aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2010-06-29 21:52:56 +0100
committerConor Curran <conor.curran@canonical.com>2010-06-29 21:52:56 +0100
commit2d1c2058a7384a6dc0d4c1b900e223b6905df4c6 (patch)
tree7f108a601c279b262d01ed8b725bbf87e47498b2
parenta0c3edbbe3d6cbb160049716cec66bf2673784e4 (diff)
downloadayatana-indicator-sound-2d1c2058a7384a6dc0d4c1b900e223b6905df4c6.tar.gz
ayatana-indicator-sound-2d1c2058a7384a6dc0d4c1b900e223b6905df4c6.tar.bz2
ayatana-indicator-sound-2d1c2058a7384a6dc0d4c1b900e223b6905df4c6.zip
launching apps now working
-rw-r--r--src/music-player-bridge.vala35
-rw-r--r--src/sound-service.c4
-rw-r--r--src/transport-menu-item.vala1
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)