~ps-jenkins/unity-settings-daemon/ubuntu-vivid-proposed

« back to all changes in this revision

Viewing changes to debian/patches/revert_background_dropping.patch

  • Committer: Robert Ancell
  • Date: 2013-11-13 01:33:12 UTC
  • Revision ID: robert.ancell@canonical.com-20131113013312-lqg7dhy39tvmjrda
Import packaging

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From 99da10fa1c771bd692bf00b6c4ccf2a5c1818bdb Mon Sep 17 00:00:00 2001
 
2
From: Bastien Nocera <hadess@hadess.net>
 
3
Date: Tue, 08 Jan 2013 06:35:42 +0000
 
4
Subject: background: Remove obsolete plugin
 
5
 
 
6
The background drawing has now moved to gnome-shell, allowing
 
7
smoother integration, animated backgrounds, etc.
 
8
 
 
9
https://bugzilla.gnome.org/show_bug.cgi?id=686549
 
10
---
 
11
Index: gnome-settings-daemon-3.8.5/configure.ac
 
12
===================================================================
 
13
--- gnome-settings-daemon-3.8.5.orig/configure.ac       2013-11-12 16:32:35.410469671 +1300
 
14
+++ gnome-settings-daemon-3.8.5/configure.ac    2013-11-12 16:32:35.402469671 +1300
 
15
@@ -154,6 +154,12 @@
 
16
 AC_SUBST(XTEST_LIBS)
 
17
 
 
18
 dnl ---------------------------------------------------------------------------
 
19
+dnl - background
 
20
+dnl ---------------------------------------------------------------------------
 
21
+
 
22
+PKG_CHECK_MODULES(BACKGROUND, x11 gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION)
 
23
+
 
24
+dnl ---------------------------------------------------------------------------
 
25
 dnl - mouse
 
26
 dnl ---------------------------------------------------------------------------
 
27
 
 
28
@@ -489,6 +495,7 @@
 
29
 plugins/Makefile
 
30
 plugins/a11y-keyboard/Makefile
 
31
 plugins/a11y-settings/Makefile
 
32
+plugins/background/Makefile
 
33
 plugins/clipboard/Makefile
 
34
 plugins/color/Makefile
 
35
 plugins/common/Makefile
 
36
Index: gnome-settings-daemon-3.8.5/data/gnome-settings-daemon.convert
 
37
===================================================================
 
38
--- gnome-settings-daemon-3.8.5.orig/data/gnome-settings-daemon.convert 2013-11-12 16:32:35.410469671 +1300
 
39
+++ gnome-settings-daemon-3.8.5/data/gnome-settings-daemon.convert      2013-11-12 16:32:35.402469671 +1300
 
40
@@ -14,6 +14,10 @@
 
41
 active = /apps/gnome_settings_daemon/plugins/a11y-keyboard/active
 
42
 priority = /apps/gnome_settings_daemon/plugins/a11y-keyboard/priority
 
43
 
 
44
+[org.gnome.settings-daemon.plugins.background]
 
45
+active = /apps/gnome_settings_daemon/plugins/background/active
 
46
+priority = /apps/gnome_settings_daemon/plugins/background/priority
 
47
+
 
48
 [org.gnome.settings-daemon.plugins.clipboard]
 
49
 active = /apps/gnome_settings_daemon/plugins/clipboard/active
 
50
 priority = /apps/gnome_settings_daemon/plugins/clipboard/priority
 
51
Index: gnome-settings-daemon-3.8.5/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in
 
52
===================================================================
 
53
--- gnome-settings-daemon-3.8.5.orig/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in   2013-11-12 16:32:35.410469671 +1300
 
54
+++ gnome-settings-daemon-3.8.5/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in        2013-11-12 16:32:35.402469671 +1300
 
55
@@ -11,6 +11,7 @@
 
56
     </key>
 
57
     <child name="a11y-keyboard" schema="org.gnome.settings-daemon.plugins.a11y-keyboard"/>
 
58
     <child name="a11y-settings" schema="org.gnome.settings-daemon.plugins.a11y-settings"/>
 
59
+    <child name="background" schema="org.gnome.settings-daemon.plugins.background"/>
 
60
     <child name="clipboard" schema="org.gnome.settings-daemon.plugins.clipboard"/>
 
61
     <child name="color" schema="org.gnome.settings-daemon.plugins.color"/>
 
62
     <child name="cursor" schema="org.gnome.settings-daemon.plugins.cursor"/>
 
63
@@ -53,6 +54,18 @@
 
64
       <_summary>Priority to use for this plugin</_summary>
 
65
       <_description>Priority to use for this plugin in gnome-settings-daemon startup queue</_description>
 
66
     </key>
 
67
+  </schema>
 
