From 2d1c2058a7384a6dc0d4c1b900e223b6905df4c6 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 29 Jun 2010 21:52:56 +0100 Subject: launching apps now working --- src/music-player-bridge.vala | 35 ++++++++++++++++++++++++++--------- src/sound-service.c | 4 ++-- src/transport-menu-item.vala | 1 - 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 6fc9032..07eef2a 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -42,15 +42,22 @@ public class MusicPlayerBridge : GLib.Object listener.server_removed.connect(on_server_removed); listener.server_count_changed.connect(on_server_count_changed); } - // Alpha 2 not in use ... yet. + private void try_to_add_inactive_familiar_clients(){ // for now just use one of the entries. int count = 0; foreach(string app in this.playersDB.records()){ if(count == 0){ debug("we have found %s", app); + if(app == null){ + debug("moving on to next player"); + continue; + } string[] bits = app.split("/"); - + if(bits.length < 2){ + continue; + } + debug("trying to dig deeper %s", app); try{ string app_name = bits[bits.length -1].split(".")[0]; debug("we have found %s", app_name); @@ -58,9 +65,11 @@ public class MusicPlayerBridge : GLib.Object app_name, false); this.registered_clients.set(app_name, ctrl); - DesktopAppInfo info = new DesktopAppInfo.from_filename(app_name); - string desc = info.get_display_name(); - debug("description from app %s", desc); + DesktopAppInfo info = new DesktopAppInfo.from_filename(app); + GLib.AppInfo app_info = info as GLib.AppInfo; + + debug("Display name = %s", app_info.get_display_name()); + app_info.launch(null, null); count += 1; } catch(Error er){ @@ -93,7 +102,8 @@ public class MusicPlayerBridge : GLib.Object if (root_menu != null && client_name != null){ registered_clients[client_name].vanish(); registered_clients.remove(client_name); - debug("Successively removed menu_item for client %s from registered_clients", client_name); + debug("Successively removed menu_item for client %s from registered_clients", + client_name); } } @@ -109,15 +119,22 @@ public class MusicPlayerBridge : GLib.Object private void desktop_info_callback(Indicate.ListenerServer server, owned string path, void* data) { - debug("we got a desktop file path hopefully: %s", path); MusicPlayerBridge bridge = data as MusicPlayerBridge; - bridge.playersDB.insert(path); + // Not the most secure validation + // TODO revisit validation mechanism + if(path.contains("/")){ + debug("About to store desktop file path: %s", path); + bridge.playersDB.insert(path); + } + else{ + debug("Ignoring desktop file path: %s", path); + } } public void set_root_menu_item(Dbusmenu.Menuitem menu) { this.root_menu = menu; - //try_to_add_inactive_familiar_clients(); + try_to_add_inactive_familiar_clients(); } public void on_server_count_changed(Indicate.ListenerServer object, uint i) diff --git a/src/sound-service.c b/src/sound-service.c index 8f4e941..a5f3941 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -43,8 +43,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/transport-menu-item.vala b/src/transport-menu-item.vala index 264e153..e0d241e 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -27,7 +27,6 @@ public class TransportMenuitem : PlayerItem public TransportMenuitem() { this.property_set(MENUITEM_PROP_TYPE, MENUITEM_TYPE); - debug("transport on the vala side"); } public void change_play_state(int state) -- cgit v1.2.3 From edac78eadc5ddceb17b93bffa101eeffbab4437c Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 30 Jun 2010 18:02:53 +0100 Subject: correct startup behaviour in place --- src/familiar-players-db.vala | 3 +- src/music-player-bridge.vala | 74 ++++++++++++++++++++++++++++---------------- src/player-controller.vala | 25 ++++++++++----- 3 files changed, 67 insertions(+), 35 deletions(-) diff --git a/src/familiar-players-db.vala b/src/familiar-players-db.vala index 88bc01f..b83caa3 100644 --- a/src/familiar-players-db.vala +++ b/src/familiar-players-db.vala @@ -143,7 +143,8 @@ public class FamiliarPlayersDB : GLib.Object public bool already_familiar(string desktop) { - return this.players_DB.get(desktop); + debug("playerDB->already_familiar - result %s", this.players_DB.keys.contains(desktop).to_string()); + return this.players_DB.keys.contains(desktop); } public Gee.Set records() diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 07eef2a..84bf3df 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -44,32 +44,26 @@ public class MusicPlayerBridge : GLib.Object } private void try_to_add_inactive_familiar_clients(){ - // for now just use one of the entries. int count = 0; foreach(string app in this.playersDB.records()){ if(count == 0){ - debug("we have found %s", app); if(app == null){ - debug("moving on to next player"); + warning("App string in keyfile is null therefore moving on to next player"); continue; } - string[] bits = app.split("/"); - if(bits.length < 2){ - continue; - } - debug("trying to dig deeper %s", app); try{ - string app_name = bits[bits.length -1].split(".")[0]; - debug("we have found %s", app_name); - PlayerController ctrl = new PlayerController(this.root_menu, - app_name, - false); - this.registered_clients.set(app_name, ctrl); DesktopAppInfo info = new DesktopAppInfo.from_filename(app); + if(info == null){ + warning("Could not create a desktopappinfo instance from app: %s", app); + continue; + } GLib.AppInfo app_info = info as GLib.AppInfo; - - debug("Display name = %s", app_info.get_display_name()); - app_info.launch(null, null); + PlayerController ctrl = new PlayerController(this.root_menu, + app_info.get_name(), + app_info); + ctrl.set("active", false); + this.registered_clients.set(app_info.get_name().down().strip(), ctrl); + debug("Created a player controller for %s which was found in the cache file", app_info.get_name().down().strip()); count += 1; } catch(Error er){ @@ -84,13 +78,24 @@ public class MusicPlayerBridge : GLib.Object { debug("MusicPlayerBridge -> on_server_added with value %s", type); if(server_is_not_of_interest(type)) return; - string client_name = type.split(".")[1]; + string client_name = type.split(".")[1]; if (root_menu != null && client_name != null){ - listener_get_server_property_cb cb = (listener_get_server_property_cb)desktop_info_callback; - this.listener.server_get_desktop(object, cb, this); - PlayerController ctrl = new PlayerController(root_menu, client_name, true); - registered_clients.set(client_name, ctrl); - debug("client of name %s has successfully registered with us", client_name); + // If we have an instance already for this player, ensure it is switched to active + if(this.registered_clients.keys.contains(client_name)){ + debug("It figured out that it already has an instance for this player already"); + this.registered_clients[client_name].set("active", true); + } + //else init a new one + else{ + PlayerController ctrl = new PlayerController(root_menu, client_name); + 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 + if(this.registered_clients[client_name].app_info == null){ + listener_get_server_property_cb cb = (listener_get_server_property_cb)desktop_info_callback; + this.listener.server_get_desktop(object, cb, this); + } } } @@ -122,12 +127,18 @@ public class MusicPlayerBridge : GLib.Object MusicPlayerBridge bridge = data as MusicPlayerBridge; // Not the most secure validation // TODO revisit validation mechanism - if(path.contains("/")){ - debug("About to store desktop file path: %s", path); + if(path.contains("/") && bridge.playersDB.already_familiar(path) == false){ + debug("About to store desktop file path: %s", path); bridge.playersDB.insert(path); + AppInfo? app_info = create_app_info(path); + if(app_info != null){ + PlayerController ctrl = bridge.registered_clients[app_info.get_name().down().strip()]; + ctrl.set("app_info", app_info); + debug("successfully created appinfo from path and set it on the respective instance"); + } } else{ - debug("Ignoring desktop file path: %s", path); + debug("Ignoring desktop file path because its either invalid of the db cache file has it already: %s", path); } } @@ -156,6 +167,17 @@ public class MusicPlayerBridge : GLib.Object debug("MusicPlayerBridge -> indicator_modified with vale %s", s ); } + public static AppInfo? create_app_info(string path) + { + DesktopAppInfo info = new DesktopAppInfo.from_filename(path); + if(path == null){ + warning("Could not create a desktopappinfo instance from app: %s", path); + return null; + } + GLib.AppInfo app_info = info as GLib.AppInfo; + return app_info; + } + } diff --git a/src/player-controller.vala b/src/player-controller.vala index 0d8dc01..dfc2659 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -27,19 +27,20 @@ public class PlayerController : GLib.Object private const int TRANSPORT = 3; private Dbusmenu.Menuitem root_menu; - private string name; - private bool is_active; + public string name { get; set;} + public bool active { get; set;} public ArrayList custom_items; private MprisController mpris_adaptor; - private string desktop_path; - - public PlayerController(Dbusmenu.Menuitem root, string client_name, bool active) + public AppInfo app_info { get; set;} + + public PlayerController(Dbusmenu.Menuitem root, string client_name, AppInfo? info = null) { this.root_menu = root; this.name = format_client_name(client_name.strip()); - this.is_active = active; this.custom_items = new ArrayList(); + this.app_info = info; self_construct(); + //app_info.launch(null, null); // Temporary scenario to handle both v1 and v2 of MPRIS. if(this.name == "Vlc"){ @@ -61,6 +62,14 @@ public class PlayerController : GLib.Object root_menu.child_delete(item); } } + + //public void switch_active(bool active){ + // this.is_active = active; + //} + + //public bool has_app_info(){ + // return (this.app_info != null); + //} private bool self_construct() { @@ -84,7 +93,7 @@ public class PlayerController : GLib.Object } return true; } - + private static string format_client_name(string client_name) { string formatted = client_name; @@ -94,5 +103,5 @@ public class PlayerController : GLib.Object } return formatted; } - + } \ No newline at end of file -- cgit v1.2.3 From 7555ea6755750dd64a6c4652b852a0bdc0d0bfeb Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 6 Jul 2010 18:55:05 +0100 Subject: whole new widget to house the customised title item --- src/Makefile.am | 3 + src/common-defs.h | 3 + src/metadata-menu-item.vala | 2 +- src/mpris-controller.vala | 5 ++ src/music-player-bridge.vala | 17 +++-- src/player-controller.vala | 97 +++++++++++++++++++-------- src/player-item.vala | 30 ++++++--- src/title-menu-item.vala | 37 +++++++++++ src/title-widget.c | 155 +++++++++++++++++++++++++++++++++++++++++++ src/title-widget.h | 51 ++++++++++++++ src/transport-menu-item.vala | 4 +- src/transport-widget.c | 2 - vapi/common-defs.vapi | 6 ++ 13 files changed, 361 insertions(+), 51 deletions(-) create mode 100644 src/title-menu-item.vala create mode 100644 src/title-widget.c create mode 100644 src/title-widget.h diff --git a/src/Makefile.am b/src/Makefile.am index b33107d..327fcbb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,6 +14,8 @@ libsoundmenu_la_SOURCES = \ metadata-widget.c \ metadata-widget.h \ indicator-sound.c \ + title-widget.c \ + title-widget.h \ dbus-shared-names.h \ sound-service-client.h @@ -54,6 +56,7 @@ music_bridge_VALASOURCES = \ music-player-bridge.vala \ transport-menu-item.vala \ metadata-menu-item.vala \ + title-menu-item.vala \ player-controller.vala \ mpris-controller-v2.vala \ mpris-controller.vala \ diff --git a/src/common-defs.h b/src/common-defs.h index dca21cc..9c1fbab 100644 --- a/src/common-defs.h +++ b/src/common-defs.h @@ -34,3 +34,6 @@ with this program. If not, see . #define DBUSMENU_METADATA_MENUITEM_TEXT_TITLE "x-canonical-metadata-text-title" #define DBUSMENU_METADATA_MENUITEM_TEXT_ALBUM "x-canonical-metadata-text-album" #define DBUSMENU_METADATA_MENUITEM_ARTURL "x-canonical-metadata-arturl" + +#define DBUSMENU_TITLE_MENUITEM_TYPE "x-canonical-sound-menu-player-title-menu-item" +#define DBUSMENU_TITLE_MENUITEM_TEXT_NAME "x-canonical-sound-menu-player-title-name" diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 541fbf4..7eb112a 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -25,7 +25,7 @@ public class MetadataMenuitem : PlayerItem { public MetadataMenuitem() { - this.property_set(MENUITEM_PROP_TYPE, MENUITEM_TYPE); + Object(item_type: MENUITEM_TYPE); } public static HashSet attributes_format() diff --git a/src/mpris-controller.vala b/src/mpris-controller.vala index beaf02c..b1e66f3 100644 --- a/src/mpris-controller.vala +++ b/src/mpris-controller.vala @@ -76,6 +76,11 @@ public class MprisController : GLib.Object this.mpris_player.Pause(); } } + + public bool connected() + { + return (this.mpris_player != null); + } private void onStatusChange(dynamic DBus.Object mpris_client, status st) { diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 84bf3df..77341a4 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -44,6 +44,7 @@ public class MusicPlayerBridge : GLib.Object } private void try_to_add_inactive_familiar_clients(){ + // TODO handle multple players - just working with one right now int count = 0; foreach(string app in this.playersDB.records()){ if(count == 0){ @@ -59,9 +60,9 @@ public class MusicPlayerBridge : GLib.Object } GLib.AppInfo app_info = info as GLib.AppInfo; PlayerController ctrl = new PlayerController(this.root_menu, - app_info.get_name(), - app_info); - ctrl.set("active", false); + app_info.get_name(), + PlayerController.OFFLINE); + ctrl.set("app_info", app_info); this.registered_clients.set(app_info.get_name().down().strip(), ctrl); debug("Created a player controller for %s which was found in the cache file", app_info.get_name().down().strip()); count += 1; @@ -83,11 +84,11 @@ public class MusicPlayerBridge : GLib.Object // If we have an instance already for this player, ensure it is switched to active if(this.registered_clients.keys.contains(client_name)){ debug("It figured out that it already has an instance for this player already"); - this.registered_clients[client_name].set("active", true); + this.registered_clients[client_name].activate(); } //else init a new one else{ - PlayerController ctrl = new PlayerController(root_menu, client_name); + PlayerController ctrl = new PlayerController(root_menu, client_name, PlayerController.READY); registered_clients.set(client_name, ctrl); debug("New Client of name %s has successfully registered with us", client_name); } @@ -125,14 +126,12 @@ public class MusicPlayerBridge : GLib.Object owned string path, void* data) { MusicPlayerBridge bridge = data as MusicPlayerBridge; - // Not the most secure validation - // TODO revisit validation mechanism if(path.contains("/") && bridge.playersDB.already_familiar(path) == false){ debug("About to store desktop file path: %s", path); bridge.playersDB.insert(path); AppInfo? app_info = create_app_info(path); if(app_info != null){ - PlayerController ctrl = bridge.registered_clients[app_info.get_name().down().strip()]; + PlayerController ctrl = bridge.registered_clients[app_info.get_name().down().strip()]; ctrl.set("app_info", app_info); debug("successfully created appinfo from path and set it on the respective instance"); } @@ -169,7 +168,7 @@ public class MusicPlayerBridge : GLib.Object public static AppInfo? create_app_info(string path) { - DesktopAppInfo info = new DesktopAppInfo.from_filename(path); + DesktopAppInfo info = new DesktopAppInfo.from_filename(path); if(path == null){ warning("Could not create a desktopappinfo instance from app: %s", path); return null; diff --git a/src/player-controller.vala b/src/player-controller.vala index dfc2659..dd55f3d 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -25,37 +25,79 @@ public class PlayerController : GLib.Object { public const int METADATA = 2; private const int TRANSPORT = 3; + + public static const int OFFLINE = 0; + public static const int INSTANTIATING = 1; + public static const int READY = 2; + public static const int CONNECTED = 3; + public static const int DISCONNECTED = 4; + + public int current_state = OFFLINE; + private Dbusmenu.Menuitem root_menu; public string name { get; set;} - public bool active { get; set;} public ArrayList custom_items; private MprisController mpris_adaptor; - public AppInfo app_info { get; set;} + public AppInfo? app_info { get; set;} - public PlayerController(Dbusmenu.Menuitem root, string client_name, AppInfo? info = null) + public PlayerController(Dbusmenu.Menuitem root, string client_name, int state = OFFLINE) { this.root_menu = root; this.name = format_client_name(client_name.strip()); this.custom_items = new ArrayList(); - this.app_info = info; - self_construct(); - //app_info.launch(null, null); - - // Temporary scenario to handle both v1 and v2 of MPRIS. + this.update_state(state); + construct_widgets(); + establish_mpris_connection(); + update_layout(); + } + + public void update_state(int new_state) + { + debug("update_state : new state %i", new_state); + this.current_state = new_state; + } + + public void activate() + { + debug("about to try to establish an mpris connection"); + this.establish_mpris_connection(); + this.custom_items[METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, true); + } + + /* + instantiate() + The user should be able to start the app from the transport bar when in an offline state + There is a need to wait before the application is on DBus before attempting to access its mpris address + Hence only when the it has registered with us via libindicate do we attempt to kick off mpris communication + */ + public void instantiate() + { + this.app_info.launch(null, null); + this.update_state(INSTANTIATING); + } + + private void establish_mpris_connection() + { + if(this.current_state != READY){ + debug("establish_mpris_connection - Not ready to connect"); + return; + } if(this.name == "Vlc"){ this.mpris_adaptor = new MprisControllerV2(this.name, this); } else{ this.mpris_adaptor = new MprisController(this.name, this); - } - this.custom_items[TRANSPORT].set_adaptor(this.mpris_adaptor); - - // At start up if there is no metadata then hide the item. - // TODO: NOT working -> dbus menu bug ? - //((MetadataMenuitem)this.custom_items[METADATA]).check_layout(); + } + if(this.mpris_adaptor.connected() == true){ + this.custom_items[TRANSPORT].set_adaptor(this.mpris_adaptor); + this.update_state(CONNECTED); + } + else{ + this.update_state(DISCONNECTED); + } } - + public void vanish() { foreach(Dbusmenu.Menuitem item in this.custom_items){ @@ -63,21 +105,25 @@ public class PlayerController : GLib.Object } } - //public void switch_active(bool active){ - // this.is_active = active; - //} - - //public bool has_app_info(){ - // return (this.app_info != null); - //} + private void update_layout() + { + bool visibility = true; + if(this.current_state != CONNECTED){ + visibility = false; + } + this.custom_items[TRANSPORT].property_set_bool(MENUITEM_PROP_VISIBLE, visibility); + this.custom_items[METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, visibility); + } + - private bool self_construct() + private void construct_widgets() { // Separator item - this.custom_items.add(PlayerItem.new_separator_item()); + this.custom_items.add(new PlayerItem(CLIENT_TYPES_SEPARATOR)); // Title item - this.custom_items.add(PlayerItem.new_title_item(this.name)); + TitleMenuitem title_menu_item = new TitleMenuitem(); + this.custom_items.add(title_menu_item); // Metadata item MetadataMenuitem metadata_item = new MetadataMenuitem(); @@ -91,7 +137,6 @@ public class PlayerController : GLib.Object foreach(PlayerItem item in this.custom_items){ root_menu.child_add_position(item, offset + this.custom_items.index_of(item)); } - return true; } private static string format_client_name(string client_name) diff --git a/src/player-item.vala b/src/player-item.vala index a5c5512..88e1dd3 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -22,10 +22,18 @@ using Gee; public class PlayerItem : Dbusmenu.Menuitem { + public MprisController mpris_adaptor; - - public PlayerItem() + public string item_type { get; construct; } + + public PlayerItem(string type) { + Object(item_type: type); + } + + construct { + debug("in the base constructor for %s", item_type); + this.property_set(MENUITEM_PROP_TYPE, item_type); } public void reset(HashSet attrs){ @@ -94,19 +102,19 @@ public class PlayerItem : Dbusmenu.Menuitem //----- Custom constructors for player items ----------------// // Title item - public static PlayerItem new_title_item(dynamic string name) - { - PlayerItem item = new PlayerItem(); - item.property_set(MENUITEM_PROP_LABEL, name); - item.property_set(MENUITEM_PROP_ICON_NAME, "applications-multimedia"); - return item; - } + //public static PlayerItem new_title_item(dynamic string name) + //{ + // PlayerItem item = new PlayerItem(); + // item.property_set(MENUITEM_PROP_LABEL, name); + // item.property_set(MENUITEM_PROP_ICON_NAME, "applications-multimedia"); + // return item; + //} // Separator item public static PlayerItem new_separator_item() { - PlayerItem separator = new PlayerItem(); - separator.property_set(MENUITEM_PROP_TYPE, CLIENT_TYPES_SEPARATOR); + PlayerItem separator = new PlayerItem(CLIENT_TYPES_SEPARATOR); + //separator.property_set(MENUITEM_PROP_TYPE, CLIENT_TYPES_SEPARATOR); return separator; } diff --git a/src/title-menu-item.vala b/src/title-menu-item.vala new file mode 100644 index 0000000..f29d970 --- /dev/null +++ b/src/title-menu-item.vala @@ -0,0 +1,37 @@ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + +using Dbusmenu; +using DbusmenuTitle; +using Gee; + +public class TitleMenuitem : PlayerItem +{ + public TitleMenuitem() + { + Object(item_type: MENUITEM_TYPE); + } + + public static HashSet attributes_format() + { + HashSet attrs = new HashSet(); + attrs.add(MENUITEM_TEXT_NAME); + return attrs; + } +} \ No newline at end of file diff --git a/src/title-widget.c b/src/title-widget.c new file mode 100644 index 0000000..f5af09e --- /dev/null +++ b/src/title-widget.c @@ -0,0 +1,155 @@ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include "title-widget.h" +#include "common-defs.h" +#include + +static DbusmenuMenuitem* twin_item; + +typedef struct _TitleWidgetPrivate TitleWidgetPrivate; + +struct _TitleWidgetPrivate +{ + GtkWidget* hbox; +}; + +#define TITLE_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TITLE_WIDGET_TYPE, TitleWidgetPrivate)) + +/* Prototypes */ +static void title_widget_class_init (TitleWidgetClass *klass); +static void title_widget_init (TitleWidget *self); +static void title_widget_dispose (GObject *object); +static void title_widget_finalize (GObject *object); +// keyevent consumers +static gboolean title_widget_button_press_event (GtkWidget *menuitem, + GdkEventButton *event); +static gboolean title_widget_button_release_event (GtkWidget *menuitem, + GdkEventButton *event); +static gboolean title_widget_expose_event(GtkWidget* widget, + GdkEventExpose* event); + +// Dbusmenuitem properties update callback +static void title_widget_property_update(DbusmenuMenuitem* item, gchar* property, + GValue* value, gpointer userdata); + + +G_DEFINE_TYPE (TitleWidget, title_widget, GTK_TYPE_MENU_ITEM); + + + +static void +title_widget_class_init (TitleWidgetClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + widget_class->button_press_event = title_widget_button_press_event; + widget_class->button_release_event = title_widget_button_release_event; + widget_class->expose_event = title_widget_expose_event; + + g_type_class_add_private (klass, sizeof (TitleWidgetPrivate)); + + gobject_class->dispose = title_widget_dispose; + gobject_class->finalize = title_widget_finalize; + +} + +static void +title_widget_init (TitleWidget *self) +{ + g_debug("TitleWidget::title_widget_init"); + + TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(self); + + GtkWidget *hbox; + + hbox = gtk_hbox_new(FALSE, 0); + priv->hbox = hbox; + + g_signal_connect(G_OBJECT(twin_item), "property-changed", + G_CALLBACK(title_widget_property_update), self); + gtk_widget_show_all (priv->hbox); + gtk_container_add (GTK_CONTAINER (self), hbox); + +} + +static void +title_widget_dispose (GObject *object) +{ + G_OBJECT_CLASS (title_widget_parent_class)->dispose (object); +} + +static void +title_widget_finalize (GObject *object) +{ + G_OBJECT_CLASS (title_widget_parent_class)->finalize (object); +} + +/* Suppress/consume keyevents */ +static gboolean +title_widget_button_press_event (GtkWidget *menuitem, + GdkEventButton *event) +{ + g_debug("TitleWidget::menu_press_event"); + return TRUE; +} + +static gboolean +title_widget_button_release_event (GtkWidget *menuitem, + GdkEventButton *event) +{ + g_debug("TitleWidget::menu_release_event"); + return TRUE; +} + +static gboolean +title_widget_expose_event(GtkWidget* widget, GdkEventExpose* event) +{ + TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(widget); + + gtk_container_propagate_expose(GTK_CONTAINER(widget), priv->hbox, event); + return TRUE; +} + +static void +title_widget_property_update(DbusmenuMenuitem* item, gchar* property, + GValue* value, gpointer userdata) +{ + g_return_if_fail (IS_TITLE_WIDGET (userdata)); + +} + + + /** + * transport_new: + * @returns: a new #TitleWidget. + **/ +GtkWidget* +title_widget_new(DbusmenuMenuitem *item) +{ + twin_item = item; + return g_object_new(TITLE_WIDGET_TYPE, NULL); +} + diff --git a/src/title-widget.h b/src/title-widget.h new file mode 100644 index 0000000..efc0c78 --- /dev/null +++ b/src/title-widget.h @@ -0,0 +1,51 @@ +/* +Copyright 2010 Canonical Ltd. + +Authors: + Conor Curran + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ +#ifndef __TITLE_WIDGET_H__ +#define __TITLE_WIDGET_H__ + +#include +#include + +G_BEGIN_DECLS + +#define TITLE_WIDGET_TYPE (title_widget_get_type ()) +#define TITLE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TITLE_WIDGET_TYPE, TitleWidget)) +#define TITLE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TITLE_WIDGET_TYPE, TitleWidgetClass)) +#define IS_TITLE_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TITLE_WIDGET_TYPE)) +#define IS_TITLE_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TITLE_WIDGET_TYPE)) +#define TITLE_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TITLE_WIDGET_TYPE, TitleWidgetClass)) + +typedef struct _TitleWidget TitleWidget; +typedef struct _TitleWidgetClass TitleWidgetClass; + +struct _TitleWidgetClass { + GtkMenuItemClass parent_class; +}; + +struct _TitleWidget { + GtkMenuItem parent; +}; + +GType title_widget_get_type (void); +GtkWidget* title_widget_new(DbusmenuMenuitem *twin_item); + +G_END_DECLS + +#endif + diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index e0d241e..af71df4 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -26,7 +26,7 @@ public class TransportMenuitem : PlayerItem public TransportMenuitem() { - this.property_set(MENUITEM_PROP_TYPE, MENUITEM_TYPE); + Object(item_type: MENUITEM_TYPE); } public void change_play_state(int state) @@ -37,7 +37,7 @@ public class TransportMenuitem : PlayerItem public override void handle_event(string name, GLib.Value input_value, uint timestamp) { debug("handle_event with bool value %s", input_value.get_boolean().to_string()); - this.mpris_adaptor.toggle_playback(input_value.get_boolean()); + this.mpris_adaptor.toggle_playback(input_value.get_boolean()); } public override void check_layout(){ diff --git a/src/transport-widget.c b/src/transport-widget.c index bc9df53..a05bda2 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -26,8 +26,6 @@ with this program. If not, see . #include "common-defs.h" #include -// TODO: think about leakage: ted ! - static DbusmenuMenuitem* twin_item; typedef struct _TransportWidgetPrivate TransportWidgetPrivate; diff --git a/vapi/common-defs.vapi b/vapi/common-defs.vapi index 222fb67..6649b26 100644 --- a/vapi/common-defs.vapi +++ b/vapi/common-defs.vapi @@ -30,4 +30,10 @@ namespace DbusmenuMetadata{ namespace DbusmenuTransport{ public const string MENUITEM_TYPE; public const string MENUITEM_PLAY_STATE; +} + +[CCode (cheader_filename = "common-defs.h")] +namespace DbusmenuTitle{ + public const string MENUITEM_TYPE; + public const string MENUITEM_TEXT_NAME; } \ No newline at end of file -- cgit v1.2.3 From 410965575fa1039cbcc6c6ef7f7ef316438118ed Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 7 Jul 2010 13:22:18 +0100 Subject: alot of work around the title menu stuff --- data/album_artwork.png | Bin 0 -> 552 bytes data/sound_icon.png | Bin 0 -> 467 bytes src/indicator-sound.c | 24 +++++++++++++++++++--- src/metadata-menu-item.vala | 5 ----- src/player-controller.vala | 7 +++---- src/player-item.vala | 33 +---------------------------- src/title-menu-item.vala | 15 ++++++++++++-- src/title-widget.c | 48 +++++++++++++++++++++++++++++++++++++------ src/transport-menu-item.vala | 13 ++++-------- 9 files changed, 84 insertions(+), 61 deletions(-) create mode 100644 data/album_artwork.png create mode 100644 data/sound_icon.png diff --git a/data/album_artwork.png b/data/album_artwork.png new file mode 100644 index 0000000..940a69b Binary files /dev/null and b/data/album_artwork.png differ diff --git a/data/sound_icon.png b/data/sound_icon.png new file mode 100644 index 0000000..b52d6c4 Binary files /dev/null and b/data/sound_icon.png differ diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 3f0d2d3..10333fe 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -40,6 +40,7 @@ with this program. If not, see . #include "indicator-sound.h" #include "transport-widget.h" #include "metadata-widget.h" +#include "title-widget.h" #include "dbus-shared-names.h" #include "sound-service-client.h" #include "common-defs.h" @@ -96,6 +97,7 @@ static void style_changed_cb(GtkWidget *widget, gpointer user_data); //player widgets related static gboolean new_transport_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); static gboolean new_metadata_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); +static gboolean new_title_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); // DBUS communication static DBusGProxy *sound_dbus_proxy = NULL; @@ -243,7 +245,7 @@ get_menu (IndicatorObject * io) dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_SLIDER_MENUITEM_TYPE, new_slider_item); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TRANSPORT_MENUITEM_TYPE, new_transport_widget); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_METADATA_MENUITEM_TYPE, new_metadata_widget); - + dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(client), DBUSMENU_TITLE_MENUITEM_TYPE, new_title_widget); // register Key-press listening on the menu widget as the slider does not allow this. g_signal_connect(menu, "key-press-event", G_CALLBACK(key_press_cb), NULL); return GTK_MENU(menu); @@ -353,9 +355,25 @@ new_metadata_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm return TRUE; } -//const gchar* path = dbusmenu_menuitem_property_get(new_item, DBUSMENU_METADATA_MENUITEM_IMAGE_PATH); +static gboolean +new_title_widget(DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client) +{ + g_debug("indicator-sound: new_title_widget"); + + GtkWidget* title = NULL; + + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(newitem), FALSE); + g_return_val_if_fail(DBUSMENU_IS_GTKCLIENT(client), FALSE); + + title = title_widget_new (newitem); + GtkMenuItem *menu_title_widget = GTK_MENU_ITEM(title); + + dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, menu_title_widget, parent); -//g_debug("New transport bar path = %s", path); + gtk_widget_show_all(title); + + return TRUE; +} static void diff --git a/src/metadata-menu-item.vala b/src/metadata-menu-item.vala index 7eb112a..cfcb3bc 100644 --- a/src/metadata-menu-item.vala +++ b/src/metadata-menu-item.vala @@ -37,11 +37,6 @@ public class MetadataMenuitem : PlayerItem attrs.add(MENUITEM_ARTURL); return attrs; } - - public override void check_layout(){ - this.property_set_bool(MENUITEM_PROP_VISIBLE, this.populated()); - debug("check layout for the metadata = %s", this.populated().to_string()); - } public bool populated() { diff --git a/src/player-controller.vala b/src/player-controller.vala index dd55f3d..75c251c 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -38,7 +38,7 @@ public class PlayerController : GLib.Object private Dbusmenu.Menuitem root_menu; public string name { get; set;} public ArrayList custom_items; - private MprisController mpris_adaptor; + public MprisController mpris_adaptor; public AppInfo? app_info { get; set;} public PlayerController(Dbusmenu.Menuitem root, string client_name, int state = OFFLINE) @@ -90,7 +90,6 @@ public class PlayerController : GLib.Object this.mpris_adaptor = new MprisController(this.name, this); } if(this.mpris_adaptor.connected() == true){ - this.custom_items[TRANSPORT].set_adaptor(this.mpris_adaptor); this.update_state(CONNECTED); } else{ @@ -122,7 +121,7 @@ public class PlayerController : GLib.Object this.custom_items.add(new PlayerItem(CLIENT_TYPES_SEPARATOR)); // Title item - TitleMenuitem title_menu_item = new TitleMenuitem(); + TitleMenuitem title_menu_item = new TitleMenuitem(this, this.name); this.custom_items.add(title_menu_item); // Metadata item @@ -130,7 +129,7 @@ public class PlayerController : GLib.Object this.custom_items.add(metadata_item); // Transport item - TransportMenuitem transport_item = new TransportMenuitem(); + TransportMenuitem transport_item = new TransportMenuitem(this); this.custom_items.add(transport_item); int offset = 2; diff --git a/src/player-item.vala b/src/player-item.vala index 88e1dd3..171c140 100644 --- a/src/player-item.vala +++ b/src/player-item.vala @@ -22,8 +22,7 @@ using Gee; public class PlayerItem : Dbusmenu.Menuitem { - - public MprisController mpris_adaptor; + public PlayerController owner {get; construct;} public string item_type { get; construct; } public PlayerItem(string type) @@ -32,7 +31,6 @@ public class PlayerItem : Dbusmenu.Menuitem } construct { - debug("in the base constructor for %s", item_type); this.property_set(MENUITEM_PROP_TYPE, item_type); } @@ -68,15 +66,8 @@ public class PlayerItem : Dbusmenu.Menuitem this.property_set_bool(property, v.get_boolean()); } } - // TODO: not working - //this.check_layout(); } - public void set_adaptor(MprisController adaptor) - { - this.mpris_adaptor = adaptor; - } - private static bool ensure_valid_updates(HashTable data, HashSet attributes) { if(data == null){ @@ -99,27 +90,5 @@ public class PlayerItem : Dbusmenu.Menuitem return result; } - - //----- Custom constructors for player items ----------------// - // Title item - //public static PlayerItem new_title_item(dynamic string name) - //{ - // PlayerItem item = new PlayerItem(); - // item.property_set(MENUITEM_PROP_LABEL, name); - // item.property_set(MENUITEM_PROP_ICON_NAME, "applications-multimedia"); - // return item; - //} - - // Separator item - public static PlayerItem new_separator_item() - { - PlayerItem separator = new PlayerItem(CLIENT_TYPES_SEPARATOR); - //separator.property_set(MENUITEM_PROP_TYPE, CLIENT_TYPES_SEPARATOR); - return separator; - } - - public virtual void check_layout(){ - warning("this should not be hit"); - } } diff --git a/src/title-menu-item.vala b/src/title-menu-item.vala index f29d970..0acd97f 100644 --- a/src/title-menu-item.vala +++ b/src/title-menu-item.vala @@ -23,11 +23,22 @@ using Gee; public class TitleMenuitem : PlayerItem { - public TitleMenuitem() + public TitleMenuitem(PlayerController parent, string name) { - Object(item_type: MENUITEM_TYPE); + Object(item_type: MENUITEM_TYPE, owner: parent); + this.property_set(MENUITEM_TEXT_NAME, name); } + public override void handle_event(string name, GLib.Value input_value, uint timestamp) + { + debug("handle_event with bool value %s", input_value.get_boolean().to_string()); + if(this.owner.current_state == PlayerController.OFFLINE) + { + this.owner.instantiate(); + } + } + + public static HashSet attributes_format() { HashSet attrs = new HashSet(); diff --git a/src/title-widget.c b/src/title-widget.c index f5af09e..45f918f 100644 --- a/src/title-widget.c +++ b/src/title-widget.c @@ -33,6 +33,8 @@ typedef struct _TitleWidgetPrivate TitleWidgetPrivate; struct _TitleWidgetPrivate { GtkWidget* hbox; + GtkWidget* name; + GtkWidget* player_icon; }; #define TITLE_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TITLE_WIDGET_TYPE, TitleWidgetPrivate)) @@ -42,19 +44,19 @@ static void title_widget_class_init (TitleWidgetClass *klass); static void title_widget_init (TitleWidget *self); static void title_widget_dispose (GObject *object); static void title_widget_finalize (GObject *object); + // keyevent consumers static gboolean title_widget_button_press_event (GtkWidget *menuitem, - GdkEventButton *event); + GdkEventButton *event); static gboolean title_widget_button_release_event (GtkWidget *menuitem, - GdkEventButton *event); + GdkEventButton *event); static gboolean title_widget_expose_event(GtkWidget* widget, GdkEventExpose* event); // Dbusmenuitem properties update callback static void title_widget_property_update(DbusmenuMenuitem* item, gchar* property, GValue* value, gpointer userdata); - - +static void style_name_text(TitleWidget* self); G_DEFINE_TYPE (TitleWidget, title_widget, GTK_TYPE_MENU_ITEM); @@ -87,9 +89,19 @@ title_widget_init (TitleWidget *self) hbox = gtk_hbox_new(FALSE, 0); priv->hbox = hbox; - g_signal_connect(G_OBJECT(twin_item), "property-changed", G_CALLBACK(title_widget_property_update), self); + + priv->player_icon = gtk_image_new_from_file("/home/ronoc/branches/sound-menu-v2/finish-indicate/indicator-sound/data/sound_icon.png"); + gtk_box_pack_start(GTK_BOX (priv->hbox), priv->player_icon, FALSE, FALSE, 0); + + priv->name = gtk_label_new(dbusmenu_menuitem_property_get(twin_item, + DBUSMENU_TITLE_MENUITEM_TEXT_NAME)); + gtk_misc_set_padding(GTK_MISC(priv->name), 10, 0); + gtk_box_pack_start (GTK_BOX (priv->hbox), priv->name, FALSE, FALSE, 0); + + style_name_text(self); + gtk_widget_show_all (priv->hbox); gtk_container_add (GTK_CONTAINER (self), hbox); @@ -113,6 +125,13 @@ title_widget_button_press_event (GtkWidget *menuitem, GdkEventButton *event) { g_debug("TitleWidget::menu_press_event"); + + GValue value = {0}; + g_value_init(&value, G_TYPE_BOOLEAN); + + g_value_set_boolean(&value, TRUE); + dbusmenu_menuitem_handle_event (twin_item, "Title menu event", &value, 0); + return TRUE; } @@ -138,9 +157,26 @@ title_widget_property_update(DbusmenuMenuitem* item, gchar* property, GValue* value, gpointer userdata) { g_return_if_fail (IS_TITLE_WIDGET (userdata)); - + TitleWidget* mitem = TITLE_WIDGET(userdata); + TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(mitem); + + if(g_ascii_strcasecmp(DBUSMENU_TITLE_MENUITEM_TEXT_NAME, property) == 0){ + gtk_label_set_text(GTK_LABEL(priv->name), g_value_get_string(value)); + style_name_text(mitem); + } } +static void +style_name_text(TitleWidget* self) +{ + TitleWidgetPrivate * priv = TITLE_WIDGET_GET_PRIVATE(self); + + char* markup; + markup = g_markup_printf_escaped ("%s", + gtk_label_get_text(GTK_LABEL(priv->name))); + gtk_label_set_markup (GTK_LABEL (priv->name), markup); + g_free(markup); +} /** * transport_new: diff --git a/src/transport-menu-item.vala b/src/transport-menu-item.vala index af71df4..7a1bb4a 100644 --- a/src/transport-menu-item.vala +++ b/src/transport-menu-item.vala @@ -24,9 +24,9 @@ using DbusmenuTransport; public class TransportMenuitem : PlayerItem { - public TransportMenuitem() + public TransportMenuitem(PlayerController parent) { - Object(item_type: MENUITEM_TYPE); + Object(item_type: MENUITEM_TYPE, owner: parent); } public void change_play_state(int state) @@ -37,13 +37,8 @@ public class TransportMenuitem : PlayerItem public override void handle_event(string name, GLib.Value input_value, uint timestamp) { debug("handle_event with bool value %s", input_value.get_boolean().to_string()); - this.mpris_adaptor.toggle_playback(input_value.get_boolean()); - } - - public override void check_layout(){ - // nothing to be done for this item - always active - } - + this.owner.mpris_adaptor.toggle_playback(input_value.get_boolean()); + } public static HashSet attributes_format() { -- cgit v1.2.3 From caf13b4dccb20aff410ffc0da63c298cabbcca5f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 7 Jul 2010 13:36:56 +0100 Subject: fixed the mpris connection problems --- src/music-player-bridge.vala | 1 + src/player-controller.vala | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/music-player-bridge.vala b/src/music-player-bridge.vala index 77341a4..46723cb 100644 --- a/src/music-player-bridge.vala +++ b/src/music-player-bridge.vala @@ -84,6 +84,7 @@ public class MusicPlayerBridge : GLib.Object // If we have an instance already for this player, ensure it is switched to active if(this.registered_clients.keys.contains(client_name)){ debug("It figured out that it already has an instance for this player already"); + this.registered_clients[client_name].update_state(PlayerController.READY); this.registered_clients[client_name].activate(); } //else init a new one diff --git a/src/player-controller.vala b/src/player-controller.vala index 75c251c..88dc3a7 100644 --- a/src/player-controller.vala +++ b/src/player-controller.vala @@ -60,7 +60,6 @@ public class PlayerController : GLib.Object public void activate() { - debug("about to try to establish an mpris connection"); this.establish_mpris_connection(); this.custom_items[METADATA].property_set_bool(MENUITEM_PROP_VISIBLE, true); } @@ -95,6 +94,7 @@ public class PlayerController : GLib.Object else{ this.update_state(DISCONNECTED); } + this.update_layout(); } public void vanish() -- cgit v1.2.3 From b41d94677b3471742fa957cc4f60381d8f67ea5d Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 7 Jul 2010 15:08:34 +0100 Subject: updated for merge --- data/Makefile.am | 1 - src/sound-service.c | 4 ++-- src/title-widget.c | 2 +- src/transport-widget.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/data/Makefile.am b/data/Makefile.am index 0389576..9fa0c9b 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,4 +1,3 @@ - dbus_servicesdir = $(DBUSSERVICEDIR) service_in_files = indicator-sound.service.in dbus_services_DATA = $(service_in_files:.service.in=.service) diff --git a/src/sound-service.c b/src/sound-service.c index a5f3941..8f4e941 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -43,8 +43,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 45f918f..9951754 100644 --- a/src/title-widget.c +++ b/src/title-widget.c @@ -91,7 +91,7 @@ title_widget_init (TitleWidget *self) priv->hbox = hbox; g_signal_connect(G_OBJECT(twin_item), "property-changed", G_CALLBACK(title_widget_property_update), self); - + // TODO - waiting theme icon name for correct usage priv->player_icon = gtk_image_new_from_file("/home/ronoc/branches/sound-menu-v2/finish-indicate/indicator-sound/data/sound_icon.png"); gtk_box_pack_start(GTK_BOX (priv->hbox), priv->player_icon, FALSE, FALSE, 0); diff --git a/src/transport-widget.c b/src/transport-widget.c index a05bda2..e7b8e4f 100644 --- a/src/transport-widget.c +++ b/src/transport-widget.c @@ -134,7 +134,7 @@ transport_widget_init (TransportWidget *self) hbox = gtk_hbox_new(TRUE, 2); gchar* symbol = transport_widget_toggle_play_label(dbusmenu_menuitem_property_get_int(twin_item, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE)); priv->play_button = gtk_button_new_with_label(symbol); - //g_free(symbol); + gtk_box_pack_start (GTK_BOX (hbox), priv->play_button, FALSE, TRUE, 0); priv->hbox = hbox; -- cgit v1.2.3