Merge lp:~mterry/update-notifier/gsettings into lp:update-notifier/ubuntu
- gsettings
- Merge into ubuntu
Proposed by
Michael Terry
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 631 | ||||
Proposed branch: | lp:~mterry/update-notifier/gsettings | ||||
Merge into: | lp:update-notifier/ubuntu | ||||
Prerequisite: | lp:~mterry/update-notifier/gtk3-and-gdbus | ||||
Diff against target: |
592 lines (+124/-156) 17 files modified
README.testing (+1/-1) configure.in (+2/-4) data/Makefile.am (+10/-9) data/com.canonical.update-notifier.gschema.xml.in (+35/-66) data/update-notifier.convert (+8/-0) debian/control (+2/-3) debian/update-notifier.install (+2/-1) po/POTFILES.in (+1/-1) src/clipboard.c (+0/-1) src/crash.c (+6/-6) src/hooks.c (+3/-2) src/reboot.c (+8/-8) src/release.c (+7/-11) src/update-notifier.c (+8/-8) src/update-notifier.h (+12/-13) src/update.c (+18/-21) src/update.h (+1/-1) |
||||
To merge this branch: | bzr merge lp:~mterry/update-notifier/gsettings | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Core Development Team | Pending | ||
Review via email: mp+67848@code.launchpad.net |
Commit message
Description of the change
Port to gsettings (and update debian/ directory for gtk3/gdbus/
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 'README.testing' |
2 | --- README.testing 2009-06-26 16:07:39 +0000 |
3 | +++ README.testing 2011-07-13 15:23:55 +0000 |
4 | @@ -30,4 +30,4 @@ |
5 | funtionatliy |
6 | $ NO_FAKE_STAT=1 faketime '10 days' update-notifier --debug-updates |
7 | # aftwards the launch time in u-m needs to be reset |
8 | -$ gconftool --unset /apps/update-manager/launch_time |
9 | +$ gsettings reset com.ubuntu.update-manager launch-time |
10 | |
11 | === modified file 'configure.in' |
12 | --- configure.in 2011-07-13 15:23:55 +0000 |
13 | +++ configure.in 2011-07-13 15:23:55 +0000 |
14 | @@ -11,8 +11,9 @@ |
15 | AC_HEADER_STDC |
16 | |
17 | GNOME_COMMON_INIT |
18 | +GLIB_GSETTINGS |
19 | |
20 | -pkg_modules="gtk+-3.0 gconf-2.0 libnotify gio-2.0 >= 2.26 x11" |
21 | +pkg_modules="gtk+-3.0 libnotify gio-2.0 >= 2.26 x11" |
22 | |
23 | PKG_CHECK_EXISTS(gdu, [ HAVE_GDU=1 ]) |
24 | if test "x$HAVE_GDU" != "x"; then |
25 | @@ -42,9 +43,6 @@ |
26 | |
27 | AM_GLIB_GNU_GETTEXT |
28 | |
29 | -AC_PATH_PROG(GCONFTOOL, gconftool-2) |
30 | -AM_GCONF_SOURCE_2 |
31 | - |
32 | dnl AC_ARG_WITH(pkg-manager, [ --with-pkg-manager=PATH Package manager to use.]) |
33 | dnl if test "x$with_pkg_manager" != "x"; then |
34 | dnl AC_DEFINE_UNQUOTED(PKG_MANAGER, "$with_pkg_manager", [Package manager to use.]) |
35 | |
36 | === modified file 'data/Makefile.am' |
37 | --- data/Makefile.am 2010-11-17 19:54:35 +0000 |
38 | +++ data/Makefile.am 2011-07-13 15:23:55 +0000 |
39 | @@ -4,10 +4,12 @@ |
40 | desktop_in_files = update-notifier.desktop.in |
41 | desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) |
42 | |
43 | -schemadir = $(datadir)/gconf/schemas |
44 | -schema_in_files = update-notifier.schemas.in |
45 | -schema_DATA = $(schema_in_files:.schemas.in=.schemas) |
46 | -@INTLTOOL_SCHEMAS_RULE@ |
47 | +@INTLTOOL_XML_NOMERGE_RULE@ |
48 | +@GSETTINGS_RULES@ |
49 | +gsettings_SCHEMAS = com.canonical.update-notifier.gschema.xml |
50 | + |
51 | +convertdir = $(datadir)/GConf/gsettings |
52 | +dist_convert_DATA = update-notifier.convert |
53 | |
54 | helperdir = $(libdir)/update-notifier |
55 | helper_SCRIPTS = apt_check.py apt-cdrom-check cddistupgrader update-motd-reboot-required update-motd-updates-available update-motd-fsck-at-reboot |
56 | @@ -17,8 +19,7 @@ |
57 | |
58 | EXTRA_DIST= $(helper_SCRIPTS) \ |
59 | $(desktop_in_files) \ |
60 | - $(schema_in_files) |
61 | - |
62 | -#install-data-local: |
63 | -# -GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$(schema_DATA) |
64 | - |
65 | + $(gsettings_SCHEMAS:.xml=.xml.in) |
66 | + |
67 | +CLEANFILES = \ |
68 | + $(gsettings_SCHEMAS) |
69 | |
70 | === renamed file 'data/update-notifier.schemas.in' => 'data/com.canonical.update-notifier.gschema.xml.in' |
71 | --- data/update-notifier.schemas.in 2009-10-12 07:24:10 +0000 |
72 | +++ data/com.canonical.update-notifier.gschema.xml.in 2011-07-13 15:23:55 +0000 |
73 | @@ -1,70 +1,39 @@ |
74 | -<gconfschemafile> |
75 | - <schemalist> |
76 | - <schema> |
77 | - <key>/schemas/apps/update-notifier/show_apport_crashes</key> |
78 | - <applyto>/apps/update-notifier/show_apport_crashes</applyto> |
79 | - <type>bool</type> |
80 | +<schemalist> |
81 | + <schema id="com.canonical.update-notifier" path="/com/canonical/update-notifier/"> |
82 | + <key name="show-apport-crashes" type="b"> |
83 | <default>true</default> |
84 | - <locale name="C"> |
85 | - <short>Display apport crash reports automatically</short> |
86 | - <long>If this is disabled, the user will not be notified about pending apport crash reports.</long> |
87 | - </locale> |
88 | - </schema> |
89 | - |
90 | - <schema> |
91 | - <key>/schemas/apps/update-notifier/end_system_uids</key> |
92 | - <applyto>/apps/update-notifier/end_system_uids</applyto> |
93 | - <type>int</type> |
94 | + <summary>Display apport crash reports automatically</summary> |
95 | + <description>If this is disabled, the user will not be notified about pending apport crash reports.</description> |
96 | + </key> |
97 | + <key name="end-system-uids" type="i"> |
98 | <default>500</default> |
99 | - <locale name="C"> |
100 | - <short>The maximum UID that is reserved for system users</short> |
101 | - <long>Update-notifier will not be started for system users, this |
102 | -specifies the upper bound of this range. |
103 | - </long> |
104 | - </locale> |
105 | - </schema> |
106 | - |
107 | - <schema> |
108 | - <key>/schemas/apps/update-notifier/auto_launch</key> |
109 | - <applyto>/apps/update-notifier/auto_launch</applyto> |
110 | - <type>bool</type> |
111 | + <summary>The maximum UID that is reserved for system users</summary> |
112 | + <description>Update-notifier will not be started for system users, this specifies the upper bound of this range.</description> |
113 | + </key> |
114 | + <key name="auto-launch" type="b"> |
115 | <default>true</default> |
116 | - <locale name="C"> |
117 | - <short>Automatically launch the default action</short> |
118 | - <long>The default action (update-manager) will be started |
119 | - automatically. All dialog boxes like notification hooks, |
120 | - reboot required, media detected will open automatically |
121 | - </long> |
122 | - </locale> |
123 | - </schema> |
124 | - |
125 | - <schema> |
126 | - <key>/schemas/apps/update-notifier/regular_auto_launch_interval</key> |
127 | - <applyto>/apps/update-notifier/regular_auto_launch_interval</applyto> |
128 | - <type>int</type> |
129 | + <summary>Automatically launch the default action</summary> |
130 | + <description>The default action (update-manager) will be started automatically. All dialog boxes like notification hooks, reboot required, media detected will open automatically</description> |
131 | + </key> |
132 | + <key name="regular-auto-launch-interval" type="i"> |
133 | <default>7</default> |
134 | - <locale name="C"> |
135 | - <short>Interval (in days) when to auto launch for normal updates</short> |
136 | - <long>The interval (in days) when auto launching update-manager |
137 | - for normal updates. Please note that it will auto launch for |
138 | - security updates immediately. If you set it to "0" it will |
139 | - also launch as soon as updates become available. |
140 | - </long> |
141 | - </locale> |
142 | - </schema> |
143 | - |
144 | - <schema> |
145 | - <key>/schemas/apps/update-notifier/hide_reboot_notification</key> |
146 | - <applyto>/apps/update-notifier/hide_reboot_notification</applyto> |
147 | - <type>bool</type> |
148 | - <default>False</default> |
149 | - <locale name="C"> |
150 | - <short>Hide the reboot notification</short> |
151 | - <long>Do not display a reboot required icon or dialog. This is |
152 | - useful for sysadmin who want to prevent this feature from users. |
153 | - </long> |
154 | - </locale> |
155 | - </schema> |
156 | - |
157 | - </schemalist> |
158 | -</gconfschemafile> |
159 | + <summary>Interval (in days) when to auto launch for normal updates</summary> |
160 | + <description>The interval (in days) when auto launching update-manager for normal updates. Please note that it will auto launch for security updates immediately. If you set it to "0" it will also launch as soon as updates become available.</description> |
161 | + </key> |
162 | + <key name="hide-reboot-notification" type="b"> |
163 | + <default>false</default> |
164 | + <summary>Hide the reboot notification</summary> |
165 | + <description>Do not display a reboot required icon or dialog. This is useful for sysadmins who want to prevent this feature from users.</description> |
166 | + </key> |
167 | + <key name="no-show-notifications" type="b"> |
168 | + <default>false</default> |
169 | + <summary>Stop showing update notifications</summary> |
170 | + <description>Do not display a notification when updates are available.</description> |
171 | + </key> |
172 | + <key name="release-check-time" type="u"> |
173 | + <default>0</default> |
174 | + <summary>Time of last release check</summary> |
175 | + <description>The last time update-notifier checked for a new release. The format is seconds since UNIX epoch.</description> |
176 | + </key> |
177 | + </schema> |
178 | +</schemalist> |
179 | |
180 | === added file 'data/update-notifier.convert' |
181 | --- data/update-notifier.convert 1970-01-01 00:00:00 +0000 |
182 | +++ data/update-notifier.convert 2011-07-13 15:23:55 +0000 |
183 | @@ -0,0 +1,8 @@ |
184 | +[com.canonical.update-notifier] |
185 | +show-apport-crashes = /apps/update-notifier/show_apport_crashes |
186 | +end-system-uids = /apps/update-notifier/end_system_uids |
187 | +auto-launch = /apps/update-notifier/auto_launch |
188 | +regular-auto-launch-interval = /apps/update-notifier/regular_auto_launch_interval |
189 | +hide-reboot-notification = /apps/update-notifier/hide_reboot_notification |
190 | +no-show-notifications = /apps/update-notifier/no_show_notifications |
191 | +release-check-time = /apps/update-notifier/release_check_time |
192 | |
193 | === modified file 'debian/control' |
194 | --- debian/control 2011-06-08 07:28:28 +0000 |
195 | +++ debian/control 2011-07-13 15:23:55 +0000 |
196 | @@ -3,10 +3,9 @@ |
197 | Priority: optional |
198 | Maintainer: Michael Vogt <michael.vogt@ubuntu.com> |
199 | Build-Depends: debhelper (>= 7.0.50~), |
200 | - libgtk2.0-dev (>= 2.18.0), |
201 | - libgconf2-dev, |
202 | + libgtk-3-dev, |
203 | + libglib2.0-dev (>= 2.26), |
204 | libgdu-dev, |
205 | - libdbus-glib-1-dev (>= 0.60), |
206 | intltool, |
207 | libnotify-dev (>= 0.7), |
208 | libgudev-1.0-dev, |
209 | |
210 | === modified file 'debian/update-notifier.install' |
211 | --- debian/update-notifier.install 2009-06-26 16:00:13 +0000 |
212 | +++ debian/update-notifier.install 2011-07-13 15:23:55 +0000 |
213 | @@ -5,5 +5,6 @@ |
214 | usr/share/icons/hicolor/22x22/ |
215 | usr/share/icons/hicolor/24x24/ |
216 | usr/share/icons/hicolor/48x48/ |
217 | -usr/share/gconf/schemas/update-notifier.schemas |
218 | +usr/share/glib-2.0/schemas/com.canonical.update-notifier.gschema.xml |
219 | +usr/share/GConf/gsettings/update-notifier.convert |
220 | usr/bin/update-notifier |
221 | |
222 | === modified file 'po/POTFILES.in' |
223 | --- po/POTFILES.in 2009-07-08 15:22:36 +0000 |
224 | +++ po/POTFILES.in 2011-07-13 15:23:55 +0000 |
225 | @@ -15,5 +15,5 @@ |
226 | src/update-notifier.c |
227 | [type: gettext/glade]ui/hooks-dialog.ui |
228 | [type: gettext/glade]ui/reboot-dialog.ui |
229 | -data/update-notifier.schemas.in |
230 | +data/com.canonical.update-notifier.gschema.xml.in |
231 | data/update-notifier.desktop.in |
232 | |
233 | === modified file 'src/clipboard.c' |
234 | --- src/clipboard.c 2010-10-05 16:33:46 +0000 |
235 | +++ src/clipboard.c 2011-07-13 15:23:55 +0000 |
236 | @@ -10,7 +10,6 @@ |
237 | |
238 | #include "config.h" |
239 | |
240 | -#include <gconf/gconf-client.h> |
241 | #include <gdk/gdkx.h> |
242 | |
243 | #include "update-notifier.h" |
244 | |
245 | === modified file 'src/crash.c' |
246 | --- src/crash.c 2011-07-13 15:23:55 +0000 |
247 | +++ src/crash.c 2011-07-13 15:23:55 +0000 |
248 | @@ -131,9 +131,9 @@ |
249 | return FALSE; |
250 | |
251 | // Check whether the user doesn't want notifications |
252 | - if (!gconf_client_get_bool ((GConfClient*) ta->user_data, |
253 | - GCONF_KEY_APPORT_NOTIFICATIONS, NULL)) { |
254 | - g_debug("apport notifications disabled in gconf, not displaying crashes"); |
255 | + if (!g_settings_get_boolean ((GSettings*) ta->user_data, |
256 | + SETTINGS_KEY_APPORT_NOTIFICATIONS)) { |
257 | + g_debug("apport notifications disabled, not displaying crashes"); |
258 | return FALSE; |
259 | } |
260 | |
261 | @@ -159,8 +159,8 @@ |
262 | crashreports_found = !exitcode || system_crashes; |
263 | |
264 | // in autolaunch mode, just open windows, |
265 | - gboolean autolaunch = gconf_client_get_bool((GConfClient*) ta->user_data, |
266 | - GCONF_KEY_AUTO_LAUNCH, NULL); |
267 | + gboolean autolaunch = g_settings_get_boolean((GSettings*) ta->user_data, |
268 | + SETTINGS_KEY_AUTO_LAUNCH); |
269 | if (autolaunch) { |
270 | if (crashreports_found > 0) { |
271 | g_debug("autolaunch mode, just running apport now"); |
272 | @@ -214,7 +214,7 @@ |
273 | crashreport_tray_icon_init (TrayApplet *ta) |
274 | { |
275 | |
276 | - ta->user_data = gconf_client_get_default(); |
277 | + ta->user_data = g_settings_new(SETTINGS_SCHEMA); |
278 | g_signal_connect (G_OBJECT(ta->tray_icon), |
279 | "activate", |
280 | G_CALLBACK (button_release_cb), |
281 | |
282 | === modified file 'src/hooks.c' |
283 | --- src/hooks.c 2011-07-13 15:23:55 +0000 |
284 | +++ src/hooks.c 2011-07-13 15:23:55 +0000 |
285 | @@ -670,8 +670,8 @@ |
286 | assert(button_next); |
287 | |
288 | // check if we do a notification or a dialog |
289 | - GConfClient *gconf = gconf_client_get_default(); |
290 | - if(gconf_client_get_bool(gconf, GCONF_KEY_AUTO_LAUNCH, NULL)) { |
291 | + GSettings *settings = g_settings_new(SETTINGS_SCHEMA); |
292 | + if(g_settings_get_boolean(settings, SETTINGS_KEY_AUTO_LAUNCH)) { |
293 | g_debug_hooks("showing hooks with focus on map == FALSE"); |
294 | if (unseen_count < 2) |
295 | gtk_widget_hide(button_next); |
296 | @@ -680,6 +680,7 @@ |
297 | show_hooks(ta, FALSE); |
298 | return TRUE; |
299 | } |
300 | + g_object_unref(settings); |
301 | |
302 | // no dialog, do the notification |
303 | if((unseen_count > 0) && !gtk_status_icon_get_visible (ta->tray_icon)) |
304 | |
305 | === modified file 'src/reboot.c' |
306 | --- src/reboot.c 2011-07-13 15:23:55 +0000 |
307 | +++ src/reboot.c 2011-07-13 15:23:55 +0000 |
308 | @@ -195,13 +195,13 @@ |
309 | |
310 | // if we are not supposed to show the reboot notification |
311 | // just skip it |
312 | - if(gconf_client_get_bool((GConfClient*) ta->user_data, |
313 | - GCONF_KEY_HIDE_REBOOT, NULL)) |
314 | + if(g_settings_get_boolean((GSettings*) ta->user_data, |
315 | + SETTINGS_KEY_HIDE_REBOOT)) |
316 | return; |
317 | // no auto-open of this dialog |
318 | - if(gconf_client_get_bool((GConfClient*) ta->user_data, |
319 | - GCONF_KEY_AUTO_LAUNCH, NULL)) { |
320 | - g_debug ("Skipping reboot required"); |
321 | + if(g_settings_get_boolean((GSettings*) ta->user_data, |
322 | + SETTINGS_KEY_AUTO_LAUNCH)) { |
323 | + g_debug ("Skipping reboot required"); |
324 | return; |
325 | } |
326 | |
327 | @@ -227,8 +227,8 @@ |
328 | gtk_status_icon_set_visible (ta->tray_icon, TRUE); |
329 | |
330 | /* Check whether the user doesn't like notifications */ |
331 | - if (gconf_client_get_bool ((GConfClient*) ta->user_data, |
332 | - GCONF_KEY_NO_UPDATE_NOTIFICATIONS, NULL)) |
333 | + if (g_settings_get_boolean ((GSettings*) ta->user_data, |
334 | + SETTINGS_KEY_NO_UPDATE_NOTIFICATIONS)) |
335 | return; |
336 | |
337 | /* Show the notification, after a delay so it doesn't look ugly |
338 | @@ -274,7 +274,7 @@ |
339 | GdkPixbuf *pixbuf = gtk_icon_theme_load_icon (icon_theme, "un-reboot", |
340 | 48, 0,NULL); |
341 | gtk_status_icon_set_from_pixbuf (ta->tray_icon, pixbuf); |
342 | - ta->user_data = gconf_client_get_default(); |
343 | + ta->user_data = g_settings_new(SETTINGS_SCHEMA); |
344 | |
345 | g_signal_connect (G_OBJECT(ta->tray_icon), |
346 | "activate", |
347 | |
348 | === modified file 'src/release.c' |
349 | --- src/release.c 2010-03-31 18:56:10 +0000 |
350 | +++ src/release.c 2011-07-13 15:23:55 +0000 |
351 | @@ -28,15 +28,11 @@ |
352 | { |
353 | g_debug_release ("check_new_release"); |
354 | |
355 | - GError *error = NULL; |
356 | - GConfClient *client = (GConfClient*)user_data; |
357 | + GSettings *settings = (GSettings*)user_data; |
358 | |
359 | time_t now = time(NULL); |
360 | - time_t last_check = gconf_client_get_int(client, GCONF_KEY_LAST_RELEASE_CHECK, &error); |
361 | - if ( error != NULL ) { |
362 | - g_warning ("could not get %s", GCONF_KEY_LAST_RELEASE_CHECK); |
363 | - return FALSE; |
364 | - } |
365 | + time_t last_check = (time_t)g_settings_get_uint(settings, |
366 | + SETTINGS_KEY_LAST_RELEASE_CHECK); |
367 | |
368 | // test if we need to run |
369 | if ( (last_check + RELEASE_UPGRADE_CHECK_WAIT) > now ) { |
370 | @@ -57,7 +53,7 @@ |
371 | g_spawn_async ("/", argv, NULL, 0, NULL, NULL, NULL, NULL); |
372 | |
373 | // and update the timestamp so we don't check again too soon |
374 | - gconf_client_set_int(client, GCONF_KEY_LAST_RELEASE_CHECK, now, NULL); |
375 | + g_settings_set_uint(settings, SETTINGS_KEY_LAST_RELEASE_CHECK, (guint)now); |
376 | |
377 | return TRUE; |
378 | } |
379 | @@ -67,14 +63,14 @@ |
380 | { |
381 | g_debug_release ("release_checker_init"); |
382 | |
383 | - GConfClient *client = gconf_client_get_default(); |
384 | + GSettings *settings = g_settings_new(SETTINGS_SCHEMA); |
385 | |
386 | // check once at startup |
387 | - check_new_release (client); |
388 | + check_new_release (settings); |
389 | // release upgrades happen not that frequently, we use two timers |
390 | // check every 10 min if 48h are reached and then run |
391 | // "check-release-upgrade-gtk" again |
392 | - g_timeout_add_seconds (60*10, check_new_release, client); |
393 | + g_timeout_add_seconds (60*10, check_new_release, settings); |
394 | |
395 | return TRUE; |
396 | } |
397 | |
398 | === modified file 'src/update-notifier.c' |
399 | --- src/update-notifier.c 2011-01-03 15:21:35 +0000 |
400 | +++ src/update-notifier.c 2011-07-13 15:23:55 +0000 |
401 | @@ -489,12 +489,11 @@ |
402 | * (see /usr/share/gdm/guest-session/guest-session-setup.sh) |
403 | */ |
404 | int end_system_uid = 500; |
405 | - GConfClient *gconf = gconf_client_get_default(); |
406 | - if (gconf) { |
407 | - int i = gconf_client_get_int(gconf, GCONF_KEY_END_SYSTEM_UIDS, NULL); |
408 | - if (i>0) |
409 | - end_system_uid = i; |
410 | - } |
411 | + GSettings *settings = g_settings_new(SETTINGS_SCHEMA); |
412 | + int i = g_settings_get_int(settings, SETTINGS_KEY_END_SYSTEM_UIDS); |
413 | + if (i>0) |
414 | + end_system_uid = i; |
415 | + g_object_unref(settings); |
416 | |
417 | uid_t uid = getuid(); |
418 | if (uid < end_system_uid) |
419 | @@ -600,8 +599,9 @@ |
420 | |
421 | // do not run as system user (e.g. guest user) |
422 | if (FORCE_RELEASE_CHECK) { |
423 | - GConfClient *gconf = gconf_client_get_default(); |
424 | - gconf_client_unset(gconf, GCONF_KEY_LAST_RELEASE_CHECK, NULL); |
425 | + GSettings *settings = g_settings_new(SETTINGS_SCHEMA); |
426 | + g_settings_reset(settings, SETTINGS_KEY_LAST_RELEASE_CHECK); |
427 | + g_object_unref(settings); |
428 | } |
429 | |
430 | // check if it is running already |
431 | |
432 | === modified file 'src/update-notifier.h' |
433 | --- src/update-notifier.h 2010-06-29 19:31:20 +0000 |
434 | +++ src/update-notifier.h 2011-07-13 15:23:55 +0000 |
435 | @@ -22,19 +22,20 @@ |
436 | |
437 | #include <gtk/gtk.h> |
438 | #include <glib/gi18n.h> |
439 | -#include <gconf/gconf.h> |
440 | -#include <gconf/gconf-client.h> |
441 | |
442 | #define CLIPBOARD_NAME "UPGRADE_NOTIFIER_SELECTION" |
443 | -#define GCONF_KEY_DEFAULT_ACTION "/apps/update-notifier/default_action" |
444 | -#define GCONF_KEY_NO_UPDATE_NOTIFICATIONS "/apps/update-notifier/no_show_notifications" |
445 | -#define GCONF_KEY_APPORT_NOTIFICATIONS "/apps/update-notifier/show_apport_crashes" |
446 | -#define GCONF_KEY_END_SYSTEM_UIDS "/apps/update-notifier/end_system_uids" |
447 | -#define GCONF_KEY_AUTO_LAUNCH "/apps/update-notifier/auto_launch" |
448 | -#define GCONF_KEY_AUTO_LAUNCH_INTERVAL "/apps/update-notifier/regular_auto_launch_interval" |
449 | -#define GCONF_KEY_HIDE_REBOOT "/apps/update-notifier/hide_reboot_notification" |
450 | -#define GCONF_KEY_LAST_LAUNCH "/apps/update-manager/launch_time" |
451 | -#define GCONF_KEY_LAST_RELEASE_CHECK "/apps/update-notifier/release_check_time" |
452 | + |
453 | +#define SETTINGS_SCHEMA "com.canonical.update-notifier" |
454 | +#define SETTINGS_KEY_NO_UPDATE_NOTIFICATIONS "no-show-notifications" |
455 | +#define SETTINGS_KEY_APPORT_NOTIFICATIONS "show-apport-crashes" |
456 | +#define SETTINGS_KEY_END_SYSTEM_UIDS "end-system-uids" |
457 | +#define SETTINGS_KEY_AUTO_LAUNCH "auto-launch" |
458 | +#define SETTINGS_KEY_AUTO_LAUNCH_INTERVAL "regular-auto-launch-interval" |
459 | +#define SETTINGS_KEY_HIDE_REBOOT "hide-reboot-notification" |
460 | +#define SETTINGS_KEY_LAST_RELEASE_CHECK "release-check-time" |
461 | + |
462 | +#define SETTINGS_UM_SCHEMA "com.ubuntu.update-manager" |
463 | +#define SETTINGS_UM_KEY_LAST_LAUNCH "launch-time" |
464 | |
465 | #define HOOKS_DIR "/var/lib/update-notifier/user.d/" |
466 | #define CRASHREPORT_HELPER "/usr/share/apport/apport-checkreports" |
467 | @@ -87,8 +88,6 @@ |
468 | TrayApplet *hook; |
469 | TrayApplet *crashreport; |
470 | |
471 | - GConfClient *gconf; |
472 | - |
473 | guint update_finished_timer; |
474 | |
475 | |
476 | |
477 | === modified file 'src/update.c' |
478 | --- src/update.c 2011-07-13 15:23:55 +0000 |
479 | +++ src/update.c 2011-07-13 15:23:55 +0000 |
480 | @@ -108,7 +108,6 @@ |
481 | invoke (actions[i][0], _(actions[i][2]), (long)actions[i][3]); |
482 | |
483 | UpdateTrayAppletPrivate *priv = (UpdateTrayAppletPrivate*)ta->user_data; |
484 | - gconf_client_set_int(priv->gconf, GCONF_KEY_DEFAULT_ACTION, i, NULL); |
485 | } |
486 | |
487 | void |
488 | @@ -126,8 +125,8 @@ |
489 | UpdateTrayAppletPrivate *priv = (UpdateTrayAppletPrivate*)ta->user_data; |
490 | |
491 | gboolean b = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(self)); |
492 | - gconf_client_set_bool(priv->gconf, GCONF_KEY_NO_UPDATE_NOTIFICATIONS, |
493 | - !b,NULL); |
494 | + g_settings_set_boolean(priv->settings, |
495 | + SETTINGS_KEY_NO_UPDATE_NOTIFICATIONS, !b); |
496 | |
497 | |
498 | NotifyNotification *n = priv->active_notification; |
499 | @@ -162,9 +161,8 @@ |
500 | |
501 | menuitem = gtk_check_menu_item_new_with_label(_("Show notifications")); |
502 | UpdateTrayAppletPrivate *priv = (UpdateTrayAppletPrivate*)ta->user_data; |
503 | - gboolean b = gconf_client_get_bool(priv->gconf, |
504 | - GCONF_KEY_NO_UPDATE_NOTIFICATIONS, |
505 | - NULL); |
506 | + gboolean b = g_settings_get_boolean(priv->settings, |
507 | + SETTINGS_KEY_NO_UPDATE_NOTIFICATIONS); |
508 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), !b); |
509 | gtk_menu_shell_append (GTK_MENU_SHELL (ta->menu), menuitem); |
510 | g_signal_connect(G_OBJECT(menuitem), "toggled", |
511 | @@ -194,7 +192,7 @@ |
512 | |
513 | // if the user wants auto-launch mode, do not show the icon |
514 | // the auto launch stuff will do its magic later |
515 | - if(gconf_client_get_bool(priv->gconf, GCONF_KEY_AUTO_LAUNCH, NULL)) |
516 | + if(g_settings_get_boolean(priv->settings, SETTINGS_KEY_AUTO_LAUNCH)) |
517 | return; |
518 | |
519 | if(is_running) { |
520 | @@ -525,20 +523,20 @@ |
521 | #endif |
522 | |
523 | // when checking for regular updates honor the |
524 | - // regular_auto_launch_interval |
525 | - interval_days = gconf_client_get_int(priv->gconf, |
526 | - GCONF_KEY_AUTO_LAUNCH_INTERVAL, |
527 | - NULL); |
528 | - g_debug_update ("interval_days from gconf: %i\n", interval_days); |
529 | + // regular-auto-launch-interval |
530 | + interval_days = g_settings_get_int(priv->settings, |
531 | + SETTINGS_KEY_AUTO_LAUNCH_INTERVAL); |
532 | + g_debug_update ("interval_days: %i\n", interval_days); |
533 | |
534 | if (interval_days <= 0) |
535 | return TRUE; |
536 | |
537 | // check last launch time |
538 | - last_launch = gconf_client_get_int(priv->gconf, |
539 | - GCONF_KEY_LAST_LAUNCH, |
540 | - NULL); |
541 | - g_debug_update ("last_launch from gconf: %i (%s)\n", last_launch, ctime(&last_launch)); |
542 | + GSettings *um_settings = g_settings_new(SETTINGS_UM_SCHEMA); |
543 | + last_launch = g_settings_get_int(um_settings, |
544 | + SETTINGS_UM_KEY_LAST_LAUNCH); |
545 | + g_debug_update ("last_launch: %i (%s)\n", last_launch, ctime(&last_launch)); |
546 | + g_object_unref(um_settings); |
547 | |
548 | time_t now = time(NULL); |
549 | if (auto_launch_security_now(priv, now, last_launch)) |
550 | @@ -660,8 +658,7 @@ |
551 | |
552 | // check if the user wants to see the icon or launch |
553 | // the default action |
554 | - if(gconf_client_get_bool(priv->gconf, |
555 | - GCONF_KEY_AUTO_LAUNCH, NULL)) |
556 | + if(g_settings_get_boolean(priv->settings, SETTINGS_KEY_AUTO_LAUNCH)) |
557 | { |
558 | gtk_status_icon_set_visible(ta->tray_icon, FALSE); |
559 | if (auto_launch_now(priv)) |
560 | @@ -680,8 +677,8 @@ |
561 | gtk_status_icon_set_visible(ta->tray_icon, TRUE); |
562 | |
563 | // the user does not no notification messages |
564 | - if(gconf_client_get_bool(priv->gconf, |
565 | - GCONF_KEY_NO_UPDATE_NOTIFICATIONS, NULL)) |
566 | + if(g_settings_get_boolean(priv->settings, |
567 | + SETTINGS_KEY_NO_UPDATE_NOTIFICATIONS)) |
568 | return TRUE; |
569 | |
570 | // show the notification with some delay. otherwise on a login |
571 | @@ -697,7 +694,7 @@ |
572 | { |
573 | // create the private data struct |
574 | UpdateTrayAppletPrivate *priv = g_new0(UpdateTrayAppletPrivate, 1); |
575 | - priv->gconf = gconf_client_get_default(); |
576 | + priv->settings = g_settings_new(SETTINGS_SCHEMA); |
577 | priv->apt_is_running = FALSE; |
578 | priv->active_notification = NULL; |
579 | ta->user_data = priv; |
580 | |
581 | === modified file 'src/update.h' |
582 | --- src/update.h 2009-03-02 14:51:55 +0000 |
583 | +++ src/update.h 2011-07-13 15:23:55 +0000 |
584 | @@ -10,7 +10,7 @@ |
585 | typedef struct _UpdateTrayAppletPrivate UpdateTrayAppletPrivate; |
586 | struct _UpdateTrayAppletPrivate |
587 | { |
588 | - GConfClient* gconf; |
589 | + GSettings* settings; |
590 | // this is a permanent marker if apt is runing currently |
591 | // (the difference to the one in update-notifier.h is that |
592 | // the one in here is "global" and not "per-timeslice" information |