68
+  <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins.background" path="/org/gnome/settings-daemon/plugins/background/">
 
69
+    <key name="active" type="b">
 
70
+      <default>true</default>
 
71
+      <_summary>Activation of this plugin</_summary>
 
72
+      <_description>Whether this plugin would be activated by gnome-settings-daemon or not</_description>
 
73
+    </key>
 
74
+    <key name="priority" type="i">
 
75
+      <default>97</default>
 
76
+      <_summary>Priority to use for this plugin</_summary>
 
77
+      <_description>Priority to use for this plugin in gnome-settings-daemon startup queue</_description>
 
78
+    </key>
 
79
   </schema>
 
80
   <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins.clipboard" path="/org/gnome/settings-daemon/plugins/clipboard/">
 
81
     <key name="active" type="b">
 
82
Index: gnome-settings-daemon-3.8.5/plugins/Makefile.am
 
83
===================================================================
 
84
--- gnome-settings-daemon-3.8.5.orig/plugins/Makefile.am        2013-11-12 16:32:35.410469671 +1300
 
85
+++ gnome-settings-daemon-3.8.5/plugins/Makefile.am     2013-11-12 16:32:35.402469671 +1300
 
86
@@ -3,6 +3,7 @@
 
87
 enabled_plugins =      \
 
88
        a11y-keyboard   \
 
89
        a11y-settings   \
 
90
+       background      \
 
91
        clipboard       \
 
92
        color           \
 
93
        cursor          \
 
94
Index: gnome-settings-daemon-3.8.5/plugins/background/Makefile.am
 
95
===================================================================
 
96
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
 
97
+++ gnome-settings-daemon-3.8.5/plugins/background/Makefile.am  2013-11-12 16:32:35.402469671 +1300
 
98
@@ -0,0 +1,79 @@
 
99
+NULL =
 
100
+
 
101
+plugin_name = background
 
102
+
 
103
+libexec_PROGRAMS = gsd-test-background
 
104
+
 
105
+gsd_test_background_SOURCES =          \
 
106
+       test-background.c               \
 
107
+       gsd-background-manager.h        \
 
108
+       gsd-background-manager.c        \
 
109
+       $(NULL)
 
110
+
 
111
+gsd_test_background_CPPFLAGS =                         \
 
112
+       -I$(top_srcdir)/gnome-settings-daemon           \
 
113
+       -I$(top_srcdir)/plugins/common                  \
 
114
+       -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
 
115
+       $(AM_CPPFLAGS)
 
116
+
 
117
+gsd_test_background_CFLAGS = \
 
118
+       $(PLUGIN_CFLAGS)                \
 
119
+       $(SETTINGS_PLUGIN_CFLAGS)       \
 
120
+       $(BACKGROUND_CFLAGS)            \
 
121
+       $(AM_CFLAGS)
 
122
+
 
123
+gsd_test_background_LDADD =                            \
 
124
+       $(top_builddir)/gnome-settings-daemon/libgsd.la \
 
125
+       $(SETTINGS_PLUGIN_LIBS)                         \
 
126
+       $(BACKGROUND_LIBS)                              \
 
127
+       $(NULL)
 
128
+
 
129
+plugin_LTLIBRARIES = \
 
130
+       libbackground.la                \
 
131
+       $(NULL)
 
132
+
 
133
+libbackground_la_SOURCES =             \
 
134
+       gsd-background-plugin.c         \
 
135
+       gsd-background-manager.h        \
 
136
+       gsd-background-manager.c        \
 
137
+       $(NULL)
 
138
+
 
139
+libbackground_la_CPPFLAGS = \
 
140
+       -I$(top_srcdir)/gnome-settings-daemon           \
 
141
+       -I$(top_srcdir)/plugins/background/libbackground   \
 
142
+       -DGNOME_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
 
143
+       $(AM_CPPFLAGS)
 
144
+
 
145
+libbackground_la_CFLAGS = \
 
146
+       $(SETTINGS_PLUGIN_CFLAGS)       \
 
147
+       $(BACKGROUND_CFLAGS)            \
 
148
+       $(AM_CFLAGS)
 
149
+
 
150
+libbackground_la_LDFLAGS =             \
 
151
+       $(GSD_PLUGIN_LDFLAGS)           \
 
152
+       $(NULL)
 
153
+
 
154
+libbackground_la_LIBADD  =             \
 
155
+       $(SETTINGS_PLUGIN_LIBS)         \
 
156
+       $(BACKGROUND_LIBS)              \
 
157
+       $(NULL)
 
158
+
 
159
+plugin_in_files =              \
 
160
+       background.gnome-settings-plugin.in     \
 
161
+       $(NULL)
 
162
+
 
163
+plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin)
 
164
+
 
