From 16bdc89ecb9aa7e31d7efd8b34b0a632d4440f5e Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 4 Mar 2011 14:30:17 +0000 Subject: iconthemepath work in progress --- src/playlists-menu-item.vala | 6 ++++++ src/sound-service-dbus.c | 5 ++++- src/sound-service.c | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index f4d7233..4ed6cf4 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -47,6 +47,12 @@ public class PlaylistsMenuitem : PlayerItem Dbusmenu.Menuitem menuitem = new Menuitem(); menuitem.property_set (MENUITEM_PROP_LABEL, detail.name); + + var icon_file = File.new_for_path (detail.icon_path); + if (icon_file.query_exists () == true) { + menuitem.property_set (MENUITEM_PROP_ICON_NAME, + icon_file.get_basename () ); + } menuitem.property_set (MENUITEM_PROP_ICON_NAME, detail.icon_path); menuitem.property_set (MENUITEM_PATH, (string)detail.path); menuitem.property_set_bool (MENUITEM_PROP_VISIBLE, true); diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index b493ce8..ce32beb 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -147,7 +147,10 @@ sound_service_dbus_create_root_item (SoundServiceDbus* self) SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self); priv->root_menuitem = dbusmenu_menuitem_new(); g_debug("Root ID: %d", dbusmenu_menuitem_get_id(priv->root_menuitem)); - DbusmenuServer *server = dbusmenu_server_new(INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH); + DbusmenuServer *server = dbusmenu_server_new (INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH); + gchar** paths = {'/usr/share/banshee-1/icons'}; + dbusmenu_server_set_icon_paths (server, + g_strdupv(paths)); dbusmenu_server_set_root (server, priv->root_menuitem); g_object_unref (priv->root_menuitem); priv->active_sink = active_sink_new (self); diff --git a/src/sound-service.c b/src/sound-service.c index c79b9f6..553f07a 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -40,8 +40,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); - close_pulse_activites(); - g_main_loop_quit(mainloop); + //close_pulse_activites(); + //g_main_loop_quit(mainloop); } return; -- cgit v1.2.3 From 0146cc8f82bca83ce7bff34ff412db762022ea06 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 4 Mar 2011 14:37:01 +0000 Subject: free the string array, plug the leaks --- src/sound-service-dbus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index ce32beb..67c7e47 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -151,6 +151,7 @@ sound_service_dbus_create_root_item (SoundServiceDbus* self) gchar** paths = {'/usr/share/banshee-1/icons'}; dbusmenu_server_set_icon_paths (server, g_strdupv(paths)); + g_strfreev (paths); dbusmenu_server_set_root (server, priv->root_menuitem); g_object_unref (priv->root_menuitem); priv->active_sink = active_sink_new (self); -- cgit v1.2.3 From f01207e8ee86d4fd36cfefc1520be5b758799572 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 4 Mar 2011 09:51:30 -0600 Subject: Fix the GStrv to use a string and be NULL terminated --- src/sound-service-dbus.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 67c7e47..580304f 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -148,10 +148,9 @@ sound_service_dbus_create_root_item (SoundServiceDbus* self) priv->root_menuitem = dbusmenu_menuitem_new(); g_debug("Root ID: %d", dbusmenu_menuitem_get_id(priv->root_menuitem)); DbusmenuServer *server = dbusmenu_server_new (INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH); - gchar** paths = {'/usr/share/banshee-1/icons'}; + gchar* paths[] = {"/usr/share/banshee-1/icons", NULL}; dbusmenu_server_set_icon_paths (server, - g_strdupv(paths)); - g_strfreev (paths); + paths); dbusmenu_server_set_root (server, priv->root_menuitem); g_object_unref (priv->root_menuitem); priv->active_sink = active_sink_new (self); -- cgit v1.2.3 From fb651cca574070250f95dca42c888f97be5989f2 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 4 Mar 2011 16:32:31 +0000 Subject: debug trace --- src/playlists-menu-item.vala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 4ed6cf4..9b1f724 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -50,6 +50,7 @@ public class PlaylistsMenuitem : PlayerItem var icon_file = File.new_for_path (detail.icon_path); if (icon_file.query_exists () == true) { + debug ("icon name = %s", icon_file.get_basename ()); menuitem.property_set (MENUITEM_PROP_ICON_NAME, icon_file.get_basename () ); } -- cgit v1.2.3 From 2081219c98f9ac3d3054c3eb6565740899d42e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 5 Mar 2011 21:27:39 +0100 Subject: Newer notify-osd needs that the x-canonical-private-synchronous is set to a non-empty string This will allows to show the indicator notification like before. --- src/sound-state-manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound-state-manager.c b/src/sound-state-manager.c index 0958763..7095a39 100644 --- a/src/sound-state-manager.c +++ b/src/sound-state-manager.c @@ -153,7 +153,7 @@ sound_state_manager_notification_init (SoundStateManager* self) if (has_notify_osd) { priv->notification = notify_notification_new(PACKAGE_NAME, NULL, NULL); notify_notification_set_hint_string(priv->notification, - "x-canonical-private-synchronous", ""); + "x-canonical-private-synchronous", PACKAGE_NAME); } } -- cgit v1.2.3 From f4ed658ce1ea0b2bc0eaa47d9aa95a5585cba533 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 7 Mar 2011 11:48:56 +0000 Subject: added the is blacklisted dbus method --- src/sound-service-dbus.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++- src/sound-service.xml | 6 ++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index b493ce8..249a054 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -74,6 +74,8 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, gchar* player_name, gboolean blacklist); +static gboolean sound_service_dbus_is_blacklisted (SoundServiceDbus* self, + gchar* player_name); G_DEFINE_TYPE (SoundServiceDbus, sound_service_dbus, G_TYPE_OBJECT); @@ -281,7 +283,16 @@ bus_method_call (GDBusConnection * connection, player_name, blacklist); retval = g_variant_new ("(b)", result); - } + } + else if (g_strcmp0(method, "IsBlacklisted") == 0) { + gchar* player_name; + g_variant_get (params, "(s)", &player_name); + + g_debug ("IsBlacklisted - name %s", player_name); + gboolean result = sound_service_dbus_is_blacklisted (service, + player_name); + retval = g_variant_new ("(b)", result); + } else { g_warning("Calling method '%s' on the sound service but it's unknown", method); } @@ -373,4 +384,42 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, return result; } +static gboolean sound_service_dbus_is_blacklisted (SoundServiceDbus* self, + gchar* player_name) +{ + g_return_val_if_fail (player_name != NULL, FALSE); + + gboolean result = FALSE; + GSettings* our_settings = NULL; + our_settings = g_settings_new ("com.canonical.indicators.sound"); + GVariant* the_black_list = g_settings_get_value (our_settings, + "blacklisted-media-players"); + GVariantIter iter; + gchar *str; + // Firstly prep new array which will be set on the key. + GVariantBuilder builder; + + g_variant_iter_init (&iter, the_black_list); + g_variant_builder_init(&builder, G_VARIANT_TYPE_STRING_ARRAY); + + while (g_variant_iter_loop (&iter, "s", &str)){ + g_variant_builder_add (&builder, "s", str); + } + g_variant_iter_init (&iter, the_black_list); + + while (g_variant_iter_loop (&iter, "s", &str)){ + if (g_strcmp0 (player_name, str) == 0){ + // Return if its already there + g_debug ("Yes it is blacklisted !"); + result = TRUE; + break; + } + } + g_variant_builder_clear (&builder); + g_object_unref (our_settings); + g_variant_unref (the_black_list); + g_debug ("Is it blacklisted ? %i", result); + + return result; +} diff --git a/src/sound-service.xml b/src/sound-service.xml index 81ebc2d..517088e 100644 --- a/src/sound-service.xml +++ b/src/sound-service.xml @@ -7,6 +7,12 @@ + + + + + + -- cgit v1.2.3 From 10f404afef79bcf5fe3bb4bdc8a82d0cff08d87a Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 7 Mar 2011 15:19:28 +0000 Subject: rewrote the method with the help of mikkel --- src/sound-service-dbus.c | 55 +++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 249a054..43d7360 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -307,17 +307,18 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, gboolean blacklist) { g_return_val_if_fail (player_name != NULL, FALSE); + g_return_val_if_fail (IS_SOUND_SERVICE_DBUS (self), FALSE); + GVariant* the_black_list; gboolean result = FALSE; - GSettings* our_settings = NULL; - our_settings = g_settings_new ("com.canonical.indicators.sound"); - GVariant* the_black_list = g_settings_get_value (our_settings, - "blacklisted-media-players"); + GSettings* our_settings; GVariantIter iter; gchar *str; - // Firstly prep new array which will be set on the key. GVariantBuilder builder; - + + our_settings = g_settings_new ("com.canonical.indicators.sound"); + the_black_list = g_settings_get_value (our_settings, + "blacklisted-media-players"); g_variant_iter_init (&iter, the_black_list); g_variant_builder_init(&builder, G_VARIANT_TYPE_STRING_ARRAY); @@ -384,41 +385,33 @@ static gboolean sound_service_dbus_blacklist_player (SoundServiceDbus* self, return result; } -static gboolean sound_service_dbus_is_blacklisted (SoundServiceDbus* self, - gchar* player_name) +static gboolean sound_service_dbus_is_blacklisted (SoundServiceDbus *self, + gchar *player_name) { - g_return_val_if_fail (player_name != NULL, FALSE); - - gboolean result = FALSE; - GSettings* our_settings = NULL; - our_settings = g_settings_new ("com.canonical.indicators.sound"); - GVariant* the_black_list = g_settings_get_value (our_settings, - "blacklisted-media-players"); - GVariantIter iter; - gchar *str; - // Firstly prep new array which will be set on the key. - GVariantBuilder builder; + GSettings *our_settings; + GVariant *the_black_list; + GVariantIter iter; + gchar *str; + gboolean result = FALSE; - g_variant_iter_init (&iter, the_black_list); - g_variant_builder_init(&builder, G_VARIANT_TYPE_STRING_ARRAY); + g_return_val_if_fail (player_name != NULL, FALSE); + g_return_val_if_fail (IS_SOUND_SERVICE_DBUS (self), FALSE); - while (g_variant_iter_loop (&iter, "s", &str)){ - g_variant_builder_add (&builder, "s", str); - } + our_settings = g_settings_new ("com.canonical.indicators.sound"); + the_black_list = g_settings_get_value (our_settings, + "blacklisted-media-players"); g_variant_iter_init (&iter, the_black_list); - - while (g_variant_iter_loop (&iter, "s", &str)){ - if (g_strcmp0 (player_name, str) == 0){ - // Return if its already there - g_debug ("Yes it is blacklisted !"); + while (g_variant_iter_next (&iter, "s", &str)){ + if (g_strcmp0 (player_name, str) == 0) { result = TRUE; + g_free (str); break; } + g_free (str); } - g_variant_builder_clear (&builder); + g_object_unref (our_settings); g_variant_unref (the_black_list); - g_debug ("Is it blacklisted ? %i", result); return result; } -- cgit v1.2.3 From 3b16991b0cc19cb330295bc0cd2e7da1704f445d Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 8 Mar 2011 20:30:47 +0000 Subject: timer mechanism in place --- src/transport-widget.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/src/transport-widget.c b/src/transport-widget.c index 7c96684..acbdf0f 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -81,9 +81,11 @@ struct _TransportWidgetPrivate TransportWidgetEvent key_event; TransportWidgetEvent motion_event; TransportWidgetState current_state; - GHashTable* command_coordinates; + GHashTable* command_coordinates; DbusmenuMenuitem* twin_item; - gboolean has_focus; + gboolean has_focus; + gint hold_timer; + gint skip_frequency; }; #define TRANSPORT_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRANSPORT_WIDGET_TYPE, TransportWidgetPrivate)) @@ -130,6 +132,9 @@ static void transport_widget_toggle_play_pause ( TransportWidget* button, static void transport_widget_select (GtkItem* menu, gpointer Userdata); static void transport_widget_deselect (GtkItem* menu, gpointer Userdata); static TransportWidgetEvent transport_widget_collision_detection (gint x, gint y); +static void transport_widget_start_timing (TransportWidget* widget); +static gboolean transport_widget_trigger_seek (gpointer userdata); +static gboolean transport_widget_seek (gpointer userdata); /// Init functions ////////////////////////////////////////////////////////// @@ -160,6 +165,8 @@ transport_widget_init (TransportWidget *self) priv->key_event = TRANSPORT_NADA; priv->motion_event = TRANSPORT_NADA; priv->has_focus = FALSE; + priv->hold_timer = 0; + priv->skip_frequency = 0; priv->command_coordinates = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, @@ -287,7 +294,6 @@ transport_widget_motion_notify_event (GtkWidget *menuitem, TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) ); TransportWidgetEvent result = transport_widget_determine_motion_event ( TRANSPORT_WIDGET(menuitem), event); - priv->motion_event = result; gtk_widget_queue_draw (menuitem); return TRUE; @@ -318,10 +324,50 @@ transport_widget_button_press_event (GtkWidget *menuitem, if(result != TRANSPORT_NADA){ priv->current_command = result; gtk_widget_queue_draw (GTK_WIDGET(menuitem)); + transport_widget_start_timing (TRANSPORT_WIDGET(menuitem)); } return TRUE; } - +/** + * TODO rename or merge + * @param widget + */ +static void +transport_widget_start_timing (TransportWidget* widget) +{ + TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (widget); + priv->hold_timer = g_timeout_add (1200, + transport_widget_trigger_seek, + widget); +} + +static gboolean +transport_widget_trigger_seek (gpointer userdata) +{ + g_return_val_if_fail ( IS_TRANSPORT_WIDGET(userdata), FALSE ); + TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (TRANSPORT_WIDGET(userdata)); + priv->skip_frequency = g_timeout_add (500, + transport_widget_seek, + userdata); + return FALSE; +} + +/** + * This will be called repeatedly until a key/button release is received + * @param userdata + * @return + */ +static gboolean +transport_widget_seek (gpointer userdata) +{ +/* + g_return_val_if_fail ( IS_TRANSPORT_WIDGET(userdata), FALSE ); + TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (TRANSPORT_WIDGET(userdata)); +*/ + + return TRUE; +} + static gboolean transport_widget_button_release_event (GtkWidget *menuitem, GdkEventButton *event) @@ -441,6 +487,14 @@ transport_widget_react_to_button_release ( TransportWidget* button, priv->key_event = TRANSPORT_NADA; gtk_widget_queue_draw (GTK_WIDGET(button)); + if (priv->hold_timer != 0){ + g_source_remove (priv->hold_timer); + priv->hold_timer = 0; + } + if(priv->skip_frequency != 0){ + g_source_remove (priv->skip_frequency); + priv->skip_frequency = 0; + } } /// internal helper functions ////////////////////////////////////////////////// -- cgit v1.2.3 From da2fbe31c29cadf4d8215d882d212ef40a0d1da0 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 8 Mar 2011 20:51:16 +0000 Subject: skipping instructions sent --- src/mpris2-controller.vala | 2 +- src/sound-service.c | 2 ++ src/transport-widget.c | 26 ++++++++++++++++++++++---- src/transport-widget.h | 2 ++ 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index c7305f4..e5bc1f6 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -176,7 +176,7 @@ public class Mpris2Controller : GLib.Object public void transport_update(TransportMenuitem.action command) { - //debug("transport_event input = %i", (int)command); + debug("transport_event input = %i", (int)command); if(command == TransportMenuitem.action.PLAY_PAUSE){ this.player.PlayPause.begin(); } diff --git a/src/sound-service.c b/src/sound-service.c index c79b9f6..eeab33e 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -40,8 +40,10 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); +/* close_pulse_activites(); g_main_loop_quit(mainloop); +*/ } return; diff --git a/src/transport-widget.c b/src/transport-widget.c index acbdf0f..5d58201 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -336,7 +336,7 @@ static void transport_widget_start_timing (TransportWidget* widget) { TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (widget); - priv->hold_timer = g_timeout_add (1200, + priv->hold_timer = g_timeout_add (800, transport_widget_trigger_seek, widget); } @@ -346,7 +346,7 @@ transport_widget_trigger_seek (gpointer userdata) { g_return_val_if_fail ( IS_TRANSPORT_WIDGET(userdata), FALSE ); TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (TRANSPORT_WIDGET(userdata)); - priv->skip_frequency = g_timeout_add (500, + priv->skip_frequency = g_timeout_add (300, transport_widget_seek, userdata); return FALSE; @@ -360,10 +360,28 @@ transport_widget_trigger_seek (gpointer userdata) static gboolean transport_widget_seek (gpointer userdata) { -/* g_return_val_if_fail ( IS_TRANSPORT_WIDGET(userdata), FALSE ); TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (TRANSPORT_WIDGET(userdata)); -*/ + GVariant* new_transport_state; + if(priv->current_command == TRANSPORT_NEXT){ + g_debug ("we should be skipping forward"); + new_transport_state = g_variant_new_int32 ((int)TRANSPORT_FORWIND); + + dbusmenu_menuitem_handle_event ( priv->twin_item, + "Transport state change", + new_transport_state, + 0 ); + + } + else if(priv->current_command == TRANSPORT_PREVIOUS){ + g_debug ("we should be skipping back"); + new_transport_state = g_variant_new_int32 ((int)TRANSPORT_REWIND); + + dbusmenu_menuitem_handle_event ( priv->twin_item, + "Transport state change", + new_transport_state, + 0 ); + } return TRUE; } diff --git a/src/transport-widget.h b/src/transport-widget.h index d02f59b..c9354b1 100644 --- a/src/transport-widget.h +++ b/src/transport-widget.h @@ -39,6 +39,8 @@ typedef enum { TRANSPORT_PREVIOUS, TRANSPORT_PLAY_PAUSE, TRANSPORT_NEXT, + TRANSPORT_REWIND, + TRANSPORT_FORWIND, TRANSPORT_NADA }TransportWidgetEvent; -- cgit v1.2.3 From 7576ffb4d9b247d1db2e44a7ea0f4ec8b5101f20 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 8 Mar 2011 21:43:50 +0000 Subject: seeking is working, need a tidy up --- src/mpris2-controller.vala | 6 ++++++ src/mpris2-interfaces.vala | 1 + src/transport-menu-item.vala | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index e5bc1f6..dae8dfb 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -186,6 +186,12 @@ public class Mpris2Controller : GLib.Object else if(command == TransportMenuitem.action.NEXT){ this.player.Next.begin(); } + else if(command == TransportMenuitem.action.REWIND){ + this.player.Seek.begin(-1); + } + else if(command == TransportMenuitem.action.FORWIND){ + this.player.Seek.begin(1); + } } public bool connected() diff --git a/src/mpris2-interfaces.vala b/src/mpris2-interfaces.vala index 5506a47..5dab1d2 100644 --- a/src/mpris2-interfaces.vala +++ b/src/mpris2-interfaces.vala @@ -42,6 +42,7 @@ public interface MprisPlayer : Object { public abstract async void PlayPause() throws IOError; public abstract async void Next() throws IOError; public abstract async void Previous() throws IOError; + public abstract async void Seek(int64 offset) throws IOError; // signals public signal void Seeked(int64 new_position); } diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index b0009d9..d5ae283 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -26,7 +26,9 @@ public class TransportMenuitem : PlayerItem public enum action{ PREVIOUS, PLAY_PAUSE, - NEXT + NEXT, + REWIND, + FORWIND } public enum state{ -- cgit v1.2.3 From 1844fd179212b85591f0e4eeb33591edba2f0f0b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 8 Mar 2011 21:49:27 +0000 Subject: ensure we don't trigger a simple next/previous after releasing from a skip --- src/transport-widget.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/transport-widget.c b/src/transport-widget.c index 5d58201..2f5001c 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -395,7 +395,9 @@ transport_widget_button_release_event (GtkWidget *menuitem, TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport ); TransportWidgetEvent result = transport_widget_determine_button_event ( transport, event ); - if (result != TRANSPORT_NADA && priv->current_command == result){ + if (result != TRANSPORT_NADA && + priv->current_command == result && + priv->skip_frequency == 0){ GVariant* new_transport_state = g_variant_new_int32 ((int)result); dbusmenu_menuitem_handle_event ( priv->twin_item, "Transport state change", -- cgit v1.2.3 From 726f77ccdb4d0cc47b952c8403df926a9c7c7d45 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Wed, 9 Mar 2011 12:17:01 +1100 Subject: Indicators are now responsible for updating their own accessible description. Refactor accessible description update code into a new function. --- src/indicator-sound.c | 14 ++++++++++++++ src/indicator-sound.h | 3 +++ src/volume-widget.c | 18 ++---------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 6e1acc9..9e10f3a 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -640,3 +640,17 @@ indicator_sound_scroll (IndicatorObject *io, gint delta, sound_state_manager_show_notification (priv->state_manager, value); } + +void +update_accessible_desc (IndicatorObject * io) +{ + GList *entries = indicator_object_get_entries(io); + IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data; + entry->accessible_desc = get_accessible_desc(io); + g_signal_emit(G_OBJECT(io), + INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, + 0, + entry, + TRUE); + g_list_free(entries); +} diff --git a/src/indicator-sound.h b/src/indicator-sound.h index 40a3e6f..c945efa 100644 --- a/src/indicator-sound.h +++ b/src/indicator-sound.h @@ -53,4 +53,7 @@ struct _IndicatorSound { // GObject Boiler plate GType indicator_sound_get_type (void); +// Update the accessible description +void update_accessible_desc (IndicatorObject * io); + #endif diff --git a/src/volume-widget.c b/src/volume-widget.c index be97994..c45e93c 100644 --- a/src/volume-widget.c +++ b/src/volume-widget.c @@ -138,14 +138,7 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property, gdouble update = g_variant_get_double (value); //g_debug("volume-widget - update level with value %f", update); gtk_range_set_value(range, update); - - GList *entry = indicator_object_get_entries(priv->indicator); - g_signal_emit(G_OBJECT(priv->indicator), - INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, - 0, - entry->data, - TRUE); - g_list_free(entry); + update_accessible_desc(priv->indicator); } } } @@ -165,14 +158,7 @@ volume_widget_set_twin_item(VolumeWidget* self, GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); GtkRange *range = (GtkRange*)slider; gtk_range_set_value(range, initial_level); - - GList *entry = indicator_object_get_entries(priv->indicator); - g_signal_emit(G_OBJECT(priv->indicator), - INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, - 0, - entry->data, - TRUE); - g_list_free(entry); + update_accessible_desc(priv->indicator); } static gboolean -- cgit v1.2.3 From 5bae6af22449e60aa0c3eaf0dd08a518979f2df9 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 9 Mar 2011 12:27:18 +0000 Subject: nicely seeking --- src/mpris2-controller.vala | 8 +++++--- src/sound-service.c | 2 -- src/transport-widget.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index dae8dfb..7838a67 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -176,7 +176,7 @@ public class Mpris2Controller : GLib.Object public void transport_update(TransportMenuitem.action command) { - debug("transport_event input = %i", (int)command); + //debug("transport_event input = %i", (int)command); if(command == TransportMenuitem.action.PLAY_PAUSE){ this.player.PlayPause.begin(); } @@ -187,10 +187,12 @@ public class Mpris2Controller : GLib.Object this.player.Next.begin(); } else if(command == TransportMenuitem.action.REWIND){ - this.player.Seek.begin(-1); + debug("transport_event rewind = %i", (int)command); + this.player.Seek.begin(-500000); } else if(command == TransportMenuitem.action.FORWIND){ - this.player.Seek.begin(1); + debug("transport_event input = %i", (int)command); + this.player.Seek.begin(350000); } } diff --git a/src/sound-service.c b/src/sound-service.c index eeab33e..c79b9f6 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -40,10 +40,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); -/* close_pulse_activites(); g_main_loop_quit(mainloop); -*/ } return; diff --git a/src/transport-widget.c b/src/transport-widget.c index 2f5001c..00913aa 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -346,7 +346,7 @@ transport_widget_trigger_seek (gpointer userdata) { g_return_val_if_fail ( IS_TRANSPORT_WIDGET(userdata), FALSE ); TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (TRANSPORT_WIDGET(userdata)); - priv->skip_frequency = g_timeout_add (300, + priv->skip_frequency = g_timeout_add (100, transport_widget_seek, userdata); return FALSE; -- cgit v1.2.3 From 017cbc3be8b4bf1e365d013ede94c848e774d5ef Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 9 Mar 2011 14:17:12 +0000 Subject: refactored transport enums so as both vala and c are using the same definitions in common defs --- src/common-defs.h | 14 ++++++++++++++ src/indicator-sound.c | 12 ++++++------ src/mpris2-controller.vala | 35 ++++++++++++++++++----------------- src/sound-service.c | 2 ++ src/transport-menu-item.vala | 17 +++-------------- vapi/common-defs.vapi | 22 +++++++++++++++++++--- 6 files changed, 62 insertions(+), 40 deletions(-) diff --git a/src/common-defs.h b/src/common-defs.h index 2184a48..da504de 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -31,6 +31,20 @@ typedef enum { AVAILABLE }SoundState; +typedef enum { + TRANSPORT_ACTION_PREVIOUS, + TRANSPORT_ACTION_PLAY_PAUSE, + TRANSPORT_ACTION_NEXT, + TRANSPORT_ACTION_REWIND, + TRANSPORT_ACTION_FORWIND, + TRANSPORT_ACTION_NO_ACTION +}TransportAction; + +typedef enum { + TRANSPORT_STATE_PLAYING, + TRANSPORT_STATE_PAUSED +}TransportState; + #define NOT_ACTIVE -1 #define DBUSMENU_PROPERTY_EMPTY -1 diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 6e1acc9..7851e8a 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -532,17 +532,17 @@ key_press_cb(GtkWidget* widget, GdkEventKey* event, gpointer data) switch (event->keyval) { case GDK_Right: transport_widget_react_to_key_press_event ( transport_widget, - TRANSPORT_NEXT ); + TRANSPORT_ACTION_NEXT ); digested = TRUE; break; case GDK_Left: transport_widget_react_to_key_press_event ( transport_widget, - TRANSPORT_PREVIOUS ); + TRANSPORT_ACTION_PREVIOUS ); digested = TRUE; break; case GDK_KEY_space: transport_widget_react_to_key_press_event ( transport_widget, - TRANSPORT_PLAY_PAUSE ); + TRANSPORT_ACTION_PLAY_PAUSE ); digested = TRUE; break; case GDK_Up: @@ -587,17 +587,17 @@ key_release_cb(GtkWidget* widget, GdkEventKey* event, gpointer data) switch (event->keyval) { case GDK_Right: transport_widget_react_to_key_release_event ( transport_widget, - TRANSPORT_NEXT ); + TRANSPORT_ACTION_NEXT ); digested = TRUE; break; case GDK_Left: transport_widget_react_to_key_release_event ( transport_widget, - TRANSPORT_PREVIOUS ); + TRANSPORT_ACTION_PREVIOUS ); digested = TRUE; break; case GDK_KEY_space: transport_widget_react_to_key_release_event ( transport_widget, - TRANSPORT_PLAY_PAUSE ); + TRANSPORT_ACTION_PLAY_PAUSE ); digested = TRUE; break; case GDK_Up: diff --git a/src/mpris2-controller.vala b/src/mpris2-controller.vala index 7838a67..6129458 100644 --- a/src/mpris2-controller.vala +++ b/src/mpris2-controller.vala @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ using Dbusmenu; +using Transport; /* This class will entirely replace mpris-controller.vala hence why there is no @@ -33,7 +34,7 @@ public class Mpris2Controller : GLib.Object public Mpris2Controller(PlayerController ctrl) { - GLib.Object(owner: ctrl); + GLib.Object(owner: ctrl); } construct{ @@ -77,7 +78,7 @@ public class Mpris2Controller : GLib.Object string state = this.player.PlaybackStatus; //debug("in the property update and the playback status = %s and update = %s", state, (string)play_v); Timeout.add ( 200, ensure_correct_playback_status ); - TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(state); + Transport.State p = (Transport.State)this.determine_play_state(state); (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p); } Variant? meta_v = changed_properties.lookup("Metadata"); @@ -115,7 +116,7 @@ public class Mpris2Controller : GLib.Object private bool ensure_correct_playback_status(){ //debug("TEST playback status = %s", this.player.PlaybackStatus); - TransportMenuitem.state p = (TransportMenuitem.state)this.determine_play_state(this.player.PlaybackStatus); + Transport.State p = (Transport.State)this.determine_play_state(this.player.PlaybackStatus); (this.owner.custom_items[PlayerController.widget_order.TRANSPORT] as TransportMenuitem).change_play_state(p); return false; } @@ -142,19 +143,19 @@ public class Mpris2Controller : GLib.Object return changed_updates; } - private TransportMenuitem.state determine_play_state(string? status){ + private Transport.State determine_play_state(string? status){ if(status != null && status == "Playing"){ - return TransportMenuitem.state.PLAYING; + return Transport.State.PLAYING; } - return TransportMenuitem.state.PAUSED; + return Transport.State.PAUSED; } public void initial_update() { - TransportMenuitem.state update; + Transport.State update; if(this.player.PlaybackStatus == null){ - update = TransportMenuitem.state.PAUSED; + update = Transport.State.PAUSED; } else{ update = determine_play_state (this.player.PlaybackStatus); @@ -174,25 +175,25 @@ public class Mpris2Controller : GLib.Object } } - public void transport_update(TransportMenuitem.action command) + public void transport_update(Transport.Action command) { //debug("transport_event input = %i", (int)command); - if(command == TransportMenuitem.action.PLAY_PAUSE){ + if(command == Transport.Action.PLAY_PAUSE){ this.player.PlayPause.begin(); } - else if(command == TransportMenuitem.action.PREVIOUS){ + else if(command == Transport.Action.PREVIOUS){ this.player.Previous.begin(); } - else if(command == TransportMenuitem.action.NEXT){ + else if(command == Transport.Action.NEXT){ this.player.Next.begin(); } - else if(command == TransportMenuitem.action.REWIND){ - debug("transport_event rewind = %i", (int)command); + else if(command == Transport.Action.REWIND){ + //debug("transport_event rewind = %i", (int)command); this.player.Seek.begin(-500000); } - else if(command == TransportMenuitem.action.FORWIND){ - debug("transport_event input = %i", (int)command); - this.player.Seek.begin(350000); + else if(command == Transport.Action.FORWIND){ + //debug("transport_event input = %i", (int)command); + this.player.Seek.begin(400000); } } diff --git a/src/sound-service.c b/src/sound-service.c index c79b9f6..eeab33e 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -40,8 +40,10 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); +/* close_pulse_activites(); g_main_loop_quit(mainloop); +*/ } return; diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index d5ae283..67e9562 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -20,21 +20,10 @@ with this program. If not, see . using Dbusmenu; using Gee; using DbusmenuTransport; +using Transport; public class TransportMenuitem : PlayerItem { - public enum action{ - PREVIOUS, - PLAY_PAUSE, - NEXT, - REWIND, - FORWIND - } - - public enum state{ - PLAYING, - PAUSED - } public TransportMenuitem(PlayerController parent) { @@ -42,7 +31,7 @@ public class TransportMenuitem : PlayerItem this.property_set_int(MENUITEM_PLAY_STATE, 1); } - public void change_play_state(state update) + public void change_play_state(Transport.State update) { //debug("UPDATING THE TRANSPORT DBUSMENUITEM PLAY STATE WITH VALUE %i", // (int)update); @@ -64,7 +53,7 @@ public class TransportMenuitem : PlayerItem int32 input = v.get_int32(); //debug("transport menu item -> handle_event with value %s", input.to_string()); //debug("transport owner name = %s", this.owner.app_info.get_name()); - this.owner.mpris_bridge.transport_update((action)input); + this.owner.mpris_bridge.transport_update((Transport.Action)input); } public static HashSet attributes_format() diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi index 7b38e9c..03a8e4c 100644 --- a/vapi/common-defs.vapi +++ b/vapi/common-defs.vapi @@ -40,14 +40,14 @@ namespace DbusmenuTitle{ public const string MENUITEM_RUNNING; } -[CCode (cheader_filename = "common-defs.h")] +/**[CCode (cheader_filename = "common-defs.h")] namespace DbusmenuScrub{ public const string MENUITEM_TYPE; public const string MENUITEM_POSITION; public const string MENUITEM_DURATION; public const string MENUITEM_PLAY_STATE; } - +**/ [CCode (cheader_filename = "common-defs.h")] namespace DbusmenuPlaylists{ public const string MENUITEM_TYPE; @@ -57,4 +57,20 @@ namespace DbusmenuPlaylists{ [CCode (cheader_filename = "common-defs.h")] namespace DbusmenuPlaylist{ public const string MENUITEM_PATH; -} \ No newline at end of file +} + + +[CCode (cprefix ="Transport", cheader_filename = "common-defs.h")] +namespace Transport{ + public enum Action{ + PREVIOUS, + PLAY_PAUSE, + NEXT, + REWIND, + FORWIND + } + public enum State{ + PLAYING, + PAUSED + } +} -- cgit v1.2.3 From 54041ebcb901119c79aa5c5156b5888a1deecd39 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 9 Mar 2011 16:18:02 +0000 Subject: refactored indicator side --- src/sound-service.c | 2 - src/transport-widget.c | 133 +++++++++++++++++++++++++------------------------ src/transport-widget.h | 27 +++------- 3 files changed, 75 insertions(+), 87 deletions(-) diff --git a/src/sound-service.c b/src/sound-service.c index eeab33e..c79b9f6 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -40,10 +40,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); -/* close_pulse_activites(); g_main_loop_quit(mainloop); -*/ } return; diff --git a/src/transport-widget.c b/src/transport-widget.c index 00913aa..0fbc101 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -27,7 +27,6 @@ Uses code from ctk #include #include "transport-widget.h" -#include "common-defs.h" #define RECT_WIDTH 130.0f @@ -77,15 +76,15 @@ typedef struct _TransportWidgetPrivate TransportWidgetPrivate; struct _TransportWidgetPrivate { - TransportWidgetEvent current_command; - TransportWidgetEvent key_event; - TransportWidgetEvent motion_event; - TransportWidgetState current_state; - GHashTable* command_coordinates; - DbusmenuMenuitem* twin_item; - gboolean has_focus; - gint hold_timer; - gint skip_frequency; + TransportAction current_command; + TransportAction key_event; + TransportAction motion_event; + TransportState current_state; + GHashTable* command_coordinates; + DbusmenuMenuitem* twin_item; + gboolean has_focus; + gint hold_timer; + gint skip_frequency; }; #define TRANSPORT_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRANSPORT_WIDGET_TYPE, TransportWidgetPrivate)) @@ -121,17 +120,17 @@ static void transport_widget_menu_hidden ( GtkWidget *menu, static void transport_widget_notify ( GObject *item, GParamSpec *pspec, gpointer user_data ); -static TransportWidgetEvent transport_widget_determine_button_event ( TransportWidget* button, +static TransportAction transport_widget_determine_button_event ( TransportWidget* button, GdkEventButton* event); -static TransportWidgetEvent transport_widget_determine_motion_event ( TransportWidget* button, +static TransportAction transport_widget_determine_motion_event ( TransportWidget* button, GdkEventMotion* event); static void transport_widget_react_to_button_release ( TransportWidget* button, - TransportWidgetEvent command); + TransportAction command); static void transport_widget_toggle_play_pause ( TransportWidget* button, - TransportWidgetState update); + TransportState update); static void transport_widget_select (GtkItem* menu, gpointer Userdata); static void transport_widget_deselect (GtkItem* menu, gpointer Userdata); -static TransportWidgetEvent transport_widget_collision_detection (gint x, gint y); +static TransportAction transport_widget_collision_detection (gint x, gint y); static void transport_widget_start_timing (TransportWidget* widget); static gboolean transport_widget_trigger_seek (gpointer userdata); static gboolean transport_widget_seek (gpointer userdata); @@ -160,10 +159,10 @@ static void transport_widget_init (TransportWidget *self) { TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(self); - priv->current_command = TRANSPORT_NADA; - priv->current_state = PAUSE; - priv->key_event = TRANSPORT_NADA; - priv->motion_event = TRANSPORT_NADA; + priv->current_command = TRANSPORT_ACTION_NO_ACTION; + priv->current_state = TRANSPORT_STATE_PAUSED; + priv->key_event = TRANSPORT_ACTION_NO_ACTION; + priv->motion_event = TRANSPORT_ACTION_NO_ACTION; priv->has_focus = FALSE; priv->hold_timer = 0; priv->skip_frequency = 0; @@ -177,7 +176,7 @@ transport_widget_init (TransportWidget *self) 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), + GINT_TO_POINTER(TRANSPORT_ACTION_PREVIOUS), previous_list); GList* play_list = NULL; @@ -187,7 +186,7 @@ transport_widget_init (TransportWidget *self) play_list = g_list_insert(play_list, GINT_TO_POINTER(43), 3); g_hash_table_insert(priv->command_coordinates, - GINT_TO_POINTER(TRANSPORT_PLAY_PAUSE), + GINT_TO_POINTER(TRANSPORT_ACTION_PLAY_PAUSE), play_list); GList* next_list = NULL; @@ -197,7 +196,7 @@ transport_widget_init (TransportWidget *self) next_list = g_list_insert(next_list, GINT_TO_POINTER(34), 3); g_hash_table_insert(priv->command_coordinates, - GINT_TO_POINTER(TRANSPORT_NEXT), + GINT_TO_POINTER(TRANSPORT_ACTION_NEXT), next_list); gtk_widget_set_size_request(GTK_WIDGET(self), 200, 43); g_signal_connect (G_OBJECT(self), @@ -255,7 +254,7 @@ transport_widget_is_selected ( TransportWidget* widget ) static void transport_widget_toggle_play_pause(TransportWidget* button, - TransportWidgetState update) + TransportState update) { TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button); priv->current_state = update; @@ -283,7 +282,7 @@ transport_widget_menu_hidden ( GtkWidget *menu, TransportWidget *transport) { g_return_if_fail(IS_TRANSPORT_WIDGET(transport)); - transport_widget_react_to_button_release(transport, TRANSPORT_NADA); + transport_widget_react_to_button_release(transport, TRANSPORT_ACTION_NO_ACTION); } static gboolean @@ -292,7 +291,7 @@ transport_widget_motion_notify_event (GtkWidget *menuitem, { g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE ); TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) ); - TransportWidgetEvent result = transport_widget_determine_motion_event ( TRANSPORT_WIDGET(menuitem), + TransportAction result = transport_widget_determine_motion_event ( TRANSPORT_WIDGET(menuitem), event); priv->motion_event = result; gtk_widget_queue_draw (menuitem); @@ -306,8 +305,8 @@ transport_widget_leave_notify_event (GtkWidget *menuitem, g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE ); TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) ); - priv->motion_event = TRANSPORT_NADA; - priv->current_command = TRANSPORT_NADA; + priv->motion_event = TRANSPORT_ACTION_NO_ACTION; + priv->current_command = TRANSPORT_ACTION_NO_ACTION; gtk_widget_queue_draw (GTK_WIDGET(menuitem)); return TRUE; @@ -319,9 +318,9 @@ transport_widget_button_press_event (GtkWidget *menuitem, { g_return_val_if_fail ( IS_TRANSPORT_WIDGET(menuitem), FALSE ); TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE ( TRANSPORT_WIDGET(menuitem) ); - TransportWidgetEvent result = transport_widget_determine_button_event ( TRANSPORT_WIDGET(menuitem), + TransportAction result = transport_widget_determine_button_event ( TRANSPORT_WIDGET(menuitem), event); - if(result != TRANSPORT_NADA){ + if(result != TRANSPORT_ACTION_NO_ACTION){ priv->current_command = result; gtk_widget_queue_draw (GTK_WIDGET(menuitem)); transport_widget_start_timing (TRANSPORT_WIDGET(menuitem)); @@ -363,9 +362,9 @@ transport_widget_seek (gpointer userdata) g_return_val_if_fail ( IS_TRANSPORT_WIDGET(userdata), FALSE ); TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (TRANSPORT_WIDGET(userdata)); GVariant* new_transport_state; - if(priv->current_command == TRANSPORT_NEXT){ + if(priv->current_command == TRANSPORT_ACTION_NEXT){ g_debug ("we should be skipping forward"); - new_transport_state = g_variant_new_int32 ((int)TRANSPORT_FORWIND); + new_transport_state = g_variant_new_int32 ((int)TRANSPORT_ACTION_FORWIND); dbusmenu_menuitem_handle_event ( priv->twin_item, "Transport state change", @@ -373,9 +372,9 @@ transport_widget_seek (gpointer userdata) 0 ); } - else if(priv->current_command == TRANSPORT_PREVIOUS){ + else if(priv->current_command == TRANSPORT_ACTION_PREVIOUS){ g_debug ("we should be skipping back"); - new_transport_state = g_variant_new_int32 ((int)TRANSPORT_REWIND); + new_transport_state = g_variant_new_int32 ((int)TRANSPORT_ACTION_REWIND); dbusmenu_menuitem_handle_event ( priv->twin_item, "Transport state change", @@ -393,9 +392,9 @@ transport_widget_button_release_event (GtkWidget *menuitem, g_return_val_if_fail(IS_TRANSPORT_WIDGET(menuitem), FALSE); TransportWidget* transport = TRANSPORT_WIDGET(menuitem); TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport ); - TransportWidgetEvent result = transport_widget_determine_button_event ( transport, + TransportAction result = transport_widget_determine_button_event ( transport, event ); - if (result != TRANSPORT_NADA && + if (result != TRANSPORT_ACTION_NO_ACTION && priv->current_command == result && priv->skip_frequency == 0){ GVariant* new_transport_state = g_variant_new_int32 ((int)result); @@ -427,9 +426,9 @@ transport_widget_deselect (GtkItem* item, gpointer Userdata) void transport_widget_react_to_key_press_event ( TransportWidget* transport, - TransportWidgetEvent transport_event ) + TransportAction transport_event ) { - if(transport_event != TRANSPORT_NADA){ + if(transport_event != TRANSPORT_ACTION_NO_ACTION){ TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport ); priv->current_command = transport_event; priv->key_event = transport_event; @@ -440,9 +439,9 @@ transport_widget_react_to_key_press_event ( TransportWidget* transport, void transport_widget_react_to_key_release_event ( TransportWidget* transport, - TransportWidgetEvent transport_event ) + TransportAction transport_event ) { - if(transport_event != TRANSPORT_NADA){ + if(transport_event != TRANSPORT_ACTION_NO_ACTION){ TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport ); GVariant* new_transport_event = g_variant_new_int32((int)transport_event); dbusmenu_menuitem_handle_event ( priv->twin_item, @@ -461,50 +460,50 @@ transport_widget_focus_update ( TransportWidget* transport, gboolean focus ) priv->has_focus = focus; } -static TransportWidgetEvent +static TransportAction transport_widget_determine_button_event( TransportWidget* button, GdkEventButton* event ) { return transport_widget_collision_detection (event->x, event->y); } -static TransportWidgetEvent +static TransportAction transport_widget_determine_motion_event( TransportWidget* button, GdkEventMotion* event ) { return transport_widget_collision_detection (event->x, event->y); } -static TransportWidgetEvent +static TransportAction transport_widget_collision_detection ( gint x, gint y ) { - TransportWidgetEvent event = TRANSPORT_NADA; + TransportAction event = TRANSPORT_ACTION_NO_ACTION; if (x > 67 && x < 112 && y > 12 && y < 40){ - event = TRANSPORT_PREVIOUS; + event = TRANSPORT_ACTION_PREVIOUS; } else if (x > 111 && x < 153 && y > 5 && y < 47){ - event = TRANSPORT_PLAY_PAUSE; + event = TRANSPORT_ACTION_PLAY_PAUSE; } else if (x > 152 && x < 197 && y > 12 && y < 40){ - event = TRANSPORT_NEXT; + event = TRANSPORT_ACTION_NEXT; } return event; } static void transport_widget_react_to_button_release ( TransportWidget* button, - TransportWidgetEvent command ) + TransportAction command ) { g_return_if_fail(IS_TRANSPORT_WIDGET(button)); TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE(button); - priv->current_command = TRANSPORT_NADA; - priv->key_event = TRANSPORT_NADA; + priv->current_command = TRANSPORT_ACTION_NO_ACTION; + priv->key_event = TRANSPORT_ACTION_NO_ACTION; gtk_widget_queue_draw (GTK_WIDGET(button)); if (priv->hold_timer != 0){ @@ -1292,7 +1291,7 @@ draw (GtkWidget* button, cairo_t *cr) MIDDLE_END); //prev/next button - if(priv->current_command == TRANSPORT_PREVIOUS) + if(priv->current_command == TRANSPORT_ACTION_PREVIOUS) { draw_gradient (cr, X, @@ -1318,7 +1317,7 @@ draw (GtkWidget* button, cairo_t *cr) INNER_COMPRESSED_START, INNER_COMPRESSED_END); } - else if(priv->current_command == TRANSPORT_NEXT) + else if(priv->current_command == TRANSPORT_ACTION_NEXT) { draw_gradient (cr, RECT_WIDTH / 2 + X, @@ -1344,7 +1343,7 @@ draw (GtkWidget* button, cairo_t *cr) INNER_COMPRESSED_START, INNER_COMPRESSED_END); } - else if (priv->motion_event == TRANSPORT_PREVIOUS) + else if (priv->motion_event == TRANSPORT_ACTION_PREVIOUS) { draw_gradient (cr, X, @@ -1370,7 +1369,7 @@ draw (GtkWidget* button, cairo_t *cr) MIDDLE_START_PRELIGHT, MIDDLE_END_PRELIGHT); } - else if (priv->motion_event == TRANSPORT_NEXT) + else if (priv->motion_event == TRANSPORT_ACTION_NEXT) { draw_gradient (cr, RECT_WIDTH / 2 + X, @@ -1398,7 +1397,7 @@ draw (GtkWidget* button, cairo_t *cr) } // play/pause shadow - if(priv->current_command != TRANSPORT_PLAY_PAUSE) + if(priv->current_command != TRANSPORT_ACTION_PLAY_PAUSE) { cairo_save (cr); cairo_rectangle (cr, X, Y, RECT_WIDTH, MIDDLE_RADIUS*2); @@ -1415,7 +1414,7 @@ draw (GtkWidget* button, cairo_t *cr) } // play/pause button - if(priv->current_command == TRANSPORT_PLAY_PAUSE) + if(priv->current_command == TRANSPORT_ACTION_PLAY_PAUSE) { draw_circle (cr, X + RECT_WIDTH / 2.0f - 2.0f * OUTER_RADIUS - 5.5f, @@ -1431,7 +1430,7 @@ draw (GtkWidget* button, cairo_t *cr) INNER_COMPRESSED_START, INNER_COMPRESSED_END); } - else if (priv->motion_event == TRANSPORT_PLAY_PAUSE) + else if (priv->motion_event == TRANSPORT_ACTION_PLAY_PAUSE) { /* this subtle offset is to fix alpha borders, should be removed once this draw routine will be refactored */ draw_circle (cr, @@ -1466,7 +1465,7 @@ draw (GtkWidget* button, cairo_t *cr) } // draw previous-button drop-shadow - if (priv->has_focus && priv->key_event == TRANSPORT_PREVIOUS) + if (priv->has_focus && priv->key_event == TRANSPORT_ACTION_PREVIOUS) { _setup (&cr_surf, &surf, PREV_WIDTH+6, PREV_HEIGHT+6); _mask_prev (cr_surf, @@ -1526,7 +1525,7 @@ draw (GtkWidget* button, cairo_t *cr) _finalize (cr, &cr_surf, &surf, PREV_X, PREV_Y); // draw next-button drop-shadow - if (priv->has_focus && priv->key_event == TRANSPORT_NEXT) + if (priv->has_focus && priv->key_event == TRANSPORT_ACTION_NEXT) { _setup (&cr_surf, &surf, NEXT_WIDTH+6, NEXT_HEIGHT+6); _mask_next (cr_surf, @@ -1586,9 +1585,10 @@ draw (GtkWidget* button, cairo_t *cr) _finalize (cr, &cr_surf, &surf, NEXT_X, NEXT_Y); // draw pause-button drop-shadow - if(priv->current_state == PLAY) + if(priv->current_state == TRANSPORT_STATE_PLAYING) { - if (priv->has_focus && (priv->key_event == TRANSPORT_NADA || priv->key_event == TRANSPORT_PLAY_PAUSE)) + if (priv->has_focus && (priv->key_event == TRANSPORT_ACTION_NO_ACTION || + priv->key_event == TRANSPORT_ACTION_PLAY_PAUSE)) { _setup (&cr_surf, &surf, PAUSE_WIDTH+6, PAUSE_HEIGHT+6); _mask_pause (cr_surf, @@ -1647,9 +1647,10 @@ draw (GtkWidget* button, cairo_t *cr) TRUE); _finalize (cr, &cr_surf, &surf, PAUSE_X, PAUSE_Y); } - else if(priv->current_state == PAUSE) + else if(priv->current_state == TRANSPORT_STATE_PAUSED) { - if (priv->has_focus && (priv->key_event == TRANSPORT_NADA || priv->key_event == TRANSPORT_PLAY_PAUSE)) + if (priv->has_focus && (priv->key_event == TRANSPORT_ACTION_NO_ACTION || + priv->key_event == TRANSPORT_ACTION_PLAY_PAUSE)) { _setup (&cr_surf, &surf, PLAY_WIDTH+6, PLAY_HEIGHT+6); _mask_play (cr_surf, @@ -1718,11 +1719,11 @@ transport_widget_set_twin_item(TransportWidget* self, priv->twin_item = twin_item; g_signal_connect(G_OBJECT(priv->twin_item), "property-changed", G_CALLBACK(transport_widget_property_update), self); - gint initial_state = dbusmenu_menuitem_property_get_int( twin_item, + gint initial_state = dbusmenu_menuitem_property_get_int (twin_item, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE ); //g_debug("TRANSPORT WIDGET - INITIAL UPDATE = %i", initial_state); - transport_widget_toggle_play_pause( self, - (TransportWidgetState)initial_state); + transport_widget_toggle_play_pause (self, + (TransportState)initial_state); } /** @@ -1741,7 +1742,7 @@ transport_widget_property_update(DbusmenuMenuitem* item, gchar* property, { int update_value = g_variant_get_int32(value); //g_debug("transport_widget_update_state - with value %i", update_value); - transport_widget_toggle_play_pause(bar, (TransportWidgetState)update_value); + transport_widget_toggle_play_pause(bar, (TransportState)update_value); } } diff --git a/src/transport-widget.h b/src/transport-widget.h index c9354b1..e5e91dc 100644 --- a/src/transport-widget.h +++ b/src/transport-widget.h @@ -23,6 +23,8 @@ with this program. If not, see . #include #include +#include "common-defs.h" + G_BEGIN_DECLS #define TRANSPORT_WIDGET_TYPE (transport_widget_get_type ()) @@ -35,19 +37,6 @@ G_BEGIN_DECLS typedef struct _TransportWidget TransportWidget; typedef struct _TransportWidgetClass TransportWidgetClass; -typedef enum { - TRANSPORT_PREVIOUS, - TRANSPORT_PLAY_PAUSE, - TRANSPORT_NEXT, - TRANSPORT_REWIND, - TRANSPORT_FORWIND, - TRANSPORT_NADA -}TransportWidgetEvent; - -typedef enum { - PLAY, - PAUSE -}TransportWidgetState; struct _TransportWidgetClass { GtkMenuItemClass parent_class; @@ -67,12 +56,12 @@ typedef struct void _color_shade (const CairoColorRGB *a, float k, CairoColorRGB *b); GType transport_widget_get_type (void); -GtkWidget* transport_widget_new ( DbusmenuMenuitem *item ); -void transport_widget_react_to_key_press_event ( TransportWidget* widget, - TransportWidgetEvent transport_event ); -void transport_widget_react_to_key_release_event ( TransportWidget* widget, - TransportWidgetEvent transport_event ); -gboolean transport_widget_is_selected ( TransportWidget* widget ); +GtkWidget* transport_widget_new (DbusmenuMenuitem *item); +void transport_widget_react_to_key_press_event (TransportWidget* widget, + TransportAction transport_event); +void transport_widget_react_to_key_release_event (TransportWidget* widget, + TransportAction transport_event); +gboolean transport_widget_is_selected (TransportWidget* widget); G_END_DECLS #endif -- cgit v1.2.3 From c3bf2f956a4d2ef4dfb21494655dec3c9570df2a Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 9 Mar 2011 16:38:11 +0000 Subject: icons names updated to match new icons submitted by Daniel --- src/voip-input-widget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/voip-input-widget.c b/src/voip-input-widget.c index 9b29feb..fc295ce 100644 --- a/src/voip-input-widget.c +++ b/src/voip-input-widget.c @@ -95,12 +95,12 @@ voip_input_widget_init (VoipInputWidget *self) g_signal_connect(priv->ido_voip_input_slider, "slider-released", G_CALLBACK(voip_input_widget_slider_released), self); GtkWidget* primary_image = ido_scale_menu_item_get_primary_image((IdoScaleMenuItem*)priv->ido_voip_input_slider); - GIcon * primary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone"); + GIcon * primary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone-none-panel"); gtk_image_set_from_gicon(GTK_IMAGE(primary_image), primary_gicon, GTK_ICON_SIZE_MENU); g_object_unref(primary_gicon); GtkWidget* secondary_image = ido_scale_menu_item_get_secondary_image((IdoScaleMenuItem*)priv->ido_voip_input_slider); - GIcon * secondary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone-high"); + GIcon * secondary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone-high-panel"); gtk_image_set_from_gicon(GTK_IMAGE(secondary_image), secondary_gicon, GTK_ICON_SIZE_MENU); g_object_unref(secondary_gicon); -- cgit v1.2.3 From 7169ee044ae4bded4df95e4c3fb92b1dfa99b74b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 9 Mar 2011 18:00:36 +0000 Subject: deleting commented out vapi defs --- vapi/common-defs.vapi | 8 -------- 1 file changed, 8 deletions(-) diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi index 03a8e4c..7cac0de 100644 --- a/vapi/common-defs.vapi +++ b/vapi/common-defs.vapi @@ -40,14 +40,6 @@ namespace DbusmenuTitle{ public const string MENUITEM_RUNNING; } -/**[CCode (cheader_filename = "common-defs.h")] -namespace DbusmenuScrub{ - public const string MENUITEM_TYPE; - public const string MENUITEM_POSITION; - public const string MENUITEM_DURATION; - public const string MENUITEM_PLAY_STATE; -} -**/ [CCode (cheader_filename = "common-defs.h")] namespace DbusmenuPlaylists{ public const string MENUITEM_TYPE; -- cgit v1.2.3 From bc33d0a5ef7a294804719273811cdd2878bddbe9 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 9 Mar 2011 18:58:36 +0000 Subject: now uses the correct basename minus the extension for the icon name property --- src/playlists-menu-item.vala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 9b1f724..78fb6dc 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -49,10 +49,14 @@ public class PlaylistsMenuitem : PlayerItem menuitem.property_set (MENUITEM_PROP_LABEL, detail.name); var icon_file = File.new_for_path (detail.icon_path); - if (icon_file.query_exists () == true) { - debug ("icon name = %s", icon_file.get_basename ()); + + if (icon_file.get_basename () != null) { + debug ("icon name = %s", icon_file.get_basename().split(".")[0]); menuitem.property_set (MENUITEM_PROP_ICON_NAME, - icon_file.get_basename () ); + icon_file.get_basename().split(".")[0]); + } + // TODO: Make sure to set a stock playlist image + else{ } menuitem.property_set (MENUITEM_PROP_ICON_NAME, detail.icon_path); menuitem.property_set (MENUITEM_PATH, (string)detail.path); -- cgit v1.2.3 From 8ded632700c7331b9e4e1f9f1b19ae9bade2eced Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 9 Mar 2011 19:36:20 +0000 Subject: tidied --- src/playlists-menu-item.vala | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 78fb6dc..2b820e5 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -47,18 +47,13 @@ public class PlaylistsMenuitem : PlayerItem Dbusmenu.Menuitem menuitem = new Menuitem(); menuitem.property_set (MENUITEM_PROP_LABEL, detail.name); - - var icon_file = File.new_for_path (detail.icon_path); - - if (icon_file.get_basename () != null) { - debug ("icon name = %s", icon_file.get_basename().split(".")[0]); - menuitem.property_set (MENUITEM_PROP_ICON_NAME, - icon_file.get_basename().split(".")[0]); + var result = this.parse_icon_path (detail.icon_path); + if (result != null) { + menuitem.property_set (MENUITEM_PROP_ICON_NAME, result); } // TODO: Make sure to set a stock playlist image else{ } - menuitem.property_set (MENUITEM_PROP_ICON_NAME, detail.icon_path); menuitem.property_set (MENUITEM_PATH, (string)detail.path); menuitem.property_set_bool (MENUITEM_PROP_VISIBLE, true); menuitem.property_set_bool (MENUITEM_PROP_ENABLED, true); @@ -88,12 +83,25 @@ public class PlaylistsMenuitem : PlayerItem } } + private string? parse_icon_path (string path) + { + var icon_file = File.new_for_path (path); + + if (icon_file.get_basename() == null)return null; + + debug ("icon name = %s", icon_file.get_basename().split(".")[0]); + return icon_file.get_basename().split(".")[0]; + } + public void update_individual_playlist (PlaylistDetails new_detail) { foreach ( Dbusmenu.Menuitem item in this.current_playlists.values ){ if (new_detail.path == item.property_get (MENUITEM_PATH)){ item.property_set (MENUITEM_PROP_LABEL, new_detail.name); - item.property_set (MENUITEM_PROP_ICON_NAME, new_detail.icon_path); + var result = this.parse_icon_path (new_detail.icon_path); + if (result != null) { + item.property_set (MENUITEM_PROP_ICON_NAME, result); + } } } // If its active make sure the name is updated on the root item. -- cgit v1.2.3 From f6fd2dc4c5c1fb31f9175ddded990264cf939c77 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 10 Mar 2011 19:48:26 +0000 Subject: fixes bug around volume going to zero on client start up --- src/slider-menu-item.c | 3 ++- src/volume-widget.c | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/slider-menu-item.c b/src/slider-menu-item.c index b89f5ca..1c88f01 100644 --- a/src/slider-menu-item.c +++ b/src/slider-menu-item.c @@ -92,10 +92,11 @@ handle_event (DbusmenuMenuitem * mi, input = g_variant_get_variant(value); } - gboolean volume_input = g_variant_get_double(input); if (value != NULL){ if (IS_SLIDER_MENU_ITEM (mi)) { SliderMenuItemPrivate* priv = SLIDER_MENU_ITEM_GET_PRIVATE (SLIDER_MENU_ITEM (mi)); + gdouble volume_input = g_variant_get_double(input); + //g_debug ("slider menu item about to update volume %f", volume_input); active_sink_update_volume (priv->a_sink, volume_input); active_sink_ensure_sink_is_unmuted (priv->a_sink); } diff --git a/src/volume-widget.c b/src/volume-widget.c index c45e93c..5c842dc 100644 --- a/src/volume-widget.c +++ b/src/volume-widget.c @@ -128,6 +128,7 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property, GVariant* value, gpointer userdata) { g_return_if_fail (IS_VOLUME_WIDGET (userdata)); + g_return_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE) ); VolumeWidget* mitem = VOLUME_WIDGET(userdata); VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem); //g_debug("scrub-widget::property_update for prop %s", property); @@ -136,7 +137,6 @@ volume_widget_property_update( DbusmenuMenuitem* item, gchar* property, GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); GtkRange *range = (GtkRange*)slider; gdouble update = g_variant_get_double (value); - //g_debug("volume-widget - update level with value %f", update); gtk_range_set_value(range, update); update_accessible_desc(priv->indicator); } @@ -163,13 +163,14 @@ volume_widget_set_twin_item(VolumeWidget* self, static gboolean volume_widget_change_value_cb (GtkRange *range, - GtkScrollType scroll, - gdouble new_value, - gpointer user_data) + GtkScrollType scroll, + gdouble new_value, + gpointer user_data) { g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE); VolumeWidget* mitem = VOLUME_WIDGET(user_data); - volume_widget_update(mitem, new_value); + //g_debug ("changed value %f", new_value); + volume_widget_update(mitem, new_value); return FALSE; } @@ -178,17 +179,19 @@ volume_widget_change_value_cb (GtkRange *range, which set the slider to 0 or 100. Ignore all other events. */ static gboolean -volume_widget_value_changed_cb(GtkRange *range, gpointer user_data) +volume_widget_value_changed_cb (GtkRange *range, gpointer user_data) { + g_return_val_if_fail (IS_VOLUME_WIDGET (user_data), FALSE); VolumeWidget* mitem = VOLUME_WIDGET(user_data); VolumeWidgetPrivate * priv = VOLUME_WIDGET_GET_PRIVATE(mitem); - GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); + GtkWidget *slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)priv->ido_volume_slider); gdouble current_value = CLAMP(gtk_range_get_value(GTK_RANGE(slider)), 0, 100); - + //g_debug ("value changed %f", gtk_range_get_value(GTK_RANGE(slider))); if(current_value == 0 || current_value == 100){ volume_widget_update(mitem, current_value); } + return FALSE; } -- cgit v1.2.3 From bd007a90262f90081c1be04947e949191cb7e1c6 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 11 Mar 2011 11:43:09 +0000 Subject: players who do not export icon names will have iconless playlists menuitems --- src/playlists-menu-item.vala | 13 +++++-------- src/sound-service.c | 6 ++---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 2b820e5..9dcb686 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -48,12 +48,11 @@ public class PlaylistsMenuitem : PlayerItem Dbusmenu.Menuitem menuitem = new Menuitem(); menuitem.property_set (MENUITEM_PROP_LABEL, detail.name); var result = this.parse_icon_path (detail.icon_path); + if (result != null) { - menuitem.property_set (MENUITEM_PROP_ICON_NAME, result); - } - // TODO: Make sure to set a stock playlist image - else{ + menuitem.property_set (MENUITEM_PROP_ICON_NAME, result); } + menuitem.property_set (MENUITEM_PATH, (string)detail.path); menuitem.property_set_bool (MENUITEM_PROP_VISIBLE, true); menuitem.property_set_bool (MENUITEM_PROP_ENABLED, true); @@ -85,11 +84,9 @@ public class PlaylistsMenuitem : PlayerItem private string? parse_icon_path (string path) { + if (path == "")return null; var icon_file = File.new_for_path (path); - - if (icon_file.get_basename() == null)return null; - - debug ("icon name = %s", icon_file.get_basename().split(".")[0]); + if (icon_file.get_path() == null)return null; return icon_file.get_basename().split(".")[0]; } diff --git a/src/sound-service.c b/src/sound-service.c index 553f07a..cfc0b7e 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -39,10 +39,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) { if (mainloop != NULL) { g_debug("Service shutdown !"); - - //close_pulse_activites(); - //g_main_loop_quit(mainloop); - + close_pulse_activites(); + g_main_loop_quit(mainloop); } return; } -- cgit v1.2.3 From e20947c031e791447487c71d902986837e50fca6 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 11 Mar 2011 11:46:20 +0000 Subject: bumped the dbusmenu version --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e4ccb67..39d3f6e 100644 --- a/configure.ac +++ b/configure.ac @@ -33,7 +33,7 @@ DBUSMENUGTK_REQUIRED_VERSION=0.3.9 POLKIT_REQUIRED_VERSION=0.92 PULSE_AUDIO_REQUIRED_VERSION=0.9.19 INDICATOR_DISPLAY_OBJECTS=0.1.11 -DBUSMENUGLIB_REQUIRED_VERSION=0.3.9 +DBUSMENUGLIB_REQUIRED_VERSION=0.3.101 GIO_2_0_REQUIRED_VERSION=2.25.13 LIBNOTIFY_REQUIRED_VERSION=0.7.0 -- cgit v1.2.3 From e97cb2babe643545ac2ccc0484e3a5bc98dbfb2c Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 11 Mar 2011 11:48:37 +0000 Subject: bumped the dbusmenu gtk version --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 39d3f6e..bf438e0 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) GTK_REQUIRED_VERSION=2.12 INDICATOR_REQUIRED_VERSION=0.3.19 -DBUSMENUGTK_REQUIRED_VERSION=0.3.9 +DBUSMENUGTK_REQUIRED_VERSION=0.3.101 POLKIT_REQUIRED_VERSION=0.92 PULSE_AUDIO_REQUIRED_VERSION=0.9.19 INDICATOR_DISPLAY_OBJECTS=0.1.11 -- cgit v1.2.3 From 529fa42ec3fe6c144e09e254e3bf60fce35d75c9 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 11 Mar 2011 12:49:42 +0000 Subject: key board shortcuts now handle rewind and forwind intentions --- src/transport-widget.c | 52 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/src/transport-widget.c b/src/transport-widget.c index 0fbc101..ef2916d 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -87,6 +87,8 @@ struct _TransportWidgetPrivate gint skip_frequency; }; +// TODO refactor the UI handlers, consolidate functionality between key press /release +// and button press / release. #define TRANSPORT_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRANSPORT_WIDGET_TYPE, TransportWidgetPrivate)) /* Gobject boiler plate */ @@ -295,6 +297,14 @@ transport_widget_motion_notify_event (GtkWidget *menuitem, event); priv->motion_event = result; gtk_widget_queue_draw (menuitem); + if (priv->hold_timer != 0){ + g_source_remove (priv->hold_timer); + priv->hold_timer = 0; + } + if(priv->skip_frequency != 0){ + g_source_remove (priv->skip_frequency); + priv->skip_frequency = 0; + } return TRUE; } @@ -323,7 +333,10 @@ transport_widget_button_press_event (GtkWidget *menuitem, if(result != TRANSPORT_ACTION_NO_ACTION){ priv->current_command = result; gtk_widget_queue_draw (GTK_WIDGET(menuitem)); - transport_widget_start_timing (TRANSPORT_WIDGET(menuitem)); + if (priv->current_command == TRANSPORT_ACTION_PREVIOUS || + priv->current_command == TRANSPORT_ACTION_NEXT){ + transport_widget_start_timing (TRANSPORT_WIDGET(menuitem)); + } } return TRUE; } @@ -335,9 +348,11 @@ static void transport_widget_start_timing (TransportWidget* widget) { TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (widget); - priv->hold_timer = g_timeout_add (800, - transport_widget_trigger_seek, - widget); + if (priv->hold_timer == 0){ + priv->hold_timer = g_timeout_add (800, + transport_widget_trigger_seek, + widget); + } } static gboolean @@ -345,9 +360,12 @@ transport_widget_trigger_seek (gpointer userdata) { g_return_val_if_fail ( IS_TRANSPORT_WIDGET(userdata), FALSE ); TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (TRANSPORT_WIDGET(userdata)); - priv->skip_frequency = g_timeout_add (100, - transport_widget_seek, - userdata); + if (priv->skip_frequency == 0){ + priv->skip_frequency = g_timeout_add (100, + transport_widget_seek, + userdata); + } + priv->hold_timer = 0; return FALSE; } @@ -363,7 +381,7 @@ transport_widget_seek (gpointer userdata) TransportWidgetPrivate* priv = TRANSPORT_WIDGET_GET_PRIVATE (TRANSPORT_WIDGET(userdata)); GVariant* new_transport_state; if(priv->current_command == TRANSPORT_ACTION_NEXT){ - g_debug ("we should be skipping forward"); + //g_debug ("we should be skipping forward"); new_transport_state = g_variant_new_int32 ((int)TRANSPORT_ACTION_FORWIND); dbusmenu_menuitem_handle_event ( priv->twin_item, @@ -373,7 +391,7 @@ transport_widget_seek (gpointer userdata) } else if(priv->current_command == TRANSPORT_ACTION_PREVIOUS){ - g_debug ("we should be skipping back"); + //g_debug ("we should be skipping back"); new_transport_state = g_variant_new_int32 ((int)TRANSPORT_ACTION_REWIND); dbusmenu_menuitem_handle_event ( priv->twin_item, @@ -434,6 +452,10 @@ transport_widget_react_to_key_press_event ( TransportWidget* transport, priv->key_event = transport_event; gtk_widget_realize ( GTK_WIDGET(transport) ); gtk_widget_queue_draw (GTK_WIDGET(transport) ); + if (priv->current_command == TRANSPORT_ACTION_PREVIOUS || + priv->current_command == TRANSPORT_ACTION_NEXT){ + transport_widget_start_timing (transport); + } } } @@ -443,11 +465,13 @@ transport_widget_react_to_key_release_event ( TransportWidget* transport, { if(transport_event != TRANSPORT_ACTION_NO_ACTION){ TransportWidgetPrivate * priv = TRANSPORT_WIDGET_GET_PRIVATE ( transport ); - GVariant* new_transport_event = g_variant_new_int32((int)transport_event); - dbusmenu_menuitem_handle_event ( priv->twin_item, - "Transport state change", - new_transport_event, - 0 ); + GVariant* new_transport_event = g_variant_new_int32((int)transport_event); + if (priv->skip_frequency == 0){ + dbusmenu_menuitem_handle_event ( priv->twin_item, + "Transport state change", + new_transport_event, + 0 ); + } } transport_widget_react_to_button_release ( transport, transport_event ); -- cgit v1.2.3 From 6b0f3ffcaf55d151d87f8dc60d16388b8f4557a2 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 11 Mar 2011 15:16:09 +0000 Subject: applied Mikkel's suggestions --- src/playlists-menu-item.vala | 5 +---- src/sound-service-dbus.c | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index 9dcb686..b3fd7c6 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -84,10 +84,7 @@ public class PlaylistsMenuitem : PlayerItem private string? parse_icon_path (string path) { - if (path == "")return null; - var icon_file = File.new_for_path (path); - if (icon_file.get_path() == null)return null; - return icon_file.get_basename().split(".")[0]; + return ( path == "" ? null : Path.get_basename(path).split(".")[0] ); } public void update_individual_playlist (PlaylistDetails new_detail) diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 580304f..9e5cffe 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -148,7 +148,7 @@ sound_service_dbus_create_root_item (SoundServiceDbus* self) priv->root_menuitem = dbusmenu_menuitem_new(); g_debug("Root ID: %d", dbusmenu_menuitem_get_id(priv->root_menuitem)); DbusmenuServer *server = dbusmenu_server_new (INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH); - gchar* paths[] = {"/usr/share/banshee-1/icons", NULL}; + const gchar* paths[] = {"/usr/share/banshee-1/icons", NULL}; dbusmenu_server_set_icon_paths (server, paths); dbusmenu_server_set_root (server, priv->root_menuitem); -- cgit v1.2.3 From 9484c6a93caa72c9c6f1f4205c6982bc58615c58 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 11 Mar 2011 16:23:38 +0000 Subject: revert to old way of parsing playlist icon path, i suspect some vala gremlins were working against us ... --- src/playlists-menu-item.vala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/playlists-menu-item.vala b/src/playlists-menu-item.vala index b3fd7c6..46bda50 100644 --- a/src/playlists-menu-item.vala +++ b/src/playlists-menu-item.vala @@ -48,9 +48,9 @@ public class PlaylistsMenuitem : PlayerItem Dbusmenu.Menuitem menuitem = new Menuitem(); menuitem.property_set (MENUITEM_PROP_LABEL, detail.name); var result = this.parse_icon_path (detail.icon_path); - if (result != null) { - menuitem.property_set (MENUITEM_PROP_ICON_NAME, result); + debug("ICON PATH = %s and name = %s", detail.icon_path, Path.get_basename(detail.icon_path).split(".")[0]); + menuitem.property_set (MENUITEM_PROP_ICON_NAME, (string)result); } menuitem.property_set (MENUITEM_PATH, (string)detail.path); @@ -84,7 +84,11 @@ public class PlaylistsMenuitem : PlayerItem private string? parse_icon_path (string path) { - return ( path == "" ? null : Path.get_basename(path).split(".")[0] ); + if (path == "")return null; + var icon_file = File.new_for_path (path); + if (icon_file.get_path() == null)return null; + return icon_file.get_basename().split(".")[0]; + //return ( path == "" ? null : Path.get_basename(path).split(".")[0] ); } public void update_individual_playlist (PlaylistDetails new_detail) -- cgit v1.2.3 From 014ef9d63fdf4d7213f1a9481d0566a63daa7543 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 11 Mar 2011 16:34:21 +0000 Subject: bumped in prep for release --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index bf438e0..88535b1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(indicator-sound, 0.6.2, conor.curran@canonical.com) +AC_INIT(indicator-sound, 0.6.3, conor.curran@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-sound, 0.6.2) +AM_INIT_AUTOMAKE(indicator-sound, 0.6.3) AM_MAINTAINER_MODE -- cgit v1.2.3