summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2008-10-25 08:53:44 +0000
committerCarsten Haitzler <raster@rasterman.com>2008-10-25 08:53:44 +0000
commitd04a4c70d8b8c90eef40643893c08237137aebea (patch)
treec122c5e33605be11ae029dc6fa01db6cb50fdbba /src
parent26c18a511633f7b73970b645e69bccb8bdb2eb5d (diff)
downloadenlightenment-d04a4c70d8b8c90eef40643893c08237137aebea.tar.gz
support flag icons.. and add them.
SVN revision: 37093
Diffstat (limited to 'src')
-rw-r--r--src/bin/e_config.c44
-rw-r--r--src/bin/e_config.h3
-rw-r--r--src/modules/wizard/page_010.c59
-rw-r--r--src/modules/wizard/page_020.c116
4 files changed, 181 insertions, 41 deletions
diff --git a/src/bin/e_config.c b/src/bin/e_config.c
index 69de7722b1..d7586d8df4 100644
--- a/src/bin/e_config.c
+++ b/src/bin/e_config.c
@@ -1804,12 +1804,29 @@ e_config_profile_set(const char *prof)
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 *
e_config_profile_list(void)
{
Ecore_List *files;
- char buf[4096];
+ char buf[PATH_MAX];
const char *homedir;
+ const char *dir;
Eina_List *flist = NULL;
homedir = e_user_homedir_get();
@@ -1829,6 +1846,31 @@ e_config_profile_list(void)
}
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;
}
diff --git a/src/bin/e_config.h b/src/bin/e_config.h
index 3494063467..e16e2909ba 100644
--- a/src/bin/e_config.h
+++ b/src/bin/e_config.h
@@ -456,7 +456,8 @@ EAPI int e_config_save(void);
EAPI void e_config_save_flush(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 Eina_List *e_config_profile_list(void);
EAPI void e_config_profile_add(const char *prof);
diff --git a/src/modules/wizard/page_010.c b/src/modules/wizard/page_010.c
index cdf2d9e771..7c03880aa2 100644
--- a/src/modules/wizard/page_010.c
+++ b/src/modules/wizard/page_010.c
@@ -11,34 +11,35 @@ static int _basic_lang_list_sort(const void *data1, const void *data2);
struct _E_Intl_Pair
{
const char *locale_key;
+ const char *locale_icon;
const char *locale_translation;
};
const E_Intl_Pair basic_language_predefined_pairs[ ] = {
- {"bg_BG.UTF-8", "Български"},
- {"ca_ES.UTF-8", "Català"},
- {"zh_CN.UTF-8", "Chinese (Simplified)"},
- {"zh_TW.UTF-8", "Chinese (Traditional)"},
- {"cs_CZ.UTF-8", "Čeština"},
- {"da_DK.UTF-8", "Dansk"},
- {"nl_NL.UTF-8", "Nederlands"},
- {"en_US.UTF-8", "English"},
- {"fi_FI.UTF-8", "Suomi"},
- {"fr_FR.UTF-8", "Français"},
- {"de_DE.UTF-8", "Deutsch"},
- {"hu_HU.UTF-8", "Magyar"},
- {"it_IT.UTF-8", "Italiano"},
- {"ja_JP.UTF-8", "日本語"},
- {"ko_KR.UTF-8", "한국어"},
- {"nb_NO.UTF-8", "Norsk Bokmål"},
- {"pl_PL.UTF-8", "Polski"},
- {"pt_BR.UTF-8", "Português"},
- {"ru_RU.UTF-8", "Русский"},
- {"sk_SK.UTF-8", "Slovenčina"},
- {"sl_SI.UTF-8", "Slovenščina"},
- {"es_AR.UTF-8", "Español"},
- {"sv_SE.UTF-8", "Svenska"},
- { NULL, NULL }
+ {"bg_BG.UTF-8", "lang-bg_BG.png", "Български"},
+ {"ca_ES.UTF-8", "lang-ca_ES.png", "Català"},
+ {"zh_CN.UTF-8", "lang-zh_CN.png", "Chinese (Simplified)"},
+ {"zh_TW.UTF-8", "lang-zh_TW.png", "Chinese (Traditional)"},
+ {"cs_CZ.UTF-8", "lang-cs_CZ.png", "Čeština"},
+ {"da_DK.UTF-8", "lang-da_DK.png", "Dansk"},
+ {"nl_NL.UTF-8", "lang-nl_NL.png", "Nederlands"},
+ {"en_US.UTF-8", "lang-en_US.png", "English"},
+ {"fi_FI.UTF-8", "lang-fi_FI.png", "Suomi"},
+ {"fr_FR.UTF-8", "lang-fr_FR.png", "Français"},
+ {"de_DE.UTF-8", "lang-de_DE.png", "Deutsch"},
+ {"hu_HU.UTF-8", "lang-hu_HU.png", "Magyar"},
+ {"it_IT.UTF-8", "lang-it_IT.png", "Italiano"},
+ {"ja_JP.UTF-8", "lang-ja_JP.png", "日本語"},
+ {"ko_KR.UTF-8", "lang-ko_KR.png", "한국어"},
+ {"nb_NO.UTF-8", "lang-nb_NO.png", "Norsk Bokmål"},
+ {"pl_PL.UTF-8", "lang-pl_PL.png", "Polski"},
+ {"pt_BR.UTF-8", "lang-pt_BR.png", "Português"},
+ {"ru_RU.UTF-8", "lang-ru_RU.png", "Русский"},
+ {"sk_SK.UTF-8", "lang-sk_SK.png", "Slovenčina"},
+ {"sl_SI.UTF-8", "lang-sl_SI.png", "Slovenščina"},
+ {"es_AR.UTF-8", "lang-es_AR.png", "Español"},
+ {"sv_SE.UTF-8", "lang-sv_SE.png", "Svenska"},
+ { NULL, NULL, NULL }
};
static char *lang = NULL;
@@ -74,7 +75,6 @@ wizard_page_init(E_Wizard_Page *pg)
e_lang_list = e_intl_language_list();
- printf("init\n");
output = popen("locale -a", "r");
if (output)
{
@@ -146,7 +146,7 @@ wizard_page_show(E_Wizard_Page *pg)
o = e_widget_list_add(pg->evas, 1, 0);
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);
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++)
{
E_Intl_Pair *pair;
+ Evas_Object *ic;
+ char buf[PATH_MAX], *dir;
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);
if (e_intl_language_get())
{
diff --git a/src/modules/wizard/page_020.c b/src/modules/wizard/page_020.c
index ceb7d96296..e72331047b 100644
--- a/src/modules/wizard/page_020.c
+++ b/src/modules/wizard/page_020.c
@@ -4,6 +4,35 @@
#include "e.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
wizard_page_init(E_Wizard_Page *pg)
{
@@ -17,17 +46,80 @@ wizard_page_shutdown(E_Wizard_Page *pg)
EAPI int
wizard_page_show(E_Wizard_Page *pg)
{
- Evas_Object *ob, *o;
-
- printf("t2\n");
- ob = e_widget_list_add(pg->evas, 1, 0);
- o = e_widget_button_add(pg->evas,
- "Hello Another World", NULL,
- NULL, NULL, NULL);
- e_widget_list_object_append(ob, o, 0, 0, 0.5);
- evas_object_show(o);
- e_wizard_page_show(ob);
- pg->data = ob;
+ Evas_Object *o, *of, *ob;
+ Eina_List *l, *profiles;
+ int i, sel = -1;
+ Evas_Object *ilist;
+
+ o = e_widget_list_add(pg->evas, 1, 0);
+ e_wizard_title_set(_("Profile"));
+ of = e_widget_framelist_add(pg->evas, _("Select one"), 0);
+
+ ob = e_widget_ilist_add(pg->evas, 32 * e_scale, 32 * e_scale, &profile);
+ e_widget_min_size_set(ob, 140 * e_scale, 70 * e_scale);
+ ilist = ob;
+ e_widget_on_change_hook_set(ob, _profile_change, NULL);
+
+ 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 */
}
EAPI int
@@ -39,6 +131,6 @@ wizard_page_hide(E_Wizard_Page *pg)
EAPI int
wizard_page_apply(E_Wizard_Page *pg)
{
- printf("a2\n");
+ // FIXME: actually apply profile
return 1;
}