165
+EXTRA_DIST =                   \
 
166
+       $(plugin_in_files)      \
 
167
+       $(NULL)
 
168
+
 
169
+CLEANFILES =                   \
 
170
+       $(plugin_DATA)          \
 
171
+       $(NULL)
 
172
+
 
173
+DISTCLEANFILES =               \
 
174
+       $(plugin_DATA)          \
 
175
+       $(NULL)
 
176
+
 
177
+@GSD_INTLTOOL_PLUGIN_RULE@
 
178
Index: gnome-settings-daemon-3.8.5/plugins/background/background.gnome-settings-plugin.in
 
179
===================================================================
 
180
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
 
181
+++ gnome-settings-daemon-3.8.5/plugins/background/background.gnome-settings-plugin.in  2013-11-12 16:32:35.406469671 +1300
 
182
@@ -0,0 +1,8 @@
 
183
+[GNOME Settings Plugin]
 
184
+Module=background
 
185
+IAge=0
 
186
+_Name=Background
 
187
+_Description=Background plugin
 
188
+Authors=
 
189
+Copyright=Copyright © 2007
 
190
+Website=
 
191
Index: gnome-settings-daemon-3.8.5/plugins/background/gsd-background-manager.c
 
192
===================================================================
 
193
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
 
194
+++ gnome-settings-daemon-3.8.5/plugins/background/gsd-background-manager.c     2013-11-12 16:32:35.406469671 +1300
 
195
@@ -0,0 +1,520 @@
 
196
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 
197
+ *
 
198
+ * Copyright © 2001 Ximian, Inc.
 
199
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
 
200
+ * Copyright 2007 Red Hat, Inc.
 
201
+ *
 
202
+ * This program is free software; you can redistribute it and/or modify
 
203
+ * it under the terms of the GNU General Public License as published by
 
204
+ * the Free Software Foundation; either version 2 of the License, or
 
205
+ * (at your option) any later version.
 
206
+ *
 
207
+ * This program is distributed in the hope that it will be useful,
 
208
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
209
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
210
+ * GNU General Public License for more details.
 
211
+ *
 
212
+ * You should have received a copy of the GNU General Public License
 
213
+ * along with this program; if not, write to the Free Software
 
214
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
215
+ *
 
216
+ */
 
217
+
 
218
+#include "config.h"
 
219
+
 
220
+#include <sys/types.h>
 
221
+#include <sys/wait.h>
 
222
+#include <stdlib.h>
 
223
+#include <stdio.h>
 
224
+#include <unistd.h>
 
225
+#include <string.h>
 
226
+#include <errno.h>
 
227
+
 
228
+#include <locale.h>
 
229
+
 
230
+#include <glib.h>
 
231
+#include <glib/gi18n.h>
 
232
+#include <gio/gio.h>
 
233
+#include <gdk/gdk.h>
 
234
+#include <gdk/gdkx.h>
 
235
+
 
236
+#define GNOME_DESKTOP_USE_UNSTABLE_API
 
237
+#include <libgnome-desktop/gnome-bg.h>
 
238
+#include <X11/Xatom.h>
 
239
+
 
240
+#include "gnome-settings-session.h"
 
241
+#include "gnome-settings-profile.h"
 
242
+#include "gsd-background-manager.h"
 
243
+
 
244
+#define GSD_BACKGROUND_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_BACKGROUND_MANAGER, GsdBackgroundManagerPrivate))
 
245
+
 
246
+struct GsdBackgroundManagerPrivate
 
247
+{
 
248
+        GSettings   *settings;
 
249
+        GnomeBG     *bg;
 
250
+
 
251
+        GnomeBGCrossfade *fade;
 
252
+
 
253
+        GDBusProxy  *proxy;
 
254
+        guint        proxy_signal_id;
 
255
+};
 
256
+
 
257
+static void     gsd_background_manager_class_init  (GsdBackgroundManagerClass *klass);
 
258
+static void     gsd_background_manager_init        (GsdBackgroundManager      *background_manager);
 
259
+static void     gsd_background_manager_finalize    (GObject             *object);
 
260
+
 
261
+static void setup_bg (GsdBackgroundManager *manager);
 
262
+static void connect_screen_signals (GsdBackgroundManager *manager);
 
263
+
 
264
+G_DEFINE_TYPE (GsdBackgroundManager, gsd_background_manager, G_TYPE_OBJECT)
 
265
+
 
266
+static gpointer manager_object = NULL;
 
267
+
 
268
+static gboolean
 
269
+dont_draw_background (GsdBackgroundManager *manager)
 
270
+{
 
271
+        return !g_settings_get_boolean (manager->priv->settings,
 
272
+                                        "draw-background");
 
273
+}
 
274
+
 
275
+static gboolean
 
