aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore7
-rw-r--r--configure.ac2
-rw-r--r--data/icons/16x16/actions/Makefile.am1
-rw-r--r--data/icons/16x16/actions/system-shutdown-panel.pngbin0 -> 699 bytes
-rw-r--r--data/icons/22x22/actions/Makefile.am1
-rw-r--r--data/icons/22x22/actions/system-shutdown-panel.pngbin0 -> 1339 bytes
-rw-r--r--data/icons/24x24/actions/Makefile.am1
-rw-r--r--data/icons/24x24/actions/system-shutdown-panel.pngbin0 -> 1355 bytes
-rw-r--r--data/icons/scalable/actions/Makefile.am1
-rw-r--r--data/icons/scalable/actions/system-shutdown-panel.svg247
-rw-r--r--debian/changelog21
-rw-r--r--debian/patches/switch_user_lp-444494.patch13
-rw-r--r--src/Makefile.am13
-rw-r--r--src/gtk-dialog/logout-dialog.c1
-rw-r--r--src/indicator-session.c56
-rw-r--r--src/lock-helper.c326
-rw-r--r--src/lock-helper.h37
-rw-r--r--src/session-service.c137
-rw-r--r--src/status-provider-mc5.c7
-rw-r--r--src/status-service.c2
-rw-r--r--src/users-service.c135
21 files changed, 730 insertions, 278 deletions
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
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
diff --git a/data/icons/16x16/actions/Makefile.am b/data/icons/16x16/actions/Makefile.am
index 5aa276c..417ab60 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 = \
+ system-shutdown-panel.png \
system-shutdown.png \
system-restart.png \
system-log-out.png
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
--- /dev/null
+++ b/data/icons/16x16/actions/system-shutdown-panel.png
Binary files differ
diff --git a/data/icons/22x22/actions/Makefile.am b/data/icons/22x22/actions/Makefile.am
index 73cdd09..029ad1c 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 = \
+ system-shutdown-panel.png \
system-shutdown.png \
system-restart.png \
system-log-out.png
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
--- /dev/null
+++ b/data/icons/22x22/actions/system-shutdown-panel.png
Binary files differ
diff --git a/data/icons/24x24/actions/Makefile.am b/data/icons/24x24/actions/Makefile.am
index 55c63d1..aebdf14 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 = \
+ system-shutdown-panel.png \
system-shutdown.png \
system-restart.png \
system-log-out.png
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
--- /dev/null
+++ b/data/icons/24x24/actions/system-shutdown-panel.png
Binary files differ
diff --git a/data/icons/scalable/actions/Makefile.am b/data/icons/scalable/actions/Makefile.am
index 39b4177..26ee574 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 = \
+ system-shutdown-panel.svg \
system-restart.svg \
system-log-out.svg \
system-shutdown.svg
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 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ sodipodi:docname="gnome-shutdown.svg"
+ sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/apps"
+ inkscape:version="0.45"
+ sodipodi:version="0.32"
+ id="svg11142"
+ height="48"
+ width="48"
+ version="1.0"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs3">
+ <linearGradient
+ id="linearGradient4749">
+ <stop
+ id="stop4751"
+ offset="0"
+ style="stop-color:#ffffff;stop-opacity:1;" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.0000000;"
+ offset="0.50000000"
+ id="stop4757" />
+ <stop
+ id="stop4753"
+ offset="1.0000000"
+ style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient11264"
+ inkscape:collect="always">
+ <stop
+ id="stop11266"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:1;" />
+ <stop
+ id="stop11268"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient11178">
+ <stop
+ style="stop-color:#d1d1cc;stop-opacity:1.0000000;"
+ offset="0.0000000"
+ id="stop11180" />
+ <stop
+ id="stop4735"
+ offset="0.50000000"
+ style="stop-color:#d1d1d1;stop-opacity:1.0000000;" />
+ <stop
+ style="stop-color:#b9b9b9;stop-opacity:1.0000000;"
+ offset="1.0000000"
+ id="stop11188" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient11164">
+ <stop
+ id="stop11166"
+ offset="0"
+ style="stop-color:#eeeeec;stop-opacity:1;" />
+ <stop
+ style="stop-color:#c6c6bf;stop-opacity:1.0000000;"
+ offset="0.26988637"
+ id="stop11172" />
+ <stop
+ id="stop11176"
+ offset="0.37900311"
+ style="stop-color:#f9f9f8;stop-opacity:1.0000000;" />
+ <stop
+ id="stop11174"
+ offset="0.75000000"
+ style="stop-color:#c8c8c2;stop-opacity:1.0000000;" />
+ <stop
+ id="stop11168"
+ offset="1.0000000"
+ style="stop-color:#eeeeec;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="23.071428"
+ x2="42.471249"
+ y1="23.071428"
+ x1="7.1433797"
+ id="linearGradient11170"
+ xlink:href="#linearGradient11164"
+ inkscape:collect="always" />
+ <radialGradient
+ gradientTransform="matrix(1.364252,-9.115392e-17,9.115392e-17,1.364252,-9.47947,-5.618016)"
+ gradientUnits="userSpaceOnUse"
+ r="18.672388"
+ fy="17.224812"
+ fx="24.673435"
+ cy="17.224812"
+ cx="24.673435"
+ id="radialGradient11234"
+ xlink:href="#linearGradient11178"
+ inkscape:collect="always" />
+ <radialGradient
+ gradientUnits="userSpaceOnUse"
+ r="18.214285"
+ fy="23.071428"
+ fx="25.785715"
+ cy="23.071428"
+ cx="25.785715"
+ id="radialGradient11270"
+ xlink:href="#linearGradient11264"
+ inkscape:collect="always" />
+ <linearGradient
+ gradientUnits="userSpaceOnUse"
+ y2="8.5882788"
+ x2="25.785715"
+ y1="21.978363"
+ x1="25.785715"
+ id="linearGradient4755"
+ xlink:href="#linearGradient4749"
+ inkscape:collect="always" />
+ </defs>
+ <sodipodi:namedview
+ inkscape:window-y="423"
+ inkscape:window-x="840"
+ inkscape:window-height="606"
+ inkscape:window-width="750"
+ stroke="#555753"
+ fill="#edd400"
+ inkscape:showpageshadow="false"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ showgrid="false"
+ inkscape:current-layer="layer1"
+ inkscape:cy="-10.815272"
+ inkscape:cx="85.353158"
+ inkscape:zoom="1"
+ inkscape:pageshadow="2"
+ inkscape:pageopacity="0.0"
+ borderopacity="0.32941176"
+ bordercolor="#666666"
+ pagecolor="#ffffff"
+ id="base"
+ showguides="true"
+ inkscape:guide-bbox="true" />
+ <metadata
+ id="metadata4">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title>Shutdown</dc:title>
+ <dc:creator>
+ <cc:Agent>
+ <dc:title>Jakub Steiner</dc:title>
+ </cc:Agent>
+ </dc:creator>
+ <cc:license
+ rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" />
+ <dc:source>http://jimmac.musichall.cz</dc:source>
+ <dc:subject>
+ <rdf:Bag>
+ <rdf:li>lock</rdf:li>
+ <rdf:li>key</rdf:li>
+ <rdf:li>secure</rdf:li>
+ </rdf:Bag>
+ </dc:subject>
+ </cc:Work>
+ <cc:License
+ rdf:about="http://creativecommons.org/licenses/GPL/2.0/">
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Reproduction" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/Distribution" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/Notice" />
+ <cc:permits
+ rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/ShareAlike" />
+ <cc:requires
+ rdf:resource="http://web.resource.org/cc/SourceCode" />
+ </cc:License>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ inkscape:label="Layer 1"
+ id="layer1">
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;color:#000000;fill:url(#radialGradient11270);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.8505457;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path11262"
+ sodipodi:cx="25.785715"
+ sodipodi:cy="23.071428"
+ sodipodi:rx="18.214285"
+ sodipodi:ry="18.214285"
+ d="M 44 23.071428 A 18.214285 18.214285 0 1 1 7.5714302,23.071428 A 18.214285 18.214285 0 1 1 44 23.071428 z"
+ transform="matrix(1.269833,0,0,1.269833,-9.24356,-4.225444)" />
+ <path
+ transform="matrix(1.175715,0,0,1.175715,-6.816669,-3.911156)"
+ d="M 44 23.071428 A 18.214285 18.214285 0 1 1 7.5714302,23.071428 A 18.214285 18.214285 0 1 1 44 23.071428 z"
+ sodipodi:ry="18.214285"
+ sodipodi:rx="18.214285"
+ sodipodi:cy="23.071428"
+ sodipodi:cx="25.785715"
+ id="path11152"
+ style="opacity:1;color:#000000;fill:url(#linearGradient11170);fill-opacity:1;fill-rule:evenodd;stroke:#74796e;stroke-width:0.8505457;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;color:#000000;fill:url(#radialGradient11234);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.93590021;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ id="path11154"
+ sodipodi:cx="25.785715"
+ sodipodi:cy="23.071428"
+ sodipodi:rx="18.214285"
+ sodipodi:ry="18.214285"
+ d="M 44 23.071428 A 18.214285 18.214285 0 1 1 7.5714302,23.071428 A 18.214285 18.214285 0 1 1 44 23.071428 z"
+ transform="matrix(1.06849,0,0,1.06849,-4.051771,-2.437299)" />
+ <path
+ sodipodi:nodetypes="czs"
+ id="path4743"
+ d="M 19.1468,14.674063 C 12.154448,18.486901 15.316371,29.412893 23.310313,29.412893 C 31.220984,29.412893 34.766419,19.054547 27.473824,14.674063"
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ id="path4745"
+ d="M 23.364832,19.364034 L 23.364832,11.95091"
+ style="opacity:1;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:2.99999905;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
+ <path
+ transform="matrix(1.04555,0,0,1.04555,-3.460245,-1.908039)"
+ d="M 44 23.071428 A 18.214285 18.214285 0 1 1 7.5714302,23.071428 A 18.214285 18.214285 0 1 1 44 23.071428 z"
+ sodipodi:ry="18.214285"
+ sodipodi:rx="18.214285"
+ sodipodi:cy="23.071428"
+ sodipodi:cx="25.785715"
+ id="path4747"
+ style="opacity:0.88235294;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient4755);stroke-width:0.95643449;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
+ sodipodi:type="arc" />
+ </g>
+</svg>
diff --git a/debian/changelog b/debian/changelog
index 8081ae0..4d030d8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,23 @@
-indicator-session (0.1.6-0ubuntu2) UNRELEASED; urgency=low
+indicator-session (0.1.7-0ubuntu1) UNRELEASED; urgency=low
+
+ * Upstream release 0.1.7
+ * 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)
+ * Also fixes by happenstance: (LP: #444170 and LP: #437065)
+ * 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)
+ * Asynchronized the menu handling so that it's in the right
+ order with async startup. (LP: #440484)
+ * String change, "New Session" to "Switch User" (LP: #444494)
+ * Removed debian/patches/switch_user_lp-444494.patch
+
+ -- Ted Gould <ted@ubuntu.com> Thu, 08 Oct 2009 11:12:07 -0400
+
+indicator-session (0.1.6-0ubuntu2) karmic; urgency=low
* debian/patches/switch_user_lp-444494.patch
- String change, "New Session" to "Switch User" (LP: #444494)
diff --git a/debian/patches/switch_user_lp-444494.patch b/debian/patches/switch_user_lp-444494.patch
deleted file mode 100644
index 6c4bdf8..0000000
--- a/debian/patches/switch_user_lp-444494.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-=== modified file 'src/users-service.c'
---- src/users-service.c 2009-09-30 02:03:36 +0000
-+++ src/users-service.c 2009-10-05 20:38:14 +0000
-@@ -342,7 +342,7 @@
- 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);
- }
-
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/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]));
diff --git a/src/indicator-session.c b/src/indicator-session.c
index a4bb5e1..c22aa1c 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -76,18 +76,60 @@ 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-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;
}
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;
diff --git a/src/lock-helper.c b/src/lock-helper.c
new file mode 100644
index 0000000..0bdec6c
--- /dev/null
+++ b/src/lock-helper.c
@@ -0,0 +1,326 @@
+/*
+A small helper for locking the screen.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <dbus/dbus-glib.h>
+#include "lock-helper.h"
+
+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;
+static const gchar * gdm_auto_login_string = "daemon/AutomaticLoginEnable";
+
+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, "Session Menu",
+ G_TYPE_STRING, reason,
+ G_TYPE_INVALID);
+
+ return;
+}
+
+/* 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
+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;
+}
+
+/* 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
+lock_screen (DbusmenuMenuitem * mi, gpointer data)
+{
+ g_debug("Lock Screen");
+ if (!will_lock_screen()) {
+ g_debug("\tGDM set to autologin, blocking lock");
+ return;
+ }
+
+ g_return_if_fail(gss_proxy != NULL);
+
+ dbus_g_proxy_call_no_reply(gss_proxy,
+ "Lock",
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
+
+ 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)
+{
+ if (!g_strcmp0(g_get_user_name(), "guest")) {
+ is_guest = TRUE;
+ }
+
+ build_gdm_proxy();
+ build_gss_proxy();
+
+ return FALSE;
+}
+
diff --git a/src/lock-helper.h b/src/lock-helper.h
new file mode 100644
index 0000000..b4a382e
--- /dev/null
+++ b/src/lock-helper.h
@@ -0,0 +1,37 @@
+/*
+A small helper for locking the screen.
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef LOCK_HELPER_H__
+#define LOCK_HELPER_H__
+
+#include <libdbusmenu-glib/menuitem.h>
+
+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);
+void lock_screen_gdm_cb_set (gdm_autologin_cb_t cb);
+
+#endif /* LOCK_HELPER_H__ */
diff --git a/src/session-service.c b/src/session-service.c
index 0242b17..a4240be 100644
--- a/src/session-service.c
+++ b/src/session-service.c
@@ -35,6 +35,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#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;
@@ -57,120 +55,12 @@ static DbusmenuMenuitem * logout_mi = NULL;
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. */
+/* A return from the command to sleep the system. Make sure
+ that we unthrottle the screensaver. */
static void
-gdm_settings_change (DBusGProxy * proxy, const gchar * value, const gchar * old, const gchar * new, gpointer data)
+sleep_response (DBusGProxy * proxy, DBusGProxyCall * call, 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);
-
+ screensaver_unthrottle();
return;
}
@@ -185,12 +75,15 @@ sleep (DbusmenuMenuitem * mi, gpointer userdata)
g_warning("Can not %s as no DeviceKit Power Proxy", type);
}
- lock_screen();
+ 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;
}
@@ -427,7 +320,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));
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], "");
diff --git a/src/status-service.c b/src/status-service.c
index a448ada..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 */"user-offline"
+ /* STATUS_PROVIDER_STATUS_DISCONNECTED */"system-shutdown-panel"
};
diff --git a/src/users-service.c b/src/users-service.c
index 9877ba6..b4310da 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,11 +55,6 @@ 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;
@@ -66,96 +62,17 @@ static GList *users;
/* 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 (void)
{
- 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 (!will_lock_screen()) {
+ 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;
-}
-
static gboolean
check_guest_session (void)
{
@@ -222,37 +139,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 +178,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");
@@ -342,7 +228,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);
}
@@ -410,11 +296,8 @@ 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);
+ lock_screen_gdm_cb_set(gdm_settings_change);
dbus_interface = g_object_new (USERS_SERVICE_DBUS_TYPE, NULL);