diff --git a/legacy/efreet/ChangeLog b/legacy/efreet/ChangeLog index ad112471d9..f7ef484526 100644 --- a/legacy/efreet/ChangeLog +++ b/legacy/efreet/ChangeLog @@ -166,3 +166,7 @@ 2012-11-24 Sebastian Dransfeld * Fix alloca + +2012-11-26 Sebastian Dransfeld + + * Update language for efreetd diff --git a/legacy/efreet/src/bin/efreetd_cache.c b/legacy/efreet/src/bin/efreetd_cache.c index 2b53060d52..1e1d4c9ff1 100644 --- a/legacy/efreet/src/bin/efreetd_cache.c +++ b/legacy/efreet/src/bin/efreetd_cache.c @@ -31,6 +31,9 @@ static Eina_List *icon_extra_dirs = NULL; static Eina_List *icon_exts = NULL; static Eina_Bool icon_flush = EINA_FALSE; +static Eina_Bool desktop_queue = EINA_FALSE; +static Eina_Bool icon_queue = EINA_FALSE; + static void desktop_changes_monitor_add(const char *path); /* internal */ @@ -42,7 +45,12 @@ icon_cache_update_cache_cb(void *data __UNUSED__) icon_cache_timer = NULL; - if (icon_cache_exe) return ECORE_CALLBACK_CANCEL; + if (icon_cache_exe) + { + icon_queue = EINA_TRUE; + return ECORE_CALLBACK_CANCEL; + } + icon_queue = EINA_FALSE; if ((!icon_flush) && (!icon_exts)) return ECORE_CALLBACK_CANCEL; /* TODO: Queue if already running */ @@ -102,8 +110,12 @@ desktop_cache_update_cache_cb(void *data __UNUSED__) desktop_cache_timer = NULL; - if (desktop_cache_exe) return ECORE_CALLBACK_CANCEL; - /* TODO: Queue if already running */ + if (desktop_cache_exe) + { + desktop_queue = EINA_TRUE; + return ECORE_CALLBACK_CANCEL; + } + desktop_queue = EINA_FALSE; prio = ecore_exe_run_priority_get(); ecore_exe_run_priority_set(19); // XXX: use eina_prefix, not hard-coded prefixes @@ -165,10 +177,12 @@ cache_exe_del_cb(void *data __UNUSED__, int type __UNUSED__, void *event) if (ev->exe == desktop_cache_exe) { desktop_cache_exe = NULL; + if (desktop_queue) cache_desktop_update(); } else if (ev->exe == icon_cache_exe) { icon_cache_exe = NULL; + if (icon_queue) cache_icon_update(EINA_FALSE); } return ECORE_CALLBACK_RENEW; } diff --git a/legacy/efreet/src/bin/efreetd_dbus.c b/legacy/efreet/src/bin/efreetd_dbus.c index f99a239a8f..524a8b0d34 100644 --- a/legacy/efreet/src/bin/efreetd_dbus.c +++ b/legacy/efreet/src/bin/efreetd_dbus.c @@ -46,6 +46,14 @@ static EDBus_Message * do_register(const EDBus_Service_Interface *ifc __UNUSED__, const EDBus_Message *message) { EDBus_Message *reply; + const char *lang; + + if (!edbus_message_arguments_get(message, "s", &lang)) + { + ERR("Error getting arguments."); + return NULL; + } + setenv("LANG", lang, 1); clients++; if (shutdown) ecore_timer_del(shutdown); @@ -111,6 +119,15 @@ add_icon_dirs(const EDBus_Service_Interface *ifc __UNUSED__, const EDBus_Message static EDBus_Message * build_desktop_cache(const EDBus_Service_Interface *ifc __UNUSED__, const EDBus_Message *message __UNUSED__) { + const char *lang; + + if (!edbus_message_arguments_get(message, "s", &lang)) + { + ERR("Error getting arguments."); + return NULL; + } + setenv("LANG", lang, 1); + cache_desktop_update(); return NULL; } @@ -143,7 +160,7 @@ static const EDBus_Signal signals[] = { static const EDBus_Method methods[] = { { - "Register", NULL, EDBUS_ARGS({"b", "cache exists"}), + "Register", EDBUS_ARGS({"s", "lang info"}), EDBUS_ARGS({"b", "cache exists"}), do_register, 0 }, { @@ -155,7 +172,7 @@ static const EDBus_Method methods[] = { add_desktop_dirs, EDBUS_METHOD_FLAG_NOREPLY }, { - "BuildDesktopCache", NULL, NULL, + "BuildDesktopCache", EDBUS_ARGS({"s", "lang info"}), NULL, build_desktop_cache, EDBUS_METHOD_FLAG_NOREPLY }, { diff --git a/legacy/efreet/src/lib/efreet.c b/legacy/efreet/src/lib/efreet.c index 6899a2b1fa..9a2f187009 100644 --- a/legacy/efreet/src/lib/efreet.c +++ b/legacy/efreet/src/lib/efreet.c @@ -29,6 +29,7 @@ static int efreet_parsed_locale = 0; static const char *efreet_lang = NULL; static const char *efreet_lang_country = NULL; static const char *efreet_lang_modifier = NULL; +static const char *efreet_language = NULL; static void efreet_parse_locale(void); static int efreet_parse_locale_setting(const char *env); @@ -151,6 +152,7 @@ efreet_shutdown(void) IF_RELEASE(efreet_lang); IF_RELEASE(efreet_lang_country); IF_RELEASE(efreet_lang_modifier); + IF_RELEASE(efreet_language); efreet_parsed_locale = 0; /* reset this in case they init efreet again */ ecore_file_shutdown(); @@ -167,9 +169,11 @@ efreet_lang_reset(void) IF_RELEASE(efreet_lang); IF_RELEASE(efreet_lang_country); IF_RELEASE(efreet_lang_modifier); + IF_RELEASE(efreet_language); efreet_parsed_locale = 0; /* reset this in case they init efreet again */ efreet_dirs_reset(); + efreet_parse_locale(); efreet_cache_desktop_close(); efreet_cache_desktop_build(); } @@ -217,6 +221,15 @@ efreet_lang_modifier_get(void) return efreet_lang_modifier; } +EAPI const char * +efreet_language_get(void) +{ + if (efreet_parsed_locale) return efreet_language; + + efreet_parse_locale(); + return efreet_language; +} + /** * @internal * @return Returns no value @@ -286,6 +299,8 @@ efreet_parse_locale_setting(const char *env) found = 1; } + if (found) + efreet_language = eina_stringshare_add(getenv(env)); return found; } diff --git a/legacy/efreet/src/lib/efreet_cache.c b/legacy/efreet/src/lib/efreet_cache.c index 9f607bb538..b526a1f23a 100644 --- a/legacy/efreet/src/lib/efreet_cache.c +++ b/legacy/efreet/src/lib/efreet_cache.c @@ -134,7 +134,7 @@ efreet_cache_init(void) edbus_proxy_signal_handler_add(proxy, "IconCacheUpdate", icon_cache_update, NULL); edbus_proxy_signal_handler_add(proxy, "DesktopCacheUpdate", desktop_cache_update, NULL); - edbus_proxy_call(proxy, "Register", on_send_register, NULL, -1, ""); + edbus_proxy_call(proxy, "Register", on_send_register, NULL, -1, "s", efreet_language_get()); /* * TODO: Needed? @@ -958,7 +958,8 @@ void efreet_cache_desktop_build(void) { if (!efreet_cache_update) return; - edbus_proxy_call(proxy, "BuildDesktopCache", NULL, NULL, -1, ""); + if (proxy) + edbus_proxy_call(proxy, "BuildDesktopCache", NULL, NULL, -1, "s", efreet_language_get()); } static Eina_Bool diff --git a/legacy/efreet/src/lib/efreet_private.h b/legacy/efreet/src/lib/efreet_private.h index 2f7821c41c..7c9e3c3c72 100644 --- a/legacy/efreet/src/lib/efreet_private.h +++ b/legacy/efreet/src/lib/efreet_private.h @@ -192,6 +192,7 @@ void efreet_dirs_reset(void); const char *efreet_lang_get(void); const char *efreet_lang_country_get(void); const char *efreet_lang_modifier_get(void); +EAPI const char *efreet_language_get(void); size_t efreet_array_cat(char *buffer, size_t size, const char *strs[]);