support flag icons.. and add them.

SVN revision: 37093
This commit is contained in:
Carsten Haitzler 2008-10-25 08:53:44 +00:00
parent 26c18a5116
commit d04a4c70d8
32 changed files with 213 additions and 42 deletions

View File

@ -15,6 +15,8 @@ EXTRA_DIST = \
filesdir = $(datadir)/enlightenment/data/config/default filesdir = $(datadir)/enlightenment/data/config/default
files_DATA = \ files_DATA = \
profile.desktop \
icon.png \
e.cfg \ e.cfg \
module.battery.cfg \ module.battery.cfg \
module.cpufreq.cfg \ module.cpufreq.cfg \

BIN
config/default/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,5 @@
[Desktop Entry]
Type=Link
Name=Default
Icon=icon.png
Comment=This is the default<br>theme that is<br>universal for most<br>desktop and laptop<br>systems. Choose this<br>if you are not<br>sure what to choose.

View File

@ -4,6 +4,30 @@ files_DATA = \
enlightenment.png \ enlightenment.png \
test.png \ test.png \
test.jpg \ test.jpg \
test.edj test.edj \
lang-bg_BG.png \
lang-ca_ES.png \
lang-cs_CZ.png \
lang-da_DK.png \
lang-de_DE.png \
lang-en_US.png \
lang-es_AR.png \
lang-es_ES.png \
lang-fi_FI.png \
lang-fr_FR.png \
lang-hu_HU.png \
lang-it_IT.png \
lang-ja_JP.png \
lang-ko_KR.png \
lang-nb_NO.png \
lang-nl_NL.png \
lang-pl_PL.png \
lang-pt_BR.png \
lang-ru_RU.png \
lang-sk_SK.png \
lang-sl_SI.png \
lang-sv_SE.png \
lang-zh_CN.png \
lang-zh_TW.png
EXTRA_DIST = $(files_DATA) EXTRA_DIST = $(files_DATA)

BIN
data/images/lang-bg_BG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

BIN
data/images/lang-ca_ES.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
data/images/lang-cs_CZ.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
data/images/lang-da_DK.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

BIN
data/images/lang-de_DE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

BIN
data/images/lang-en_US.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
data/images/lang-es_AR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
data/images/lang-es_ES.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
data/images/lang-fi_FI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

BIN
data/images/lang-fr_FR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

BIN
data/images/lang-hu_HU.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

BIN
data/images/lang-it_IT.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

BIN
data/images/lang-ja_JP.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
data/images/lang-ko_KR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
data/images/lang-nb_NO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 B

BIN
data/images/lang-nl_NL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

BIN
data/images/lang-pl_PL.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

BIN
data/images/lang-pt_BR.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
data/images/lang-ru_RU.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

BIN
data/images/lang-sk_SK.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
data/images/lang-sl_SI.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
data/images/lang-sv_SE.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

BIN
data/images/lang-zh_CN.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
data/images/lang-zh_TW.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -1804,12 +1804,29 @@ e_config_profile_set(const char *prof)
e_util_env_set("E_CONF_PROFILE", _e_config_profile); e_util_env_set("E_CONF_PROFILE", _e_config_profile);
} }
EAPI char *
e_config_profile_dir_get(const char *prof)
{
char buf[PATH_MAX];
const char *homedir;
const char *dir;
homedir = e_user_homedir_get();
snprintf(buf, sizeof(buf), "%s/.e/e/config/%s", homedir, prof);
if (ecore_file_is_dir(buf)) return strdup(buf);
dir = e_prefix_data_get();
snprintf(buf, sizeof(buf), "%s/data/config/%s", dir, prof);
if (ecore_file_is_dir(buf)) return strdup(buf);
return NULL;
}
EAPI Eina_List * EAPI Eina_List *
e_config_profile_list(void) e_config_profile_list(void)
{ {
Ecore_List *files; Ecore_List *files;
char buf[4096]; char buf[PATH_MAX];
const char *homedir; const char *homedir;
const char *dir;
Eina_List *flist = NULL; Eina_List *flist = NULL;
homedir = e_user_homedir_get(); homedir = e_user_homedir_get();
@ -1829,6 +1846,31 @@ e_config_profile_list(void)
} }
ecore_list_destroy(files); ecore_list_destroy(files);
} }
dir = e_prefix_data_get();
snprintf(buf, sizeof(buf), "%s/data/config", dir);
files = ecore_file_ls(buf);
if (files)
{
char *file;
ecore_list_first_goto(files);
while ((file = ecore_list_current(files)))
{
snprintf(buf, sizeof(buf), "%s/data/config/%s", dir, file);
if (ecore_file_is_dir(buf))
{
Eina_List *l;
for (l = flist; l; l = l->next)
{
if (!strcmp(file, l->data)) break;
}
if (!l) flist = eina_list_append(flist, strdup(file));
}
ecore_list_next(files);
}
ecore_list_destroy(files);
}
return flist; return flist;
} }

