summaryrefslogtreecommitdiff
path: root/libbackground
diff options
context:
space:
mode:
authorRichard Hestilow <hestilow@ximian.com>2002-02-07 06:15:03 +0000
committerRachel Hestilow <hestgray@src.gnome.org>2002-02-07 06:15:03 +0000
commit96d7f7d1a8b4a12870dc441180eaa5e6afbe0d54 (patch)
treead65cbd6be3783d624d12a28d9bb09093249a796 /libbackground
parent54d7e22f6059d6c5762bc1a353e22e25c9d2f7e3 (diff)
downloadgnome-control-center-96d7f7d1a8b4a12870dc441180eaa5e6afbe0d54.tar.gz
Add "timeout" field. (bg_apply_cleanup_cb): Added.
2002-02-07 Richard Hestilow <hestilow@ximian.com> * applier.c (BGApplierPrivate): Add "timeout" field. (bg_apply_cleanup_cb): Added. (bg_applier_apply_prefs): Add/reset timeout for cleanup function if we load a pixbuf.
Diffstat (limited to 'libbackground')
-rw-r--r--libbackground/ChangeLog7
-rw-r--r--libbackground/applier.c27
2 files changed, 34 insertions, 0 deletions
diff --git a/libbackground/ChangeLog b/libbackground/ChangeLog
index c0fbe0a69..f3800cef4 100644
--- a/libbackground/ChangeLog
+++ b/libbackground/ChangeLog
@@ -1,3 +1,10 @@
+2002-02-07 Richard Hestilow <hestilow@ximian.com>
+
+ * applier.c (BGApplierPrivate): Add "timeout" field.
+ (bg_apply_cleanup_cb): Added.
+ (bg_applier_apply_prefs): Add/reset timeout for cleanup function
+ if we load a pixbuf.
+
2002-02-04 Lauris Kaplinski <lauris@ximian.com>
* preferences.c (read_wptype_from_string): Do not crash on NULL
diff --git a/libbackground/applier.c b/libbackground/applier.c
index e2bf03335..794d33bb3 100644
--- a/libbackground/applier.c
+++ b/libbackground/applier.c
@@ -107,6 +107,9 @@ struct _BGApplierPrivate
gboolean pixmap_is_set; /* TRUE iff the pixmap above
* has been set as the root
* pixmap */
+ guint timeout; /* "Cleanup" timeout handler;
+ * reset to 30 seconds every
+ * time apply is called. */
};
static GObjectClass *parent_class;
@@ -177,6 +180,8 @@ static void set_root_pixmap (GdkPixmap *pixmap);
static gboolean is_nautilus_running (void);
+static gboolean cleanup_cb (BGApplier *bg_applier);
+
guint
bg_applier_get_type (void)
{
@@ -213,6 +218,7 @@ bg_applier_init (BGApplier *bg_applier, BGApplierClass *class)
bg_applier->p->pixbuf = NULL;
bg_applier->p->wallpaper_pixbuf = NULL;
bg_applier->p->nautilus_running = is_nautilus_running ();
+ bg_applier->p->timeout = 0;
}
static void
@@ -396,6 +402,14 @@ bg_applier_apply_prefs (BGApplier *bg_applier,
g_warning (_("Could not load pixbuf \"%s\"; disabling wallpaper."),
new_prefs->wallpaper_filename);
new_prefs->wallpaper_enabled = FALSE;
+
+ }
+ else
+ {
+ if (bg_applier->p->timeout)
+ g_source_remove (bg_applier->p->timeout);
+ bg_applier->p->timeout = g_timeout_add (30000, (GSourceFunc) cleanup_cb, bg_applier);
+
}
}
}
@@ -1394,3 +1408,16 @@ is_nautilus_running (void)
return running;
}
+
+static gboolean
+cleanup_cb (BGApplier *bg_applier)
+{
+ if (bg_applier->p->wallpaper_pixbuf != NULL)
+ {
+ g_object_unref (G_OBJECT (bg_applier->p->wallpaper_pixbuf));
+ bg_applier->p->wallpaper_pixbuf = NULL;
+ }
+ bg_applier->p->timeout = 0;
+
+ return FALSE;
+}