efreet: reply on ping whether cache exists

And trigger event

SVN revision: 78813
This commit is contained in:
Sebastian Dransfeld 2012-11-02 01:47:06 +00:00
parent 9262991a45
commit f38c608627
4 changed files with 22 additions and 3 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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
},
{

View File

@ -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);
}
}