View File

@ -456,7 +456,8 @@ EAPI int e_config_save(void);
EAPI void e_config_save_flush(void); EAPI void e_config_save_flush(void);
EAPI void e_config_save_queue(void); EAPI void e_config_save_queue(void);
EAPI const char *e_config_profile_get(void); EAPI const char*e_config_profile_get(void);
EAPI char *e_config_profile_dir_get(const char *prof);
EAPI void e_config_profile_set(const char *prof); EAPI void e_config_profile_set(const char *prof);
EAPI Eina_List *e_config_profile_list(void); EAPI Eina_List *e_config_profile_list(void);
EAPI void e_config_profile_add(const char *prof); EAPI void e_config_profile_add(const char *prof);

View File

@ -11,34 +11,35 @@ static int _basic_lang_list_sort(const void *data1, const void *data2);
struct _E_Intl_Pair struct _E_Intl_Pair
{ {
const char *locale_key; const char *locale_key;
const char *locale_icon;
const char *locale_translation; const char *locale_translation;
}; };
const E_Intl_Pair basic_language_predefined_pairs[ ] = { const E_Intl_Pair basic_language_predefined_pairs[ ] = {
{"bg_BG.UTF-8", "Български"}, {"bg_BG.UTF-8", "lang-bg_BG.png", "Български"},
{"ca_ES.UTF-8", "Català"}, {"ca_ES.UTF-8", "lang-ca_ES.png", "Català"},
{"zh_CN.UTF-8", "Chinese (Simplified)"}, {"zh_CN.UTF-8", "lang-zh_CN.png", "Chinese (Simplified)"},
{"zh_TW.UTF-8", "Chinese (Traditional)"}, {"zh_TW.UTF-8", "lang-zh_TW.png", "Chinese (Traditional)"},
{"cs_CZ.UTF-8", "Čeština"}, {"cs_CZ.UTF-8", "lang-cs_CZ.png", "Čeština"},
{"da_DK.UTF-8", "Dansk"}, {"da_DK.UTF-8", "lang-da_DK.png", "Dansk"},
{"nl_NL.UTF-8", "Nederlands"}, {"nl_NL.UTF-8", "lang-nl_NL.png", "Nederlands"},
{"en_US.UTF-8", "English"}, {"en_US.UTF-8", "lang-en_US.png", "English"},
{"fi_FI.UTF-8", "Suomi"}, {"fi_FI.UTF-8", "lang-fi_FI.png", "Suomi"},
{"fr_FR.UTF-8", "Français"}, {"fr_FR.UTF-8", "lang-fr_FR.png", "Français"},
{"de_DE.UTF-8", "Deutsch"}, {"de_DE.UTF-8", "lang-de_DE.png", "Deutsch"},
{"hu_HU.UTF-8", "Magyar"}, {"hu_HU.UTF-8", "lang-hu_HU.png", "Magyar"},
{"it_IT.UTF-8", "Italiano"}, {"it_IT.UTF-8", "lang-it_IT.png", "Italiano"},
{"ja_JP.UTF-8", "日本語"}, {"ja_JP.UTF-8", "lang-ja_JP.png", "日本語"},
{"ko_KR.UTF-8", "한국어"}, {"ko_KR.UTF-8", "lang-ko_KR.png", "한국어"},
{"nb_NO.UTF-8", "Norsk Bokmål"}, {"nb_NO.UTF-8", "lang-nb_NO.png", "Norsk Bokmål"},
{"pl_PL.UTF-8", "Polski"}, {"pl_PL.UTF-8", "lang-pl_PL.png", "Polski"},
{"pt_BR.UTF-8", "Português"}, {"pt_BR.UTF-8", "lang-pt_BR.png", "Português"},
{"ru_RU.UTF-8", "Русский"}, {"ru_RU.UTF-8", "lang-ru_RU.png", "Русский"},
{"sk_SK.UTF-8", "Slovenčina"}, {"sk_SK.UTF-8", "lang-sk_SK.png", "Slovenčina"},
{"sl_SI.UTF-8", "Slovenščina"}, {"sl_SI.UTF-8", "lang-sl_SI.png", "Slovenščina"},
{"es_AR.UTF-8", "Español"}, {"es_AR.UTF-8", "lang-es_AR.png", "Español"},
{"sv_SE.UTF-8", "Svenska"}, {"sv_SE.UTF-8", "lang-sv_SE.png", "Svenska"},
{ NULL, NULL } { NULL, NULL, NULL }
}; };
static char *lang = NULL; static char *lang = NULL;
@ -74,7 +75,6 @@ wizard_page_init(E_Wizard_Page *pg)
e_lang_list = e_intl_language_list(); e_lang_list = e_intl_language_list();
printf("init\n");
output = popen("locale -a", "r"); output = popen("locale -a", "r");
if (output) if (output)
{ {
@ -146,7 +146,7 @@ wizard_page_show(E_Wizard_Page *pg)
o = e_widget_list_add(pg->evas, 1, 0); o = e_widget_list_add(pg->evas, 1, 0);
e_wizard_title_set(_("Language")); e_wizard_title_set(_("Language"));
of = e_widget_framelist_add(pg->evas, _("Available"), 0); of = e_widget_framelist_add(pg->evas, _("Select one"), 0);
ob = e_widget_ilist_add(pg->evas, 32 * e_scale, 32 * e_scale, &lang); ob = e_widget_ilist_add(pg->evas, 32 * e_scale, 32 * e_scale, &lang);
e_widget_min_size_set(ob, 140 * e_scale, 140 * e_scale); e_widget_min_size_set(ob, 140 * e_scale, 140 * e_scale);
@ -155,9 +155,14 @@ wizard_page_show(E_Wizard_Page *pg)
for (i = 0, l = blang_list; l; l = l->next, i++) for (i = 0, l = blang_list; l; l = l->next, i++)
{ {
E_Intl_Pair *pair; E_Intl_Pair *pair;
Evas_Object *ic;
char buf[PATH_MAX], *dir;
pair = l->data; pair = l->data;
e_widget_ilist_append(ob, NULL, _(pair->locale_translation), dir = e_prefix_data_get();
snprintf(buf, sizeof(buf), "%s/data/images/%s", dir, pair->locale_icon);
ic = e_util_icon_add(buf, pg->evas);
e_widget_ilist_append(ob, ic, _(pair->locale_translation),
NULL, NULL, pair->locale_key); NULL, NULL, pair->locale_key);
if (e_intl_language_get()) if (e_intl_language_get())
{ {

View File

@ -4,6 +4,35 @@
#include "e.h" #include "e.h"
#include "e_mod_main.h" #include "e_mod_main.h"
static char *profile = NULL;
static Evas_Object *textblock = NULL;
static void
_profile_change(void *data, Evas_Object *obj)
{
char buf[PATH_MAX], *dir;
Efreet_Desktop *desk = NULL;
dir = e_prefix_data_get();
snprintf(buf, sizeof(buf), "%s/data/config/%s", dir, profile);
dir = strdup(buf);
if (!dir)
{
e_widget_textblock_markup_set(textblock, _("Unknown"));
return;
}
snprintf(buf, sizeof(buf), "%s/profile.desktop", dir);
desk = efreet_desktop_get(buf);
if (desk)
{
e_widget_textblock_markup_set(textblock, desk->comment);
}
else
e_widget_textblock_markup_set(textblock, _("Unknown"));
if (desk) efreet_desktop_free(desk);
free(dir);
}
EAPI int EAPI int
wizard_page_init(E_Wizard_Page *pg) wizard_page_init(E_Wizard_Page *pg)
{ {
@ -17,17 +46,80 @@ wizard_page_shutdown(E_Wizard_Page *pg)
EAPI int EAPI int
wizard_page_show(E_Wizard_Page *pg) wizard_page_show(E_Wizard_Page *pg)
{ {
Evas_Object *ob, *o; Evas_Object *o, *of, *ob;
Eina_List *l, *profiles;
int i, sel = -1;
Evas_Object *ilist;
printf("t2\n"); o = e_widget_list_add(pg->evas, 1, 0);
ob = e_widget_list_add(pg->evas, 1, 0); e_wizard_title_set(_("Profile"));
o = e_widget_button_add(pg->evas, of = e_widget_framelist_add(pg->evas, _("Select one"), 0);
"Hello Another World", NULL,
NULL, NULL, NULL); ob = e_widget_ilist_add(pg->evas, 32 * e_scale, 32 * e_scale, &profile);
e_widget_list_object_append(ob, o, 0, 0, 0.5); e_widget_min_size_set(ob, 140 * e_scale, 70 * e_scale);
evas_object_show(o); ilist = ob;
e_wizard_page_show(ob); e_widget_on_change_hook_set(ob, _profile_change, NULL);
pg->data = ob;
e_widget_ilist_freeze(ob);
profiles = e_config_profile_list();
for (i = 0, l = profiles; l; l = l->next, i++)
{
Efreet_Desktop *desk = NULL;
char buf[PATH_MAX], *prof, *dir;
const char *label;
Evas_Object *ic;
prof = l->data;
dir = e_prefix_data_get();
snprintf(buf, sizeof(buf), "%s/data/config/%s", dir, prof);
dir = strdup(buf);
if (!dir)
{
free(prof);
continue;
}
snprintf(buf, sizeof(buf), "%s/profile.desktop", dir);
desk = efreet_desktop_get(buf);
label = prof;
if ((desk) && (desk->name)) label = desk->name;
snprintf(buf, sizeof(buf), "%s/icon.edj", dir);
if ((desk) && (desk->icon))
snprintf(buf, sizeof(buf), "%s/%s", dir, desk->icon);
ic = e_util_icon_add(buf, pg->evas);
e_widget_ilist_append(ob, ic, label, NULL, NULL, prof);
if (e_config_profile_get())
{
if (!strcmp(prof, e_config_profile_get())) sel = i;
}
free(dir);
free(prof);
if (desk) efreet_desktop_free(desk);
}
if (profiles) evas_list_free(profiles);
e_widget_ilist_go(ob);
e_widget_ilist_thaw(ob);
e_widget_framelist_object_append(of, ob);
ob = e_widget_textblock_add(pg->evas);
e_widget_min_size_set(ob, 140 * e_scale, 70 * e_scale);
e_widget_textblock_markup_set(ob, _("Select a profile"));
textblock = ob;
e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 0, 0, 0.5);
if (sel >= 0) e_widget_ilist_selected_set(ilist, sel);
evas_object_show(ob);
evas_object_show(of);
e_wizard_page_show(o);
pg->data = of;
return 1; /* 1 == show ui, and wait for user, 0 == just continue */ return 1; /* 1 == show ui, and wait for user, 0 == just continue */
} }
EAPI int EAPI int
@ -39,6 +131,6 @@ wizard_page_hide(E_Wizard_Page *pg)
EAPI int EAPI int
wizard_page_apply(E_Wizard_Page *pg) wizard_page_apply(E_Wizard_Page *pg)
{ {
printf("a2\n"); // FIXME: actually apply profile
return 1; return 1;
} }