~gnome3-team/gnome-screensaver/ubuntu

« back to all changes in this revision

Viewing changes to debian/patches/00git_gnome_bg.patch

  • Committer: Robert Ancell
  • Date: 2010-12-10 04:26:24 UTC
  • Revision ID: robert.ancell@canonical.com-20101210042624-dtb0yaeaamwewuus
* New upstream release
* debian/control:
  - Bump build-depends on libgnome-desktop-3-dev
  - Build-depend on libxklavier-dev
* debian/patches/00git_gdk_window_get_geometry.patch:
  - Build with the latest GTK
* debian/patches/00git_gnome_bg.patch:
* debian/patches/00git_gnome_rr.patch:
* debian/patches/00git_size_request.patch:
* debian/patches/01_libxklavier.patch:
  - Applied upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From 22aff5e2a8c8faa8608cd38951665ccb175d6953 Mon Sep 17 00:00:00 2001
2
 
From: Tomas Bzatek <tbzatek@redhat.com>
3
 
Date: Fri, 19 Nov 2010 13:26:14 +0000
4
 
Subject: Port background handling to GSettings and new gnome-bg API
5
 
 
6
 
See bug 632566 for details.
7
 
---
8
 
diff --git a/src/gs-manager.c b/src/gs-manager.c
9
 
index a6b2404..0f0d42c 100644
10
 
--- a/src/gs-manager.c
11
 
+++ b/src/gs-manager.c
12
 
@@ -26,11 +26,8 @@
13
 
 #include <gdk/gdk.h>
14
 
 #include <gdk/gdkx.h>
15
 
 
16
 
-#include <gconf/gconf-engine.h>
17
 
-#include <gconf/gconf-client.h>
18
 
-
19
 
 #define GNOME_DESKTOP_USE_UNSTABLE_API
20
 
-#include <libgnomeui/gnome-bg.h>
21
 
+#include <libgnome-desktop/gnome-bg.h>
22
 
 
23
 
 #include "gs-prefs.h"        /* for GSSaverMode */
24
 
 
25
 
@@ -54,9 +51,8 @@ struct GSManagerPrivate
26
 
         GHashTable  *jobs;
27
 
 
28
 
         GSThemeManager *theme_manager;
29
 
-        GConfClient    *client;
30
 
+        GSettings      *settings;
31
 
         GnomeBG        *bg;
32
 
-        guint           bg_notify_id;
33
 
 
34
 
         /* Policy */
35
 
         glong        lock_timeout;
36
 
@@ -949,61 +945,46 @@ on_bg_changed (GnomeBG   *bg,
37
 
         gs_debug ("background changed");
38
 
 }
39
 
 
40
 
-static void
41
 
-gconf_changed_callback (GConfClient *client,
42
 
-                        guint        cnxn_id,
43
 
-                        GConfEntry  *entry,
44
 
-                        GSManager   *manager)
45
 
-{
46
 
+static gboolean
47
 
+background_settings_change_event_cb (GSettings *settings,
48
 
+                                     gpointer   keys,
49
 
+                                     gint       n_keys,
50
 
+                                     GSManager   *manager)
51
 
+{
52
 
+#if 0
53
 
+        /* FIXME: since we bind user settings instead of system ones,
54
 
+         *        watching for changes is no longer valid.
55
 
+         */
56
 
         gnome_bg_load_from_preferences (manager->priv->bg,
57
 
-                                        manager->priv->client);
58
 
-}
59
 
+                                        manager->priv->settings);
60
 
+#endif
61
 
 
62
 
-static void
63
 
-watch_bg_preferences (GSManager *manager)
64
 
-{
65
 
-        g_assert (manager->priv->bg_notify_id == 0);
66
 
-
67
 
-        gconf_client_add_dir (manager->priv->client,
68
 
-                              GNOME_BG_KEY_DIR,
69
 
-                              GCONF_CLIENT_PRELOAD_NONE,
70
 
-                              NULL);
71
 
-        manager->priv->bg_notify_id = gconf_client_notify_add (manager->priv->client,
72
 
-                                                               GNOME_BG_KEY_DIR,
73
 
-                                                               (GConfClientNotifyFunc)gconf_changed_callback,
74
 
-                                                               manager,
75
 
-                                                               NULL,
76
 
-                                                               NULL);
77
 
+        return FALSE;
78
 
 }
79
 
 
80
 
-static GConfClient *
81
 
-get_gconf_client (void)
82
 
+static GSettings *
83
 
