From e2792ab0a1dfd8ca0c96b59b675fa09e8cd0e5d7 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 14 Oct 2010 17:58:42 +0100 Subject: moving towards getting the icon across the divide --- src/Makefile.am | 2 ++ src/music-player-bridge.vala | 14 ++++++++++++-- src/player-controller.vala | 16 ++++++++++++++++ src/sound-service.c | 4 ++-- src/title-widget.c | 3 +++ src/title-widget.h | 2 ++ 6 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index b23e9c1..563b755 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -76,6 +76,8 @@ music_bridge_VALAFLAGS = \ --pkg gee-1.0 \ --pkg Indicate-0.2 \ --pkg Dbusmenu-Glib-0.2 \ + --pkg DbusmenuGtk-0.2 \ + --pkg gtk+-2.0 \ --pkg common-defs \ --pkg dbus-glib-1 \ --pkg gio-unix-2.0 \ diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 9ba4ef6..e109dec 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -24,7 +24,6 @@ using GLib; public class MusicPlayerBridge : GLib.Object { - private Listener listener; private Dbusmenu.Menuitem root_menu; private HashMap registered_clients; @@ -61,8 +60,12 @@ public class MusicPlayerBridge : GLib.Object calculate_menu_position(), PlayerController.state.OFFLINE); ctrl.app_info = app_info; - if(ctrl.app_info == null) + if(ctrl.app_info == null){ warning("for some reason the app info is null"); + } + else{ + ctrl.set_icon_path(); + } this.registered_clients.set(determine_key(app), ctrl); } } @@ -102,6 +105,13 @@ public class MusicPlayerBridge : GLib.Object bridge.calculate_menu_position(), PlayerController.state.READY); ctrl.set("app_info", app_info); + if(ctrl.app_info == null){ + warning("for some reason the app info is null"); + } + else{ + ctrl.set_icon_path(); + } + bridge.registered_clients.set(determine_key(path), ctrl); debug("successfully created appinfo and instance from path and set it on the respective instance"); } diff --git a/src/player-controller.vala b/src/player-controller.vala index d5b79e7..4b5144a 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -19,6 +19,7 @@ with this program. If not, see . */ using Dbusmenu; +using DbusmenuGtk; using Gee; public class PlayerController : GLib.Object @@ -62,6 +63,7 @@ public class PlayerController : GLib.Object construct_widgets(); establish_mpris_connection(); this.update_layout(); + } public void update_state(state new_state) @@ -167,6 +169,20 @@ public class PlayerController : GLib.Object return formatted; } + public void set_icon_path() + { + if(this.app_info != null){ + /*Gtk.IconTheme icon_t = Gtk.IconTheme.get_default(); + Gtk.IconInfo iconInfo = icon_t.lookup_icon(app_info.get_icon(), + getIconSize(), + Gtk.ICON_LOOKUP_USE_BUILTIN);*/ + //return iconInfo.load_icon(); + dbusmenu_menuitem_property_set_image(this.custom_items[widget_order.TITLE], + MENUITEM_PROP_ICON_DATA, + app_info.get_icon()); + } + } + // Temporarily we will need to handle to different mpris implemenations // Do it for now - a couple of weeks should see this messy carry on out of // the codebase. diff --git a/src/sound-service.c b/src/sound-service.c index f19379d..51f5f37 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -41,8 +41,8 @@ service_shutdown (IndicatorService *service, gpointer user_data) if (mainloop != NULL) { g_debug("Service shutdown !"); //TODO: uncomment for release !! - close_pulse_activites(); - g_main_loop_quit(mainloop); + //close_pulse_activites(); + //g_main_loop_quit(mainloop); } return; } diff --git a/src/title-widget.c b/src/title-widget.c index 5e86b4d..d9faa57 100644 --- a/src/title-widget.c +++ b/src/title-widget.c @@ -135,6 +135,9 @@ title_widget_property_update(DbusmenuMenuitem* item, gchar* property, gtk_menu_item_set_label (GTK_MENU_ITEM(mitem), g_value_get_string(value)); } + /*else(g_ascii_strcasecmp(DBUSMENU_MENUITEM_PROP_ICON_DATA, property) == 0){ + g_debug("changing the icon data on the title"); + }*/ } static void diff --git a/src/title-widget.h b/src/title-widget.h index 574a2b1..1e25775 100644 --- a/src/title-widget.h +++ b/src/title-widget.h @@ -21,6 +21,8 @@ with this program. If not, see . #include #include +#include + G_BEGIN_DECLS -- cgit v1.2.3