[gdm-list] [PATCH 2/3] Support per-applet GConf key "lock_screen_after_switch"
- From: Dan Nicholson <dbn lists gmail com>
- To: gdm-list gnome org
- Subject: [gdm-list] [PATCH 2/3] Support per-applet GConf key "lock_screen_after_switch"
- Date: Sun, 12 Oct 2008 16:46:30 -0700
Ports code from fast-user-switch-applet to support per-applet GConf
keys. The key "lock_screen_after_switch" has been added to control
whether the current session is locked when switching to another session.
---
ChangeLog | 9 +++++++
gui/user-switch-applet/Makefile.am | 26 ++++++++++++++++++++
gui/user-switch-applet/applet.c | 15 +++++++++--
.../gdm-user-switch-applet.schemas.in | 16 ++++++++++++
4 files changed, 63 insertions(+), 3 deletions(-)
create mode 100644 gui/user-switch-applet/gdm-user-switch-applet.schemas.in
diff --git a/ChangeLog b/ChangeLog
index 514198d..b04c234 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2008-10-12 Dan Nicholson <dbn lists gmail com>
+ * gui/user-switch-applet/applet.c (do_switch), (fill_applet):
+ Register per-applet GConf keys. Check for
+ "lock_screen_after_switch" GConf key before locking the screen.
+ * gui/user-switch-applet/Makefile.am:
+ * gui/user-switch-applet/gdm-user-switch-applet.schemas.in:
+ Support per-applet GConf keys.
+
+2008-10-12 Dan Nicholson <dbn lists gmail com>
+
* gui/simple-greeter/gdm-user-manager.c
(gdm_user_manager_goto_login_session), (start_new_login_session):
* gui/simple-greeter/gdm-user-manager.h:
diff --git a/gui/user-switch-applet/Makefile.am b/gui/user-switch-applet/Makefile.am
index a7f8042..a14b08d 100644
--- a/gui/user-switch-applet/Makefile.am
+++ b/gui/user-switch-applet/Makefile.am
@@ -49,9 +49,35 @@ $(server_in_files): $(server_in_files:.server.in=.server.in.in)
@INTLTOOL_SERVER_RULE@
+# GConf Schema
+schemadir = \
+ $(GCONF_SCHEMA_FILE_DIR) \
+ $(NULL)
+schema_in_files = \
+ gdm-user-switch-applet.schemas.in \
+ $(NULL)
+schema_DATA = $(schema_in_files:.schemas.in=.schemas)
+
+if GCONF_SCHEMAS_INSTALL
+# don't do this if we are building in eg. rpm
+install-data-local:
+ if test -z "$(DESTDIR)" ; then \
+ for p in $(schema_DATA) ; do \
+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \
+ $(GCONFTOOL) --makefile-install-rule \
+ $(builddir)/$$p || exit 1 ; \
+ done ; \
+ fi
+else
+install-data-local:
+endif
+
+ INTLTOOL_SCHEMAS_RULE@
+
EXTRA_DIST = \
$(ui_DATA) \
GNOME_FastUserSwitchApplet.server.in.in \
+ $(schema_in_files) \
$(NULL)
DISTCLEANFILES = \
diff --git a/gui/user-switch-applet/applet.c b/gui/user-switch-applet/applet.c
index 92fc6f3..2a5ab3b 100644
--- a/gui/user-switch-applet/applet.c
+++ b/gui/user-switch-applet/applet.c
@@ -42,6 +42,9 @@
#include "gdm-user-manager.h"
#include "gdm-user-menu-item.h"
+#define SCHEMA_DIR "/schemas/apps/gdm-user-switch-applet/per-applet"
+#define LOCK_KEY "lock_screen_after_switch"
+
#define LOCKDOWN_DIR "/desktop/gnome/lockdown"
#define LOCKDOWN_KEY LOCKDOWN_DIR "/disable_user_switching"
@@ -814,11 +817,14 @@ do_switch (GdmAppletData *adata,
GdmUser *user)
{
guint num_sessions;
+ gboolean lock;
g_debug ("Do user switch");
+ lock = panel_applet_gconf_get_bool (adata->applet, LOCK_KEY, NULL);
+
if (user == NULL) {
- gdm_user_manager_goto_login_session (adata->manager, TRUE);
+ gdm_user_manager_goto_login_session (adata->manager, lock);
goto out;
}
@@ -826,10 +832,11 @@ do_switch (GdmAppletData *adata,
if (num_sessions > 0) {
switch_to_user_session (adata, user);
} else {
- gdm_user_manager_goto_login_session (adata->manager, TRUE);
+ gdm_user_manager_goto_login_session (adata->manager, lock);
}
out:
- maybe_lock_screen (adata);
+ if (lock)
+ maybe_lock_screen (adata);
}
static void
@@ -1225,6 +1232,8 @@ fill_applet (PanelApplet *applet)
g_free (tmp);
}
+ panel_applet_add_preferences (applet, SCHEMA_DIR, NULL);
+
g_signal_connect (adata->applet,
"style-set",
G_CALLBACK (applet_style_set_cb), adata);
diff --git a/gui/user-switch-applet/gdm-user-switch-applet.schemas.in b/gui/user-switch-applet/gdm-user-switch-applet.schemas.in
new file mode 100644
index 0000000..9b3f37a
--- /dev/null
+++ b/gui/user-switch-applet/gdm-user-switch-applet.schemas.in
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<gconfschemafile>
+ <schemalist>
+ <schema>
+ <key>/schemas/apps/gdm-user-switch-applet/per-applet/lock_screen_after_switch</key>
+ <owner>gdm-user-switch-applet</owner>
+ <type>bool</type>
+ <default>TRUE</default>
+ <locale name="C">
+ <short>Lock Screen After Switch</short>
+ <long>Whether or not to lock the screen after switching to a different
+ console.</long>
+ </locale>
+ </schema>
+ </schemalist>
+</gconfschemafile>
--
1.5.5.1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]