efreet: Fixed formatting.

SVN revision: 76923
This commit is contained in:
Daniel Juyung Seo 2012-09-21 00:03:18 +00:00
parent be7b396171
commit c01f421317
2 changed files with 817 additions and 817 deletions

View File

@ -57,140 +57,140 @@ EAPI int
efreet_init(void) efreet_init(void)
{ {
#ifndef _WIN32 #ifndef _WIN32
char *tmp; char *tmp;
#endif #endif
if (++_efreet_init_count != 1) if (++_efreet_init_count != 1)
return _efreet_init_count; return _efreet_init_count;
#ifndef _WIN32 #ifndef _WIN32
/* Find users real uid and gid */ /* Find users real uid and gid */
tmp = getenv("SUDO_UID"); tmp = getenv("SUDO_UID");
if (tmp) if (tmp)
ruid = strtoul(tmp, NULL, 10); ruid = strtoul(tmp, NULL, 10);
else else
ruid = getuid(); ruid = getuid();
tmp = getenv("SUDO_GID"); tmp = getenv("SUDO_GID");
if (tmp) if (tmp)
rgid = strtoul(tmp, NULL, 10); rgid = strtoul(tmp, NULL, 10);
else else
rgid = getgid(); rgid = getgid();
#endif #endif
if (!eina_init()) if (!eina_init())
return --_efreet_init_count; return --_efreet_init_count;
if (!eet_init()) if (!eet_init())
goto shutdown_eina; goto shutdown_eina;
if (!ecore_init()) if (!ecore_init())
goto shutdown_eet; goto shutdown_eet;
if (!ecore_file_init()) if (!ecore_file_init())
goto shutdown_ecore; goto shutdown_ecore;
if (!efreet_base_init()) if (!efreet_base_init())
goto shutdown_ecore_file; goto shutdown_ecore_file;
if (!efreet_cache_init()) if (!efreet_cache_init())
goto shutdown_efreet_base; goto shutdown_efreet_base;
if (!efreet_xml_init()) if (!efreet_xml_init())
goto shutdown_efreet_cache; goto shutdown_efreet_cache;
if (!efreet_icon_init()) if (!efreet_icon_init())
goto shutdown_efreet_xml; goto shutdown_efreet_xml;
if (!efreet_ini_init()) if (!efreet_ini_init())
goto shutdown_efreet_icon; goto shutdown_efreet_icon;
if (!efreet_desktop_init()) if (!efreet_desktop_init())
goto shutdown_efreet_ini; goto shutdown_efreet_ini;
if (!efreet_menu_init()) if (!efreet_menu_init())
goto shutdown_efreet_desktop; goto shutdown_efreet_desktop;
if (!efreet_util_init()) if (!efreet_util_init())
goto shutdown_efreet_menu; goto shutdown_efreet_menu;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain(PACKAGE, LOCALE_DIR); bindtextdomain(PACKAGE, LOCALE_DIR);
bind_textdomain_codeset(PACKAGE, "UTF-8"); bind_textdomain_codeset(PACKAGE, "UTF-8");
#endif #endif
return _efreet_init_count; return _efreet_init_count;
shutdown_efreet_menu: shutdown_efreet_menu:
efreet_menu_shutdown(); efreet_menu_shutdown();
shutdown_efreet_desktop: shutdown_efreet_desktop:
efreet_desktop_shutdown(); efreet_desktop_shutdown();
shutdown_efreet_ini: shutdown_efreet_ini:
efreet_ini_shutdown(); efreet_ini_shutdown();
shutdown_efreet_icon: shutdown_efreet_icon:
efreet_icon_shutdown(); efreet_icon_shutdown();
shutdown_efreet_xml: shutdown_efreet_xml:
efreet_xml_shutdown(); efreet_xml_shutdown();
shutdown_efreet_cache: shutdown_efreet_cache:
efreet_cache_shutdown(); efreet_cache_shutdown();
shutdown_efreet_base: shutdown_efreet_base:
efreet_base_shutdown(); efreet_base_shutdown();
shutdown_ecore_file: shutdown_ecore_file:
ecore_file_shutdown(); ecore_file_shutdown();
shutdown_ecore: shutdown_ecore:
ecore_shutdown(); ecore_shutdown();
shutdown_eet: shutdown_eet:
eet_shutdown(); eet_shutdown();
shutdown_eina: shutdown_eina:
eina_shutdown(); eina_shutdown();
return --_efreet_init_count; return --_efreet_init_count;
} }
EAPI int EAPI int
efreet_shutdown(void) efreet_shutdown(void)
{ {
if (_efreet_init_count <= 0) if (_efreet_init_count <= 0)
{ {
EINA_LOG_ERR("Init count not greater than 0 in shutdown."); EINA_LOG_ERR("Init count not greater than 0 in shutdown.");
return 0; return 0;
} }
if (--_efreet_init_count != 0) if (--_efreet_init_count != 0)
return _efreet_init_count; return _efreet_init_count;
efreet_util_shutdown(); efreet_util_shutdown();
efreet_menu_shutdown(); efreet_menu_shutdown();
efreet_desktop_shutdown(); efreet_desktop_shutdown();
efreet_ini_shutdown(); efreet_ini_shutdown();
efreet_icon_shutdown(); efreet_icon_shutdown();
efreet_xml_shutdown(); efreet_xml_shutdown();
efreet_cache_shutdown(); efreet_cache_shutdown();
efreet_base_shutdown(); efreet_base_shutdown();
IF_RELEASE(efreet_lang); IF_RELEASE(efreet_lang);
IF_RELEASE(efreet_lang_country); IF_RELEASE(efreet_lang_country);
IF_RELEASE(efreet_lang_modifier); IF_RELEASE(efreet_lang_modifier);
efreet_parsed_locale = 0; /* reset this in case they init efreet again */ efreet_parsed_locale = 0; /* reset this in case they init efreet again */
ecore_file_shutdown(); ecore_file_shutdown();
ecore_shutdown(); ecore_shutdown();
eet_shutdown(); eet_shutdown();
eina_shutdown(); eina_shutdown();
return _efreet_init_count; return _efreet_init_count;
} }
EAPI void EAPI void
efreet_lang_reset(void) efreet_lang_reset(void)
{ {
IF_RELEASE(efreet_lang); IF_RELEASE(efreet_lang);
IF_RELEASE(efreet_lang_country); IF_RELEASE(efreet_lang_country);
IF_RELEASE(efreet_lang_modifier); IF_RELEASE(efreet_lang_modifier);
efreet_parsed_locale = 0; /* reset this in case they init efreet again */ efreet_parsed_locale = 0; /* reset this in case they init efreet again */
efreet_dirs_reset(); efreet_dirs_reset();
efreet_cache_desktop_close(); efreet_cache_desktop_close();
efreet_cache_desktop_update(); efreet_cache_desktop_update();
} }
/** /**
* @internal * @internal
* @return Returns the current users language setting or NULL if none set * @return Returns the current users language setting or NULL if none set
* @brief Retrieves the current language setting * @brief Retrieves the current language setting
@ -198,10 +198,10 @@ efreet_lang_reset(void)
const char * const char *
efreet_lang_get(void) efreet_lang_get(void)
{ {
if (efreet_parsed_locale) return efreet_lang; if (efreet_parsed_locale) return efreet_lang;
efreet_parse_locale(); efreet_parse_locale();
return efreet_lang; return efreet_lang;
} }
/** /**
@ -212,10 +212,10 @@ efreet_lang_get(void)
const char * const char *
efreet_lang_country_get(void) efreet_lang_country_get(void)
{ {
if (efreet_parsed_locale) return efreet_lang_country; if (efreet_parsed_locale) return efreet_lang_country;
efreet_parse_locale(); efreet_parse_locale();
return efreet_lang_country; return efreet_lang_country;
} }
/** /**
@ -227,10 +227,10 @@ efreet_lang_country_get(void)
const char * const char *
efreet_lang_modifier_get(void) efreet_lang_modifier_get(void)
{ {
if (efreet_parsed_locale) return efreet_lang_modifier; if (efreet_parsed_locale) return efreet_lang_modifier;
efreet_parse_locale(); efreet_parse_locale();
return efreet_lang_modifier; return efreet_lang_modifier;
} }
/** /**
@ -242,15 +242,15 @@ efreet_lang_modifier_get(void)
static void static void
efreet_parse_locale(void) efreet_parse_locale(void)
{ {
efreet_parsed_locale = 1; efreet_parsed_locale = 1;
if (efreet_parse_locale_setting("LANG")) if (efreet_parse_locale_setting("LANG"))
return; return;
if (efreet_parse_locale_setting("LC_ALL")) if (efreet_parse_locale_setting("LC_ALL"))
return; return;
efreet_parse_locale_setting("LC_MESSAGES"); efreet_parse_locale_setting("LC_MESSAGES");
} }
/** /**
@ -263,46 +263,46 @@ efreet_parse_locale(void)
static int static int
efreet_parse_locale_setting(const char *env) efreet_parse_locale_setting(const char *env)
{ {
int found = 0; int found = 0;
char *setting; char *setting;
char *p; char *p;
size_t len; size_t len;
p = getenv(env); p = getenv(env);
if (!p) return 0; if (!p) return 0;
len = strlen(p) + 1; len = strlen(p) + 1;
setting = alloca(len); setting = alloca(len);
memcpy(setting, p, len); memcpy(setting, p, len);
/* pull the modifier off the end */ /* pull the modifier off the end */
p = strrchr(setting, '@'); p = strrchr(setting, '@');
if (p) if (p)
{ {
*p = '\0'; *p = '\0';
efreet_lang_modifier = eina_stringshare_add(p + 1); efreet_lang_modifier = eina_stringshare_add(p + 1);
found = 1; found = 1;
} }
/* if there is an encoding we ignore it */ /* if there is an encoding we ignore it */
p = strrchr(setting, '.'); p = strrchr(setting, '.');
if (p) *p = '\0'; if (p) *p = '\0';
/* get the country if available */ /* get the country if available */
p = strrchr(setting, '_'); p = strrchr(setting, '_');
if (p) if (p)
{ {
*p = '\0'; *p = '\0';
efreet_lang_country = eina_stringshare_add(p + 1); efreet_lang_country = eina_stringshare_add(p + 1);
found = 1; found = 1;
} }
if (*setting != '\0') if (*setting != '\0')
{ {
efreet_lang = eina_stringshare_add(setting); efreet_lang = eina_stringshare_add(setting);
found = 1; found = 1;
} }
return found; return found;
} }
/** /**
@ -317,26 +317,26 @@ efreet_parse_locale_setting(const char *env)
size_t size_t
efreet_array_cat(char *buffer, size_t size, const char *strs[]) efreet_array_cat(char *buffer, size_t size, const char *strs[])
{ {
int i; int i;
size_t n; size_t n;
for (i = 0, n = 0; n < size && strs[i]; i++) for (i = 0, n = 0; n < size && strs[i]; i++)
{ {
n += eina_strlcpy(buffer + n, strs[i], size - n); n += eina_strlcpy(buffer + n, strs[i], size - n);
} }
return n; return n;
} }
#ifndef _WIN32 #ifndef _WIN32
EAPI void EAPI void
efreet_fsetowner(int fd) efreet_fsetowner(int fd)
{ {
struct stat st; struct stat st;
if (fd < 0) return; if (fd < 0) return;
if (fstat(fd, &st) < 0) return; if (fstat(fd, &st) < 0) return;
if (st.st_uid == ruid) return; if (st.st_uid == ruid) return;
if (fchown(fd, ruid, rgid) != 0) return; if (fchown(fd, ruid, rgid) != 0) return;
} }
#else #else
EAPI void EAPI void
@ -349,14 +349,14 @@ efreet_fsetowner(int fd __UNUSED__)
EAPI void EAPI void
efreet_setowner(const char *path) efreet_setowner(const char *path)
{ {
EINA_SAFETY_ON_NULL_RETURN(path); EINA_SAFETY_ON_NULL_RETURN(path);
int fd; int fd;
fd = open(path, O_RDONLY); fd = open(path, O_RDONLY);
if (fd < 0) return; if (fd < 0) return;
efreet_fsetowner(fd); efreet_fsetowner(fd);
close(fd); close(fd);
} }
#else #else
EAPI void EAPI void

File diff suppressed because it is too large Load Diff