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