From e1a933792dbf2114d66a3132d2ce29107ed25130 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 31 Aug 2011 13:09:57 +0100 Subject: apt race condition handled --- src/indicator-session.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/indicator-session.c') diff --git a/src/indicator-session.c b/src/indicator-session.c index fab47b3..0f44a36 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -499,6 +499,7 @@ receive_signal (GDBusProxy * proxy, } else if (g_strcmp0(signal_name, "RebootRequired") == 0) { // TODO waiting on design to give me a name. + g_debug ("Reboot required, icon changed to %s", ICON_RESTART); self->devices.image = indicator_image_helper (ICON_RESTART); } } -- cgit v1.2.3 From 254ca429137d15b4814b171c96a7d92f1a46b2da Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 31 Aug 2011 13:19:38 +0100 Subject: restart signal actually being sent now properly --- src/indicator-session.c | 3 +-- src/session-dbus.c | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/indicator-session.c') diff --git a/src/indicator-session.c b/src/indicator-session.c index 0f44a36..3b5a7c3 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -497,8 +497,7 @@ receive_signal (GDBusProxy * proxy, &self->users); } } - else if (g_strcmp0(signal_name, "RebootRequired") == 0) { - // TODO waiting on design to give me a name. + else if (g_strcmp0(signal_name, "RestartRequired") == 0) { g_debug ("Reboot required, icon changed to %s", ICON_RESTART); self->devices.image = indicator_image_helper (ICON_RESTART); } diff --git a/src/session-dbus.c b/src/session-dbus.c index 1cf73ac..232e440 100644 --- a/src/session-dbus.c +++ b/src/session-dbus.c @@ -300,11 +300,13 @@ void session_dbus_restart_required (SessionDbus* session) GError * error = NULL; if (priv->bus != NULL) { + g_debug("About to send RebootRequired signal"); + g_dbus_connection_emit_signal (priv->bus, NULL, INDICATOR_SESSION_SERVICE_DBUS_OBJECT, INDICATOR_SESSION_SERVICE_DBUS_IFACE, - "RebootRequired", + "RestartRequired", NULL, &error); -- cgit v1.2.3 From 55a161683098d17364d9f521d2f4b97f89298297 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 31 Aug 2011 14:32:07 +0100 Subject: tidy up --- src/apt-watcher.c | 6 +----- src/indicator-session.c | 1 - src/session-dbus.xml | 3 --- 3 files changed, 1 insertion(+), 9 deletions(-) (limited to 'src/indicator-session.c') diff --git a/src/apt-watcher.c b/src/apt-watcher.c index e757896..346b8a9 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -144,11 +144,7 @@ fetch_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) g_signal_connect (self->proxy, "g-signal", G_CALLBACK(apt_watcher_signal_cb), - self); - - /*self->reboot_query = g_timeout_add_seconds (5, - apt_watcher_query_reboot_status, - self);*/ + self); } diff --git a/src/indicator-session.c b/src/indicator-session.c index 3b5a7c3..aacef49 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -498,7 +498,6 @@ receive_signal (GDBusProxy * proxy, } } else if (g_strcmp0(signal_name, "RestartRequired") == 0) { - g_debug ("Reboot required, icon changed to %s", ICON_RESTART); self->devices.image = indicator_image_helper (ICON_RESTART); } } diff --git a/src/session-dbus.xml b/src/session-dbus.xml index 076e595..96e9837 100644 --- a/src/session-dbus.xml +++ b/src/session-dbus.xml @@ -8,9 +8,6 @@ - - - -- cgit v1.2.3 From 383e28467156675a5c1231c37eafb2a7bbc6e4f2 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 1 Sep 2011 18:23:35 +0100 Subject: much easier of handling the greeter icon --- src/dbus-shared-names.h | 1 + src/indicator-session.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src/indicator-session.c') diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h index c5372e4..350fa6d 100644 --- a/src/dbus-shared-names.h +++ b/src/dbus-shared-names.h @@ -63,5 +63,6 @@ typedef enum { #define ICON_DEFAULT "system-devices-panel" #define ICON_RESTART "system-devices-panel-alert" +#define GREETER_ICON_DEFAULT "system-shutdown-panel" #endif /* __DBUS_SHARED_NAMES_H__ */ diff --git a/src/indicator-session.c b/src/indicator-session.c index aacef49..2b36fdd 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -164,10 +164,19 @@ indicator_session_init (IndicatorSession *self) self->users.label = GTK_LABEL (gtk_label_new (NULL)); + const gchar *greeter_var; + greeter_var = g_getenv("INDICATOR_GREETER_MODE"); + // devices self->devices.menu = GTK_MENU (dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); - self->devices.image = indicator_image_helper (ICON_DEFAULT); + if (g_strcmp0(greeter_var, "1") == 0){ + self->devices.image = indicator_image_helper (GREETER_ICON_DEFAULT); + } + else{ + self->devices.image = indicator_image_helper (ICON_DEFAULT); + } + gtk_widget_show (GTK_WIDGET(self->devices.menu)); gtk_widget_show (GTK_WIDGET(self->devices.image)); -- cgit v1.2.3 From a335b8e973287fa5cf60286bb6fd8f46fb66ad83 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 2 Sep 2011 12:11:13 +0100 Subject: make sure to flag restart state in greeter mode also with the right icon --- src/dbus-shared-names.h | 2 ++ src/indicator-session.c | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/indicator-session.c') diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h index 350fa6d..11aebca 100644 --- a/src/dbus-shared-names.h +++ b/src/dbus-shared-names.h @@ -64,5 +64,7 @@ typedef enum { #define ICON_DEFAULT "system-devices-panel" #define ICON_RESTART "system-devices-panel-alert" #define GREETER_ICON_DEFAULT "system-shutdown-panel" +#define GREETER_ICON_RESTART "system-shutdown-panel-restart" + #endif /* __DBUS_SHARED_NAMES_H__ */ diff --git a/src/indicator-session.c b/src/indicator-session.c index 2b36fdd..7a8a238 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -70,6 +70,8 @@ struct _IndicatorSession { GDBusProxy * service_proxy; }; +static gboolean greeter_mode; + GType indicator_session_get_type (void); /* Indicator stuff */ @@ -166,11 +168,11 @@ indicator_session_init (IndicatorSession *self) const gchar *greeter_var; greeter_var = g_getenv("INDICATOR_GREETER_MODE"); - + greeter_mode = g_strcmp0(greeter_var, "1") == 0; // devices self->devices.menu = GTK_MENU (dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); - if (g_strcmp0(greeter_var, "1") == 0){ + if (greeter_mode){ self->devices.image = indicator_image_helper (GREETER_ICON_DEFAULT); } else{ @@ -507,7 +509,12 @@ receive_signal (GDBusProxy * proxy, } } else if (g_strcmp0(signal_name, "RestartRequired") == 0) { - self->devices.image = indicator_image_helper (ICON_RESTART); + if (greeter_mode == TRUE){ + self->devices.image = indicator_image_helper (GREETER_ICON_RESTART); + } + else{ + self->devices.image = indicator_image_helper (ICON_RESTART); + } } } -- cgit v1.2.3 From 3f39e981fdbe934faf762de161645edd5eba753f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 2 Sep 2011 16:16:09 +0100 Subject: remove the greeter icon stuff --- src/dbus-shared-names.h | 1 - src/indicator-session.c | 11 +---------- 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'src/indicator-session.c') diff --git a/src/dbus-shared-names.h b/src/dbus-shared-names.h index 350fa6d..c5372e4 100644 --- a/src/dbus-shared-names.h +++ b/src/dbus-shared-names.h @@ -63,6 +63,5 @@ typedef enum { #define ICON_DEFAULT "system-devices-panel" #define ICON_RESTART "system-devices-panel-alert" -#define GREETER_ICON_DEFAULT "system-shutdown-panel" #endif /* __DBUS_SHARED_NAMES_H__ */ diff --git a/src/indicator-session.c b/src/indicator-session.c index 2b36fdd..aacef49 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -164,19 +164,10 @@ indicator_session_init (IndicatorSession *self) self->users.label = GTK_LABEL (gtk_label_new (NULL)); - const gchar *greeter_var; - greeter_var = g_getenv("INDICATOR_GREETER_MODE"); - // devices self->devices.menu = GTK_MENU (dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME, INDICATOR_SESSION_DBUS_OBJECT)); - if (g_strcmp0(greeter_var, "1") == 0){ - self->devices.image = indicator_image_helper (GREETER_ICON_DEFAULT); - } - else{ - self->devices.image = indicator_image_helper (ICON_DEFAULT); - } - + self->devices.image = indicator_image_helper (ICON_DEFAULT); gtk_widget_show (GTK_WIDGET(self->devices.menu)); gtk_widget_show (GTK_WIDGET(self->devices.image)); -- cgit v1.2.3 From 46db1068e1684293f02125872361f75204399e8f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 6 Sep 2011 17:59:18 +0100 Subject: refactor the apt state callback because the use case of real and simulation were proving far too disparate --- src/apt-watcher.c | 95 ++++++++++++++++++++++++++++++++----------------- src/indicator-session.c | 3 +- 2 files changed, 65 insertions(+), 33 deletions(-) (limited to 'src/indicator-session.c') diff --git a/src/apt-watcher.c b/src/apt-watcher.c index 167b847..b0d9688 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -66,6 +66,13 @@ static void apt_watcher_signal_cb (GDBusProxy* proxy, static void apt_watcher_manage_transactions (AptWatcher* self, gchar* transaction_id); static gboolean apt_watcher_query_reboot_status (gpointer self); +static void apt_watcher_transaction_state_simulation_update_cb (AptTransaction* trans, + gint update, + gpointer user_data); +static void apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, + gint update, + gpointer user_data); + @@ -245,34 +252,23 @@ apt_watcher_show_apt_dialog (DbusmenuMenuitem * mi, } static void -apt_watcher_transaction_state_update_cb (AptTransaction* trans, - gint update, - gpointer user_data) +apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, + gint update, + gpointer user_data) { g_debug ("apt-watcher -transaction update %i", update); g_return_if_fail (APT_IS_WATCHER (user_data)); AptWatcher* self = APT_WATCHER (user_data); AptState state = (AptState)update; - if (state == UP_TO_DATE){ dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Software Up to Date")); - // Simulations don't send a finished signal for some reason - // Anyway from a simulation we just need one state update - // (updates available or not) - if (apt_transaction_get_transaction_type (self->current_transaction) - == SIMULATION){ - g_object_unref (G_OBJECT(self->current_transaction)); - self->current_transaction = NULL; - } if (self->reboot_query != 0){ g_source_remove (self->reboot_query); self->reboot_query = 0; } - // Wait a sec before querying for reboot status, - // race condition with Apt has been observed. self->reboot_query = g_timeout_add_seconds (1, apt_watcher_query_reboot_status, self); @@ -281,27 +277,15 @@ apt_watcher_transaction_state_update_cb (AptTransaction* trans, dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Updates Available…")); - // Simulations don't send a finished signal for some reason - // Anyway from a simulation we just need one state update - // (updates available or not) - if (apt_transaction_get_transaction_type (self->current_transaction) - == SIMULATION){ - g_object_unref (G_OBJECT(self->current_transaction)); - self->current_transaction = NULL; - } + self->current_state = state; } else if (state == UPGRADE_IN_PROGRESS){ dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Updates Installing…")); + self->current_state = state; } else if (state == FINISHED){ - g_object_unref (G_OBJECT(self->current_transaction)); - self->current_transaction = NULL; - - if (self->current_state == UPDATES_AVAILABLE){ - return; - } if (self->reboot_query != 0){ g_source_remove (self->reboot_query); @@ -312,11 +296,57 @@ apt_watcher_transaction_state_update_cb (AptTransaction* trans, self->reboot_query = g_timeout_add_seconds (1, apt_watcher_query_reboot_status, self); + } + + self->current_state = state; + + if (self->current_state != UPGRADE_IN_PROGRESS){ + g_object_unref (G_OBJECT(self->current_transaction)); + self->current_transaction = NULL; + } +} + + +static void +apt_watcher_transaction_state_simulation_update_cb (AptTransaction* trans, + gint update, + gpointer user_data) +{ + g_debug ("apt-watcher -transaction update %i", update); + g_return_if_fail (APT_IS_WATCHER (user_data)); + AptWatcher* self = APT_WATCHER (user_data); + + AptState state = (AptState)update; + + if (state == UP_TO_DATE){ + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_LABEL, + _("Software Up to Date")); + if (self->reboot_query != 0){ + g_source_remove (self->reboot_query); + self->reboot_query = 0; + } + self->reboot_query = g_timeout_add_seconds (1, + apt_watcher_query_reboot_status, + self); + } + else if (state == UPDATES_AVAILABLE){ dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, - _("Finished Updating…")); + _("Updates Available…")); } + else if (state == UPGRADE_IN_PROGRESS){ + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_LABEL, + _("Updates Installing…")); + } + self->current_state = state; + + if (self->current_state != UPGRADE_IN_PROGRESS){ + g_object_unref (G_OBJECT(self->current_transaction)); + self->current_transaction = NULL; + } } static void @@ -326,7 +356,7 @@ apt_watcher_manage_transactions (AptWatcher* self, gchar* transaction_id) self->current_transaction = apt_transaction_new (transaction_id, SIMULATION); g_signal_connect (G_OBJECT(self->current_transaction), "state-update", - G_CALLBACK(apt_watcher_transaction_state_update_cb), self); + G_CALLBACK(apt_watcher_transaction_state_simulation_update_cb), self); } } @@ -359,6 +389,7 @@ apt_watcher_query_reboot_status (gpointer data) DBUSMENU_MENUITEM_PROP_DISPOSITION, DBUSMENU_MENUITEM_DISPOSITION_ALERT); session_dbus_restart_required (self->session_dbus_interface); + self->current_state = RESTART_NEEDED; } self->reboot_query = 0; return FALSE; @@ -384,7 +415,7 @@ static void apt_watcher_signal_cb ( GDBusProxy* proxy, if (g_str_has_prefix (current, "/org/debian/apt/transaction/") == TRUE){ g_debug ("ActiveTransactionsChanged - current is %s", current); - + // Cancel all existing operations. if (self->reboot_query != 0){ g_source_remove (self->reboot_query); @@ -400,7 +431,7 @@ static void apt_watcher_signal_cb ( GDBusProxy* proxy, self->current_transaction = apt_transaction_new (current, REAL); g_signal_connect (G_OBJECT(self->current_transaction), "state-update", - G_CALLBACK(apt_watcher_transaction_state_update_cb), self); + G_CALLBACK(apt_watcher_transaction_state_real_update_cb), self); } } g_variant_unref (parameters); diff --git a/src/indicator-session.c b/src/indicator-session.c index 2f1764f..f41c841 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -507,11 +507,12 @@ receive_signal (GDBusProxy * proxy, &self->users); } } - else if (g_strcmp0(signal_name, "RestartRequired") == 0) { + else if (g_strcmp0(signal_name, "RestartRequired") == 0) { if (greeter_mode == TRUE){ self->devices.image = indicator_image_helper (GREETER_ICON_RESTART); } else{ + g_debug ("reboot required"); self->devices.image = indicator_image_helper (ICON_RESTART); } } -- cgit v1.2.3 From 6174b1bac576198e5d3df35f93971598937e71c6 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 8 Sep 2011 14:01:36 +0100 Subject: user correct string on switch item unless user actually wants to show username --- data/com.canonical.indicator.session.gschema.xml.in | 7 +++++++ src/indicator-session.c | 11 ++++++++--- src/settings-helper.h | 15 ++++++++------- 3 files changed, 23 insertions(+), 10 deletions(-) (limited to 'src/indicator-session.c') diff --git a/data/com.canonical.indicator.session.gschema.xml.in b/data/com.canonical.indicator.session.gschema.xml.in index e0d14c3..eaebea1 100644 --- a/data/com.canonical.indicator.session.gschema.xml.in +++ b/data/com.canonical.indicator.session.gschema.xml.in @@ -25,6 +25,13 @@ Determine the visibility of the User Menu Allow for the user menu to be hidden by the user. + + false + Determine what string to use for the user's name in the switch menuitem. + The switch menuitem as part of the user menu should be default have the label 'Switch User Account'. + This settings gives the user the potential to have the label read 'Switch from $username' + + diff --git a/src/indicator-session.c b/src/indicator-session.c index f41c841..20fc643 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -539,10 +539,16 @@ switch_property_change (DbusmenuMenuitem * item, if (g_strcmp0(translate, "1") != 0) { no_name_in_lang = TRUE; } + + GSettings* settings = g_settings_new ("com.canonical.indicator.session"); + gboolean use_username = g_settings_get_boolean (settings, + "use-username-in-switch-item"); + g_object_unref (settings); if (variant == NULL || g_variant_get_string(variant, NULL) == NULL || - g_variant_get_string(variant, NULL)[0] == '\0' || no_name_in_lang) { - finalstring = _("Switch User…"); + g_variant_get_string(variant, NULL)[0] == '\0' || no_name_in_lang + || use_username == FALSE) { + finalstring = _("Switch User Account…"); set_ellipsize = FALSE; } @@ -587,7 +593,6 @@ switch_property_change (DbusmenuMenuitem * item, gtk_label_set_ellipsize(label, PANGO_ELLIPSIZE_NONE); } } - return; } diff --git a/src/settings-helper.h b/src/settings-helper.h index ae57575..ea0c99f 100644 --- a/src/settings-helper.h +++ b/src/settings-helper.h @@ -21,7 +21,7 @@ with this program. If not, see . #ifndef __GCONF_HELPER_H__ -#define __GCONF_HELPER_H__ 1 +#define __GCONF_HELPER_H__ #include @@ -31,12 +31,13 @@ with this program. If not, see . #include #include -#define SESSION_SCHEMA "com.canonical.indicator.session" -#define SUPPRESS_KEY "suppress-logout-restart-shutdown" -#define LOGOUT_KEY "suppress-logout-menuitem" -#define RESTART_KEY "suppress-restart-menuitem" -#define SHUTDOWN_KEY "suppress-shutdown-menuitem" -#define SHOW_USER_MENU "user-show-menu" +#define SESSION_SCHEMA "com.canonical.indicator.session" +#define SUPPRESS_KEY "suppress-logout-restart-shutdown" +#define LOGOUT_KEY "suppress-logout-menuitem" +#define RESTART_KEY "suppress-restart-menuitem" +#define SHUTDOWN_KEY "suppress-shutdown-menuitem" +#define SHOW_USER_MENU "user-show-menu" +#define USER_USERNAME_IN_SWITCH_ITEM "use-username-in-switch-item" #define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown" #define LOCKDOWN_KEY_USER "disable-user-switching" -- cgit v1.2.3 From d446a9d9bf96e5d3dd9b6065adceb1aeb25fcd98 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 8 Sep 2011 18:30:52 +0100 Subject: add the new gsettings entry for toggling the visibility of the real name on the panel --- data/com.canonical.indicator.session.gschema.xml.in | 5 +++++ src/indicator-session.c | 1 + 2 files changed, 6 insertions(+) (limited to 'src/indicator-session.c') diff --git a/data/com.canonical.indicator.session.gschema.xml.in b/data/com.canonical.indicator.session.gschema.xml.in index e0d14c3..3b4cd4d 100644 --- a/data/com.canonical.indicator.session.gschema.xml.in +++ b/data/com.canonical.indicator.session.gschema.xml.in @@ -20,6 +20,11 @@ <_summary>Remove the shutdown item from the session menu <_description>Makes it so that the shutdown button doesn’t show in the session menu. + + true + Determine the visibility of the User's real name on the panel + Allow for the Removal of the users name from the panel + true Determine the visibility of the User Menu diff --git a/src/indicator-session.c b/src/indicator-session.c index f41c841..1f58aba 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -705,6 +705,7 @@ indicator_session_update_users_label (IndicatorSession* self, gtk_widget_hide(GTK_WIDGET(self->users.label)); return; } + gtk_label_set_text (self->users.label, g_strdup(name)); gtk_widget_show(GTK_WIDGET(self->users.label)); } -- cgit v1.2.3