From f38c608627b2e8e8272fd4bc59992c6c544df9a2 Mon Sep 17 00:00:00 2001 From: Sebastian Dransfeld Date: Fri, 2 Nov 2012 01:47:06 +0000 Subject: [PATCH] efreet: reply on ping whether cache exists And trigger event SVN revision: 78813 --- legacy/efreet/src/bin/efreetd_cache.c | 12 ++++++++++++ legacy/efreet/src/bin/efreetd_cache.h | 1 + legacy/efreet/src/bin/efreetd_dbus.c | 8 ++++++-- legacy/efreet/src/lib/efreet_cache.c | 4 +++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/legacy/efreet/src/bin/efreetd_cache.c b/legacy/efreet/src/bin/efreetd_cache.c index cd1132aaff..ad16dc3ee1 100644 --- a/legacy/efreet/src/bin/efreetd_cache.c +++ b/legacy/efreet/src/bin/efreetd_cache.c @@ -23,6 +23,8 @@ static Ecore_Exe *desktop_cache_exe = NULL; static Ecore_Timer *icon_cache_timer = NULL; static Ecore_Timer *desktop_cache_timer = NULL; +static Eina_Bool desktop_exists = EINA_FALSE; + static Eina_List *desktop_system_dirs = NULL; static Eina_List *desktop_extra_dirs = NULL; static Eina_List *icon_extra_dirs = NULL; @@ -135,6 +137,7 @@ cache_exe_data_cb(void *data __UNUSED__, int type __UNUSED__, void *event) if ((ev->lines) && (*ev->lines->line == 'c')) update = EINA_TRUE; + desktop_exists = EINA_TRUE; send_signal_desktop_cache_update(update); } else if (ev->exe == icon_cache_exe) @@ -202,6 +205,7 @@ icon_changes_monitor_add(const char *path) if (!ecore_file_is_dir(path)) return; if (eina_hash_find(change_monitors, path)) return; + /* TODO: Check for symlink and monitor the real path */ mon = ecore_file_monitor_add(path, icon_changes_cb, NULL); @@ -213,6 +217,7 @@ icon_changes_monitor_add(const char *path) EINA_ITERATOR_FOREACH(it, info) { if (info->type != EINA_FILE_DIR) continue; + /* TODO: Check for symlink and monitor the real path */ mon = ecore_file_monitor_add(info->path, icon_changes_cb, NULL); @@ -297,6 +302,7 @@ desktop_changes_monitor_add(const char *path) Ecore_File_Monitor *mon; if (eina_hash_find(change_monitors, path)) return; + /* TODO: Check for symlink and monitor the real path */ mon = ecore_file_monitor_add(path, desktop_changes_cb, NULL); @@ -445,6 +451,12 @@ cache_desktop_update(void) desktop_cache_timer = ecore_timer_add(0.2, desktop_cache_update_cache_cb, NULL); } +Eina_Bool +cache_desktop_exists(void) +{ + return desktop_exists; +} + Eina_Bool cache_init(void) { diff --git a/legacy/efreet/src/bin/efreetd_cache.h b/legacy/efreet/src/bin/efreetd_cache.h index 252f6d2edc..2fb520e384 100644 --- a/legacy/efreet/src/bin/efreetd_cache.h +++ b/legacy/efreet/src/bin/efreetd_cache.h @@ -5,6 +5,7 @@ void cache_desktop_dir_add(const char *dir); void cache_icon_dir_add(const char *dir); void cache_icon_ext_add(const char *ext); void cache_desktop_update(void); +Eina_Bool cache_desktop_exists(void); Eina_Bool cache_init(void); Eina_Bool cache_shutdown(void); diff --git a/legacy/efreet/src/bin/efreetd_dbus.c b/legacy/efreet/src/bin/efreetd_dbus.c index dd9fa22a2a..92902ab7f2 100644 --- a/legacy/efreet/src/bin/efreetd_dbus.c +++ b/legacy/efreet/src/bin/efreetd_dbus.c @@ -24,7 +24,11 @@ static EDBus_Service_Interface *iface; static EDBus_Message * ping(const EDBus_Service_Interface *ifc __UNUSED__, const EDBus_Message *message) { - return edbus_message_method_return_new(message); + EDBus_Message *reply; + + reply = edbus_message_method_return_new(message); + edbus_message_arguments_set(reply, "b", cache_desktop_exists()); + return reply; } static EDBus_Message * @@ -103,7 +107,7 @@ static const EDBus_Signal signals[] = { static const EDBus_Method methods[] = { /* TODO: Register / Unregister */ { - "Ping", NULL, NULL, + "Ping", NULL, EDBUS_ARGS({"b", "cache exists"}), ping, 0 }, { diff --git a/legacy/efreet/src/lib/efreet_cache.c b/legacy/efreet/src/lib/efreet_cache.c index 5dbe86e717..acdc711f2d 100644 --- a/legacy/efreet/src/lib/efreet_cache.c +++ b/legacy/efreet/src/lib/efreet_cache.c @@ -1049,12 +1049,15 @@ static void on_send_ping(void *data __UNUSED__, const EDBus_Message *msg, EDBus_Pending *pending __UNUSED__) { const char *errname, *errmsg; + Eina_Bool exists; if (edbus_message_error_get(msg, &errname, &errmsg)) { ERR("%s %s", errname, errmsg); return; } + if (edbus_message_arguments_get(msg, "b", &exists) && exists) + ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_BUILD, NULL, NULL, NULL); } static void @@ -1074,7 +1077,6 @@ desktop_cache_update(void *context __UNUSED__, const EDBus_Message *msg) if (ev) ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_UPDATE, ev, NULL, NULL); } - /* TODO: Need to send this event always */ ecore_event_add(EFREET_EVENT_DESKTOP_CACHE_BUILD, NULL, NULL, NULL); } }