efreet: update language for daemon

SVN revision: 79721
This commit is contained in:
Sebastian Dransfeld 2012-11-26 16:07:55 +00:00
parent de02fe4438
commit c823b3fe29
6 changed files with 59 additions and 7 deletions

View File

@ -166,3 +166,7 @@
2012-11-24 Sebastian Dransfeld
* Fix alloca
2012-11-26 Sebastian Dransfeld
* Update language for efreetd

View File

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

View File

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

View File

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

View File

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

View File

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