+get_system_settings (void)
84
 
 {
85
 
-        GConfClient        *client;
86
 
-        GSList             *addresses;
87
 
-        GError             *error;
88
 
-        GConfEngine        *engine;
89
 
+        GSettings *settings;
90
 
+        gchar **keys;
91
 
+        gchar **k;
92
 
 
93
 
-        client = NULL;
94
 
-        addresses = NULL;
95
 
+        /* FIXME: we need to bind system settings instead of user but
96
 
+         *        that's currently impossible, not implemented yet.
97
 
+         *        Hence, reset to system default values.
98
 
+         */
99
 
+        /* TODO: Ideally we would like to bind some other key, screensaver-specific. */
100
 
+        settings = g_settings_new ("org.gnome.desktop.background");
101
 
 
102
 
-        addresses = g_slist_prepend (addresses, "xml:merged:" SYSCONFDIR "/gconf/gconf.xml.mandatory");
103
 
-        addresses = g_slist_prepend (addresses, "xml:merged:" SYSCONFDIR "/gconf/gconf.xml.system");
104
 
-        addresses = g_slist_prepend (addresses, "xml:merged:" SYSCONFDIR "/gconf/gconf.xml.defaults");
105
 
-        addresses = g_slist_reverse (addresses);
106
 
+        g_settings_delay (settings);
107
 
 
108
 
-        error = NULL;
109
 
-        engine = gconf_engine_get_for_addresses (addresses, &error);
110
 
-        if (engine == NULL) {
111
 
-                gs_debug ("Unable to get gconf engine for addresses: %s", error->message);
112
 
-                g_error_free (error);
113
 
-        } else {
114
 
-                client = gconf_client_get_for_engine (engine);
115
 
+        keys = g_settings_list_keys (settings);
116
 
+        for (k = keys; *k; k++) {
117
 
+                g_settings_reset (settings, *k);
118
 
         }
119
 
+        g_strfreev (keys);
120
 
 
121
 
-        g_slist_free (addresses);
122
 
-
123
 
-        return client;
124
 
+        return settings;
125
 
 }
126
 
 
127
 
 static void
128
 
@@ -1015,18 +996,20 @@ gs_manager_init (GSManager *manager)
129
 
         manager->priv->grab = gs_grab_new ();
130
 
         manager->priv->theme_manager = gs_theme_manager_new ();
131
 
 
132
 
-        manager->priv->client = get_gconf_client ();
133
 
-        if (manager->priv->client != NULL) {
134
 
-                manager->priv->bg = gnome_bg_new ();
135
 
+        manager->priv->settings = get_system_settings ();
136
 
+        manager->priv->bg = gnome_bg_new ();
137
 
 
138
 
-                g_signal_connect (manager->priv->bg,
139
 
-                                  "changed",
140
 
-                                  G_CALLBACK (on_bg_changed),
141
 
-                                  manager);
142
 
-                watch_bg_preferences (manager);
143
 
+        g_signal_connect (manager->priv->bg,
144
 
+                          "changed",
145
 
+                          G_CALLBACK (on_bg_changed),
146
 
+                          manager);
147
 
+        g_signal_connect (manager->priv->settings,
148
 
+                          "change-event",
149
 
+                          G_CALLBACK (background_settings_change_event_cb),
150
 
+                          manager);
151
 
 
152
 
-                gnome_bg_load_from_preferences (manager->priv->bg, manager->priv->client);
153
 
-        }
154
 
+        gnome_bg_load_from_preferences (manager->priv->bg,
155
 
+                                        manager->priv->settings);
156
 
 }
157
 
 
158
 
 static void
159
 
@@ -1600,19 +1583,12 @@ gs_manager_finalize (GObject *object)
160
 
 
161
 
         g_return_if_fail (manager->priv != NULL);
162
 
 
163
 
-        if (manager->priv->bg_notify_id != 0) {
164
 
-                gconf_client_remove_dir (manager->priv->client,
165
 
-                                         GNOME_BG_KEY_DIR,
166
 
-                                         NULL);
167
 
-                gconf_client_notify_remove (manager->priv->client,
168
 
-                                            manager->priv->bg_notify_id);
169
 
-                manager->priv->bg_notify_id = 0;
170
 
-        }
171
 
         if (manager->priv->bg != NULL) {
172
 
                 g_object_unref (manager->priv->bg);
173
 
         }
174
 
-        if (manager->priv->client != NULL) {
175
 
-                g_object_unref (manager->priv->client);
176
 
+        if (manager->priv->settings != NULL) {
177
 
+                g_settings_revert (manager->priv->settings);
178
 
+                g_object_unref (manager->priv->settings);
179
 
         }
180
 
 
181
 
         free_themes (manager);
182
 
--
183
 
cgit v0.8.3.1