From 79e6a724e78801b81ce240e9d0eaed0515eed1b5 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Thu, 17 Dec 2009 21:49:18 +0000 Subject: [PATCH] 'set as wallpaper': simpler and faster. * allow path and dev to be handled by eina_stringshare_replace() and thus if they were the last reference, we do not remove from share to add them again. * just call save queue and set as wallpaper if something actually changed. SVN revision: 44525 --- .../conf_wallpaper/e_int_config_wallpaper.c | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/modules/conf_wallpaper/e_int_config_wallpaper.c b/src/modules/conf_wallpaper/e_int_config_wallpaper.c index 39ab878a6..c541db612 100644 --- a/src/modules/conf_wallpaper/e_int_config_wallpaper.c +++ b/src/modules/conf_wallpaper/e_int_config_wallpaper.c @@ -168,22 +168,16 @@ void e_int_config_wallpaper_handler_set(Evas_Object *obj, const char *path, void *data) { const char *dev, *fpath; + Eina_Bool r1, r2; if (!path) return; e_fm2_path_get(obj, &dev, &fpath); - if (e_config->wallpaper_import_last_dev) - { - eina_stringshare_del(e_config->wallpaper_import_last_dev); - e_config->wallpaper_import_last_dev = NULL; - } - if (dev) - e_config->wallpaper_import_last_dev = eina_stringshare_add(dev); - if (e_config->wallpaper_import_last_path) { - eina_stringshare_del(e_config->wallpaper_import_last_path); - e_config->wallpaper_import_last_path = NULL; - } - if (fpath) - e_config->wallpaper_import_last_path = eina_stringshare_add(fpath); + + r1 = eina_stringshare_replace(&e_config->wallpaper_import_last_dev, dev); + r2 = eina_stringshare_replace(&e_config->wallpaper_import_last_path, fpath); + + if ((!r1) && (!r2)) return; + e_config_save_queue(); e_int_config_wallpaper_import(NULL, path);