summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBradford Hovinen <hovinen@ximian.com>2001-12-20 20:47:43 +0000
committerBradford Hovinen (Gdict maintainer) <hovinen@src.gnome.org>2001-12-20 20:47:43 +0000
commit064dac63c0d3816dfdc34dd7dc45400a8fa6b7f5 (patch)
tree27b77a2044c23c5ed11fcace0f16124bd1818096
parent894a0a1c3a1e4b689bbd2183678f5dd545bb8f68 (diff)
downloadgnome-control-center-064dac63c0d3816dfdc34dd7dc45400a8fa6b7f5.tar.gz
Disable the wallpaper if we couldn't load it (bg_applier_apply_prefs):
2001-12-20 Bradford Hovinen <hovinen@ximian.com> * applier.c (bg_applier_apply_prefs): Disable the wallpaper if we couldn't load it (bg_applier_apply_prefs): Create a clone of the preferences structure first and work off of that (wallpaper_full_cover_p): Return FALSE if the wallpaper pixbuf is NULL
-rw-r--r--libbackground/ChangeLog9
-rw-r--r--libbackground/applier.c32
-rw-r--r--libbackground/preferences.c7
3 files changed, 32 insertions, 16 deletions
diff --git a/libbackground/ChangeLog b/libbackground/ChangeLog
index 11bf8e537..63ed0bdad 100644
--- a/libbackground/ChangeLog
+++ b/libbackground/ChangeLog
@@ -1,5 +1,14 @@
2001-12-20 Bradford Hovinen <hovinen@ximian.com>
+ * applier.c (bg_applier_apply_prefs): Disable the wallpaper if we
+ couldn't load it
+ (bg_applier_apply_prefs): Create a clone of the preferences
+ structure first and work off of that
+ (wallpaper_full_cover_p): Return FALSE if the wallpaper pixbuf is NULL
+
+ * preferences.c (bg_preferences_merge_entry): Don't actually set
+ the wallpaper to "enabled" unless we can load the thing
+
* applier.c: Eliminate compiler warnings
* applier.[ch]: Rename applier to bg_applier to avoid possible
diff --git a/libbackground/applier.c b/libbackground/applier.c
index 8f541a9b4..51ecb04fa 100644
--- a/libbackground/applier.c
+++ b/libbackground/applier.c
@@ -354,47 +354,53 @@ bg_applier_new (BGApplierType type)
void
bg_applier_apply_prefs (BGApplier *bg_applier,
- const BGPreferences *prefs)
+ const BGPreferences *prefs)
{
+ BGPreferences *new_prefs;
+
g_return_if_fail (bg_applier != NULL);
g_return_if_fail (IS_BG_APPLIER (bg_applier));
+ new_prefs = BG_PREFERENCES (bg_preferences_clone (prefs));
+
if (bg_applier->p->type == BG_APPLIER_ROOT && bg_applier->p->nautilus_running)
set_root_pixmap ((GdkPixmap *) -1);
- if (!prefs->enabled) {
+ if (!new_prefs->enabled) {
if (bg_applier->p->type == BG_APPLIER_PREVIEW)
draw_disabled_message (bg_applier_get_preview_widget (bg_applier));
return;
}
- if (need_wallpaper_load_p (bg_applier, prefs)) {
+ if (need_wallpaper_load_p (bg_applier, new_prefs)) {
if (bg_applier->p->wallpaper_pixbuf != NULL)
gdk_pixbuf_unref (bg_applier->p->wallpaper_pixbuf);
bg_applier->p->wallpaper_pixbuf = NULL;
- if (prefs->wallpaper_enabled) {
- g_return_if_fail (prefs->wallpaper_filename != NULL);
+ if (new_prefs->wallpaper_enabled) {
+ g_return_if_fail (new_prefs->wallpaper_filename != NULL);
bg_applier->p->wallpaper_pixbuf =
- gdk_pixbuf_new_from_file (prefs->wallpaper_filename, NULL);
+ gdk_pixbuf_new_from_file (new_prefs->wallpaper_filename, NULL);
- if (bg_applier->p->wallpaper_pixbuf == NULL)
+ if (bg_applier->p->wallpaper_pixbuf == NULL) {
g_warning (_("Could not load pixbuf \"%s\"; disabling wallpaper."),
- prefs->wallpaper_filename);
+ new_prefs->wallpaper_filename);
+ new_prefs->wallpaper_enabled = FALSE;
+ }
}
}
if (bg_applier->p->type == BG_APPLIER_ROOT)
nice (20);
- run_render_pipeline (bg_applier, prefs);
+ run_render_pipeline (bg_applier, new_prefs);
if (bg_applier->p->last_prefs != NULL)
g_object_unref (G_OBJECT (bg_applier->p->last_prefs));
- bg_applier->p->last_prefs = BG_PREFERENCES (bg_preferences_clone (prefs));
+ bg_applier->p->last_prefs = new_prefs;
if (bg_applier->p->type == BG_APPLIER_PREVIEW && bg_applier->p->preview_widget != NULL)
gtk_widget_queue_draw (bg_applier->p->preview_widget);
@@ -1229,11 +1235,7 @@ wallpaper_full_cover_p (const BGApplier *bg_applier, const BGPreferences *prefs)
gint pwidth, pheight;
gdouble asp1, asp2;
- /* We can't make this determination until the wallpaper is loaded, if
- * wallpaper is enabled */
- g_return_val_if_fail (!prefs->wallpaper_enabled || bg_applier->p->wallpaper_pixbuf != NULL, TRUE);
-
- if (!prefs->wallpaper_enabled)
+ if (bg_applier->p->wallpaper_pixbuf == NULL)
return FALSE;
else if (gdk_pixbuf_get_has_alpha (bg_applier->p->wallpaper_pixbuf))
return FALSE;
diff --git a/libbackground/preferences.c b/libbackground/preferences.c
index 71ec4732d..0bc396168 100644
--- a/libbackground/preferences.c
+++ b/libbackground/preferences.c
@@ -239,7 +239,12 @@ bg_preferences_merge_entry (BGPreferences *prefs,
prefs->gradient_enabled = TRUE;
}
else if (!strcmp (entry->key, "/desktop/gnome/background/wallpaper-enabled")) {
- prefs->wallpaper_enabled = gconf_value_get_bool (value);
+ if (gconf_value_get_bool (value) &&
+ strcmp (prefs->wallpaper_filename, "") != 0 &&
+ strcmp (prefs->wallpaper_filename, "(none)") != 0)
+ prefs->wallpaper_enabled = TRUE;
+ else
+ prefs->wallpaper_enabled = FALSE;
}
else if (!strcmp (entry->key, "/desktop/gnome/background/wallpaper-type")) {
prefs->wallpaper_type = gconf_value_get_int (value);