276
+nautilus_is_drawing_background (GsdBackgroundManager *manager)
 
277
+{
 
278
+       Atom           window_id_atom;
 
279
+       Window         nautilus_xid;
 
280
+       Atom           actual_type;
 
281
+       int            actual_format;
 
282
+       unsigned long  nitems;
 
283
+       unsigned long  bytes_after;
 
284
+       unsigned char *data;
 
285
+       Atom           wmclass_atom;
 
286
+       gboolean       running;
 
287
+       gint           error;
 
288
+       gboolean       show_desktop_icons;
 
289
+
 
290
+       show_desktop_icons = g_settings_get_boolean (manager->priv->settings,
 
291
+                                                     "show-desktop-icons");
 
292
+       if (! show_desktop_icons) {
 
293
+               return FALSE;
 
294
+       }
 
295
+
 
296
+       window_id_atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
 
297
+                                     "NAUTILUS_DESKTOP_WINDOW_ID", True);
 
298
+
 
299
+       if (window_id_atom == None) {
 
300
+               return FALSE;
 
301
+       }
 
302
+
 
303
+       XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
 
304
+                           GDK_ROOT_WINDOW (),
 
305
+                           window_id_atom,
 
306
+                           0,
 
307
+                           1,
 
308
+                           False,
 
309
+                           XA_WINDOW,
 
310
+                           &actual_type,
 
311
+                           &actual_format,
 
312
+                           &nitems,
 
313
+                           &bytes_after,
 
314
+                           &data);
 
315
+
 
316
+       if (data != NULL) {
 
317
+               nautilus_xid = *(Window *) data;
 
318
+               XFree (data);
 
319
+       } else {
 
320
+               return FALSE;
 
321
+       }
 
322
+
 
323
+       if (actual_type != XA_WINDOW) {
 
324
+               return FALSE;
 
325
+       }
 
326
+       if (actual_format != 32) {
 
327
+               return FALSE;
 
328
+       }
 
329
+
 
330
+       wmclass_atom = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "WM_CLASS", False);
 
331
+
 
332
+       gdk_error_trap_push ();
 
333
+
 
334
+       XGetWindowProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
 
335
+                           nautilus_xid,
 
336
+                           wmclass_atom,
 
337
+                           0,
 
338
+                           24,
 
339
+                           False,
 
340
+                           XA_STRING,
 
341
+                           &actual_type,
 
342
+                           &actual_format,
 
343
+                           &nitems,
 
344
+                           &bytes_after,
 
345
+                           &data);
 
346
+
 
347
+       error = gdk_error_trap_pop ();
 
348
+
 
349
+       if (error == BadWindow) {
 
350
+               return FALSE;
 
351
+       }
 
352
+
 
353
+       if (actual_type == XA_STRING &&
 
354
+           nitems == 24 &&
 
355
+           bytes_after == 0 &&
 
356
+           actual_format == 8 &&
 
357
+           data != NULL &&
 
358
+           !strcmp ((char *)data, "desktop_window") &&
 
359
+           !strcmp ((char *)data + strlen ((char *)data) + 1, "Nautilus")) {
 
360
+               running = TRUE;
 
361
+       } else {
 
362
+               running = FALSE;
 
363
+       }
 
364
+
 
365
+       if (data != NULL) {
 
366
+               XFree (data);
 
367
+       }
 
368
+
 
369
+       return running;
 
370
+}
 
371
+
 
372
+static void
 
373
+on_crossfade_finished (GsdBackgroundManager *manager)
 
374
+{
 
375
+        g_object_unref (manager->priv->fade);
 
376
+        manager->priv->fade = NULL;
 
377
+}
 
378
+
 
379
+static void
 
380
+draw_background (GsdBackgroundManager *manager,
 
381
+                 gboolean              use_crossfade)
 
