group actions to improve the configuration screen

This commit is contained in:
Boris Faure 2014-08-31 22:53:34 +02:00
parent 772843d568
commit bd31879114
2 changed files with 50 additions and 12 deletions

View File

@ -885,16 +885,19 @@ cb_scroll_down_line(Evas_Object *term)
static Shortcut_Action _actions[] =
{
{"group", gettext_noop("Scrolling"), NULL},
{"one_page_up", gettext_noop("Scroll one page up"), cb_scroll_up_page},
{"one_page_down", gettext_noop("Scroll one page down"), cb_scroll_down_page},
{"one_line_up", gettext_noop("Scroll one line up"), cb_scroll_up_line},
{"one_line_down", gettext_noop("Scroll one line down"), cb_scroll_down_line},
{"paste_primary", gettext_noop("Paste Primary buffer (highlight)"), cb_paste_primary},
{"paste_clipboard", gettext_noop("Paste Clipboard buffer (ctrl+c/v)"), cb_paste_clipboard},
{"group", gettext_noop("Copy/Paste"), NULL},
{"copy_primary", gettext_noop("Copy selection to Primary buffer"), cb_copy_primary},
{"copy_clipboard", gettext_noop("Copy selection to Clipboard buffer"), cb_copy_clipboard},
{"paste_primary", gettext_noop("Paste Primary buffer (highlight)"), cb_paste_primary},
{"paste_clipboard", gettext_noop("Paste Clipboard buffer (ctrl+c/v)"), cb_paste_clipboard},
{"group", gettext_noop("Splits/Tabs"), NULL},
{"term_prev", gettext_noop("Focus to the previous terminal"), cb_term_prev},
{"term_next", gettext_noop("Focus to the next terminal"), cb_term_next},
{"split_h", gettext_noop("Split horizontally (new below)"), cb_split_h},
@ -912,11 +915,13 @@ static Shortcut_Action _actions[] =
{"tab_9", gettext_noop("Switch to terminal tab 9"), cb_tab_9},
{"tab_10", gettext_noop("Switch to terminal tab 10"), cb_tab_0},
{"group", gettext_noop("Font size"), NULL},
{"increase_font_size", gettext_noop("Font size up 1"), cb_increase_font_size},
{"decrease_font_size", gettext_noop("Font size down 1"), cb_decrease_font_size},
{"big_font_size", gettext_noop("Diplay big font size"), cb_big_font_size},
{"reset_font_size", gettext_noop("Reset font size"), cb_reset_font_size},
{"group", gettext_noop("Actions"), NULL},
{"miniview", gettext_noop("Display the history miniview"), cb_miniview},
{"cmd_box", gettext_noop("Display the command box"), cb_cmd_box},

View File

@ -244,7 +244,7 @@ gl_content_get(void *data, Evas_Object *obj, const char *part EINA_UNUSED)
{
Evas_Coord min_w = 0, w = 0, min_h = 0, h = 0;
const Shortcut_Action *action = data;
Evas_Object *bx, *bt, *lbl;
Evas_Object *bx, *bt, *lbl, *sep;
Config_Keys *key;
Eina_List *l;
@ -258,7 +258,13 @@ gl_content_get(void *data, Evas_Object *obj, const char *part EINA_UNUSED)
elm_box_pack_end(bx, lbl);
evas_object_show(lbl);
evas_object_size_hint_min_get(lbl, &w, &h);
evas_object_size_hint_min_get(lbl, &w, &h);
min_w += w;
if (h > min_h) min_h = h;
sep = elm_separator_add(obj);
elm_box_pack_end(bx, sep);
evas_object_show(sep);
evas_object_size_hint_min_get(sep, &w, &h);
min_w += w;
if (h > min_h) min_h = h;
@ -297,14 +303,20 @@ gl_content_get(void *data, Evas_Object *obj, const char *part EINA_UNUSED)
char *gl_group_text_get(void *data, Evas_Object *obj EINA_UNUSED,
const char *part EINA_UNUSED)
{
Shortcut_Action *action = data;
return strdup(action->description);
}
void
options_keys(Evas_Object *opbox, Evas_Object *term)
{
Evas_Object *o, *gl, *bx;
const Shortcut_Action *action;
Elm_Genlist_Item_Class *itc;
//Elm_Object_Item *gli;
Elm_Genlist_Item_Class *itc, *itc_group;
Elm_Object_Item *git = NULL;
_config = termio_config_get(term);
@ -337,15 +349,36 @@ options_keys(Evas_Object *opbox, Evas_Object *term)
itc->func.state_get = NULL;
itc->func.del = NULL;
itc_group = elm_genlist_item_class_new();
itc_group->item_style = "group_index";
itc_group->func.text_get = gl_group_text_get;
itc_group->func.content_get = NULL;
itc_group->func.state_get = NULL;
itc_group->func.del = NULL;
action = shortcut_actions_get();
while (action->action)
{
elm_genlist_item_append(gl, itc,
(void *)action/* item data */,
NULL/* parent */,
ELM_GENLIST_ITEM_NONE,
NULL/* func */,
NULL/* func data */);
Elm_Object_Item *gli;
if (action->cb)
{
gli = elm_genlist_item_append(gl, itc,
(void *)action/* item data */,
git /* parent */,
ELM_GENLIST_ITEM_NONE,
NULL/* func */,
NULL/* func data */);
}
else
{
git = gli = elm_genlist_item_append(gl, itc_group,
(void *)action/* item data */,
NULL/* parent */,
ELM_GENLIST_ITEM_NONE,
NULL/* func */,
NULL/* func data */);
}
elm_genlist_item_select_mode_set(gli, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
action++;
}