forked from enlightenment/enlightenment
back to working on wizard. page 000 is just a splash page. does nothing
interestign except pause for 2 seconds so the "welcome to enlightenment" title it sets can be seen (and disable the next button). 010 is the laguage selector - borrows a small bit of logic code from the langaue config module so it can just list known supported locales on your system let you select, and move on. it's special in that it implements its langauge choice the moment you hit "next" (the page hides). this is so further pages are in the selected language (which they are. and that's so cool). SVN revision: 37092
This commit is contained in:
parent
e5c4d62fd4
commit
26c18a5116
|
@ -20768,6 +20768,12 @@ group { name: "e/toolbar/default/base";
|
|||
images {
|
||||
image: "vgrad_dark.png" COMP;
|
||||
image: "grill_dark_tiny_pattern.png" COMP;
|
||||
image: "bt_base1.png" COMP;
|
||||
image: "bt_base2.png" COMP;
|
||||
image: "bt_hilight.png" COMP;
|
||||
image: "bt_shine.png" COMP;
|
||||
image: "bt_dis_base.png" COMP;
|
||||
image: "bt_dis_hilight.png" COMP;
|
||||
}
|
||||
parts {
|
||||
part { name: "background_image";
|
||||
|
@ -20793,12 +20799,190 @@ group { name: "e/toolbar/default/base";
|
|||
}
|
||||
}
|
||||
}
|
||||
part { name: "e.text.title";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
scale: 1;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
align: 0.5 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 0 8;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 0.0;
|
||||
offset: -1 8;
|
||||
}
|
||||
color: 255 255 255 255;
|
||||
color3: 0 0 0 32;
|
||||
text {
|
||||
font: "Sans:style=Bold";
|
||||
size: 20;
|
||||
min: 1 1;
|
||||
align: 0.5 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "e.swallow.content";
|
||||
type: SWALLOW;
|
||||
description { state: "default" 0.0;
|
||||
rel1.relative: 0.5 0.5;
|
||||
rel2.relative: 0.5 0.5;
|
||||
}
|
||||
}
|
||||
part { name: "button_image";
|
||||
mouse_events: 1;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
align: 0.5 1.0;
|
||||
rel1.relative: 0.5 1.0;
|
||||
rel1.offset: 0 -9;
|
||||
rel2.relative: 0.5 1.0;
|
||||
rel2.offset: 0 -9;
|
||||
min: 64 32;
|
||||
max: 64 32;
|
||||
image {
|
||||
normal: "bt_base2.png";
|
||||
border: 7 7 7 7;
|
||||
}
|
||||
}
|
||||
description { state: "clicked" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
image.normal: "bt_base1.png";
|
||||
}
|
||||
description { state: "disabled" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
image {
|
||||
normal: "bt_dis_base.png";
|
||||
border: 4 4 4 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "e.text.label";
|
||||
type: TEXT;
|
||||
effect: SOFT_SHADOW;
|
||||
mouse_events: 0;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "button_image";
|
||||
relative: 0.0 0.0;
|
||||
offset: 3 3;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -4 -4;
|
||||
to: "button_image";
|
||||
}
|
||||
color: 224 224 224 255;
|
||||
color3: 0 0 0 64;
|
||||
color_class: "button_text";
|
||||
text {
|
||||
text: "Close";
|
||||
font: "Sans";
|
||||
size: 10;
|
||||
min: 1 1;
|
||||
align: 0.5 0.5;
|
||||
text_class: "button";
|
||||
}
|
||||
}
|
||||
description { state: "disabled" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 0 0 0 128;
|
||||
color3: 0 0 0 0;
|
||||
color_class: "button_text_disabled";
|
||||
}
|
||||
}
|
||||
part { name: "over1";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "button_image";
|
||||
rel2.to: "button_image";
|
||||
rel2.relative: 1.0 0.5;
|
||||
image {
|
||||
normal: "bt_hilight.png";
|
||||
border: 7 7 7 0;
|
||||
}
|
||||
}
|
||||
description { state: "disabled" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
image {
|
||||
normal: "bt_dis_hilight.png";
|
||||
border: 4 4 4 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "over2";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "button_image";
|
||||
rel2.to: "button_image";
|
||||
image {
|
||||
normal: "bt_shine.png";
|
||||
border: 7 7 7 7;
|
||||
}
|
||||
}
|
||||
description { state: "disabled" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
part { name: "block";
|
||||
mouse_events: 1;
|
||||
description { state: "default" 0.0;
|
||||
rel1.to: "button_image";
|
||||
rel2.to: "button_image";
|
||||
visible: 0;
|
||||
color: 0 0 0 0;
|
||||
}
|
||||
description { state: "disabled" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program { name: "button_click";
|
||||
signal: "mouse,down,1";
|
||||
source: "button_image";
|
||||
action: STATE_SET "clicked" 0.0;
|
||||
target: "button_image";
|
||||
}
|
||||
program { name: "button_unclick";
|
||||
signal: "mouse,up,1";
|
||||
source: "button_image";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "button_image";
|
||||
}
|
||||
program { name: "button_unclick2";
|
||||
signal: "mouse,clicked,1";
|
||||
source: "button_image";
|
||||
action: SIGNAL_EMIT "e,action,next" "";
|
||||
}
|
||||
program { name: "button_enable";
|
||||
signal: "e,state,next,enable";
|
||||
source: "e";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "button_image";
|
||||
target: "e.text.label";
|
||||
target: "over1";
|
||||
target: "over2";
|
||||
target: "block";
|
||||
}
|
||||
program { name: "button_disable";
|
||||
signal: "e,state,next,disable";
|
||||
source: "e";
|
||||
action: STATE_SET "disabled" 0.0;
|
||||
target: "button_image";
|
||||
target: "e.text.label";
|
||||
target: "over1";
|
||||
target: "over2";
|
||||
target: "block";
|
||||
}
|
||||
}
|
||||
// FIXME: add e.button.next.label, e.button.back.label,
|
||||
// e.text.title, e.swallow.content
|
||||
// FIXME: add programs that:
|
||||
// action: SIGNAL_EMIT "e,action,back" "";
|
||||
// action: SIGNAL_EMIT "e,action,next" "";
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -20,39 +20,19 @@ static E_Module *conf_module = NULL;
|
|||
* These are the currently planned wizard pages:
|
||||
*
|
||||
* o == interactive
|
||||
* . == automatic (no gui)
|
||||
* . == automatic (no gui - none implemented currently)
|
||||
*
|
||||
* --- THE LIST
|
||||
* . look for system global profile - if it exists just copy it and exit
|
||||
* wizard now.
|
||||
* . find fonts like sans and other known fonts that have full intl. support
|
||||
* and use them if found.
|
||||
* o ask for language (default selection is current locale).
|
||||
* o ask for font size to use.
|
||||
* o xrender/engine speed test and detect and suggest best engine.
|
||||
* o ask for one of N default config profiles to be set up. if profile is
|
||||
* marked as "final" end wizard now.
|
||||
* o ask for initial profile
|
||||
* o find XDG app menus/repositories and list them let user choose which
|
||||
* one(s) are to be used.
|
||||
* o find other secondary menus - like ubuntu's settings menu and build
|
||||
* more app menus for this.
|
||||
* . look for battery, cpufreq and temperature support - if there, enable the
|
||||
* appropriate modules.
|
||||
* o ask what apps you want in ibar by default (or none - no ibar).
|
||||
* o ask for ibar initial app set
|
||||
* o ask if user wants desktop icons or not (enable fwin module but seed it
|
||||
* with default config).
|
||||
* o ask if the user wants virtual desktops (if so have 4x1 and page module
|
||||
* loaded).
|
||||
* o ask about what kind of default key and mouse bindings a user wants
|
||||
* (current e defaults, windows-style or mac-style?).
|
||||
* o ask for what default wallpaper to use.
|
||||
* o ask if the user wants gnome or kde support
|
||||
* (for gnome run gnome-settings-daemon, unknown for kde).
|
||||
*
|
||||
* --- THINGS TO ADD?
|
||||
* o choose one of n available default themes (if we have any).
|
||||
* o do you want a taskbar or not.
|
||||
|
||||
* o ask if you want links to home/system/tmp on desktop (if fileman above on)
|
||||
* . take some of current config (language, fileman, profile) and load
|
||||
* load profile, apply language to it and save, restart e.
|
||||
*/
|
||||
|
||||
/**/
|
||||
|
|
|
@ -4,13 +4,11 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
static void _e_wizard_back_eval(void);
|
||||
static void _e_wizard_next_eval(void);
|
||||
static E_Popup *_e_wizard_main_new(E_Zone *zone);
|
||||
static E_Popup *_e_wizard_extra_new(E_Zone *zone);
|
||||
static void _e_wizard_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event);
|
||||
static void _e_wizard_cb_next(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _e_wizard_cb_back(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
|
||||
static E_Popup *pop = NULL;
|
||||
static Eina_List *pops = NULL;
|
||||
|
@ -19,11 +17,8 @@ static Evas_Object *o_content = NULL;
|
|||
static Eina_List *pages = NULL;
|
||||
static E_Wizard_Page *curpage = NULL;
|
||||
static int next_ok = 1;
|
||||
static int back_ok = 1;
|
||||
static int next_can = 0;
|
||||
static int back_can = 0;
|
||||
static int next_prev = 0;
|
||||
static int back_prev = 0;
|
||||
|
||||
EAPI int
|
||||
e_wizard_init(void)
|
||||
|
@ -91,7 +86,6 @@ e_wizard_go(void)
|
|||
if (curpage)
|
||||
{
|
||||
if ((!curpage->data) && (curpage->init)) curpage->init(curpage);
|
||||
_e_wizard_back_eval();
|
||||
_e_wizard_next_eval();
|
||||
if ((curpage->show) && (!curpage->show(curpage)))
|
||||
{
|
||||
|
@ -137,9 +131,6 @@ e_wizard_next(void)
|
|||
curpage->init(curpage);
|
||||
}
|
||||
next_can = 1;
|
||||
if (l->prev) back_can = 1;
|
||||
else back_can = 0;
|
||||
_e_wizard_back_eval();
|
||||
_e_wizard_next_eval();
|
||||
if ((curpage->show) && (curpage->show(curpage)))
|
||||
{
|
||||
|
@ -157,46 +148,6 @@ e_wizard_next(void)
|
|||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_wizard_back(void)
|
||||
{
|
||||
Eina_List *l;
|
||||
|
||||
for (l = eina_list_last(pages); l; l = l->prev)
|
||||
{
|
||||
if (l->data == curpage)
|
||||
{
|
||||
if (l->prev)
|
||||
{
|
||||
if (curpage)
|
||||
{
|
||||
if (curpage->hide)
|
||||
curpage->hide(curpage);
|
||||
}
|
||||
curpage = l->prev->data;
|
||||
if (!curpage->data)
|
||||
{
|
||||
if (curpage->init)
|
||||
curpage->init(curpage);
|
||||
}
|
||||
next_can = 1;
|
||||
if (l->prev) back_can = 1;
|
||||
else back_can = 0;
|
||||
_e_wizard_back_eval();
|
||||
_e_wizard_next_eval();
|
||||
if ((curpage->show) && (curpage->show(curpage)))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_wizard_page_show(Evas_Object *obj)
|
||||
{
|
||||
|
@ -252,13 +203,6 @@ e_wizard_page_del(E_Wizard_Page *pg)
|
|||
free(pg);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_wizard_button_back_enable_set(int enable)
|
||||
{
|
||||
back_ok = enable;
|
||||
_e_wizard_back_eval();
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_wizard_button_next_enable_set(int enable)
|
||||
{
|
||||
|
@ -272,19 +216,10 @@ e_wizard_title_set(const char *title)
|
|||
edje_object_part_text_set(o_bg, "e.text.title", title);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_wizard_back_eval(void)
|
||||
EAPI void
|
||||
e_wizard_labels_update(void)
|
||||
{
|
||||
int ok;
|
||||
|
||||
ok = back_can;
|
||||
if (!back_ok) ok = 0;
|
||||
if (back_prev != ok)
|
||||
{
|
||||
if (ok) edje_object_signal_emit(o_bg, "e,state,back,enable", "e");
|
||||
else edje_object_signal_emit(o_bg, "e,state,back,disable", "e");
|
||||
back_prev = ok;
|
||||
}
|
||||
edje_object_part_text_set(o_bg, "e.text.label", _("Next"));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -312,16 +247,13 @@ _e_wizard_main_new(E_Zone *zone)
|
|||
pop = e_popup_new(zone, zone->x, zone->y, zone->w, zone->h);
|
||||
e_popup_layer_set(pop, 255);
|
||||
o = edje_object_add(pop->evas);
|
||||
/* FIXME: need a theme */
|
||||
e_theme_edje_object_set(o, "base/theme/wizard",
|
||||
"e/wizard/main");
|
||||
|
||||
e_theme_edje_object_set(o, "base/theme/wizard", "e/wizard/main");
|
||||
evas_object_move(o, 0, 0);
|
||||
evas_object_resize(o, zone->w, zone->h);
|
||||
evas_object_show(o);
|
||||
edje_object_signal_callback_add(o, "e,action,next", "",
|
||||
_e_wizard_cb_next, pop);
|
||||
edje_object_signal_callback_add(o, "e,action,back", "",
|
||||
_e_wizard_cb_back, pop);
|
||||
o_bg = o;
|
||||
|
||||
o = evas_object_rectangle_add(pop->evas);
|
||||
|
@ -338,12 +270,9 @@ _e_wizard_main_new(E_Zone *zone)
|
|||
o_ev = o;
|
||||
|
||||
/* set up next/prev buttons */
|
||||
edje_object_part_text_set(o_bg, "e.text.title", _("Welcome to Enlightenment 東京"));
|
||||
edje_object_part_text_set(o_bg, "e.text.page", "");
|
||||
edje_object_part_text_set(o_bg, "e.text.next", _("Next"));
|
||||
edje_object_part_text_set(o_bg, "e.text.back", _("Back"));
|
||||
edje_object_part_text_set(o_bg, "e.text.title", _("Welcome to Enlightenment"));
|
||||
edje_object_signal_emit(o_bg, "e,state,next,disable", "e");
|
||||
edje_object_signal_emit(o_bg, "e,state,back,disable", "e");
|
||||
e_wizard_labels_update();
|
||||
|
||||
e_popup_edje_bg_object_set(pop, o_bg);
|
||||
e_popup_show(pop);
|
||||
|
@ -365,9 +294,7 @@ _e_wizard_extra_new(E_Zone *zone)
|
|||
pop = e_popup_new(zone, zone->x, zone->y, zone->w, zone->h);
|
||||
e_popup_layer_set(pop, 255);
|
||||
o = edje_object_add(pop->evas);
|
||||
/* FIXME: need a theme */
|
||||
e_theme_edje_object_set(o, "base/theme/wizard",
|
||||
"e/wizard/extra");
|
||||
e_theme_edje_object_set(o, "base/theme/wizard", "e/wizard/extra");
|
||||
evas_object_move(o, 0, 0);
|
||||
evas_object_resize(o, zone->w, zone->h);
|
||||
evas_object_show(o);
|
||||
|
@ -408,9 +335,3 @@ _e_wizard_cb_next(void *data, Evas_Object *obj, const char *emission, const char
|
|||
{
|
||||
e_wizard_next();
|
||||
}
|
||||
|
||||
static void
|
||||
_e_wizard_cb_back(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
e_wizard_back();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ EAPI int e_wizard_shutdown(void);
|
|||
EAPI void e_wizard_go(void);
|
||||
EAPI void e_wizard_apply(void);
|
||||
EAPI void e_wizard_next(void);
|
||||
EAPI void e_wizard_back(void);
|
||||
EAPI void e_wizard_page_show(Evas_Object *obj);
|
||||
EAPI E_Wizard_Page *
|
||||
e_wizard_page_add(void *handle,
|
||||
|
@ -37,7 +36,6 @@ EAPI E_Wizard_Page *
|
|||
int (*apply) (E_Wizard_Page *pg)
|
||||
);
|
||||
EAPI void e_wizard_page_del(E_Wizard_Page *pg);
|
||||
EAPI void e_wizard_button_back_enable_set(int enable);
|
||||
EAPI void e_wizard_button_next_enable_set(int enable);
|
||||
EAPI void e_wizard_title_set(const char *title);
|
||||
|
||||
|
|
|
@ -4,25 +4,6 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
const char *intlfont = NULL;
|
||||
/* A list of fonts to choose as the default, in order of preference. This list
|
||||
* can and probably will change over time with fine-tuning
|
||||
*/
|
||||
const char *preferred_fonts[] =
|
||||
{
|
||||
"Sans",
|
||||
"DejaVu Sans",
|
||||
"Bitstream Vera Sans",
|
||||
"Arial",
|
||||
"Nice",
|
||||
"Verdana",
|
||||
"Lucida Sans"
|
||||
};
|
||||
/* negative numbers == keep theme set size but multiple by negative value
|
||||
* multiplied by -100 (so scale, 100 = 1:1 scaling)
|
||||
*/
|
||||
const int fontsize = -100;
|
||||
|
||||
EAPI int
|
||||
wizard_page_init(E_Wizard_Page *pg)
|
||||
{
|
||||
|
@ -33,90 +14,20 @@ wizard_page_shutdown(E_Wizard_Page *pg)
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
static int
|
||||
_next_page(void *data)
|
||||
{
|
||||
e_wizard_button_next_enable_set(1);
|
||||
e_wizard_next();
|
||||
return 0;
|
||||
}
|
||||
EAPI int
|
||||
wizard_page_show(E_Wizard_Page *pg)
|
||||
{
|
||||
Eina_List *fonts;
|
||||
Evas_Hash *fonts_hash;
|
||||
int i;
|
||||
|
||||
fonts = evas_font_available_list(pg->evas);
|
||||
fonts_hash = e_font_available_list_parse(fonts);
|
||||
|
||||
for (i = 0; i < (sizeof(preferred_fonts) / sizeof(char *)); i++)
|
||||
{
|
||||
E_Font_Properties *efp;
|
||||
|
||||
efp = evas_hash_find(fonts_hash, preferred_fonts[i]);
|
||||
printf("WIZ: page_000: FONT \"%s\" exists=", preferred_fonts[i]);
|
||||
if (efp) printf("yes\n");
|
||||
else printf("no\n");
|
||||
if ((!intlfont) && (efp))
|
||||
intlfont = preferred_fonts[i];
|
||||
}
|
||||
|
||||
if (!intlfont) printf("WIZ: page_000: No intl font found\n");
|
||||
else printf("WIZ: page_000: Chose \"%s\"\n", intlfont);
|
||||
|
||||
if (intlfont)
|
||||
{
|
||||
const char *classes[] =
|
||||
{
|
||||
"title_bar",
|
||||
"menu_item",
|
||||
"menu_title",
|
||||
"tb_plain",
|
||||
"tb_light",
|
||||
"tb_big",
|
||||
"move_text",
|
||||
"resize_text",
|
||||
"winlist_title",
|
||||
"configure",
|
||||
"about_title",
|
||||
"about_version",
|
||||
"button_text",
|
||||
"desklock_title",
|
||||
"desklock_passwd",
|
||||
"dialog_error",
|
||||
"exebuf_command",
|
||||
"init_title",
|
||||
"init_text",
|
||||
"init_version",
|
||||
"entry",
|
||||
"frame",
|
||||
"label",
|
||||
"button",
|
||||
"slider",
|
||||
"radio_button",
|
||||
"check_button",
|
||||
"tlist",
|
||||
"ilist_item",
|
||||
"ilist_header",
|
||||
"fileman_typebuf",
|
||||
"fileman_icon",
|
||||
"module_small",
|
||||
"module_normal",
|
||||
"module_large",
|
||||
"module_small_s",
|
||||
"module_normal_s",
|
||||
"module_large_s",
|
||||
"wizard_title",
|
||||
"wizard_button"
|
||||
/* FIXME: this list needs to be extended as new text classes
|
||||
* appear - maybe we need to put the list of textclasses into
|
||||
* core E
|
||||
*/
|
||||
};
|
||||
|
||||
for (i = 0; i < (sizeof(classes) / sizeof(char *)); i++)
|
||||
e_font_default_set(classes[i], intlfont, fontsize);
|
||||
|
||||
e_font_apply();
|
||||
}
|
||||
|
||||
e_font_available_hash_free(fonts_hash);
|
||||
evas_font_available_list_free(pg->evas, fonts);
|
||||
return 0; /* 1 == show ui, and wait for user, 0 == just continue */
|
||||
e_wizard_title_set(_("Enlightenment"));
|
||||
e_wizard_button_next_enable_set(0);
|
||||
ecore_timer_add(2.0, _next_page, NULL);
|
||||
return 1;
|
||||
}
|
||||
EAPI int
|
||||
wizard_page_hide(E_Wizard_Page *pg)
|
||||
|
|
|
@ -4,27 +4,170 @@
|
|||
#include "e.h"
|
||||
#include "e_mod_main.h"
|
||||
|
||||
typedef struct _E_Intl_Pair E_Intl_Pair;
|
||||
|
||||
static int _basic_lang_list_sort(const void *data1, const void *data2);
|
||||
|
||||
struct _E_Intl_Pair
|
||||
{
|
||||
const char *locale_key;
|
||||
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 }
|
||||
};
|
||||
|
||||
static char *lang = NULL;
|
||||
static Eina_List *blang_list = NULL;
|
||||
|
||||
static int
|
||||
_basic_lang_list_sort(const void *data1, const void *data2)
|
||||
{
|
||||
E_Intl_Pair *ln1, *ln2;
|
||||
const char *trans1;
|
||||
const char *trans2;
|
||||
|
||||
if (!data1) return 1;
|
||||
if (!data2) return -1;
|
||||
|
||||
ln1 = (E_Intl_Pair *)data1;
|
||||
ln2 = (E_Intl_Pair *)data2;
|
||||
|
||||
if (!ln1->locale_translation) return 1;
|
||||
trans1 = ln1->locale_translation;
|
||||
|
||||
if (!ln2->locale_translation) return -1;
|
||||
trans2 = ln2->locale_translation;
|
||||
|
||||
return (strcmp(trans1, trans2));
|
||||
}
|
||||
|
||||
EAPI int
|
||||
wizard_page_init(E_Wizard_Page *pg)
|
||||
{
|
||||
Eina_List *e_lang_list;
|
||||
FILE *output;
|
||||
|
||||
e_lang_list = e_intl_language_list();
|
||||
|
||||
printf("init\n");
|
||||
output = popen("locale -a", "r");
|
||||
if (output)
|
||||
{
|
||||
char line[32];
|
||||
|
||||
while (fscanf(output, "%[^\n]\n", line) == 1)
|
||||
{
|
||||
E_Locale_Parts *locale_parts;
|
||||
|
||||
locale_parts = e_intl_locale_parts_get(line);
|
||||
if (locale_parts)
|
||||
{
|
||||
char *basic_language;
|
||||
|
||||
basic_language =
|
||||
e_intl_locale_parts_combine
|
||||
(locale_parts, E_INTL_LOC_LANG | E_INTL_LOC_REGION);
|
||||
if (basic_language)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (basic_language_predefined_pairs[i].locale_key)
|
||||
{
|
||||
/* if basic language is supported by E and System*/
|
||||
if (!strncmp
|
||||
(basic_language_predefined_pairs[i].locale_key,
|
||||
basic_language, strlen(basic_language)))
|
||||
{
|
||||
if (!eina_list_data_find
|
||||
(blang_list,
|
||||
&basic_language_predefined_pairs[i]))
|
||||
blang_list = eina_list_append
|
||||
(blang_list,
|
||||
&basic_language_predefined_pairs[i]);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
E_FREE(basic_language);
|
||||
e_intl_locale_parts_free(locale_parts);
|
||||
}
|
||||
}
|
||||
/* Sort basic languages */
|
||||
blang_list = eina_list_sort(blang_list, eina_list_count(blang_list), _basic_lang_list_sort);
|
||||
|
||||
while (e_lang_list)
|
||||
{
|
||||
free(e_lang_list->data);
|
||||
e_lang_list = eina_list_remove_list(e_lang_list, e_lang_list);
|
||||
}
|
||||
pclose(output);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
EAPI int
|
||||
wizard_page_shutdown(E_Wizard_Page *pg)
|
||||
{
|
||||
// FIXME: free blang_list
|
||||
return 1;
|
||||
}
|
||||
EAPI int
|
||||
wizard_page_show(E_Wizard_Page *pg)
|
||||
{
|
||||
Evas_Object *o, *of, *ob;
|
||||
|
||||
Eina_List *l;
|
||||
int i, sel = -1;
|
||||
|
||||
o = e_widget_list_add(pg->evas, 1, 0);
|
||||
of = e_widget_framelist_add(pg->evas, _("Choose Language"), 0);
|
||||
ob = e_widget_ilist_add(pg->evas, 16, 16, &lang);
|
||||
e_widget_min_size_set(ob, 175, 175);
|
||||
e_wizard_title_set(_("Language"));
|
||||
of = e_widget_framelist_add(pg->evas, _("Available"), 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);
|
||||
|
||||
e_widget_ilist_freeze(ob);
|
||||
|
||||
for (i = 0, l = blang_list; l; l = l->next, i++)
|
||||
{
|
||||
E_Intl_Pair *pair;
|
||||
|
||||
pair = l->data;
|
||||
e_widget_ilist_append(ob, NULL, _(pair->locale_translation),
|
||||
NULL, NULL, pair->locale_key);
|
||||
if (e_intl_language_get())
|
||||
{
|
||||
if (!strcmp(pair->locale_key, e_intl_language_get())) sel = i;
|
||||
}
|
||||
}
|
||||
e_widget_ilist_go(ob);
|
||||
e_widget_ilist_thaw(ob);
|
||||
if (sel >= 0) e_widget_ilist_selected_set(ob, sel);
|
||||
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(o, of, 0, 0, 0.5);
|
||||
evas_object_show(ob);
|
||||
|
@ -37,11 +180,16 @@ EAPI int
|
|||
wizard_page_hide(E_Wizard_Page *pg)
|
||||
{
|
||||
evas_object_del(pg->data);
|
||||
/* special - language inits its stuff the moment it goes away */
|
||||
if (e_config->language) eina_stringshare_del(e_config->language);
|
||||
e_config->language = NULL;
|
||||
if (lang) e_config->language = eina_stringshare_add(lang);
|
||||
e_intl_language_set(e_config->language);
|
||||
e_wizard_labels_update();
|
||||
return 1;
|
||||
}
|
||||
EAPI int
|
||||
wizard_page_apply(E_Wizard_Page *pg)
|
||||
{
|
||||
printf("a2\n");
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue