forked from enlightenment/enlightenment
If finally go around to adding the advanced conf dialog for input methods.
* Note: input methods are stored as full path now, meaning most people have to update their configs SVN revision: 27492
This commit is contained in:
parent
348ec15b3f
commit
577618bf99
|
@ -100,6 +100,7 @@ e_int_config_focus.h \
|
||||||
e_int_config_desks.h \
|
e_int_config_desks.h \
|
||||||
e_int_config_intl.h \
|
e_int_config_intl.h \
|
||||||
e_int_config_imc.h \
|
e_int_config_imc.h \
|
||||||
|
e_int_config_imc_import.h \
|
||||||
e_configure.h \
|
e_configure.h \
|
||||||
e_int_border_locks.h \
|
e_int_border_locks.h \
|
||||||
e_thumb.h \
|
e_thumb.h \
|
||||||
|
@ -289,6 +290,7 @@ e_int_config_apps.c \
|
||||||
e_int_config_cfgdialogs.c \
|
e_int_config_cfgdialogs.c \
|
||||||
e_int_config_intl.c \
|
e_int_config_intl.c \
|
||||||
e_int_config_imc.c \
|
e_int_config_imc.c \
|
||||||
|
e_int_config_imc_import.c \
|
||||||
e_int_config_color_classes.c \
|
e_int_config_color_classes.c \
|
||||||
e_int_config_mime.c \
|
e_int_config_mime.c \
|
||||||
e_int_config_mime_edit.c \
|
e_int_config_mime_edit.c \
|
||||||
|
|
|
@ -148,7 +148,6 @@ extern EAPI E_Path *path_icons;
|
||||||
extern EAPI E_Path *path_init;
|
extern EAPI E_Path *path_init;
|
||||||
extern EAPI E_Path *path_modules;
|
extern EAPI E_Path *path_modules;
|
||||||
extern EAPI E_Path *path_backgrounds;
|
extern EAPI E_Path *path_backgrounds;
|
||||||
extern EAPI E_Path *path_input_methods;
|
|
||||||
extern EAPI E_Path *path_messages;
|
extern EAPI E_Path *path_messages;
|
||||||
extern EAPI int restart;
|
extern EAPI int restart;
|
||||||
extern EAPI int good;
|
extern EAPI int good;
|
||||||
|
|
|
@ -448,7 +448,6 @@ e_config_init(void)
|
||||||
E_CONFIG_VAL(D, T, menu_eap_comment_show, INT); /**/
|
E_CONFIG_VAL(D, T, menu_eap_comment_show, INT); /**/
|
||||||
E_CONFIG_VAL(D, T, fullscreen_policy, INT); /**/
|
E_CONFIG_VAL(D, T, fullscreen_policy, INT); /**/
|
||||||
E_CONFIG_VAL(D, T, input_method, STR); /**/
|
E_CONFIG_VAL(D, T, input_method, STR); /**/
|
||||||
E_CONFIG_LIST(D, T, path_append_input_methods, _e_config_path_append_edd); /**/
|
|
||||||
E_CONFIG_LIST(D, T, path_append_messages, _e_config_path_append_edd); /**/
|
E_CONFIG_LIST(D, T, path_append_messages, _e_config_path_append_edd); /**/
|
||||||
E_CONFIG_VAL(D, T, exebuf_max_exe_list, INT);
|
E_CONFIG_VAL(D, T, exebuf_max_exe_list, INT);
|
||||||
E_CONFIG_VAL(D, T, exebuf_max_eap_list, INT);
|
E_CONFIG_VAL(D, T, exebuf_max_eap_list, INT);
|
||||||
|
@ -1920,14 +1919,6 @@ _e_config_free(void)
|
||||||
if (epd->dir) evas_stringshare_del(epd->dir);
|
if (epd->dir) evas_stringshare_del(epd->dir);
|
||||||
E_FREE(epd);
|
E_FREE(epd);
|
||||||
}
|
}
|
||||||
while (e_config->path_append_input_methods)
|
|
||||||
{
|
|
||||||
E_Path_Dir *epd;
|
|
||||||
epd = e_config->path_append_input_methods->data;
|
|
||||||
e_config->path_append_input_methods = evas_list_remove_list(e_config->path_append_input_methods, e_config->path_append_input_methods);
|
|
||||||
if (epd->dir) evas_stringshare_del(epd->dir);
|
|
||||||
E_FREE(epd);
|
|
||||||
}
|
|
||||||
while (e_config->path_append_messages)
|
while (e_config->path_append_messages)
|
||||||
{
|
{
|
||||||
E_Path_Dir *epd;
|
E_Path_Dir *epd;
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef Eet_Data_Descriptor E_Config_DD;
|
||||||
*/
|
*/
|
||||||
#define E_CONFIG_FILE_EPOCH 0x0001
|
#define E_CONFIG_FILE_EPOCH 0x0001
|
||||||
/* increment this whenever a new set of config values are added but the users
|
/* increment this whenever a new set of config values are added but the users
|
||||||
* config doesn't need top be wiped - simply new values need to be put in
|
* config doesn't need to be wiped - simply new values need to be put in
|
||||||
*/
|
*/
|
||||||
#define E_CONFIG_FILE_GENERATION 0x0105
|
#define E_CONFIG_FILE_GENERATION 0x0105
|
||||||
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
|
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
|
||||||
|
@ -127,7 +127,6 @@ struct _E_Config
|
||||||
Evas_List *path_append_icons; // GUI
|
Evas_List *path_append_icons; // GUI
|
||||||
Evas_List *path_append_modules; // GUI
|
Evas_List *path_append_modules; // GUI
|
||||||
Evas_List *path_append_backgrounds; // GUI
|
Evas_List *path_append_backgrounds; // GUI
|
||||||
Evas_List *path_append_input_methods; // GUI
|
|
||||||
Evas_List *path_append_messages; // GUI
|
Evas_List *path_append_messages; // GUI
|
||||||
int window_placement_policy; // GUI
|
int window_placement_policy; // GUI
|
||||||
int focus_policy; // GUI
|
int focus_policy; // GUI
|
||||||
|
|
|
@ -106,6 +106,7 @@
|
||||||
#include "e_int_config_cfgdialogs.h"
|
#include "e_int_config_cfgdialogs.h"
|
||||||
#include "e_int_config_intl.h"
|
#include "e_int_config_intl.h"
|
||||||
#include "e_int_config_imc.h"
|
#include "e_int_config_imc.h"
|
||||||
|
#include "e_int_config_imc_import.h"
|
||||||
#include "e_int_config_color_classes.h"
|
#include "e_int_config_color_classes.h"
|
||||||
#include "e_int_config_mime.h"
|
#include "e_int_config_mime.h"
|
||||||
#include "e_int_config_mime_edit.h"
|
#include "e_int_config_mime_edit.h"
|
||||||
|
|
|
@ -3,27 +3,80 @@
|
||||||
*/
|
*/
|
||||||
#include "e.h"
|
#include "e.h"
|
||||||
|
|
||||||
|
typedef struct _E_Imc_Update_Data E_Imc_Update_Data;
|
||||||
|
|
||||||
static void *_create_data (E_Config_Dialog *cfd);
|
static void *_create_data (E_Config_Dialog *cfd);
|
||||||
static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
static int _basic_apply_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
static int _basic_apply_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
|
static int _advanced_apply_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
static Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
static Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||||
|
static Evas_Object *_advanced_create_widgets (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||||
|
|
||||||
|
/* Basic Callbacks */
|
||||||
static int _basic_list_sort_cb (void *d1, void *d2);
|
static int _basic_list_sort_cb (void *d1, void *d2);
|
||||||
|
|
||||||
|
/* Advanced Callbacks */
|
||||||
|
static void _cb_dir (void *data, Evas_Object *obj);
|
||||||
|
static void _cb_button_up (void *data1, void *data2);
|
||||||
|
static void _cb_new (void *data, void *data2);
|
||||||
|
|
||||||
|
static void _cb_files_changed (void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _cb_files_selection_change(void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _cb_files_files_changed (void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _cb_files_selected (void *data, Evas_Object *obj, void *event_info);
|
||||||
|
static void _cb_files_files_deleted (void *data, Evas_Object *obj, void *event_info);
|
||||||
|
|
||||||
|
static void _e_imc_change_enqueue (E_Config_Dialog_Data *cfdata);
|
||||||
|
static void _e_imc_entry_change_cb (void *data, Evas_Object *obj);
|
||||||
|
static void _e_imc_form_fill (E_Config_Dialog_Data *cfdata);
|
||||||
|
static const char* _e_imc_file_name_new_get (void);
|
||||||
|
static Evas_Bool _change_hash_free_cb (Evas_Hash *hash, const char *key, void *data, void *fdata);
|
||||||
|
static Evas_Bool _change_hash_apply_cb (Evas_Hash *hash, const char *key, void *data, void *fdata);
|
||||||
|
|
||||||
|
|
||||||
struct _E_Config_Dialog_Data
|
struct _E_Config_Dialog_Data
|
||||||
{
|
{
|
||||||
E_Config_Dialog *cfd;
|
E_Config_Dialog *cfd;
|
||||||
|
|
||||||
|
/* Maluable Widgets */
|
||||||
|
Evas_Object *o_personal;
|
||||||
|
Evas_Object *o_system;
|
||||||
|
Evas_Object *o_up_button;
|
||||||
|
|
||||||
|
Evas_Object *o_fm; /* File manager */
|
||||||
|
Evas_Object *o_frame; /* scrollpane for file manager*/
|
||||||
|
|
||||||
/* Current data */
|
|
||||||
char *imc_current;
|
char *imc_current;
|
||||||
|
|
||||||
Evas_List *imc_basic_list;
|
int fmdir; /* 0=Local, 1=System*/
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int dirty;
|
||||||
|
|
||||||
|
char *e_im_name;
|
||||||
|
char *e_im_exec;
|
||||||
|
|
||||||
|
char *gtk_im_module;
|
||||||
|
char *qt_im_module;
|
||||||
|
char *xmodifiers;
|
||||||
|
}
|
||||||
|
imc;
|
||||||
|
|
||||||
|
Evas_Hash *imc_change_map;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
Evas_Object *imc_basic_list;
|
Evas_Object *imc_basic_list;
|
||||||
|
|
||||||
|
Evas_Object *e_im_name;
|
||||||
|
Evas_Object *e_im_exec;
|
||||||
|
Evas_Object *gtk_im_module;
|
||||||
|
Evas_Object *qt_im_module;
|
||||||
|
Evas_Object *xmodifiers;
|
||||||
}
|
}
|
||||||
gui;
|
gui;
|
||||||
|
|
||||||
|
E_Win *win_import;
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI E_Config_Dialog *
|
EAPI E_Config_Dialog *
|
||||||
|
@ -37,8 +90,8 @@ e_int_config_imc(E_Container *con)
|
||||||
|
|
||||||
v->create_cfdata = _create_data;
|
v->create_cfdata = _create_data;
|
||||||
v->free_cfdata = _free_data;
|
v->free_cfdata = _free_data;
|
||||||
v->advanced.create_widgets = NULL;
|
v->advanced.create_widgets = _advanced_create_widgets;
|
||||||
v->advanced.apply_cfdata = NULL;
|
v->advanced.apply_cfdata = _advanced_apply_data;
|
||||||
v->basic.create_widgets = _basic_create_widgets;
|
v->basic.create_widgets = _basic_create_widgets;
|
||||||
v->basic.apply_cfdata = _basic_apply_data;
|
v->basic.apply_cfdata = _basic_apply_data;
|
||||||
|
|
||||||
|
@ -52,15 +105,19 @@ e_int_config_imc(E_Container *con)
|
||||||
static void
|
static void
|
||||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
cfdata->imc_basic_list = e_intl_input_method_list();
|
|
||||||
|
|
||||||
/* Sort basic input method list */
|
|
||||||
cfdata->imc_basic_list = evas_list_sort(cfdata->imc_basic_list,
|
|
||||||
evas_list_count(cfdata->imc_basic_list),
|
|
||||||
_basic_list_sort_cb);
|
|
||||||
|
|
||||||
if (e_config->input_method)
|
if (e_config->input_method)
|
||||||
cfdata->imc_current = strdup(e_config->input_method);
|
cfdata->imc_current = strdup(e_config->input_method);
|
||||||
|
|
||||||
|
if (cfdata->imc_current)
|
||||||
|
{
|
||||||
|
const char *path;
|
||||||
|
|
||||||
|
path = e_intl_imc_system_path_get();
|
||||||
|
if(!strncmp(cfdata->imc_current, path, strlen(path)))
|
||||||
|
{
|
||||||
|
cfdata->fmdir = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -74,19 +131,41 @@ _create_data(E_Config_Dialog *cfd)
|
||||||
return cfdata;
|
return cfdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Evas_Bool
|
||||||
|
_change_hash_free_cb(Evas_Hash *hash, const char *key, void *data, void *fdata)
|
||||||
|
{
|
||||||
|
E_Input_Method_Config *imc;
|
||||||
|
|
||||||
|
imc = data;
|
||||||
|
e_intl_input_method_config_free(imc);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
|
if (cfdata->win_import)
|
||||||
|
e_int_config_imc_import_del(cfdata->win_import);
|
||||||
E_FREE(cfdata->imc_current);
|
E_FREE(cfdata->imc_current);
|
||||||
|
|
||||||
while (cfdata->imc_basic_list)
|
if (cfdata->imc_change_map)
|
||||||
{
|
{
|
||||||
free(cfdata->imc_basic_list->data);
|
evas_hash_foreach(cfdata->imc_change_map, _change_hash_free_cb, NULL);
|
||||||
cfdata->imc_basic_list = evas_list_remove_list(cfdata->imc_basic_list, cfdata->imc_basic_list);
|
evas_hash_free(cfdata->imc_change_map);
|
||||||
}
|
}
|
||||||
|
cfdata->imc_change_map = NULL;
|
||||||
|
|
||||||
|
E_FREE(cfdata->imc.e_im_name);
|
||||||
|
E_FREE(cfdata->imc.e_im_exec);
|
||||||
|
E_FREE(cfdata->imc.gtk_im_module);
|
||||||
|
E_FREE(cfdata->imc.qt_im_module);
|
||||||
|
E_FREE(cfdata->imc.xmodifiers);
|
||||||
|
|
||||||
free(cfdata);
|
free(cfdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*** Start Basic Dialog Logic ***/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
|
@ -104,18 +183,12 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
_basic_list_sort_cb(void *d1, void *d2)
|
||||||
{
|
{
|
||||||
if (cfdata->imc_current)
|
if (!d1) return 1;
|
||||||
{
|
if (!d2) return -1;
|
||||||
if (e_config->input_method) evas_stringshare_del(e_config->input_method);
|
|
||||||
e_config->input_method = evas_stringshare_add(cfdata->imc_current);
|
|
||||||
e_intl_input_method_set(e_config->input_method);
|
|
||||||
}
|
|
||||||
|
|
||||||
e_config_save_queue();
|
return (strcmp((const char*)d1, (const char*)d2));
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
|
@ -123,13 +196,13 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
{
|
{
|
||||||
Evas_Object *o, *of, *ob;
|
Evas_Object *o, *of, *ob;
|
||||||
int i;
|
int i;
|
||||||
Evas_List *next;
|
Evas_List *imc_basic_list;
|
||||||
|
|
||||||
o = e_widget_list_add(evas, 0, 0);
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
|
|
||||||
of = e_widget_frametable_add(evas, _("Input Method Selector"), 1);
|
of = e_widget_frametable_add(evas, _("Input Method Selector"), 1);
|
||||||
|
|
||||||
/* Language List */
|
/* Input method List */
|
||||||
ob = e_widget_ilist_add(evas, 16, 16, &(cfdata->imc_current));
|
ob = e_widget_ilist_add(evas, 16, 16, &(cfdata->imc_current));
|
||||||
e_widget_min_size_set(ob, 175, 175);
|
e_widget_min_size_set(ob, 175, 175);
|
||||||
cfdata->gui.imc_basic_list = ob;
|
cfdata->gui.imc_basic_list = ob;
|
||||||
|
@ -138,18 +211,37 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
edje_freeze();
|
edje_freeze();
|
||||||
e_widget_ilist_freeze(ob);
|
e_widget_ilist_freeze(ob);
|
||||||
|
|
||||||
i = 0;
|
imc_basic_list = e_intl_input_method_list();
|
||||||
for (next = cfdata->imc_basic_list; next; next = next->next)
|
/* Sort basic input method list */
|
||||||
{
|
imc_basic_list = evas_list_sort(imc_basic_list,
|
||||||
const char * imc;
|
evas_list_count(imc_basic_list),
|
||||||
|
_basic_list_sort_cb);
|
||||||
|
|
||||||
imc = next->data;
|
i = 0;
|
||||||
|
while(imc_basic_list)
|
||||||
|
{
|
||||||
|
E_Input_Method_Config *imc;
|
||||||
|
Eet_File *imc_ef;
|
||||||
|
char *imc_path;
|
||||||
|
|
||||||
|
imc_path = imc_basic_list->data;
|
||||||
|
imc_ef = eet_open(imc_path, EET_FILE_MODE_READ);
|
||||||
|
if (imc_ef)
|
||||||
|
{
|
||||||
|
imc = e_intl_input_method_config_read(imc_ef);
|
||||||
|
eet_close(imc_ef);
|
||||||
|
|
||||||
e_widget_ilist_append(cfdata->gui.imc_basic_list, NULL, imc, NULL, NULL, imc);
|
if (imc && imc->e_im_name)
|
||||||
if (cfdata->imc_current && !strncmp(imc, cfdata->imc_current, strlen(cfdata->imc_current)))
|
{
|
||||||
e_widget_ilist_selected_set(cfdata->gui.imc_basic_list, i);
|
e_widget_ilist_append(cfdata->gui.imc_basic_list, NULL, imc->e_im_name, NULL, NULL, imc_path);
|
||||||
|
if (cfdata->imc_current && !strncmp(imc_path, cfdata->imc_current, strlen(cfdata->imc_current)))
|
||||||
i++;
|
e_widget_ilist_selected_set(cfdata->gui.imc_basic_list, i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
e_intl_input_method_config_free(imc);
|
||||||
|
}
|
||||||
|
free(imc_path);
|
||||||
|
imc_basic_list = evas_list_remove_list(imc_basic_list, imc_basic_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
e_widget_ilist_go(ob);
|
e_widget_ilist_go(ob);
|
||||||
|
@ -168,11 +260,537 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
/*** End Basic Dialog Logic ***/
|
||||||
_basic_list_sort_cb(void *d1, void *d2)
|
|
||||||
|
/*** Start Advanced Dialog Logic ***/
|
||||||
|
|
||||||
|
static Evas_Bool
|
||||||
|
_change_hash_apply_cb(Evas_Hash *hash, const char *key, void *data, void *fdata)
|
||||||
{
|
{
|
||||||
if (!d1) return 1;
|
E_Input_Method_Config *imc;
|
||||||
if (!d2) return -1;
|
Eet_File *ef;
|
||||||
|
|
||||||
return (strcmp((const char*)d1, (const char*)d2));
|
imc = data;
|
||||||
|
ef = eet_open(key, EET_FILE_MODE_WRITE);
|
||||||
|
if (ef)
|
||||||
|
{
|
||||||
|
e_intl_input_method_config_write(ef, imc);
|
||||||
|
eet_close(ef);
|
||||||
|
}
|
||||||
|
e_intl_input_method_config_free(imc);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
if (cfdata->imc_current)
|
||||||
|
{
|
||||||
|
if (e_config->input_method) evas_stringshare_del(e_config->input_method);
|
||||||
|
e_config->input_method = evas_stringshare_add(cfdata->imc_current);
|
||||||
|
e_intl_input_method_set(e_config->input_method);
|
||||||
|
}
|
||||||
|
|
||||||
|
e_config_save_queue();
|
||||||
|
|
||||||
|
if (cfdata->imc_current)
|
||||||
|
{
|
||||||
|
_e_imc_change_enqueue(cfdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cfdata->imc_change_map)
|
||||||
|
{
|
||||||
|
evas_hash_foreach(cfdata->imc_change_map, _change_hash_apply_cb, NULL);
|
||||||
|
evas_hash_free(cfdata->imc_change_map);
|
||||||
|
}
|
||||||
|
cfdata->imc_change_map = NULL;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Start Button Callbacks **/
|
||||||
|
|
||||||
|
/* Radio Toggled */
|
||||||
|
static void
|
||||||
|
_cb_dir(void *data, Evas_Object *obj)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
const char *path;
|
||||||
|
|
||||||
|
cfdata = data;
|
||||||
|
if (cfdata->fmdir == 1)
|
||||||
|
{
|
||||||
|
path = e_intl_imc_system_path_get();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path = e_intl_imc_personal_path_get();
|
||||||
|
}
|
||||||
|
e_fm2_path_set(cfdata->o_fm, path, "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Directory Navigator */
|
||||||
|
static void
|
||||||
|
_cb_button_up(void *data, void *data2)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = data;
|
||||||
|
if (cfdata->o_fm)
|
||||||
|
e_fm2_parent_go(cfdata->o_fm);
|
||||||
|
if (cfdata->o_frame)
|
||||||
|
e_widget_scrollframe_child_pos_set(cfdata->o_frame, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Entry chagned */
|
||||||
|
static void
|
||||||
|
_e_imc_entry_change_cb(void *data, Evas_Object *obj)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = data;
|
||||||
|
cfdata->imc.dirty = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Creating a new IMC */
|
||||||
|
static void
|
||||||
|
_cb_new(void *data, void *data2)
|
||||||
|
{
|
||||||
|
E_Input_Method_Config *imc_new;
|
||||||
|
Eet_File *ef;
|
||||||
|
const char *file;
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = data;
|
||||||
|
imc_new = E_NEW(E_Input_Method_Config, 1);
|
||||||
|
imc_new->version = E_INTL_INPUT_METHOD_CONFIG_VERSION;
|
||||||
|
|
||||||
|
file = _e_imc_file_name_new_get();
|
||||||
|
|
||||||
|
if (file)
|
||||||
|
{
|
||||||
|
ef = eet_open(file, EET_FILE_MODE_WRITE);
|
||||||
|
if (ef)
|
||||||
|
{
|
||||||
|
e_intl_input_method_config_write(ef, imc_new);
|
||||||
|
eet_close(ef);
|
||||||
|
e_int_config_imc_update(cfdata->cfd, file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(imc_new);
|
||||||
|
}
|
||||||
|
/** End Button Callbacks **/
|
||||||
|
|
||||||
|
/** Start IMC FM2 Callbacks **/
|
||||||
|
static void
|
||||||
|
_cb_files_changed(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = data;
|
||||||
|
if (!cfdata->o_fm) return;
|
||||||
|
if (!e_fm2_has_parent_get(cfdata->o_fm))
|
||||||
|
{
|
||||||
|
if (cfdata->o_up_button)
|
||||||
|
e_widget_disabled_set(cfdata->o_up_button, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (cfdata->o_up_button)
|
||||||
|
e_widget_disabled_set(cfdata->o_up_button, 0);
|
||||||
|
}
|
||||||
|
if (cfdata->o_frame)
|
||||||
|
e_widget_scrollframe_child_pos_set(cfdata->o_frame, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_files_selection_change(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
Evas_List *selected;
|
||||||
|
E_Fm2_Icon_Info *ici;
|
||||||
|
const char *realpath;
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
|
cfdata = data;
|
||||||
|
if (!cfdata->o_fm) return;
|
||||||
|
selected = e_fm2_selected_list_get(cfdata->o_fm);
|
||||||
|
if (!selected) return;
|
||||||
|
|
||||||
|
if (cfdata->imc_current)
|
||||||
|
{
|
||||||
|
_e_imc_change_enqueue(cfdata);
|
||||||
|
free(cfdata->imc_current);
|
||||||
|
cfdata->imc_current = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ici = selected->data;
|
||||||
|
realpath = e_fm2_real_path_get(cfdata->o_fm);
|
||||||
|
if (!strcmp(realpath, "/"))
|
||||||
|
snprintf(buf, sizeof(buf), "/%s", ici->file);
|
||||||
|
else
|
||||||
|
snprintf(buf, sizeof(buf), "%s/%s", realpath, ici->file);
|
||||||
|
evas_list_free(selected);
|
||||||
|
if (ecore_file_is_dir(buf)) return;
|
||||||
|
cfdata->imc_current = strdup(buf);
|
||||||
|
_e_imc_form_fill(cfdata);
|
||||||
|
if (cfdata->o_frame)
|
||||||
|
e_widget_change(cfdata->o_frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_files_selected(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_files_files_changed(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
const char *buf;
|
||||||
|
const char *p;
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = data;
|
||||||
|
if (!cfdata->imc_current) return;
|
||||||
|
if (!cfdata->o_fm) return;
|
||||||
|
p = e_fm2_real_path_get(cfdata->o_fm);
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
if (strncmp(p, cfdata->imc_current, strlen(p))) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = e_intl_imc_personal_path_get();
|
||||||
|
if (!strncmp(cfdata->imc_current, buf, strlen(buf)))
|
||||||
|
p = cfdata->imc_current + strlen(buf) + 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf = e_intl_imc_system_path_get();
|
||||||
|
if (!strncmp(cfdata->imc_current, buf, strlen(buf)))
|
||||||
|
p = cfdata->imc_current + strlen(buf) + 1;
|
||||||
|
}
|
||||||
|
if (!p) return;
|
||||||
|
e_fm2_select_set(cfdata->o_fm, p, 1);
|
||||||
|
e_fm2_file_show(cfdata->o_fm, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_files_files_deleted(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
Evas_List *sel, *all, *n;
|
||||||
|
E_Fm2_Icon_Info *ici, *ic;
|
||||||
|
|
||||||
|
cfdata = data;
|
||||||
|
if (!cfdata->imc_current) return;
|
||||||
|
if (!cfdata->o_fm) return;
|
||||||
|
|
||||||
|
all = e_fm2_all_list_get(cfdata->o_fm);
|
||||||
|
if (!all) return;
|
||||||
|
sel = e_fm2_selected_list_get(cfdata->o_fm);
|
||||||
|
if (!sel) return;
|
||||||
|
|
||||||
|
ici = sel->data;
|
||||||
|
|
||||||
|
all = evas_list_find_list(all, ici);
|
||||||
|
n = evas_list_next(all);
|
||||||
|
if (!n)
|
||||||
|
{
|
||||||
|
n = evas_list_prev(all);
|
||||||
|
if (!n) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ic = n->data;
|
||||||
|
if (!ic) return;
|
||||||
|
|
||||||
|
e_fm2_select_set(cfdata->o_fm, ic->file, 1);
|
||||||
|
e_fm2_file_show(cfdata->o_fm, ic->file);
|
||||||
|
|
||||||
|
evas_list_free(n);
|
||||||
|
|
||||||
|
evas_object_smart_callback_call(cfdata->o_fm, "selection_change", cfdata);
|
||||||
|
}
|
||||||
|
/** End IMC FM2 Callbacks **/
|
||||||
|
|
||||||
|
/** Start IMC Utility Functions **/
|
||||||
|
/* When updating the selection call this to fill in the form */
|
||||||
|
static void
|
||||||
|
_e_imc_form_fill(E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
Eet_File *imc_file;
|
||||||
|
E_Input_Method_Config *imc;
|
||||||
|
int imc_free;
|
||||||
|
|
||||||
|
if (!cfdata->imc_current) return;
|
||||||
|
|
||||||
|
imc_free = 0;
|
||||||
|
imc = evas_hash_find(cfdata->imc_change_map, cfdata->imc_current);
|
||||||
|
|
||||||
|
if (!imc)
|
||||||
|
{
|
||||||
|
imc_free = 1;
|
||||||
|
imc_file = eet_open(cfdata->imc_current, EET_FILE_MODE_READ);
|
||||||
|
if (imc_file)
|
||||||
|
{
|
||||||
|
imc = e_intl_input_method_config_read(imc_file);
|
||||||
|
eet_close(imc_file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (imc)
|
||||||
|
{
|
||||||
|
e_widget_entry_text_set(cfdata->gui.e_im_name, imc->e_im_name);
|
||||||
|
e_widget_entry_text_set(cfdata->gui.e_im_exec, imc->e_im_exec);
|
||||||
|
e_widget_entry_text_set(cfdata->gui.gtk_im_module, imc->gtk_im_module);
|
||||||
|
e_widget_entry_text_set(cfdata->gui.qt_im_module, imc->qt_im_module);
|
||||||
|
e_widget_entry_text_set(cfdata->gui.xmodifiers, imc->xmodifiers);
|
||||||
|
|
||||||
|
e_widget_entry_readonly_set(cfdata->gui.e_im_name, cfdata->fmdir);
|
||||||
|
e_widget_entry_readonly_set(cfdata->gui.e_im_exec, cfdata->fmdir);
|
||||||
|
e_widget_entry_readonly_set(cfdata->gui.gtk_im_module, cfdata->fmdir);
|
||||||
|
e_widget_entry_readonly_set(cfdata->gui.qt_im_module, cfdata->fmdir);
|
||||||
|
e_widget_entry_readonly_set(cfdata->gui.xmodifiers, cfdata->fmdir);
|
||||||
|
if (imc_free) e_intl_input_method_config_free(imc);
|
||||||
|
}
|
||||||
|
cfdata->imc.dirty = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remember changes in memory until we click apply */
|
||||||
|
static void
|
||||||
|
_e_imc_change_enqueue(E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
if (cfdata->imc.dirty)
|
||||||
|
{
|
||||||
|
E_Input_Method_Config *imc_update;
|
||||||
|
E_Input_Method_Config *imc_update_old;
|
||||||
|
|
||||||
|
imc_update = E_NEW(E_Input_Method_Config, 1);
|
||||||
|
|
||||||
|
imc_update->version = E_INTL_INPUT_METHOD_CONFIG_VERSION;
|
||||||
|
|
||||||
|
/* TODO: need to only add if the string is not empty */
|
||||||
|
imc_update->e_im_name = (char *) evas_stringshare_add(cfdata->imc.e_im_name);
|
||||||
|
imc_update->e_im_exec = (char *) evas_stringshare_add(cfdata->imc.e_im_exec);
|
||||||
|
imc_update->gtk_im_module = (char *) evas_stringshare_add(cfdata->imc.gtk_im_module);
|
||||||
|
imc_update->qt_im_module = (char *) evas_stringshare_add(cfdata->imc.qt_im_module);
|
||||||
|
imc_update->xmodifiers = (char *) evas_stringshare_add(cfdata->imc.xmodifiers);
|
||||||
|
|
||||||
|
/* look for changes to this file and remove them */
|
||||||
|
imc_update_old = evas_hash_find(cfdata->imc_change_map, cfdata->imc_current);
|
||||||
|
if (imc_update_old)
|
||||||
|
{
|
||||||
|
evas_hash_del(cfdata->imc_change_map, cfdata->imc_current, NULL);
|
||||||
|
e_intl_input_method_config_free(imc_update_old);
|
||||||
|
|
||||||
|
}
|
||||||
|
cfdata->imc_change_map = evas_hash_add(cfdata->imc_change_map, cfdata->imc_current, imc_update);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get a new filename, and create the new file */
|
||||||
|
static const char*
|
||||||
|
_e_imc_file_name_new_get(void)
|
||||||
|
{
|
||||||
|
char path[4096];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 32; i++)
|
||||||
|
{
|
||||||
|
snprintf(path, sizeof(path), "%s/new_input_method-%02d.imc",
|
||||||
|
e_intl_imc_personal_path_get(), i);
|
||||||
|
if (!ecore_file_exists(path))
|
||||||
|
{
|
||||||
|
return evas_stringshare_add(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/** End IMC Utility Functions **/
|
||||||
|
|
||||||
|
/** Import Dialog **/
|
||||||
|
EAPI void
|
||||||
|
e_int_config_imc_import_done(E_Config_Dialog *dia)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = dia->cfdata;
|
||||||
|
cfdata->win_import = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_import(void *data1, void *data2)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = data1;
|
||||||
|
if (cfdata->win_import)
|
||||||
|
e_win_raise(cfdata->win_import);
|
||||||
|
else
|
||||||
|
cfdata->win_import = e_int_config_imc_import(cfdata->cfd);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
e_int_config_imc_update(E_Config_Dialog *dia, const char *file)
|
||||||
|
{
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = dia->cfdata;
|
||||||
|
cfdata->fmdir = 1;
|
||||||
|
E_FREE(cfdata->imc_current);
|
||||||
|
cfdata->imc_current = strdup(file);
|
||||||
|
e_widget_radio_toggle_set(cfdata->o_personal, 1);
|
||||||
|
|
||||||
|
if (cfdata->o_fm)
|
||||||
|
e_fm2_path_set(cfdata->o_fm, e_intl_imc_personal_path_get(), "/");
|
||||||
|
_e_imc_form_fill(cfdata);
|
||||||
|
if (cfdata->o_frame)
|
||||||
|
e_widget_change(cfdata->o_frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
|
{
|
||||||
|
Evas_Object *o, *ot, *of, *il, *ol;
|
||||||
|
const char *path;
|
||||||
|
E_Fm2_Config fmc;
|
||||||
|
E_Radio_Group *rg;
|
||||||
|
|
||||||
|
ot = e_widget_table_add(evas, 0);
|
||||||
|
ol = e_widget_table_add(evas, 0);
|
||||||
|
il = e_widget_table_add(evas, 1);
|
||||||
|
|
||||||
|
rg = e_widget_radio_group_new(&(cfdata->fmdir));
|
||||||
|
|
||||||
|
o = e_widget_radio_add(evas, _("Personal"), 0, rg);
|
||||||
|
e_widget_table_object_append(il, o, 0, 0, 1, 1, 1, 1, 0, 0);
|
||||||
|
e_widget_on_change_hook_set(o, _cb_dir, cfdata);
|
||||||
|
cfdata->o_personal = o;
|
||||||
|
|
||||||
|
o = e_widget_radio_add(evas, _("System"), 1, rg);
|
||||||
|
e_widget_table_object_append(il, o, 1, 0, 1, 1, 1, 1, 0, 0);
|
||||||
|
e_widget_on_change_hook_set(o, _cb_dir, cfdata);
|
||||||
|
cfdata->o_system = o;
|
||||||
|
|
||||||
|
e_widget_table_object_append(ol, il, 0, 0, 1, 1, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
o = e_widget_button_add(evas, _("Go up a Directory"), "widget/up_dir", _cb_button_up, cfdata, NULL);
|
||||||
|
cfdata->o_up_button = o;
|
||||||
|
e_widget_table_object_append(ol, o, 0, 1, 1, 1, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
if (cfdata->fmdir == 1)
|
||||||
|
path = e_intl_imc_system_path_get();
|
||||||
|
else
|
||||||
|
path = e_intl_imc_personal_path_get();
|
||||||
|
|
||||||
|
o = e_fm2_add(evas);
|
||||||
|
cfdata->o_fm = o;
|
||||||
|
memset(&fmc, 0, sizeof(E_Fm2_Config));
|
||||||
|
fmc.view.mode = E_FM2_VIEW_MODE_LIST;
|
||||||
|
fmc.view.open_dirs_in_place = 1;
|
||||||
|
fmc.view.selector = 1;
|
||||||
|
fmc.view.single_click = 0;
|
||||||
|
fmc.view.no_subdir_jump = 0;
|
||||||
|
fmc.view.extra_file_source = NULL;
|
||||||
|
fmc.icon.list.w = 16;
|
||||||
|
fmc.icon.list.h = 16;
|
||||||
|
fmc.icon.fixed.w = 1;
|
||||||
|
fmc.icon.fixed.h = 1;
|
||||||
|
fmc.icon.extension.show = 0;
|
||||||
|
fmc.icon.key_hint = NULL;
|
||||||
|
fmc.list.sort.no_case = 1;
|
||||||
|
fmc.list.sort.dirs.first = 0;
|
||||||
|
fmc.list.sort.dirs.last = 1;
|
||||||
|
fmc.selection.single = 1;
|
||||||
|
fmc.selection.windows_modifiers = 0;
|
||||||
|
e_fm2_config_set(o, &fmc);
|
||||||
|
e_fm2_icon_menu_flags_set(o, E_FM2_MENU_NO_SHOW_HIDDEN);
|
||||||
|
|
||||||
|
evas_object_smart_callback_add(o, "dir_changed",
|
||||||
|
_cb_files_changed, cfdata);
|
||||||
|
evas_object_smart_callback_add(o, "selection_change",
|
||||||
|
_cb_files_selection_change, cfdata);
|
||||||
|
evas_object_smart_callback_add(o, "selected",
|
||||||
|
_cb_files_selected, cfdata);
|
||||||
|
evas_object_smart_callback_add(o, "changed",
|
||||||
|
_cb_files_files_changed, cfdata);
|
||||||
|
evas_object_smart_callback_add(o, "files_deleted",
|
||||||
|
_cb_files_files_deleted, cfdata);
|
||||||
|
cfdata->o_frame = NULL;
|
||||||
|
e_fm2_path_set(o, path, "/");
|
||||||
|
|
||||||
|
of = e_widget_scrollframe_pan_add(evas, o,
|
||||||
|
e_fm2_pan_set,
|
||||||
|
e_fm2_pan_get,
|
||||||
|
e_fm2_pan_max_get,
|
||||||
|
e_fm2_pan_child_size_get);
|
||||||
|
cfdata->o_frame = of;
|
||||||
|
e_widget_min_size_set(of, 160, 160);
|
||||||
|
e_widget_table_object_append(ol, of, 0, 2, 1, 1, 1, 1, 1, 1);
|
||||||
|
e_widget_table_object_append(ot, ol, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
of = e_widget_list_add(evas, 0, 0);
|
||||||
|
ol = e_widget_list_add(evas, 1, 1);
|
||||||
|
|
||||||
|
o = e_widget_button_add(evas, _("New"), "enlightenment/new", _cb_new, cfdata, NULL);
|
||||||
|
e_widget_list_object_append(ol, o, 1, 0, 0.5);
|
||||||
|
o = e_widget_button_add(evas, _("Import..."), "enlightenment/import", _cb_import, cfdata, NULL);
|
||||||
|
e_widget_list_object_append(ol, o, 1, 0, 0.5);
|
||||||
|
e_widget_list_object_append(of, ol, 1, 0, 0.0);
|
||||||
|
|
||||||
|
ol = e_widget_frametable_add(evas, _("Input Method Parameters"), 1);
|
||||||
|
|
||||||
|
o = e_widget_label_add(evas, _("Name"));
|
||||||
|
e_widget_frametable_object_append(ol, o, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||||
|
o = e_widget_entry_add(evas, &(cfdata->imc.e_im_name));
|
||||||
|
e_widget_on_change_hook_set(o, _e_imc_entry_change_cb, cfdata);
|
||||||
|
cfdata->gui.e_im_name = o;
|
||||||
|
e_widget_frametable_object_append(ol, o, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
o = e_widget_label_add(evas, _("Execute Command"));
|
||||||
|
e_widget_frametable_object_append(ol, o, 0, 1, 1, 1, 1, 1, 1, 1);
|
||||||
|
o = e_widget_entry_add(evas, &(cfdata->imc.e_im_exec));
|
||||||
|
e_widget_on_change_hook_set(o, _e_imc_entry_change_cb, cfdata);
|
||||||
|
cfdata->gui.e_im_exec = o;
|
||||||
|
e_widget_frametable_object_append(ol, o, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
e_widget_list_object_append(of, ol, 0, 1, 0.5);
|
||||||
|
|
||||||
|
ol = e_widget_frametable_add(evas, _("Exported Environment Variables"), 1);
|
||||||
|
|
||||||
|
o = e_widget_label_add(evas, _("GTK_IM_MODULE"));
|
||||||
|
e_widget_frametable_object_append(ol, o, 0, 0, 1, 1, 1, 1, 1, 1);
|
||||||
|
o = e_widget_entry_add(evas, &(cfdata->imc.gtk_im_module));
|
||||||
|
e_widget_on_change_hook_set(o, _e_imc_entry_change_cb, cfdata);
|
||||||
|
cfdata->gui.gtk_im_module = o;
|
||||||
|
e_widget_frametable_object_append(ol, o, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
o = e_widget_label_add(evas, _("QT_IM_MODULE"));
|
||||||
|
e_widget_frametable_object_append(ol, o, 0, 1, 1, 1, 1, 1, 1, 1);
|
||||||
|
o = e_widget_entry_add(evas, &(cfdata->imc.qt_im_module));
|
||||||
|
e_widget_on_change_hook_set(o, _e_imc_entry_change_cb, cfdata);
|
||||||
|
cfdata->gui.qt_im_module = o;
|
||||||
|
e_widget_frametable_object_append(ol, o, 1, 1, 1, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
o = e_widget_label_add(evas, _("XMODIFIERS"));
|
||||||
|
e_widget_frametable_object_append(ol, o, 0, 2, 1, 1, 1, 1, 1, 1);
|
||||||
|
o = e_widget_entry_add(evas, &(cfdata->imc.xmodifiers));
|
||||||
|
e_widget_on_change_hook_set(o, _e_imc_entry_change_cb, cfdata);
|
||||||
|
cfdata->gui.xmodifiers = o;
|
||||||
|
e_widget_frametable_object_append(ol, o, 1, 2, 1, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
e_widget_list_object_append(of, ol, 0, 1, 0.5);
|
||||||
|
|
||||||
|
e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
e_dialog_resizable_set(cfd->dia, 1);
|
||||||
|
|
||||||
|
_e_imc_form_fill(cfdata);
|
||||||
|
|
||||||
|
return ot;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** End Advanced Dialog Logic ***/
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#define E_INT_CONFIG_IMC_H
|
#define E_INT_CONFIG_IMC_H
|
||||||
|
|
||||||
EAPI E_Config_Dialog *e_int_config_imc(E_Container *con);
|
EAPI E_Config_Dialog *e_int_config_imc(E_Container *con);
|
||||||
|
EAPI void e_int_config_imc_import_done(E_Config_Dialog *dia);
|
||||||
|
EAPI void e_int_config_imc_update(E_Config_Dialog *dia, const char *file);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,376 @@
|
||||||
|
#include "e.h"
|
||||||
|
|
||||||
|
typedef struct _Import Import;
|
||||||
|
|
||||||
|
struct _Import
|
||||||
|
{
|
||||||
|
E_Config_Dialog *parent;
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
Evas_Object *bg_obj;
|
||||||
|
Evas_Object *box_obj;
|
||||||
|
Evas_Object *content_obj;
|
||||||
|
Evas_Object *event_obj;
|
||||||
|
Evas_Object *fsel_obj;
|
||||||
|
|
||||||
|
Evas_Object *ok_obj;
|
||||||
|
Evas_Object *cancel_obj;
|
||||||
|
|
||||||
|
E_Win *win;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _E_Config_Dialog_Data
|
||||||
|
{
|
||||||
|
char *file;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void _imc_import_cb_delete (E_Win *win);
|
||||||
|
static void _imc_import_cb_resize (E_Win *win);
|
||||||
|
static void _imc_import_cb_wid_focus (void *data, Evas_Object *obj);
|
||||||
|
static void _imc_import_cb_selected (void *data, Evas_Object *obj);
|
||||||
|
static void _imc_import_cb_changed (void *data, Evas_Object *obj);
|
||||||
|
static void _imc_import_cb_ok (void *data, void *data2);
|
||||||
|
static void _imc_import_cb_close (void *data, void *data2);
|
||||||
|
static void _imc_import_cb_key_down (void *data, Evas *e, Evas_Object *obj,
|
||||||
|
void *event);
|
||||||
|
|
||||||
|
EAPI E_Win *
|
||||||
|
e_int_config_imc_import(E_Config_Dialog *parent)
|
||||||
|
{
|
||||||
|
Evas *evas;
|
||||||
|
E_Win *win;
|
||||||
|
Evas_Object *o, *ofm;
|
||||||
|
Import *import;
|
||||||
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
Evas_Modifier_Mask mask;
|
||||||
|
Evas_Coord w, h;
|
||||||
|
|
||||||
|
import = E_NEW(Import, 1);
|
||||||
|
if (!import) return NULL;
|
||||||
|
|
||||||
|
win = e_win_new(parent->con);
|
||||||
|
if (!win)
|
||||||
|
{
|
||||||
|
E_FREE(import);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
evas = e_win_evas_get(win);
|
||||||
|
|
||||||
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||||
|
import->cfdata = cfdata;
|
||||||
|
import->win = win;
|
||||||
|
import->parent = parent;
|
||||||
|
|
||||||
|
e_win_title_set(win, _("Select an Input Method Configuration..."));
|
||||||
|
e_win_delete_callback_set(win, _imc_import_cb_delete);
|
||||||
|
e_win_resize_callback_set(win, _imc_import_cb_resize);
|
||||||
|
e_win_dialog_set(win, 1);
|
||||||
|
e_win_name_class_set(win, "E", "_imc_import_dialog");
|
||||||
|
|
||||||
|
o = edje_object_add(evas);
|
||||||
|
import->bg_obj = o;
|
||||||
|
e_theme_edje_object_set(o, "base/imc/dialog", "e/widgets/dialog/main");
|
||||||
|
evas_object_move(o, 0, 0);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
o = e_widget_list_add(evas, 1, 1);
|
||||||
|
e_widget_on_focus_hook_set(o, _imc_import_cb_wid_focus, import);
|
||||||
|
import->box_obj = o;
|
||||||
|
edje_object_part_swallow(import->bg_obj, "e.swallow.buttons", o);
|
||||||
|
|
||||||
|
o = evas_object_rectangle_add(evas);
|
||||||
|
import->event_obj = o;
|
||||||
|
mask = 0;
|
||||||
|
evas_object_key_grab(o, "Tab", mask, ~mask, 0);
|
||||||
|
mask = evas_key_modifier_mask_get(evas, "Shift");
|
||||||
|
evas_object_key_grab(o, "Tab", mask, ~mask, 0);
|
||||||
|
mask = 0;
|
||||||
|
evas_object_key_grab(o, "Return", mask, ~mask, 0);
|
||||||
|
mask = 0;
|
||||||
|
evas_object_key_grab(o, "KP_Enter", mask, ~mask, 0);
|
||||||
|
mask = 0;
|
||||||
|
// evas_object_key_grab(o, "space", mask, ~mask, 0);
|
||||||
|
// mask = 0;
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN,
|
||||||
|
_imc_import_cb_key_down, import);
|
||||||
|
|
||||||
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
|
import->content_obj = o;
|
||||||
|
|
||||||
|
ofm = e_widget_fsel_add(evas, e_user_homedir_get(), "/",
|
||||||
|
NULL, NULL,
|
||||||
|
_imc_import_cb_selected, import,
|
||||||
|
_imc_import_cb_changed, import, 1);
|
||||||
|
import->fsel_obj = ofm;
|
||||||
|
e_widget_list_object_append(o, ofm, 1, 1, 0.5);
|
||||||
|
|
||||||
|
e_widget_min_size_get(o, &w, &h);
|
||||||
|
edje_extern_object_min_size_set(o, w, h);
|
||||||
|
edje_object_part_swallow(import->bg_obj, "e.swallow.content", o);
|
||||||
|
evas_object_show(o);
|
||||||
|
|
||||||
|
import->ok_obj = e_widget_button_add(evas, _("OK"), NULL,
|
||||||
|
_imc_import_cb_ok, win, cfdata);
|
||||||
|
e_widget_list_object_append(import->box_obj, import->ok_obj, 1, 0, 0.5);
|
||||||
|
|
||||||
|
import->cancel_obj = e_widget_button_add(evas, _("Cancel"), NULL,
|
||||||
|
_imc_import_cb_close,
|
||||||
|
win, cfdata);
|
||||||
|
e_widget_list_object_append(import->box_obj, import->cancel_obj, 1, 0, 0.5);
|
||||||
|
|
||||||
|
e_widget_disabled_set(import->ok_obj, 1);
|
||||||
|
|
||||||
|
e_win_centered_set(win, 1);
|
||||||
|
|
||||||
|
o = import->box_obj;
|
||||||
|
e_widget_min_size_get(o, &w, &h);
|
||||||
|
edje_extern_object_min_size_set(o, w, h);
|
||||||
|
edje_object_part_swallow(import->bg_obj, "e.swallow.buttons", o);
|
||||||
|
|
||||||
|
edje_object_size_min_calc(import->bg_obj, &w, &h);
|
||||||
|
evas_object_resize(import->bg_obj, w, h);
|
||||||
|
e_win_resize(win, w, h);
|
||||||
|
e_win_size_min_set(win, w, h);
|
||||||
|
e_win_size_max_set(win, 99999, 99999);
|
||||||
|
e_win_show(win);
|
||||||
|
e_win_border_icon_set(win, "enlightenment/imc");
|
||||||
|
|
||||||
|
win->data = import;
|
||||||
|
|
||||||
|
return win;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
e_int_config_imc_import_del(E_Win *win)
|
||||||
|
{
|
||||||
|
Import *import;
|
||||||
|
|
||||||
|
import = win->data;
|
||||||
|
|
||||||
|
e_object_del(E_OBJECT(import->win));
|
||||||
|
e_int_config_imc_import_done(import->parent);
|
||||||
|
|
||||||
|
E_FREE(import->cfdata->file);
|
||||||
|
E_FREE(import->cfdata);
|
||||||
|
E_FREE(import);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_imc_import_cb_delete(E_Win *win)
|
||||||
|
{
|
||||||
|
e_int_config_imc_import_del(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_imc_import_cb_resize(E_Win *win)
|
||||||
|
{
|
||||||
|
Import *import;
|
||||||
|
|
||||||
|
import = win->data;
|
||||||
|
if (!import) return;
|
||||||
|
evas_object_resize(import->bg_obj, win->w, win->h);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_imc_import_cb_wid_focus(void *data, Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Import *import;
|
||||||
|
|
||||||
|
import = data;
|
||||||
|
if (obj == import->content_obj)
|
||||||
|
e_widget_focused_object_clear(import->box_obj);
|
||||||
|
else if (import->content_obj)
|
||||||
|
e_widget_focused_object_clear(import->content_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_imc_import_cb_selected(void *data, Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Import *import;
|
||||||
|
|
||||||
|
import = data;
|
||||||
|
_imc_import_cb_ok(import->win, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_imc_import_cb_changed(void *data, Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Import *import;
|
||||||
|
const char *path;
|
||||||
|
const char *file;
|
||||||
|
|
||||||
|
import = data;
|
||||||
|
if (!import) return;
|
||||||
|
if (!import->fsel_obj) return;
|
||||||
|
|
||||||
|
path = e_widget_fsel_selection_path_get(import->fsel_obj);
|
||||||
|
E_FREE(import->cfdata->file);
|
||||||
|
if (path)
|
||||||
|
import->cfdata->file = strdup(path);
|
||||||
|
|
||||||
|
if (import->cfdata->file)
|
||||||
|
{
|
||||||
|
char *strip;
|
||||||
|
|
||||||
|
file = ecore_file_get_file(import->cfdata->file);
|
||||||
|
strip = ecore_file_strip_ext(file);
|
||||||
|
if (!strip)
|
||||||
|
{
|
||||||
|
E_FREE(import->cfdata->file);
|
||||||
|
e_widget_disabled_set(import->ok_obj, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
free(strip);
|
||||||
|
if (!e_util_glob_case_match(file, "*.imc"))
|
||||||
|
{
|
||||||
|
E_FREE(import->cfdata->file);
|
||||||
|
e_widget_disabled_set(import->ok_obj, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e_widget_disabled_set(import->ok_obj, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
e_widget_disabled_set(import->ok_obj, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_imc_import_cb_ok(void *data, void *data2)
|
||||||
|
{
|
||||||
|
Import *import;
|
||||||
|
E_Win *win;
|
||||||
|
const char *path;
|
||||||
|
const char *file;
|
||||||
|
|
||||||
|
win = data;
|
||||||
|
import = win->data;
|
||||||
|
if (!import) return;
|
||||||
|
|
||||||
|
path = e_widget_fsel_selection_path_get(import->fsel_obj);
|
||||||
|
E_FREE(import->cfdata->file);
|
||||||
|
if (path)
|
||||||
|
import->cfdata->file = strdup(path);
|
||||||
|
|
||||||
|
if (import->cfdata->file)
|
||||||
|
{
|
||||||
|
Eet_File *ef;
|
||||||
|
E_Input_Method_Config *imc;
|
||||||
|
char *strip;
|
||||||
|
|
||||||
|
file = ecore_file_get_file(import->cfdata->file);
|
||||||
|
|
||||||
|
strip = ecore_file_strip_ext(file);
|
||||||
|
if (!strip)
|
||||||
|
return;
|
||||||
|
free(strip);
|
||||||
|
|
||||||
|
if (!e_util_glob_case_match(file, "*.imc"))
|
||||||
|
return;
|
||||||
|
|
||||||
|
imc = NULL;
|
||||||
|
ef = eet_open(import->cfdata->file, EET_FILE_MODE_READ);
|
||||||
|
if (ef)
|
||||||
|
{
|
||||||
|
imc = e_intl_input_method_config_read(ef);
|
||||||
|
eet_close(ef);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!imc)
|
||||||
|
{
|
||||||
|
e_util_dialog_show(_("Input Method Config Import Error"),
|
||||||
|
_("Enlightenment was unable to import "
|
||||||
|
"the configuration.<br><br>Are "
|
||||||
|
"you sure this is really a valid "
|
||||||
|
"configuration?"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
|
e_intl_input_method_config_free(imc);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/%s", e_intl_imc_personal_path_get(), file);
|
||||||
|
|
||||||
|
if (!ecore_file_cp(import->cfdata->file, buf))
|
||||||
|
{
|
||||||
|
e_util_dialog_show(_("Input Method Config Import Error"),
|
||||||
|
_("Enlightenment was unable to import "
|
||||||
|
"the configuration<br>due to a copy "
|
||||||
|
"error."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
e_int_config_imc_update(import->parent, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
e_int_config_imc_import_del(import->win);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_imc_import_cb_close(void *data, void *data2)
|
||||||
|
{
|
||||||
|
E_Win *win;
|
||||||
|
|
||||||
|
win = data;
|
||||||
|
e_int_config_imc_import_del(win);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_imc_import_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event)
|
||||||
|
{
|
||||||
|
Evas_Event_Key_Down *ev;
|
||||||
|
Import *import;
|
||||||
|
|
||||||
|
ev = event;
|
||||||
|
import = data;
|
||||||
|
if (!strcmp(ev->keyname, "Tab"))
|
||||||
|
{
|
||||||
|
if (evas_key_modifier_is_set(evas_key_modifier_get(e_win_evas_get(import->win)), "Shift"))
|
||||||
|
{
|
||||||
|
if (e_widget_focus_get(import->box_obj))
|
||||||
|
{
|
||||||
|
if (!e_widget_focus_jump(import->box_obj, 0))
|
||||||
|
{
|
||||||
|
e_widget_focus_set(import->content_obj, 0);
|
||||||
|
if (!e_widget_focus_get(import->content_obj))
|
||||||
|
e_widget_focus_set(import->box_obj, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!e_widget_focus_jump(import->content_obj, 0))
|
||||||
|
e_widget_focus_set(import->box_obj, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (e_widget_focus_get(import->box_obj))
|
||||||
|
{
|
||||||
|
if (!e_widget_focus_jump(import->box_obj, 1))
|
||||||
|
{
|
||||||
|
e_widget_focus_set(import->content_obj, 1);
|
||||||
|
if (!e_widget_focus_get(import->content_obj))
|
||||||
|
e_widget_focus_set(import->box_obj, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!e_widget_focus_jump(import->content_obj, 1))
|
||||||
|
e_widget_focus_set(import->box_obj, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (((!strcmp(ev->keyname, "Return")) ||
|
||||||
|
(!strcmp(ev->keyname, "KP_Enter")) ||
|
||||||
|
(!strcmp(ev->keyname, "space"))))
|
||||||
|
{
|
||||||
|
Evas_Object *o = NULL;
|
||||||
|
|
||||||
|
if ((import->content_obj) && (e_widget_focus_get(import->content_obj)))
|
||||||
|
o = e_widget_focused_object_get(import->content_obj);
|
||||||
|
else
|
||||||
|
o = e_widget_focused_object_get(import->box_obj);
|
||||||
|
if (o) e_widget_activate(o);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifdef E_TYPEDEFS
|
||||||
|
#else
|
||||||
|
#ifndef E_INT_CONFIG_IMC_IMPORT_H
|
||||||
|
#define E_INT_CONFIG_IMC_IMPORT_H
|
||||||
|
|
||||||
|
EAPI E_Win *e_int_config_imc_import(E_Config_Dialog *parent);
|
||||||
|
EAPI void e_int_config_imc_import_del(E_Win *win);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -88,12 +88,10 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
||||||
cfdata->paths_available[6].path_description = _("Modules");
|
cfdata->paths_available[6].path_description = _("Modules");
|
||||||
cfdata->paths_available[7].path = path_backgrounds;
|
cfdata->paths_available[7].path = path_backgrounds;
|
||||||
cfdata->paths_available[7].path_description = _("Backgrounds");
|
cfdata->paths_available[7].path_description = _("Backgrounds");
|
||||||
cfdata->paths_available[8].path = path_input_methods;
|
cfdata->paths_available[8].path = path_messages;
|
||||||
cfdata->paths_available[8].path_description = _("Input Methods");
|
cfdata->paths_available[8].path_description = _("Messages");
|
||||||
cfdata->paths_available[9].path = path_messages;
|
cfdata->paths_available[9].path = NULL;
|
||||||
cfdata->paths_available[9].path_description = _("Messages");
|
cfdata->paths_available[9].path_description = NULL;
|
||||||
cfdata->paths_available[10].path = NULL;
|
|
||||||
cfdata->paths_available[10].path_description = NULL;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
197
src/bin/e_intl.c
197
src/bin/e_intl.c
|
@ -17,7 +17,9 @@ static char *_e_intl_language_alias = NULL;
|
||||||
static char *_e_intl_orig_xmodifiers = 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 char *_e_intl_orig_gtk_im_module = NULL;
|
||||||
static char *_e_intl_input_method = NULL;
|
|
||||||
|
static const char *_e_intl_imc_personal_path = NULL;
|
||||||
|
static const char *_e_intl_imc_system_path = NULL;
|
||||||
|
|
||||||
static Eet_Data_Descriptor *_e_intl_input_method_config_edd = NULL;
|
static Eet_Data_Descriptor *_e_intl_input_method_config_edd = NULL;
|
||||||
|
|
||||||
|
@ -51,10 +53,7 @@ static Evas_Bool _e_intl_locale_hash_free_cb(Evas_Hash *hash, const char *key,
|
||||||
|
|
||||||
/* Input Method Configuration and Management */
|
/* Input Method Configuration and Management */
|
||||||
static int _e_intl_cb_exit(void *data, int type, void *event);
|
static int _e_intl_cb_exit(void *data, int type, void *event);
|
||||||
static Evas_List *_e_intl_imc_path_scan(E_Path *path);
|
|
||||||
static Evas_List *_e_intl_imc_dir_scan(const char *dir);
|
static Evas_List *_e_intl_imc_dir_scan(const char *dir);
|
||||||
static E_Input_Method_Config *_e_intl_imc_find(Evas_List *imc_list, char *name);
|
|
||||||
|
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
e_intl_init(void)
|
e_intl_init(void)
|
||||||
|
@ -94,6 +93,11 @@ e_intl_shutdown(void)
|
||||||
E_FREE(_e_intl_orig_gtk_im_module);
|
E_FREE(_e_intl_orig_gtk_im_module);
|
||||||
E_FREE(_e_intl_orig_qt_im_module);
|
E_FREE(_e_intl_orig_qt_im_module);
|
||||||
E_FREE(_e_intl_orig_xmodifiers);
|
E_FREE(_e_intl_orig_xmodifiers);
|
||||||
|
|
||||||
|
if (_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);
|
E_CONFIG_DD_FREE(_e_intl_input_method_config_edd);
|
||||||
|
|
||||||
|
@ -317,11 +321,9 @@ _e_intl_language_list_find(Evas_List *language_list, char *language)
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
e_intl_input_method_set(const char *method)
|
e_intl_input_method_set(const char *imc_path)
|
||||||
{
|
{
|
||||||
if (_e_intl_input_method) free(_e_intl_input_method);
|
if (!imc_path)
|
||||||
|
|
||||||
if (!method)
|
|
||||||
{
|
{
|
||||||
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("GTK_IM_MODULE", _e_intl_orig_gtk_im_module);
|
||||||
|
@ -329,16 +331,17 @@ e_intl_input_method_set(const char *method)
|
||||||
e_util_env_set("XMODIFIERS", _e_intl_orig_xmodifiers);
|
e_util_env_set("XMODIFIERS", _e_intl_orig_xmodifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method)
|
if (imc_path)
|
||||||
{
|
{
|
||||||
Evas_List *input_methods;
|
Eet_File *imc_ef;
|
||||||
E_Input_Method_Config *imc;
|
E_Input_Method_Config *imc;
|
||||||
|
|
||||||
input_methods = _e_intl_imc_path_scan(path_input_methods);
|
imc_ef = eet_open(imc_path, EET_FILE_MODE_READ);
|
||||||
_e_intl_input_method = strdup(method);
|
if (imc_ef)
|
||||||
|
{
|
||||||
imc = _e_intl_imc_find(input_methods, _e_intl_input_method);
|
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("GTK_IM_MODULE", imc->gtk_im_module);
|
||||||
|
@ -362,28 +365,10 @@ e_intl_input_method_set(const char *method)
|
||||||
"that your configuration's<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);
|
||||||
|
}
|
||||||
/* Free up the directory listing */
|
|
||||||
while (input_methods)
|
|
||||||
{
|
|
||||||
E_Input_Method_Config *imc;
|
|
||||||
|
|
||||||
imc = input_methods->data;
|
|
||||||
input_methods = evas_list_remove_list(input_methods,input_methods);
|
|
||||||
e_intl_input_method_config_free(imc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
_e_intl_input_method = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI const char *
|
|
||||||
e_intl_input_method_get(void)
|
|
||||||
{
|
|
||||||
return _e_intl_input_method;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Evas_List *
|
EAPI Evas_List *
|
||||||
|
@ -392,29 +377,66 @@ e_intl_input_method_list(void)
|
||||||
Evas_List *input_methods;
|
Evas_List *input_methods;
|
||||||
Evas_List *im_list;
|
Evas_List *im_list;
|
||||||
Evas_List *l;
|
Evas_List *l;
|
||||||
E_Input_Method_Config *imc;
|
char *imc_path;
|
||||||
|
|
||||||
im_list = NULL;
|
im_list = NULL;
|
||||||
|
|
||||||
input_methods = _e_intl_imc_path_scan(path_input_methods);
|
/* Personal Path */
|
||||||
|
input_methods = _e_intl_imc_dir_scan(e_intl_imc_personal_path_get());
|
||||||
for (l = input_methods; l; l = l->next)
|
for (l = input_methods; l; l = l->next)
|
||||||
{
|
{
|
||||||
imc = l->data;
|
imc_path = l->data;
|
||||||
im_list = evas_list_append(im_list, strdup(imc->e_im_name));
|
im_list = evas_list_append(im_list, imc_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Need to free up the directory listing */
|
|
||||||
while (input_methods)
|
while (input_methods)
|
||||||
{
|
{
|
||||||
E_Input_Method_Config *imc;
|
|
||||||
|
|
||||||
imc = input_methods->data;
|
|
||||||
input_methods = evas_list_remove_list(input_methods, input_methods);
|
input_methods = evas_list_remove_list(input_methods, input_methods);
|
||||||
e_intl_input_method_config_free(imc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* System Path */
|
||||||
|
input_methods = _e_intl_imc_dir_scan(e_intl_imc_system_path_get());
|
||||||
|
for (l = input_methods; l; l = l->next)
|
||||||
|
{
|
||||||
|
imc_path = l->data;
|
||||||
|
im_list = evas_list_append(im_list, imc_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (input_methods)
|
||||||
|
{
|
||||||
|
input_methods = evas_list_remove_list(input_methods, input_methods);
|
||||||
|
}
|
||||||
|
|
||||||
return im_list;
|
return im_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
return _e_intl_imc_personal_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
return _e_intl_imc_system_path;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the input method configuration from the file */
|
/* Get the input method configuration from the file */
|
||||||
EAPI E_Input_Method_Config *
|
EAPI E_Input_Method_Config *
|
||||||
e_intl_input_method_config_read(Eet_File *imc_file)
|
e_intl_input_method_config_read(Eet_File *imc_file)
|
||||||
|
@ -843,9 +865,9 @@ e_intl_locale_parts_combine(E_Locale_Parts *locale_parts, int mask)
|
||||||
if (!locale_parts) return NULL;
|
if (!locale_parts) return NULL;
|
||||||
|
|
||||||
if ((mask & locale_parts->mask) != mask) return NULL;
|
if ((mask & locale_parts->mask) != mask) return NULL;
|
||||||
|
|
||||||
|
|
||||||
/* Construct the clean locale string */
|
/* Construct the clean locale string */
|
||||||
|
locale_size = 0;
|
||||||
|
|
||||||
/* determine the size */
|
/* determine the size */
|
||||||
if (mask & E_INTL_LOC_LANG)
|
if (mask & E_INTL_LOC_LANG)
|
||||||
|
@ -1088,51 +1110,6 @@ _e_intl_locale_search_order_get(const char *locale)
|
||||||
e_intl_locale_parts_free(locale_parts);
|
e_intl_locale_parts_free(locale_parts);
|
||||||
return search_list;
|
return search_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_List *
|
|
||||||
_e_intl_imc_path_scan(E_Path *path)
|
|
||||||
{
|
|
||||||
|
|
||||||
Evas_List *next;
|
|
||||||
Evas_List *dir_list;
|
|
||||||
Evas_List *all_imcs;
|
|
||||||
|
|
||||||
if (!path) return NULL;
|
|
||||||
|
|
||||||
all_imcs = NULL;
|
|
||||||
dir_list = e_path_dir_list_get(path);
|
|
||||||
|
|
||||||
for (next = dir_list ; next ; next = next->next)
|
|
||||||
{
|
|
||||||
E_Path_Dir *epd;
|
|
||||||
Evas_List *dir_imcs;
|
|
||||||
|
|
||||||
epd = next->data;
|
|
||||||
|
|
||||||
dir_imcs = _e_intl_imc_dir_scan(epd->dir);
|
|
||||||
|
|
||||||
while (dir_imcs)
|
|
||||||
{
|
|
||||||
E_Input_Method_Config *imc;
|
|
||||||
|
|
||||||
imc = dir_imcs->data;
|
|
||||||
dir_imcs = evas_list_remove_list(dir_imcs, dir_imcs);
|
|
||||||
|
|
||||||
if (_e_intl_imc_find(all_imcs, imc->e_im_name))
|
|
||||||
{
|
|
||||||
e_intl_input_method_config_free(imc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
all_imcs = evas_list_append(all_imcs, imc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
e_path_dir_list_free(dir_list);
|
|
||||||
|
|
||||||
return all_imcs;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_List *
|
static Evas_List *
|
||||||
_e_intl_imc_dir_scan(const char *dir)
|
_e_intl_imc_dir_scan(const char *dir)
|
||||||
|
@ -1151,20 +1128,12 @@ _e_intl_imc_dir_scan(const char *dir)
|
||||||
{
|
{
|
||||||
while ((file = ecore_list_next(files)))
|
while ((file = ecore_list_next(files)))
|
||||||
{
|
{
|
||||||
E_Input_Method_Config *imc;
|
if (strstr(file, ".imc") != NULL)
|
||||||
Eet_File *imc_file;
|
|
||||||
char buf[PATH_MAX];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", dir, file);
|
|
||||||
imc_file = eet_open(buf, EET_FILE_MODE_READ);
|
|
||||||
if (imc_file)
|
|
||||||
{
|
{
|
||||||
imc = e_intl_input_method_config_read(imc_file);
|
char buf[PATH_MAX];
|
||||||
if (imc)
|
|
||||||
{
|
snprintf(buf, sizeof(buf), "%s/%s", dir, file);
|
||||||
imcs = evas_list_append(imcs, imc);
|
imcs = evas_list_append(imcs, strdup(buf));
|
||||||
}
|
|
||||||
eet_close(imc_file);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ecore_list_destroy(files);
|
ecore_list_destroy(files);
|
||||||
|
@ -1172,21 +1141,3 @@ _e_intl_imc_dir_scan(const char *dir)
|
||||||
return imcs;
|
return imcs;
|
||||||
}
|
}
|
||||||
|
|
||||||
static E_Input_Method_Config *
|
|
||||||
_e_intl_imc_find(Evas_List *imc_list, char *name)
|
|
||||||
{
|
|
||||||
Evas_List *l;
|
|
||||||
|
|
||||||
if (!imc_list) return NULL;
|
|
||||||
if (!name) return NULL;
|
|
||||||
|
|
||||||
for (l = imc_list; l; l = l->next)
|
|
||||||
{
|
|
||||||
E_Input_Method_Config *imc;
|
|
||||||
|
|
||||||
imc = l->data;
|
|
||||||
if (!strcmp(imc->e_im_name, name)) return imc;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
|
@ -71,6 +71,9 @@ EAPI Evas_List *e_intl_input_method_list(void);
|
||||||
EAPI E_Input_Method_Config *e_intl_input_method_config_read (Eet_File *imc_file);
|
EAPI E_Input_Method_Config *e_intl_input_method_config_read (Eet_File *imc_file);
|
||||||
EAPI int e_intl_input_method_config_write (Eet_File *imc_file, E_Input_Method_Config *imc);
|
EAPI int e_intl_input_method_config_write (Eet_File *imc_file, E_Input_Method_Config *imc);
|
||||||
EAPI void e_intl_input_method_config_free (E_Input_Method_Config *imc);
|
EAPI void e_intl_input_method_config_free (E_Input_Method_Config *imc);
|
||||||
|
EAPI const char *e_intl_imc_personal_path_get(void);
|
||||||
|
EAPI const char *e_intl_imc_system_path_get(void);
|
||||||
|
|
||||||
/* Getting locale */
|
/* Getting locale */
|
||||||
EAPI E_Locale_Parts *e_intl_locale_parts_get(const char *locale);
|
EAPI E_Locale_Parts *e_intl_locale_parts_get(const char *locale);
|
||||||
EAPI void e_intl_locale_parts_free(E_Locale_Parts *locale_parts);
|
EAPI void e_intl_locale_parts_free(E_Locale_Parts *locale_parts);
|
||||||
|
|
|
@ -895,8 +895,6 @@ break;
|
||||||
__path = path_modules; \
|
__path = path_modules; \
|
||||||
else if (!strcmp(__str, "backgrounds")) \
|
else if (!strcmp(__str, "backgrounds")) \
|
||||||
__path = path_backgrounds; \
|
__path = path_backgrounds; \
|
||||||
else if (!strcmp(__str, "input_methods")) \
|
|
||||||
__path = path_input_methods; \
|
|
||||||
else if (!strcmp(__str, "messages")) \
|
else if (!strcmp(__str, "messages")) \
|
||||||
__path = path_messages;
|
__path = path_messages;
|
||||||
|
|
||||||
|
|
|
@ -1218,17 +1218,6 @@ _e_main_path_init(void)
|
||||||
e_path_default_path_append(path_backgrounds, "~/.e/e/backgrounds");
|
e_path_default_path_append(path_backgrounds, "~/.e/e/backgrounds");
|
||||||
e_path_user_path_set(path_backgrounds, &(e_config->path_append_backgrounds));
|
e_path_user_path_set(path_backgrounds, &(e_config->path_append_backgrounds));
|
||||||
|
|
||||||
path_input_methods = e_path_new();
|
|
||||||
if (!path_input_methods)
|
|
||||||
{
|
|
||||||
e_error_message_show("Cannot allocate path for path_input_methods\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
e_path_default_path_append(path_input_methods, "~/.e/e/input_methods");
|
|
||||||
snprintf(buf, sizeof(buf), "%s/data/input_methods", e_prefix_data_get());
|
|
||||||
e_path_default_path_append(path_input_methods, buf);
|
|
||||||
e_path_user_path_set(path_input_methods, &(e_config->path_append_input_methods));
|
|
||||||
|
|
||||||
path_messages = e_path_new();
|
path_messages = e_path_new();
|
||||||
if (!path_messages)
|
if (!path_messages)
|
||||||
{
|
{
|
||||||
|
@ -1285,11 +1274,6 @@ _e_main_path_shutdown(void)
|
||||||
e_object_del(E_OBJECT(path_backgrounds));
|
e_object_del(E_OBJECT(path_backgrounds));
|
||||||
path_backgrounds = NULL;
|
path_backgrounds = NULL;
|
||||||
}
|
}
|
||||||
if (path_input_methods)
|
|
||||||
{
|
|
||||||
e_object_del(E_OBJECT(path_input_methods));
|
|
||||||
path_input_methods = NULL;
|
|
||||||
}
|
|
||||||
if (path_messages)
|
if (path_messages)
|
||||||
{
|
{
|
||||||
e_object_del(E_OBJECT(path_messages));
|
e_object_del(E_OBJECT(path_messages));
|
||||||
|
|
|
@ -11,7 +11,6 @@ EAPI E_Path *path_init = NULL;
|
||||||
EAPI E_Path *path_icons = NULL;
|
EAPI E_Path *path_icons = NULL;
|
||||||
EAPI E_Path *path_modules = NULL;
|
EAPI E_Path *path_modules = NULL;
|
||||||
EAPI E_Path *path_backgrounds = NULL;
|
EAPI E_Path *path_backgrounds = NULL;
|
||||||
EAPI E_Path *path_input_methods = NULL;
|
|
||||||
EAPI E_Path *path_messages = NULL;
|
EAPI E_Path *path_messages = NULL;
|
||||||
EAPI int restart = 0;
|
EAPI int restart = 0;
|
||||||
EAPI int good = 0;
|
EAPI int good = 0;
|
||||||
|
|
Loading…
Reference in New Issue