aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sound-service-dbus.c44
-rw-r--r--src/sound-service-dbus.h2
-rw-r--r--src/sound-service.c42
3 files changed, 54 insertions, 34 deletions
diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c
index 9950302..b69f081 100644
--- a/src/sound-service-dbus.c
+++ b/src/sound-service-dbus.c
@@ -57,6 +57,7 @@ struct _SoundServiceDbusPrivate {
GDBusConnection* connection;
DbusmenuMenuitem* root_menuitem;
Device* device;
+ gboolean greeter_mode;
};
enum {
@@ -169,9 +170,10 @@ sound_service_dbus_init (SoundServiceDbus *self)
}
DbusmenuMenuitem*
-sound_service_dbus_create_root_item (SoundServiceDbus* self)
+sound_service_dbus_create_root_item (SoundServiceDbus* self, gboolean greeter_mode)
{
SoundServiceDbusPrivate * priv = SOUND_SERVICE_DBUS_GET_PRIVATE(self);
+ priv->greeter_mode = greeter_mode;
priv->root_menuitem = dbusmenu_menuitem_new();
DbusmenuServer *server = dbusmenu_server_new (INDICATOR_SOUND_MENU_DBUS_OBJECT_PATH);
dbusmenu_server_set_root (server, priv->root_menuitem);
@@ -193,25 +195,27 @@ sound_service_dbus_build_sound_menu ( SoundServiceDbus* self,
dbusmenu_menuitem_child_add_position (priv->root_menuitem, slider_item, 1);
dbusmenu_menuitem_child_add_position (priv->root_menuitem, voip_input_menu_item, 2);
- // Separator
- DbusmenuMenuitem* separator = dbusmenu_menuitem_new();
-
- dbusmenu_menuitem_property_set (separator,
- DBUSMENU_MENUITEM_PROP_TYPE,
- DBUSMENU_CLIENT_TYPES_SEPARATOR);
- dbusmenu_menuitem_child_add_position (priv->root_menuitem, separator, 3);
- g_object_unref (separator);
-
- // Sound preferences dialog
- DbusmenuMenuitem* settings_mi = dbusmenu_menuitem_new();
-
- dbusmenu_menuitem_property_set( settings_mi,
- DBUSMENU_MENUITEM_PROP_LABEL,
- _("Sound Preferences..."));
- dbusmenu_menuitem_child_append(priv->root_menuitem, settings_mi);
- g_object_unref (settings_mi);
- g_signal_connect(G_OBJECT(settings_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
- G_CALLBACK(show_sound_settings_dialog), NULL);
+ if (!priv->greeter_mode) {
+ // Separator
+ DbusmenuMenuitem* separator = dbusmenu_menuitem_new();
+
+ dbusmenu_menuitem_property_set (separator,
+ DBUSMENU_MENUITEM_PROP_TYPE,
+ DBUSMENU_CLIENT_TYPES_SEPARATOR);
+ dbusmenu_menuitem_child_add_position (priv->root_menuitem, separator, 3);
+ g_object_unref (separator);
+
+ // Sound preferences dialog
+ DbusmenuMenuitem* settings_mi = dbusmenu_menuitem_new();
+
+ dbusmenu_menuitem_property_set( settings_mi,
+ DBUSMENU_MENUITEM_PROP_LABEL,
+ _("Sound Settings..."));
+ dbusmenu_menuitem_child_append(priv->root_menuitem, settings_mi);
+ g_object_unref (settings_mi);
+ g_signal_connect(G_OBJECT(settings_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
+ G_CALLBACK(show_sound_settings_dialog), NULL);
+ }
}
/**
diff --git a/src/sound-service-dbus.h b/src/sound-service-dbus.h
index 9b19a5e..1c15fc7 100644
--- a/src/sound-service-dbus.h
+++ b/src/sound-service-dbus.h
@@ -53,7 +53,7 @@ struct _SoundServiceDbusClass {
GType sound_service_dbus_get_type (void) G_GNUC_CONST;
-DbusmenuMenuitem* sound_service_dbus_create_root_item (SoundServiceDbus* self);
+DbusmenuMenuitem* sound_service_dbus_create_root_item (SoundServiceDbus* self, gboolean greeter_mode);
void sound_service_dbus_update_sound_state (SoundServiceDbus* self, SoundState new_state);
void sound_service_dbus_build_sound_menu ( SoundServiceDbus* self,
DbusmenuMenuitem* mute_item,
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);