aboutsummaryrefslogtreecommitdiff
path: root/src/session-dbus.c
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-07-14 13:06:38 +0100
committerConor Curran <conor.curran@canonical.com>2011-07-14 13:06:38 +0100
commitd8eae0b9560084bc68781d73c14fcb54cd53fd02 (patch)
tree5154306e3838d7617fa1c6dc8270317461e5b68b /src/session-dbus.c
parentee23d617b4f66ddeddaa355faef5760d62314823 (diff)
downloadayatana-indicator-session-d8eae0b9560084bc68781d73c14fcb54cd53fd02.tar.gz
ayatana-indicator-session-d8eae0b9560084bc68781d73c14fcb54cd53fd02.tar.bz2
ayatana-indicator-session-d8eae0b9560084bc68781d73c14fcb54cd53fd02.zip
dynamic user menu hiding on the way#
Diffstat (limited to 'src/session-dbus.c')
-rw-r--r--src/session-dbus.c42
1 files changed, 38 insertions, 4 deletions
diff --git a/src/session-dbus.c b/src/session-dbus.c
index d28629b..9e24141 100644
--- a/src/session-dbus.c
+++ b/src/session-dbus.c
@@ -38,6 +38,7 @@ static void bus_method_call (GDBusConnection * connection, const gchar * sender,
typedef struct _SessionDbusPrivate SessionDbusPrivate;
struct _SessionDbusPrivate {
gchar * name;
+ gboolean user_menu_is_visible;
GDBusConnection * bus;
GCancellable * bus_cancel;
guint dbus_registration;
@@ -103,6 +104,7 @@ session_dbus_init (SessionDbus *self)
priv->bus = NULL;
priv->bus_cancel = NULL;
priv->dbus_registration = 0;
+ priv->user_menu_is_visible = FALSE;
priv->bus_cancel = g_cancellable_new();
g_bus_get(G_BUS_TYPE_SESSION,
@@ -161,15 +163,20 @@ bus_method_call (GDBusConnection * connection, const gchar * sender,
const gchar * method, GVariant * params,
GDBusMethodInvocation * invocation, gpointer user_data)
{
- SessionDbus * service = SESSION_DBUS(user_data);
+ SessionDbus * service = SESSION_DBUS (user_data);
+ SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE (service);
+
GVariant * retval = NULL;
if (g_strcmp0(method, "GetUserRealName") == 0) {
retval = get_users_real_name (service);
- } else {
- g_warning("Calling method '%s' on the indicator service and it's unknown", method);
}
-
+ else if (g_strcmp0 (method, "GetUserMenuVisibility") == 0){
+ retval = g_variant_new ("(b)", priv->user_menu_is_visible);
+ }
+ else {
+ g_warning("Calling method '%s' on the indicator service and it's unknown", method);
+ }
g_dbus_method_invocation_return_value(invocation, retval);
return;
}
@@ -264,3 +271,30 @@ session_dbus_set_users_real_name (SessionDbus * session, const gchar * name)
}
return;
}
+
+void
+session_dbus_set_user_menu_visibility (SessionDbus* session,
+ gboolean visible)
+{
+ SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(session);
+ GError * error = NULL;
+
+ g_debug ("sesssion dbus set user visibility - %i", visible);
+
+ priv->user_menu_is_visible = visible;
+
+ if (priv->bus != NULL) {
+ g_dbus_connection_emit_signal (priv->bus,
+ NULL,
+ INDICATOR_SESSION_SERVICE_DBUS_OBJECT,
+ INDICATOR_SESSION_SERVICE_DBUS_IFACE,
+ "UserMenuIsVisible",
+ g_variant_new ("(b)", priv->user_menu_is_visible),
+ &error);
+
+ if (error != NULL) {
+ g_warning("Unable to send UserMenuIsVisible signal: %s", error->message);
+ g_error_free(error);
+ }
+ }
+}