382
+{
 
383
+        GdkDisplay *display;
 
384
+        int         n_screens;
 
385
+        int         i;
 
386
+
 
387
+
 
388
+        if (nautilus_is_drawing_background (manager) ||
 
389
+            dont_draw_background (manager)) {
 
390
+                return;
 
391
+        }
 
392
+
 
393
+        gnome_settings_profile_start (NULL);
 
394
+
 
395
+        display = gdk_display_get_default ();
 
396
+        n_screens = gdk_display_get_n_screens (display);
 
397
+
 
398
+        for (i = 0; i < n_screens; ++i) {
 
399
+                GdkScreen *screen;
 
400
+                GdkWindow *root_window;
 
401
+                cairo_surface_t *surface;
 
402
+
 
403
+                screen = gdk_display_get_screen (display, i);
 
404
+
 
405
+                root_window = gdk_screen_get_root_window (screen);
 
406
+
 
407
+                surface = gnome_bg_create_surface (manager->priv->bg,
 
408
+                                                   root_window,
 
409
+                                                   gdk_screen_get_width (screen),
 
410
+                                                   gdk_screen_get_height (screen),
 
411
+                                                   TRUE);
 
412
+
 
413
+                if (use_crossfade) {
 
414
+
 
415
+                        if (manager->priv->fade != NULL) {
 
416
+                                g_object_unref (manager->priv->fade);
 
417
+                        }
 
418
+
 
419
+                        manager->priv->fade = gnome_bg_set_surface_as_root_with_crossfade (screen, surface);
 
420
+                        g_signal_connect_swapped (manager->priv->fade, "finished",
 
421
+                                                  G_CALLBACK (on_crossfade_finished),
 
422
+                                                  manager);
 
423
+                } else {
 
424
+                        gnome_bg_set_surface_as_root (screen, surface);
 
425
+                }
 
426
+
 
427
+                cairo_surface_destroy (surface);
 
428
+        }
 
429
+
 
430
+        gnome_settings_profile_end (NULL);
 
431
+}
 
432
+
 
433
+static void
 
434
+on_bg_transitioned (GnomeBG              *bg,
 
435
+                    GsdBackgroundManager *manager)
 
436
+{
 
437
+        draw_background (manager, FALSE);
 
438
+}
 
439
+
 
440
+static gboolean
 
441
+settings_change_event_cb (GSettings            *settings,
 
442
+                          gpointer              keys,
 
443
+                          gint                  n_keys,
 
444
+                          GsdBackgroundManager *manager)
 
445
+{
 
446
+        gnome_bg_load_from_preferences (manager->priv->bg,
 
447
+                                        manager->priv->settings);
 
448
+        return FALSE;
 
449
+}
 
450
+
 
451
+static void
 
452
+on_screen_size_changed (GdkScreen            *screen,
 
453
+                        GsdBackgroundManager *manager)
 
454
+{
 
455
+        draw_background (manager, FALSE);
 
456
+}
 
457
+
 
458
+static void
 
459
+watch_bg_preferences (GsdBackgroundManager *manager)
 
460
+{
 
461
+        g_signal_connect (manager->priv->settings,
 
462
+                          "change-event",
 
463
+                          G_CALLBACK (settings_change_event_cb),
 
464
+                          manager);
 
465
+}
 
466
+
 
467
+static void
 
468
+on_bg_changed (GnomeBG              *bg,
 
469
+               GsdBackgroundManager *manager)
 
470
+{
 
471
+        draw_background (manager, TRUE);
 
472
+}
 
473
+
 
474
+static void
 
475
+setup_bg (GsdBackgroundManager *manager)
 
476
+{
 
477
+        g_return_if_fail (manager->priv->bg == NULL);
 
478
+
 
479
+        manager->priv->bg = gnome_bg_new ();
 
480
+
 
481
+        g_signal_connect (manager->priv->bg,
 
482
+                          "changed",
 
483
+                          G_CALLBACK (on_bg_changed),
 
484
+                          manager);
 
485
+
 
486
+        g_signal_connect (manager->priv->bg,
 
487
+                          "transitioned",
 
488
+                          G_CALLBACK (on_bg_transitioned),
 
489
+                          manager);
 
490
+
 
491
+        connect_screen_signals (manager);
 
492
+        watch_bg_preferences (manager);
 
493
+        gnome_bg_load_from_preferences (manager->priv->bg,
 
494
+                                        manager->priv->settings);
 
495
+}
 
496
+
 
497
+static void
 
498
+setup_bg_and_draw_background (GsdBackgroundManager *manager)
 
499
+{
 
500
+        setup_bg (manager);
 
501
+        draw_background (manager, FALSE);
 
502
+}
 
503
+
 
504
+static void
 
505
+disconnect_session_manager_listener (GsdBackgroundManager *manager)
 
506
+{
 
507
+        if (manager->priv->proxy && manager->priv->proxy_signal_id) {
 
508
+                g_signal_handler_disconnect (manager->priv->proxy,
 
509
+                                             manager->priv->proxy_signal_id);
 
510
+                manager->priv->proxy_signal_id = 0;
 
511
+        }
 
512
+}
 
513
+
 
514
+static void
 
515
+on_session_manager_signal (GDBusProxy   *proxy,
 
516
+                           const gchar  *sender_name,
 
517
+                           const gchar  *signal_name,
 
518
+                           GVariant     *parameters,
 
519
+                           gpointer      user_data)
 
520
+{
 
521
+        GsdBackgroundManager *manager = GSD_BACKGROUND_MANAGER (user_data);
 
522
+
 
523
+        if (g_strcmp0 (signal_name, "SessionRunning") == 0) {
 
524
+                setup_bg_and_draw_background (manager);
 
525
+                disconnect_session_manager_listener (manager);
 
526
+        }
 
527
+}
 
