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
This commit is contained in:
parent
894a0a1c3a
commit
064dac63c0
3 changed files with 32 additions and 16 deletions
|
@ -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
|
||||
|
|
|
@ -356,45 +356,51 @@ void
|
|||
bg_applier_apply_prefs (BGApplier *bg_applier,
|
||||
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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue