From 1987bc1ba09bdda36b0f08b0e179bc0fe59a858f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 30 Aug 2011 09:49:19 +0100 Subject: protect against incorrect webcam detection --- src/udev-mgr.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/udev-mgr.c b/src/udev-mgr.c index edc2262..5f197d6 100644 --- a/src/udev-mgr.c +++ b/src/udev-mgr.c @@ -226,7 +226,11 @@ udev_mgr_handle_webcam (UdevMgr* self, vendor = g_udev_device_get_property (device, "ID_VENDOR_ID"); product = g_udev_device_get_property (device, "ID_MODEL_ID"); - + + if (!vendor || !product) { + return; + } + if (action == REMOVE){ if (g_hash_table_lookup (self->webcams_present, product) == NULL){ g_warning ("Got a remove event on a webcam device but we don't have that device in our webcam cache"); @@ -316,18 +320,23 @@ static void udev_mgr_handle_scsi_device (UdevMgr* self, { const gchar* type = NULL; type = g_udev_device_get_property (device, "TYPE"); - // apparently anything thats type 3 and SCSI is a Scanner + + if (!type) { + return; + } + + // apparently anything thats type 6 and SCSI is a Scanner if (g_strcmp0 (type, "6") == 0 && action == ADD){ const gchar* manufacturer = NULL; manufacturer = g_udev_device_get_property (device, "ID_VENDOR"); if (manufacturer != NULL){ - gchar * label = format_device_name(self, manufacturer, _("Scanner"), _("%s Scanner")); + gchar * label = format_device_name(self, manufacturer, _("Scanner"), _("%s Scanner")); dbusmenu_menuitem_property_set (self->scanner_item, DBUSMENU_MENUITEM_PROP_LABEL, label); - g_free(label); + g_free(label); } gchar* random_scanner_name = g_strdup_printf("%p--scanner", self); -- cgit v1.2.3 From 4bc40ecfbdb3d5e16c3168c738f7500d12adb46c Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 30 Aug 2011 09:52:28 +0100 Subject: bump for release --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8e5ed8b..8bee0bf 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-session.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-session, 0.3.3.2) +AM_INIT_AUTOMAKE(indicator-session, 0.3.3.3) AM_MAINTAINER_MODE -- cgit v1.2.3 From 6ce3738b7e6c27f22cb949e2668e9ee47b4ced3f Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 30 Aug 2011 16:32:43 +0100 Subject: fixed the guest session panel string --- src/user-menu-mgr.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index 1b404d3..1747a8a 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -168,6 +168,10 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) users_service_dbus_set_guest_item (self->users_dbus_interface, guest_mi); } + else{ + session_dbus_set_users_real_name (self->session_dbus_interface, + _("Guest")); + } GList * users = NULL; users = users_service_dbus_get_user_list (self->users_dbus_interface); @@ -175,8 +179,9 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) gboolean user_menu_is_visible = FALSE; + // question for Ted, how to detect guest session is enabled. if (!greeter_mode){ - user_menu_is_visible = self->user_count > 1 || check_guest_session(); + user_menu_is_visible = TRUE;//self->user_count > 1 || check_guest_session(); } session_dbus_set_user_menu_visibility (self->session_dbus_interface, @@ -192,20 +197,13 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) user->service = self->users_dbus_interface; gboolean current_user = g_strcmp0 (user->user_name, g_get_user_name()) == 0; if (current_user == TRUE){ - if (check_guest_session()){ - g_debug ("about to set the users real name to %s for user %s", - user->real_name, user->user_name); - session_dbus_set_users_real_name (self->session_dbus_interface, user->real_name); - } - else{ - g_debug ("about to set the users real name to GUEST"); - session_dbus_set_users_real_name (self->session_dbus_interface, - _("Guest")); - } + g_debug ("about to set the users real name to %s for user %s", + user->real_name, user->user_name); + session_dbus_set_users_real_name (self->session_dbus_interface, user->real_name); } - if (g_strcmp0(user->user_name, "guest") == 0) { + if (g_str_has_prefix(user->user_name, "guest-") == TRUE) { /* Check to see if the guest has sessions and so therefore should get a check mark. */ dbusmenu_menuitem_property_set_bool (guest_mi, -- cgit v1.2.3 From 267bef38a08ff9d7d401cf5027d1dc2876430ca4 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 30 Aug 2011 16:46:28 +0100 Subject: remove broken logic concerned with displaying the user menu --- src/user-menu-mgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index 1747a8a..c11e0b9 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -179,9 +179,8 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) gboolean user_menu_is_visible = FALSE; - // question for Ted, how to detect guest session is enabled. if (!greeter_mode){ - user_menu_is_visible = TRUE;//self->user_count > 1 || check_guest_session(); + user_menu_is_visible = TRUE; } session_dbus_set_user_menu_visibility (self->session_dbus_interface, -- cgit v1.2.3 From a26d2f019ecbb67dacae83a07f7526759bb050f9 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 30 Aug 2011 17:17:19 +0100 Subject: remove guest checking in generic user list, the guest user is never included in the user list returned therefore the check is pointless --- src/user-menu-mgr.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index c11e0b9..a4308dd 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -192,7 +192,7 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) for (u = users; u != NULL; u = g_list_next (u)) { user = u->data; - //g_debug ("%p: %s", user, user->real_name); + g_debug ("%s: %s", user->user_name, user->real_name); user->service = self->users_dbus_interface; gboolean current_user = g_strcmp0 (user->user_name, g_get_user_name()) == 0; if (current_user == TRUE){ @@ -201,21 +201,6 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) session_dbus_set_users_real_name (self->session_dbus_interface, user->real_name); } - - if (g_str_has_prefix(user->user_name, "guest-") == TRUE) { - /* Check to see if the guest has sessions and so therefore should - get a check mark. */ - dbusmenu_menuitem_property_set_bool (guest_mi, - USER_ITEM_PROP_LOGGED_IN, - user->sessions != NULL); - /* If we're showing user accounts, keep going through the list */ - if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) { - continue; - } - /* If not, we can stop here */ - break; - } - if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) { mi = dbusmenu_menuitem_new (); dbusmenu_menuitem_property_set (mi, -- cgit v1.2.3 From 6ee7c05f5d8f4397c3111fe94ab7c742478b737e Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 30 Aug 2011 17:38:02 +0100 Subject: bump for release --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8bee0bf..a2f96f5 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-session.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-session, 0.3.3.3) +AM_INIT_AUTOMAKE(indicator-session, 0.3.4) AM_MAINTAINER_MODE -- cgit v1.2.3 From c1c06038cc814a336b02fd09ee50bf072d24bb03 Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Tue, 30 Aug 2011 15:31:52 -0400 Subject: - in a Guest session user menu is not visible (LP: #834948) - User name shown as [Invalid UTF-8] in live session (LP: #837246) --- debian/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index 9d27fb1..81240f6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ indicator-session (0.3.4-0ubuntu1) UNRELEASED; urgency=low * New upstream release. + - in a Guest session user menu is not visible (LP: #834948) + - User name shown as [Invalid UTF-8] in live session (LP: #837246) -- Ken VanDine Tue, 30 Aug 2011 15:29:35 -0400 -- cgit v1.2.3 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/apt-watcher.c | 85 ++++++++++++++++++++++++++++++++++++------------- src/indicator-session.c | 1 + src/session-dbus.xml | 2 +- 3 files changed, 64 insertions(+), 24 deletions(-) diff --git a/src/apt-watcher.c b/src/apt-watcher.c index a4298a8..e757896 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -27,6 +27,7 @@ static guint watcher_id; struct _AptWatcher { GObject parent_instance; + guint reboot_query; GCancellable * proxy_cancel; GDBusProxy * proxy; SessionDbus* session_dbus_interface; @@ -64,6 +65,7 @@ static void apt_watcher_signal_cb (GDBusProxy* proxy, gpointer user_data); static void apt_watcher_manage_transactions (AptWatcher* self, gchar* transaction_id); +static gboolean apt_watcher_query_reboot_status (gpointer self); @@ -75,6 +77,7 @@ apt_watcher_init (AptWatcher *self) self->current_state = UP_TO_DATE; self->proxy_cancel = g_cancellable_new(); self->proxy = NULL; + self->reboot_query = 0; self->current_transaction = NULL; g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, @@ -141,7 +144,11 @@ 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); + + /*self->reboot_query = g_timeout_add_seconds (5, + apt_watcher_query_reboot_status, + self);*/ } @@ -245,7 +252,16 @@ apt_watcher_transaction_state_update_cb (AptTransaction* trans, == 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); } else if (state == UPDATES_AVAILABLE){ dbusmenu_menuitem_property_set (self->apt_item, @@ -266,27 +282,20 @@ apt_watcher_transaction_state_update_cb (AptTransaction* trans, _("Updates Installing…")); } else if (state == FINISHED){ - GVariant* reboot_result = g_dbus_proxy_get_cached_property (self->proxy, - "RebootRequired"); - gboolean reboot; - g_variant_get (reboot_result, "b", &reboot); - if (reboot == FALSE){ - dbusmenu_menuitem_property_set (self->apt_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Software Up to Date")); - } - else{ - dbusmenu_menuitem_property_set (self->apt_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Reboot Required")); - dbusmenu_menuitem_property_set (self->apt_item, - DBUSMENU_MENUITEM_PROP_DISPOSITION, - DBUSMENU_MENUITEM_DISPOSITION_ALERT); - session_dbus_restart_required (self->session_dbus_interface); - } - g_debug ("Finished with a reboot value of %i", reboot); g_object_unref (G_OBJECT(self->current_transaction)); - self->current_transaction = NULL; + 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); + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_LABEL, + _("Finished Updating…")); } self->current_state = state; } @@ -302,8 +311,38 @@ apt_watcher_manage_transactions (AptWatcher* self, gchar* transaction_id) } } +static gboolean +apt_watcher_query_reboot_status (gpointer data) +{ + g_return_val_if_fail (APT_IS_WATCHER (data), FALSE); + AptWatcher* self = APT_WATCHER (data); + + GVariant* reboot_result = g_dbus_proxy_get_cached_property (self->proxy, + "RebootRequired"); + gboolean reboot; + g_variant_get (reboot_result, "b", &reboot); + g_debug ("apt_watcher_query_reboot_status: reboot prop = %i", reboot); + + if (reboot == FALSE){ + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_LABEL, + _("Software Up to Date")); + } + else{ + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_LABEL, + _("Reboot Required")); + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_DISPOSITION, + DBUSMENU_MENUITEM_DISPOSITION_ALERT); + session_dbus_restart_required (self->session_dbus_interface); + } + self->reboot_query = 0; + return FALSE; +} + // TODO - Ask MVO about this. -// Signal is of type s not sas which is on d-feet !!! +// Signal is of type s not sas which is on d-feet. static void apt_watcher_signal_cb ( GDBusProxy* proxy, gchar* sender_name, gchar* signal_name, 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); } } diff --git a/src/session-dbus.xml b/src/session-dbus.xml index fd1859f..076e595 100644 --- a/src/session-dbus.xml +++ b/src/session-dbus.xml @@ -8,7 +8,7 @@ - + -- 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(-) 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(-) 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 c7a50eedd6e9878547b73e8cf952f75f544cb5d2 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 31 Aug 2011 15:51:16 +0100 Subject: make sure to bring up logout dialog from apt menuitem when restart is required --- src/apt-watcher.c | 35 ++++++++++++++++++++++++------ src/device-menu-mgr.c | 59 --------------------------------------------------- 2 files changed, 28 insertions(+), 66 deletions(-) diff --git a/src/apt-watcher.c b/src/apt-watcher.c index 346b8a9..779d02b 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -56,7 +56,7 @@ static void apt_watcher_upgrade_system_cb (GObject * obj, static void apt_watcher_show_apt_dialog (DbusmenuMenuitem* mi, guint timestamp, - gchar * type); + gpointer userdata); static void apt_watcher_signal_cb (GDBusProxy* proxy, gchar* sender_name, @@ -216,14 +216,35 @@ apt_watcher_upgrade_system_cb (GObject * obj, static void apt_watcher_show_apt_dialog (DbusmenuMenuitem * mi, guint timestamp, - gchar * type) + gpointer userdata) { GError * error = NULL; - if (!g_spawn_command_line_async("update-manager", &error)) - { - g_warning("Unable to show update-manager: %s", error->message); - g_error_free(error); - } + g_return_if_fail (APT_IS_WATCHER (userdata)); + AptWatcher* self = APT_WATCHER (userdata); + + gchar* disposition = dbusmenu_menuitem_property_get (self->apt_item, + DBUSMENU_MENUITEM_PROP_DISPOSITION); + + if (g_strcmp0 (disposition, DBUSMENU_MENUITEM_DISPOSITION_ALERT) == 0){ + gchar * helper = g_build_filename (LIBEXECDIR, "gtk-logout-helper", NULL); + gchar * dialog_line = g_strdup_printf ("%s --%s", helper, "Restart"); + g_free(helper); + g_debug("Showing dialog '%s'", dialog_line); + GError * error = NULL; + + if (!g_spawn_command_line_async(dialog_line, &error)) { + g_warning("Unable to show dialog: %s", error->message); + g_error_free(error); + } + g_free(dialog_line); + } + else{ + if (!g_spawn_command_line_async("update-manager", &error)) + { + g_warning("Unable to show update-manager: %s", error->message); + g_error_free(error); + } + } } static void diff --git a/src/device-menu-mgr.c b/src/device-menu-mgr.c index 523ea8d..5a63be3 100644 --- a/src/device-menu-mgr.c +++ b/src/device-menu-mgr.c @@ -61,7 +61,6 @@ static DBusGProxyCall * hibernate_call = NULL; static DbusmenuMenuitem * hibernate_mi = NULL; static DbusmenuMenuitem * suspend_mi = NULL; static DbusmenuMenuitem * logout_mi = NULL; -static DbusmenuMenuitem * restart_mi = NULL; static DbusmenuMenuitem * shutdown_mi = NULL; static gboolean can_hibernate = TRUE; @@ -73,7 +72,6 @@ static DBusGProxy * up_main_proxy = NULL; static DBusGProxy * up_prop_proxy = NULL; static void device_menu_mgr_ensure_settings_client (DeviceMenuMgr* self); -static void setup_restart_watch (DeviceMenuMgr* self); static void setup_up (DeviceMenuMgr* self); static void device_menu_mgr_rebuild_items (DeviceMenuMgr *self); static void lock_if_possible (DeviceMenuMgr* self); @@ -106,7 +104,6 @@ device_menu_mgr_init (DeviceMenuMgr *self) { self->apt_watcher = NULL; self->root_item = dbusmenu_menuitem_new (); - setup_restart_watch(self); setup_up(self); g_idle_add(lock_screen_setup, NULL); } @@ -751,62 +748,6 @@ device_menu_mgr_rebuild_items (DeviceMenuMgr* self) can_suspend && allow_suspend); } -/* When the directory changes we need to figure out how our menu - item should look. */ -static void -restart_dir_changed (gpointer userdata) -{ - DeviceMenuMgr* self = DEVICE_MENU_MGR (userdata); - gboolean restart_required = g_file_test("/var/run/reboot-required", G_FILE_TEST_EXISTS); - - if (restart_required) { - if (supress_confirmations()) { - dbusmenu_menuitem_property_set (restart_mi, - RESTART_ITEM_LABEL, - _("Restart to Complete Update")); - } else { - dbusmenu_menuitem_property_set (restart_mi, - RESTART_ITEM_LABEL, - _("Restart to Complete Update\342\200\246")); - } - dbusmenu_menuitem_property_set (restart_mi, - RESTART_ITEM_ICON, - "system-restart-panel"); - if (self->session_dbus_interface != NULL) { - session_dbus_set_name (self->session_dbus_interface, ICON_RESTART); - } - } else { - if (supress_confirmations()) { - dbusmenu_menuitem_property_set(restart_mi, RESTART_ITEM_LABEL, _("Restart")); - } else { - dbusmenu_menuitem_property_set(restart_mi, RESTART_ITEM_LABEL, _("Restart\342\200\246")); - } - dbusmenu_menuitem_property_remove(restart_mi, RESTART_ITEM_ICON); - if (self->session_dbus_interface != NULL) { - session_dbus_set_name(self->session_dbus_interface, ICON_DEFAULT); - } - } - return; -} - -/* Buids a file watcher for the directory so that when it - changes we can check to see if our reboot-required is - there. */ -static void -setup_restart_watch (DeviceMenuMgr* self) -{ - GFile * filedir = g_file_new_for_path("/var/run"); - GFileMonitor * filemon = g_file_monitor_directory(filedir, G_FILE_MONITOR_NONE, NULL, NULL); - if (filemon != NULL) { - g_signal_connect (G_OBJECT(filemon), - "changed", - G_CALLBACK(restart_dir_changed), - self); - } - restart_dir_changed(self); - return; -} - /* Ensures that we have a GConf client and if we build one set up the signal handler. */ static void -- cgit v1.2.3 From 5f9ec570e2e9552273a9a7b4c15cc4f6ce03a3ab Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 31 Aug 2011 18:02:57 +0100 Subject: tidy up --- src/apt-watcher.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/apt-watcher.c b/src/apt-watcher.c index 779d02b..d19dc4f 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -221,17 +221,14 @@ apt_watcher_show_apt_dialog (DbusmenuMenuitem * mi, GError * error = NULL; g_return_if_fail (APT_IS_WATCHER (userdata)); AptWatcher* self = APT_WATCHER (userdata); - - gchar* disposition = dbusmenu_menuitem_property_get (self->apt_item, - DBUSMENU_MENUITEM_PROP_DISPOSITION); + const gchar* disposition = NULL; + disposition = dbusmenu_menuitem_property_get (self->apt_item, + DBUSMENU_MENUITEM_PROP_DISPOSITION); if (g_strcmp0 (disposition, DBUSMENU_MENUITEM_DISPOSITION_ALERT) == 0){ gchar * helper = g_build_filename (LIBEXECDIR, "gtk-logout-helper", NULL); - gchar * dialog_line = g_strdup_printf ("%s --%s", helper, "Restart"); + gchar * dialog_line = g_strdup_printf ("%s --%s", helper, "restart"); g_free(helper); - g_debug("Showing dialog '%s'", dialog_line); - GError * error = NULL; - if (!g_spawn_command_line_async(dialog_line, &error)) { g_warning("Unable to show dialog: %s", error->message); g_error_free(error); -- cgit v1.2.3 From b8b29748d3346c1cabf7ccac301158c709e56f39 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 31 Aug 2011 18:20:08 +0100 Subject: set the menuitem's disposition back to normal just in case --- src/apt-watcher.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/apt-watcher.c b/src/apt-watcher.c index d19dc4f..f5c9d55 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -341,6 +341,10 @@ apt_watcher_query_reboot_status (gpointer data) dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Software Up to Date")); + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_DISPOSITION, + DBUSMENU_MENUITEM_DISPOSITION_NORMAL); + } else{ dbusmenu_menuitem_property_set (self->apt_item, -- 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(-) 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 8c0fce006824f4c1279c293bbd9e137ae23b68f0 Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Thu, 1 Sep 2011 13:53:24 -0400 Subject: cleaned up changelog --- debian/changelog | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/debian/changelog b/debian/changelog index 979a345..f1ddfdf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,14 +4,11 @@ indicator-session (0.3.4-0ubuntu1) UNRELEASED; urgency=low - in a Guest session user menu is not visible (LP: #834948) - User name shown as [Invalid UTF-8] in live session (LP: #837246) - -- Ken VanDine Tue, 30 Aug 2011 15:29:35 -0400 - -indicator-session (0.3.3.2-0ubuntu2~ppa1) oneiric; urgency=low - + [Ted Gould] * debian/control: Adding a depend on gnome-settings-daemon to ensure that the required schemas are available. (LP: #833965) - -- Ted Gould Wed, 31 Aug 2011 13:45:22 -0500 + -- Ken VanDine Thu, 01 Sep 2011 13:52:10 -0400 indicator-session (0.3.3.2-0ubuntu1) oneiric; urgency=low @@ -51,29 +48,6 @@ indicator-session (0.3.3-0ubuntu1) oneiric; urgency=low -- Ken VanDine Thu, 25 Aug 2011 08:58:56 -0400 -indicator-session (0.3.2-0ubuntu2~ppa3) UNRELEASED; urgency=low - - * Upstream Merge - * So much stuff... - * Desktop files for system functions - - -- Ted Gould Tue, 23 Aug 2011 11:24:25 -0500 - -indicator-session (0.3.2-0ubuntu2~ppa2) oneiric; urgency=low - - * Upstream Merge - * GSettings Fixes - - -- Ted Gould Fri, 19 Aug 2011 15:10:54 -0500 - -indicator-session (0.3.2-0ubuntu2~ppa1) oneiric; urgency=low - - * Upstream Merge - * GSettings transition - * debian/rules: Adding autoreconf - - -- Ted Gould Fri, 19 Aug 2011 14:59:20 -0500 - indicator-session (0.3.2-0ubuntu1) oneiric; urgency=low * New upstream release. -- cgit v1.2.3 From a205a6f749263d1f046c568295979bca72026879 Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Thu, 1 Sep 2011 15:02:32 -0400 Subject: - "Reboot Required" menu opens Update Manager, doesn't reboot (LP: #837658) - indicator-session-service crashed with SIGSEGV in g_str_hash() (LP: #824243) - indicator-session-service crashed with SIGSEGV in g_variant_unref() (LP: #833965) * +debian/patches/revert_icon_change.patch - revert the icon change in greeter mode until a UIF exception is approved * +debian/source/format --- debian/changelog | 9 +++++++++ debian/patches/revert_icon_change.patch | 12 ++++++++++++ debian/patches/series | 1 + debian/source/format | 1 + 4 files changed, 23 insertions(+) create mode 100644 debian/patches/revert_icon_change.patch create mode 100644 debian/patches/series create mode 100644 debian/source/format diff --git a/debian/changelog b/debian/changelog index 106a6ff..d99694a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,15 @@ indicator-session (0.3.4.1-0ubuntu1) UNRELEASED; urgency=low * New upstream release. - in a Guest session user menu is not visible (LP: #834948) - User name shown as [Invalid UTF-8] in live session (LP: #837246) + - "Reboot Required" menu opens Update Manager, doesn't reboot (LP: #837658) + - indicator-session-service crashed with SIGSEGV in + g_str_hash() (LP: #824243) + - indicator-session-service crashed with SIGSEGV in + g_variant_unref() (LP: #833965) + * +debian/patches/revert_icon_change.patch + - revert the icon change in greeter mode until a UIF exception is + approved + * +debian/source/format [Ted Gould] * debian/control: Adding a depend on gnome-settings-daemon to ensure that diff --git a/debian/patches/revert_icon_change.patch b/debian/patches/revert_icon_change.patch new file mode 100644 index 0000000..59a8118 --- /dev/null +++ b/debian/patches/revert_icon_change.patch @@ -0,0 +1,12 @@ +=== modified file 'src/dbus-shared-names.h' +--- old/src/dbus-shared-names.h 2011-09-01 17:23:35 +0000 ++++ new/src/dbus-shared-names.h 2011-09-01 18:38:01 +0000 +@@ -63,6 +63,6 @@ + + #define ICON_DEFAULT "system-devices-panel" + #define ICON_RESTART "system-devices-panel-alert" +-#define GREETER_ICON_DEFAULT "system-shutdown-panel" ++#define GREETER_ICON_DEFAULT "system-devices-panel" + + #endif /* __DBUS_SHARED_NAMES_H__ */ + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..43f089f --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +revert_icon_change.patch diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) -- cgit v1.2.3 From 3b39d2b2b2578c4d6f66156905a29fdade6ffe60 Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Thu, 1 Sep 2011 15:03:40 -0400 Subject: releasing version 0.3.4.1-0ubuntu1 --- debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d99694a..088b222 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -indicator-session (0.3.4.1-0ubuntu1) UNRELEASED; urgency=low +indicator-session (0.3.4.1-0ubuntu1) oneiric; urgency=low [Ken VanDine] * New upstream release. -- cgit v1.2.3 From 374a403e76107ad6696fa67eb9d0313776f47647 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 2 Sep 2011 10:10:47 +0100 Subject: final apt menuitem bugs fixes --- src/apt-transaction.c | 2 +- src/apt-watcher.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/apt-transaction.c b/src/apt-transaction.c index be1c57b..cd9e131 100644 --- a/src/apt-transaction.c +++ b/src/apt-transaction.c @@ -213,7 +213,7 @@ apt_transaction_receive_signal (GDBusProxy * proxy, if (g_variant_is_of_type (role, G_VARIANT_TYPE_STRING) == TRUE){ gchar* current_role = NULL; g_variant_get (role, "s", ¤t_role); - g_debug ("Current transaction role = %s", current_role); + //g_debug ("Current transaction role = %s", current_role); if (g_strcmp0 (current_role, "role-commit-packages") == 0 || g_strcmp0 (current_role, "role-upgrade-system") == 0){ g_debug ("UPGRADE IN PROGRESS"); diff --git a/src/apt-watcher.c b/src/apt-watcher.c index f5c9d55..480e174 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -298,6 +298,11 @@ apt_watcher_transaction_state_update_cb (AptTransaction* trans, 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); self->reboot_query = 0; @@ -359,8 +364,6 @@ apt_watcher_query_reboot_status (gpointer data) return FALSE; } -// TODO - Ask MVO about this. -// Signal is of type s not sas which is on d-feet. static void apt_watcher_signal_cb ( GDBusProxy* proxy, gchar* sender_name, gchar* signal_name, @@ -374,10 +377,13 @@ static void apt_watcher_signal_cb ( GDBusProxy* proxy, GVariant *value = g_variant_get_child_value (parameters, 0); if (g_strcmp0(signal_name, "ActiveTransactionsChanged") == 0){ - gchar* input = NULL; - g_variant_get(value, "s", & input); - if (g_str_has_prefix (input, "/org/debian/apt/transaction/") == TRUE){ - g_debug ("Active Transactions signal - input is null = %i", input == NULL); + gchar* current = NULL; + g_debug ("ActiveTransactionsChanged"); + + //gchar** queued = NULL; + g_variant_get(value, "s", ¤t); + if (g_str_has_prefix (current, "/org/debian/apt/transaction/") == TRUE){ + g_debug ("ActiveTransactionsChanged - current is %s", current); if (self->current_transaction != NULL) { @@ -385,7 +391,7 @@ static void apt_watcher_signal_cb ( GDBusProxy* proxy, self->current_transaction = NULL; } - self->current_transaction = apt_transaction_new (input, REAL); + 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); -- 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(-) 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 40e2c4c17c08042e6ed58b554aa4c45a8f806801 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Fri, 2 Sep 2011 16:06:17 +0100 Subject: bumped version in prep for release --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 49353b2..951e8a3 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-session.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-session, 0.3.4.1) +AM_INIT_AUTOMAKE(indicator-session, 0.3.4.2) AM_MAINTAINER_MODE -- 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(-) 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 9da9edc5c66534d80ab211bad95f8c97b72c180c Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Mon, 5 Sep 2011 12:25:24 +0100 Subject: protect against a null pointer in the user-dbus-manager --- src/users-service-dbus.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c index 4b41f4b..0fa751d 100644 --- a/src/users-service-dbus.c +++ b/src/users-service-dbus.c @@ -931,9 +931,11 @@ users_service_dbus_can_activate_session (UsersServiceDbus *self) G_TYPE_BOOLEAN, &can_activate, G_TYPE_INVALID)) { - g_warning ("Failed to determine if seat can activate sessions: %s", error->message); - g_error_free (error); - + if (error != NULL){ + g_warning ("Failed to determine if seat can activate sessions: %s", + error->message); + g_error_free (error); + } return FALSE; } -- cgit v1.2.3 From 00618412f6db4570b9708f9e4ee61bb64ce37c1b Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 6 Sep 2011 10:57:44 +0100 Subject: another bug found within the apt-menuitem --- src/apt-watcher.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/apt-watcher.c b/src/apt-watcher.c index 480e174..167b847 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -380,11 +380,17 @@ static void apt_watcher_signal_cb ( GDBusProxy* proxy, gchar* current = NULL; g_debug ("ActiveTransactionsChanged"); - //gchar** queued = NULL; g_variant_get(value, "s", ¤t); + 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); + self->reboot_query = 0; + } + if (self->current_transaction != NULL) { g_object_unref (G_OBJECT(self->current_transaction)); -- cgit v1.2.3 From 12f76de565f5af5d9d946d4ebc43b195c34bbea2 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 6 Sep 2011 16:01:58 +0100 Subject: added new field to gsettings to allow to hide the user menu --- src/user-menu-mgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index a4308dd..98f6c8a 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -64,7 +64,7 @@ static void user_change (UsersServiceDbus *service, gpointer user_data); static void ensure_settings_client (); -static gboolean check_guest_session (void); +static gboolean is_this_guest_session (void); static void activate_guest_session (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data); @@ -148,7 +148,7 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) self->users_dbus_interface); } - if (check_guest_session ()) + if (is_this_guest_session ()) { guest_mi = dbusmenu_menuitem_new (); dbusmenu_menuitem_property_set (guest_mi, @@ -415,7 +415,7 @@ user_mgr_get_root_item (UserMenuMgr* self) /* Checks to see if we should show the guest suession item */ static gboolean -check_guest_session (void) +is_this_guest_session (void) { if (geteuid() < 500) { /* System users shouldn't have guest account shown. Mostly -- cgit v1.2.3 From cf5f3639b23ba4e2bd12fd4b987e67f7a3b3b1d4 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 6 Sep 2011 16:52:08 +0100 Subject: live cd user should now be turned off via new gsettings entry by casper --- src/settings-helper.c | 6 ++++++ src/settings-helper.h | 3 +++ src/user-menu-mgr.c | 20 ++++++++++---------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/settings-helper.c b/src/settings-helper.c index 5a69d17..d70df95 100644 --- a/src/settings-helper.c +++ b/src/settings-helper.c @@ -52,6 +52,12 @@ supress_confirmations (void) { return g_settings_get_boolean (settings, SUPPRESS_KEY) ; } +gboolean +should_show_user_menu (void) { + build_settings(); + return g_settings_get_boolean (settings, SHOW_USER_MENU) ; +} + gboolean show_logout (void) { build_settings(); diff --git a/src/settings-helper.h b/src/settings-helper.h index 7b377ca..f17f8ea 100644 --- a/src/settings-helper.h +++ b/src/settings-helper.h @@ -36,6 +36,7 @@ with this program. If not, see . #define LOGOUT_KEY "suppress-logout-menuitem" #define RESTART_KEY "suppress-restart-menuitem" #define SHUTDOWN_KEY "suppress-shutdown-menuitem" +#define SHOW_USER_MENU "show-user-menu" #define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown" #define LOCKDOWN_KEY_USER "disable-user-switching" @@ -56,5 +57,7 @@ gboolean supress_confirmations (void); gboolean show_logout (void); gboolean show_restart (void); gboolean show_shutdown (void); +gboolean should_show_user_menu (void); + #endif /* __GCONF_HELPER__ */ diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index 98f6c8a..16c6e3b 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -18,7 +18,6 @@ with this program. If not, see . */ #include - #include "user-menu-mgr.h" #include "settings-helper.h" #include "dbus-shared-names.h" @@ -54,22 +53,19 @@ static void activate_online_accounts (DbusmenuMenuitem *mi, gpointer user_data); static void activate_user_accounts (DbusmenuMenuitem *mi, guint timestamp, - gpointer user_data); - + gpointer user_data); static void user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode); static gboolean check_new_session (); static void user_change (UsersServiceDbus *service, const gchar *user_id, gpointer user_data); - static void ensure_settings_client (); static gboolean is_this_guest_session (void); static void activate_guest_session (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data); - G_DEFINE_TYPE (UserMenuMgr, user_menu_mgr, G_TYPE_OBJECT); @@ -177,14 +173,18 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) users = users_service_dbus_get_user_list (self->users_dbus_interface); self->user_count = g_list_length(users); - gboolean user_menu_is_visible = FALSE; + gboolean user_menu_is_visible = should_show_user_menu(); - if (!greeter_mode){ - user_menu_is_visible = TRUE; + if (user_menu_is_visible == FALSE || greeter_mode == TRUE){ + session_dbus_set_user_menu_visibility (self->session_dbus_interface, + FALSE); + } + else{ + // This needs to be updated once the ability to query guest session support is available + session_dbus_set_user_menu_visibility (self->session_dbus_interface, + user_menu_is_visible); } - session_dbus_set_user_menu_visibility (self->session_dbus_interface, - user_menu_is_visible); if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) { users = g_list_sort (users, (GCompareFunc)compare_users_by_username); -- cgit v1.2.3 From b23c52315a5a5ccb875926a6c567baa9074e8338 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 6 Sep 2011 17:36:25 +0100 Subject: change the actual key on the entry --- src/settings-helper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings-helper.h b/src/settings-helper.h index f17f8ea..ae57575 100644 --- a/src/settings-helper.h +++ b/src/settings-helper.h @@ -36,7 +36,7 @@ with this program. If not, see . #define LOGOUT_KEY "suppress-logout-menuitem" #define RESTART_KEY "suppress-restart-menuitem" #define SHUTDOWN_KEY "suppress-shutdown-menuitem" -#define SHOW_USER_MENU "show-user-menu" +#define SHOW_USER_MENU "user-show-menu" #define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown" #define LOCKDOWN_KEY_USER "disable-user-switching" -- 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(-) 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 f05ddfcd0b93b64e01efcae411b9313e22ab37f0 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 6 Sep 2011 18:07:05 +0100 Subject: updated the schema entry with the correct key --- data/com.canonical.indicator.session.gschema.xml.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/com.canonical.indicator.session.gschema.xml.in b/data/com.canonical.indicator.session.gschema.xml.in index d1d7d4c..5383221 100644 --- a/data/com.canonical.indicator.session.gschema.xml.in +++ b/data/com.canonical.indicator.session.gschema.xml.in @@ -20,5 +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 Menu + Allow for the user menu to be hidden by the user. + + -- cgit v1.2.3 From c6857c3028b36d35f69079e3c0e5510597997f75 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 6 Sep 2011 18:07:55 +0100 Subject: updated the schema entry with the correct key --- data/com.canonical.indicator.session.gschema.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/com.canonical.indicator.session.gschema.xml.in b/data/com.canonical.indicator.session.gschema.xml.in index 5383221..e0d14c3 100644 --- a/data/com.canonical.indicator.session.gschema.xml.in +++ b/data/com.canonical.indicator.session.gschema.xml.in @@ -20,7 +20,7 @@ <_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 Menu Allow for the user menu to be hidden by the user. -- cgit v1.2.3 From 433512c195ed7faac8d834bd648f32aaff380827 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Tue, 6 Sep 2011 18:24:09 +0100 Subject: bump version for release --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 951e8a3..a89c30d 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-session.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-session, 0.3.4.2) +AM_INIT_AUTOMAKE(indicator-session, 0.3.4.3) AM_MAINTAINER_MODE -- cgit v1.2.3 From f0fea9a9edb4529aca7a81de11259122e5e6d72e Mon Sep 17 00:00:00 2001 From: Sebastien Bacher Date: Tue, 6 Sep 2011 22:09:44 +0200 Subject: releasing version 0.3.4.3-0ubuntu1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8637dfd..8152d4d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,11 @@ -indicator-session (0.3.4.3-0ubuntu1) UNRELEASED; urgency=low +indicator-session (0.3.4.3-0ubuntu1) oneiric; urgency=low * New upstream release. - new gsettings key "com.canonical.indicator.session user-show-menu" - "[UIFe]Greeter power menu has cog icon but no settings" (lp: #838546) - -- Sebastien Bacher Tue, 06 Sep 2011 22:09:20 +0200 + -- Sebastien Bacher Tue, 06 Sep 2011 22:09:41 +0200 indicator-session (0.3.4.2-0ubuntu1) oneiric; urgency=low -- cgit v1.2.3 From d0d4fd57cf3a25547c570139cc6a311ce05eed44 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 7 Sep 2011 12:04:16 +0100 Subject: more revelations with regards the behaviour of the apt dbus 'api' --- src/apt-transaction.c | 33 ++++++++++++++++----------------- src/apt-watcher.c | 28 ++++++++++++++-------------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/apt-transaction.c b/src/apt-transaction.c index cd9e131..317d74a 100644 --- a/src/apt-transaction.c +++ b/src/apt-transaction.c @@ -160,7 +160,7 @@ apt_transaction_receive_signal (GDBusProxy * proxy, AptTransaction* self = APT_TRANSACTION(user_data); AptState current_state = DONT_KNOW; - if (g_strcmp0(signal_name, "PropertyChanged") == 0 && self->type == SIMULATION) + if (g_strcmp0(signal_name, "PropertyChanged") == 0) { gchar* prop_name= NULL; GVariant* value = NULL; @@ -204,23 +204,22 @@ apt_transaction_receive_signal (GDBusProxy * proxy, current_state = UP_TO_DATE; } } - } - else if (g_strcmp0(signal_name, "PropertyChanged") == 0 && - self->type == REAL) - { - GVariant* role = g_dbus_proxy_get_cached_property (self->proxy, - "Role"); - if (g_variant_is_of_type (role, G_VARIANT_TYPE_STRING) == TRUE){ - gchar* current_role = NULL; - g_variant_get (role, "s", ¤t_role); - //g_debug ("Current transaction role = %s", current_role); - if (g_strcmp0 (current_role, "role-commit-packages") == 0 || - g_strcmp0 (current_role, "role-upgrade-system") == 0){ - g_debug ("UPGRADE IN PROGRESS"); - current_state = UPGRADE_IN_PROGRESS; + if (self->type == REAL) + { + GVariant* role = g_dbus_proxy_get_cached_property (self->proxy, + "Role"); + if (g_variant_is_of_type (role, G_VARIANT_TYPE_STRING) == TRUE){ + gchar* current_role = NULL; + g_variant_get (role, "s", ¤t_role); + //g_debug ("Current transaction role = %s", current_role); + if (g_strcmp0 (current_role, "role-commit-packages") == 0 || + g_strcmp0 (current_role, "role-upgrade-system") == 0){ + g_debug ("UPGRADE IN PROGRESS"); + current_state = UPGRADE_IN_PROGRESS; + } } - } - } + } + } else if (g_strcmp0(signal_name, "Finished") == 0) { g_debug ("TRANSACTION Finished"); diff --git a/src/apt-watcher.c b/src/apt-watcher.c index b0d9688..1f88868 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -269,7 +269,7 @@ apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, g_source_remove (self->reboot_query); self->reboot_query = 0; } - self->reboot_query = g_timeout_add_seconds (1, + self->reboot_query = g_timeout_add_seconds (2, apt_watcher_query_reboot_status, self); } @@ -277,27 +277,27 @@ apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Updates Available…")); - 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){ - - if (self->reboot_query != 0){ - g_source_remove (self->reboot_query); - self->reboot_query = 0; + // Only query if the previous state was an upgrade. + if (self->current_state == UPGRADE_IN_PROGRESS){ + 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 (2, + apt_watcher_query_reboot_status, + self); } - // 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); } - + // Set the current state self->current_state = state; if (self->current_state != UPGRADE_IN_PROGRESS){ @@ -326,7 +326,7 @@ apt_watcher_transaction_state_simulation_update_cb (AptTransaction* trans, g_source_remove (self->reboot_query); self->reboot_query = 0; } - self->reboot_query = g_timeout_add_seconds (1, + self->reboot_query = g_timeout_add_seconds (2, apt_watcher_query_reboot_status, self); } -- cgit v1.2.3 From bc14f0aeb2dbd61c077f1f61c41303f0db4b9781 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 7 Sep 2011 15:34:50 +0100 Subject: more hoop jumping for apt --- src/apt-watcher.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/apt-watcher.c b/src/apt-watcher.c index 1f88868..d2cd1b5 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -272,18 +272,23 @@ apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, self->reboot_query = g_timeout_add_seconds (2, apt_watcher_query_reboot_status, self); + self->current_state = state; } else if (state == UPDATES_AVAILABLE){ dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, _("Updates Available…")); + 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){ + gboolean query_again = FALSE; + // Only query if the previous state was an upgrade. if (self->current_state == UPGRADE_IN_PROGRESS){ if (self->reboot_query != 0){ @@ -296,14 +301,30 @@ apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, apt_watcher_query_reboot_status, self); } - } - // Set the current state - self->current_state = state; - - if (self->current_state != UPGRADE_IN_PROGRESS){ + else{ + query_again = TRUE; + } + self->current_state = state; + g_object_unref (G_OBJECT(self->current_transaction)); self->current_transaction = NULL; - } + // Mental ah yes, because a real transaction (like one which is manually triggered by the user + // by hitting check on update-mgr) does not return a 'dependency' prop update which means + // I cannot figure out from that transaction if an update is available. + // Only when it finishes and I'm confident it was not an transaction concerned with actually updating should i then fire off another transaction, + // this time being a simulation which 'should' figure out if an update is available. + // The Reality is all APT transactions behave differently, an obsolutely nightmare of an API to use. + if (query_again){ + g_dbus_proxy_call (self->proxy, + "UpgradeSystem", + g_variant_new("(b)", TRUE), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + apt_watcher_upgrade_system_cb, + self); + } + } } -- cgit v1.2.3 From 058f9cbcbfbe0ed93ce14ad31c5a7ccd14b6d61c Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 7 Sep 2011 16:03:22 +0100 Subject: more hoop jumping for apt --- src/apt-watcher.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/apt-watcher.c b/src/apt-watcher.c index d2cd1b5..bbb541a 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -261,17 +261,11 @@ apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, 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 (2, - apt_watcher_query_reboot_status, - self); self->current_state = state; } else if (state == UPDATES_AVAILABLE){ -- cgit v1.2.3 From 0bef37124f305aef894fa19f01911bc3553df3c5 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 7 Sep 2011 21:02:44 +0100 Subject: display manager HasGuestAccount now supported --- src/user-menu-mgr.c | 41 +++++++++++++++++++++----------------- src/users-service-dbus.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++-- src/users-service-dbus.h | 2 ++ 3 files changed, 74 insertions(+), 20 deletions(-) diff --git a/src/user-menu-mgr.c b/src/user-menu-mgr.c index 16c6e3b..efb3f7d 100644 --- a/src/user-menu-mgr.c +++ b/src/user-menu-mgr.c @@ -65,6 +65,7 @@ static gboolean is_this_guest_session (void); static void activate_guest_session (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data); + G_DEFINE_TYPE (UserMenuMgr, user_menu_mgr, G_TYPE_OBJECT); @@ -129,6 +130,25 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) if (can_activate == TRUE) { + gboolean guest_enabled = users_service_dbus_guest_session_enabled (self->users_dbus_interface); + GList * users = NULL; + users = users_service_dbus_get_user_list (self->users_dbus_interface); + self->user_count = g_list_length(users); + + gboolean gsettings_user_menu_is_visible = should_show_user_menu(); + + if (gsettings_user_menu_is_visible == FALSE || greeter_mode == TRUE){ + session_dbus_set_user_menu_visibility (self->session_dbus_interface, + FALSE); + } + else{ + // This needs to be updated once the ability to query guest session support is available + session_dbus_set_user_menu_visibility (self->session_dbus_interface, + guest_enabled || self->user_count > 1); + } + + // TODO we should really return here if the menu is not going to be shown. + if (check_new_session ()){ switch_menuitem = dbusmenu_menuitem_new (); dbusmenu_menuitem_property_set (switch_menuitem, @@ -144,7 +164,7 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) self->users_dbus_interface); } - if (is_this_guest_session ()) + if ( !is_this_guest_session () && guest_enabled) { guest_mi = dbusmenu_menuitem_new (); dbusmenu_menuitem_property_set (guest_mi, @@ -169,21 +189,6 @@ user_menu_mgr_rebuild_items (UserMenuMgr *self, gboolean greeter_mode) _("Guest")); } - GList * users = NULL; - users = users_service_dbus_get_user_list (self->users_dbus_interface); - self->user_count = g_list_length(users); - - gboolean user_menu_is_visible = should_show_user_menu(); - - if (user_menu_is_visible == FALSE || greeter_mode == TRUE){ - session_dbus_set_user_menu_visibility (self->session_dbus_interface, - FALSE); - } - else{ - // This needs to be updated once the ability to query guest session support is available - session_dbus_set_user_menu_visibility (self->session_dbus_interface, - user_menu_is_visible); - } if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) { @@ -420,10 +425,10 @@ is_this_guest_session (void) if (geteuid() < 500) { /* System users shouldn't have guest account shown. Mostly this would be the case of the guest user itself. */ - return FALSE; + return TRUE; } - return TRUE; + return FALSE; } /* Called when someone clicks on the guest session item. */ diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c index 4b41f4b..7054a22 100644 --- a/src/users-service-dbus.c +++ b/src/users-service-dbus.c @@ -86,6 +86,7 @@ struct _UsersServiceDbusPrivate DBusGProxy *accounts_service_proxy; DBusGProxy *display_manager_proxy; + DBusGProxy *display_manager_props_proxy; DBusGProxy *ck_proxy; DBusGProxy *seat_proxy; DBusGProxy *session_proxy; @@ -95,6 +96,7 @@ struct _UsersServiceDbusPrivate DbusmenuMenuitem * guest_item; gchar * guest_session_id; + gboolean guest_session_enabled; }; #define USERS_SERVICE_DBUS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), USERS_SERVICE_DBUS_TYPE, UsersServiceDbusPrivate)) @@ -148,6 +150,8 @@ users_service_dbus_init (UsersServiceDbus *self) priv->count = 0; priv->guest_item = NULL; priv->guest_session_id = NULL; + + priv->guest_session_enabled = FALSE; /* Get the system bus */ priv->system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); @@ -194,6 +198,7 @@ users_service_dbus_finalize (GObject *object) G_OBJECT_CLASS (users_service_dbus_parent_class)->finalize (object); } + static void create_display_manager_proxy (UsersServiceDbus *self) { @@ -202,7 +207,7 @@ create_display_manager_proxy (UsersServiceDbus *self) GError *error = NULL; const gchar *cookie = NULL; gchar *seat = NULL; - + cookie = g_getenv ("XDG_SESSION_COOKIE"); if (cookie == NULL || cookie[0] == 0) { @@ -232,11 +237,18 @@ create_display_manager_proxy (UsersServiceDbus *self) return; } g_object_unref (dm_proxy); - + g_debug ("CREATING DM PROXIES WITH %s", seat); priv->display_manager_proxy = dbus_g_proxy_new_for_name (priv->system_bus, "org.freedesktop.DisplayManager", seat, "org.freedesktop.DisplayManager.Seat"); + + priv->display_manager_props_proxy = dbus_g_proxy_new_for_name (priv->system_bus, + "org.freedesktop.DisplayManager", + seat, + "org.freedesktop.DBus.Properties"); + + g_free (seat); if (!priv->display_manager_proxy) @@ -244,6 +256,32 @@ create_display_manager_proxy (UsersServiceDbus *self) g_warning ("Failed to get DisplayManager seat proxy."); return; } + if (!priv->display_manager_props_proxy) + { + g_warning ("Failed to get DisplayManager Properties seat proxy."); + return; + } + + GValue has_guest_session = {0}; + g_value_init (&has_guest_session, G_TYPE_BOOLEAN); + if (!dbus_g_proxy_call (priv->display_manager_props_proxy, + "Get", + &error, + G_TYPE_STRING, + "org.freedesktop.DisplayManager.Seat", + G_TYPE_STRING, + "HasGuestAccount", + G_TYPE_INVALID, + G_TYPE_VALUE, + &has_guest_session, + G_TYPE_INVALID)) + { + g_warning ("Failed to get the HasGuestSession property from the DisplayManager Properties seat proxy. error: %s", error->message); + g_error_free (error); + return; + } + g_debug ("HAS GUEST ACCOUNT = %i", g_value_get_boolean (&has_guest_session)); + priv->guest_session_enabled = g_value_get_boolean (&has_guest_session); } static void @@ -954,3 +992,12 @@ users_service_dbus_set_guest_item (UsersServiceDbus * self, DbusmenuMenuitem * m return; } + +gboolean users_service_dbus_guest_session_enabled (UsersServiceDbus * self) +{ + g_return_val_if_fail(IS_USERS_SERVICE_DBUS(self), FALSE); + UsersServiceDbusPrivate *priv = USERS_SERVICE_DBUS_GET_PRIVATE (self); + + return priv->guest_session_enabled; +} + diff --git a/src/users-service-dbus.h b/src/users-service-dbus.h index 4dbf2a4..25942df 100644 --- a/src/users-service-dbus.h +++ b/src/users-service-dbus.h @@ -85,6 +85,8 @@ gboolean users_service_dbus_activate_guest_session (UsersServiceDbus *self); void users_service_dbus_set_guest_item (UsersServiceDbus * self, DbusmenuMenuitem * mi); +gboolean users_service_dbus_guest_session_enabled (UsersServiceDbus * self); + G_END_DECLS #endif -- cgit v1.2.3 From 9c24a238b2338b3a4af7629e8e4d4a6493499ac2 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 7 Sep 2011 21:05:44 +0100 Subject: tidy up --- src/users-service-dbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/users-service-dbus.c b/src/users-service-dbus.c index 7054a22..dfb330d 100644 --- a/src/users-service-dbus.c +++ b/src/users-service-dbus.c @@ -280,7 +280,7 @@ create_display_manager_proxy (UsersServiceDbus *self) g_error_free (error); return; } - g_debug ("HAS GUEST ACCOUNT = %i", g_value_get_boolean (&has_guest_session)); + g_debug ("Does seat have a guest account = %i", g_value_get_boolean (&has_guest_session)); priv->guest_session_enabled = g_value_get_boolean (&has_guest_session); } -- cgit v1.2.3 From b85f29bbd848238a4b60fe2eccf3ead06c47b979 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 7 Sep 2011 21:20:42 +0100 Subject: tidy up --- src/apt-watcher.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/apt-watcher.c b/src/apt-watcher.c index bbb541a..e5e1d0e 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -302,12 +302,9 @@ apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, g_object_unref (G_OBJECT(self->current_transaction)); self->current_transaction = NULL; - // Mental ah yes, because a real transaction (like one which is manually triggered by the user - // by hitting check on update-mgr) does not return a 'dependency' prop update which means - // I cannot figure out from that transaction if an update is available. - // Only when it finishes and I'm confident it was not an transaction concerned with actually updating should i then fire off another transaction, - // this time being a simulation which 'should' figure out if an update is available. - // The Reality is all APT transactions behave differently, an obsolutely nightmare of an API to use. + + // It is impossible to determine from a 'real' transaction whether + // updates are available ? if (query_again){ g_dbus_proxy_call (self->proxy, "UpgradeSystem", -- cgit v1.2.3 From 693bdc8faee826e4cde13dfb0b1aff8dd294a6dc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 7 Sep 2011 22:09:01 -0500 Subject: Lots of debug messages for the logout helper --- src/gtk-logout-helper.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/gtk-logout-helper.c b/src/gtk-logout-helper.c index 33dce3a..9c1e6dd 100644 --- a/src/gtk-logout-helper.c +++ b/src/gtk-logout-helper.c @@ -31,6 +31,8 @@ with this program. If not, see . static void consolekit_fallback (LogoutDialogType action) { + g_debug("Falling back to using ConsoleKit for action"); + DBusGConnection * sbus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); g_return_if_fail(sbus != NULL); /* worst case */ DBusGProxy * proxy = dbus_g_proxy_new_for_name(sbus, "org.freedesktop.ConsoleKit", @@ -49,12 +51,14 @@ consolekit_fallback (LogoutDialogType action) g_warning("Unable to fallback to ConsoleKit for logout as it's a session issue. We need some sort of session handler."); break; case LOGOUT_DIALOG_TYPE_SHUTDOWN: + g_debug("Telling ConsoleKit to 'Stop'"); dbus_g_proxy_call(proxy, "Stop", &error, G_TYPE_INVALID); break; case LOGOUT_DIALOG_TYPE_RESTART: + g_debug("Telling ConsoleKit to 'Restart'"); dbus_g_proxy_call(proxy, "Restart", &error, @@ -104,12 +108,15 @@ session_action (LogoutDialogType action) g_clear_error (&error); if (action == LOGOUT_DIALOG_TYPE_LOG_OUT) { + g_debug("Asking Session manager to 'Logout'"); res = dbus_g_proxy_call_with_timeout (sm_proxy, "Logout", INT_MAX, &error, G_TYPE_UINT, 1, G_TYPE_INVALID, G_TYPE_INVALID); } else if (action == LOGOUT_DIALOG_TYPE_SHUTDOWN) { + g_debug("Asking Session manager to 'RequestShutdown'"); res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestShutdown", INT_MAX, &error, G_TYPE_INVALID, G_TYPE_INVALID); } else if (action == LOGOUT_DIALOG_TYPE_RESTART) { + g_debug("Asking Session manager to 'RequestReboot'"); res = dbus_g_proxy_call_with_timeout (sm_proxy, "RequestReboot", INT_MAX, &error, G_TYPE_INVALID, G_TYPE_INVALID); } else { @@ -122,6 +129,8 @@ session_action (LogoutDialogType action) } else { g_warning ("SessionManager action failed: unknown error"); } + + consolekit_fallback(action); } g_object_unref(sm_proxy); @@ -139,6 +148,7 @@ static gboolean option_logout (const gchar * arg, const gchar * value, gpointer data, GError * error) { type = LOGOUT_DIALOG_TYPE_LOG_OUT; + g_debug("Dialog type: logout"); return TRUE; } @@ -146,6 +156,7 @@ static gboolean option_shutdown (const gchar * arg, const gchar * value, gpointer data, GError * error) { type = LOGOUT_DIALOG_TYPE_SHUTDOWN; + g_debug("Dialog type: shutdown"); return TRUE; } @@ -153,6 +164,7 @@ static gboolean option_restart (const gchar * arg, const gchar * value, gpointer data, GError * error) { type = LOGOUT_DIALOG_TYPE_RESTART; + g_debug("Dialog type: restart"); return TRUE; } @@ -193,6 +205,7 @@ main (int argc, char * argv[]) GtkWidget * dialog = NULL; if (!supress_confirmations()) { + g_debug("Showing dialog to ask for user confirmation"); dialog = GTK_WIDGET(logout_dialog_new(type)); } @@ -200,17 +213,27 @@ main (int argc, char * argv[]) GtkResponseType response = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_hide(dialog); + if (response == GTK_RESPONSE_OK) { + g_debug("Dialog return response: 'okay'"); + } else if (response == GTK_RESPONSE_HELP) { + g_debug("Dialog return response: 'help'"); + } else { + g_debug("Dialog return response: %d", response); + } + if (response == GTK_RESPONSE_HELP) { type = LOGOUT_DIALOG_TYPE_RESTART; response = GTK_RESPONSE_OK; } if (response != GTK_RESPONSE_OK) { + g_debug("Final response was not okay, quiting"); return 0; } } session_action(type); + g_debug("Finished action, quiting"); return 0; } -- 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(-) 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(+) 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 From e8cce2f8aabbc16829e52ede85ef4531f8e3abc5 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Thu, 8 Sep 2011 19:14:10 +0100 Subject: bump for release --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a89c30d..6efac90 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-session.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-session, 0.3.4.3) +AM_INIT_AUTOMAKE(indicator-session, 0.3.5.0) AM_MAINTAINER_MODE -- cgit v1.2.3 From f1bd59d1d8542f19f0f36751891d0df7df1d080f Mon Sep 17 00:00:00 2001 From: Sebastien Bacher Date: Fri, 9 Sep 2011 11:18:44 +0200 Subject: releasing version 0.3.5.0-0ubuntu1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index f777c5f..c427fb2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -indicator-session (0.3.5.0-0ubuntu1) UNRELEASED; urgency=low +indicator-session (0.3.5.0-0ubuntu1) oneiric; urgency=low * New upstream release: - fix the updates menu items randomly working (lp: #842946) @@ -8,7 +8,7 @@ indicator-session (0.3.5.0-0ubuntu1) UNRELEASED; urgency=low - don't display temporary guest user generated username (lp: #844272) - respect "show-real-name-on-panel" to hide the username (lp: #812728) - -- Sebastien Bacher Thu, 08 Sep 2011 21:40:04 +0200 + -- Sebastien Bacher Fri, 09 Sep 2011 11:18:26 +0200 indicator-session (0.3.4.3-0ubuntu1) oneiric; urgency=low -- cgit v1.2.3 From 1fc5955836adcb08e047a368b6cdb22f92a92698 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 14 Sep 2011 17:17:55 +0100 Subject: apt property changed reboot required listened for and now the whole apt interaction does not happen until after 60 secs --- src/apt-watcher.c | 196 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 110 insertions(+), 86 deletions(-) diff --git a/src/apt-watcher.c b/src/apt-watcher.c index e5e1d0e..2c5ed0b 100644 --- a/src/apt-watcher.c +++ b/src/apt-watcher.c @@ -71,10 +71,8 @@ static void apt_watcher_transaction_state_simulation_update_cb (AptTransaction* gpointer user_data); static void apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, gint update, - gpointer user_data); - - - + gpointer user_data); +static gboolean apt_watcher_start_apt_interaction (gpointer data); G_DEFINE_TYPE (AptWatcher, apt_watcher, G_TYPE_OBJECT); @@ -85,7 +83,17 @@ apt_watcher_init (AptWatcher *self) self->proxy_cancel = g_cancellable_new(); self->proxy = NULL; self->reboot_query = 0; - self->current_transaction = NULL; + self->current_transaction = NULL; + g_timeout_add_seconds (60, + apt_watcher_start_apt_interaction, + self); +} + +static gboolean +apt_watcher_start_apt_interaction (gpointer data) +{ + g_return_val_if_fail (APT_IS_WATCHER (data), FALSE); + AptWatcher* self = APT_WATCHER (data); g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, NULL, @@ -95,6 +103,7 @@ apt_watcher_init (AptWatcher *self) self->proxy_cancel, fetch_proxy_cb, self); + return FALSE; } static void @@ -154,7 +163,6 @@ fetch_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) self); } - static void apt_watcher_on_name_appeared (GDBusConnection *connection, const gchar *name, @@ -169,6 +177,8 @@ apt_watcher_on_name_appeared (GDBusConnection *connection, "the system bus", name_owner); + apt_watcher_query_reboot_status (user_data); + g_dbus_proxy_call (watcher->proxy, "UpgradeSystem", g_variant_new("(b)", TRUE), @@ -176,9 +186,10 @@ apt_watcher_on_name_appeared (GDBusConnection *connection, -1, NULL, apt_watcher_upgrade_system_cb, - user_data); + user_data); } + static void apt_watcher_on_name_vanished (GDBusConnection *connection, const gchar *name, @@ -261,60 +272,52 @@ apt_watcher_transaction_state_real_update_cb (AptTransaction* trans, 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")); - self->current_state = state; - } - else if (state == UPDATES_AVAILABLE){ - dbusmenu_menuitem_property_set (self->apt_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Updates Available…")); - 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){ - gboolean query_again = FALSE; - - // Only query if the previous state was an upgrade. - if (self->current_state == UPGRADE_IN_PROGRESS){ - 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 (2, - apt_watcher_query_reboot_status, - self); + if (self->current_state != RESTART_NEEDED) + { + if (state == UP_TO_DATE){ + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_LABEL, + _("Software Up to Date")); + self->current_state = state; + } + else if (state == UPDATES_AVAILABLE){ + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_LABEL, + _("Updates Available…")); + 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){ + gboolean query_again = FALSE; + + // Only query if the previous state was an upgrade. + if (self->current_state != UPGRADE_IN_PROGRESS){ + query_again = TRUE; + } + self->current_state = state; + + g_object_unref (G_OBJECT(self->current_transaction)); + self->current_transaction = NULL; + + // It is impossible to determine from a 'real' transaction whether + // updates are available therefore it is necessary to check again via a + // simulation whether there are updates available. + if (query_again){ + g_dbus_proxy_call (self->proxy, + "UpgradeSystem", + g_variant_new("(b)", TRUE), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + apt_watcher_upgrade_system_cb, + self); + } } - else{ - query_again = TRUE; - } - self->current_state = state; - - g_object_unref (G_OBJECT(self->current_transaction)); - self->current_transaction = NULL; - - // It is impossible to determine from a 'real' transaction whether - // updates are available ? - if (query_again){ - g_dbus_proxy_call (self->proxy, - "UpgradeSystem", - g_variant_new("(b)", TRUE), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - apt_watcher_upgrade_system_cb, - self); - } } } @@ -329,32 +332,32 @@ apt_watcher_transaction_state_simulation_update_cb (AptTransaction* trans, 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; + if (self->current_state != RESTART_NEEDED) + { + 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); } - self->reboot_query = g_timeout_add_seconds (2, - apt_watcher_query_reboot_status, - self); - } - else if (state == UPDATES_AVAILABLE){ - dbusmenu_menuitem_property_set (self->apt_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Updates Available…")); - } - else if (state == UPGRADE_IN_PROGRESS){ - dbusmenu_menuitem_property_set (self->apt_item, - DBUSMENU_MENUITEM_PROP_LABEL, - _("Updates Installing…")); + else if (state == UPDATES_AVAILABLE){ + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_LABEL, + _("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; } - - self->current_state = state; - if (self->current_state != UPGRADE_IN_PROGRESS){ g_object_unref (G_OBJECT(self->current_transaction)); self->current_transaction = NULL; @@ -383,7 +386,6 @@ apt_watcher_query_reboot_status (gpointer data) gboolean reboot; g_variant_get (reboot_result, "b", &reboot); g_debug ("apt_watcher_query_reboot_status: reboot prop = %i", reboot); - if (reboot == FALSE){ dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, @@ -396,7 +398,7 @@ apt_watcher_query_reboot_status (gpointer data) else{ dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_LABEL, - _("Reboot Required")); + _("Restart to complete updates…")); dbusmenu_menuitem_property_set (self->apt_item, DBUSMENU_MENUITEM_PROP_DISPOSITION, DBUSMENU_MENUITEM_DISPOSITION_ALERT); @@ -446,6 +448,28 @@ static void apt_watcher_signal_cb ( GDBusProxy* proxy, G_CALLBACK(apt_watcher_transaction_state_real_update_cb), self); } } + else if (g_strcmp0(signal_name, "PropertyChanged") == 0) + { + gchar* prop_name= NULL; + GVariant* value = NULL; + g_variant_get (parameters, "(sv)", &prop_name, &value); + g_debug ("transaction prop update - prop = %s", prop_name); + + if (g_strcmp0 (prop_name, "RebootRequired") == 0){ + gboolean reboot_required = FALSE; + g_variant_get (value, "(b)", &reboot_required); + if (reboot_required){ + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_LABEL, + _("Restart to complete updates…")); + dbusmenu_menuitem_property_set (self->apt_item, + DBUSMENU_MENUITEM_PROP_DISPOSITION, + DBUSMENU_MENUITEM_DISPOSITION_ALERT); + self->current_state = RESTART_NEEDED; + } + } + } + g_variant_unref (parameters); } -- cgit v1.2.3 From 1ea8cf99f98399c0404b610e7364b267637640b4 Mon Sep 17 00:00:00 2001 From: Conor Curran Date: Wed, 14 Sep 2011 17:50:23 +0100 Subject: fixes for apt handling --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 6efac90..557a8d2 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT(src/indicator-session.c) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-session, 0.3.5.0) +AM_INIT_AUTOMAKE(indicator-session, 0.3.5.1) AM_MAINTAINER_MODE -- cgit v1.2.3 From bdd5983aba1736350f603c8e1b7ba5ec97a7ef84 Mon Sep 17 00:00:00 2001 From: Didier Roche Date: Thu, 15 Sep 2011 10:33:53 +0200 Subject: =?UTF-8?q?=20=20-=20don't=20start=20apt=20on=20logging=20=20=20-?= =?UTF-8?q?=20[UIFe]=20should=20say=20"Restart=20to=20Complete=20Updates?= =?UTF-8?q?=E2=80=A6"=20(LP:=20#850013)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- debian/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index fe3ca80..19c4535 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ indicator-session (0.3.5.1-0ubuntu1) UNRELEASED; urgency=low * New upstream release. + - don't start apt on logging + - [UIFe] should say "Restart to Complete Updates…" (LP: #850013) -- Didier Roche Thu, 15 Sep 2011 09:25:11 +0200 -- cgit v1.2.3 From 18f3158453229388605760aa8e738a9adb65109b Mon Sep 17 00:00:00 2001 From: Didier Roche Date: Thu, 15 Sep 2011 10:33:57 +0200 Subject: releasing version 0.3.5.1-0ubuntu1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 19c4535..c87796c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -indicator-session (0.3.5.1-0ubuntu1) UNRELEASED; urgency=low +indicator-session (0.3.5.1-0ubuntu1) oneiric; urgency=low * New upstream release. - don't start apt on logging - [UIFe] should say "Restart to Complete Updates…" (LP: #850013) - -- Didier Roche Thu, 15 Sep 2011 09:25:11 +0200 + -- Didier Roche Thu, 15 Sep 2011 10:33:56 +0200 indicator-session (0.3.5.0-0ubuntu1) oneiric; urgency=low -- cgit v1.2.3