Merge lp:~ted/indicator-session/gsettings-port into lp:indicator-session/0.1
- gsettings-port
- Merge into trunk
Proposed by
Ted Gould
Status: | Merged |
---|---|
Merged at revision: | 180 |
Proposed branch: | lp:~ted/indicator-session/gsettings-port |
Merge into: | lp:indicator-session/0.1 |
Diff against target: |
730 lines (+148/-225) 13 files modified
.bzrignore (+4/-1) configure.ac (+2/-10) data/Makefile.am (+11/-26) data/com.canonical.indicator.session.gschema.xml.in (+24/-0) data/indicator-session.convert (+5/-0) data/indicator-session.schemas.in (+0/-50) po/POTFILES.in (+2/-2) src/Makefile.am (+4/-4) src/device-menu-mgr.c (+30/-45) src/gtk-logout-helper.c (+1/-1) src/settings-helper.c (+43/-61) src/settings-helper.h (+11/-13) src/user-menu-mgr.c (+11/-12) |
To merge this branch: | bzr merge lp:~ted/indicator-session/gsettings-port |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Conor Curran (community) | Approve | ||
Review via email: mp+72254@code.launchpad.net |
Commit message
Description of the change
GSettings port. I've updated the ubuntu branch with this branch so it can be tested easier.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2011-08-10 17:11:27 +0000 | |||
3 | +++ .bzrignore 2011-08-19 20:18:25 +0000 | |||
4 | @@ -1,6 +1,6 @@ | |||
5 | 1 | compile | 1 | compile |
6 | 2 | m4 | 2 | m4 |
8 | 3 | po | 3 | po/indicator-session.pot |
9 | 4 | src/libmessaging.la | 4 | src/libmessaging.la |
10 | 5 | src/libmessaging_la-indicator-messages.lo | 5 | src/libmessaging_la-indicator-messages.lo |
11 | 6 | config.guess.cdbs-orig | 6 | config.guess.cdbs-orig |
12 | @@ -199,3 +199,6 @@ | |||
13 | 199 | modified: | 199 | modified: |
14 | 200 | .bzrignore | 200 | .bzrignore |
15 | 201 | src/libsession_la-user-widget.lo | 201 | src/libsession_la-user-widget.lo |
16 | 202 | consolekit-seat-client.h | ||
17 | 203 | data/com.canonical.indicator.session.gschema.valid | ||
18 | 204 | data/com.canonical.indicator.session.gschema.xml | ||
19 | 202 | 205 | ||
20 | === modified file 'configure.ac' | |||
21 | --- configure.ac 2011-08-10 18:15:18 +0000 | |||
22 | +++ configure.ac 2011-08-19 20:18:25 +0000 | |||
23 | @@ -8,6 +8,8 @@ | |||
24 | 8 | 8 | ||
25 | 9 | AM_MAINTAINER_MODE | 9 | AM_MAINTAINER_MODE |
26 | 10 | 10 | ||
27 | 11 | GLIB_GSETTINGS | ||
28 | 12 | |||
29 | 11 | IT_PROG_INTLTOOL([0.35.0]) | 13 | IT_PROG_INTLTOOL([0.35.0]) |
30 | 12 | 14 | ||
31 | 13 | AC_ISC_POSIX | 15 | AC_ISC_POSIX |
32 | @@ -89,16 +91,6 @@ | |||
33 | 89 | AC_SUBST(GTKLOGOUTHELPER_CFLAGS) | 91 | AC_SUBST(GTKLOGOUTHELPER_CFLAGS) |
34 | 90 | AC_SUBST(GTKLOGOUTHELPER_LIBS) | 92 | AC_SUBST(GTKLOGOUTHELPER_LIBS) |
35 | 91 | 93 | ||
36 | 92 | AC_PATH_PROG(GCONFTOOL, gconftool-2) | ||
37 | 93 | dnl Specify the gconf configuration source, | ||
38 | 94 | dnl default to xml::$(sysconfdir)/gconf/gconf.xml.defaults | ||
39 | 95 | |||
40 | 96 | AM_GCONF_SOURCE_2 | ||
41 | 97 | |||
42 | 98 | PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.0) | ||
43 | 99 | AC_SUBST(GCONF_CFLAGS) | ||
44 | 100 | AC_SUBST(GCONF_LIBS) | ||
45 | 101 | |||
46 | 102 | ########################### | 94 | ########################### |
47 | 103 | # Check to see if we're local | 95 | # Check to see if we're local |
48 | 104 | ########################### | 96 | ########################### |
49 | 105 | 97 | ||
50 | === modified file 'data/Makefile.am' | |||
51 | --- data/Makefile.am 2011-05-11 22:22:21 +0000 | |||
52 | +++ data/Makefile.am 2011-08-19 20:18:25 +0000 | |||
53 | @@ -9,37 +9,22 @@ | |||
54 | 9 | %.service: %.service.in | 9 | %.service: %.service.in |
55 | 10 | sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ | 10 | sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ |
56 | 11 | 11 | ||
57 | 12 | ############################## | ||
58 | 13 | # GConf Schema | ||
59 | 14 | ############################## | ||
60 | 15 | |||
61 | 16 | schemadir = \ | ||
62 | 17 | $(GCONF_SCHEMA_FILE_DIR) | ||
63 | 18 | |||
64 | 19 | schema_in_files = \ | ||
65 | 20 | indicator-session.schemas.in | ||
66 | 21 | |||
67 | 22 | schema_DATA = \ | ||
68 | 23 | $(schema_in_files:.schemas.in=.schemas) | ||
69 | 24 | |||
70 | 25 | @INTLTOOL_SCHEMAS_RULE@ | 12 | @INTLTOOL_SCHEMAS_RULE@ |
75 | 26 | 13 | @INTLTOOL_XML_NOMERGE_RULE@ | |
76 | 27 | 14 | ||
77 | 28 | #$(dbus_services_DATA): $(service_in_files) Makefile | 15 | @GSETTINGS_RULES@ |
78 | 29 | # sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@ | 16 | gsettings_SCHEMAS = com.canonical.indicator.session.gschema.xml |
79 | 17 | |||
80 | 18 | convertdir = $(datadir)/GConf/gsettings | ||
81 | 19 | dist_convert_DATA = indicator-session.convert | ||
82 | 20 | |||
83 | 30 | 21 | ||
84 | 31 | EXTRA_DIST = \ | 22 | EXTRA_DIST = \ |
85 | 32 | $(service_in_files) \ | 23 | $(service_in_files) \ |
87 | 33 | $(schema_in_files) | 24 | $(gsettings_SCHEMAS:.xml=.xml.in) |
88 | 25 | |||
89 | 34 | 26 | ||
90 | 35 | CLEANFILES = \ | 27 | CLEANFILES = \ |
91 | 36 | $(dbus_services_DATA) \ | 28 | $(dbus_services_DATA) \ |
93 | 37 | $(schema_DATA) | 29 | $(gsettings_SCHEMAS) |
94 | 38 | 30 | ||
95 | 39 | if GCONF_SCHEMAS_INSTALL | ||
96 | 40 | install-data-local: | ||
97 | 41 | GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) \ | ||
98 | 42 | gconftool-2 --makefile-install-rule $(schema_DATA) | ||
99 | 43 | else | ||
100 | 44 | install-data-local: | ||
101 | 45 | endif | ||
102 | 46 | 31 | ||
103 | === added file 'data/com.canonical.indicator.session.gschema.xml.in' | |||
104 | --- data/com.canonical.indicator.session.gschema.xml.in 1970-01-01 00:00:00 +0000 | |||
105 | +++ data/com.canonical.indicator.session.gschema.xml.in 2011-08-19 20:18:25 +0000 | |||
106 | @@ -0,0 +1,24 @@ | |||
107 | 1 | <schemalist> | ||
108 | 2 | <schema id="com.canonical.indicator.session" path="/apps/indicator-session/"> | ||
109 | 3 | <key name="suppress-logout-restart-shutdown" type="b"> | ||
110 | 4 | <default>false</default> | ||
111 | 5 | <_summary>Suppress the dialog to confirm logout, restart and shutdown action</_summary> | ||
112 | 6 | <_description>Whether or not to show confirmation dialogs for logout, restart and shutdown actions.</_description> | ||
113 | 7 | </key> | ||
114 | 8 | <key name="suppress-logout-menuitem" type="b"> | ||
115 | 9 | <default>false</default> | ||
116 | 10 | <_summary>Remove the Log Out item from the session menu</_summary> | ||
117 | 11 | <_description>Makes it so that the logout button doesn't show in the session menu.</_description> | ||
118 | 12 | </key> | ||
119 | 13 | <key name="suppress-restart-menuitem" type="b"> | ||
120 | 14 | <default>false</default> | ||
121 | 15 | <_summary>Remove the Restart item from the session menu</_summary> | ||
122 | 16 | <_description>Makes it so that the restart button doesn't show in the session menu.</_description> | ||
123 | 17 | </key> | ||
124 | 18 | <key name="suppress-shutdown-menuitem" type="b"> | ||
125 | 19 | <default>false</default> | ||
126 | 20 | <_summary>Remove the shutdown item from the session menu</_summary> | ||
127 | 21 | <_description>Makes it so that the shutdown button doesn't show in the session menu.</_description> | ||
128 | 22 | </key> | ||
129 | 23 | </schema> | ||
130 | 24 | </schemalist> | ||
131 | 0 | 25 | ||
132 | === added file 'data/indicator-session.convert' | |||
133 | --- data/indicator-session.convert 1970-01-01 00:00:00 +0000 | |||
134 | +++ data/indicator-session.convert 2011-08-19 20:18:25 +0000 | |||
135 | @@ -0,0 +1,5 @@ | |||
136 | 1 | [com.canonical.indicator.session] | ||
137 | 2 | suppress_logout_restart_shutdown = /apps/indicator-session/suppress_logout_restart_shutdown | ||
138 | 3 | suppress_logout_menuitem = /apps/indicator-session/suppress_logout_menuitem | ||
139 | 4 | suppress_restart_menuitem = /apps/indicator-session/suppress_restart_menuitem | ||
140 | 5 | suppress_shutdown_menuitem = /apps/indicator-session/suppress_shutdown_menuitem | ||
141 | 0 | 6 | ||
142 | === removed file 'data/indicator-session.schemas.in' | |||
143 | --- data/indicator-session.schemas.in 2010-04-06 21:56:04 +0000 | |||
144 | +++ data/indicator-session.schemas.in 1970-01-01 00:00:00 +0000 | |||
145 | @@ -1,50 +0,0 @@ | |||
146 | 1 | <?xml version="1.0"?> | ||
147 | 2 | <gconfschemafile> | ||
148 | 3 | <schemalist> | ||
149 | 4 | <schema> | ||
150 | 5 | <key>/schemas/apps/indicator-session/suppress_logout_restart_shutdown</key> | ||
151 | 6 | <applyto>/apps/indicator-session/suppress_logout_restart_shutdown</applyto> | ||
152 | 7 | <owner>indicator-session</owner> | ||
153 | 8 | <type>bool</type> | ||
154 | 9 | <default>FALSE</default> | ||
155 | 10 | <locale name="C"> | ||
156 | 11 | <short>Suppress the dialog to confirm logout, restart and shutdown action</short> | ||
157 | 12 | <long>Whether or not to show confirmation dialogs for logout, | ||
158 | 13 | restart and shutdown actions.</long> | ||
159 | 14 | </locale> | ||
160 | 15 | </schema> | ||
161 | 16 | <schema> | ||
162 | 17 | <key>/schemas/apps/indicator-session/suppress_logout_menuitem</key> | ||
163 | 18 | <applyto>/apps/indicator-session/suppress_logout_menuitem</applyto> | ||
164 | 19 | <owner>indicator-session</owner> | ||
165 | 20 | <type>bool</type> | ||
166 | 21 | <default>FALSE</default> | ||
167 | 22 | <locale name="C"> | ||
168 | 23 | <short>Remove the Log Out item from the session menu</short> | ||
169 | 24 | <long>Makes it so that the logout button doesn't show in the session menu.</long> | ||
170 | 25 | </locale> | ||
171 | 26 | </schema> | ||
172 | 27 | <schema> | ||
173 | 28 | <key>/schemas/apps/indicator-session/suppress_restart_menuitem</key> | ||
174 | 29 | <applyto>/apps/indicator-session/suppress_restart_menuitem</applyto> | ||
175 | 30 | <owner>indicator-session</owner> | ||
176 | 31 | <type>bool</type> | ||
177 | 32 | <default>FALSE</default> | ||
178 | 33 | <locale name="C"> | ||
179 | 34 | <short>Remove the Restart item from the session menu</short> | ||
180 | 35 | <long>Makes it so that the restart button doesn't show in the session menu.</long> | ||
181 | 36 | </locale> | ||
182 | 37 | </schema> | ||
183 | 38 | <schema> | ||
184 | 39 | <key>/schemas/apps/indicator-session/suppress_shutdown_menuitem</key> | ||
185 | 40 | <applyto>/apps/indicator-session/suppress_shutdown_menuitem</applyto> | ||
186 | 41 | <owner>indicator-session</owner> | ||
187 | 42 | <type>bool</type> | ||
188 | 43 | <default>FALSE</default> | ||
189 | 44 | <locale name="C"> | ||
190 | 45 | <short>Remove the shutdown item from the session menu</short> | ||
191 | 46 | <long>Makes it so that the shutdown button doesn't show in the session menu.</long> | ||
192 | 47 | </locale> | ||
193 | 48 | </schema> | ||
194 | 49 | </schemalist> | ||
195 | 50 | </gconfschemafile> | ||
196 | 51 | 0 | ||
197 | === modified file 'po/POTFILES.in' | |||
198 | --- po/POTFILES.in 2011-07-22 17:12:20 +0000 | |||
199 | +++ po/POTFILES.in 2011-08-19 20:18:25 +0000 | |||
200 | @@ -1,7 +1,7 @@ | |||
201 | 1 | [encoding: UTF-8] | 1 | [encoding: UTF-8] |
203 | 2 | data/indicator-session.schemas.in | 2 | data/com.canonical.indicator.session.gschema.xml.in |
204 | 3 | data/extra-sessions/classic-desktop.desktop.in.in | 3 | data/extra-sessions/classic-desktop.desktop.in.in |
206 | 4 | src/gconf-helper.c | 4 | src/settings-helper.c |
207 | 5 | src/lock-helper.c | 5 | src/lock-helper.c |
208 | 6 | src/gtk-logout-helper.c | 6 | src/gtk-logout-helper.c |
209 | 7 | src/dialog.c | 7 | src/dialog.c |
210 | 8 | 8 | ||
211 | === modified file 'src/Makefile.am' | |||
212 | --- src/Makefile.am 2011-08-17 20:53:51 +0000 | |||
213 | +++ src/Makefile.am 2011-08-19 20:18:25 +0000 | |||
214 | @@ -96,11 +96,11 @@ | |||
215 | 96 | session-dbus.h \ | 96 | session-dbus.h \ |
216 | 97 | gen-session-dbus.xml.c \ | 97 | gen-session-dbus.xml.c \ |
217 | 98 | dbusmenu-shared.h \ | 98 | dbusmenu-shared.h \ |
219 | 99 | gconf-helper.c \ | 99 | settings-helper.c \ |
220 | 100 | users-service-dbus.h \ | 100 | users-service-dbus.h \ |
221 | 101 | users-service-dbus.c \ | 101 | users-service-dbus.c \ |
222 | 102 | user-menu-mgr.h \ | 102 | user-menu-mgr.h \ |
224 | 103 | user-menu-mgr.c \ | 103 | user-menu-mgr.c \ |
225 | 104 | device-menu-mgr.h \ | 104 | device-menu-mgr.h \ |
226 | 105 | device-menu-mgr.c \ | 105 | device-menu-mgr.c \ |
227 | 106 | apt-watcher.h \ | 106 | apt-watcher.h \ |
228 | @@ -126,8 +126,8 @@ | |||
229 | 126 | 126 | ||
230 | 127 | gtk_logout_helper_SOURCES = \ | 127 | gtk_logout_helper_SOURCES = \ |
231 | 128 | gtk-logout-helper.c \ | 128 | gtk-logout-helper.c \ |
234 | 129 | gconf-helper.c \ | 129 | settings-helper.c \ |
235 | 130 | gconf-helper.h \ | 130 | settings-helper.h \ |
236 | 131 | dialog.c \ | 131 | dialog.c \ |
237 | 132 | dialog.h | 132 | dialog.h |
238 | 133 | 133 | ||
239 | 134 | 134 | ||
240 | === modified file 'src/device-menu-mgr.c' | |||
241 | --- src/device-menu-mgr.c 2011-08-18 15:21:02 +0000 | |||
242 | +++ src/device-menu-mgr.c 2011-08-19 20:18:25 +0000 | |||
243 | @@ -21,7 +21,7 @@ | |||
244 | 21 | #include <libdbusmenu-gtk3/menuitem.h> | 21 | #include <libdbusmenu-gtk3/menuitem.h> |
245 | 22 | 22 | ||
246 | 23 | #include "device-menu-mgr.h" | 23 | #include "device-menu-mgr.h" |
248 | 24 | #include "gconf-helper.h" | 24 | #include "settings-helper.h" |
249 | 25 | #include "dbus-shared-names.h" | 25 | #include "dbus-shared-names.h" |
250 | 26 | #include "dbusmenu-shared.h" | 26 | #include "dbusmenu-shared.h" |
251 | 27 | #include "lock-helper.h" | 27 | #include "lock-helper.h" |
252 | @@ -44,7 +44,8 @@ | |||
253 | 44 | UdevMgr* udev_mgr; | 44 | UdevMgr* udev_mgr; |
254 | 45 | }; | 45 | }; |
255 | 46 | 46 | ||
257 | 47 | static GConfClient *gconf_client = NULL; | 47 | static GSettings *lockdown_settings = NULL; |
258 | 48 | static GSettings *keybinding_settings = NULL; | ||
259 | 48 | static DbusmenuMenuitem *lock_menuitem = NULL; | 49 | static DbusmenuMenuitem *lock_menuitem = NULL; |
260 | 49 | static DbusmenuMenuitem *system_settings_menuitem = NULL; | 50 | static DbusmenuMenuitem *system_settings_menuitem = NULL; |
261 | 50 | static DbusmenuMenuitem *display_settings_menuitem = NULL; | 51 | static DbusmenuMenuitem *display_settings_menuitem = NULL; |
262 | @@ -72,7 +73,7 @@ | |||
263 | 72 | static DBusGProxy * up_main_proxy = NULL; | 73 | static DBusGProxy * up_main_proxy = NULL; |
264 | 73 | static DBusGProxy * up_prop_proxy = NULL; | 74 | static DBusGProxy * up_prop_proxy = NULL; |
265 | 74 | 75 | ||
267 | 75 | static void device_menu_mgr_ensure_gconf_client (DeviceMenuMgr* self); | 76 | static void device_menu_mgr_ensure_settings_client (DeviceMenuMgr* self); |
268 | 76 | static void setup_restart_watch (DeviceMenuMgr* self); | 77 | static void setup_restart_watch (DeviceMenuMgr* self); |
269 | 77 | static void setup_up (DeviceMenuMgr* self); | 78 | static void setup_up (DeviceMenuMgr* self); |
270 | 78 | static void device_menu_mgr_rebuild_items (DeviceMenuMgr *self); | 79 | static void device_menu_mgr_rebuild_items (DeviceMenuMgr *self); |
271 | @@ -128,21 +129,18 @@ | |||
272 | 128 | // TODO | 129 | // TODO |
273 | 129 | // Is this needed anymore | 130 | // Is this needed anymore |
274 | 130 | static void | 131 | static void |
278 | 131 | lockdown_changed (GConfClient *client, | 132 | lockdown_changed (GSettings * settings, |
279 | 132 | guint cnxd_id, | 133 | const gchar * key, |
277 | 133 | GConfEntry *entry, | ||
280 | 134 | gpointer user_data) | 134 | gpointer user_data) |
281 | 135 | { | 135 | { |
285 | 136 | DeviceMenuMgr* self = DEVICE_MENU_MGR (user_data); | 136 | DeviceMenuMgr* self = DEVICE_MENU_MGR (user_data); |
283 | 137 | GConfValue *value = gconf_entry_get_value (entry); | ||
284 | 138 | const gchar *key = gconf_entry_get_key (entry); | ||
286 | 139 | 137 | ||
288 | 140 | if (value == NULL || key == NULL) { | 138 | if (key == NULL) { |
289 | 141 | return; | 139 | return; |
290 | 142 | } | 140 | } |
291 | 143 | 141 | ||
292 | 144 | if (g_strcmp0 (key, LOCKDOWN_KEY_USER) == 0 || | 142 | if (g_strcmp0 (key, LOCKDOWN_KEY_USER) == 0 || |
294 | 145 | g_strcmp0 (key, LOCKDOWN_KEY_SCREENSAVER) == 0) { | 143 | g_strcmp0 (key, LOCKDOWN_KEY_SCREENSAVER) == 0) { |
295 | 146 | device_menu_mgr_rebuild_items(self); | 144 | device_menu_mgr_rebuild_items(self); |
296 | 147 | } | 145 | } |
297 | 148 | 146 | ||
298 | @@ -150,23 +148,19 @@ | |||
299 | 150 | } | 148 | } |
300 | 151 | 149 | ||
301 | 152 | static void | 150 | static void |
305 | 153 | keybinding_changed (GConfClient *client, | 151 | keybinding_changed (GSettings *settings, |
306 | 154 | guint cnxd_id, | 152 | const gchar *key, |
304 | 155 | GConfEntry *entry, | ||
307 | 156 | gpointer user_data) | 153 | gpointer user_data) |
308 | 157 | { | 154 | { |
313 | 158 | GConfValue *value = gconf_entry_get_value (entry); | 155 | if (key == NULL) { |
310 | 159 | const gchar *key = gconf_entry_get_key (entry); | ||
311 | 160 | |||
312 | 161 | if (value == NULL || key == NULL) { | ||
314 | 162 | return; | 156 | return; |
315 | 163 | } | 157 | } |
316 | 164 | 158 | ||
317 | 165 | if (g_strcmp0 (key, KEY_LOCK_SCREEN) == 0) { | 159 | if (g_strcmp0 (key, KEY_LOCK_SCREEN) == 0) { |
319 | 166 | g_debug("Keybinding changed to: %s", gconf_value_get_string(value)); | 160 | g_debug("Keybinding changed to: %s", g_settings_get_string(settings, key)); |
320 | 167 | if (lock_menuitem != NULL) { | 161 | if (lock_menuitem != NULL) { |
321 | 168 | dbusmenu_menuitem_property_set_shortcut_string (lock_menuitem, | 162 | dbusmenu_menuitem_property_set_shortcut_string (lock_menuitem, |
323 | 169 | gconf_value_get_string(value)); | 163 | g_settings_get_string(settings, key)); |
324 | 170 | } | 164 | } |
325 | 171 | } | 165 | } |
326 | 172 | return; | 166 | return; |
327 | @@ -176,9 +170,9 @@ | |||
328 | 176 | locking the screen. If not, lock it. */ | 170 | locking the screen. If not, lock it. */ |
329 | 177 | static void | 171 | static void |
330 | 178 | lock_if_possible (DeviceMenuMgr* self) { | 172 | lock_if_possible (DeviceMenuMgr* self) { |
332 | 179 | device_menu_mgr_ensure_gconf_client (self); | 173 | device_menu_mgr_ensure_settings_client (self); |
333 | 180 | 174 | ||
335 | 181 | if (!gconf_client_get_bool (gconf_client, LOCKDOWN_KEY_SCREENSAVER, NULL)) { | 175 | if (!g_settings_get_boolean (lockdown_settings, LOCKDOWN_KEY_SCREENSAVER)) { |
336 | 182 | lock_screen (NULL, 0, NULL); | 176 | lock_screen (NULL, 0, NULL); |
337 | 183 | } | 177 | } |
338 | 184 | return; | 178 | return; |
339 | @@ -659,10 +653,9 @@ | |||
340 | 659 | 653 | ||
341 | 660 | /* Make sure we have a valid GConf client, and build one | 654 | /* Make sure we have a valid GConf client, and build one |
342 | 661 | if needed */ | 655 | if needed */ |
347 | 662 | device_menu_mgr_ensure_gconf_client (self); | 656 | device_menu_mgr_ensure_settings_client (self); |
348 | 663 | can_lockscreen = !gconf_client_get_bool ( gconf_client, | 657 | can_lockscreen = !g_settings_get_boolean (lockdown_settings, |
349 | 664 | LOCKDOWN_KEY_SCREENSAVER, | 658 | LOCKDOWN_KEY_SCREENSAVER); |
346 | 665 | NULL); | ||
350 | 666 | /* Lock screen item */ | 659 | /* Lock screen item */ |
351 | 667 | if (can_lockscreen) { | 660 | if (can_lockscreen) { |
352 | 668 | lock_menuitem = dbusmenu_menuitem_new(); | 661 | lock_menuitem = dbusmenu_menuitem_new(); |
353 | @@ -670,7 +663,7 @@ | |||
354 | 670 | DBUSMENU_MENUITEM_PROP_LABEL, | 663 | DBUSMENU_MENUITEM_PROP_LABEL, |
355 | 671 | _("Lock Screen")); | 664 | _("Lock Screen")); |
356 | 672 | 665 | ||
358 | 673 | gchar * shortcut = gconf_client_get_string(gconf_client, KEY_LOCK_SCREEN, NULL); | 666 | gchar * shortcut = g_settings_get_string(keybinding_settings, KEY_LOCK_SCREEN); |
359 | 674 | if (shortcut != NULL) { | 667 | if (shortcut != NULL) { |
360 | 675 | g_debug("Lock screen shortcut: %s", shortcut); | 668 | g_debug("Lock screen shortcut: %s", shortcut); |
361 | 676 | dbusmenu_menuitem_property_set_shortcut_string(lock_menuitem, shortcut); | 669 | dbusmenu_menuitem_property_set_shortcut_string(lock_menuitem, shortcut); |
362 | @@ -830,26 +823,18 @@ | |||
363 | 830 | /* Ensures that we have a GConf client and if we build one | 823 | /* Ensures that we have a GConf client and if we build one |
364 | 831 | set up the signal handler. */ | 824 | set up the signal handler. */ |
365 | 832 | static void | 825 | static void |
367 | 833 | device_menu_mgr_ensure_gconf_client (DeviceMenuMgr* self) | 826 | device_menu_mgr_ensure_settings_client (DeviceMenuMgr* self) |
368 | 834 | { | 827 | { |
378 | 835 | if (!gconf_client) { | 828 | if (!lockdown_settings) { |
379 | 836 | gconf_client = gconf_client_get_default (); | 829 | lockdown_settings = g_settings_new (LOCKDOWN_SCHEMA); |
380 | 837 | gconf_client_add_dir(gconf_client, LOCKDOWN_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); | 830 | g_signal_connect(lockdown_settings, "changed", G_CALLBACK(lockdown_changed), self); |
381 | 838 | gconf_client_notify_add (gconf_client, | 831 | } |
382 | 839 | LOCKDOWN_DIR, | 832 | if (!keybinding_settings) { |
383 | 840 | lockdown_changed, | 833 | keybinding_settings = g_settings_new (KEYBINDING_SCHEMA); |
384 | 841 | self, | 834 | g_signal_connect(lockdown_settings, "changed::" KEY_LOCK_SCREEN, G_CALLBACK(keybinding_changed), self); |
385 | 842 | NULL, | 835 | } |
377 | 843 | NULL); | ||
386 | 844 | 836 | ||
395 | 845 | gconf_client_add_dir(gconf_client, KEYBINDING_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); | 837 | return; |
388 | 846 | gconf_client_notify_add (gconf_client, | ||
389 | 847 | KEYBINDING_DIR, | ||
390 | 848 | keybinding_changed, | ||
391 | 849 | self, | ||
392 | 850 | NULL, | ||
393 | 851 | NULL); | ||
394 | 852 | } | ||
396 | 853 | } | 838 | } |
397 | 854 | 839 | ||
398 | 855 | DbusmenuMenuitem* | 840 | DbusmenuMenuitem* |
399 | 856 | 841 | ||
400 | === modified file 'src/gtk-logout-helper.c' | |||
401 | --- src/gtk-logout-helper.c 2010-04-02 02:27:28 +0000 | |||
402 | +++ src/gtk-logout-helper.c 2011-08-19 20:18:25 +0000 | |||
403 | @@ -26,7 +26,7 @@ | |||
404 | 26 | #include <gtk/gtk.h> | 26 | #include <gtk/gtk.h> |
405 | 27 | #include <dbus/dbus-glib.h> | 27 | #include <dbus/dbus-glib.h> |
406 | 28 | #include "dialog.h" | 28 | #include "dialog.h" |
408 | 29 | #include "gconf-helper.h" | 29 | #include "settings-helper.h" |
409 | 30 | 30 | ||
410 | 31 | static void | 31 | static void |
411 | 32 | consolekit_fallback (LogoutDialogType action) | 32 | consolekit_fallback (LogoutDialogType action) |
412 | 33 | 33 | ||
413 | === renamed file 'src/gconf-helper.c' => 'src/settings-helper.c' | |||
414 | --- src/gconf-helper.c 2011-06-12 12:42:53 +0000 | |||
415 | +++ src/settings-helper.c 2011-08-19 20:18:25 +0000 | |||
416 | @@ -1,5 +1,5 @@ | |||
417 | 1 | /* | 1 | /* |
419 | 2 | A small wrapper utility for connecting to gconf. | 2 | A small wrapper utility for connecting to GSettings. |
420 | 3 | 3 | ||
421 | 4 | Copyright 2009 Canonical Ltd. | 4 | Copyright 2009 Canonical Ltd. |
422 | 5 | 5 | ||
423 | @@ -19,9 +19,7 @@ | |||
424 | 19 | with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | with this program. If not, see <http://www.gnu.org/licenses/>. |
425 | 20 | */ | 20 | */ |
426 | 21 | 21 | ||
430 | 22 | 22 | #include <gio/gio.h> | |
428 | 23 | #include <gconf/gconf-client.h> | ||
429 | 24 | |||
431 | 25 | #include <glib/gi18n.h> | 23 | #include <glib/gi18n.h> |
432 | 26 | 24 | ||
433 | 27 | #include <dbus/dbus-glib.h> | 25 | #include <dbus/dbus-glib.h> |
434 | @@ -31,53 +29,52 @@ | |||
435 | 31 | #include <libdbusmenu-glib/menuitem.h> | 29 | #include <libdbusmenu-glib/menuitem.h> |
436 | 32 | 30 | ||
437 | 33 | #include "dbus-shared-names.h" | 31 | #include "dbus-shared-names.h" |
441 | 34 | #include "gconf-helper.h" | 32 | #include "settings-helper.h" |
442 | 35 | 33 | ||
443 | 36 | static GConfClient * gconf_client = NULL; | 34 | static GSettings* settings = NULL; |
444 | 35 | |||
445 | 37 | static guint confirmation_notify = 0; | 36 | static guint confirmation_notify = 0; |
446 | 38 | static guint logout_notify = 0; | 37 | static guint logout_notify = 0; |
447 | 39 | static guint restart_notify = 0; | 38 | static guint restart_notify = 0; |
448 | 40 | static guint shutdown_notify = 0; | 39 | static guint shutdown_notify = 0; |
449 | 41 | 40 | ||
450 | 41 | static void | ||
451 | 42 | build_settings (void) { | ||
452 | 43 | if(!settings) { | ||
453 | 44 | settings = g_settings_new (SESSION_SCHEMA); | ||
454 | 45 | } | ||
455 | 46 | return; | ||
456 | 47 | } | ||
457 | 48 | |||
458 | 42 | gboolean | 49 | gboolean |
459 | 43 | supress_confirmations (void) { | 50 | supress_confirmations (void) { |
464 | 44 | if(!gconf_client) { | 51 | build_settings(); |
465 | 45 | gconf_client = gconf_client_get_default (); | 52 | return g_settings_get_boolean (settings, SUPPRESS_KEY) ; |
462 | 46 | } | ||
463 | 47 | return gconf_client_get_bool (gconf_client, SUPPRESS_KEY, NULL) ; | ||
466 | 48 | } | 53 | } |
467 | 49 | 54 | ||
468 | 50 | gboolean | 55 | gboolean |
469 | 51 | show_logout (void) { | 56 | show_logout (void) { |
474 | 52 | if(!gconf_client) { | 57 | build_settings(); |
475 | 53 | gconf_client = gconf_client_get_default (); | 58 | return !g_settings_get_boolean (settings, LOGOUT_KEY) ; |
472 | 54 | } | ||
473 | 55 | return !gconf_client_get_bool (gconf_client, LOGOUT_KEY, NULL) ; | ||
476 | 56 | } | 59 | } |
477 | 57 | 60 | ||
478 | 58 | gboolean | 61 | gboolean |
479 | 59 | show_restart (void) { | 62 | show_restart (void) { |
484 | 60 | if(!gconf_client) { | 63 | build_settings(); |
485 | 61 | gconf_client = gconf_client_get_default (); | 64 | return !g_settings_get_boolean (settings, RESTART_KEY) ; |
482 | 62 | } | ||
483 | 63 | return !gconf_client_get_bool (gconf_client, RESTART_KEY, NULL) ; | ||
486 | 64 | } | 65 | } |
487 | 65 | 66 | ||
488 | 66 | gboolean | 67 | gboolean |
489 | 67 | show_shutdown (void) { | 68 | show_shutdown (void) { |
494 | 68 | if(!gconf_client) { | 69 | build_settings(); |
495 | 69 | gconf_client = gconf_client_get_default (); | 70 | return !g_settings_get_boolean (settings, SHUTDOWN_KEY) ; |
492 | 70 | } | ||
493 | 71 | return !gconf_client_get_bool (gconf_client, SHUTDOWN_KEY, NULL) ; | ||
496 | 72 | } | 71 | } |
497 | 73 | 72 | ||
499 | 74 | static void update_menu_entries_callback (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer data) { | 73 | static void update_menu_entries_callback (GSettings * settings, const gchar * key, gpointer data) { |
500 | 75 | RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi = (RestartShutdownLogoutMenuItems*) data; | 74 | RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi = (RestartShutdownLogoutMenuItems*) data; |
501 | 76 | GConfValue * value = gconf_entry_get_value (entry); | ||
502 | 77 | const gchar * key = gconf_entry_get_key (entry); | ||
503 | 78 | 75 | ||
504 | 79 | if(g_strcmp0 (key, SUPPRESS_KEY) == 0) { | 76 | if(g_strcmp0 (key, SUPPRESS_KEY) == 0) { |
506 | 80 | if (gconf_value_get_bool (value)) { | 77 | if (g_settings_get_boolean (settings, key)) { |
507 | 81 | dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->logout_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Log Out")); | 78 | dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->logout_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Log Out")); |
508 | 82 | dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->restart_mi, RESTART_ITEM_LABEL, _("Restart")); | 79 | dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->restart_mi, RESTART_ITEM_LABEL, _("Restart")); |
509 | 83 | dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->shutdown_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Shut Down")); | 80 | dbusmenu_menuitem_property_set(restart_shutdown_logout_mi->shutdown_mi, DBUSMENU_MENUITEM_PROP_LABEL, _("Shut Down")); |
510 | @@ -90,80 +87,65 @@ | |||
511 | 90 | } | 87 | } |
512 | 91 | 88 | ||
513 | 92 | static void | 89 | static void |
515 | 93 | update_logout_callback (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer data) { | 90 | update_logout_callback (GSettings * settings, const gchar * key, gpointer data) { |
516 | 94 | DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data; | 91 | DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data; |
517 | 95 | GConfValue * value = gconf_entry_get_value (entry); | ||
518 | 96 | const gchar * key = gconf_entry_get_key (entry); | ||
519 | 97 | 92 | ||
520 | 98 | if(g_strcmp0 (key, LOGOUT_KEY) == 0) { | 93 | if(g_strcmp0 (key, LOGOUT_KEY) == 0) { |
522 | 99 | dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !gconf_value_get_bool(value)); | 94 | dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !g_settings_get_boolean(settings, key)); |
523 | 100 | } | 95 | } |
524 | 101 | } | 96 | } |
525 | 102 | 97 | ||
526 | 103 | static void | 98 | static void |
528 | 104 | update_restart_callback (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer data) { | 99 | update_restart_callback (GSettings * settings, const gchar * key, gpointer data) { |
529 | 105 | DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data; | 100 | DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data; |
530 | 106 | GConfValue * value = gconf_entry_get_value (entry); | ||
531 | 107 | const gchar * key = gconf_entry_get_key (entry); | ||
532 | 108 | 101 | ||
533 | 109 | if(g_strcmp0 (key, RESTART_KEY) == 0) { | 102 | if(g_strcmp0 (key, RESTART_KEY) == 0) { |
535 | 110 | dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !gconf_value_get_bool(value)); | 103 | dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !g_settings_get_boolean(settings, key)); |
536 | 111 | } | 104 | } |
537 | 112 | } | 105 | } |
538 | 113 | 106 | ||
539 | 114 | static void | 107 | static void |
541 | 115 | update_shutdown_callback (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer data) { | 108 | update_shutdown_callback (GSettings * settings, const gchar * key, gpointer data) { |
542 | 116 | DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data; | 109 | DbusmenuMenuitem * mi = (DbusmenuMenuitem*) data; |
543 | 117 | GConfValue * value = gconf_entry_get_value (entry); | ||
544 | 118 | const gchar * key = gconf_entry_get_key (entry); | ||
545 | 119 | 110 | ||
546 | 120 | if(g_strcmp0 (key, SHUTDOWN_KEY) == 0) { | 111 | if(g_strcmp0 (key, SHUTDOWN_KEY) == 0) { |
548 | 121 | dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !gconf_value_get_bool(value)); | 112 | dbusmenu_menuitem_property_set_bool(mi, DBUSMENU_MENUITEM_PROP_VISIBLE, !g_settings_get_boolean(settings, key)); |
549 | 122 | } | 113 | } |
550 | 123 | } | 114 | } |
551 | 124 | 115 | ||
552 | 125 | void | 116 | void |
553 | 126 | update_menu_entries(RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi) { | 117 | update_menu_entries(RestartShutdownLogoutMenuItems * restart_shutdown_logout_mi) { |
554 | 127 | /* If we don't have a client, build one. */ | 118 | /* If we don't have a client, build one. */ |
565 | 128 | if(!gconf_client) { | 119 | build_settings(); |
556 | 129 | gconf_client = gconf_client_get_default (); | ||
557 | 130 | } | ||
558 | 131 | |||
559 | 132 | /* If we've not gotten any notifications, then we need | ||
560 | 133 | to add the directory for notifications to come from. */ | ||
561 | 134 | if (confirmation_notify == 0 || logout_notify == 0) { | ||
562 | 135 | gconf_client_add_dir (gconf_client, GLOBAL_DIR, | ||
563 | 136 | GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); | ||
564 | 137 | } | ||
566 | 138 | 120 | ||
567 | 139 | if (confirmation_notify != 0) { | 121 | if (confirmation_notify != 0) { |
569 | 140 | gconf_client_notify_remove (gconf_client, confirmation_notify); | 122 | g_signal_handler_disconnect (settings, confirmation_notify); |
570 | 141 | confirmation_notify = 0; | 123 | confirmation_notify = 0; |
571 | 142 | } | 124 | } |
572 | 143 | 125 | ||
573 | 144 | if (logout_notify != 0) { | 126 | if (logout_notify != 0) { |
575 | 145 | gconf_client_notify_remove (gconf_client, logout_notify); | 127 | g_signal_handler_disconnect (settings, logout_notify); |
576 | 146 | logout_notify = 0; | 128 | logout_notify = 0; |
577 | 147 | } | 129 | } |
578 | 148 | 130 | ||
579 | 149 | if (restart_notify != 0) { | 131 | if (restart_notify != 0) { |
581 | 150 | gconf_client_notify_remove (gconf_client, restart_notify); | 132 | g_signal_handler_disconnect (settings, restart_notify); |
582 | 151 | restart_notify = 0; | 133 | restart_notify = 0; |
583 | 152 | } | 134 | } |
584 | 153 | 135 | ||
585 | 154 | if (shutdown_notify != 0) { | 136 | if (shutdown_notify != 0) { |
587 | 155 | gconf_client_notify_remove (gconf_client, shutdown_notify); | 137 | g_signal_handler_disconnect (settings, shutdown_notify); |
588 | 156 | shutdown_notify = 0; | 138 | shutdown_notify = 0; |
589 | 157 | } | 139 | } |
590 | 158 | 140 | ||
599 | 159 | confirmation_notify = gconf_client_notify_add (gconf_client, SUPPRESS_KEY, | 141 | confirmation_notify = g_signal_connect (settings, "changed::" SUPPRESS_KEY, |
600 | 160 | update_menu_entries_callback, restart_shutdown_logout_mi, NULL, NULL); | 142 | G_CALLBACK(update_menu_entries_callback), restart_shutdown_logout_mi); |
601 | 161 | logout_notify = gconf_client_notify_add (gconf_client, LOGOUT_KEY, | 143 | logout_notify = g_signal_connect (settings, "changed::" LOGOUT_KEY, |
602 | 162 | update_logout_callback, restart_shutdown_logout_mi->logout_mi, NULL, NULL); | 144 | G_CALLBACK(update_logout_callback), restart_shutdown_logout_mi->logout_mi); |
603 | 163 | restart_notify = gconf_client_notify_add (gconf_client, RESTART_KEY, | 145 | restart_notify = g_signal_connect (settings, "changed::" RESTART_KEY, |
604 | 164 | update_restart_callback, restart_shutdown_logout_mi->restart_mi, NULL, NULL); | 146 | G_CALLBACK(update_restart_callback), restart_shutdown_logout_mi->restart_mi); |
605 | 165 | shutdown_notify = gconf_client_notify_add (gconf_client, SHUTDOWN_KEY, | 147 | shutdown_notify = g_signal_connect (settings, "changed::" SHUTDOWN_KEY, |
606 | 166 | update_shutdown_callback, restart_shutdown_logout_mi->shutdown_mi, NULL, NULL); | 148 | G_CALLBACK(update_shutdown_callback), restart_shutdown_logout_mi->shutdown_mi); |
607 | 167 | 149 | ||
608 | 168 | return; | 150 | return; |
609 | 169 | } | 151 | } |
610 | 170 | 152 | ||
611 | === renamed file 'src/gconf-helper.h' => 'src/settings-helper.h' | |||
612 | --- src/gconf-helper.h 2011-07-15 11:06:53 +0000 | |||
613 | +++ src/settings-helper.h 2011-08-19 20:18:25 +0000 | |||
614 | @@ -1,5 +1,5 @@ | |||
615 | 1 | /* | 1 | /* |
617 | 2 | A small wrapper utility for connecting to gconf. | 2 | A small wrapper utility for connecting to GSettings. |
618 | 3 | 3 | ||
619 | 4 | Copyright 2009 Canonical Ltd. | 4 | Copyright 2009 Canonical Ltd. |
620 | 5 | 5 | ||
621 | @@ -23,8 +23,6 @@ | |||
622 | 23 | #ifndef __GCONF_HELPER_H__ | 23 | #ifndef __GCONF_HELPER_H__ |
623 | 24 | #define __GCONF_HELPER_H__ 1 | 24 | #define __GCONF_HELPER_H__ 1 |
624 | 25 | 25 | ||
625 | 26 | #include <gconf/gconf-client.h> | ||
626 | 27 | |||
627 | 28 | #include <glib/gi18n.h> | 26 | #include <glib/gi18n.h> |
628 | 29 | 27 | ||
629 | 30 | #include <dbus/dbus-glib.h> | 28 | #include <dbus/dbus-glib.h> |
630 | @@ -33,17 +31,17 @@ | |||
631 | 33 | #include <libdbusmenu-glib/server.h> | 31 | #include <libdbusmenu-glib/server.h> |
632 | 34 | #include <libdbusmenu-glib/menuitem.h> | 32 | #include <libdbusmenu-glib/menuitem.h> |
633 | 35 | 33 | ||
639 | 36 | #define GLOBAL_DIR "/apps/indicator-session" | 34 | #define SESSION_SCHEMA "com.canonical.indicator.session" |
640 | 37 | #define SUPPRESS_KEY GLOBAL_DIR "/suppress_logout_restart_shutdown" | 35 | #define SUPPRESS_KEY "suppress-logout-restart-shutdown" |
641 | 38 | #define LOGOUT_KEY GLOBAL_DIR "/suppress_logout_menuitem" | 36 | #define LOGOUT_KEY "suppress-logout-menuitem" |
642 | 39 | #define RESTART_KEY GLOBAL_DIR "/suppress_restart_menuitem" | 37 | #define RESTART_KEY "suppress-restart-menuitem" |
643 | 40 | #define SHUTDOWN_KEY GLOBAL_DIR "/suppress_shutdown_menuitem" | 38 | #define SHUTDOWN_KEY "suppress-shutdown-menuitem" |
644 | 41 | 39 | ||
650 | 42 | #define LOCKDOWN_DIR "/desktop/gnome/lockdown" | 40 | #define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown" |
651 | 43 | #define LOCKDOWN_KEY_USER LOCKDOWN_DIR "/disable_user_switching" | 41 | #define LOCKDOWN_KEY_USER "disable-user-switching" |
652 | 44 | #define LOCKDOWN_KEY_SCREENSAVER LOCKDOWN_DIR "/disable_lock_screen" | 42 | #define LOCKDOWN_KEY_SCREENSAVER "disable-lock-screen" |
653 | 45 | #define KEYBINDING_DIR "/apps/gnome_settings_daemon/keybindings" | 43 | #define KEYBINDING_SCHEMA "org.gnome.settings-daemon.plugins.media-keys" |
654 | 46 | #define KEY_LOCK_SCREEN KEYBINDING_DIR "/screensaver" | 44 | #define KEY_LOCK_SCREEN "screensaver" |
655 | 47 | 45 | ||
656 | 48 | typedef struct _RestartShutdownLogoutMenuItems | 46 | typedef struct _RestartShutdownLogoutMenuItems |
657 | 49 | { | 47 | { |
658 | 50 | 48 | ||
659 | === modified file 'src/user-menu-mgr.c' | |||
660 | --- src/user-menu-mgr.c 2011-08-18 15:21:02 +0000 | |||
661 | +++ src/user-menu-mgr.c 2011-08-19 20:18:25 +0000 | |||
662 | @@ -20,13 +20,13 @@ | |||
663 | 20 | #include <libdbusmenu-glib/client.h> | 20 | #include <libdbusmenu-glib/client.h> |
664 | 21 | 21 | ||
665 | 22 | #include "user-menu-mgr.h" | 22 | #include "user-menu-mgr.h" |
667 | 23 | #include "gconf-helper.h" | 23 | #include "settings-helper.h" |
668 | 24 | #include "dbus-shared-names.h" | 24 | #include "dbus-shared-names.h" |
669 | 25 | #include "dbusmenu-shared.h" | 25 | #include "dbusmenu-shared.h" |
670 | 26 | #include "lock-helper.h" | 26 | #include "lock-helper.h" |
671 | 27 | #include "users-service-dbus.h" | 27 | #include "users-service-dbus.h" |
672 | 28 | 28 | ||
674 | 29 | static GConfClient * gconf_client = NULL; | 29 | static GSettings* settings = NULL; |
675 | 30 | static DbusmenuMenuitem *switch_menuitem = NULL; | 30 | static DbusmenuMenuitem *switch_menuitem = NULL; |
676 | 31 | 31 | ||
677 | 32 | struct _UserMenuMgr | 32 | struct _UserMenuMgr |
678 | @@ -56,7 +56,7 @@ | |||
679 | 56 | const gchar *user_id, | 56 | const gchar *user_id, |
680 | 57 | gpointer user_data); | 57 | gpointer user_data); |
681 | 58 | 58 | ||
683 | 59 | static void ensure_gconf_client (); | 59 | static void ensure_settings_client (); |
684 | 60 | static gboolean check_guest_session (void); | 60 | static gboolean check_guest_session (void); |
685 | 61 | static void activate_guest_session (DbusmenuMenuitem * mi, | 61 | static void activate_guest_session (DbusmenuMenuitem * mi, |
686 | 62 | guint timestamp, | 62 | guint timestamp, |
687 | @@ -110,11 +110,11 @@ | |||
688 | 110 | 110 | ||
689 | 111 | /* Make sure we have a valid GConf client, and build one | 111 | /* Make sure we have a valid GConf client, and build one |
690 | 112 | if needed */ | 112 | if needed */ |
692 | 113 | ensure_gconf_client (); | 113 | ensure_settings_client (); |
693 | 114 | 114 | ||
694 | 115 | /* Check to see which menu items we're allowed to have */ | 115 | /* Check to see which menu items we're allowed to have */ |
695 | 116 | can_activate = users_service_dbus_can_activate_session (self->users_dbus_interface) && | 116 | can_activate = users_service_dbus_can_activate_session (self->users_dbus_interface) && |
697 | 117 | !gconf_client_get_bool (gconf_client, LOCKDOWN_KEY_USER, NULL); | 117 | !g_settings_get_boolean (settings, LOCKDOWN_KEY_USER); |
698 | 118 | 118 | ||
699 | 119 | /* Remove the old menu items if that makes sense */ | 119 | /* Remove the old menu items if that makes sense */ |
700 | 120 | children = dbusmenu_menuitem_take_children (self->root_item); | 120 | children = dbusmenu_menuitem_take_children (self->root_item); |
701 | @@ -288,9 +288,9 @@ | |||
702 | 288 | locking the screen. If not, lock it. */ | 288 | locking the screen. If not, lock it. */ |
703 | 289 | static void | 289 | static void |
704 | 290 | lock_if_possible (void) { | 290 | lock_if_possible (void) { |
706 | 291 | ensure_gconf_client (); | 291 | ensure_settings_client (); |
707 | 292 | 292 | ||
709 | 293 | if (!gconf_client_get_bool (gconf_client, LOCKDOWN_KEY_SCREENSAVER, NULL)) { | 293 | if (!g_settings_get_boolean (settings, LOCKDOWN_KEY_SCREENSAVER)) { |
710 | 294 | lock_screen(NULL, 0, NULL); | 294 | lock_screen(NULL, 0, NULL); |
711 | 295 | } | 295 | } |
712 | 296 | 296 | ||
713 | @@ -373,13 +373,12 @@ | |||
714 | 373 | /* Ensures that we have a GConf client and if we build one | 373 | /* Ensures that we have a GConf client and if we build one |
715 | 374 | set up the signal handler. */ | 374 | set up the signal handler. */ |
716 | 375 | static void | 375 | static void |
718 | 376 | ensure_gconf_client () | 376 | ensure_settings_client () |
719 | 377 | { | 377 | { |
724 | 378 | if (!gconf_client) { | 378 | if(!settings) { |
725 | 379 | gconf_client = gconf_client_get_default (); | 379 | settings = g_settings_new (LOCKDOWN_SCHEMA); |
722 | 380 | gconf_client_add_dir (gconf_client, LOCKDOWN_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); | ||
723 | 381 | gconf_client_add_dir (gconf_client, KEYBINDING_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); | ||
726 | 382 | } | 380 | } |
727 | 381 | return; | ||
728 | 383 | } | 382 | } |
729 | 384 | 383 | ||
730 | 385 | DbusmenuMenuitem* | 384 | DbusmenuMenuitem* |
looking good.