diff options
Diffstat (limited to 'src/sound-service.c')
-rw-r--r-- | src/sound-service.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/src/sound-service.c b/src/sound-service.c index da9b94e..0170f81 100644 --- a/src/sound-service.c +++ b/src/sound-service.c @@ -25,8 +25,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "music-player-bridge.h" static GMainLoop *mainloop = NULL; -static MusicPlayerBridge* player_bridge; -/**********************************************************************************************************************/ +static MusicPlayerBridge* player_bridge = NULL; +/***********************************************************************************************************/ // Init and exit functions /**********************************************************************************************************************/ /** @@ -46,16 +46,25 @@ service_shutdown (IndicatorService *service, gpointer user_data) return; } +static gboolean +get_greeter_mode (void) +{ + const gchar *var; + var = g_getenv("INDICATOR_GREETER_MODE"); + return (g_strcmp0(var, "1") == 0); +} + void on_player_specific_item_requested (SoundServiceDbus* sound_service, const gchar* desktop_id, const gchar* player_object_path, gpointer userdata) { - music_player_bridge_enable_player_specific_items_for_client (player_bridge, - desktop_id, - player_object_path); - g_debug ("ON PLAYER SPECIFIC ITEM REQUESTED %s", desktop_id); + if (player_bridge != NULL){ + music_player_bridge_enable_player_specific_items_for_client (player_bridge, + desktop_id, + player_object_path); + } } void @@ -64,10 +73,11 @@ on_track_specific_item_requested (SoundServiceDbus* sound_service, const gchar* player_object_path, gpointer userdata) { - music_player_bridge_enable_track_specific_items_for_client (player_bridge, - desktop_id, - player_object_path); - g_debug ("ON TRACK SPECIFIC ITEM REQUESTED %s", desktop_id); + if (player_bridge != NULL){ + music_player_bridge_enable_track_specific_items_for_client (player_bridge, + desktop_id, + player_object_path); + } } /** @@ -76,6 +86,8 @@ main: int main (int argc, char ** argv) { + gboolean greeter_mode; + g_type_init(); textdomain (GETTEXT_PACKAGE); bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); @@ -95,9 +107,13 @@ main (int argc, char ** argv) "player-specific-item-requested", G_CALLBACK(on_player_specific_item_requested), NULL); - DbusmenuMenuitem* root_menuitem = sound_service_dbus_create_root_item (sound_service); - player_bridge = music_player_bridge_new (); - music_player_bridge_set_root_menu_item (player_bridge, root_menuitem); + greeter_mode = get_greeter_mode(); + + DbusmenuMenuitem* root_menuitem = sound_service_dbus_create_root_item(sound_service, greeter_mode); + if (!greeter_mode) { + player_bridge = music_player_bridge_new(); + music_player_bridge_set_root_menu_item(player_bridge, root_menuitem); + } // Run the loop mainloop = g_main_loop_new(NULL, FALSE); |