From 1967b9c58fd2727733fb38c10d610eb80e365ae3 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 13 Jul 2011 13:12:00 +0100 Subject: tidied up signals and methods for the session service so as the users real name should be available and not the icon, icon should not change on the panel --- src/session-dbus.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/session-dbus.c') diff --git a/src/session-dbus.c b/src/session-dbus.c index fa9ea54..07cebf7 100644 --- a/src/session-dbus.c +++ b/src/session-dbus.c @@ -5,6 +5,7 @@ Copyright 2010 Canonical Ltd. Authors: Ted Gould + Conor Curran This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published @@ -28,7 +29,7 @@ with this program. If not, see . #include "session-dbus.h" #include "dbus-shared-names.h" -static GVariant * get_icon (SessionDbus * service); +static GVariant * get_users_real_name (SessionDbus * service); static void bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data); static void bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data); @@ -98,7 +99,7 @@ session_dbus_init (SessionDbus *self) { SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(self); - priv->name = g_strdup(ICON_DEFAULT); + priv->name = NULL; priv->bus = NULL; priv->bus_cancel = NULL; priv->dbus_registration = 0; @@ -163,8 +164,8 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, SessionDbus * service = SESSION_DBUS(user_data); GVariant * retval = NULL; - if (g_strcmp0(method, "GetIcon") == 0) { - retval = get_icon(service); + 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); } @@ -214,10 +215,11 @@ session_dbus_finalize (GObject *object) } static GVariant * -get_icon (SessionDbus * service) +get_users_real_name (SessionDbus * service) { SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(service); - return g_variant_new("(s)", priv->name); + g_debug ("Get users real name: %s", priv->name); + return g_variant_new ("(s)", priv->name); } SessionDbus * @@ -239,19 +241,18 @@ session_dbus_set_name (SessionDbus * session, const gchar * name) if (priv->bus != NULL) { g_dbus_connection_emit_signal (priv->bus, - NULL, - INDICATOR_SESSION_SERVICE_DBUS_OBJECT, - INDICATOR_SESSION_SERVICE_DBUS_IFACE, - "IconUpdated", - g_variant_new ("(s)", priv->name, NULL), - &error); + NULL, + INDICATOR_SESSION_SERVICE_DBUS_OBJECT, + INDICATOR_SESSION_SERVICE_DBUS_IFACE, + "UserRealNameUpdated", + g_variant_new ("(s)", priv->name, NULL), + &error); if (error != NULL) { - g_warning("Unable to send IconUpdated signal: %s", error->message); + g_warning("Unable to send UserRealNameUpdated signal: %s", error->message); g_error_free(error); return; } } - return; } -- cgit v1.2.3 From ee23d617b4f66ddeddaa355faef5760d62314823 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 13 Jul 2011 17:34:03 +0100 Subject: user label fixed for now --- src/session-dbus.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/session-dbus.c') diff --git a/src/session-dbus.c b/src/session-dbus.c index 07cebf7..d28629b 100644 --- a/src/session-dbus.c +++ b/src/session-dbus.c @@ -230,6 +230,11 @@ session_dbus_new (void) void session_dbus_set_name (SessionDbus * session, const gchar * name) +{ +} + +void +session_dbus_set_users_real_name (SessionDbus * session, const gchar * name) { SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(session); GError * error = NULL; @@ -237,6 +242,9 @@ session_dbus_set_name (SessionDbus * session, const gchar * name) g_free(priv->name); priv->name = NULL; } + + g_debug ("sesssion dbus set name with %s", name); + priv->name = g_strdup(name); if (priv->bus != NULL) { -- cgit v1.2.3 From d8eae0b9560084bc68781d73c14fcb54cd53fd02 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 14 Jul 2011 13:06:38 +0100 Subject: dynamic user menu hiding on the way# --- src/session-dbus.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) (limited to 'src/session-dbus.c') 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); + } + } +} -- cgit v1.2.3 From f2d458b0addfe408835366939b49f4a38c0a14cb Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 14 Jul 2011 16:35:57 +0100 Subject: get location overridden and debugs tidied up --- src/session-dbus.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/session-dbus.c') diff --git a/src/session-dbus.c b/src/session-dbus.c index 9e24141..9aa75ef 100644 --- a/src/session-dbus.c +++ b/src/session-dbus.c @@ -225,7 +225,6 @@ static GVariant * get_users_real_name (SessionDbus * service) { SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(service); - g_debug ("Get users real name: %s", priv->name); return g_variant_new ("(s)", priv->name); } @@ -249,9 +248,7 @@ session_dbus_set_users_real_name (SessionDbus * session, const gchar * name) g_free(priv->name); priv->name = NULL; } - - g_debug ("sesssion dbus set name with %s", name); - + priv->name = g_strdup(name); if (priv->bus != NULL) { @@ -278,9 +275,7 @@ session_dbus_set_user_menu_visibility (SessionDbus* session, { 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) { -- cgit v1.2.3 From 853ad495b863c179792044f1a74e8556d04e32db Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 9 Aug 2011 09:59:20 +0100 Subject: and the actual code --- src/session-dbus.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/session-dbus.c') diff --git a/src/session-dbus.c b/src/session-dbus.c index 9aa75ef..1cf73ac 100644 --- a/src/session-dbus.c +++ b/src/session-dbus.c @@ -293,3 +293,25 @@ session_dbus_set_user_menu_visibility (SessionDbus* session, } } } + +void session_dbus_restart_required (SessionDbus* session) +{ + SessionDbusPrivate * priv = SESSION_DBUS_GET_PRIVATE(session); + GError * error = NULL; + + if (priv->bus != NULL) { + g_dbus_connection_emit_signal (priv->bus, + NULL, + INDICATOR_SESSION_SERVICE_DBUS_OBJECT, + INDICATOR_SESSION_SERVICE_DBUS_IFACE, + "RebootRequired", + NULL, + &error); + + if (error != NULL) { + g_warning("Unable to send reboot-required signal: %s", error->message); + g_error_free(error); + } + } + +} -- cgit v1.2.3