528
+
 
529
+static void
 
530
+draw_background_after_session_loads (GsdBackgroundManager *manager)
 
531
+{
 
532
+        manager->priv->proxy =
 
533
+                gnome_settings_session_get_session_proxy ();
 
534
+
 
535
+        manager->priv->proxy_signal_id = g_signal_connect (manager->priv->proxy,
 
536
+                                                           "g-signal",
 
537
+                                                           G_CALLBACK (on_session_manager_signal),
 
538
+                                                           manager);
 
539
+}
 
540
+
 
541
+
 
542
+static void
 
543
+disconnect_screen_signals (GsdBackgroundManager *manager)
 
544
+{
 
545
+        GdkDisplay *display;
 
546
+        int         i;
 
547
+        int         n_screens;
 
548
+
 
549
+        display = gdk_display_get_default ();
 
550
+        n_screens = gdk_display_get_n_screens (display);
 
551
+
 
552
+        for (i = 0; i < n_screens; ++i) {
 
553
+                GdkScreen *screen;
 
554
+                screen = gdk_display_get_screen (display, i);
 
555
+                g_signal_handlers_disconnect_by_func (screen,
 
556
+                                                      G_CALLBACK (on_screen_size_changed),
 
557
+                                                      manager);
 
558
+        }
 
559
+}
 
560
+
 
561
+static void
 
562
+connect_screen_signals (GsdBackgroundManager *manager)
 
563
+{
 
564
+        GdkDisplay *display;
 
565
+        int         i;
 
566
+        int         n_screens;
 
567
+
 
568
+        display = gdk_display_get_default ();
 
569
+        n_screens = gdk_display_get_n_screens (display);
 
570
+
 
571
+        for (i = 0; i < n_screens; ++i) {
 
572
+                GdkScreen *screen;
 
573
+                screen = gdk_display_get_screen (display, i);
 
574
+                g_signal_connect (screen,
 
575
+                                  "monitors-changed",
 
576
+                                  G_CALLBACK (on_screen_size_changed),
 
577
+                                  manager);
 
578
+                g_signal_connect (screen,
 
579
+                                  "size-changed",
 
580
+                                  G_CALLBACK (on_screen_size_changed),
 
581
+                                  manager);
 
582
+        }
 
583
+}
 
584
+
 
585
+static void
 
586
+draw_background_changed (GSettings            *settings,
 
587
+                         const char           *key,
 
588
+                         GsdBackgroundManager *manager)
 
589
+{
 
590
+        if (dont_draw_background (manager) == FALSE)
 
591
+                setup_bg_and_draw_background (manager);
 
592
+}
 
593
+
 
594
+gboolean
 
595
+gsd_background_manager_start (GsdBackgroundManager *manager,
 
596
+                              GError              **error)
 
597
+{
 
598
+        gboolean show_desktop_icons;
 
599
+
 
600
+        g_debug ("Starting background manager");
 
601
+        gnome_settings_profile_start (NULL);
 
602
+
 
603
+        manager->priv->settings = g_settings_new ("org.gnome.desktop.background");
 
604
+        g_signal_connect (manager->priv->settings, "changed::draw-background",
 
605
+                          G_CALLBACK (draw_background_changed), manager);
 
606
+
 
607
+        /* If this is set, nautilus will draw the background and is
 
608
+        * almost definitely in our session.  however, it may not be
 
609
+        * running yet (so is_nautilus_running() will fail).  so, on
 
610
+        * startup, just don't do anything if this key is set so we
 
611
+        * don't waste time setting the background only to have
 
612
+        * nautilus overwrite it.
 
613
+        */
 
614
+        show_desktop_icons = g_settings_get_boolean (manager->priv->settings,
 
615
+                                                     "show-desktop-icons");
 
616
+
 
617
+        if (!show_desktop_icons) {
 
618
+                setup_bg (manager);
 
619
+        } else {
 
620
+                draw_background_after_session_loads (manager);
 
621
+        }
 
622
+
 
623
+        gnome_settings_profile_end (NULL);
 
624
+
 
625
+        return TRUE;
 
626
+}
 
627
+
 
628
+void
 
629
+gsd_background_manager_stop (GsdBackgroundManager *manager)
 
