parent
ca94561458
commit
b150b36b93
368
src/bin/e_intl.c
368
src/bin/e_intl.c
|
@ -15,7 +15,7 @@ static char *_e_intl_language = NULL;
|
|||
static char *_e_intl_language_alias = NULL;
|
||||
|
||||
static char *_e_intl_orig_xmodifiers = NULL;
|
||||
static char *_e_intl_orig_qt_im_module = NULL;
|
||||
static char *_e_intl_orig_qt_im_module = NULL;
|
||||
static char *_e_intl_orig_gtk_im_module = NULL;
|
||||
|
||||
static const char *_e_intl_imc_personal_path = NULL;
|
||||
|
@ -59,7 +59,7 @@ EAPI int
|
|||
e_intl_init(void)
|
||||
{
|
||||
char *s;
|
||||
|
||||
|
||||
_e_intl_input_method_config_edd = E_CONFIG_DD_NEW("input_method_config", E_Input_Method_Config);
|
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, version, INT);
|
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, e_im_name, STR);
|
||||
|
@ -67,7 +67,7 @@ e_intl_init(void)
|
|||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, qt_im_module, STR);
|
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, xmodifiers, STR);
|
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, e_im_exec, STR);
|
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, e_im_setup_exec, STR);
|
||||
E_CONFIG_VAL(_e_intl_input_method_config_edd, E_Input_Method_Config, e_im_setup_exec, STR);
|
||||
|
||||
if ((s = getenv("LC_MESSAGES"))) _e_intl_orig_lc_messages = strdup(s);
|
||||
if ((s = getenv("LANGUAGE"))) _e_intl_orig_language = strdup(s);
|
||||
|
@ -77,7 +77,7 @@ e_intl_init(void)
|
|||
if ((s = getenv("GTK_IM_MODULE"))) _e_intl_orig_gtk_im_module = strdup(s);
|
||||
if ((s = getenv("QT_IM_MODULE"))) _e_intl_orig_qt_im_module = strdup(s);
|
||||
if ((s = getenv("XMODIFIERS"))) _e_intl_orig_xmodifiers = strdup(s);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -89,18 +89,18 @@ e_intl_shutdown(void)
|
|||
E_FREE(_e_intl_orig_language);
|
||||
E_FREE(_e_intl_orig_lc_all);
|
||||
E_FREE(_e_intl_orig_lang);
|
||||
|
||||
|
||||
E_FREE(_e_intl_orig_gtk_im_module);
|
||||
E_FREE(_e_intl_orig_qt_im_module);
|
||||
E_FREE(_e_intl_orig_xmodifiers);
|
||||
|
||||
if (_e_intl_imc_personal_path)
|
||||
evas_stringshare_del(_e_intl_imc_personal_path);
|
||||
evas_stringshare_del(_e_intl_imc_personal_path);
|
||||
if (_e_intl_imc_system_path)
|
||||
evas_stringshare_del(_e_intl_imc_system_path);
|
||||
|
||||
|
||||
E_CONFIG_DD_FREE(_e_intl_input_method_config_edd);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -110,11 +110,11 @@ e_intl_post_init(void)
|
|||
{
|
||||
if ((e_config->language) && (e_config->language[0] != 0))
|
||||
e_intl_language_set(e_config->language);
|
||||
else
|
||||
else
|
||||
e_intl_language_set(NULL);
|
||||
|
||||
|
||||
if ((e_config->input_method) && (e_config->input_method[0] != 0))
|
||||
e_intl_input_method_set(e_config->input_method);
|
||||
e_intl_input_method_set(e_config->input_method);
|
||||
|
||||
_e_intl_exit_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _e_intl_cb_exit, NULL);
|
||||
return 1;
|
||||
|
@ -126,20 +126,20 @@ e_intl_post_shutdown(void)
|
|||
if (_e_intl_exit_handler)
|
||||
{
|
||||
ecore_event_handler_del(_e_intl_exit_handler);
|
||||
_e_intl_exit_handler = NULL;
|
||||
_e_intl_exit_handler = NULL;
|
||||
}
|
||||
|
||||
|
||||
e_intl_input_method_set(NULL);
|
||||
|
||||
|
||||
e_intl_language_set(NULL);
|
||||
E_FREE(_e_intl_language_alias);
|
||||
|
||||
|
||||
E_EXE_STOP(_e_intl_input_method_exec);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO
|
||||
* TODO
|
||||
* - Add error dialogs explaining any errors while setting the locale
|
||||
* * Locale aliases need to be configured
|
||||
* * Locale is invalid
|
||||
|
@ -151,10 +151,10 @@ EAPI void
|
|||
e_intl_language_set(const char *lang)
|
||||
{
|
||||
int set_envars;
|
||||
|
||||
|
||||
set_envars = 1;
|
||||
/* NULL lang means set everything back to the original environment
|
||||
* defaults
|
||||
/* NULL lang means set everything back to the original environment
|
||||
* defaults
|
||||
*/
|
||||
if (!lang)
|
||||
{
|
||||
|
@ -162,24 +162,24 @@ e_intl_language_set(const char *lang)
|
|||
e_util_env_set("LANGUAGE", _e_intl_orig_language);
|
||||
e_util_env_set("LC_ALL", _e_intl_orig_lc_all);
|
||||
e_util_env_set("LANG", _e_intl_orig_lang);
|
||||
|
||||
|
||||
lang = getenv("LC_MESSAGES");
|
||||
if (!lang) lang = getenv("LANGUAGE");
|
||||
if (!lang) lang = getenv("LC_ALL");
|
||||
if (!lang) lang = getenv("LANG");
|
||||
|
||||
|
||||
set_envars = 0;
|
||||
}
|
||||
|
||||
|
||||
E_FREE(_e_intl_language_alias);
|
||||
_e_intl_language_alias = _e_intl_locale_alias_get(lang);
|
||||
_e_intl_language_alias = _e_intl_locale_alias_get(lang);
|
||||
E_FREE(_e_intl_language);
|
||||
|
||||
|
||||
if (lang)
|
||||
_e_intl_language = strdup(lang);
|
||||
else
|
||||
_e_intl_language = NULL;
|
||||
|
||||
|
||||
if (!_e_intl_locale_validate(_e_intl_language_alias))
|
||||
{
|
||||
fprintf(stderr, "The locale '%s' cannot be found on your "
|
||||
|
@ -196,44 +196,44 @@ e_intl_language_set(const char *lang)
|
|||
e_util_env_set("LC_ALL", _e_intl_language);
|
||||
e_util_env_set("LC_MESSAGES", _e_intl_language);
|
||||
}
|
||||
|
||||
|
||||
setlocale(LC_ALL, _e_intl_language);
|
||||
if (_e_intl_language)
|
||||
{
|
||||
char *locale_path;
|
||||
|
||||
|
||||
locale_path = _e_intl_language_path_find(_e_intl_language_alias);
|
||||
if (locale_path == NULL)
|
||||
{
|
||||
E_Locale_Parts *locale_parts;
|
||||
|
||||
locale_parts = e_intl_locale_parts_get(_e_intl_language_alias);
|
||||
|
||||
|
||||
/* If locale is C or some form of en don't report an error */
|
||||
if ( locale_parts == NULL && strcmp (_e_intl_language_alias, "C") )
|
||||
{
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"An error occurred setting your locale. \n\n"
|
||||
|
||||
|
||||
"The locale you have chosen '%s' appears to \n"
|
||||
"be an alias, however, it can not be resloved.\n"
|
||||
"Please make sure you have a 'locale.alias' \n"
|
||||
"file in your 'messages' path which can resolve\n"
|
||||
"this alias.\n\n"
|
||||
|
||||
"Enlightenment will not be translated.\n",
|
||||
|
||||
"Enlightenment will not be translated.\n",
|
||||
_e_intl_language_alias);
|
||||
}
|
||||
else if ( locale_parts && locale_parts->lang && strcmp(locale_parts->lang, "en") )
|
||||
else if ( locale_parts && locale_parts->lang && strcmp(locale_parts->lang, "en") )
|
||||
{
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"An error occurred setting your locale. \n\n"
|
||||
|
||||
|
||||
"The translation files for the locale you \n"
|
||||
"have chosen (%s) cannot be found in your \n"
|
||||
"'messages' path. \n\n"
|
||||
|
||||
"Enlightenment will not be translated.\n",
|
||||
|
||||
"Enlightenment will not be translated.\n",
|
||||
_e_intl_language_alias);
|
||||
}
|
||||
e_intl_locale_parts_free(locale_parts);
|
||||
|
@ -244,7 +244,7 @@ e_intl_language_set(const char *lang)
|
|||
textdomain(PACKAGE);
|
||||
bind_textdomain_codeset(PACKAGE, "UTF-8");
|
||||
free(locale_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -272,10 +272,10 @@ e_intl_language_list(void)
|
|||
dir_list = e_path_dir_list_get(path_messages);
|
||||
for (next = dir_list ; next ; next = next->next)
|
||||
{
|
||||
E_Path_Dir *epd;
|
||||
E_Path_Dir *epd;
|
||||
Evas_List *dir_languages;
|
||||
|
||||
epd = next->data;
|
||||
|
||||
epd = next->data;
|
||||
dir_languages = _e_intl_language_dir_scan(epd->dir);
|
||||
while (dir_languages)
|
||||
{
|
||||
|
@ -284,7 +284,7 @@ e_intl_language_list(void)
|
|||
language = dir_languages->data;
|
||||
dir_languages = evas_list_remove_list(dir_languages, dir_languages);
|
||||
|
||||
if ( _e_intl_language_list_find(all_languages, language) || (strlen(language) > 2 &&
|
||||
if ( _e_intl_language_list_find(all_languages, language) || (strlen(language) > 2 &&
|
||||
!_e_intl_locale_validate(language)))
|
||||
{
|
||||
free(language);
|
||||
|
@ -295,7 +295,7 @@ e_intl_language_list(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
e_path_dir_list_free(dir_list);
|
||||
|
||||
return all_languages;
|
||||
|
@ -305,7 +305,7 @@ static int
|
|||
_e_intl_language_list_find(Evas_List *language_list, char *language)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
|
||||
if (!language_list) return 0;
|
||||
if (!language) return 0;
|
||||
|
||||
|
@ -316,7 +316,7 @@ _e_intl_language_list_find(Evas_List *language_list, char *language)
|
|||
lang = l->data;
|
||||
if (!strcmp(lang, language)) return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -325,14 +325,14 @@ e_intl_input_method_set(const char *imc_path)
|
|||
{
|
||||
if (!imc_path)
|
||||
{
|
||||
E_EXE_STOP(_e_intl_input_method_exec);
|
||||
E_EXE_STOP(_e_intl_input_method_exec);
|
||||
e_util_env_set("GTK_IM_MODULE", _e_intl_orig_gtk_im_module);
|
||||
e_util_env_set("QT_IM_MODULE", _e_intl_orig_qt_im_module);
|
||||
e_util_env_set("XMODIFIERS", _e_intl_orig_xmodifiers);
|
||||
}
|
||||
|
||||
if (imc_path)
|
||||
{
|
||||
}
|
||||
|
||||
if (imc_path)
|
||||
{
|
||||
Eet_File *imc_ef;
|
||||
E_Input_Method_Config *imc;
|
||||
|
||||
|
@ -341,36 +341,36 @@ e_intl_input_method_set(const char *imc_path)
|
|||
{
|
||||
imc = e_intl_input_method_config_read(imc_ef);
|
||||
eet_close(imc_ef);
|
||||
|
||||
if (imc)
|
||||
{
|
||||
|
||||
if (imc)
|
||||
{
|
||||
e_util_env_set("GTK_IM_MODULE", imc->gtk_im_module);
|
||||
e_util_env_set("QT_IM_MODULE", imc->qt_im_module);
|
||||
e_util_env_set("XMODIFIERS", imc->xmodifiers);
|
||||
|
||||
E_EXE_STOP(_e_intl_input_method_exec);
|
||||
|
||||
if (E_EXE_IS_VALID(imc->e_im_exec))
|
||||
|
||||
E_EXE_STOP(_e_intl_input_method_exec);
|
||||
|
||||
if (E_EXE_IS_VALID(imc->e_im_exec))
|
||||
{
|
||||
e_util_library_path_strip();
|
||||
_e_intl_input_method_exec = ecore_exe_run(imc->e_im_exec, NULL);
|
||||
e_util_library_path_restore();
|
||||
ecore_exe_tag_set(_e_intl_input_method_exec,"E/im_exec");
|
||||
|
||||
if ( !_e_intl_input_method_exec ||
|
||||
!ecore_exe_pid_get(_e_intl_input_method_exec))
|
||||
|
||||
if ((!_e_intl_input_method_exec) ||
|
||||
(!ecore_exe_pid_get(_e_intl_input_method_exec)))
|
||||
e_util_dialog_show(_("Input Method Error"),
|
||||
_( "Error starting the input method executable<br><br>"
|
||||
|
||||
|
||||
"please make sure that your input<br>"
|
||||
"method configuration is correct and<br>"
|
||||
"that your configuration's<br>"
|
||||
"executable is in your PATH<br>"));
|
||||
"executable is in your PATH<br>"));
|
||||
}
|
||||
e_intl_input_method_config_free(imc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EAPI Evas_List *
|
||||
|
@ -382,8 +382,8 @@ e_intl_input_method_list(void)
|
|||
char *imc_path;
|
||||
|
||||
im_list = NULL;
|
||||
|
||||
/* Personal Path */
|
||||
|
||||
/* Personal Path */
|
||||
input_methods = _e_intl_imc_dir_scan(e_intl_imc_personal_path_get());
|
||||
for (l = input_methods; l; l = l->next)
|
||||
{
|
||||
|
@ -418,7 +418,7 @@ e_intl_imc_personal_path_get(void)
|
|||
if (_e_intl_imc_personal_path == NULL)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/input_methods", e_user_homedir_get());
|
||||
_e_intl_imc_personal_path = evas_stringshare_add(buf);
|
||||
}
|
||||
|
@ -431,7 +431,7 @@ e_intl_imc_system_path_get(void)
|
|||
if (_e_intl_imc_system_path == NULL)
|
||||
{
|
||||
char buf[4096];
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/data/input_methods", e_prefix_data_get());
|
||||
_e_intl_imc_system_path = evas_stringshare_add(buf);
|
||||
}
|
||||
|
@ -444,10 +444,10 @@ EAPI E_Input_Method_Config *
|
|||
e_intl_input_method_config_read(Eet_File *imc_file)
|
||||
{
|
||||
E_Input_Method_Config *imc;
|
||||
|
||||
|
||||
imc = NULL;
|
||||
if (imc_file)
|
||||
{
|
||||
if (imc_file)
|
||||
{
|
||||
imc = (E_Input_Method_Config *) eet_data_read(imc_file, _e_intl_input_method_config_edd, "imc");
|
||||
}
|
||||
return imc;
|
||||
|
@ -485,12 +485,12 @@ static int
|
|||
_e_intl_cb_exit(void *data, int type, void *event)
|
||||
{
|
||||
Ecore_Exe_Event_Del *ev;
|
||||
|
||||
|
||||
ev = event;
|
||||
if (!ev->exe) return 1;
|
||||
|
||||
if (!(ecore_exe_tag_get(ev->exe) &&
|
||||
(!strcmp(ecore_exe_tag_get(ev->exe), "E/im_exec")))) return 1;
|
||||
|
||||
if (!(ecore_exe_tag_get(ev->exe) &&
|
||||
(!strcmp(ecore_exe_tag_get(ev->exe), "E/im_exec")))) return 1;
|
||||
|
||||
_e_intl_input_method_exec = NULL;
|
||||
return 1;
|
||||
|
@ -512,15 +512,15 @@ _e_intl_locale_hash_free_cb(Evas_Hash *hash __UNUSED__, const char *key __UNUSED
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* get the directory associated with the language. Language Must be valid alias
|
||||
* i.e. Already validated and already de-aliased.
|
||||
*
|
||||
* NULL means:
|
||||
* 1) The user does not have an enlightenment translation for this locale
|
||||
* 2) The user does not have their locale.aliases configured correctly
|
||||
*
|
||||
* @return NULL if not found.
|
||||
*
|
||||
* @return NULL if not found.
|
||||
*/
|
||||
static char *
|
||||
_e_intl_language_path_find(char *language)
|
||||
|
@ -532,39 +532,39 @@ _e_intl_language_path_find(char *language)
|
|||
Evas_List *next_search;
|
||||
int found;
|
||||
|
||||
search_list = _e_intl_locale_search_order_get(language);
|
||||
search_list = _e_intl_locale_search_order_get(language);
|
||||
|
||||
if (search_list == NULL) return NULL;
|
||||
|
||||
directory = NULL;
|
||||
found = 0;
|
||||
dir_list = e_path_dir_list_get(path_messages);
|
||||
|
||||
|
||||
/* For each directory in the path */
|
||||
for (next_dir = dir_list ; next_dir && !found ; next_dir = next_dir->next)
|
||||
{
|
||||
E_Path_Dir *epd;
|
||||
epd = next_dir->data;
|
||||
|
||||
|
||||
/* Match canonicalized locale against each possible search */
|
||||
for (next_search = search_list ; next_search && !found ; next_search = next_search->next)
|
||||
{
|
||||
char *search_locale;
|
||||
char message_path[PATH_MAX];
|
||||
|
||||
|
||||
search_locale = next_search->data;
|
||||
snprintf(message_path, sizeof(message_path), "%s/%s/LC_MESSAGES/%s.mo", epd->dir, search_locale, PACKAGE);
|
||||
|
||||
|
||||
if (ecore_file_exists(message_path) && !ecore_file_is_dir(message_path))
|
||||
{
|
||||
directory = strdup(epd->dir);
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
e_path_dir_list_free(dir_list);
|
||||
|
||||
|
||||
while (search_list)
|
||||
{
|
||||
char *data;
|
||||
|
@ -582,20 +582,20 @@ _e_intl_language_dir_scan(const char *dir)
|
|||
Evas_List *languages;
|
||||
Ecore_List *files;
|
||||
char *file;
|
||||
|
||||
|
||||
languages = NULL;
|
||||
|
||||
|
||||
files = ecore_file_ls(dir);
|
||||
if (!files) return NULL;
|
||||
|
||||
|
||||
ecore_list_goto_first(files);
|
||||
if (files)
|
||||
{
|
||||
while ((file = ecore_list_next(files)))
|
||||
{
|
||||
char file_path[PATH_MAX];
|
||||
|
||||
snprintf(file_path, sizeof(file_path),"%s/%s/LC_MESSAGES/%s.mo",
|
||||
|
||||
snprintf(file_path, sizeof(file_path),"%s/%s/LC_MESSAGES/%s.mo",
|
||||
dir, file, PACKAGE);
|
||||
if (ecore_file_exists(file_path) && !ecore_file_is_dir(file_path))
|
||||
languages = evas_list_append(languages, strdup(file));
|
||||
|
@ -606,51 +606,51 @@ _e_intl_language_dir_scan(const char *dir)
|
|||
return languages;
|
||||
}
|
||||
|
||||
/* get the alias for a locale
|
||||
*
|
||||
/* get the alias for a locale
|
||||
*
|
||||
* return pointer to allocated alias string. never returns NULL
|
||||
* String will be the same if its a valid locale already or there
|
||||
* is no alias.
|
||||
* String will be the same if its a valid locale already or there
|
||||
* is no alias.
|
||||
*/
|
||||
static char *
|
||||
_e_intl_locale_alias_get(const char *language)
|
||||
{
|
||||
Evas_Hash *alias_hash;
|
||||
char *alias;
|
||||
|
||||
|
||||
if (language == NULL || !strncmp(language, "POSIX", strlen("POSIX")))
|
||||
return strdup("C");
|
||||
|
||||
|
||||
alias_hash = _e_intl_locale_alias_hash_get();
|
||||
if (alias_hash == NULL) /* No alias file available */
|
||||
{
|
||||
{
|
||||
return strdup(language);
|
||||
}
|
||||
|
||||
{
|
||||
char *lower_language;
|
||||
int i;
|
||||
|
||||
|
||||
lower_language = malloc(strlen(language) + 1);
|
||||
for (i = 0; i < strlen(language); i++)
|
||||
lower_language[i] = tolower(language[i]);
|
||||
lower_language[i] = 0;
|
||||
|
||||
lower_language[i] = 0;
|
||||
|
||||
alias = evas_hash_find(alias_hash, lower_language);
|
||||
free(lower_language);
|
||||
}
|
||||
|
||||
if (alias)
|
||||
|
||||
if (alias)
|
||||
{
|
||||
alias = strdup(alias);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
alias = strdup(language);
|
||||
}
|
||||
|
||||
|
||||
_e_intl_locale_hash_free(alias_hash);
|
||||
|
||||
|
||||
return alias;
|
||||
}
|
||||
|
||||
|
@ -659,25 +659,25 @@ _e_intl_locale_alias_hash_get(void)
|
|||
{
|
||||
Evas_List *next;
|
||||
Evas_List *dir_list;
|
||||
Evas_Hash *alias_hash;
|
||||
|
||||
Evas_Hash *alias_hash;
|
||||
|
||||
dir_list = e_path_dir_list_get(path_messages);
|
||||
alias_hash = NULL;
|
||||
|
||||
|
||||
for (next = dir_list ; next ; next = next->next)
|
||||
{
|
||||
char buf[4096];
|
||||
E_Path_Dir *epd;
|
||||
FILE *f;
|
||||
|
||||
FILE *f;
|
||||
|
||||
epd = next->data;
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/locale.alias", epd->dir);
|
||||
f = fopen(buf, "r");
|
||||
if (f)
|
||||
{
|
||||
char alias[4096], locale[4096];
|
||||
|
||||
|
||||
/* read locale alias lines */
|
||||
while (fscanf(f, "%4090s %[^\n]\n", alias, locale) == 2)
|
||||
{
|
||||
|
@ -688,25 +688,25 @@ _e_intl_locale_alias_hash_get(void)
|
|||
/* skip dupes */
|
||||
if (evas_hash_find(alias_hash, alias))
|
||||
continue;
|
||||
|
||||
|
||||
alias_hash = evas_hash_add(alias_hash, alias, strdup(locale));
|
||||
}
|
||||
fclose (f);
|
||||
}
|
||||
}
|
||||
e_path_dir_list_free(dir_list);
|
||||
|
||||
|
||||
return alias_hash;
|
||||
}
|
||||
|
||||
/* return parts of the locale that are requested in the mask
|
||||
* return null if the locale looks to be invalid (Does not have
|
||||
/* return parts of the locale that are requested in the mask
|
||||
* return null if the locale looks to be invalid (Does not have
|
||||
* ll_DD)
|
||||
*
|
||||
*
|
||||
* the returned string needs to be freed
|
||||
*/
|
||||
/*
|
||||
* Not canonic, just gets the parts
|
||||
* Not canonic, just gets the parts
|
||||
*/
|
||||
EAPI E_Locale_Parts *
|
||||
e_intl_locale_parts_get(const char *locale)
|
||||
|
@ -722,17 +722,17 @@ e_intl_locale_parts_get(const char *locale)
|
|||
int state = 0; /* start out looking for the language */
|
||||
int locale_idx;
|
||||
int tmp_idx = 0;
|
||||
|
||||
|
||||
/* Parse Loop - Seperators are _ . @ */
|
||||
for ( locale_idx = 0; locale_idx < strlen(locale); locale_idx++ )
|
||||
{
|
||||
char locale_char;
|
||||
locale_char = locale[locale_idx];
|
||||
|
||||
|
||||
/* we have finished scanning the locale string */
|
||||
if(locale_char == 0)
|
||||
break;
|
||||
|
||||
|
||||
/* scan this character based on the current start */
|
||||
switch(state)
|
||||
{
|
||||
|
@ -770,7 +770,7 @@ e_intl_locale_parts_get(const char *locale)
|
|||
{
|
||||
territory[tmp_idx++] = locale_char;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -818,9 +818,9 @@ e_intl_locale_parts_get(const char *locale)
|
|||
case 3:
|
||||
modifier[tmp_idx] = 0;
|
||||
}
|
||||
|
||||
|
||||
locale_parts = E_NEW(E_Locale_Parts, 1);
|
||||
|
||||
|
||||
/* Put the parts of the string together */
|
||||
if (language[0] != 0)
|
||||
{
|
||||
|
@ -831,18 +831,18 @@ e_intl_locale_parts_get(const char *locale)
|
|||
{
|
||||
locale_parts->mask |= E_INTL_LOC_REGION;
|
||||
locale_parts->region = evas_stringshare_add(territory);
|
||||
}
|
||||
if (codeset[0] != 0)
|
||||
}
|
||||
if (codeset[0] != 0)
|
||||
{
|
||||
locale_parts->mask |= E_INTL_LOC_CODESET;
|
||||
locale_parts->codeset = evas_stringshare_add(codeset);
|
||||
}
|
||||
if (modifier[0] != 0)
|
||||
{
|
||||
}
|
||||
if (modifier[0] != 0)
|
||||
{
|
||||
locale_parts->mask |= E_INTL_LOC_MODIFIER;
|
||||
locale_parts->modifier = evas_stringshare_add(modifier);
|
||||
}
|
||||
|
||||
|
||||
return locale_parts;
|
||||
}
|
||||
|
||||
|
@ -866,50 +866,50 @@ e_intl_locale_parts_combine(E_Locale_Parts *locale_parts, int mask)
|
|||
char *locale;
|
||||
|
||||
if (!locale_parts) return NULL;
|
||||
|
||||
|
||||
if ((mask & locale_parts->mask) != mask) return NULL;
|
||||
|
||||
|
||||
/* Construct the clean locale string */
|
||||
locale_size = 0;
|
||||
|
||||
|
||||
/* determine the size */
|
||||
if (mask & E_INTL_LOC_LANG)
|
||||
locale_size = strlen(locale_parts->lang) + 1;
|
||||
|
||||
|
||||
if (mask & E_INTL_LOC_REGION)
|
||||
locale_size += strlen(locale_parts->region) + 1;
|
||||
|
||||
|
||||
if (mask & E_INTL_LOC_CODESET)
|
||||
locale_size += strlen(locale_parts->codeset) + 1;
|
||||
|
||||
|
||||
if (mask & E_INTL_LOC_MODIFIER)
|
||||
locale_size += strlen(locale_parts->modifier) + 1;
|
||||
|
||||
|
||||
/* Allocate memory */
|
||||
locale = (char *) malloc(locale_size);
|
||||
locale[0] = 0;
|
||||
|
||||
|
||||
if (mask & E_INTL_LOC_LANG)
|
||||
{
|
||||
strcat(locale, locale_parts->lang);
|
||||
}
|
||||
|
||||
|
||||
if (mask & E_INTL_LOC_REGION)
|
||||
{
|
||||
if (locale[0] != 0) strcat(locale, "_");
|
||||
strcat(locale, locale_parts->region);
|
||||
}
|
||||
|
||||
|
||||
if (mask & E_INTL_LOC_CODESET)
|
||||
{
|
||||
if (locale[0] != 0) strcat(locale, ".");
|
||||
strcat(locale, locale_parts->codeset);
|
||||
}
|
||||
|
||||
|
||||
if (mask & E_INTL_LOC_MODIFIER)
|
||||
{
|
||||
if (locale[0] != 0) strcat(locale, "@");
|
||||
strcat(locale, locale_parts->modifier);
|
||||
strcat(locale, locale_parts->modifier);
|
||||
}
|
||||
|
||||
return locale;
|
||||
|
@ -921,10 +921,10 @@ e_intl_locale_charset_canonic_get(const char *charset)
|
|||
char charset_canonic[32];
|
||||
char c;
|
||||
int i, i_tmp;
|
||||
|
||||
|
||||
i = 0;
|
||||
i_tmp = 0;
|
||||
while ((c = charset[i++]) != 0)
|
||||
while ((c = charset[i++]) != 0)
|
||||
{
|
||||
if (isalnum(c))
|
||||
{
|
||||
|
@ -937,7 +937,7 @@ e_intl_locale_charset_canonic_get(const char *charset)
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
return strdup(charset_canonic);
|
||||
}
|
||||
|
||||
|
@ -949,14 +949,14 @@ _e_intl_locale_system_locales_get(void)
|
|||
|
||||
locales = NULL;
|
||||
output = popen("locale -a", "r");
|
||||
if ( output )
|
||||
if ( output )
|
||||
{
|
||||
char line[32];
|
||||
while ( fscanf(output, "%[^\n]\n", line) == 1)
|
||||
{
|
||||
locales = evas_list_append(locales, strdup(line));
|
||||
}
|
||||
|
||||
|
||||
pclose(output);
|
||||
}
|
||||
return locales;
|
||||
|
@ -969,33 +969,33 @@ static int
|
|||
_e_intl_locale_validate(const char *locale)
|
||||
{
|
||||
Evas_List *all_locales;
|
||||
E_Locale_Parts *locale_parts;
|
||||
E_Locale_Parts *locale_parts;
|
||||
char *locale_lr;
|
||||
char *locale_cs_canonic;
|
||||
int found;
|
||||
|
||||
|
||||
found = 0;
|
||||
|
||||
locale_parts = e_intl_locale_parts_get(locale);
|
||||
|
||||
|
||||
/* Gather the search information */
|
||||
locale_lr = e_intl_locale_parts_combine(locale_parts, E_INTL_LOC_LANG | E_INTL_LOC_REGION);
|
||||
|
||||
|
||||
if ( locale_lr == NULL )
|
||||
{
|
||||
/* Not valid locale, maybe its an alias */
|
||||
locale_lr = strdup(locale);
|
||||
locale_lr = strdup(locale);
|
||||
locale_cs_canonic = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( locale_parts && locale_parts->codeset )
|
||||
if ( locale_parts && locale_parts->codeset )
|
||||
locale_cs_canonic = e_intl_locale_charset_canonic_get(locale_parts->codeset);
|
||||
else
|
||||
locale_cs_canonic = NULL;
|
||||
}
|
||||
|
||||
/* Get list of all available locales and aliases */
|
||||
|
||||
/* Get list of all available locales and aliases */
|
||||
all_locales = _e_intl_locale_system_locales_get();
|
||||
|
||||
/* Match locale with one from the list */
|
||||
|
@ -1007,20 +1007,20 @@ _e_intl_locale_validate(const char *locale)
|
|||
if (found == 0)
|
||||
{
|
||||
E_Locale_Parts *locale_parts_next;
|
||||
char * locale_lr_next;
|
||||
|
||||
char * locale_lr_next;
|
||||
|
||||
locale_parts_next = e_intl_locale_parts_get(locale_next);
|
||||
locale_lr_next = e_intl_locale_parts_combine(locale_parts_next,
|
||||
locale_lr_next = e_intl_locale_parts_combine(locale_parts_next,
|
||||
E_INTL_LOC_LANG | E_INTL_LOC_REGION);
|
||||
|
||||
if (locale_parts && locale_lr_next && !strcmp(locale_lr, locale_lr_next))
|
||||
|
||||
if (locale_parts && locale_lr_next && !strcmp(locale_lr, locale_lr_next))
|
||||
{
|
||||
/* Matched lang/region part, now if CS matches */
|
||||
if ((locale_parts->codeset == NULL) && (locale_parts_next->codeset == NULL))
|
||||
{
|
||||
/* Lang/Region parts match and no charsets,
|
||||
* we have a match
|
||||
*/
|
||||
/* Lang/Region parts match and no charsets,
|
||||
* we have a match
|
||||
*/
|
||||
found = 1;
|
||||
}
|
||||
else if (locale_parts->codeset && locale_parts_next->codeset)
|
||||
|
@ -1030,20 +1030,20 @@ _e_intl_locale_validate(const char *locale)
|
|||
/* Lang/Region and charsets match */
|
||||
found = 1;
|
||||
}
|
||||
else if (locale_cs_canonic)
|
||||
else if (locale_cs_canonic)
|
||||
{
|
||||
char *locale_cs_canonic_next;
|
||||
/* try to match charsets in canonic form */
|
||||
|
||||
locale_cs_canonic_next =
|
||||
|
||||
locale_cs_canonic_next =
|
||||
e_intl_locale_charset_canonic_get(locale_parts_next->codeset);
|
||||
|
||||
|
||||
if (locale_cs_canonic_next)
|
||||
{
|
||||
if (!strcmp(locale_cs_canonic, locale_cs_canonic_next))
|
||||
{
|
||||
/* Lang/Resion and charsets in canonic
|
||||
* form match
|
||||
/* Lang/Resion and charsets in canonic
|
||||
* form match
|
||||
*/
|
||||
found = 1;
|
||||
}
|
||||
|
@ -1053,8 +1053,8 @@ _e_intl_locale_validate(const char *locale)
|
|||
{
|
||||
if (!strcmp(locale_cs_canonic, locale_parts_next->codeset))
|
||||
{
|
||||
/* Lang/Resion and charsets in canonic
|
||||
* form match
|
||||
/* Lang/Resion and charsets in canonic
|
||||
* form match
|
||||
*/
|
||||
found = 1;
|
||||
}
|
||||
|
@ -1070,17 +1070,17 @@ _e_intl_locale_validate(const char *locale)
|
|||
e_intl_locale_parts_free(locale_parts_next);
|
||||
E_FREE(locale_lr_next);
|
||||
}
|
||||
|
||||
|
||||
all_locales = evas_list_remove_list(all_locales, all_locales);
|
||||
free(locale_next);
|
||||
}
|
||||
e_intl_locale_parts_free(locale_parts);
|
||||
free(locale_lr);
|
||||
E_FREE(locale_cs_canonic);
|
||||
return found;
|
||||
return found;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* arg local must be an already validated and unaliased locale
|
||||
* returns the locale search order e.g.
|
||||
* en_US.UTF-8 ->
|
||||
|
@ -1096,10 +1096,10 @@ _e_intl_locale_search_order_get(const char *locale)
|
|||
E_Locale_Parts *locale_parts;
|
||||
char *masked_locale;
|
||||
int mask;
|
||||
|
||||
|
||||
locale_parts = e_intl_locale_parts_get(locale);
|
||||
if (locale_parts == NULL) return NULL;
|
||||
|
||||
|
||||
search_list = NULL;
|
||||
for ( mask = E_INTL_LOC_ALL; mask >= E_INTL_LOC_LANG; mask-- )
|
||||
{
|
||||
|
@ -1109,23 +1109,23 @@ _e_intl_locale_search_order_get(const char *locale)
|
|||
masked_locale = e_intl_locale_parts_combine(locale_parts, mask);
|
||||
search_list = evas_list_append(search_list, masked_locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
e_intl_locale_parts_free(locale_parts);
|
||||
return search_list;
|
||||
}
|
||||
|
||||
|
||||
static Evas_List *
|
||||
_e_intl_imc_dir_scan(const char *dir)
|
||||
{
|
||||
Evas_List *imcs;
|
||||
Ecore_List *files;
|
||||
char *file;
|
||||
|
||||
|
||||
imcs = NULL;
|
||||
|
||||
|
||||
files = ecore_file_ls(dir);
|
||||
if (!files) return NULL;
|
||||
|
||||
|
||||
ecore_list_goto_first(files);
|
||||
if (files)
|
||||
{
|
||||
|
@ -1133,9 +1133,9 @@ _e_intl_imc_dir_scan(const char *dir)
|
|||
{
|
||||
if (strstr(file, ".imc") != NULL)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s", dir, file);
|
||||
char buf[PATH_MAX];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s", dir, file);
|
||||
imcs = evas_list_append(imcs, strdup(buf));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ EAPI int
|
|||
e_sys_action_do(E_Sys_Action a, char *param)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
if (_e_sys_action_current != E_SYS_NONE)
|
||||
{
|
||||
_e_sys_current_action();
|
||||
|
@ -124,7 +124,7 @@ _e_sys_cb_timer(void *data)
|
|||
* things
|
||||
*/
|
||||
char buf[4096];
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/enlightenment_sys -t halt", e_prefix_bin_get());
|
||||
_e_sys_halt_check_exe = ecore_exe_run(buf, NULL);
|
||||
snprintf(buf, sizeof(buf), "%s/enlightenment_sys -t reboot", e_prefix_bin_get());
|
||||
|
@ -242,11 +242,11 @@ _e_sys_cb_logout_timer(void *data)
|
|||
{
|
||||
Evas_List *l;
|
||||
int pending = 0;
|
||||
|
||||
|
||||
for (l = e_border_client_list(); l; l = l->next)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
|
||||
bd = l->data;
|
||||
if (!bd->internal) pending++;
|
||||
}
|
||||
|
@ -259,13 +259,13 @@ _e_sys_cb_logout_timer(void *data)
|
|||
if ((ecore_time_get() - _e_sys_logout_begin_time) > 15.0)
|
||||
{
|
||||
E_Dialog *dia;
|
||||
|
||||
|
||||
dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_sys_error_logout_slow");
|
||||
if (dia)
|
||||
{
|
||||
e_dialog_title_set(dia, _("Logout problems"));
|
||||
e_dialog_icon_set(dia, "enlightenment/logout", 64);
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("Logout is taking too long. Some<br>"
|
||||
"applications refuse to close.<br>"
|
||||
"Do you want to finish the logout<br>"
|
||||
|
@ -309,9 +309,9 @@ _e_sys_logout_begin(E_Sys_Action a_after)
|
|||
{
|
||||
Evas_List *l;
|
||||
E_Obj_Dialog *od;
|
||||
|
||||
|
||||
/* start logout - at end do the a_after action */
|
||||
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
_("Logout in progress"), "E", "_sys_logout");
|
||||
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/logout");
|
||||
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
|
||||
|
@ -325,7 +325,7 @@ _e_sys_logout_begin(E_Sys_Action a_after)
|
|||
for (l = e_border_client_list(); l; l = l->next)
|
||||
{
|
||||
E_Border *bd;
|
||||
|
||||
|
||||
bd = l->data;
|
||||
e_border_act_close_begin(bd);
|
||||
}
|
||||
|
@ -343,48 +343,48 @@ _e_sys_current_action(void)
|
|||
|
||||
dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_sys_error_action_busy");
|
||||
if (!dia) return;
|
||||
|
||||
|
||||
e_dialog_title_set(dia, _("Enlightenment is busy with another request"));
|
||||
e_dialog_icon_set(dia, "enlightenment/sys", 64);
|
||||
switch (_e_sys_action_current)
|
||||
{
|
||||
case E_SYS_LOGOUT:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("Enlightenment is busy logging out.<br>"
|
||||
"You cannot perform other system actions<br>"
|
||||
"once a logout has begun.")
|
||||
);
|
||||
break;
|
||||
case E_SYS_HALT:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("Enlightenment is shutting the system down.<br>"
|
||||
"You cannot do any other system actions<br>"
|
||||
"once a shutdown has been started.")
|
||||
);
|
||||
break;
|
||||
case E_SYS_REBOOT:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("Enlightenment is rebooting the system.<br>"
|
||||
"You cannot do any other system actions<br>"
|
||||
"once a reboot has begun.")
|
||||
);
|
||||
break;
|
||||
case E_SYS_SUSPEND:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("Enlightenment is suspending the system.<br>"
|
||||
"Until suspend is complete you cannot perform<br>"
|
||||
"any other system actions.")
|
||||
);
|
||||
break;
|
||||
case E_SYS_HIBERNATE:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("Enlightenment is hibernating the system.<br>"
|
||||
"You cannot perform an other system actions<br>"
|
||||
"until this is complete.")
|
||||
);
|
||||
break;
|
||||
default:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("EEK! This should not happen")
|
||||
);
|
||||
break;
|
||||
|
@ -403,33 +403,33 @@ _e_sys_action_failed(void)
|
|||
|
||||
dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_sys_error_action_failed");
|
||||
if (!dia) return;
|
||||
|
||||
|
||||
e_dialog_title_set(dia, _("Enlightenment is busy with another request"));
|
||||
e_dialog_icon_set(dia, "enlightenment/sys", 64);
|
||||
switch (_e_sys_action_current)
|
||||
{
|
||||
case E_SYS_HALT:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("Shutting down of your system failed.")
|
||||
);
|
||||
break;
|
||||
case E_SYS_REBOOT:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("Rebooting your system failed.")
|
||||
);
|
||||
break;
|
||||
case E_SYS_SUSPEND:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("Suspend of your system failed.")
|
||||
);
|
||||
break;
|
||||
case E_SYS_HIBERNATE:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("Hibernating your system failed.")
|
||||
);
|
||||
break;
|
||||
default:
|
||||
e_dialog_text_set(dia,
|
||||
e_dialog_text_set(dia,
|
||||
_("EEK! This should not happen")
|
||||
);
|
||||
break;
|
||||
|
@ -445,7 +445,7 @@ _e_sys_action_do(E_Sys_Action a, char *param)
|
|||
{
|
||||
char buf[4096];
|
||||
E_Obj_Dialog *od;
|
||||
|
||||
|
||||
switch (a)
|
||||
{
|
||||
case E_SYS_EXIT:
|
||||
|
@ -474,7 +474,7 @@ _e_sys_action_do(E_Sys_Action a, char *param)
|
|||
else
|
||||
{
|
||||
_e_sys_exe = ecore_exe_run(buf, NULL);
|
||||
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
_("Shutting down"), "E", "_sys_halt");
|
||||
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/halt");
|
||||
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
|
||||
|
@ -501,7 +501,7 @@ _e_sys_action_do(E_Sys_Action a, char *param)
|
|||
else
|
||||
{
|
||||
_e_sys_exe = ecore_exe_run(buf, NULL);
|
||||
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
_("Rebooting"), "E", "_sys_reboot");
|
||||
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/reboot");
|
||||
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
|
||||
|
@ -527,7 +527,7 @@ _e_sys_action_do(E_Sys_Action a, char *param)
|
|||
else
|
||||
{
|
||||
_e_sys_exe = ecore_exe_run(buf, NULL);
|
||||
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
_("Suspending"), "E", "_sys_suspend");
|
||||
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/suspend");
|
||||
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
|
||||
|
@ -553,7 +553,7 @@ _e_sys_action_do(E_Sys_Action a, char *param)
|
|||
else
|
||||
{
|
||||
_e_sys_exe = ecore_exe_run(buf, NULL);
|
||||
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
od = e_obj_dialog_new(e_container_current_get(e_manager_current_get()),
|
||||
_("Hibernating"), "E", "_sys_hibernate");
|
||||
e_obj_dialog_obj_theme_set(od, "base/theme/sys", "e/sys/hibernate");
|
||||
e_obj_dialog_obj_part_text_set(od, "e.textblock.message",
|
||||
|
|
|
@ -93,7 +93,7 @@ EAPI void
|
|||
e_thumb_icon_file_set(Evas_Object *obj, const char *file, const char *key)
|
||||
{
|
||||
E_Thumb *eth;
|
||||
|
||||
|
||||
eth = evas_object_data_get(obj, "e_thumbdata");
|
||||
if (!eth) return;
|
||||
if (eth->file) evas_stringshare_del(eth->file);
|
||||
|
@ -108,7 +108,7 @@ EAPI void
|
|||
e_thumb_icon_size_set(Evas_Object *obj, int w, int h)
|
||||
{
|
||||
E_Thumb *eth;
|
||||
|
||||
|
||||
eth = evas_object_data_get(obj, "e_thumbdata");
|
||||
if (!eth) return;
|
||||
if ((w < 1) || (h <1)) return;
|
||||
|
@ -121,7 +121,7 @@ e_thumb_icon_begin(Evas_Object *obj)
|
|||
{
|
||||
E_Thumb *eth, *eth2;
|
||||
char buf[4096];
|
||||
|
||||
|
||||
eth = evas_object_data_get(obj, "e_thumbdata");
|
||||
if (!eth) return;
|
||||
if (eth->queued) return;
|
||||
|
@ -133,7 +133,7 @@ e_thumb_icon_begin(Evas_Object *obj)
|
|||
while (evas_list_count(_thumbnailers_exe) < _num_thumbnailers)
|
||||
{
|
||||
Ecore_Exe *exe;
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/enlightenment_thumb", e_prefix_bin_get());
|
||||
exe = ecore_exe_run(buf, NULL);
|
||||
_thumbnailers_exe = evas_list_append(_thumbnailers_exe, exe);
|
||||
|
@ -162,7 +162,7 @@ EAPI void
|
|||
e_thumb_icon_end(Evas_Object *obj)
|
||||
{
|
||||
E_Thumb *eth;
|
||||
|
||||
|
||||
eth = evas_object_data_get(obj, "e_thumbdata");
|
||||
if (!eth) return;
|
||||
if (eth->queued)
|
||||
|
@ -200,7 +200,7 @@ e_thumb_client_data(Ecore_Ipc_Event_Client_Data *e)
|
|||
char *icon;
|
||||
E_Thumb *eth;
|
||||
Evas_Object *obj;
|
||||
|
||||
|
||||
if (!evas_list_find(_thumbnailers, e->client))
|
||||
_thumbnailers = evas_list_prepend(_thumbnailers, e->client);
|
||||
if (e->minor == 2)
|
||||
|
@ -277,7 +277,7 @@ _e_thumb_gen_end(int objid)
|
|||
{
|
||||
Evas_List *l;
|
||||
Ecore_Ipc_Client *cli;
|
||||
|
||||
|
||||
/* send thumb cancel */
|
||||
for (l = _thumbnailers; l; l = l->next)
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ static void
|
|||
_e_thumb_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
E_Thumb *eth;
|
||||
|
||||
|
||||
eth = evas_object_data_get(obj, "e_thumbdata");
|
||||
if (!eth) return;
|
||||
evas_object_data_del(obj, "e_thumbdata");
|
||||
|
@ -313,7 +313,7 @@ static void
|
|||
_e_thumb_hash_add(int objid, Evas_Object *obj)
|
||||
{
|
||||
char buf[32];
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%i", objid);
|
||||
_thumbs = evas_hash_add(_thumbs, buf, obj);
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ static void
|
|||
_e_thumb_hash_del(int objid)
|
||||
{
|
||||
char buf[32];
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%i", objid);
|
||||
_thumbs = evas_hash_del(_thumbs, buf, NULL);
|
||||
if ((!_thumbs) && (!_thumbnailers)) _objid = 0;
|
||||
|
@ -332,7 +332,7 @@ static Evas_Object *
|
|||
_e_thumb_hash_find(int objid)
|
||||
{
|
||||
char buf[32];
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%i", objid);
|
||||
return evas_hash_find(_thumbs, buf);
|
||||
}
|
||||
|
@ -355,7 +355,7 @@ static int
|
|||
_e_thumb_cb_kill(void *data)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
|
||||
for (l = _thumbnailers_exe; l; l = l->next)
|
||||
ecore_exe_terminate(l->data);
|
||||
_kill_timer = NULL;
|
||||
|
@ -367,7 +367,7 @@ _e_thumb_cb_exe_event_del(void *data, int type, void *event)
|
|||
{
|
||||
Ecore_Exe_Event_Del *ev;
|
||||
Evas_List *l;
|
||||
|
||||
|
||||
ev = event;
|
||||
for (l = _thumbnailers_exe; l; l = l->next)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ e_util_container_fake_mouse_up_later(E_Container *con, int button)
|
|||
{
|
||||
E_OBJECT_CHECK(con);
|
||||
E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
|
||||
|
||||
|
||||
e_util_evas_fake_mouse_up_later(con->bg_evas, button);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ e_util_container_fake_mouse_up_all_later(E_Container *con)
|
|||
{
|
||||
E_OBJECT_CHECK(con);
|
||||
E_OBJECT_TYPE_CHECK(con, E_CONTAINER_TYPE);
|
||||
|
||||
|
||||
e_util_container_fake_mouse_up_later(con, 1);
|
||||
e_util_container_fake_mouse_up_later(con, 2);
|
||||
e_util_container_fake_mouse_up_later(con, 3);
|
||||
|
@ -57,7 +57,7 @@ EAPI void
|
|||
e_util_evas_fake_mouse_up_later(Evas *e, int button)
|
||||
{
|
||||
E_Util_Fake_Mouse_Up_Info *info;
|
||||
|
||||
|
||||
info = calloc(1, sizeof(E_Util_Fake_Mouse_Up_Info));
|
||||
if (info)
|
||||
{
|
||||
|
@ -79,25 +79,25 @@ e_util_env_set(const char *var, const char *val)
|
|||
{
|
||||
if (val)
|
||||
{
|
||||
#ifdef HAVE_SETENV
|
||||
#ifdef HAVE_SETENV
|
||||
setenv(var, val, 1);
|
||||
#else
|
||||
char buf[8192];
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s=%s", var, val);
|
||||
if (getenv(var))
|
||||
putenv(buf);
|
||||
else
|
||||
putenv(strdup(buf));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_UNSETENV
|
||||
#ifdef HAVE_UNSETENV
|
||||
unsetenv(var);
|
||||
#else
|
||||
if (getenv(var)) putenv(var);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,14 +105,14 @@ EAPI E_Zone *
|
|||
e_util_zone_current_get(E_Manager *man)
|
||||
{
|
||||
E_Container *con;
|
||||
|
||||
|
||||
E_OBJECT_CHECK_RETURN(man, NULL);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(man, E_MANAGER_TYPE, NULL);
|
||||
con = e_container_current_get(man);
|
||||
if (con)
|
||||
{
|
||||
E_Zone *zone;
|
||||
|
||||
|
||||
zone = e_zone_current_get(con);
|
||||
return zone;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ e_util_utils_installed(void)
|
|||
}
|
||||
|
||||
EAPI int
|
||||
e_util_app_installed(char *app)
|
||||
e_util_app_installed(char *app)
|
||||
{
|
||||
return ecore_file_app_installed(app);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ e_util_glob_case_match(const char *str, const char *glob)
|
|||
{
|
||||
const char *p;
|
||||
char *tstr, *tglob, *tp;
|
||||
|
||||
|
||||
if (glob[0] == 0)
|
||||
{
|
||||
if (str[0] == 0) return 1;
|
||||
|
@ -172,12 +172,12 @@ EAPI E_Container *
|
|||
e_util_container_number_get(int num)
|
||||
{
|
||||
Evas_List *l;
|
||||
|
||||
|
||||
for (l = e_manager_list(); l; l = l->next)
|
||||
{
|
||||
E_Manager *man;
|
||||
E_Container *con;
|
||||
|
||||
|
||||
man = l->data;
|
||||
con = e_container_number_get(man, num);
|
||||
if (con) return con;
|
||||
|
@ -189,7 +189,7 @@ EAPI E_Zone *
|
|||
e_util_container_zone_number_get(int con_num, int zone_num)
|
||||
{
|
||||
E_Container *con;
|
||||
|
||||
|
||||
con = e_util_container_number_get(con_num);
|
||||
if (!con) return NULL;
|
||||
return e_container_zone_number_get(con, zone_num);
|
||||
|
@ -203,7 +203,7 @@ e_util_head_exec(int head, const char *cmd)
|
|||
char buf[4096], buf2[32];
|
||||
int ok = 0;
|
||||
Ecore_Exe *exe;
|
||||
|
||||
|
||||
penv_display = getenv("DISPLAY");
|
||||
if (penv_display) penv_display = strdup(penv_display);
|
||||
/* set env vars */
|
||||
|
@ -227,7 +227,7 @@ e_util_head_exec(int head, const char *cmd)
|
|||
}
|
||||
else
|
||||
strcpy(buf, penv_display);
|
||||
|
||||
|
||||
ok = 1;
|
||||
e_util_library_path_strip();
|
||||
exe = ecore_exe_run(cmd, NULL);
|
||||
|
@ -241,7 +241,7 @@ e_util_head_exec(int head, const char *cmd)
|
|||
cmd);
|
||||
ok = 0;
|
||||
}
|
||||
|
||||
|
||||
/* reset env vars */
|
||||
if (penv_display)
|
||||
{
|
||||
|
@ -263,7 +263,7 @@ EAPI int
|
|||
e_util_both_str_empty(const char *s1, const char *s2)
|
||||
{
|
||||
int empty = 0;
|
||||
|
||||
|
||||
if ((!s1) && (!s2)) return 1;
|
||||
if ((!s1) || ((s1) && (s1[0] == 0))) empty++;
|
||||
if ((!s2) || ((s2) && (s2[0] == 0))) empty++;
|
||||
|
@ -275,7 +275,7 @@ EAPI int
|
|||
e_util_immortal_check(void)
|
||||
{
|
||||
Evas_List *wins;
|
||||
|
||||
|
||||
wins = e_border_immortal_windows_get();
|
||||
if (wins)
|
||||
{
|
||||
|
@ -298,7 +298,7 @@ e_util_edje_icon_list_check(const char *list)
|
|||
char *buf;
|
||||
const char *p;
|
||||
const char *c;
|
||||
|
||||
|
||||
if ((!list) || (!list[0])) return 0;
|
||||
buf = alloca(strlen(list) + 1);
|
||||
p = list;
|
||||
|
@ -329,7 +329,7 @@ e_util_edje_icon_list_set(Evas_Object *obj, const char *list)
|
|||
char *buf;
|
||||
const char *p;
|
||||
const char *c;
|
||||
|
||||
|
||||
if ((!list) || (!list[0])) return 0;
|
||||
buf = alloca(strlen(list) + 1);
|
||||
p = list;
|
||||
|
@ -360,7 +360,7 @@ e_util_menu_item_edje_icon_list_set(E_Menu_Item *mi, const char *list)
|
|||
char *buf;
|
||||
const char *p;
|
||||
char *c;
|
||||
|
||||
|
||||
if ((!list) || (!list[0])) return 0;
|
||||
buf = alloca(strlen(list) + 1);
|
||||
p = list;
|
||||
|
@ -421,7 +421,7 @@ e_util_menu_item_edje_icon_set(E_Menu_Item *mi, const char *name)
|
|||
{
|
||||
const char *file;
|
||||
char buf[4096];
|
||||
|
||||
|
||||
if ((!name) || (!name[0])) return 0;
|
||||
snprintf(buf, sizeof(buf), "e/icons/%s", name);
|
||||
file = e_theme_edje_file_get("base/theme/icons", buf);
|
||||
|
@ -441,14 +441,14 @@ e_util_container_window_find(Ecore_X_Window win)
|
|||
for (l = e_manager_list(); l; l = l->next)
|
||||
{
|
||||
E_Manager *man;
|
||||
|
||||
|
||||
man = l->data;
|
||||
for (ll = man->containers; ll; ll = ll->next)
|
||||
{
|
||||
E_Container *con;
|
||||
|
||||
|
||||
con = ll->data;
|
||||
if ((con->win == win) || (con->bg_win == win) ||
|
||||
if ((con->win == win) || (con->bg_win == win) ||
|
||||
(con->event_win == win))
|
||||
return con;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ e_util_desk_border_above(E_Border *bd)
|
|||
|
||||
E_OBJECT_CHECK_RETURN(bd, NULL);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, NULL);
|
||||
|
||||
|
||||
if (bd->layer == 0) pos = 0;
|
||||
else if ((bd->layer > 0) && (bd->layer <= 50)) pos = 1;
|
||||
else if ((bd->layer > 50) && (bd->layer <= 100)) pos = 2;
|
||||
|
@ -508,7 +508,7 @@ e_util_desk_border_below(E_Border *bd)
|
|||
|
||||
E_OBJECT_CHECK_RETURN(bd, NULL);
|
||||
E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, NULL);
|
||||
|
||||
|
||||
if (bd->layer == 0) pos = 0;
|
||||
else if ((bd->layer > 0) && (bd->layer <= 50)) pos = 1;
|
||||
else if ((bd->layer > 50) && (bd->layer <= 100)) pos = 2;
|
||||
|
@ -550,7 +550,7 @@ EAPI int
|
|||
e_util_edje_collection_exists(const char *file, const char *coll)
|
||||
{
|
||||
Evas_List *clist, *l;
|
||||
|
||||
|
||||
clist = edje_file_collection_list(file);
|
||||
for (l = clist; l; l = l->next)
|
||||
{
|
||||
|
@ -568,7 +568,7 @@ EAPI void
|
|||
e_util_dialog_internal(const char *title, const char *txt)
|
||||
{
|
||||
E_Dialog *dia;
|
||||
|
||||
|
||||
dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_error_dialog");
|
||||
if (!dia) return;
|
||||
e_dialog_title_set(dia, title);
|
||||
|
@ -586,7 +586,7 @@ e_util_filename_escape(const char *filename)
|
|||
const char *p;
|
||||
char *q;
|
||||
static char buf[4096];
|
||||
|
||||
|
||||
p = filename;
|
||||
q = buf;
|
||||
while (*p)
|
||||
|
@ -722,7 +722,7 @@ e_util_size_string_get(off_t size)
|
|||
{
|
||||
double dsize;
|
||||
char buf[256];
|
||||
|
||||
|
||||
dsize = (double)size;
|
||||
if (dsize < 1024.0) snprintf(buf, sizeof(buf), _("%'.0f Bytes"), dsize);
|
||||
else
|
||||
|
@ -759,25 +759,25 @@ e_util_file_time_get(time_t ftime)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (diff <= 60)
|
||||
if (diff <= 60)
|
||||
snprintf(buf, sizeof(buf), _("In the last Minute"));
|
||||
else if (diff >= 31526000)
|
||||
else if (diff >= 31526000)
|
||||
snprintf(buf, sizeof(buf), _("%li Years ago"), (diff / 31526000));
|
||||
else if (diff >= 2592000)
|
||||
else if (diff >= 2592000)
|
||||
snprintf(buf, sizeof(buf), _("%li Months ago"), (diff / 2592000));
|
||||
else if (diff >= 604800)
|
||||
else if (diff >= 604800)
|
||||
snprintf(buf, sizeof(buf), _("%li Weeks ago"), (diff / 604800));
|
||||
else if (diff >= 86400)
|
||||
snprintf(buf, sizeof(buf), _("%li Days ago"), (diff / 86400));
|
||||
else if (diff >= 3600)
|
||||
else if (diff >= 3600)
|
||||
snprintf(buf, sizeof(buf), _("%li Hours ago"), (diff / 3600));
|
||||
else if (diff > 60)
|
||||
else if (diff > 60)
|
||||
snprintf(buf, sizeof(buf), _("%li Minutes ago"), (diff / 60));
|
||||
}
|
||||
|
||||
if (buf)
|
||||
|
||||
if (buf)
|
||||
s = strdup(buf);
|
||||
else
|
||||
else
|
||||
s = strdup(_("Unknown"));
|
||||
return s;
|
||||
}
|
||||
|
@ -789,7 +789,7 @@ EAPI void
|
|||
e_util_library_path_strip(void)
|
||||
{
|
||||
char *p, *p2;
|
||||
|
||||
|
||||
p = getenv("LD_LIBRARY_PATH");
|
||||
E_FREE(prev_ld_library_path);
|
||||
if (p)
|
||||
|
@ -851,7 +851,7 @@ static void
|
|||
_e_util_container_fake_mouse_up_cb(void *data)
|
||||
{
|
||||
E_Util_Fake_Mouse_Up_Info *info;
|
||||
|
||||
|
||||
info = data;
|
||||
if (info)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue