diff options
author | Alexander Larsson <alexl@redhat.com> | 2003-06-10 17:02:38 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2003-06-10 17:02:38 +0000 |
commit | 98179bf4c7b2a1001e7fb2fdd2932fa8001ee016 (patch) | |
tree | 3d613a24325595ac40485e772ffad2521bf52e1e /libnautilus-private/nautilus-directory-background.c | |
parent | f364c0618ec4ed8373a495a187cc1688131aa15e (diff) | |
download | nautilus-98179bf4c7b2a1001e7fb2fdd2932fa8001ee016.tar.gz |
Don't update the desktop background image four times for each change in
2003-06-10 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-directory-background.c:
Don't update the desktop background image four times
for each change in the desktop directory.
Diffstat (limited to 'libnautilus-private/nautilus-directory-background.c')
-rw-r--r-- | libnautilus-private/nautilus-directory-background.c | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c index 917030846..799ea8924 100644 --- a/libnautilus-private/nautilus-directory-background.c +++ b/libnautilus-private/nautilus-directory-background.c @@ -598,7 +598,7 @@ image_loading_done_callback (EelBackground *background, gboolean successful_load static void nautilus_file_update_root_pixmaps (EelBackground *background) -{ +{ if (eel_background_is_loaded (background)) { image_loading_done_callback (background, TRUE, GINT_TO_POINTER (FALSE)); } else { @@ -696,13 +696,14 @@ background_changed_callback (EelBackground *background, } } -static void +static gboolean initialize_background_from_settings (NautilusFile *file, EelBackground *background) { - char *color; - char *image; - EelBackgroundImagePlacement placement; + char *color, *old_color; + char *image, *old_image; + EelBackgroundImagePlacement placement, old_placement; + gboolean changed; g_assert (NAUTILUS_IS_FILE (file)); g_assert (EEL_IS_BACKGROUND (background)); @@ -735,14 +736,33 @@ initialize_background_from_settings (NautilusFile *file, G_CALLBACK (background_changed_callback), file); - eel_background_set_color (background, color); - if (background_is_desktop(background)) { - eel_background_set_image_uri_sync (background, image); + + changed = FALSE; + + old_color = eel_background_get_color (background); + if (eel_strcmp (color, old_color) != 0) { + eel_background_set_color (background, color); + changed = TRUE; } - else { - eel_background_set_image_uri (background, image); + g_free (old_color); + + old_image = eel_background_get_image_uri (background); + if (eel_strcmp (image, old_image) != 0) { + if (background_is_desktop(background)) { + eel_background_set_image_uri_sync (background, image); + } + else { + eel_background_set_image_uri (background, image); + } + changed = TRUE; + } + g_free (old_image); + + old_placement = eel_background_get_image_placement (background); + if (old_placement != placement) { + eel_background_set_image_placement (background, placement); + changed = TRUE; } - eel_background_set_image_placement (background, placement); /* Unblock the handler. */ g_signal_handlers_unblock_by_func @@ -752,6 +772,8 @@ initialize_background_from_settings (NautilusFile *file, g_free (color); g_free (image); + + return changed; } /* handle the file changed signal */ @@ -759,9 +781,10 @@ static void saved_settings_changed_callback (NautilusFile *file, EelBackground *background) { - initialize_background_from_settings (file, background); + gboolean changed; + changed = initialize_background_from_settings (file, background); - if (background_is_desktop (background)) { + if (changed && background_is_desktop (background)) { nautilus_file_update_root_pixmaps (background); } } |