630
+{
 
631
+        GsdBackgroundManagerPrivate *p = manager->priv;
 
632
+
 
633
+        g_debug ("Stopping background manager");
 
634
+
 
635
+        disconnect_screen_signals (manager);
 
636
+
 
637
+        if (manager->priv->proxy) {
 
638
+                disconnect_session_manager_listener (manager);
 
639
+                g_clear_object (&manager->priv->proxy);
 
640
+        }
 
641
+
 
642
+        g_signal_handlers_disconnect_by_func (manager->priv->settings,
 
643
+                                              settings_change_event_cb,
 
644
+                                              manager);
 
645
+
 
646
+        if (p->settings != NULL) {
 
647
+                g_object_unref (p->settings);
 
648
+                p->settings = NULL;
 
649
+        }
 
650
+
 
651
+        if (p->bg != NULL) {
 
652
+                g_object_unref (p->bg);
 
653
+                p->bg = NULL;
 
654
+        }
 
655
+}
 
656
+
 
657
+static GObject *
 
658
+gsd_background_manager_constructor (GType                  type,
 
659
+                                    guint                  n_construct_properties,
 
660
+                                    GObjectConstructParam *construct_properties)
 
661
+{
 
662
+        GsdBackgroundManager      *background_manager;
 
663
+
 
664
+        background_manager = GSD_BACKGROUND_MANAGER (G_OBJECT_CLASS (gsd_background_manager_parent_class)->constructor (type,
 
665
+                                                                                                                        n_construct_properties,
 
666
+                                                                                                                        construct_properties));
 
667
+
 
668
+        return G_OBJECT (background_manager);
 
669
+}
 
670
+
 
671
+static void
 
672
+gsd_background_manager_class_init (GsdBackgroundManagerClass *klass)
 
673
+{
 
674
+        GObjectClass   *object_class = G_OBJECT_CLASS (klass);
 
675
+
 
676
+        object_class->constructor = gsd_background_manager_constructor;
 
677
+        object_class->finalize = gsd_background_manager_finalize;
 
678
+
 
679
+        g_type_class_add_private (klass, sizeof (GsdBackgroundManagerPrivate));
 
680
+}
 
681
+
 
682
+static void
 
683
+gsd_background_manager_init (GsdBackgroundManager *manager)
 
684
+{
 
685
+        manager->priv = GSD_BACKGROUND_MANAGER_GET_PRIVATE (manager);
 
686
+}
 
687
+
 
688
+static void
 
689
+gsd_background_manager_finalize (GObject *object)
 
690
+{
 
691
+        GsdBackgroundManager *background_manager;
 
692
+
 
693
+        g_return_if_fail (object != NULL);
 
694
+        g_return_if_fail (GSD_IS_BACKGROUND_MANAGER (object));
 
695
+
 
696
+        background_manager = GSD_BACKGROUND_MANAGER (object);
 
697
+
 
698
+        g_return_if_fail (background_manager->priv != NULL);
 
699
+
 
700
+        G_OBJECT_CLASS (gsd_background_manager_parent_class)->finalize (object);
 
701
+}
 
702
+
 
703
+GsdBackgroundManager *
 
704
+gsd_background_manager_new (void)
 
705
+{
 
706
+        if (manager_object != NULL) {
 
707
+                g_object_ref (manager_object);
 
708
+        } else {
 
709
+                manager_object = g_object_new (GSD_TYPE_BACKGROUND_MANAGER, NULL);
 
710
+                g_object_add_weak_pointer (manager_object,
 
711
+                                           (gpointer *) &manager_object);
 
712
+        }
 
713
+
 
714
+        return GSD_BACKGROUND_MANAGER (manager_object);
 
715
+}
 
716
Index: gnome-settings-daemon-3.8.5/plugins/background/gsd-background-manager.h
 
717
===================================================================
 
718
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
 
719
+++ gnome-settings-daemon-3.8.5/plugins/background/gsd-background-manager.h     2013-11-12 16:32:35.406469671 +1300
 
720
@@ -0,0 +1,57 @@
 
721
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 
722
+ *
 
723
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
 
724
+ *
 
725
+ * This program is free software; you can redistribute it and/or modify
 
726
+ * it under the terms of the GNU General Public License as published by
 
727
+ * the Free Software Foundation; either version 2 of the License, or
 
728
+ * (at your option) any later version.
 
729
+ *
 
730
+ * This program is distributed in the hope that it will be useful,
 
731
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
732
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
733
+ * GNU General Public License for more details.
 
734
+ *
 
735
+ * You should have received a copy of the GNU General Public License
 
736
+ * along with this program; if not, write to the Free Software
 
737
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
738
+ *
 
739
+ */
 
740
+
 
741
+#ifndef __GSD_BACKGROUND_MANAGER_H
 
742
+#define __GSD_BACKGROUND_MANAGER_H
 
743
+
 
744
+#include <glib-object.h>
 
745
+
 
746
+G_BEGIN_DECLS
 
747
+
 
748
+#define GSD_TYPE_BACKGROUND_MANAGER         (gsd_background_manager_get_type ())
 
749
+#define GSD_BACKGROUND_MANAGER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_BACKGROUND_MANAGER, GsdBackgroundManager))
 
750
+#define GSD_BACKGROUND_MANAGER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_BACKGROUND_MANAGER, GsdBackgroundManagerClass))
 
751
+#define GSD_IS_BACKGROUND_MANAGER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_BACKGROUND_MANAGER))
 
752
+#define GSD_IS_BACKGROUND_MANAGER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_BACKGROUND_MANAGER))
 
753
+#define GSD_BACKGROUND_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_BACKGROUND_MANAGER, GsdBackgroundManagerClass))
 
754
+
 
755
+typedef struct GsdBackgroundManagerPrivate GsdBackgroundManagerPrivate;
 
756
+
 
757
+typedef struct
 
758
+{
 
759
+        GObject                     parent;
 
760
+        GsdBackgroundManagerPrivate *priv;
 
761
+} GsdBackgroundManager;
 
762
+
 
763
+typedef struct
 
764
+{
 
765
+        GObjectClass   parent_class;
 
766
+} GsdBackgroundManagerClass;
 
767
+
 
768
+GType                   gsd_background_manager_get_type            (void);
 
769
+
 
770
+GsdBackgroundManager *  gsd_background_manager_new                 (void);
 
771
+gboolean                gsd_background_manager_start               (GsdBackgroundManager *manager,
 
772
+                                                                    GError              **error);
 
773
+void                    gsd_background_manager_stop                (GsdBackgroundManager *manager);
 
774
+
 
775
+G_END_DECLS
 
776
+
 
777
+#endif /* __GSD_BACKGROUND_MANAGER_H */
 
778
Index: gnome-settings-daemon-3.8.5/plugins/background/gsd-background-plugin.c
 
779
===================================================================
 
780
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
 
781
+++ gnome-settings-daemon-3.8.5/plugins/background/gsd-background-plugin.c      2013-11-12 16:32:35.406469671 +1300
 
782
@@ -0,0 +1,29 @@
 
783
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 
784
+ *
 
785
+ * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
 
786
+ *
 
787
+ * This program is free software; you can redistribute it and/or modify
 
788
+ * it under the terms of the GNU General Public License as published by
 
789
+ * the Free Software Foundation; either version 2, or (at your option)
 
790
+ * any later version.
 
791
+ *
 
792
+ * This program is distributed in the hope that it will be useful,
 
793
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
794
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
795
+ * GNU General Public License for more details.
 
796
+ *
 
797
+ * You should have received a copy of the GNU General Public License
 
798
+ * along with this program; if not, write to the Free Software
 
799
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
800
+ *
 
801
+ */
 
802
+
 
803
+#include "config.h"
 
804
+
 
805
+#include <glib/gi18n-lib.h>
 
806
+#include <gmodule.h>
 
807
+
 
808
+#include "gnome-settings-plugin.h"
 
809
+#include "gsd-background-manager.h"
 
810
+
 
811
+GNOME_SETTINGS_PLUGIN_REGISTER (GsdBackground, gsd_background)
 
812
Index: gnome-settings-daemon-3.8.5/plugins/background/test-background.c
 
813
===================================================================
 
814
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
 
815
+++ gnome-settings-daemon-3.8.5/plugins/background/test-background.c    2013-11-12 16:32:35.406469671 +1300
 
816
@@ -0,0 +1,7 @@
 
817
+#define NEW gsd_background_manager_new
 
818
+#define START gsd_background_manager_start
 
819
+#define STOP gsd_background_manager_stop
 
820
+#define MANAGER GsdBackgroundManager
 
821
+#include "gsd-background-manager.h"
 
822
+
 
823
+#include "test-plugin.h"
 
824
Index: gnome-settings-daemon-3.8.5/po/POTFILES.in
 
825
===================================================================
 
826
--- gnome-settings-daemon-3.8.5.orig/po/POTFILES.in     2013-11-12 16:32:35.410469671 +1300
 
827
+++ gnome-settings-daemon-3.8.5/po/POTFILES.in  2013-11-12 16:32:35.406469671 +1300
 
828
@@ -18,6 +18,7 @@
 
829
 [type: gettext/ini]plugins/a11y-keyboard/a11y-keyboard.gnome-settings-plugin.in
 
830
 plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
 
831
 [type: gettext/ini]plugins/a11y-settings/a11y-settings.gnome-settings-plugin.in
 
832
+[type: gettext/ini]plugins/background/background.gnome-settings-plugin.in
 
833
 [type: gettext/ini]plugins/clipboard/clipboard.gnome-settings-plugin.in
 
834
 [type: gettext/ini]plugins/color/color.gnome-settings-plugin.in
 
835
 plugins/color/gsd-color-manager.c