add another tab in desklock config to allow changing keyboard layout on desklock. EXPERIMENTAL!

ticket #1538


SVN revision: 77324
This commit is contained in:
Mike Blumenkrantz 2012-10-02 14:04:04 +00:00
parent e14715ca32
commit 7aaa4e554c
4 changed files with 74 additions and 3 deletions

View File

@ -932,6 +932,7 @@ e_config_init(void)
E_CONFIG_LIST(D, T, xkb.used_options, _e_config_xkb_option_edd);
E_CONFIG_VAL(D, T, xkb.only_label, INT);
E_CONFIG_VAL(D, T, xkb.default_model, STR);
E_CONFIG_VAL(D, T, xkb.desklock_group, INT);
//E_CONFIG_VAL(D, T, xkb.cur_group, INT);
E_CONFIG_VAL(D, T, exe_always_single_instance, UCHAR);
@ -1239,6 +1240,10 @@ e_config_load(void)
COPYVAL(window_grouping);
IFCFGEND;
IFCFG(0x0156);
e_config->xkb.desklock_group = -1;
IFCFGEND;
e_config->config_version = E_CONFIG_FILE_VERSION;
_e_config_free(tcfg);
}

View File

@ -37,7 +37,7 @@ typedef struct _E_Event_Config_Icon_Theme E_Event_Config_Icon_Theme;
/* increment this whenever a new set of config values are added but the users
* config doesn't need to be wiped - simply new values need to be put in
*/
#define E_CONFIG_FILE_GENERATION 0x0155
#define E_CONFIG_FILE_GENERATION 0x0156
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH << 16) | E_CONFIG_FILE_GENERATION)
struct _E_Config
@ -386,6 +386,7 @@ struct _E_Config
int only_label;
const char *default_model;
int cur_group;
int desklock_group;
} xkb;
unsigned char exe_always_single_instance;

View File

@ -309,6 +309,10 @@ e_desklock_show(Eina_Bool suspend)
works:
if (e_config->desklock_language)
e_intl_language_set(e_config->desklock_language);
if (e_config->xkb.desklock_group != -1)
e_xkb_update(e_config->xkb.desklock_group);
total_zone_num = _e_desklock_zone_num_get();
EINA_LIST_FOREACH(managers, l, man)
{
@ -378,6 +382,9 @@ e_desklock_hide(void)
if (e_config->desklock_language)
e_intl_language_set(e_config->language);
if (e_config->xkb.desklock_group != -1)
e_xkb_update(e_config->xkb.cur_group);
_e_desklock_state = EINA_FALSE;
ev = E_NEW(E_Event_Desklock, 1);
ev->on = 0;

View File

@ -32,6 +32,9 @@ struct _E_Config_Dialog_Data
int zone;
char *custom_lock_cmd;
/* Layout */
int desklock_group;
/* Timers */
int screensaver_lock;
double idle_time;
@ -47,6 +50,7 @@ struct _E_Config_Dialog_Data
struct
{
Evas_Object *kbd_list;
Evas_Object *loginbox_slider;
Evas_Object *post_screensaver_slider;
Evas_Object *auto_lock_slider;
@ -128,6 +132,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
if (e_config->desklock_custom_desklock_cmd)
cfdata->custom_lock_cmd = strdup(e_config->desklock_custom_desklock_cmd);
cfdata->desklock_group = e_config->xkb.desklock_group;
cfdata->start_locked = e_config->desklock_start_locked;
cfdata->lock_on_suspend = e_config->desklock_on_suspend;
cfdata->auto_lock = e_config->desklock_autolock_idle;
@ -195,9 +200,19 @@ _basic_screensaver_lock_cb_changed(void *data, Evas_Object *o __UNUSED__)
e_widget_disabled_set(cfdata->gui.post_screensaver_slider, disable);
}
static void
_layout_changed(void *data)
{
E_Config_Dialog_Data *cfdata = data;
cfdata->desklock_group = e_widget_ilist_selected_get(cfdata->gui.kbd_list);
}
static Evas_Object *
_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
{
E_Config_XKB_Layout *cl;
int grp = 0;
Evas_Object *otb, *ol, *ow, *of, *ot;
Eina_List *l, *ll, *lll;
E_Zone *zone;
@ -229,6 +244,45 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
e_widget_toolbook_page_append(otb, NULL, _("Locking"), ol,
1, 0, 1, 0, 0.5, 0.0);
/* Keyboard Layout */
cfdata->gui.kbd_list = ol = e_widget_ilist_add(evas, 32 * e_scale, 32 * e_scale, NULL);
EINA_LIST_FOREACH(e_config->xkb.used_layouts, l, cl)
{
Evas_Object *icon, *end;
char buf[4096];
const char *name = cl->name;
end = edje_object_add(evas);
if (e_theme_edje_object_set(end, "base/theme/widgets",
"e/widgets/ilist/toggle_end"))
{
if (grp == cfdata->desklock_group)
edje_object_signal_emit(end, "e,state,checked", "e");
else
edje_object_signal_emit(end, "e,state,unchecked", "e");
}
else
{
evas_object_del(end);
end = NULL;
}
e_xkb_flag_file_get(buf, sizeof(buf), name);
icon = e_icon_add(evas);
if (!e_icon_file_set(icon, buf))
{
evas_object_del(icon);
icon = NULL;
}
if (cl->variant)
snprintf(buf, sizeof(buf), "%s (%s, %s)", cl->name, cl->model, cl->variant);
else
snprintf(buf, sizeof(buf), "%s (%s)", cl->name, cl->model);
e_widget_ilist_append_full(ol, icon, end, buf, _layout_changed, cfdata, NULL);
grp++;
}
e_widget_toolbook_page_append(otb, NULL, _("Keyboard Layout"), ol,
1, 1, 1, 1, 0.5, 0.0);
/* Login */
ol = e_widget_list_add(evas, 0, 0);
rg = e_widget_radio_group_new(&(cfdata->login_zone));
@ -359,8 +413,8 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
e_config->desklock_autolock_screensaver = cfdata->screensaver_lock;
e_config->desklock_autolock_idle_timeout = (cfdata->idle_time * 60);
e_config->desklock_ask_presentation = cfdata->ask_presentation;
e_config->desklock_ask_presentation_timeout =
cfdata->ask_presentation_timeout;
e_config->desklock_ask_presentation_timeout = cfdata->ask_presentation_timeout;
e_config->xkb.desklock_group = cfdata->desklock_group;
if (cfdata->bgs)
{
@ -399,6 +453,10 @@ _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda
{
Eina_List *l, *ll;
E_Config_Desklock_Background *cbg;
if (e_config->xkb.desklock_group != cfdata->desklock_group)
return 1;
if (e_config->desklock_start_locked != cfdata->start_locked)
return 1;