From 7198caabc88b0027dcefa4dd3edfabb2fffbfed2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 4 Oct 2009 16:52:41 -0500 Subject: Switching from positioning items to having a major resort function to reposition everything. This should be a little overkill, but should work nicely with the new async startup. --- src/indicator-session.c | 52 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/src/indicator-session.c b/src/indicator-session.c index a4bb5e1..c367e3a 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -84,10 +84,52 @@ get_icon (void) typedef struct _realized_data_t realized_data_t; struct _realized_data_t { - guint position; section_t section; }; +static void +resort_menu (void) +{ + guint location = 0; + guint clientnum; + + for (clientnum = 0; clientnum < 3; clientnum++) { + DbusmenuGtkClient * client = NULL; + if (clientnum == 0) client = status_client; + if (clientnum == 1) client = users_client; + if (clientnum == 2) client = session_client; + + if (client == NULL) continue; + + DbusmenuMenuitem * root = dbusmenu_client_get_root(DBUSMENU_CLIENT(client)); + + GList * children = dbusmenu_menuitem_get_children(root); + if (children == NULL) { + continue; + } + + GList * child; + for (child = children; child != NULL; child = g_list_next(child)) { + GtkMenuItem * widget = dbusmenu_gtkclient_menuitem_get(client, DBUSMENU_MENUITEM(child->data)); + if (widget != NULL) { + gtk_menu_reorder_child(main_menu, GTK_WIDGET(widget), location); + location++; + } + } + + if (clientnum == 0) { + gtk_menu_reorder_child(main_menu, status_separator, location); + location++; + } + if (clientnum == 1) { + gtk_menu_reorder_child(main_menu, users_separator, location); + location++; + } + } + + return; +} + static void child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position, gpointer section) { @@ -97,7 +139,6 @@ child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint position return; } - data->position = position; data->section = GPOINTER_TO_UINT(section); g_signal_connect(G_OBJECT(child), DBUSMENU_MENUITEM_SIGNAL_REALIZED, G_CALLBACK(child_realized), data); @@ -111,7 +152,6 @@ child_realized (DbusmenuMenuitem * child, gpointer userdata) g_return_if_fail(DBUSMENU_IS_MENUITEM(child)); realized_data_t * data = (realized_data_t *)userdata; - guint position = data->position; section_t section = data->section; g_free(data); @@ -145,8 +185,6 @@ child_realized (DbusmenuMenuitem * child, gpointer userdata) return; } - position += posfunc(); - g_debug("SUS: Adding child: %d", position); GtkMenuItem * widget = dbusmenu_gtkclient_menuitem_get(client, child); if (widget == NULL) { @@ -154,9 +192,11 @@ child_realized (DbusmenuMenuitem * child, gpointer userdata) return; } - gtk_menu_insert(main_menu, GTK_WIDGET(widget), position); + gtk_menu_append(main_menu, GTK_WIDGET(widget)); gtk_widget_show(GTK_WIDGET(widget)); + resort_menu(); + gtk_widget_hide(loading_item); return; -- cgit v1.2.3 From 672d8f6b34c4bb32fef935310915d096a0941a13 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 4 Oct 2009 16:55:41 -0500 Subject: releasing version 0.1.6-0ubuntu1~ppa2~async1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8a2ab2b..ee91d78 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -indicator-session (0.1.6-0ubuntu1~ppa2~async1) UNRELEASED; urgency=low +indicator-session (0.1.6-0ubuntu1~ppa2~async1) karmic; urgency=low * Resorting the menu all the time. - -- Ted Gould Sun, 04 Oct 2009 16:53:44 -0500 + -- Ted Gould Sun, 04 Oct 2009 16:55:24 -0500 indicator-session (0.1.6-0ubuntu1~ppa1) karmic; urgency=low -- cgit v1.2.3 From f654c69200540c8e27151061c01ccd6fd45076a1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 5 Oct 2009 16:38:14 -0400 Subject: Switching the string from 'New Session' to 'Switch User' --- src/users-service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/users-service.c b/src/users-service.c index 9877ba6..5a189c8 100644 --- a/src/users-service.c +++ b/src/users-service.c @@ -342,7 +342,7 @@ rebuild_items (DbusmenuMenuitem *root, if (check_new_session ()) { mi = dbusmenu_menuitem_new (); - dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, _("New Session...")); + dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Switch User...")); dbusmenu_menuitem_child_append (root, mi); g_signal_connect (G_OBJECT (mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK (activate_new_session), NULL); } -- cgit v1.2.3 From faad9824212471656f2e4e0df76bb40fb1c790ce Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 5 Oct 2009 17:11:25 -0400 Subject: Also setting the icon on property changed. --- src/gtk-dialog/logout-dialog.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gtk-dialog/logout-dialog.c b/src/gtk-dialog/logout-dialog.c index c53590e..65df9fe 100644 --- a/src/gtk-dialog/logout-dialog.c +++ b/src/gtk-dialog/logout-dialog.c @@ -163,6 +163,7 @@ set_property (GObject * object, guint param_id, const GValue * value, GParamSpec gtk_image_set_from_icon_name(GTK_IMAGE(dialog->image), icon_strings[dialog->action], GTK_ICON_SIZE_DIALOG); gtk_window_set_title (GTK_WINDOW(dialog), _(title_strings[dialog->action])); + gtk_window_set_icon_name (GTK_WINDOW(dialog), icon_strings[dialog->action]); gtk_widget_hide(dialog->message); gtk_button_set_label(GTK_BUTTON(dialog->ok_button), _(button_strings[dialog->action])); -- cgit v1.2.3 From 51ecaad4b544f3ba4b757c7ebc31d5c10b8b3689 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 14:31:05 -0400 Subject: Use the shutdown icon in the disconnected state. --- src/status-service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status-service.c b/src/status-service.c index a448ada..fc4e535 100644 --- a/src/status-service.c +++ b/src/status-service.c @@ -68,7 +68,7 @@ static const gchar * status_icons[STATUS_PROVIDER_STATUS_LAST] = { /* STATUS_PROVIDER_STATUS_DND, */ "user-busy", /* STATUS_PROVIDER_STATUS_INVISIBLE, */ "user-invisible", /* STATUS_PROVIDER_STATUS_OFFLINE */ "user-offline", - /* STATUS_PROVIDER_STATUS_DISCONNECTED */"user-offline" + /* STATUS_PROVIDER_STATUS_DISCONNECTED */"system-shutdown" }; -- cgit v1.2.3 From fb0944b211fc298684bcc872c7c8102d35573285 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 14:35:36 -0400 Subject: releasing version 0.1.6-0ubuntu1~ppa2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index c491d9d..7ffe071 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -indicator-session (0.1.6-0ubuntu1~ppa2) UNRELEASED; urgency=low +indicator-session (0.1.6-0ubuntu1~ppa2) karmic; urgency=low * Stupid, stupid, icon stuff - -- Ted Gould Tue, 06 Oct 2009 14:34:12 -0400 + -- Ted Gould Tue, 06 Oct 2009 14:35:34 -0400 indicator-session (0.1.6-0ubuntu1~ppa1) karmic; urgency=low -- cgit v1.2.3 From 5763f8c1c49af3c2435ee8b43fc4625eceb8b13f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 14:38:51 -0400 Subject: Setting the default icon as well. --- src/indicator-session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/indicator-session.c b/src/indicator-session.c index a4bb5e1..ef80033 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -76,8 +76,8 @@ get_label (void) GtkImage * get_icon (void) { - g_debug("Changing status icon: '%s'", "user-offline"); - status_image = GTK_IMAGE(gtk_image_new_from_icon_name("user-offline", GTK_ICON_SIZE_MENU)); + g_debug("Changing status icon: '%s'", "system-shutdown"); + status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown", GTK_ICON_SIZE_MENU)); gtk_widget_show(GTK_WIDGET(status_image)); return status_image; } -- cgit v1.2.3 From 74996e1b74e945ff90f9dfad68375e0b6f3a84d9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 15:01:54 -0400 Subject: Making it so that the manager only gets created if the status is set. --- src/status-provider-mc5.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/status-provider-mc5.c b/src/status-provider-mc5.c index 813ce3e..671e459 100644 --- a/src/status-provider-mc5.c +++ b/src/status-provider-mc5.c @@ -113,8 +113,8 @@ status_provider_mc5_init (StatusProviderMC5 *self) { StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(self); - priv->status = STATUS_PROVIDER_STATUS_OFFLINE; - priv->manager = EMPATHY_ACCOUNT_MANAGER(g_object_new(EMPATHY_TYPE_ACCOUNT_MANAGER, NULL)); + priv->status = STATUS_PROVIDER_STATUS_DISCONNECTED; + priv->manager = NULL; g_signal_connect(G_OBJECT(priv->manager), "global-presence-changed", G_CALLBACK(presence_changed), self); @@ -169,8 +169,7 @@ set_status (StatusProvider * sp, StatusProviderStatus status) { StatusProviderMC5Private * priv = STATUS_PROVIDER_MC5_GET_PRIVATE(sp); if (priv->manager == NULL) { - priv->status = STATUS_PROVIDER_STATUS_DISCONNECTED; - return; + priv->manager = EMPATHY_ACCOUNT_MANAGER(g_object_new(EMPATHY_TYPE_ACCOUNT_MANAGER, NULL)); } empathy_account_manager_request_global_presence(priv->manager, sp_to_tp_map[status], sp_to_mc_map[status], ""); -- cgit v1.2.3 From fba2cd7a0447689a20f128c80287ac37391e3c08 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 15:22:09 -0400 Subject: releasing version 0.1.6-0ubuntu1~ppa4 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 7602e90..f4411d9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -indicator-session (0.1.6-0ubuntu1~ppa4) UNRELEASED; urgency=low +indicator-session (0.1.6-0ubuntu1~ppa4) karmic; urgency=low * Making it so that the Empathy account manager doesn't start unless you set the status. - -- Ted Gould Tue, 06 Oct 2009 15:20:43 -0400 + -- Ted Gould Tue, 06 Oct 2009 15:22:07 -0400 indicator-session (0.1.6-0ubuntu1~ppa3) karmic; urgency=low -- cgit v1.2.3 From df23d93731a05db7daa1abb34893f5cb5221c7b8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 17:32:12 -0400 Subject: Adding a new icon 'indicator-system-shutdown' --- data/icons/16x16/actions/Makefile.am | 1 + .../16x16/actions/indicator-system-shutdown.png | Bin 0 -> 699 bytes data/icons/22x22/actions/Makefile.am | 1 + .../22x22/actions/indicator-system-shutdown.png | Bin 0 -> 1339 bytes data/icons/24x24/actions/Makefile.am | 1 + .../24x24/actions/indicator-system-shutdown.png | Bin 0 -> 1355 bytes data/icons/scalable/actions/Makefile.am | 1 + .../scalable/actions/indicator-system-shutdown.svg | 247 +++++++++++++++++++++ 8 files changed, 251 insertions(+) create mode 100644 data/icons/16x16/actions/indicator-system-shutdown.png create mode 100644 data/icons/22x22/actions/indicator-system-shutdown.png create mode 100644 data/icons/24x24/actions/indicator-system-shutdown.png create mode 100644 data/icons/scalable/actions/indicator-system-shutdown.svg diff --git a/data/icons/16x16/actions/Makefile.am b/data/icons/16x16/actions/Makefile.am index 5aa276c..da8d5c2 100644 --- a/data/icons/16x16/actions/Makefile.am +++ b/data/icons/16x16/actions/Makefile.am @@ -2,6 +2,7 @@ iconsdir = $(INDICATORICONSDIR)/hicolor/16x16/actions icons_DATA = \ + indicator-system-shutdown.png \ system-shutdown.png \ system-restart.png \ system-log-out.png diff --git a/data/icons/16x16/actions/indicator-system-shutdown.png b/data/icons/16x16/actions/indicator-system-shutdown.png new file mode 100644 index 0000000..ef69a83 Binary files /dev/null and b/data/icons/16x16/actions/indicator-system-shutdown.png differ diff --git a/data/icons/22x22/actions/Makefile.am b/data/icons/22x22/actions/Makefile.am index 73cdd09..40e243e 100644 --- a/data/icons/22x22/actions/Makefile.am +++ b/data/icons/22x22/actions/Makefile.am @@ -2,6 +2,7 @@ iconsdir = $(INDICATORICONSDIR)/hicolor/22x22/actions icons_DATA = \ + indicator-system-shutdown.png \ system-shutdown.png \ system-restart.png \ system-log-out.png diff --git a/data/icons/22x22/actions/indicator-system-shutdown.png b/data/icons/22x22/actions/indicator-system-shutdown.png new file mode 100644 index 0000000..aef0e91 Binary files /dev/null and b/data/icons/22x22/actions/indicator-system-shutdown.png differ diff --git a/data/icons/24x24/actions/Makefile.am b/data/icons/24x24/actions/Makefile.am index 55c63d1..8bd940b 100644 --- a/data/icons/24x24/actions/Makefile.am +++ b/data/icons/24x24/actions/Makefile.am @@ -2,6 +2,7 @@ iconsdir = $(INDICATORICONSDIR)/hicolor/24x24/actions icons_DATA = \ + indicator-system-shutdown.png \ system-shutdown.png \ system-restart.png \ system-log-out.png diff --git a/data/icons/24x24/actions/indicator-system-shutdown.png b/data/icons/24x24/actions/indicator-system-shutdown.png new file mode 100644 index 0000000..c1cca10 Binary files /dev/null and b/data/icons/24x24/actions/indicator-system-shutdown.png differ diff --git a/data/icons/scalable/actions/Makefile.am b/data/icons/scalable/actions/Makefile.am index 39b4177..e6dd384 100644 --- a/data/icons/scalable/actions/Makefile.am +++ b/data/icons/scalable/actions/Makefile.am @@ -2,6 +2,7 @@ iconsdir = $(INDICATORICONSDIR)/hicolor/scalable/actions icons_DATA = \ + indicator-system-shutdown.svg \ system-restart.svg \ system-log-out.svg \ system-shutdown.svg diff --git a/data/icons/scalable/actions/indicator-system-shutdown.svg b/data/icons/scalable/actions/indicator-system-shutdown.svg new file mode 100644 index 0000000..fc60baf --- /dev/null +++ b/data/icons/scalable/actions/indicator-system-shutdown.svg @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Shutdown + + + Jakub Steiner + + + + http://jimmac.musichall.cz + + + lock + key + secure + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 7ffa07052dc783b5c49a006cc1a8d8ef03c08d9d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 17:34:05 -0400 Subject: Changing the icon name in the code. --- src/indicator-session.c | 4 ++-- src/status-service.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/indicator-session.c b/src/indicator-session.c index ef80033..197bd2f 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -76,8 +76,8 @@ get_label (void) GtkImage * get_icon (void) { - g_debug("Changing status icon: '%s'", "system-shutdown"); - status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown", GTK_ICON_SIZE_MENU)); + g_debug("Changing status icon: '%s'", "indicator-system-shutdown"); + status_image = GTK_IMAGE(gtk_image_new_from_icon_name("indicator-system-shutdown", GTK_ICON_SIZE_MENU)); gtk_widget_show(GTK_WIDGET(status_image)); return status_image; } diff --git a/src/status-service.c b/src/status-service.c index fc4e535..b49913c 100644 --- a/src/status-service.c +++ b/src/status-service.c @@ -68,7 +68,7 @@ static const gchar * status_icons[STATUS_PROVIDER_STATUS_LAST] = { /* STATUS_PROVIDER_STATUS_DND, */ "user-busy", /* STATUS_PROVIDER_STATUS_INVISIBLE, */ "user-invisible", /* STATUS_PROVIDER_STATUS_OFFLINE */ "user-offline", - /* STATUS_PROVIDER_STATUS_DISCONNECTED */"system-shutdown" + /* STATUS_PROVIDER_STATUS_DISCONNECTED */"indicator-system-shutdown" }; -- cgit v1.2.3 From 06e6a3c279b5d7faea9e4e77781b9493c294bade Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 17:35:46 -0400 Subject: releasing version 0.1.6-0ubuntu1~ppa5 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8074319..c176485 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,9 @@ -indicator-session (0.1.6-0ubuntu1~ppa5) UNRELEASED; urgency=low +indicator-session (0.1.6-0ubuntu1~ppa5) karmic; urgency=low * Adding in a new icon name as apparently adding the icon wasn't good enough. - -- Ted Gould Tue, 06 Oct 2009 17:34:26 -0400 + -- Ted Gould Tue, 06 Oct 2009 17:35:44 -0400 indicator-session (0.1.6-0ubuntu1~ppa4) karmic; urgency=low -- cgit v1.2.3 From b46bedd309f466e23faaa5ca4f8c71059830ce79 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 18:14:21 -0400 Subject: releasing version 0.1.6-0ubuntu3~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0e85b0b..de3fa75 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,11 @@ -indicator-session (0.1.6-0ubuntu3~ppa1) UNRELEASED; urgency=low +indicator-session (0.1.6-0ubuntu3~ppa1) karmic; urgency=low * Asynchronized the menu handling so that it's in the right order with async startup. * String change, "New Session" to "Switch User" (LP: #444494) * Removed debian/patches/switch_user_lp-444494.patch - -- Ted Gould Tue, 06 Oct 2009 18:09:08 -0400 + -- Ted Gould Tue, 06 Oct 2009 18:14:16 -0400 indicator-session (0.1.6-0ubuntu2) UNRELEASED; urgency=low -- cgit v1.2.3 From 7bb2c92d05bac11fecb30d744632f4d581903fbb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 18:51:09 -0400 Subject: Changing icon name again. This is probably better WRT the icon naming spec. --- data/icons/16x16/actions/Makefile.am | 2 +- .../16x16/actions/indicator-system-shutdown.png | Bin 699 -> 0 bytes data/icons/16x16/actions/system-shutdown-panel.png | Bin 0 -> 699 bytes data/icons/22x22/actions/Makefile.am | 2 +- .../22x22/actions/indicator-system-shutdown.png | Bin 1339 -> 0 bytes data/icons/22x22/actions/system-shutdown-panel.png | Bin 0 -> 1339 bytes data/icons/24x24/actions/Makefile.am | 2 +- .../24x24/actions/indicator-system-shutdown.png | Bin 1355 -> 0 bytes data/icons/24x24/actions/system-shutdown-panel.png | Bin 0 -> 1355 bytes data/icons/scalable/actions/Makefile.am | 2 +- .../scalable/actions/indicator-system-shutdown.svg | 247 --------------------- .../scalable/actions/system-shutdown-panel.svg | 247 +++++++++++++++++++++ src/indicator-session.c | 4 +- src/status-service.c | 2 +- 14 files changed, 254 insertions(+), 254 deletions(-) delete mode 100644 data/icons/16x16/actions/indicator-system-shutdown.png create mode 100644 data/icons/16x16/actions/system-shutdown-panel.png delete mode 100644 data/icons/22x22/actions/indicator-system-shutdown.png create mode 100644 data/icons/22x22/actions/system-shutdown-panel.png delete mode 100644 data/icons/24x24/actions/indicator-system-shutdown.png create mode 100644 data/icons/24x24/actions/system-shutdown-panel.png delete mode 100644 data/icons/scalable/actions/indicator-system-shutdown.svg create mode 100644 data/icons/scalable/actions/system-shutdown-panel.svg diff --git a/data/icons/16x16/actions/Makefile.am b/data/icons/16x16/actions/Makefile.am index da8d5c2..417ab60 100644 --- a/data/icons/16x16/actions/Makefile.am +++ b/data/icons/16x16/actions/Makefile.am @@ -2,7 +2,7 @@ iconsdir = $(INDICATORICONSDIR)/hicolor/16x16/actions icons_DATA = \ - indicator-system-shutdown.png \ + system-shutdown-panel.png \ system-shutdown.png \ system-restart.png \ system-log-out.png diff --git a/data/icons/16x16/actions/indicator-system-shutdown.png b/data/icons/16x16/actions/indicator-system-shutdown.png deleted file mode 100644 index ef69a83..0000000 Binary files a/data/icons/16x16/actions/indicator-system-shutdown.png and /dev/null differ diff --git a/data/icons/16x16/actions/system-shutdown-panel.png b/data/icons/16x16/actions/system-shutdown-panel.png new file mode 100644 index 0000000..ef69a83 Binary files /dev/null and b/data/icons/16x16/actions/system-shutdown-panel.png differ diff --git a/data/icons/22x22/actions/Makefile.am b/data/icons/22x22/actions/Makefile.am index 40e243e..029ad1c 100644 --- a/data/icons/22x22/actions/Makefile.am +++ b/data/icons/22x22/actions/Makefile.am @@ -2,7 +2,7 @@ iconsdir = $(INDICATORICONSDIR)/hicolor/22x22/actions icons_DATA = \ - indicator-system-shutdown.png \ + system-shutdown-panel.png \ system-shutdown.png \ system-restart.png \ system-log-out.png diff --git a/data/icons/22x22/actions/indicator-system-shutdown.png b/data/icons/22x22/actions/indicator-system-shutdown.png deleted file mode 100644 index aef0e91..0000000 Binary files a/data/icons/22x22/actions/indicator-system-shutdown.png and /dev/null differ diff --git a/data/icons/22x22/actions/system-shutdown-panel.png b/data/icons/22x22/actions/system-shutdown-panel.png new file mode 100644 index 0000000..aef0e91 Binary files /dev/null and b/data/icons/22x22/actions/system-shutdown-panel.png differ diff --git a/data/icons/24x24/actions/Makefile.am b/data/icons/24x24/actions/Makefile.am index 8bd940b..aebdf14 100644 --- a/data/icons/24x24/actions/Makefile.am +++ b/data/icons/24x24/actions/Makefile.am @@ -2,7 +2,7 @@ iconsdir = $(INDICATORICONSDIR)/hicolor/24x24/actions icons_DATA = \ - indicator-system-shutdown.png \ + system-shutdown-panel.png \ system-shutdown.png \ system-restart.png \ system-log-out.png diff --git a/data/icons/24x24/actions/indicator-system-shutdown.png b/data/icons/24x24/actions/indicator-system-shutdown.png deleted file mode 100644 index c1cca10..0000000 Binary files a/data/icons/24x24/actions/indicator-system-shutdown.png and /dev/null differ diff --git a/data/icons/24x24/actions/system-shutdown-panel.png b/data/icons/24x24/actions/system-shutdown-panel.png new file mode 100644 index 0000000..c1cca10 Binary files /dev/null and b/data/icons/24x24/actions/system-shutdown-panel.png differ diff --git a/data/icons/scalable/actions/Makefile.am b/data/icons/scalable/actions/Makefile.am index e6dd384..26ee574 100644 --- a/data/icons/scalable/actions/Makefile.am +++ b/data/icons/scalable/actions/Makefile.am @@ -2,7 +2,7 @@ iconsdir = $(INDICATORICONSDIR)/hicolor/scalable/actions icons_DATA = \ - indicator-system-shutdown.svg \ + system-shutdown-panel.svg \ system-restart.svg \ system-log-out.svg \ system-shutdown.svg diff --git a/data/icons/scalable/actions/indicator-system-shutdown.svg b/data/icons/scalable/actions/indicator-system-shutdown.svg deleted file mode 100644 index fc60baf..0000000 --- a/data/icons/scalable/actions/indicator-system-shutdown.svg +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - Shutdown - - - Jakub Steiner - - - - http://jimmac.musichall.cz - - - lock - key - secure - - - - - - - - - - - - - - - - - - - - - - diff --git a/data/icons/scalable/actions/system-shutdown-panel.svg b/data/icons/scalable/actions/system-shutdown-panel.svg new file mode 100644 index 0000000..fc60baf --- /dev/null +++ b/data/icons/scalable/actions/system-shutdown-panel.svg @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Shutdown + + + Jakub Steiner + + + + http://jimmac.musichall.cz + + + lock + key + secure + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/indicator-session.c b/src/indicator-session.c index 197bd2f..62f3941 100644 --- a/src/indicator-session.c +++ b/src/indicator-session.c @@ -76,8 +76,8 @@ get_label (void) GtkImage * get_icon (void) { - g_debug("Changing status icon: '%s'", "indicator-system-shutdown"); - status_image = GTK_IMAGE(gtk_image_new_from_icon_name("indicator-system-shutdown", GTK_ICON_SIZE_MENU)); + g_debug("Changing status icon: '%s'", "system-shutdown-panel"); + status_image = GTK_IMAGE(gtk_image_new_from_icon_name("system-shutdown-panel", GTK_ICON_SIZE_MENU)); gtk_widget_show(GTK_WIDGET(status_image)); return status_image; } diff --git a/src/status-service.c b/src/status-service.c index b49913c..e3a9684 100644 --- a/src/status-service.c +++ b/src/status-service.c @@ -68,7 +68,7 @@ static const gchar * status_icons[STATUS_PROVIDER_STATUS_LAST] = { /* STATUS_PROVIDER_STATUS_DND, */ "user-busy", /* STATUS_PROVIDER_STATUS_INVISIBLE, */ "user-invisible", /* STATUS_PROVIDER_STATUS_OFFLINE */ "user-offline", - /* STATUS_PROVIDER_STATUS_DISCONNECTED */"indicator-system-shutdown" + /* STATUS_PROVIDER_STATUS_DISCONNECTED */"system-shutdown-panel" }; -- cgit v1.2.3 From 04c5f5f83568ceca6dd178179bb1168c308f8c03 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 18:54:13 -0400 Subject: releasing version 0.1.6-0ubuntu1~ppa6 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 875ad97..ccff741 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -indicator-session (0.1.6-0ubuntu1~ppa6) UNRELEASED; urgency=low +indicator-session (0.1.6-0ubuntu1~ppa6) karmic; urgency=low * New icon name. - -- Ted Gould Tue, 06 Oct 2009 18:52:42 -0400 + -- Ted Gould Tue, 06 Oct 2009 18:54:11 -0400 indicator-session (0.1.6-0ubuntu1~ppa5) karmic; urgency=low -- cgit v1.2.3 From e9bce071011fd10360934dcc09cdabff2b9880ce Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 19:49:57 -0400 Subject: Creating the lock helper files. --- src/Makefile.am | 13 +++++++++++-- src/lock-helper.c | 0 src/lock-helper.h | 0 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 src/lock-helper.c create mode 100644 src/lock-helper.h diff --git a/src/Makefile.am b/src/Makefile.am index 17d14e1..fefcd37 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -112,7 +112,12 @@ status-provider-mc5-marshal.c: $(srcdir)/status-provider-mc5.list # Users Stuff ############### -indicator_users_service_SOURCES = users-service.c users-service-dbus.c users-service-marshal.c +indicator_users_service_SOURCES = \ + lock-helper.c \ + lock-helper.h \ + users-service.c \ + users-service-dbus.c \ + users-service-marshal.c indicator_users_service_CFLAGS = $(USERSSERVICE_CFLAGS) -Wall -Werror indicator_users_service_LDADD = $(USERSSERVICE_LIBS) @@ -120,7 +125,11 @@ indicator_users_service_LDADD = $(USERSSERVICE_LIBS) # Session Stuff ################# -indicator_session_service_SOURCES = session-service.c gtk-dialog/gconf-helper.c +indicator_session_service_SOURCES = \ + lock-helper.c \ + lock-helper.h \ + session-service.c \ + gtk-dialog/gconf-helper.c indicator_session_service_CFLAGS = $(SESSIONSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror indicator_session_service_LDADD = $(SESSIONSERVICE_LIBS) $(GCONF_LIBS) diff --git a/src/lock-helper.c b/src/lock-helper.c new file mode 100644 index 0000000..e69de29 diff --git a/src/lock-helper.h b/src/lock-helper.h new file mode 100644 index 0000000..e69de29 -- cgit v1.2.3 From f6fc44d8020fb20200b961359ad581dade9e231b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 20:23:17 -0400 Subject: Moving arround the lock screen code so that it's in a helper. --- src/lock-helper.c | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lock-helper.h | 12 ++++ src/users-service.c | 134 +++---------------------------------------- 3 files changed, 180 insertions(+), 125 deletions(-) diff --git a/src/lock-helper.c b/src/lock-helper.c index e69de29..0df840e 100644 --- a/src/lock-helper.c +++ b/src/lock-helper.c @@ -0,0 +1,159 @@ + +#include +#include "lock-helper.h" + +static DBusGProxy * gdm_settings_proxy = NULL; +static gboolean gdm_auto_login = FALSE; +static const gchar * gdm_auto_login_string = "daemon/AutomaticLoginEnable"; + +static gboolean is_guest = FALSE; + +static gdm_autologin_cb_t gdm_autologin_cb = NULL; + +/* This is our logic on whether the screen should be locked + or not. It effects everything else. */ +gboolean +will_lock_screen (void) +{ + if (gdm_auto_login) { + return FALSE; + } + if (is_guest) { + return FALSE; + } + + return TRUE; +} + +/* Respond to the signal of autologin changing to see if the + setting for timed login changes. */ +static void +gdm_settings_change (DBusGProxy * proxy, const gchar * value, const gchar * old, const gchar * new, gpointer data) +{ + if (g_strcmp0(value, gdm_auto_login_string)) { + /* This is not a setting that we care about, + there is only one. */ + return; + } + g_debug("GDM Settings change: %s", new); + + if (g_strcmp0(new, "true") == 0) { + gdm_auto_login = TRUE; + } else { + gdm_auto_login = FALSE; + } + + if (gdm_autologin_cb != NULL) { + gdm_autologin_cb(); + } + + return; +} + +/* Get back the data from querying to see if there is auto + login enabled in GDM */ +static void +gdm_get_autologin (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data) +{ + GError * error = NULL; + gchar * value = NULL; + + if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_STRING, &value, G_TYPE_INVALID)) { + g_warning("Unable to get autologin setting: %s", error != NULL ? error->message : "null"); + g_error_free(error); + return; + } + + g_return_if_fail(value != NULL); + gdm_settings_change(proxy, gdm_auto_login_string, NULL, value, NULL); + + return; +} + +/* Sets up the proxy and queries for the setting to know + whether we're doing an autologin. */ +static void +build_gdm_proxy (void) +{ + g_return_if_fail(gdm_settings_proxy == NULL); + + /* Grab the system bus */ + DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); + g_return_if_fail(bus != NULL); + + /* Get the settings proxy */ + gdm_settings_proxy = dbus_g_proxy_new_for_name_owner(bus, + "org.gnome.DisplayManager", + "/org/gnome/DisplayManager/Settings", + "org.gnome.DisplayManager.Settings", NULL); + g_return_if_fail(gdm_settings_proxy != NULL); + + /* Signal for value changed */ + dbus_g_proxy_add_signal(gdm_settings_proxy, + "ValueChanged", + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(gdm_settings_proxy, + "ValueChanged", + G_CALLBACK(gdm_settings_change), + NULL, + NULL); + + /* Start to get the initial value */ + dbus_g_proxy_begin_call(gdm_settings_proxy, + "GetValue", + gdm_get_autologin, + NULL, + NULL, + G_TYPE_STRING, + gdm_auto_login_string, + G_TYPE_INVALID); + + return; +} + +/* A fun little function to actually lock the screen. If, + that's what you want, let's do it! */ +void +lock_screen (DbusmenuMenuitem * mi, gpointer data) +{ + g_debug("Lock Screen"); + if (!will_lock_screen()) { + g_debug("\tGDM set to autologin, blocking lock"); + return; + } + + DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + g_return_if_fail(session_bus != NULL); + + DBusGProxy * proxy = dbus_g_proxy_new_for_name_owner(session_bus, + "org.gnome.ScreenSaver", + "/", + "org.gnome.ScreenSaver", + NULL); + g_return_if_fail(proxy != NULL); + + dbus_g_proxy_call_no_reply(proxy, + "Lock", + G_TYPE_INVALID, + G_TYPE_INVALID); + + g_object_unref(proxy); + + return; +} + +gboolean +lock_screen_setup (gpointer data) +{ + if (!g_strcmp0(g_get_user_name(), "guest")) { + is_guest = TRUE; + } + + build_gdm_proxy(); + + return FALSE; +} + diff --git a/src/lock-helper.h b/src/lock-helper.h index e69de29..5103242 100644 --- a/src/lock-helper.h +++ b/src/lock-helper.h @@ -0,0 +1,12 @@ +#ifndef LOCK_HELPER_H__ +#define LOCK_HELPER_H__ + +#include + +typedef void (*gdm_autologin_cb_t) (void); + +gboolean will_lock_screen (void); +void lock_screen (DbusmenuMenuitem * mi, gpointer data); +gboolean lock_screen_setup (gpointer data); + +#endif /* LOCK_HELPER_H__ */ diff --git a/src/users-service.c b/src/users-service.c index 5a189c8..576574b 100644 --- a/src/users-service.c +++ b/src/users-service.c @@ -35,6 +35,7 @@ #include "dbus-shared-names.h" #include "users-service-dbus.h" +#include "lock-helper.h" #define GUEST_SESSION_LAUNCHER "/usr/share/gdm/guest-session/guest-session-launch" @@ -54,107 +55,25 @@ static GMainLoop *mainloop = NULL; static UsersServiceDbus *dbus_interface = NULL; static DbusmenuMenuitem *lock_menuitem = NULL; -static gboolean is_guest = FALSE; - -static DBusGProxy * gdm_settings_proxy = NULL; -static gboolean gdm_auto_login = FALSE; -static const gchar * gdm_auto_login_string = "daemon/AutomaticLoginEnable"; static gint count; static GList *users; +#if 0 /* Respond to the signal of autologin changing to see if the setting for timed login changes. */ static void -gdm_settings_change (DBusGProxy * proxy, const gchar * value, const gchar * old, const gchar * new, gpointer data) +gdm_settings_change (gboolean autologin) { - if (g_strcmp0(value, gdm_auto_login_string)) { - /* This is not a setting that we care about, - there is only one. */ - return; - } - g_debug("GDM Settings change: %s", new); - - if (g_strcmp0(new, "true") == 0) { - gdm_auto_login = TRUE; + if (autologin) { + dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "false"); } else { - gdm_auto_login = FALSE; - } - - if (lock_menuitem != NULL) { - if (gdm_auto_login || is_guest) { - dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "false"); - } else { - dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "true"); - } + dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "true"); } return; } - -/* Get back the data from querying to see if there is auto - login enabled in GDM */ -static void -gdm_get_autologin (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data) -{ - GError * error = NULL; - gchar * value = NULL; - - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_STRING, &value, G_TYPE_INVALID)) { - g_warning("Unable to get autologin setting: %s", error != NULL ? error->message : "null"); - g_error_free(error); - return; - } - - g_return_if_fail(value != NULL); - gdm_settings_change(proxy, gdm_auto_login_string, NULL, value, NULL); - - return; -} - -/* Sets up the proxy and queries for the setting to know - whether we're doing an autologin. */ -static gboolean -build_gdm_proxy (gpointer null_data) -{ - g_return_val_if_fail(gdm_settings_proxy == NULL, FALSE); - - /* Grab the system bus */ - DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); - g_return_val_if_fail(bus != NULL, FALSE); - - /* Get the settings proxy */ - gdm_settings_proxy = dbus_g_proxy_new_for_name_owner(bus, - "org.gnome.DisplayManager", - "/org/gnome/DisplayManager/Settings", - "org.gnome.DisplayManager.Settings", NULL); - g_return_val_if_fail(gdm_settings_proxy != NULL, FALSE); - - /* Signal for value changed */ - dbus_g_proxy_add_signal(gdm_settings_proxy, - "ValueChanged", - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal(gdm_settings_proxy, - "ValueChanged", - G_CALLBACK(gdm_settings_change), - NULL, - NULL); - - /* Start to get the initial value */ - dbus_g_proxy_begin_call(gdm_settings_proxy, - "GetValue", - gdm_get_autologin, - NULL, - NULL, - G_TYPE_STRING, - gdm_auto_login_string, - G_TYPE_INVALID); - - return FALSE; -} +#endif static gboolean check_guest_session (void) @@ -222,37 +141,6 @@ activate_new_session (DbusmenuMenuitem * mi, gpointer user_data) return; } -/* A fun little function to actually lock the screen. If, - that's what you want, let's do it! */ -static void -lock_screen (DbusmenuMenuitem * mi, gpointer data) -{ - g_debug("Lock Screen"); - if (gdm_auto_login) { - g_debug("\tGDM set to autologin, blocking lock"); - return; - } - - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_return_if_fail(session_bus != NULL); - - DBusGProxy * proxy = dbus_g_proxy_new_for_name_owner(session_bus, - "org.gnome.ScreenSaver", - "/", - "org.gnome.ScreenSaver", - NULL); - g_return_if_fail(proxy != NULL); - - dbus_g_proxy_call_no_reply(proxy, - "Lock", - G_TYPE_INVALID, - G_TYPE_INVALID); - - g_object_unref(proxy); - - return; -} - static void activate_user_session (DbusmenuMenuitem *mi, gpointer user_data) { @@ -292,7 +180,7 @@ rebuild_items (DbusmenuMenuitem *root, dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_LABEL, _("Lock Screen")); g_signal_connect(G_OBJECT(lock_menuitem), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(lock_screen), NULL); dbusmenu_menuitem_child_append(root, lock_menuitem); - if (gdm_auto_login || is_guest) { + if (!will_lock_screen()) { dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "false"); } else { dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "true"); @@ -410,11 +298,7 @@ main (int argc, char ** argv) return 1; } - if (!g_strcmp0(g_get_user_name(), "guest")) { - is_guest = TRUE; - } - - g_idle_add(build_gdm_proxy, NULL); + g_idle_add(lock_screen_setup, NULL); dbus_interface = g_object_new (USERS_SERVICE_DBUS_TYPE, NULL); -- cgit v1.2.3 From d6c6861081cd6133fd605bae27a9c199b41b1555 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 20:28:06 -0400 Subject: Setting up the callback --- src/lock-helper.c | 12 ++++++++++++ src/lock-helper.h | 1 + src/users-service.c | 7 +++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/lock-helper.c b/src/lock-helper.c index 0df840e..e717968 100644 --- a/src/lock-helper.c +++ b/src/lock-helper.c @@ -10,6 +10,18 @@ static gboolean is_guest = FALSE; static gdm_autologin_cb_t gdm_autologin_cb = NULL; +/* Setting up a call back */ +void +lock_screen_gdm_cb_set (gdm_autologin_cb_t cb) +{ + if (gdm_autologin_cb) { + g_warning("Already had a callback, setting up a new one..."); + } + + gdm_autologin_cb = cb; + return; +} + /* This is our logic on whether the screen should be locked or not. It effects everything else. */ gboolean diff --git a/src/lock-helper.h b/src/lock-helper.h index 5103242..9a0571c 100644 --- a/src/lock-helper.h +++ b/src/lock-helper.h @@ -8,5 +8,6 @@ typedef void (*gdm_autologin_cb_t) (void); gboolean will_lock_screen (void); void lock_screen (DbusmenuMenuitem * mi, gpointer data); gboolean lock_screen_setup (gpointer data); +void lock_screen_gdm_cb_set (gdm_autologin_cb_t cb); #endif /* LOCK_HELPER_H__ */ diff --git a/src/users-service.c b/src/users-service.c index 576574b..b4310da 100644 --- a/src/users-service.c +++ b/src/users-service.c @@ -59,13 +59,12 @@ static DbusmenuMenuitem *lock_menuitem = NULL; static gint count; static GList *users; -#if 0 /* Respond to the signal of autologin changing to see if the setting for timed login changes. */ static void -gdm_settings_change (gboolean autologin) +gdm_settings_change (void) { - if (autologin) { + if (!will_lock_screen()) { dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "false"); } else { dbusmenu_menuitem_property_set(lock_menuitem, DBUSMENU_MENUITEM_PROP_SENSITIVE, "true"); @@ -73,7 +72,6 @@ gdm_settings_change (gboolean autologin) return; } -#endif static gboolean check_guest_session (void) @@ -299,6 +297,7 @@ main (int argc, char ** argv) } g_idle_add(lock_screen_setup, NULL); + lock_screen_gdm_cb_set(gdm_settings_change); dbus_interface = g_object_new (USERS_SERVICE_DBUS_TYPE, NULL); -- cgit v1.2.3 From 148ef878b3ca66a7f644a1c0f11741646d08524c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 6 Oct 2009 20:33:00 -0400 Subject: Linking into the lock screen helper. --- src/session-service.c | 126 ++------------------------------------------------ 1 file changed, 4 insertions(+), 122 deletions(-) diff --git a/src/session-service.c b/src/session-service.c index 0242b17..3c0535f 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -35,6 +35,8 @@ with this program. If not, see . #include "gtk-dialog/gconf-helper.h" +#include "lock-helper.h" + #define DKP_ADDRESS "org.freedesktop.DeviceKit.Power" #define DKP_OBJECT "/org/freedesktop/DeviceKit/Power" #define DKP_INTERFACE "org.freedesktop.DeviceKit.Power" @@ -44,10 +46,6 @@ static GMainLoop * mainloop = NULL; static DBusGProxy * dkp_main_proxy = NULL; static DBusGProxy * dkp_prop_proxy = NULL; -static DBusGProxy * gdm_settings_proxy = NULL; -static gboolean gdm_auto_login = FALSE; -static const gchar * gdm_auto_login_string = "daemon/AutomaticLoginEnable"; - static DBusGProxyCall * suspend_call = NULL; static DBusGProxyCall * hibernate_call = NULL; @@ -58,122 +56,6 @@ static DbusmenuMenuitem * restart_mi = NULL; static DbusmenuMenuitem * shutdown_mi = NULL; -/* Respond to the signal of autologin changing to see if the - setting for timed login changes. */ -static void -gdm_settings_change (DBusGProxy * proxy, const gchar * value, const gchar * old, const gchar * new, gpointer data) -{ - if (g_strcmp0(value, gdm_auto_login_string)) { - /* This is not a setting that we care about, - there is only one. */ - return; - } - g_debug("GDM Settings change: %s", new); - - if (g_strcmp0(new, "true") == 0) { - gdm_auto_login = TRUE; - } else { - gdm_auto_login = FALSE; - } - - return; -} - -/* Get back the data from querying to see if there is auto - login enabled in GDM */ -static void -gdm_get_autologin (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data) -{ - GError * error = NULL; - gchar * value = NULL; - - if (!dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_STRING, &value, G_TYPE_INVALID)) { - g_warning("Unable to get autologin setting: %s", error != NULL ? error->message : "null"); - g_error_free(error); - return; - } - - g_return_if_fail(value != NULL); - gdm_settings_change(proxy, gdm_auto_login_string, NULL, value, NULL); - - return; -} - -/* Sets up the proxy and queries for the setting to know - whether we're doing an autologin. */ -static gboolean -build_gdm_proxy (gpointer null_data) -{ - g_return_val_if_fail(gdm_settings_proxy == NULL, FALSE); - - /* Grab the system bus */ - DBusGConnection * bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); - g_return_val_if_fail(bus != NULL, FALSE); - - /* Get the settings proxy */ - gdm_settings_proxy = dbus_g_proxy_new_for_name_owner(bus, - "org.gnome.DisplayManager", - "/org/gnome/DisplayManager/Settings", - "org.gnome.DisplayManager.Settings", NULL); - g_return_val_if_fail(gdm_settings_proxy != NULL, FALSE); - - /* Signal for value changed */ - dbus_g_proxy_add_signal(gdm_settings_proxy, - "ValueChanged", - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal(gdm_settings_proxy, - "ValueChanged", - G_CALLBACK(gdm_settings_change), - NULL, - NULL); - - /* Start to get the initial value */ - dbus_g_proxy_begin_call(gdm_settings_proxy, - "GetValue", - gdm_get_autologin, - NULL, - NULL, - G_TYPE_STRING, - gdm_auto_login_string, - G_TYPE_INVALID); - - return FALSE; -} - -/* A fun little function to actually lock the screen. If, - that's what you want, let's do it! */ -static void -lock_screen (void) -{ - g_debug("Lock Screen"); - if (gdm_auto_login) { - g_debug("\tGDM set to autologin, blocking lock"); - return; - } - - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_return_if_fail(session_bus != NULL); - - DBusGProxy * proxy = dbus_g_proxy_new_for_name_owner(session_bus, - "org.gnome.ScreenSaver", - "/", - "org.gnome.ScreenSaver", - NULL); - g_return_if_fail(proxy != NULL); - - dbus_g_proxy_call_no_reply(proxy, - "Lock", - G_TYPE_INVALID, - G_TYPE_INVALID); - - g_object_unref(proxy); - - return; -} - /* Let's put this machine to sleep, with some info on how it should sleep. */ static void @@ -185,7 +67,7 @@ sleep (DbusmenuMenuitem * mi, gpointer userdata) g_warning("Can not %s as no DeviceKit Power Proxy", type); } - lock_screen(); + lock_screen(NULL, NULL); dbus_g_proxy_call_no_reply(dkp_main_proxy, type, @@ -427,7 +309,7 @@ main (int argc, char ** argv) return 1; } - g_idle_add(build_gdm_proxy, NULL); + g_idle_add(lock_screen_setup, NULL); root_menuitem = dbusmenu_menuitem_new(); g_debug("Root ID: %d", dbusmenu_menuitem_get_id(root_menuitem)); -- cgit v1.2.3 From b90777f78569b41e8ef6cdd065fc44a2ab4bd19b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 7 Oct 2009 10:31:26 -0400 Subject: Building a GSS proxy and setting up a signal to it. Then when we lock, we drop to a mainloop and wait for the screensaver to activate. --- src/lock-helper.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 11 deletions(-) diff --git a/src/lock-helper.c b/src/lock-helper.c index e717968..b2ae7f0 100644 --- a/src/lock-helper.c +++ b/src/lock-helper.c @@ -2,6 +2,9 @@ #include #include "lock-helper.h" +static DBusGProxy * gss_proxy = NULL; +static GMainLoop * gss_mainloop = NULL; + static DBusGProxy * gdm_settings_proxy = NULL; static gboolean gdm_auto_login = FALSE; static const gchar * gdm_auto_login_string = "daemon/AutomaticLoginEnable"; @@ -126,6 +129,53 @@ build_gdm_proxy (void) return; } +/* When the screensave go active, if we've got a mainloop + running we should quit it. */ +static void +gss_active_changed (DBusGProxy * proxy, gboolean active, gpointer data) +{ + if (active && gss_mainloop != NULL) { + g_main_loop_quit(gss_mainloop); + } + + return; +} + +/* Build the gss proxy and set up it's signals */ +void +build_gss_proxy (void) +{ + DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + g_return_if_fail(session_bus != NULL); + + gss_proxy = dbus_g_proxy_new_for_name_owner(session_bus, + "org.gnome.ScreenSaver", + "/", + "org.gnome.ScreenSaver", + NULL); + g_return_if_fail(gss_proxy != NULL); + + dbus_g_proxy_add_signal(gss_proxy, "ActiveChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(gss_proxy, "ActiveChanged", G_CALLBACK(gss_active_changed), NULL, NULL); + + return; +} + +/* This is a timeout, we only want to wait for the screen to + lock for a little bit, but not forever. */ +static gboolean +activate_timeout (gpointer data) +{ + guint * address = (guint *)data; + *address = 0; + + if (gss_mainloop != NULL) { + g_main_loop_quit(gss_mainloop); + } + + return FALSE; +} + /* A fun little function to actually lock the screen. If, that's what you want, let's do it! */ void @@ -137,26 +187,30 @@ lock_screen (DbusmenuMenuitem * mi, gpointer data) return; } - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_return_if_fail(session_bus != NULL); + g_return_if_fail(gss_proxy != NULL); - DBusGProxy * proxy = dbus_g_proxy_new_for_name_owner(session_bus, - "org.gnome.ScreenSaver", - "/", - "org.gnome.ScreenSaver", - NULL); - g_return_if_fail(proxy != NULL); - - dbus_g_proxy_call_no_reply(proxy, + dbus_g_proxy_call_no_reply(gss_proxy, "Lock", G_TYPE_INVALID, G_TYPE_INVALID); - g_object_unref(proxy); + if (gss_mainloop == NULL) { + gss_mainloop = g_main_loop_new(NULL, FALSE); + } + + guint timer = g_timeout_add_seconds(1, activate_timeout, &timer); + + g_main_loop_run(gss_mainloop); + + if (timer != 0) { + g_source_remove(timer); + } return; } +/* Do what it takes to make the lock screen function work + and be happy. */ gboolean lock_screen_setup (gpointer data) { @@ -165,6 +219,7 @@ lock_screen_setup (gpointer data) } build_gdm_proxy(); + build_gss_proxy(); return FALSE; } -- cgit v1.2.3 From 158293e30266fe0de1e88db8758118ac862a147b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 7 Oct 2009 10:37:35 -0400 Subject: releasing version 0.1.6-0ubuntu3~ppa2~betterlock1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 68c90f8..945f9cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -indicator-session (0.1.6-0ubuntu3~ppa2~betterlock1) UNRELEASED; urgency=low +indicator-session (0.1.6-0ubuntu3~ppa2~betterlock1) karmic; urgency=low * Merging in better locking - -- Ted Gould Wed, 07 Oct 2009 10:35:15 -0400 + -- Ted Gould Wed, 07 Oct 2009 10:37:33 -0400 indicator-session (0.1.6-0ubuntu3~ppa1) karmic; urgency=low -- cgit v1.2.3 From 18d5a15229b093fbecc358f6883ae9811d5c97d6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 7 Oct 2009 10:42:06 -0400 Subject: Copyright headers --- src/lock-helper.c | 20 ++++++++++++++++++++ src/lock-helper.h | 21 +++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/lock-helper.c b/src/lock-helper.c index b2ae7f0..5f32c0c 100644 --- a/src/lock-helper.c +++ b/src/lock-helper.c @@ -1,3 +1,23 @@ +/* +A small helper for locking the screen. + +Copyright 2009 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ #include #include "lock-helper.h" diff --git a/src/lock-helper.h b/src/lock-helper.h index 9a0571c..f9405ac 100644 --- a/src/lock-helper.h +++ b/src/lock-helper.h @@ -1,3 +1,24 @@ +/* +A small helper for locking the screen. + +Copyright 2009 Canonical Ltd. + +Authors: + Ted Gould + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + #ifndef LOCK_HELPER_H__ #define LOCK_HELPER_H__ -- cgit v1.2.3 From 22a02f891220f637ec1b451b517f25b69cbe8b01 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 7 Oct 2009 11:57:52 -0400 Subject: Adding throttle and unthrottle functions --- src/lock-helper.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/lock-helper.h | 3 +++ 2 files changed, 82 insertions(+) diff --git a/src/lock-helper.c b/src/lock-helper.c index 5f32c0c..b202b9d 100644 --- a/src/lock-helper.c +++ b/src/lock-helper.c @@ -24,6 +24,8 @@ with this program. If not, see . static DBusGProxy * gss_proxy = NULL; static GMainLoop * gss_mainloop = NULL; +static guint cookie = 0; +static DBusGProxyCall * cookie_call = NULL; static DBusGProxy * gdm_settings_proxy = NULL; static gboolean gdm_auto_login = FALSE; @@ -33,6 +35,83 @@ static gboolean is_guest = FALSE; static gdm_autologin_cb_t gdm_autologin_cb = NULL; +/* Checks to see if there is an error and reports + it. Not much else we can do. */ +static void +unthrottle_return (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data) +{ + GError * error = NULL; + dbus_g_proxy_end_call(proxy, call, &error, + G_TYPE_INVALID); + + if (error != NULL) { + g_warning("Unable to unthrottle: %s", error->message); + } + return; +} + +/* Sends an unthrottle if we're throttled. */ +void +screensaver_unthrottle (void) +{ + g_return_if_fail(cookie != 0); + + dbus_g_proxy_begin_call(gss_proxy, "UnThrottle", + unthrottle_return, NULL, + NULL, + G_TYPE_UINT, cookie, + G_TYPE_INVALID); + + cookie = 0; + return; +} + +/* Gets there return cookie from the throttle command + and sets things valid */ +static void +throttle_return (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data) +{ + GError * error = NULL; + cookie_call = NULL; + + dbus_g_proxy_end_call(proxy, call, &error, + G_TYPE_UINT, &cookie, + G_TYPE_INVALID); + + if (error != NULL) { + g_warning("Unable to throttle the screensaver: %s", error->message); + return; + } + + + if (cookie == 0) { + g_warning("We didn't get a throttle cookie!"); + } + + return; +} + +/* Throttling the screensaver by using the screen saver + command. */ +void +screensaver_throttle (gchar * reason) +{ + g_return_if_fail(cookie_call == NULL); + g_return_if_fail(will_lock_screen()); + + if (cookie != 0) { + screensaver_unthrottle(); + } + + cookie_call = dbus_g_proxy_begin_call(gss_proxy, "Throttle", + throttle_return, NULL, + NULL, + G_TYPE_STRING, reason, + G_TYPE_INVALID); + + return; +} + /* Setting up a call back */ void lock_screen_gdm_cb_set (gdm_autologin_cb_t cb) diff --git a/src/lock-helper.h b/src/lock-helper.h index f9405ac..b4a382e 100644 --- a/src/lock-helper.h +++ b/src/lock-helper.h @@ -26,6 +26,9 @@ with this program. If not, see . typedef void (*gdm_autologin_cb_t) (void); +void screensaver_throttle (gchar * reason); +void screensaver_unthrottle (void); + gboolean will_lock_screen (void); void lock_screen (DbusmenuMenuitem * mi, gpointer data); gboolean lock_screen_setup (gpointer data); -- cgit v1.2.3 From 1b12089eb7897608478ce4c3ab9b58361cbe991f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 7 Oct 2009 12:56:05 -0400 Subject: Switching the sleep action to have a response so we can make sure to unthrottle the screensaver. --- src/session-service.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/session-service.c b/src/session-service.c index 3c0535f..a4240be 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -55,6 +55,14 @@ static DbusmenuMenuitem * logout_mi = NULL; static DbusmenuMenuitem * restart_mi = NULL; static DbusmenuMenuitem * shutdown_mi = NULL; +/* A return from the command to sleep the system. Make sure + that we unthrottle the screensaver. */ +static void +sleep_response (DBusGProxy * proxy, DBusGProxyCall * call, gpointer data) +{ + screensaver_unthrottle(); + return; +} /* Let's put this machine to sleep, with some info on how it should sleep. */ @@ -67,12 +75,15 @@ sleep (DbusmenuMenuitem * mi, gpointer userdata) g_warning("Can not %s as no DeviceKit Power Proxy", type); } + screensaver_throttle(type); lock_screen(NULL, NULL); - dbus_g_proxy_call_no_reply(dkp_main_proxy, - type, - G_TYPE_INVALID, - G_TYPE_INVALID); + dbus_g_proxy_begin_call(dkp_main_proxy, + type, + sleep_response, + NULL, + NULL, + G_TYPE_INVALID); return; } -- cgit v1.2.3 From 0547aa3fd537737ede2d22a3cc164e31df97b103 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 7 Oct 2009 13:10:38 -0400 Subject: Oops, forgot to say who we were. --- src/lock-helper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lock-helper.c b/src/lock-helper.c index b202b9d..0bdec6c 100644 --- a/src/lock-helper.c +++ b/src/lock-helper.c @@ -106,6 +106,7 @@ screensaver_throttle (gchar * reason) cookie_call = dbus_g_proxy_begin_call(gss_proxy, "Throttle", throttle_return, NULL, NULL, + G_TYPE_STRING, "Session Menu", G_TYPE_STRING, reason, G_TYPE_INVALID); -- cgit v1.2.3 From e0da62c1cefcfa2c795de77059f3974abe760d70 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 7 Oct 2009 13:14:13 -0400 Subject: releasing version 0.1.6-0ubuntu3~ppa2~betterlock3 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 66a2f42..1f80c44 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -indicator-session (0.1.6-0ubuntu3~ppa2~betterlock3) UNRELEASED; urgency=low +indicator-session (0.1.6-0ubuntu3~ppa2~betterlock3) karmic; urgency=low * Right API - -- Ted Gould Wed, 07 Oct 2009 13:11:07 -0400 + -- Ted Gould Wed, 07 Oct 2009 13:14:11 -0400 indicator-session (0.1.6-0ubuntu3~ppa2~betterlock2) karmic; urgency=low -- cgit v1.2.3 -- cgit v1.2.3 From 9ace1e376aac193ba04bcfb0365af774bf96a4e5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 7 Oct 2009 18:25:02 -0400 Subject: releasing version 0.1.6-0ubuntu3~ppa2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 9946b7e..9966cc4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,11 @@ -indicator-session (0.1.6-0ubuntu3~ppa2) UNRELEASED; urgency=low +indicator-session (0.1.6-0ubuntu3~ppa2) karmic; urgency=low * Handling the locking of the screensaver so that we ensure the screensaver is active before suspending. Also, we throttle it to ensure it doesn't start until after suspend. (LP: #444391) - -- Ted Gould Wed, 07 Oct 2009 18:21:30 -0400 + -- Ted Gould Wed, 07 Oct 2009 18:25:00 -0400 indicator-session (0.1.6-0ubuntu3~ppa1) karmic; urgency=low -- cgit v1.2.3 From 8ec71fe8283925d4fb4dd0f59767d1c2eba75451 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Oct 2009 10:45:29 -0400 Subject: Better ignore --- .bzrignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.bzrignore b/.bzrignore index 8c2c2c7..0a49cb4 100644 --- a/.bzrignore +++ b/.bzrignore @@ -47,3 +47,10 @@ src/status-provider-telepathy-marshal.h src/status-provider-mc5-marshal.c src/status-provider-mc5-marshal.h data/indicator-session.schemas +src/users-service-client.h +src/users-service-marshal.c +src/users-service-marshal.h +indicator-session-[0-9].[0-9].[0-9].tar.gz +indicator-session-[0-9].[0-9].tar.gz +indicator-session-[0-9].[0-9].[0-9].tar.gz.asc +indicator-session-[0-9].[0-9].tar.gz.asc -- cgit v1.2.3 From 8bee87898909ee3daa1a66dd080f4dbc915651b0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Oct 2009 10:58:20 -0400 Subject: 0.1.7 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 193e88c..340177e 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.1.6) +AM_INIT_AUTOMAKE(indicator-session, 0.1.7) AM_MAINTAINER_MODE -- cgit v1.2.3 From 76e76e5d2e33b9b7f89c4888e2a1305c8c0550f4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Oct 2009 11:00:34 -0400 Subject: releasing version 0.1.6-0ubuntu3~ppa3 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 40268b7..7c35c89 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,11 @@ -indicator-session (0.1.6-0ubuntu3~ppa3) UNRELEASED; urgency=low +indicator-session (0.1.6-0ubuntu3~ppa3) karmic; urgency=low * Changing the icon so that if you are disconnected it is 'system-shutdown-panel' and making sure that we see it sometimes by not allocating the EmpathyAccountManager isn't allocated until status is set. (LP: #432635) - -- Ted Gould Thu, 08 Oct 2009 10:53:40 -0400 + -- Ted Gould Thu, 08 Oct 2009 11:00:32 -0400 indicator-session (0.1.6-0ubuntu3~ppa2) karmic; urgency=low -- cgit v1.2.3 From 5ff6b510c9be9df8bb30a00e0795af2d9dcc78ae Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Oct 2009 11:12:17 -0400 Subject: releasing version 0.1.7-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 24489db..69924f9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -indicator-session (0.1.7-0ubuntu1~ppa1) UNRELEASED; urgency=low +indicator-session (0.1.7-0ubuntu1~ppa1) karmic; urgency=low * Upstream release 0.1.7 * Changing the icon so that if you are disconnected it is @@ -15,7 +15,7 @@ indicator-session (0.1.7-0ubuntu1~ppa1) UNRELEASED; urgency=low * String change, "New Session" to "Switch User" (LP: #444494) * Removed debian/patches/switch_user_lp-444494.patch - -- Ted Gould Thu, 08 Oct 2009 11:00:47 -0400 + -- Ted Gould Thu, 08 Oct 2009 11:12:07 -0400 indicator-session (0.1.6-0ubuntu2) UNRELEASED; urgency=low -- cgit v1.2.3