aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2010-07-22 23:12:10 +0200
committerBazaar Package Importer <james.westby@ubuntu.com>2010-07-22 23:12:10 +0200
commit6383dbb01af071843bd8089fd48f173540734148 (patch)
tree101cc9ea1b424973a7c43cd7ce7bb9c4f9ac66aa
parent944907b441affebd907605ccd1f825e801650427 (diff)
parent1777ee4291dc792ca3d4df087c8af23cd8458961 (diff)
downloadayatana-indicator-sound-6383dbb01af071843bd8089fd48f173540734148.tar.gz
ayatana-indicator-sound-6383dbb01af071843bd8089fd48f173540734148.tar.bz2
ayatana-indicator-sound-6383dbb01af071843bd8089fd48f173540734148.zip
Import upstream version 0.3.8
-rwxr-xr-xconfigure22
-rw-r--r--configure.ac6
-rw-r--r--src/common-defs.h1
-rw-r--r--src/metadata-menu-item.c8
-rw-r--r--src/metadata-menu-item.vala6
-rw-r--r--src/mpris-controller.c292
-rw-r--r--src/mpris-controller.vala71
-rw-r--r--src/music-player-bridge.c24
-rw-r--r--src/music-player-bridge.h3
-rw-r--r--src/music-player-bridge.vala7
-rw-r--r--src/play-button.c219
-rw-r--r--src/play-button.h7
-rw-r--r--src/player-controller.c67
-rw-r--r--src/player-controller.vala13
-rw-r--r--src/player-item.c5
-rw-r--r--src/player-item.vala4
-rw-r--r--src/scrub-menu-item.c1
-rw-r--r--src/scrub-menu-item.vala4
-rw-r--r--src/scrub-widget.c178
-rw-r--r--src/transport-menu-item.c5
-rw-r--r--src/transport-menu-item.vala1
-rw-r--r--src/transport-widget.c2
-rw-r--r--vapi/common-defs.vapi1
23 files changed, 598 insertions, 349 deletions
diff --git a/configure b/configure
index 9d3d42c..ef18d47 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for indicator-sound 0.3.7.
+# Generated by GNU Autoconf 2.65 for indicator-sound 0.3.8.
#
# Report bugs to <conor.curran@canonical.com>.
#
@@ -761,8 +761,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='indicator-sound'
PACKAGE_TARNAME='indicator-sound'
-PACKAGE_VERSION='0.3.7'
-PACKAGE_STRING='indicator-sound 0.3.7'
+PACKAGE_VERSION='0.3.8'
+PACKAGE_STRING='indicator-sound 0.3.8'
PACKAGE_BUGREPORT='conor.curran@canonical.com'
PACKAGE_URL=''
@@ -1555,7 +1555,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures indicator-sound 0.3.7 to adapt to many kinds of systems.
+\`configure' configures indicator-sound 0.3.8 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1625,7 +1625,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of indicator-sound 0.3.7:";;
+ short | recursive ) echo "Configuration of indicator-sound 0.3.8:";;
esac
cat <<\_ACEOF
@@ -1752,7 +1752,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-sound configure 0.3.7
+indicator-sound configure 0.3.8
generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
@@ -2123,7 +2123,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by indicator-sound $as_me 0.3.7, which was
+It was created by indicator-sound $as_me 0.3.8, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -2936,7 +2936,7 @@ fi
# Define the identity of the package.
PACKAGE=indicator-sound
- VERSION=0.3.7
+ VERSION=0.3.8
cat >>confdefs.h <<_ACEOF
@@ -12111,7 +12111,7 @@ INDICATOR_REQUIRED_VERSION=0.3.6
DBUSMENUGTK_REQUIRED_VERSION=0.2.2
POLKIT_REQUIRED_VERSION=0.92
PULSE_AUDIO_REQUIRED_VERSION=0.9.19
-INDICATOR_DISPLAY_OBJECTS=0.1.9
+INDICATOR_DISPLAY_OBJECTS=0.1.10
INDICATE_REQUIRED_VERSION=0.4.1
DBUSMENUGLIB_REQUIRED_VERSION=0.3.1
@@ -14069,7 +14069,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by indicator-sound $as_me 0.3.7, which was
+This file was extended by indicator-sound $as_me 0.3.8, which was
generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14135,7 +14135,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-indicator-sound config.status 0.3.7
+indicator-sound config.status 0.3.8
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 222a3da..8dcaaea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,10 +1,10 @@
-AC_INIT(indicator-sound, 0.3.7, conor.curran@canonical.com)
+AC_INIT(indicator-sound, 0.3.8, conor.curran@canonical.com)
AC_PREREQ(2.53)
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(indicator-sound, 0.3.7)
+AM_INIT_AUTOMAKE(indicator-sound, 0.3.8)
AM_MAINTAINER_MODE
@@ -33,7 +33,7 @@ INDICATOR_REQUIRED_VERSION=0.3.6
DBUSMENUGTK_REQUIRED_VERSION=0.2.2
POLKIT_REQUIRED_VERSION=0.92
PULSE_AUDIO_REQUIRED_VERSION=0.9.19
-INDICATOR_DISPLAY_OBJECTS=0.1.9
+INDICATOR_DISPLAY_OBJECTS=0.1.10
INDICATE_REQUIRED_VERSION=0.4.1
DBUSMENUGLIB_REQUIRED_VERSION=0.3.1
diff --git a/src/common-defs.h b/src/common-defs.h
index 76e9558..208c8cb 100644
--- a/src/common-defs.h
+++ b/src/common-defs.h
@@ -41,4 +41,5 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#define DBUSMENU_SCRUB_MENUITEM_TYPE "x-canonical-sound-menu-player-scrub-menu-item"
#define DBUSMENU_SCRUB_MENUITEM_DURATION "x-canonical-sound-menu-player-scrub-time"
#define DBUSMENU_SCRUB_MENUITEM_POSITION "x-canonical-sound-menu-player-scrub-position"
+#define DBUSMENU_SCRUB_MENUITEM_PLAY_STATE "x-canonical-sound-menu-player-scrub-play-state"
diff --git a/src/metadata-menu-item.c b/src/metadata-menu-item.c
index f297708..792b638 100644
--- a/src/metadata-menu-item.c
+++ b/src/metadata-menu-item.c
@@ -84,7 +84,7 @@ enum {
MetadataMenuitem* metadata_menuitem_new (void);
MetadataMenuitem* metadata_menuitem_construct (GType object_type);
GeeHashSet* metadata_menuitem_attributes_format (void);
-gboolean metadata_menuitem_populated (MetadataMenuitem* self);
+gboolean metadata_menuitem_not_populated (MetadataMenuitem* self);
static int _vala_strcmp0 (const char * str1, const char * str2);
@@ -114,12 +114,12 @@ GeeHashSet* metadata_menuitem_attributes_format (void) {
}
-gboolean metadata_menuitem_populated (MetadataMenuitem* self) {
+gboolean metadata_menuitem_not_populated (MetadataMenuitem* self) {
gboolean result = FALSE;
gboolean _tmp0_ = FALSE;
g_return_val_if_fail (self != NULL, FALSE);
- if (dbusmenu_menuitem_property_get ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_TITLE) != NULL) {
- _tmp0_ = _vala_strcmp0 (dbusmenu_menuitem_property_get ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_TITLE), "") != 0;
+ if (dbusmenu_menuitem_property_get ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_TITLE) == NULL) {
+ _tmp0_ = _vala_strcmp0 (dbusmenu_menuitem_property_get ((DbusmenuMenuitem*) self, DBUSMENU_METADATA_MENUITEM_TITLE), "") == 0;
} else {
_tmp0_ = FALSE;
}
diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala
index 3af9ff1..388ef81 100644
--- a/src/metadata-menu-item.vala
+++ b/src/metadata-menu-item.vala
@@ -38,10 +38,10 @@ public class MetadataMenuitem : PlayerItem
return attrs;
}
- public bool populated()
+ public bool not_populated()
{
- return (this.property_get(MENUITEM_TITLE) != null &&
- this.property_get(MENUITEM_TITLE) != "");
+ return (this.property_get(MENUITEM_TITLE) == null &&
+ this.property_get(MENUITEM_TITLE) == "");
}
} \ No newline at end of file
diff --git a/src/mpris-controller.c b/src/mpris-controller.c
index 0d84330..4131b5f 100644
--- a/src/mpris-controller.c
+++ b/src/mpris-controller.c
@@ -118,6 +118,9 @@ struct _MprisControllerPrivate {
struct _MprisControllerstatus {
gint32 playback;
+ gint32 shuffle;
+ gint32 repeat;
+ gint32 endless;
};
struct _PlayerController {
@@ -179,24 +182,23 @@ GType scrub_menuitem_get_type (void);
static gint32 _dynamic_PositionGet3 (DBusGProxy* self, GError** error);
void scrub_menuitem_update_position (ScrubMenuitem* self, gint32 new_position);
static void mpris_controller_initial_update (MprisController* self);
-void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
-static GHashTable* _dynamic_GetMetadata4 (DBusGProxy* self, GError** error);
-static gint32 _dynamic_PositionGet5 (DBusGProxy* self, GError** error);
-static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* mpris_client, GHashTable* ht);
GType transport_menuitem_action_get_type (void);
-static void _dynamic_GetStatus6 (DBusGProxy* self, MprisControllerstatus* result, GError** error);
-static void _dynamic_Play7 (DBusGProxy* self, GError** error);
-static void _dynamic_Pause8 (DBusGProxy* self, GError** error);
-static void _dynamic_Prev9 (DBusGProxy* self, GError** error);
-static void _dynamic_Next10 (DBusGProxy* self, GError** error);
+static void _dynamic_Pause4 (DBusGProxy* self, GError** error);
+static void _dynamic_Prev5 (DBusGProxy* self, GError** error);
+static void _dynamic_Next6 (DBusGProxy* self, GError** error);
void mpris_controller_transport_event (MprisController* self, TransportMenuitemaction command);
-static GHashTable* _dynamic_GetMetadata11 (DBusGProxy* self, GError** error);
+static GHashTable* _dynamic_GetMetadata7 (DBusGProxy* self, GError** error);
static GValue* _g_value_dup (GValue* self);
-static void _dynamic_PositionSet12 (DBusGProxy* self, gint32 param1, GError** error);
+static void _dynamic_PositionSet8 (DBusGProxy* self, gint32 param1, GError** error);
+static gint32 _dynamic_PositionGet9 (DBusGProxy* self, GError** error);
void mpris_controller_set_position (MprisController* self, double position);
gboolean mpris_controller_connected (MprisController* self);
GeeHashSet* transport_menuitem_attributes_format (void);
static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy* mpris_client, MprisControllerstatus* st);
+void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
+static GHashTable* _dynamic_GetMetadata10 (DBusGProxy* self, GError** error);
+static gint32 _dynamic_PositionGet11 (DBusGProxy* self, GError** error);
+static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* mpris_client, GHashTable* ht);
static void mpris_controller_set_mpris_player (MprisController* self, DBusGProxy* value);
static void mpris_controller_set_owner (MprisController* self, PlayerController* value);
const char* mpris_controller_get_mpris_interface (MprisController* self);
@@ -230,11 +232,14 @@ MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter
static void _dynamic_GetStatus0 (DBusGProxy* self, MprisControllerstatus* result, GError** error) {
GValueArray* dbus_result;
- dbus_g_proxy_call (self, "GetStatus", error, G_TYPE_INVALID, dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INVALID), &dbus_result, G_TYPE_INVALID);
+ dbus_g_proxy_call (self, "GetStatus", error, G_TYPE_INVALID, dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID), &dbus_result, G_TYPE_INVALID);
if (*error) {
return;
}
result->playback = g_value_get_int (&dbus_result->values[0]);
+ result->shuffle = g_value_get_int (&dbus_result->values[1]);
+ result->repeat = g_value_get_int (&dbus_result->values[2]);
+ result->endless = g_value_get_int (&dbus_result->values[3]);
}
@@ -331,99 +336,7 @@ static void mpris_controller_initial_update (MprisController* self) {
}
-static GHashTable* _dynamic_GetMetadata4 (DBusGProxy* self, GError** error) {
- GHashTable* result;
- dbus_g_proxy_call (self, "GetMetadata", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &result, G_TYPE_INVALID);
- if (*error) {
- return NULL;
- }
- return result;
-}
-
-
-static gint32 _dynamic_PositionGet5 (DBusGProxy* self, GError** error) {
- gint32 result;
- dbus_g_proxy_call (self, "PositionGet", error, G_TYPE_INVALID, G_TYPE_INT, &result, G_TYPE_INVALID);
- if (*error) {
- return 0;
- }
- return result;
-}
-
-
-static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* mpris_client, GHashTable* ht) {
- GError * _inner_error_;
- GeeHashSet* _tmp1_;
- PlayerItem* _tmp0_;
- GeeHashSet* _tmp3_;
- PlayerItem* _tmp2_;
- GeeHashSet* _tmp5_;
- PlayerItem* _tmp4_;
- GHashTable* _tmp6_;
- GeeHashSet* _tmp9_;
- GHashTable* _tmp8_;
- PlayerItem* _tmp7_;
- PlayerItem* _tmp10_;
- ScrubMenuitem* scrub;
- gint32 _tmp11_;
- g_return_if_fail (self != NULL);
- g_return_if_fail (mpris_client != NULL);
- g_return_if_fail (ht != NULL);
- _inner_error_ = NULL;
- g_debug ("mpris-controller.vala:74: onTrackChange");
- player_item_reset (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp1_ = metadata_menuitem_attributes_format ());
- _g_object_unref0 (_tmp1_);
- _g_object_unref0 (_tmp0_);
- player_item_reset (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp3_ = scrub_menuitem_attributes_format ());
- _g_object_unref0 (_tmp3_);
- _g_object_unref0 (_tmp2_);
- player_item_update (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), ht, _tmp5_ = metadata_menuitem_attributes_format ());
- _g_object_unref0 (_tmp5_);
- _g_object_unref0 (_tmp4_);
- g_debug ("mpris-controller.vala:79: about to update the duration on the scrub ba" \
-"r");
- _tmp6_ = _dynamic_GetMetadata4 (self->priv->_mpris_player, &_inner_error_);
- if (_inner_error_ != NULL) {
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return;
- }
- player_item_update (_tmp7_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp8_ = _tmp6_, _tmp9_ = scrub_menuitem_attributes_format ());
- _g_object_unref0 (_tmp9_);
- _g_hash_table_unref0 (_tmp8_);
- _g_object_unref0 (_tmp7_);
- scrub = (_tmp10_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp10_) ? ((ScrubMenuitem*) _tmp10_) : NULL);
- _tmp11_ = _dynamic_PositionGet5 (self->priv->_mpris_player, &_inner_error_);
- if (_inner_error_ != NULL) {
- _g_object_unref0 (scrub);
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return;
- }
- scrub_menuitem_update_position (scrub, _tmp11_);
- _g_object_unref0 (scrub);
-}
-
-
-static void _dynamic_GetStatus6 (DBusGProxy* self, MprisControllerstatus* result, GError** error) {
- GValueArray* dbus_result;
- dbus_g_proxy_call (self, "GetStatus", error, G_TYPE_INVALID, dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INVALID), &dbus_result, G_TYPE_INVALID);
- if (*error) {
- return;
- }
- result->playback = g_value_get_int (&dbus_result->values[0]);
-}
-
-
-static void _dynamic_Play7 (DBusGProxy* self, GError** error) {
- dbus_g_proxy_call (self, "Play", error, G_TYPE_INVALID, G_TYPE_INVALID);
- if (*error) {
- return;
- }
-}
-
-
-static void _dynamic_Pause8 (DBusGProxy* self, GError** error) {
+static void _dynamic_Pause4 (DBusGProxy* self, GError** error) {
dbus_g_proxy_call (self, "Pause", error, G_TYPE_INVALID, G_TYPE_INVALID);
if (*error) {
return;
@@ -431,7 +344,7 @@ static void _dynamic_Pause8 (DBusGProxy* self, GError** error) {
}
-static void _dynamic_Prev9 (DBusGProxy* self, GError** error) {
+static void _dynamic_Prev5 (DBusGProxy* self, GError** error) {
dbus_g_proxy_call (self, "Prev", error, G_TYPE_INVALID, G_TYPE_INVALID);
if (*error) {
return;
@@ -439,7 +352,7 @@ static void _dynamic_Prev9 (DBusGProxy* self, GError** error) {
}
-static void _dynamic_Next10 (DBusGProxy* self, GError** error) {
+static void _dynamic_Next6 (DBusGProxy* self, GError** error) {
dbus_g_proxy_call (self, "Next", error, G_TYPE_INVALID, G_TYPE_INVALID);
if (*error) {
return;
@@ -451,42 +364,18 @@ void mpris_controller_transport_event (MprisController* self, TransportMenuitema
GError * _inner_error_;
g_return_if_fail (self != NULL);
_inner_error_ = NULL;
- g_debug ("mpris-controller.vala:89: transport_event input = %i", (gint) command);
+ g_debug ("mpris-controller.vala:73: transport_event input = %i", (gint) command);
if (command == TRANSPORT_MENUITEM_ACTION_PLAY_PAUSE) {
- MprisControllerstatus _tmp0_ = {0};
- MprisControllerstatus st;
- gboolean play_state;
- gboolean new_play_state;
- st = (_dynamic_GetStatus6 (self->priv->_mpris_player, &_tmp0_, &_inner_error_), _tmp0_);
+ g_debug ("mpris-controller.vala:75: transport_event PLAY_PAUSE");
+ _dynamic_Pause4 (self->priv->_mpris_player, &_inner_error_);
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return;
}
- play_state = st.playback == 1;
- g_debug ("mpris-controller.vala:93: toggle_playback - initial play state %i", (gint) play_state);
- new_play_state = !play_state;
- g_debug ("mpris-controller.vala:95: toggle_playback - new play state %i", (gint) new_play_state);
- if (new_play_state == TRUE) {
- g_debug ("mpris-controller.vala:97: about to play");
- _dynamic_Play7 (self->priv->_mpris_player, &_inner_error_);
- if (_inner_error_ != NULL) {
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return;
- }
- } else {
- g_debug ("mpris-controller.vala:101: about to pause");
- _dynamic_Pause8 (self->priv->_mpris_player, &_inner_error_);
- if (_inner_error_ != NULL) {
- g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
- g_clear_error (&_inner_error_);
- return;
- }
- }
} else {
if (command == TRANSPORT_MENUITEM_ACTION_PREVIOUS) {
- _dynamic_Prev9 (self->priv->_mpris_player, &_inner_error_);
+ _dynamic_Prev5 (self->priv->_mpris_player, &_inner_error_);
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -494,7 +383,7 @@ void mpris_controller_transport_event (MprisController* self, TransportMenuitema
}
} else {
if (command == TRANSPORT_MENUITEM_ACTION_NEXT) {
- _dynamic_Next10 (self->priv->_mpris_player, &_inner_error_);
+ _dynamic_Next6 (self->priv->_mpris_player, &_inner_error_);
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -506,7 +395,7 @@ void mpris_controller_transport_event (MprisController* self, TransportMenuitema
}
-static GHashTable* _dynamic_GetMetadata11 (DBusGProxy* self, GError** error) {
+static GHashTable* _dynamic_GetMetadata7 (DBusGProxy* self, GError** error) {
GHashTable* result;
dbus_g_proxy_call (self, "GetMetadata", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &result, G_TYPE_INVALID);
if (*error) {
@@ -526,7 +415,7 @@ static gpointer __g_value_dup0 (gpointer self) {
}
-static void _dynamic_PositionSet12 (DBusGProxy* self, gint32 param1, GError** error) {
+static void _dynamic_PositionSet8 (DBusGProxy* self, gint32 param1, GError** error) {
dbus_g_proxy_call (self, "PositionSet", error, G_TYPE_INT, param1, G_TYPE_INVALID, G_TYPE_INVALID);
if (*error) {
return;
@@ -534,15 +423,29 @@ static void _dynamic_PositionSet12 (DBusGProxy* self, gint32 param1, GError** er
}
+static gint32 _dynamic_PositionGet9 (DBusGProxy* self, GError** error) {
+ gint32 result;
+ dbus_g_proxy_call (self, "PositionGet", error, G_TYPE_INVALID, G_TYPE_INT, &result, G_TYPE_INVALID);
+ if (*error) {
+ return 0;
+ }
+ return result;
+}
+
+
void mpris_controller_set_position (MprisController* self, double position) {
GError * _inner_error_;
GHashTable* data;
GValue* time_value;
guint32 total_time;
double new_time_position;
+ PlayerItem* _tmp0_;
+ ScrubMenuitem* scrub;
+ gint32 _tmp1_;
g_return_if_fail (self != NULL);
_inner_error_ = NULL;
- data = _dynamic_GetMetadata11 (self->priv->_mpris_player, &_inner_error_);
+ g_debug ("mpris-controller.vala:88: Set position with pos (0-100) %f", position);
+ data = _dynamic_GetMetadata7 (self->priv->_mpris_player, &_inner_error_);
if (_inner_error_ != NULL) {
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
@@ -550,24 +453,38 @@ void mpris_controller_set_position (MprisController* self, double position) {
}
time_value = __g_value_dup0 ((GValue*) g_hash_table_lookup (data, "time"));
if (time_value == NULL) {
- g_warning ("mpris-controller.vala:119: Can't fetch the duration of the track there" \
-"fore cant set the position");
+ g_warning ("mpris-controller.vala:92: Can't fetch the duration of the track theref" \
+"ore cant set the position");
_g_hash_table_unref0 (data);
_g_free0 (time_value);
return;
}
total_time = (guint32) g_value_get_uint (time_value);
+ g_debug ("mpris-controller.vala:96: total time of track = %i", (gint) total_time);
new_time_position = (total_time * position) / 100.0;
- _dynamic_PositionSet12 (self->priv->_mpris_player, (gint32) (new_time_position * 1000), &_inner_error_);
+ g_debug ("mpris-controller.vala:98: new position = %f", new_time_position * 1000);
+ _dynamic_PositionSet8 (self->priv->_mpris_player, (gint32) new_time_position, &_inner_error_);
+ if (_inner_error_ != NULL) {
+ _g_hash_table_unref0 (data);
+ _g_free0 (time_value);
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ return;
+ }
+ scrub = (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp0_) ? ((ScrubMenuitem*) _tmp0_) : NULL);
+ _tmp1_ = _dynamic_PositionGet9 (self->priv->_mpris_player, &_inner_error_);
if (_inner_error_ != NULL) {
_g_hash_table_unref0 (data);
_g_free0 (time_value);
+ _g_object_unref0 (scrub);
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
g_clear_error (&_inner_error_);
return;
}
+ scrub_menuitem_update_position (scrub, _tmp1_);
_g_hash_table_unref0 (data);
_g_free0 (time_value);
+ _g_object_unref0 (scrub);
}
@@ -587,13 +504,15 @@ static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy*
GValue v = {0};
GeeHashSet* _tmp1_;
PlayerItem* _tmp0_;
+ GeeHashSet* _tmp3_;
+ PlayerItem* _tmp2_;
g_return_if_fail (self != NULL);
g_return_if_fail (mpris_client != NULL);
- g_debug ("mpris-controller.vala:136: onStatusChange - signal received");
+ g_debug ("mpris-controller.vala:111: onStatusChange - signal received");
status = st;
ar = (GValueArray*) status;
play_state = g_value_get_int (g_value_array_get_nth (ar, (guint) 0));
- g_debug ("mpris-controller.vala:140: onStatusChange - play state %i", play_state);
+ g_debug ("mpris-controller.vala:115: onStatusChange - play state %i", play_state);
ht = g_hash_table_new (g_str_hash, g_str_equal);
g_value_init (&v, G_TYPE_INT);
g_value_set_int (&v, play_state);
@@ -601,11 +520,88 @@ static void mpris_controller_onStatusChange (MprisController* self, DBusGProxy*
player_item_update (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), ht, _tmp1_ = transport_menuitem_attributes_format ());
_g_object_unref0 (_tmp1_);
_g_object_unref0 (_tmp0_);
+ player_item_update (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), ht, _tmp3_ = scrub_menuitem_attributes_format ());
+ _g_object_unref0 (_tmp3_);
+ _g_object_unref0 (_tmp2_);
_g_hash_table_unref0 (ht);
G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
}
+static GHashTable* _dynamic_GetMetadata10 (DBusGProxy* self, GError** error) {
+ GHashTable* result;
+ dbus_g_proxy_call (self, "GetMetadata", error, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &result, G_TYPE_INVALID);
+ if (*error) {
+ return NULL;
+ }
+ return result;
+}
+
+
+static gint32 _dynamic_PositionGet11 (DBusGProxy* self, GError** error) {
+ gint32 result;
+ dbus_g_proxy_call (self, "PositionGet", error, G_TYPE_INVALID, G_TYPE_INT, &result, G_TYPE_INVALID);
+ if (*error) {
+ return 0;
+ }
+ return result;
+}
+
+
+static void mpris_controller_onTrackChange (MprisController* self, DBusGProxy* mpris_client, GHashTable* ht) {
+ GError * _inner_error_;
+ GeeHashSet* _tmp1_;
+ PlayerItem* _tmp0_;
+ GeeHashSet* _tmp3_;
+ PlayerItem* _tmp2_;
+ GeeHashSet* _tmp5_;
+ PlayerItem* _tmp4_;
+ GHashTable* _tmp6_;
+ GeeHashSet* _tmp9_;
+ GHashTable* _tmp8_;
+ PlayerItem* _tmp7_;
+ PlayerItem* _tmp10_;
+ ScrubMenuitem* scrub;
+ gint32 _tmp11_;
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (mpris_client != NULL);
+ g_return_if_fail (ht != NULL);
+ _inner_error_ = NULL;
+ g_debug ("mpris-controller.vala:126: onTrackChange");
+ player_item_reset (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp1_ = metadata_menuitem_attributes_format ());
+ _g_object_unref0 (_tmp1_);
+ _g_object_unref0 (_tmp0_);
+ player_item_reset (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp3_ = scrub_menuitem_attributes_format ());
+ _g_object_unref0 (_tmp3_);
+ _g_object_unref0 (_tmp2_);
+ player_item_update (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), ht, _tmp5_ = metadata_menuitem_attributes_format ());
+ _g_object_unref0 (_tmp5_);
+ _g_object_unref0 (_tmp4_);
+ g_debug ("mpris-controller.vala:131: about to update the duration on the scrub b" \
+"ar");
+ _tmp6_ = _dynamic_GetMetadata10 (self->priv->_mpris_player, &_inner_error_);
+ if (_inner_error_ != NULL) {
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ return;
+ }
+ player_item_update (_tmp7_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp8_ = _tmp6_, _tmp9_ = scrub_menuitem_attributes_format ());
+ _g_object_unref0 (_tmp9_);
+ _g_hash_table_unref0 (_tmp8_);
+ _g_object_unref0 (_tmp7_);
+ scrub = (_tmp10_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->priv->_owner->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), IS_SCRUB_MENUITEM (_tmp10_) ? ((ScrubMenuitem*) _tmp10_) : NULL);
+ _tmp11_ = _dynamic_PositionGet11 (self->priv->_mpris_player, &_inner_error_);
+ if (_inner_error_ != NULL) {
+ _g_object_unref0 (scrub);
+ g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
+ g_clear_error (&_inner_error_);
+ return;
+ }
+ scrub_menuitem_update_position (scrub, _tmp11_);
+ _g_object_unref0 (scrub);
+}
+
+
DBusGProxy* mpris_controller_get_mpris_player (MprisController* self) {
DBusGProxy* result;
g_return_val_if_fail (self != NULL, NULL);
@@ -677,8 +673,8 @@ static void _mpris_controller_onStatusChange_dynamic_StatusChange2_ (DBusGProxy*
void _dynamic_StatusChange3_connect (gpointer obj, const char * signal_name, GCallback handler, gpointer data) {
- dbus_g_object_register_marshaller (g_cclosure_user_marshal_VOID__BOXED, G_TYPE_NONE, dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INVALID), G_TYPE_INVALID);
- dbus_g_proxy_add_signal (obj, "StatusChange", dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INVALID), G_TYPE_INVALID);
+ dbus_g_object_register_marshaller (g_cclosure_user_marshal_VOID__BOXED, G_TYPE_NONE, dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID), G_TYPE_INVALID);
+ dbus_g_proxy_add_signal (obj, "StatusChange", dbus_g_type_get_struct ("GValueArray", G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INVALID), G_TYPE_INVALID);
dbus_g_proxy_connect_signal (obj, signal_name, handler, data, NULL);
}
@@ -727,8 +723,8 @@ static GObject * mpris_controller_constructor (GType type, guint n_construct_pro
_g_object_unref0 (_tmp4_);
_g_free0 (_tmp3_);
_g_free0 (_tmp2_);
- g_debug ("mpris-controller.vala:49: just attempting to establish an mpris connec" \
-"tion to %s, %s, %s", _tmp6_ = g_strconcat ("org.mpris.", _tmp5_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/Player", self->priv->_mpris_interface);
+ g_debug ("mpris-controller.vala:49: Attempting to establish an mpris connection " \
+"to %s, %s, %s", _tmp6_ = g_strconcat ("org.mpris.", _tmp5_ = g_utf8_strdown (player_controller_get_name (self->priv->_owner), -1), NULL), "/Player", self->priv->_mpris_interface);
_g_free0 (_tmp6_);
_g_free0 (_tmp5_);
_dynamic_TrackChange1_connect (self->priv->_mpris_player, "TrackChange", (GCallback) _mpris_controller_onTrackChange_dynamic_TrackChange0_, self);
diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala
index 5e4dce2..8ecd20a 100644
--- a/src/mpris-controller.vala
+++ b/src/mpris-controller.vala
@@ -29,9 +29,9 @@ public class MprisController : GLib.Object
struct status {
public int32 playback;
- //public int32 shuffle; // Not used just yet
- //public int32 repeat;
- //public int32 endless;
+ public int32 shuffle;
+ public int32 repeat;
+ public int32 endless;
}
public MprisController(PlayerController ctrl, string inter="org.freedesktop.MediaPlayer"){
@@ -46,7 +46,7 @@ public class MprisController : GLib.Object
}
this.mpris_player = this.connection.get_object ("org.mpris.".concat(this.owner.name.down()) , "/Player", this.mpris_interface);
- debug("just attempting to establish an mpris connection to %s, %s, %s", "org.mpris.".concat(this.owner.name.down()) , "/Player", this.mpris_interface);
+ debug("Attempting to establish an mpris connection to %s, %s, %s", "org.mpris.".concat(this.owner.name.down()) , "/Player", this.mpris_interface);
this.mpris_player.TrackChange += onTrackChange;
this.mpris_player.StatusChange += onStatusChange;
@@ -65,42 +65,15 @@ public class MprisController : GLib.Object
ScrubMenuitem.attributes_format());
// temporary fix
ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem;
- scrub.update_position(this.mpris_player.PositionGet());
-
- }
-
- private void onTrackChange(dynamic DBus.Object mpris_client, HashTable<string,Value?> ht)
- {
- debug("onTrackChange");
- this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format());
- this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format());
- this.owner.custom_items[PlayerController.widget_order.METADATA].update(ht,
- MetadataMenuitem.attributes_format());
- debug("about to update the duration on the scrub bar");
- this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(),
- ScrubMenuitem.attributes_format());
- // temporary fix
- ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem;
- scrub.update_position(this.mpris_player.PositionGet());
+ scrub.update_position(this.mpris_player.PositionGet());
}
public void transport_event(TransportMenuitem.action command)
{
debug("transport_event input = %i", (int)command);
if(command == TransportMenuitem.action.PLAY_PAUSE){
- status st = this.mpris_player.GetStatus();
- bool play_state = st.playback == 1;
- debug("toggle_playback - initial play state %i", (int)play_state);
- bool new_play_state = !play_state;
- debug("toggle_playback - new play state %i", (int)new_play_state);
- if(new_play_state == true){
- debug("about to play");
- this.mpris_player.Play();
- }
- else{
- debug("about to pause");
- this.mpris_player.Pause();
- }
+ debug("transport_event PLAY_PAUSE");
+ this.mpris_player.Pause();
}
else if(command == TransportMenuitem.action.PREVIOUS){
this.mpris_player.Prev();
@@ -112,7 +85,7 @@ public class MprisController : GLib.Object
public void set_position(double position)
{
- //debug("Set position with pos (0-100) %f", position);
+ debug("Set position with pos (0-100) %f", position);
HashTable<string, Value?> data = this.mpris_player.GetMetadata();
Value? time_value = data.lookup("time");
if(time_value == null){
@@ -120,10 +93,12 @@ public class MprisController : GLib.Object
return;
}
uint32 total_time = time_value.get_uint();
- //debug("total time of track = %i", (int)total_time);
+ debug("total time of track = %i", (int)total_time);
double new_time_position = total_time * position/100.0;
- //debug("new position = %f", (new_time_position * 1000));
- this.mpris_player.PositionSet((int32)(new_time_position * 1000));
+ debug("new position = %f", (new_time_position * 1000));
+ this.mpris_player.PositionSet((int32)(new_time_position));
+ ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem;
+ scrub.update_position(this.mpris_player.PositionGet());
}
public bool connected()
@@ -133,7 +108,7 @@ public class MprisController : GLib.Object
private void onStatusChange(dynamic DBus.Object mpris_client, status st)
{
- debug("onStatusChange - signal received");
+ debug("onStatusChange - signal received");
status* status = &st;
unowned ValueArray ar = (ValueArray)status;
int play_state = ar.get_nth(0).get_int();
@@ -143,7 +118,23 @@ public class MprisController : GLib.Object
v.set_int(play_state);
ht.insert("state", v);
this.owner.custom_items[PlayerController.widget_order.TRANSPORT].update(ht, TransportMenuitem.attributes_format());
+ this.owner.custom_items[PlayerController.widget_order.SCRUB].update(ht, ScrubMenuitem.attributes_format());
}
-
+
+ private void onTrackChange(dynamic DBus.Object mpris_client, HashTable<string,Value?> ht)
+ {
+ debug("onTrackChange");
+ this.owner.custom_items[PlayerController.widget_order.METADATA].reset(MetadataMenuitem.attributes_format());
+ this.owner.custom_items[PlayerController.widget_order.SCRUB].reset(ScrubMenuitem.attributes_format());
+ this.owner.custom_items[PlayerController.widget_order.METADATA].update(ht,
+ MetadataMenuitem.attributes_format());
+ debug("about to update the duration on the scrub bar");
+ this.owner.custom_items[PlayerController.widget_order.SCRUB].update(this.mpris_player.GetMetadata(),
+ ScrubMenuitem.attributes_format());
+ // temporary fix
+ ScrubMenuitem scrub = this.owner.custom_items[PlayerController.widget_order.SCRUB] as ScrubMenuitem;
+ scrub.update_position(this.mpris_player.PositionGet());
+ }
+
}
diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c
index 196eefa..aa4e5dd 100644
--- a/src/music-player-bridge.c
+++ b/src/music-player-bridge.c
@@ -329,7 +329,7 @@ void music_player_bridge_on_server_added (MusicPlayerBridge* self, IndicateListe
PlayerController* ctrl;
ctrl = player_controller_new (self->priv->root_menu, client_name, music_player_bridge_calculate_menu_position (self), PLAYER_CONTROLLER_STATE_READY);
gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, client_name, ctrl);
- g_debug ("music-player-bridge.vala:104: New Client of name %s has successfully r" \
+ g_debug ("music-player-bridge.vala:103: New Client of name %s has successfully r" \
"egistered with us", client_name);
_g_object_unref0 (ctrl);
}
@@ -352,7 +352,7 @@ void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateLis
gboolean _tmp3_ = FALSE;
g_return_if_fail (self != NULL);
g_return_if_fail (type != NULL);
- g_debug ("music-player-bridge.vala:116: MusicPlayerBridge -> on_server_removed w" \
+ g_debug ("music-player-bridge.vala:115: MusicPlayerBridge -> on_server_removed w" \
"ith value %s", type);
if (music_player_bridge_server_is_not_of_interest (self, type)) {
return;
@@ -368,7 +368,7 @@ void music_player_bridge_on_server_removed (MusicPlayerBridge* self, IndicateLis
player_controller_vanish (_tmp4_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, client_name));
_g_object_unref0 (_tmp4_);
gee_map_remove ((GeeMap*) self->priv->registered_clients, client_name, NULL);
- g_debug ("music-player-bridge.vala:122: Successively removed menu_item for clien" \
+ g_debug ("music-player-bridge.vala:121: Successively removed menu_item for clien" \
"t %s from registered_clients", client_name);
}
_g_free0 (client_name);
@@ -393,7 +393,7 @@ static gboolean music_player_bridge_server_is_not_of_interest (MusicPlayerBridge
return result;
}
if (string_contains (type, "music") == FALSE) {
- g_debug ("music-player-bridge.vala:130: server is of no interest, it is not an " \
+ g_debug ("music-player-bridge.vala:129: server is of no interest, it is not an " \
"music server");
result = TRUE;
return result;
@@ -417,7 +417,7 @@ static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self,
}
if (_tmp1_) {
GAppInfo* app_info;
- g_debug ("music-player-bridge.vala:141: About to store desktop file path: %s", path);
+ g_debug ("music-player-bridge.vala:140: About to store desktop file path: %s", path);
familiar_players_db_insert (bridge->priv->playersDB, path);
app_info = music_player_bridge_create_app_info (path);
if (app_info != NULL) {
@@ -427,13 +427,13 @@ static void music_player_bridge_desktop_info_callback (MusicPlayerBridge* self,
PlayerController* ctrl;
ctrl = (_tmp4_ = (PlayerController*) gee_abstract_map_get ((GeeAbstractMap*) bridge->priv->registered_clients, _tmp3_ = string_strip (_tmp2_ = g_utf8_strdown (g_app_info_get_name (app_info), -1))), _g_free0 (_tmp3_), _g_free0 (_tmp2_), _tmp4_);
g_object_set ((GObject*) ctrl, "app_info", app_info, NULL);
- g_debug ("music-player-bridge.vala:147: successfully created appinfo from path a" \
+ g_debug ("music-player-bridge.vala:146: successfully created appinfo from path a" \
"nd set it on the respective instance");
_g_object_unref0 (ctrl);
}
_g_object_unref0 (app_info);
} else {
- g_debug ("music-player-bridge.vala:151: Ignoring desktop file path because its e" \
+ g_debug ("music-player-bridge.vala:150: Ignoring desktop file path because its e" \
"ither invalid of the db cache file has it already: %s", path);
}
_g_object_unref0 (bridge);
@@ -452,20 +452,20 @@ void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMe
void music_player_bridge_on_server_count_changed (MusicPlayerBridge* self, IndicateListenerServer* object, guint i) {
g_return_if_fail (self != NULL);
- g_debug ("music-player-bridge.vala:163: MusicPlayerBridge-> on_server_count_chan" \
+ g_debug ("music-player-bridge.vala:162: MusicPlayerBridge-> on_server_count_chan" \
"ged with value %u", i);
}
void music_player_bridge_on_indicator_added (MusicPlayerBridge* self, IndicateListenerServer* object, IndicateListenerIndicator* p0) {
g_return_if_fail (self != NULL);
- g_debug ("music-player-bridge.vala:167: MusicPlayerBridge-> on_indicator_added");
+ g_debug ("music-player-bridge.vala:166: MusicPlayerBridge-> on_indicator_added");
}
void music_player_bridge_on_indicator_removed (MusicPlayerBridge* self, IndicateListenerServer* object, IndicateListenerIndicator* p0) {
g_return_if_fail (self != NULL);
- g_debug ("music-player-bridge.vala:172: MusicPlayerBridge -> on_indicator_remove" \
+ g_debug ("music-player-bridge.vala:171: MusicPlayerBridge -> on_indicator_remove" \
"d");
}
@@ -473,7 +473,7 @@ void music_player_bridge_on_indicator_removed (MusicPlayerBridge* self, Indicate
void music_player_bridge_on_indicator_modified (MusicPlayerBridge* self, IndicateListenerServer* object, IndicateListenerIndicator* p0, const char* s) {
g_return_if_fail (self != NULL);
g_return_if_fail (s != NULL);
- g_debug ("music-player-bridge.vala:177: MusicPlayerBridge -> indicator_modified " \
+ g_debug ("music-player-bridge.vala:176: MusicPlayerBridge -> indicator_modified " \
"with vale %s", s);
}
@@ -486,7 +486,7 @@ GAppInfo* music_player_bridge_create_app_info (const char* path) {
g_return_val_if_fail (path != NULL, NULL);
info = g_desktop_app_info_new_from_filename (path);
if (path == NULL) {
- g_warning ("music-player-bridge.vala:184: Could not create a desktopappinfo instan" \
+ g_warning ("music-player-bridge.vala:183: Could not create a desktopappinfo instan" \
"ce from app: %s", path);
result = NULL;
_g_object_unref0 (info);
diff --git a/src/music-player-bridge.h b/src/music-player-bridge.h
index b885a7b..03c8831 100644
--- a/src/music-player-bridge.h
+++ b/src/music-player-bridge.h
@@ -282,7 +282,7 @@ GType metadata_menuitem_get_type (void);
MetadataMenuitem* metadata_menuitem_new (void);
MetadataMenuitem* metadata_menuitem_construct (GType object_type);
GeeHashSet* metadata_menuitem_attributes_format (void);
-gboolean metadata_menuitem_populated (MetadataMenuitem* self);
+gboolean metadata_menuitem_not_populated (MetadataMenuitem* self);
GType scrub_menuitem_get_type (void);
ScrubMenuitem* scrub_menuitem_new (PlayerController* parent);
ScrubMenuitem* scrub_menuitem_construct (GType object_type, PlayerController* parent);
@@ -302,6 +302,7 @@ void player_controller_update_state (PlayerController* self, PlayerControllersta
void player_controller_activate (PlayerController* self);
void player_controller_instantiate (PlayerController* self);
void player_controller_vanish (PlayerController* self);
+void player_controller_update_layout (PlayerController* self);
const char* player_controller_get_name (PlayerController* self);
void player_controller_set_name (PlayerController* self, const char* value);
GAppInfo* player_controller_get_app_info (PlayerController* self);
diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala
index 3ee7b55..352ea7f 100644
--- a/src/music-player-bridge.vala
+++ b/src/music-player-bridge.vala
@@ -35,7 +35,7 @@ public class MusicPlayerBridge : GLib.Object
playersDB = new FamiliarPlayersDB();
registered_clients = new HashMap<string, PlayerController> ();
listener = Listener.ref_default();
- listener.indicator_added.connect(on_indicator_added);
+ listener.indicator_added += on_indicator_added;
listener.indicator_removed.connect(on_indicator_removed);
listener.indicator_modified.connect(on_indicator_modified);
listener.server_added.connect(on_server_added);
@@ -99,8 +99,7 @@ public class MusicPlayerBridge : GLib.Object
client_name,
calculate_menu_position(),
PlayerController.state.READY);
- registered_clients.set(client_name, ctrl);
-
+ registered_clients.set(client_name, ctrl);
debug("New Client of name %s has successfully registered with us", client_name);
}
// irregardless check that it has a desktop file if not kick off a request for it
@@ -162,7 +161,7 @@ public class MusicPlayerBridge : GLib.Object
{
debug("MusicPlayerBridge-> on_server_count_changed with value %u", i);
}
- public void on_indicator_added(Indicate.ListenerServer object, Indicate.ListenerIndicator p0)
+ public void on_indicator_added(ListenerServer object, ListenerIndicator p0)
{
debug("MusicPlayerBridge-> on_indicator_added");
}
diff --git a/src/play-button.c b/src/play-button.c
index cac2bc3..1aeff12 100644
--- a/src/play-button.c
+++ b/src/play-button.c
@@ -52,13 +52,9 @@ Uses code from ctk
#define BAR_OFFSET 10.0f
#define PAUSE_X 77.0f
#define PAUSE_Y 15.0f
-
-
-// Transport updates
-enum{
- PAUSE,
- PLAY
-};
+#define PLAY_WIDTH 28.0f
+#define PLAY_HEIGHT 29.0f
+#define PLAY_PADDING 5.0f
typedef struct _PlayButtonPrivate PlayButtonPrivate;
@@ -70,6 +66,8 @@ struct _PlayButtonPrivate
GdkColor foreground_colour_fg;
GdkColor foreground_colour_bg;
PlayButtonEvent current_command;
+ PlayButtonState current_state;
+ GHashTable* command_coordinates;
};
#define PLAY_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PLAY_BUTTON_TYPE, PlayButtonPrivate))
@@ -87,7 +85,7 @@ G_DEFINE_TYPE (PlayButton, play_button, GTK_TYPE_DRAWING_AREA);
/// internal helper functions //////////////////////////////////////////////////
-static double
+/*static double
_align (double val)
{
double fract = val - (int) val;
@@ -96,7 +94,7 @@ _align (double val)
return (double) ((int) val + 0.5f);
else
return val;
-}
+}*/
static inline void
_blurinner (guchar* pixel,
@@ -309,8 +307,7 @@ _surface_blur (cairo_surface_t* surface,
static void
play_button_class_init (PlayButtonClass *klass)
-{
-
+{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
@@ -327,6 +324,41 @@ play_button_init (PlayButton *self)
{
PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(self);
priv->current_command = TRANSPORT_NADA;
+ priv->current_state = PAUSE;
+ priv->command_coordinates = g_hash_table_new_full(g_direct_hash,
+ g_direct_equal,
+ NULL,
+ (GDestroyNotify)g_list_free);
+ GList* previous_list = NULL;
+ previous_list = g_list_insert(previous_list, GINT_TO_POINTER(15), 0);
+ previous_list = g_list_insert(previous_list, GINT_TO_POINTER(10), 1);
+ previous_list = g_list_insert(previous_list, GINT_TO_POINTER(60), 2);
+ previous_list = g_list_insert(previous_list, GINT_TO_POINTER(34), 3);
+
+ g_hash_table_insert(priv->command_coordinates,
+ GINT_TO_POINTER(TRANSPORT_PREVIOUS),
+ previous_list);
+
+ GList* play_list = NULL;
+ play_list = g_list_insert(play_list, GINT_TO_POINTER(60), 0);
+ play_list = g_list_insert(play_list, GINT_TO_POINTER(10), 1);
+ play_list = g_list_insert(play_list, GINT_TO_POINTER(45), 2);
+ play_list = g_list_insert(play_list, GINT_TO_POINTER(40), 3);
+
+ g_hash_table_insert(priv->command_coordinates,
+ GINT_TO_POINTER(TRANSPORT_PLAY_PAUSE),
+ play_list);
+
+ GList* next_list = NULL;
+ next_list = g_list_insert(next_list, GINT_TO_POINTER(100), 0);
+ next_list = g_list_insert(next_list, GINT_TO_POINTER(10), 1);
+ next_list = g_list_insert(next_list, GINT_TO_POINTER(60), 2);
+ next_list = g_list_insert(next_list, GINT_TO_POINTER(34), 3);
+
+ g_hash_table_insert(priv->command_coordinates,
+ GINT_TO_POINTER(TRANSPORT_NEXT),
+ next_list);
+
gtk_widget_set_size_request(GTK_WIDGET(self), 200, 80);
}
@@ -391,12 +423,13 @@ play_button_react_to_button_press(GtkWidget* button, PlayButtonEvent command)
cairo_t *cr;
cr = gdk_cairo_create (button->window);
-
- /*cairo_rectangle (cr,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
- cairo_clip(cr);*/
+ GList* list = g_hash_table_lookup(priv->command_coordinates, GINT_TO_POINTER(command));
+ cairo_rectangle(cr,
+ GPOINTER_TO_INT(g_list_nth_data(list, 0)),
+ GPOINTER_TO_INT(g_list_nth_data(list, 1)),
+ GPOINTER_TO_INT(g_list_nth_data(list, 2)),
+ GPOINTER_TO_INT(g_list_nth_data(list, 3)));
+ cairo_clip(cr);
draw (button, cr);
cairo_destroy (cr);
}
@@ -407,22 +440,32 @@ play_button_react_to_button_release(GtkWidget* button)
{
g_return_if_fail(IS_PLAY_BUTTON(button));
PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(button);
- priv->current_command = TRANSPORT_NADA;
cairo_t *cr;
+
cr = gdk_cairo_create (button->window);
- /*cairo_rectangle (cr,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
+ GList* list = g_hash_table_lookup(priv->command_coordinates,
+ GINT_TO_POINTER(priv->current_command));
+
+ priv->current_command = TRANSPORT_NADA;
+
+ cairo_rectangle(cr,
+ GPOINTER_TO_INT(g_list_nth_data(list, 0)),
+ GPOINTER_TO_INT(g_list_nth_data(list, 1)),
+ GPOINTER_TO_INT(g_list_nth_data(list, 2)),
+ GPOINTER_TO_INT(g_list_nth_data(list, 3)));
- cairo_clip(cr);*/
+ cairo_clip(cr);
draw (button, cr);
cairo_destroy (cr);
}
-void
-play_button_toggle_play_pause(GtkWidget* button, int update)
+void
+play_button_toggle_play_pause(GtkWidget* button, PlayButtonState update)
{
+ PlayButtonPrivate* priv = PLAY_BUTTON_GET_PRIVATE(button);
+ priv->current_state = update;
+ g_debug("PlayButton::toggle play state : %i", priv->current_state);
}
@@ -608,6 +651,24 @@ _mask_pause (cairo_t* cr,
}
static void
+_mask_play (cairo_t* cr,
+ double x,
+ double y,
+ double tri_width,
+ double tri_height
+ /*double tri_offset*/)
+{
+ if (!cr)
+ return;
+
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x + tri_width, y + tri_height / 2.0f);
+ cairo_line_to (cr, x, y + tri_height);
+ cairo_close_path (cr);
+
+}
+
+static void
_fill (cairo_t* cr,
double x_start,
double y_start,
@@ -826,41 +887,81 @@ draw (GtkWidget* button, cairo_t *cr)
_finalize (cr, &cr_surf, &surf, NEXT_X, NEXT_Y);
// draw pause-button drop-shadow
- _setup (&cr_surf, &surf, PAUSE_WIDTH, PAUSE_HEIGHT);
- _mask_pause (cr_surf,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
- BAR_WIDTH,
- BAR_HEIGHT - 2.0f * BAR_WIDTH,
- BAR_OFFSET);
- _fill (cr_surf,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (double) BAR_HEIGHT,
- BUTTON_SHADOW,
- BUTTON_SHADOW,
- TRUE);
- _surface_blur (surf, 1);
- _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y + 1.0f);
-
- // draw pause-button
- _setup (&cr_surf, &surf, PAUSE_WIDTH, PAUSE_HEIGHT);
- _mask_pause (cr_surf,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
- BAR_WIDTH,
- BAR_HEIGHT - 2.0f * BAR_WIDTH,
- BAR_OFFSET);
- _fill (cr_surf,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
- (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
- (double) BAR_HEIGHT,
- BUTTON_START,
- BUTTON_END,
- TRUE);
- _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y);
+ if(priv->current_state == PLAY){
+ _setup (&cr_surf, &surf, PAUSE_WIDTH, PAUSE_HEIGHT);
+ _mask_pause (cr_surf,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
+ BAR_WIDTH,
+ BAR_HEIGHT - 2.0f * BAR_WIDTH,
+ BAR_OFFSET);
+ _fill (cr_surf,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (double) BAR_HEIGHT,
+ BUTTON_SHADOW,
+ BUTTON_SHADOW,
+ TRUE);
+ _surface_blur (surf, 1);
+ _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y + 1.0f);
+
+ // draw pause-button
+ _setup (&cr_surf, &surf, PAUSE_WIDTH, PAUSE_HEIGHT);
+ _mask_pause (cr_surf,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
+ BAR_WIDTH,
+ BAR_HEIGHT - 2.0f * BAR_WIDTH,
+ BAR_OFFSET);
+ _fill (cr_surf,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (PAUSE_HEIGHT - BAR_HEIGHT) / 2.0f,
+ (PAUSE_WIDTH - (2.0f * BAR_WIDTH + BAR_OFFSET)) / 2.0f,
+ (double) BAR_HEIGHT,
+ BUTTON_START,
+ BUTTON_END,
+ TRUE);
+ _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y);
+ }
+ else if(priv->current_state == PAUSE){
+ _setup (&cr_surf, &surf, PLAY_WIDTH, PLAY_HEIGHT);
+ _mask_play (cr_surf,
+ PLAY_PADDING,
+ PLAY_PADDING,
+ PLAY_WIDTH - (2*PLAY_PADDING),
+ PLAY_HEIGHT - (2*PLAY_PADDING));
+ _fill (cr_surf,
+ PLAY_PADDING,
+ PLAY_PADDING,
+ PLAY_WIDTH - (2*PLAY_PADDING),
+ PLAY_HEIGHT - (2*PLAY_PADDING),
+ BUTTON_SHADOW,
+ BUTTON_SHADOW,
+ FALSE);
+ _surface_blur (surf, 1);
+ _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y + 1.0f);
+ // draw play-button
+ _setup (&cr_surf, &surf, PLAY_WIDTH, PLAY_HEIGHT);
+ cairo_set_line_width (cr, 10.5);
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_join(cr, CAIRO_LINE_JOIN_ROUND);
+ _mask_play (cr_surf,
+ PLAY_PADDING,
+ PLAY_PADDING,
+ PLAY_WIDTH - (2*PLAY_PADDING),
+ PLAY_HEIGHT - (2*PLAY_PADDING));
+ _fill (cr_surf,
+ PLAY_PADDING,
+ PLAY_PADDING,
+ PLAY_WIDTH - (2*PLAY_PADDING),
+ PLAY_HEIGHT - (2*PLAY_PADDING),
+ BUTTON_START,
+ BUTTON_END,
+ FALSE);
+ _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y);
+ }
+
}
diff --git a/src/play-button.h b/src/play-button.h
index 6f646b5..727a489 100644
--- a/src/play-button.h
+++ b/src/play-button.h
@@ -40,6 +40,11 @@ typedef enum {
TRANSPORT_NADA
}PlayButtonEvent;
+typedef enum {
+ PLAY,
+ PAUSE
+}PlayButtonState;
+
struct _PlayButtonClass {
GtkDrawingAreaClass parent_class;
};
@@ -53,7 +58,7 @@ void play_button_set_style(GtkWidget* button, GtkStyle* style);
PlayButtonEvent determine_button_event(GtkWidget* button, GdkEventButton* event);
void play_button_react_to_button_press(GtkWidget* button, PlayButtonEvent command);
void play_button_react_to_button_release(GtkWidget* button);
-void play_button_toggle_play_pause(GtkWidget* button, int update);
+void play_button_toggle_play_pause(GtkWidget* button, PlayButtonState update);
GtkWidget* play_button_new();
diff --git a/src/player-controller.c b/src/player-controller.c
index 811033e..acb2da2 100644
--- a/src/player-controller.c
+++ b/src/player-controller.c
@@ -71,16 +71,6 @@ typedef struct _MprisControllerClass MprisControllerClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-#define TYPE_TITLE_MENUITEM (title_menuitem_get_type ())
-#define TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TITLE_MENUITEM, TitleMenuitem))
-#define TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TITLE_MENUITEM, TitleMenuitemClass))
-#define IS_TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TITLE_MENUITEM))
-#define IS_TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TITLE_MENUITEM))
-#define TITLE_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TITLE_MENUITEM, TitleMenuitemClass))
-
-typedef struct _TitleMenuitem TitleMenuitem;
-typedef struct _TitleMenuitemClass TitleMenuitemClass;
-
#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ())
#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem))
#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
@@ -91,6 +81,16 @@ typedef struct _TitleMenuitemClass TitleMenuitemClass;
typedef struct _MetadataMenuitem MetadataMenuitem;
typedef struct _MetadataMenuitemClass MetadataMenuitemClass;
+#define TYPE_TITLE_MENUITEM (title_menuitem_get_type ())
+#define TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TITLE_MENUITEM, TitleMenuitem))
+#define TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TITLE_MENUITEM, TitleMenuitemClass))
+#define IS_TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TITLE_MENUITEM))
+#define IS_TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TITLE_MENUITEM))
+#define TITLE_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TITLE_MENUITEM, TitleMenuitemClass))
+
+typedef struct _TitleMenuitem TitleMenuitem;
+typedef struct _TitleMenuitemClass TitleMenuitemClass;
+
#define TYPE_SCRUB_MENUITEM (scrub_menuitem_get_type ())
#define SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitem))
#define SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass))
@@ -168,7 +168,7 @@ void player_controller_update_state (PlayerController* self, PlayerControllersta
void player_controller_set_menu_offset (PlayerController* self, gint value);
static void player_controller_construct_widgets (PlayerController* self);
static void player_controller_establish_mpris_connection (PlayerController* self);
-static void player_controller_update_layout (PlayerController* self);
+void player_controller_update_layout (PlayerController* self);
PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state);
PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state);
const char* player_controller_get_name (PlayerController* self);
@@ -179,6 +179,7 @@ MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter
MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter);
gboolean mpris_controller_connected (MprisController* self);
void player_controller_vanish (PlayerController* self);
+GType metadata_menuitem_get_type (void);
PlayerItem* player_item_new (const char* type);
PlayerItem* player_item_construct (GType object_type, const char* type);
TitleMenuitem* title_menuitem_new (PlayerController* parent);
@@ -186,7 +187,6 @@ TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* pa
GType title_menuitem_get_type (void);
MetadataMenuitem* metadata_menuitem_new (void);
MetadataMenuitem* metadata_menuitem_construct (GType object_type);
-GType metadata_menuitem_get_type (void);
ScrubMenuitem* scrub_menuitem_new (PlayerController* parent);
ScrubMenuitem* scrub_menuitem_construct (GType object_type, PlayerController* parent);
GType scrub_menuitem_get_type (void);
@@ -291,7 +291,7 @@ void player_controller_instantiate (PlayerController* self) {
GError * _inner_error_;
g_return_if_fail (self != NULL);
_inner_error_ = NULL;
- g_debug ("player-controller.vala:86: instantiate in player controller for %s", self->priv->_name);
+ g_debug ("player-controller.vala:87: instantiate in player controller for %s", self->priv->_name);
{
g_app_info_launch (self->priv->_app_info, NULL, NULL, &_inner_error_);
if (_inner_error_ != NULL) {
@@ -306,7 +306,7 @@ void player_controller_instantiate (PlayerController* self) {
_error_ = _inner_error_;
_inner_error_ = NULL;
{
- g_warning ("player-controller.vala:92: Failed to launch app %s with error message:" \
+ g_warning ("player-controller.vala:93: Failed to launch app %s with error message:" \
" %s", self->priv->_name, _error_->message);
_g_error_free0 (_error_);
}
@@ -323,20 +323,20 @@ void player_controller_instantiate (PlayerController* self) {
static void player_controller_establish_mpris_connection (PlayerController* self) {
g_return_if_fail (self != NULL);
if (self->current_state != PLAYER_CONTROLLER_STATE_READY) {
- g_debug ("player-controller.vala:99: establish_mpris_connection - Not ready to c" \
-"onnect");
+ g_debug ("player-controller.vala:100: establish_mpris_connection - Not ready to " \
+"connect");
return;
}
if (_vala_strcmp0 (self->priv->_name, "Vlc") == 0) {
MprisController* _tmp0_;
- g_debug ("player-controller.vala:104: establishing a vlc mpris controller");
+ g_debug ("player-controller.vala:105: establishing a vlc mpris controller");
self->mpris_adaptor = (_tmp0_ = mpris_controller_new (self, "org.mpris.MediaPlayer.Player"), _g_object_unref0 (self->mpris_adaptor), _tmp0_);
} else {
MprisController* _tmp1_;
self->mpris_adaptor = (_tmp1_ = mpris_controller_new (self, "org.freedesktop.MediaPlayer"), _g_object_unref0 (self->mpris_adaptor), _tmp1_);
}
if (mpris_controller_connected (self->mpris_adaptor) == TRUE) {
- g_debug ("player-controller.vala:112: yup I'm connected");
+ g_debug ("player-controller.vala:113: yup I'm connected");
player_controller_update_state (self, PLAYER_CONTROLLER_STATE_CONNECTED);
} else {
player_controller_update_state (self, PLAYER_CONTROLLER_STATE_DISCONNECTED);
@@ -376,29 +376,34 @@ static char* bool_to_string (gboolean self) {
}
-static void player_controller_update_layout (PlayerController* self) {
+void player_controller_update_layout (PlayerController* self) {
gboolean visibility;
- char* _tmp0_;
- PlayerItem* _tmp1_;
+ PlayerItem* _tmp0_;
+ MetadataMenuitem* meta_item;
+ char* _tmp1_;
PlayerItem* _tmp2_;
PlayerItem* _tmp3_;
+ PlayerItem* _tmp4_;
g_return_if_fail (self != NULL);
visibility = TRUE;
+ meta_item = (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), IS_METADATA_MENUITEM (_tmp0_) ? ((MetadataMenuitem*) _tmp0_) : NULL);
if (self->current_state != PLAYER_CONTROLLER_STATE_CONNECTED) {
visibility = FALSE;
}
- g_debug ("player-controller.vala:134: about the set the visibility on both the t" \
-"ransport and metadata widget to %s", _tmp0_ = bool_to_string (visibility));
- _g_free0 (_tmp0_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp1_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, visibility);
- _g_object_unref0 (_tmp1_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, visibility);
+ g_debug ("player-controller.vala:137: about the set the visibility on both the t" \
+"ransport and metadata widget to %s", _tmp1_ = bool_to_string (visibility));
+ _g_free0 (_tmp1_);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, visibility);
_g_object_unref0 (_tmp2_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, visibility);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, visibility);
_g_object_unref0 (_tmp3_);
- if (self->mpris_adaptor == NULL) {
- g_warning ("player-controller.vala:140: Why is the mpris object null");
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, visibility);
+ _g_object_unref0 (_tmp4_);
+ if (visibility == FALSE) {
+ g_warning ("player-controller.vala:143: Update layout of client %s is setting widg" \
+"ets to invisibile!", self->priv->_name);
}
+ _g_object_unref0 (meta_item);
}
@@ -485,7 +490,7 @@ static char* player_controller_format_client_name (const char* client_name) {
formatted = (_tmp2_ = g_strconcat (_tmp0_ = g_utf8_strup (client_name, (gssize) 1), _tmp1_ = string_slice (client_name, (glong) 1, g_utf8_strlen (client_name, -1)), NULL), _g_free0 (formatted), _tmp2_);
_g_free0 (_tmp1_);
_g_free0 (_tmp0_);
- g_debug ("player-controller.vala:176: PlayerController->format_client_name - : %" \
+ g_debug ("player-controller.vala:179: PlayerController->format_client_name - : %" \
"s", formatted);
}
result = formatted;
diff --git a/src/player-controller.vala b/src/player-controller.vala
index 48416b9..f824d6f 100644
--- a/src/player-controller.vala
+++ b/src/player-controller.vala
@@ -60,13 +60,14 @@ public class PlayerController : GLib.Object
this.menu_offset = offset;
construct_widgets();
establish_mpris_connection();
- update_layout();
+ this.update_layout();
}
public void update_state(state new_state)
{
debug("update_state - player controller %s : new state %i", this.name, new_state);
this.current_state = new_state;
+ //this.update_layout();
}
public void activate()
@@ -125,10 +126,12 @@ public class PlayerController : GLib.Object
}
}
- private void update_layout()
+ public void update_layout()
{
bool visibility = true;
- if(this.current_state != state.CONNECTED){
+ MetadataMenuitem meta_item = this.custom_items[widget_order.METADATA] as MetadataMenuitem;
+ if(this.current_state != state.CONNECTED /*||
+ meta_item.not_populated()*/){
visibility = false;
}
debug("about the set the visibility on both the transport and metadata widget to %s", visibility.to_string());
@@ -136,8 +139,8 @@ public class PlayerController : GLib.Object
this.custom_items[widget_order.SCRUB].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
this.custom_items[widget_order.METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, visibility);
// DEBUG
- if(this.mpris_adaptor == null){
- warning("Why is the mpris object null");
+ if(visibility == false){
+ warning("Update layout of client %s is setting widgets to invisibile!", this.name);
}
}
diff --git a/src/player-item.c b/src/player-item.c
index f2a8a75..7546ca2 100644
--- a/src/player-item.c
+++ b/src/player-item.c
@@ -285,11 +285,6 @@ static gboolean player_item_ensure_valid_updates (GHashTable* data, GeeHashSet*
result = FALSE;
return result;
}
- if (g_hash_table_size (data) < gee_collection_get_size ((GeeCollection*) attributes)) {
- g_warning ("player-item.vala:93: update hash was too small for the target");
- result = FALSE;
- return result;
- }
result = TRUE;
return result;
}
diff --git a/src/player-item.vala b/src/player-item.vala
index 4bdb60d..2952f71 100644
--- a/src/player-item.vala
+++ b/src/player-item.vala
@@ -89,10 +89,10 @@ public class PlayerItem : Dbusmenu.Menuitem
if(data == null){
return false;
}
- if(data.size() < attributes.size){
+ /*if(data.size() < attributes.size){
warning("update hash was too small for the target");
return false;
- }
+ }*/
return true;
}
diff --git a/src/scrub-menu-item.c b/src/scrub-menu-item.c
index 6f08b62..24b10e3 100644
--- a/src/scrub-menu-item.c
+++ b/src/scrub-menu-item.c
@@ -163,6 +163,7 @@ GeeHashSet* scrub_menuitem_attributes_format (void) {
attrs = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_SCRUB_MENUITEM_DURATION);
gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_SCRUB_MENUITEM_POSITION);
+ gee_abstract_collection_add ((GeeAbstractCollection*) attrs, DBUSMENU_SCRUB_MENUITEM_PLAY_STATE);
result = attrs;
return result;
}
diff --git a/src/scrub-menu-item.vala b/src/scrub-menu-item.vala
index cfd6312..29fa903 100644
--- a/src/scrub-menu-item.vala
+++ b/src/scrub-menu-item.vala
@@ -37,14 +37,14 @@ public class ScrubMenuitem : PlayerItem
public void update_position(int32 new_position)
{
this.property_set_int(MENUITEM_POSITION, new_position);
- }
-
+ }
public static HashSet<string> attributes_format()
{
HashSet<string> attrs = new HashSet<string>();
attrs.add(MENUITEM_DURATION);
attrs.add(MENUITEM_POSITION);
+ attrs.add(MENUITEM_PLAY_STATE);
return attrs;
}
} \ No newline at end of file
diff --git a/src/scrub-widget.c b/src/scrub-widget.c
index dbbbdf3..fa290e0 100644
--- a/src/scrub-widget.c
+++ b/src/scrub-widget.c
@@ -25,6 +25,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "scrub-widget.h"
#include "common-defs.h"
#include <libido/idoscalemenuitem.h>
+#include <libido/idotimeline.h>
typedef struct _ScrubWidgetPrivate ScrubWidgetPrivate;
@@ -32,6 +33,8 @@ struct _ScrubWidgetPrivate
{
DbusmenuMenuitem* twin_item;
GtkWidget* ido_scrub_bar;
+ IdoTimeline* time_line;
+ gboolean scrubbing;
};
#define SCRUB_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SCRUB_WIDGET_TYPE, ScrubWidgetPrivate))
@@ -54,6 +57,19 @@ static gboolean scrub_widget_change_value_cb (GtkRange *range,
gdouble value,
gpointer user_data);
+static void scrub_widget_timeline_frame_cb(IdoTimeline *timeline,
+ gdouble progress,
+ gpointer userdata);
+static void scrub_widget_timeline_started_cb(IdoTimeline *timeline,
+ gpointer userdata);
+static void scrub_widget_timeline_finished_cb(IdoTimeline *timeline,
+ gpointer userdata);
+static gdouble scrub_widget_calculate_progress(ScrubWidget* widget);
+static void scrub_widget_check_play_state(ScrubWidget* self);
+static void scrub_widget_slider_grabbed(GtkWidget *widget, gpointer user_data);
+static void scrub_widget_slider_released(GtkWidget *widget, gpointer user_data);
+
+
G_DEFINE_TYPE (ScrubWidget, scrub_widget, G_TYPE_OBJECT);
@@ -68,7 +84,6 @@ scrub_widget_class_init (ScrubWidgetClass *klass)
gobject_class->finalize = scrub_widget_finalize;
}
-
static void
scrub_widget_init (ScrubWidget *self)
{
@@ -76,13 +91,20 @@ scrub_widget_init (ScrubWidget *self)
ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(self);
priv->ido_scrub_bar = ido_scale_menu_item_new_with_range ("Scrub", IDO_RANGE_STYLE_SMALL, 0, 0, 100, 1);
- ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), IDO_SCALE_MENU_ITEM_STYLE_LABEL);
+ priv->time_line = ido_timeline_new(0);
+ ido_scale_menu_item_set_style (IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), IDO_SCALE_MENU_ITEM_STYLE_LABEL);
g_object_set(priv->ido_scrub_bar, "reverse-scroll-events", TRUE, NULL);
+ priv->scrubbing = FALSE;
// register slider changes listening on the range
GtkWidget* scrub_widget = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_scrub_bar);
g_signal_connect(scrub_widget, "change-value", G_CALLBACK(scrub_widget_change_value_cb), self);
+ g_signal_connect(priv->time_line, "frame", G_CALLBACK(scrub_widget_timeline_frame_cb), self);
+ g_signal_connect(priv->time_line, "started", G_CALLBACK(scrub_widget_timeline_started_cb), self);
+ g_signal_connect(priv->time_line, "finished", G_CALLBACK(scrub_widget_timeline_finished_cb), self);
+ g_signal_connect(priv->ido_scrub_bar, "slider-grabbed", G_CALLBACK(scrub_widget_slider_grabbed), self);
+ g_signal_connect(priv->ido_scrub_bar, "slider-released", G_CALLBACK(scrub_widget_slider_released), self);
}
static void
@@ -110,17 +132,50 @@ scrub_widget_property_update(DbusmenuMenuitem* item, gchar* property,
if(g_ascii_strcasecmp(DBUSMENU_SCRUB_MENUITEM_DURATION, property) == 0){
g_debug("scrub-widget::update length = %i", g_value_get_int(value));
ido_scale_menu_item_set_secondary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar),
- scrub_widget_format_time(g_value_get_int(value)));
+ scrub_widget_format_time(g_value_get_int(value)));
+
+ ido_timeline_set_duration(priv->time_line, g_value_get_int(value) * 1000);
+ ido_timeline_rewind(priv->time_line);
+ scrub_widget_check_play_state(mitem);
+ g_debug("timeline is running: %i", (gint)ido_timeline_is_running(priv->time_line));
+ g_debug("timeline duration = %i", ido_timeline_get_duration(priv->time_line));
+
+ scrub_widget_set_ido_position(mitem,
+ dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000,
+ dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION));
}
else if(g_ascii_strcasecmp(DBUSMENU_SCRUB_MENUITEM_POSITION, property) == 0){
g_debug("scrub-widget::update position = %i", g_value_get_int(value));
+ ido_timeline_pause(priv->time_line);
ido_scale_menu_item_set_primary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar),
scrub_widget_format_time(g_value_get_int(value)/1000));
- }
- scrub_widget_set_ido_position(mitem,
- dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000,
- dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION));
+
+ ido_timeline_set_progress(priv->time_line, scrub_widget_calculate_progress(mitem)*1000);
+ scrub_widget_set_ido_position(mitem, g_value_get_int(value)/1000,
+ dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION));
+ ido_timeline_start(priv->time_line);
+
+ }
+ else if(g_ascii_strcasecmp(DBUSMENU_SCRUB_MENUITEM_PLAY_STATE, property) == 0){
+ scrub_widget_check_play_state(mitem);
+ }
+}
+
+static void
+scrub_widget_check_play_state(ScrubWidget* self)
+{
+ ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(self);
+ gint play_state = dbusmenu_menuitem_property_get_int(priv->twin_item,
+ DBUSMENU_SCRUB_MENUITEM_PLAY_STATE);
+ if(play_state == 0){
+ g_debug("START TIMELINE");
+ ido_timeline_start(priv->time_line);
+ }
+ else{
+ g_debug("PAUSE TIMELINE");
+ ido_timeline_pause(priv->time_line);
+ }
}
static void
@@ -133,13 +188,12 @@ scrub_widget_set_twin_item(ScrubWidget* self,
g_signal_connect(G_OBJECT(twin_item), "property-changed",
G_CALLBACK(scrub_widget_property_update), self);
- gchar* left_text = scrub_widget_format_time(dbusmenu_menuitem_property_get_int(priv->twin_item,
- DBUSMENU_SCRUB_MENUITEM_POSITION)/1000);
+ gchar* left_text = scrub_widget_format_time(dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000);
gchar* right_text = scrub_widget_format_time(dbusmenu_menuitem_property_get_int(priv->twin_item,
DBUSMENU_SCRUB_MENUITEM_DURATION));
scrub_widget_set_ido_position(self,
- dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000,
- dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION));
+ dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_POSITION)/1000,
+ dbusmenu_menuitem_property_get_int(priv->twin_item, DBUSMENU_SCRUB_MENUITEM_DURATION));
ido_scale_menu_item_set_primary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), left_text);
ido_scale_menu_item_set_secondary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), right_text);
@@ -153,7 +207,7 @@ scrub_widget_change_value_cb (GtkRange *range,
gdouble new_value,
gpointer user_data)
{
- g_return_val_if_fail (IS_SCRUB_WIDGET (user_data), FALSE);
+ /*g_return_val_if_fail (IS_SCRUB_WIDGET (user_data), FALSE);
ScrubWidget* mitem = SCRUB_WIDGET(user_data);
ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem);
@@ -161,8 +215,13 @@ scrub_widget_change_value_cb (GtkRange *range,
g_value_init(&value, G_TYPE_DOUBLE);
gdouble clamped = CLAMP(new_value, 0, 100);
g_value_set_double(&value, clamped);
- g_debug("scrub-widget-change-value callback - = %f", clamped);
- dbusmenu_menuitem_handle_event (priv->twin_item, "scrubbing", &value, 0);
+ //g_debug("scrub-widget-change-value callback - = %f", clamped);
+ if(priv->scrubbing == FALSE){
+ dbusmenu_menuitem_handle_event (priv->twin_item, "scrubbing", &value, 0);
+ }
+ else{
+ g_debug("blocking scrubbing because the slider is still grabbed"
+ }*/
return FALSE;
}
@@ -203,8 +262,96 @@ scrub_widget_set_ido_position(ScrubWidget* self,
gtk_range_set_value(range, ido_position);
}
+static gdouble
+scrub_widget_calculate_progress(ScrubWidget* widget)
+{
+ ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(widget);
+ gint position = dbusmenu_menuitem_property_get_int(priv->twin_item,
+ DBUSMENU_SCRUB_MENUITEM_POSITION)/1000;
+ gint duration = dbusmenu_menuitem_property_get_int(priv->twin_item,
+ DBUSMENU_SCRUB_MENUITEM_DURATION);
+ gdouble ido_position = position/(gdouble)duration;
+ g_debug("scrub_widget_calculate_progress %f", ido_position);
+
+ return ido_position;
+}
+
+
+static void
+scrub_widget_timeline_frame_cb( IdoTimeline *timeline,
+ gdouble progress,
+ gpointer user_data)
+{
+
+ //g_debug("Timeline CB : %f", progress);
+ g_return_if_fail (IS_SCRUB_WIDGET (user_data));
+ ScrubWidget* mitem = SCRUB_WIDGET(user_data);
+ ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem);
+ if(priv->scrubbing == TRUE)
+ {
+ //g_debug("don't update the slider or timeline, slider is being scrubbed");
+ return;
+ }
+ gint position = progress * dbusmenu_menuitem_property_get_int(priv->twin_item,
+ DBUSMENU_SCRUB_MENUITEM_DURATION);
+ gchar* left_text = scrub_widget_format_time(position);
+ ido_scale_menu_item_set_primary_label(IDO_SCALE_MENU_ITEM(priv->ido_scrub_bar), left_text);
+ GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_scrub_bar);
+ GtkRange *range = (GtkRange*)slider;
+ gtk_range_set_value(range, progress * 100);
+
+ /*g_debug("position in seconds %i and in words %s", position, left_text);
+ g_debug("timeline is running: %i", (gint)ido_timeline_is_running(priv->time_line));
+ g_debug("timeline duration = %i", ido_timeline_get_duration(priv->time_line));
+ */
+ g_free(left_text);
+}
+
+
+static void
+scrub_widget_slider_released(GtkWidget *widget, gpointer user_data)
+{
+ ScrubWidget* mitem = SCRUB_WIDGET(user_data);
+ ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem);
+ priv->scrubbing = FALSE;
+ GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_scrub_bar);
+ gdouble new_value = gtk_range_get_value(GTK_RANGE(slider));
+ g_debug("okay set the scrub position with %f", new_value);
+ GValue value = {0};
+ g_value_init(&value, G_TYPE_DOUBLE);
+ gdouble clamped = CLAMP(new_value, 0, 100);
+ g_value_set_double(&value, clamped);
+ dbusmenu_menuitem_handle_event (priv->twin_item, "scrubbing", &value, 0);
+}
+
+static void
+scrub_widget_slider_grabbed(GtkWidget *widget, gpointer user_data)
+{
+ ScrubWidget* mitem = SCRUB_WIDGET(user_data);
+ ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem);
+ priv->scrubbing = TRUE;
+
+}
+
+static void
+scrub_widget_timeline_started_cb( IdoTimeline *timeline,
+ gpointer user_data)
+{
+ g_debug("Timeline Started!");
+}
- /**
+static void
+scrub_widget_timeline_finished_cb(IdoTimeline *timeline,
+ gpointer user_data)
+{
+ g_debug("Timeline Finished!");
+ /*g_return_if_fail (IS_SCRUB_WIDGET (user_data));
+ ScrubWidget* mitem = SCRUB_WIDGET(user_data);
+ ScrubWidgetPrivate * priv = SCRUB_WIDGET_GET_PRIVATE(mitem);
+ ido_timeline_rewind(priv->time_line);*/
+}
+
+/**
* scrub_widget_new:
* @returns: a new #ScrubWidget.
**/
@@ -216,3 +363,4 @@ scrub_widget_new(DbusmenuMenuitem *item)
return widget;
}
+
diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c
index 0734a97..bbe5a4d 100644
--- a/src/transport-menu-item.c
+++ b/src/transport-menu-item.c
@@ -153,6 +153,7 @@ TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerContro
TransportMenuitem * self;
g_return_val_if_fail (parent != NULL, NULL);
self = (TransportMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_TRANSPORT_MENUITEM_TYPE, "owner", parent, NULL);
+ dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, 1);
return self;
}
@@ -175,9 +176,9 @@ static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const
self = (TransportMenuitem*) base;
g_return_if_fail (name != NULL);
input = g_value_get_int (input_value);
- g_debug ("transport-menu-item.vala:45: handle_event with value %s", _tmp0_ = g_strdup_printf ("%i", input));
+ g_debug ("transport-menu-item.vala:46: handle_event with value %s", _tmp0_ = g_strdup_printf ("%i", input));
_g_free0 (_tmp0_);
- g_debug ("transport-menu-item.vala:46: transport owner name = %s", player_controller_get_name (player_item_get_owner ((PlayerItem*) self)));
+ g_debug ("transport-menu-item.vala:47: transport owner name = %s", player_controller_get_name (player_item_get_owner ((PlayerItem*) self)));
mpris_controller_transport_event (player_item_get_owner ((PlayerItem*) self)->mpris_adaptor, (TransportMenuitemaction) input);
}
diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala
index 8e837c2..3d6dcdd 100644
--- a/src/transport-menu-item.vala
+++ b/src/transport-menu-item.vala
@@ -32,6 +32,7 @@ public class TransportMenuitem : PlayerItem
public TransportMenuitem(PlayerController parent)
{
Object(item_type: MENUITEM_TYPE, owner: parent);
+ this.property_set_int(MENUITEM_PLAY_STATE, 1);
}
public void change_play_state(int state)
diff --git a/src/transport-widget.c b/src/transport-widget.c
index 3174afe..c616fff 100644
--- a/src/transport-widget.c
+++ b/src/transport-widget.c
@@ -186,7 +186,7 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property,
TransportWidgetPrivate *priv = TRANSPORT_WIDGET_GET_PRIVATE(bar);
int update_value = g_value_get_int(value);
g_debug("transport_widget_update_state - with value %i", update_value);
- play_button_toggle_play_pause(priv->play_button, update_value);
+ play_button_toggle_play_pause(priv->play_button, (PlayButtonState)update_value);
}
/**
diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi
index 24344ce..c083e2a 100644
--- a/vapi/common-defs.vapi
+++ b/vapi/common-defs.vapi
@@ -43,4 +43,5 @@ namespace DbusmenuScrub{
public const string MENUITEM_TYPE;
public const string MENUITEM_POSITION;
public const string MENUITEM_DURATION;
+ public const string MENUITEM_PLAY_STATE;
} \ No newline at end of file