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(-) (limited to 'src') 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(+) (limited to 'src') 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(-) (limited to 'src') 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(+) (limited to 'src') 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 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(-) (limited to 'src') 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(-) (limited to 'src') 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 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(-) (limited to 'src') 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 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(-) (limited to 'src') 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