2006-02-09 15:24:06 -08:00
|
|
|
#include "e.h"
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
#define ACTION_LIST_ICON_W 24
|
|
|
|
#define ACTION_LIST_ICON_H 24
|
|
|
|
|
|
|
|
#define BINDING_LIST_ICON_W 16
|
|
|
|
#define BINDING_LIST_ICON_H 16
|
|
|
|
|
2006-07-02 04:05:59 -07:00
|
|
|
#define BTN_ASSIGN_KEYBINDING_TEXT _("Choose a Key")
|
2006-03-04 16:30:28 -08:00
|
|
|
|
|
|
|
#define TEXT_ACTION _("Action")
|
|
|
|
#define TEXT_NONE_ACTION_KEY _("<None>")
|
2006-07-02 04:05:59 -07:00
|
|
|
#define TEXT_PRESS_KEY_SEQUENCE _("Please press key sequence,<br>" \
|
2006-08-30 21:16:43 -07:00
|
|
|
"or <hilight>Escape</hilight> to abort.")
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-07-16 17:03:08 -07:00
|
|
|
#define ILIST_ICON_WITH_KEYBIND "enlightenment/keys"
|
2006-02-09 15:24:06 -08:00
|
|
|
#define ILIST_ICON_WITHOUT_KEYBIND ""
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
#define AG_UNSORTED _("Unsorted")
|
|
|
|
#define AG_AN_UNKNOWN _("Unknown")
|
2006-02-22 06:35:04 -08:00
|
|
|
|
|
|
|
#define E_BINDING_CONTEXT_NUMBER 10
|
|
|
|
|
2006-02-09 15:24:06 -08:00
|
|
|
static void *_create_data(E_Config_Dialog *cfd);
|
|
|
|
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 Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas,
|
|
|
|
E_Config_Dialog_Data *cfdata);
|
|
|
|
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
/*******************************************************************************************/
|
|
|
|
static void _e_keybinding_action_ilist_cb_change(void *data, Evas_Object *obj);
|
|
|
|
static void _e_keybinding_binding_ilist_cb_change(void *data, Evas_Object *obj);
|
|
|
|
static void _e_keybinding_default_keybinding_settings(E_Config_Dialog_Data *cfdata);
|
|
|
|
|
|
|
|
static void _e_keybinding_keybind_cb_del_keybinding(void *data, void *data2);
|
2006-05-22 13:28:33 -07:00
|
|
|
//static void _e_keybinding_keybind_delete_keybinding(E_Config_Dialog_Data *cfdata);
|
2006-03-04 16:30:28 -08:00
|
|
|
|
|
|
|
static void _e_keybinding_keybind_cb_add_keybinding(void *data, void *data2);
|
|
|
|
|
|
|
|
static void _e_keybinding_keybind_cb_new_shortcut(void *data, void *data2);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
static void _e_keybinding_update_binding_list(E_Config_Dialog_Data *cfdata);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
static void _e_keybinding_update_keybinding_button(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _e_keybinding_update_add_delete_buttons(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _e_keybinding_update_context_radios(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _e_keybinding_update_action_param_entries(E_Config_Dialog_Data *cfdata);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
static void _e_keybinding_update_binding_ilist_cur_selection_icon(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _e_keybinding_update_action_ilist_cur_selection_icon(E_Config_Dialog_Data *cfdata);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
static char *_e_keybinding_get_keybinding_text(E_Config_Binding_Key *bk);
|
|
|
|
|
|
|
|
static int _e_keybinding_cb_shortcut_key_down(void *data, int type, void *event);
|
|
|
|
static int _e_keybinding_cb_mouse_handler_dumb(void *data, int type, void *event);
|
|
|
|
|
|
|
|
static int _e_keybinding_keybind_cb_auto_apply(E_Config_Dialog_Data *cfdata);
|
|
|
|
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
static void _fill_data(E_Config_Dialog_Data *cfdata);
|
|
|
|
static int _action_group_list_sort_cb(void *e1, void *e2);
|
|
|
|
static int _action_group_actions_list_sort_cb(void *e1, void *e2);
|
|
|
|
/*******************************************************************************************/
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
typedef struct _action2
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-06-16 02:37:32 -07:00
|
|
|
const char *action_name;
|
|
|
|
const char *action_cmd;
|
|
|
|
const char *action_params;
|
|
|
|
int def_action;
|
|
|
|
int restrictions;
|
|
|
|
Evas_List *key_bindings;
|
2006-05-06 02:35:05 -07:00
|
|
|
} ACTION2;
|
2006-02-22 06:35:04 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
typedef struct _action_group
|
2006-02-22 06:35:04 -08:00
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
const char *action_group;
|
|
|
|
Evas_List *actions; // Here ACTION2 structure is used.
|
|
|
|
} ACTION_GROUP;
|
2006-02-22 06:35:04 -08:00
|
|
|
|
|
|
|
struct _E_Config_Dialog_Data
|
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
E_Config_Dialog *cfd;
|
2006-02-22 06:35:04 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
ACTION2 *current_act;
|
|
|
|
int current_act_selector;
|
|
|
|
|
2006-02-22 06:35:04 -08:00
|
|
|
Evas *evas;
|
|
|
|
|
|
|
|
int binding_context;
|
|
|
|
char *key_action;
|
|
|
|
char *key_params;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
Evas_Object *action_ilist;
|
|
|
|
Evas_Object *binding_ilist;
|
2006-02-22 06:35:04 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
Evas_Object *btn_add;
|
|
|
|
Evas_Object *btn_del;
|
|
|
|
Evas_Object *btn_keybind;
|
|
|
|
|
2006-02-22 06:35:04 -08:00
|
|
|
Evas_Object *bind_context[E_BINDING_CONTEXT_NUMBER];
|
|
|
|
Evas_Object *key_action;
|
|
|
|
Evas_Object *key_params;
|
2006-05-22 13:28:33 -07:00
|
|
|
|
|
|
|
E_Dialog *confirm_dialog;
|
2006-02-22 06:35:04 -08:00
|
|
|
} gui;
|
2006-03-04 16:30:28 -08:00
|
|
|
|
|
|
|
struct {
|
|
|
|
Ecore_X_Window keybind_win;
|
|
|
|
Evas_List *handlers;
|
|
|
|
E_Dialog *dia;
|
|
|
|
}locals;
|
|
|
|
|
|
|
|
int changed;
|
2006-02-22 06:35:04 -08:00
|
|
|
};
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
/*******************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
Evas_List *action_group_list=NULL;
|
|
|
|
|
|
|
|
int e_int_config_keybindings_register_action_predef_name(const char *action_group,
|
|
|
|
const char *action_name,
|
|
|
|
const char *action_cmd,
|
|
|
|
const char *action_params,
|
2006-06-16 02:37:32 -07:00
|
|
|
E_Keybindings_Restrict restrictions,
|
2006-05-06 02:35:05 -07:00
|
|
|
int flag)
|
|
|
|
{
|
|
|
|
ACTION_GROUP *actg = NULL;
|
|
|
|
ACTION2 *act = NULL;
|
|
|
|
Evas_List *ll;
|
|
|
|
|
|
|
|
if (!action_group || !action_name)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
for (ll = action_group_list; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
actg = ll->data;
|
|
|
|
|
|
|
|
if (!strcmp(actg->action_group, action_group))
|
|
|
|
break;
|
|
|
|
actg = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (actg == NULL)
|
|
|
|
{
|
|
|
|
actg = E_NEW(ACTION_GROUP, 1);
|
|
|
|
if (!actg)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
actg->action_group = evas_stringshare_add(action_group);
|
|
|
|
actg->actions = NULL;
|
|
|
|
|
|
|
|
action_group_list = evas_list_append(action_group_list, actg);
|
|
|
|
|
|
|
|
action_group_list = evas_list_sort(action_group_list, evas_list_count(action_group_list),
|
|
|
|
_action_group_list_sort_cb);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (ll = actg->actions; ll; ll = ll->next)
|
|
|
|
{
|
|
|
|
act = ll->data;
|
|
|
|
if (!strcmp(act->action_name, action_name))
|
|
|
|
break;
|
|
|
|
act = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (act)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
|
|
act = E_NEW(ACTION2, 1);
|
|
|
|
if (!act)
|
|
|
|
return 0;
|
2006-06-16 02:37:32 -07:00
|
|
|
|
|
|
|
act->action_name = evas_stringshare_add(action_name);
|
2006-05-06 02:35:05 -07:00
|
|
|
act->action_cmd = action_cmd == NULL ? NULL : evas_stringshare_add(action_cmd);
|
|
|
|
act->action_params = action_params == NULL ? NULL : evas_stringshare_add(action_params);
|
|
|
|
act->restrictions = restrictions;
|
|
|
|
act->def_action = flag;
|
|
|
|
act->key_bindings = NULL;
|
|
|
|
|
|
|
|
actg->actions = evas_list_append(actg->actions, act);
|
|
|
|
#if 0
|
|
|
|
actg->actions = evas_list_sort(actg->actions, evas_list_count(actg->actions),
|
|
|
|
_action_group_actions_list_sort_cb);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int e_int_config_keybindings_unregister_action_predef_name(const char *action_group,
|
|
|
|
const char *action_name)
|
|
|
|
{
|
|
|
|
ACTION_GROUP *actg;
|
|
|
|
ACTION2 *act;
|
2006-05-31 11:58:26 -07:00
|
|
|
Evas_List *l, *l2;
|
2006-05-06 02:35:05 -07:00
|
|
|
|
|
|
|
for (l = action_group_list; l; l = l->next)
|
|
|
|
{
|
|
|
|
actg = l->data;
|
|
|
|
if (!strcmp(actg->action_group, action_group))
|
|
|
|
{
|
|
|
|
for (l2 = actg->actions; l2; l2 = l2->next)
|
|
|
|
{
|
|
|
|
act = l2->data;
|
|
|
|
if (!strcmp(act->action_name, action_name))
|
|
|
|
{
|
2006-05-08 13:24:18 -07:00
|
|
|
actg->actions = evas_list_remove_list(actg->actions, l2);
|
2006-05-06 02:35:05 -07:00
|
|
|
|
|
|
|
if (act->action_name) evas_stringshare_del(act->action_name);
|
|
|
|
if (act->action_cmd) evas_stringshare_del(act->action_cmd);
|
|
|
|
if (act->action_params) evas_stringshare_del(act->action_params);
|
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
while (act->key_bindings)
|
2006-05-06 02:35:05 -07:00
|
|
|
{
|
2006-05-08 13:24:18 -07:00
|
|
|
E_Config_Binding_Key *eb = act->key_bindings->data;
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->key) evas_stringshare_del(eb->key);
|
|
|
|
if (eb->action) evas_stringshare_del(eb->action);
|
|
|
|
if (eb->params) evas_stringshare_del(eb->params);
|
|
|
|
E_FREE(eb);
|
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
act->key_bindings = evas_list_remove_list(act->key_bindings,
|
|
|
|
act->key_bindings);
|
|
|
|
|
|
|
|
}
|
2006-05-06 02:35:05 -07:00
|
|
|
E_FREE(act);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (evas_list_count(actg->actions) == 0)
|
|
|
|
{
|
2006-05-08 13:24:18 -07:00
|
|
|
action_group_list = evas_list_remove_list(action_group_list, l);
|
2006-05-06 02:35:05 -07:00
|
|
|
if (actg->action_group) evas_stringshare_del(actg->action_group);
|
|
|
|
E_FREE(actg);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void e_int_config_keybindings_unregister_all_action_predef_names()
|
|
|
|
{
|
|
|
|
ACTION_GROUP *actg;
|
|
|
|
ACTION2 *act;
|
|
|
|
|
|
|
|
while (action_group_list)
|
|
|
|
{
|
|
|
|
actg = action_group_list->data;
|
|
|
|
|
|
|
|
while (actg->actions)
|
|
|
|
{
|
|
|
|
act = actg->actions->data;
|
|
|
|
|
|
|
|
if (act->action_name) evas_stringshare_del(act->action_name);
|
|
|
|
if (act->action_cmd) evas_stringshare_del(act->action_cmd);
|
|
|
|
if (act->action_params) evas_stringshare_del(act->action_params);
|
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
while (act->key_bindings)
|
|
|
|
{
|
|
|
|
E_Config_Binding_Key *eb = act->key_bindings->data;
|
|
|
|
if (eb->key) evas_stringshare_del(eb->key);
|
|
|
|
if (eb->action) evas_stringshare_del(eb->action);
|
|
|
|
if (eb->params) evas_stringshare_del(eb->params);
|
|
|
|
E_FREE(eb);
|
|
|
|
|
|
|
|
act->key_bindings = evas_list_remove_list(act->key_bindings,
|
|
|
|
act->key_bindings);
|
|
|
|
}
|
|
|
|
/*for (l3 = act->key_bindings; l3; l3 = l3->next)
|
2006-05-06 02:35:05 -07:00
|
|
|
{
|
|
|
|
E_Config_Binding_Key *eb = l3->data;
|
|
|
|
if (eb->key) evas_stringshare_del(eb->key);
|
|
|
|
if (eb->action) evas_stringshare_del(eb->action);
|
|
|
|
if (eb->params) evas_stringshare_del(eb->params);
|
|
|
|
E_FREE(eb);
|
2006-05-08 13:24:18 -07:00
|
|
|
}*/
|
2006-05-06 02:35:05 -07:00
|
|
|
|
|
|
|
E_FREE(act);
|
|
|
|
|
|
|
|
actg->actions = evas_list_remove_list(actg->actions, actg->actions);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (actg->action_group) evas_stringshare_del(actg->action_group);
|
|
|
|
E_FREE(actg);
|
|
|
|
|
|
|
|
action_group_list = evas_list_remove_list(action_group_list, action_group_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
action_group_list = NULL;
|
|
|
|
}
|
|
|
|
/*******************************************************************************/
|
|
|
|
|
2006-02-22 06:35:04 -08:00
|
|
|
|
|
|
|
EAPI E_Config_Dialog *
|
|
|
|
e_int_config_keybindings(E_Container *con)
|
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
E_Config_Dialog_View *v;
|
|
|
|
|
|
|
|
v = E_NEW(E_Config_Dialog_View, 1);
|
|
|
|
|
|
|
|
v->create_cfdata = _create_data;
|
|
|
|
v->free_cfdata = _free_data;
|
|
|
|
v->basic.apply_cfdata = _basic_apply_data;
|
|
|
|
v->basic.create_widgets = _basic_create_widgets;
|
2006-05-27 10:09:08 -07:00
|
|
|
v->override_auto_apply = 1;
|
2006-02-22 06:35:04 -08:00
|
|
|
|
2006-08-14 08:22:46 -07:00
|
|
|
cfd = e_config_dialog_new(con,
|
|
|
|
_("Key Binding Settings"),
|
|
|
|
"E", "_config_keybindings_dialog",
|
|
|
|
"enlightenment/keys", 0, v, NULL);
|
2006-02-22 06:35:04 -08:00
|
|
|
return cfd;
|
|
|
|
}
|
|
|
|
|
2006-02-09 15:24:06 -08:00
|
|
|
static void
|
2006-05-06 02:35:05 -07:00
|
|
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
E_Config_Binding_Key *eb, *t;
|
|
|
|
Evas_List *l, *l2, *l3;
|
|
|
|
ACTION_GROUP *actg;
|
|
|
|
ACTION2 *act;
|
|
|
|
|
|
|
|
e_int_config_keybindings_register_action_predef_name(AG_UNSORTED, AG_AN_UNKNOWN,
|
|
|
|
NULL, NULL,
|
|
|
|
EDIT_RESTRICT_NONE, 1);
|
|
|
|
|
|
|
|
for (l = e_config->key_bindings; l; l = l->next)
|
|
|
|
{
|
|
|
|
int found;
|
|
|
|
t = l->data;
|
|
|
|
|
|
|
|
found = 0;
|
|
|
|
for (l2 = action_group_list; l2 && !found; l2 = l2->next)
|
|
|
|
{
|
|
|
|
actg = l2->data;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
/* here we are looking for actions with params */
|
|
|
|
for (l3 = actg->actions; l3 && !found; l3 = l3->next)
|
|
|
|
{
|
|
|
|
act = l3->data;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-31 11:58:26 -07:00
|
|
|
if (((!act->action_cmd || !act->action_cmd[0]) && (t->action && t->action[0])) ||
|
|
|
|
((!t->action || !t->action[0]) && (act->action_cmd && act->action_cmd[0])))
|
2006-05-06 02:35:05 -07:00
|
|
|
continue;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (t->params && t->params[0]) // here we have that action has params
|
|
|
|
{
|
|
|
|
if (!act->action_params || !act->action_params[0])
|
|
|
|
continue;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (strcmp(!act->action_cmd ? "" : act->action_cmd,
|
|
|
|
!t->action ? "" : t->action) == 0 &&
|
|
|
|
strcmp(act->action_params, t->params) == 0)
|
|
|
|
{
|
|
|
|
eb = E_NEW(E_Config_Binding_Key, 1);
|
|
|
|
if (!eb) continue;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
eb->context = t->context;
|
|
|
|
eb->modifiers = t->modifiers;
|
|
|
|
eb->key = (!t->key) ? evas_stringshare_add("") :
|
|
|
|
evas_stringshare_add(t->key);
|
|
|
|
eb->action = (!t->action) ? NULL : evas_stringshare_add(t->action);
|
|
|
|
eb->params = (!t->params) ? NULL : evas_stringshare_add(t->params);
|
|
|
|
eb->any_mod = t->any_mod;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
act->key_bindings = evas_list_append(act->key_bindings, eb);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
found = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* here we are looking for actions without parmas and for unsorted actions */
|
|
|
|
for (l3 = actg->actions; l3 && !found; l3 = l3->next)
|
|
|
|
{
|
|
|
|
act = l3->data;
|
|
|
|
|
|
|
|
if (act->action_params && act->action_params[0])
|
2006-02-09 15:24:06 -08:00
|
|
|
continue;
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!strcmp(actg->action_group, AG_UNSORTED) &&
|
|
|
|
!strcmp(act->action_name, AG_AN_UNKNOWN))
|
|
|
|
{
|
|
|
|
eb = E_NEW(E_Config_Binding_Key, 1);
|
|
|
|
if (!eb) continue;
|
|
|
|
|
|
|
|
eb->context = t->context;
|
|
|
|
eb->modifiers = t->modifiers;
|
|
|
|
eb->key = t->key == NULL ? evas_stringshare_add("") :
|
|
|
|
evas_stringshare_add(t->key);
|
|
|
|
eb->action = t->action == NULL ? NULL : evas_stringshare_add(t->action);
|
|
|
|
eb->params = t->params == NULL ? NULL : evas_stringshare_add(t->params);
|
|
|
|
eb->any_mod = t->any_mod;
|
|
|
|
|
|
|
|
act->key_bindings = evas_list_append(act->key_bindings, eb);
|
|
|
|
found = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-05-31 11:58:26 -07:00
|
|
|
if (((!act->action_cmd || !act->action_cmd[0]) && (t->action && t->action[0])) ||
|
|
|
|
((!t->action || !t->action[0]) && (act->action_cmd && act->action_cmd[0])))
|
2006-05-06 02:35:05 -07:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if (strcmp(!act->action_cmd ? "" : act->action_cmd,
|
|
|
|
!t->action ? "" : t->action) == 0)
|
|
|
|
{
|
|
|
|
eb = E_NEW(E_Config_Binding_Key, 1);
|
|
|
|
if (!eb) continue;
|
|
|
|
|
|
|
|
eb->context = t->context;
|
|
|
|
eb->modifiers = t->modifiers;
|
|
|
|
eb->key = (!t->key) ? evas_stringshare_add("") :
|
|
|
|
evas_stringshare_add(t->key);
|
|
|
|
eb->action = (!t->action) ? NULL : evas_stringshare_add(t->action);
|
|
|
|
eb->params = (!t->params) ? NULL : evas_stringshare_add(t->params);
|
|
|
|
eb->any_mod = t->any_mod;
|
|
|
|
|
|
|
|
act->key_bindings = evas_list_append(act->key_bindings, eb);
|
|
|
|
|
|
|
|
found = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-06-16 02:37:32 -07:00
|
|
|
cfdata->locals.keybind_win = 0;
|
|
|
|
cfdata->locals.handlers = NULL;
|
|
|
|
cfdata->locals.dia = NULL;
|
|
|
|
cfdata->changed = 0;
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
static void *
|
|
|
|
_create_data(E_Config_Dialog *cfd)
|
|
|
|
{
|
2006-06-16 02:37:32 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
|
|
|
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
|
|
|
|
|
|
|
cfdata->binding_context = -1;//E_BINDING_CONTEXT_ANY;
|
|
|
|
cfdata->key_action = strdup("");
|
|
|
|
cfdata->key_params = strdup("");
|
|
|
|
|
|
|
|
_fill_data(cfdata);
|
|
|
|
cfdata->cfd = cfd;
|
|
|
|
|
|
|
|
return cfdata;
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
Evas_List *l, *l2;
|
|
|
|
E_FREE(cfdata->key_action);
|
|
|
|
E_FREE(cfdata->key_params);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
for (l = action_group_list; l; l = l->next)
|
|
|
|
{
|
|
|
|
ACTION_GROUP *actg = l->data;
|
|
|
|
for (l2 = actg->actions; l2; l2 = l2->next)
|
|
|
|
{
|
|
|
|
ACTION2 *act = l2->data;
|
|
|
|
while (act->key_bindings)
|
|
|
|
{
|
|
|
|
E_Config_Binding_Key *eb = act->key_bindings->data;
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb)
|
|
|
|
{
|
|
|
|
if (eb->key) evas_stringshare_del(eb->key);
|
|
|
|
if (eb->action) evas_stringshare_del(eb->action);
|
|
|
|
if (eb->params) evas_stringshare_del(eb->params);
|
|
|
|
E_FREE(eb);
|
|
|
|
}
|
|
|
|
act->key_bindings = evas_list_remove_list(act->key_bindings, act->key_bindings);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(cfdata);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
Evas_List *l, *l2, *l3;
|
|
|
|
if (!cfdata) return 0;
|
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
if (cfdata->current_act)
|
2006-05-06 02:35:05 -07:00
|
|
|
if (_e_keybinding_keybind_cb_auto_apply(cfdata) != 1)
|
|
|
|
{
|
|
|
|
//TODO: message box which should ask if we really should proceed.
|
|
|
|
//If yes, then the current 'empty' binding will be deleted
|
|
|
|
//_keybind_delete_keybinding(cfdata);
|
|
|
|
}
|
|
|
|
|
|
|
|
e_managers_keys_ungrab();
|
|
|
|
while(e_config->key_bindings)
|
|
|
|
{
|
|
|
|
E_Config_Binding_Key *eb;
|
2006-02-26 08:48:16 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
eb = e_config->key_bindings->data;
|
|
|
|
e_bindings_key_del(eb->context, eb->key, eb->modifiers, eb->any_mod,
|
|
|
|
eb->action, eb->params);
|
|
|
|
e_config->key_bindings = evas_list_remove_list(e_config->key_bindings,
|
2006-02-09 15:24:06 -08:00
|
|
|
e_config->key_bindings);
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->key) evas_stringshare_del(eb->key);
|
|
|
|
if (eb->action) evas_stringshare_del(eb->action);
|
|
|
|
if (eb->params) evas_stringshare_del(eb->params);
|
|
|
|
E_FREE(eb);
|
|
|
|
}
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
for (l = action_group_list; l; l = l->next)
|
|
|
|
{
|
|
|
|
ACTION_GROUP *actg = l->data;
|
|
|
|
for (l2 = actg->actions; l2; l2 = l2->next)
|
|
|
|
{
|
|
|
|
ACTION2 *act = l2->data;
|
|
|
|
for (l3 = act->key_bindings; l3; l3 = l3->next)
|
|
|
|
{
|
|
|
|
E_Config_Binding_Key *eb, *eb2;
|
|
|
|
eb = l3->data;
|
|
|
|
if (!eb || !eb->key || !eb->key[0]) continue;
|
|
|
|
|
|
|
|
eb2 = E_NEW(E_Config_Binding_Key, 1);
|
|
|
|
if (!eb2) continue;
|
|
|
|
|
|
|
|
eb2->context = eb->context;
|
|
|
|
eb2->key = evas_stringshare_add(eb->key);
|
|
|
|
eb2->modifiers = eb->modifiers;
|
|
|
|
eb2->any_mod = eb->any_mod;
|
|
|
|
eb2->action = !eb->action || !eb->action[0] ? NULL :
|
|
|
|
evas_stringshare_add(eb->action);
|
|
|
|
eb2->params = !eb->params || !eb->params[0] ? NULL :
|
|
|
|
evas_stringshare_add(eb->params);
|
|
|
|
e_config->key_bindings = evas_list_append(e_config->key_bindings, eb2);
|
|
|
|
e_bindings_key_add(eb->context, eb->key, eb->modifiers, eb->any_mod,
|
|
|
|
eb->action, eb->params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
e_managers_keys_grab();
|
|
|
|
e_config_save_queue();
|
|
|
|
cfdata->changed = 0;
|
|
|
|
return 1;
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
static Evas_Object *
|
|
|
|
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
Evas_Object *ot;
|
|
|
|
Evas_Object *ob, *of;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
cfdata->evas = evas;
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
ot = e_widget_table_add(evas, 0);
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
of = e_widget_framelist_add(evas, _("Action"), 0);
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
cfdata->gui.action_ilist = e_widget_ilist_add(evas, ACTION_LIST_ICON_W,
|
|
|
|
ACTION_LIST_ICON_H, NULL);
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
Evas_List *l, *l2;
|
|
|
|
ACTION_GROUP *actg = NULL;
|
|
|
|
ACTION2 *act = NULL;
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_on_change_hook_set(cfdata->gui.action_ilist, _e_keybinding_action_ilist_cb_change,
|
|
|
|
cfdata);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
for (l = action_group_list; l; l = l->next)
|
|
|
|
{
|
|
|
|
//TODO:possible: do not show Unsorted:Unknow group if there are no unsorted actions.
|
|
|
|
actg = l->data;
|
|
|
|
e_widget_ilist_header_append(cfdata->gui.action_ilist, NULL, actg->action_group);
|
|
|
|
|
|
|
|
for (l2 = actg->actions; l2; l2 = l2->next)
|
|
|
|
{
|
|
|
|
Evas_Object *ic = NULL;
|
|
|
|
act = l2->data;
|
|
|
|
|
|
|
|
ic = edje_object_add(evas);
|
|
|
|
if (evas_list_count(act->key_bindings))
|
|
|
|
e_util_edje_icon_set(ic, ILIST_ICON_WITH_KEYBIND);
|
|
|
|
else
|
|
|
|
e_util_edje_icon_set(ic, ILIST_ICON_WITHOUT_KEYBIND);
|
|
|
|
|
|
|
|
e_widget_ilist_append(cfdata->gui.action_ilist, ic,
|
|
|
|
act->action_name, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
}
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_min_size_set(cfdata->gui.action_ilist, 250, 330);
|
|
|
|
e_widget_ilist_go(cfdata->gui.action_ilist);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_framelist_object_append(of, cfdata->gui.action_ilist);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
of = e_widget_framelist_add(evas, _("Key Bindings"), 0);
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
Evas_Object *ot1;
|
|
|
|
/* bindings list */
|
|
|
|
cfdata->gui.binding_ilist = e_widget_ilist_add(evas, BINDING_LIST_ICON_W,
|
|
|
|
BINDING_LIST_ICON_H, NULL);
|
|
|
|
e_widget_on_change_hook_set(cfdata->gui.binding_ilist, _e_keybinding_binding_ilist_cb_change,
|
|
|
|
cfdata);
|
2006-07-02 04:05:59 -07:00
|
|
|
e_widget_min_size_set(cfdata->gui.binding_ilist, 250, 200);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_ilist_go(cfdata->gui.binding_ilist);
|
|
|
|
e_widget_framelist_object_append(of, cfdata->gui.binding_ilist);
|
|
|
|
/****************/
|
|
|
|
|
|
|
|
ot1 = e_widget_table_add(evas, 0);
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
/* add keybinding button */
|
2006-07-02 04:05:59 -07:00
|
|
|
cfdata->gui.btn_add = e_widget_button_add(evas, _("Add Key"), NULL,
|
2006-03-04 16:30:28 -08:00
|
|
|
_e_keybinding_keybind_cb_add_keybinding, cfdata,
|
|
|
|
NULL);
|
|
|
|
e_widget_disabled_set(cfdata->gui.btn_add, 1);
|
|
|
|
e_widget_min_size_set(cfdata->gui.btn_add, 140, 28);
|
|
|
|
e_widget_table_object_append(ot1, cfdata->gui.btn_add, 0, 0, 1, 1, 1, 1, 1, 1);
|
|
|
|
/****************/
|
|
|
|
|
|
|
|
/* delete keybinding button */
|
2006-07-02 04:05:59 -07:00
|
|
|
cfdata->gui.btn_del = e_widget_button_add(evas, _("Remove Key"), NULL,
|
2006-03-04 16:30:28 -08:00
|
|
|
_e_keybinding_keybind_cb_del_keybinding, cfdata,
|
|
|
|
NULL);
|
|
|
|
e_widget_disabled_set(cfdata->gui.btn_del, 1);
|
|
|
|
e_widget_min_size_set(cfdata->gui.btn_del, 140, 28);
|
|
|
|
e_widget_table_object_append(ot1, cfdata->gui.btn_del, 1, 0, 1, 1, 1, 1, 1, 1);
|
|
|
|
/****************/
|
|
|
|
}
|
|
|
|
e_widget_framelist_object_append(of, ot1);
|
|
|
|
|
2006-07-02 04:05:59 -07:00
|
|
|
#if 0
|
2006-03-04 16:30:28 -08:00
|
|
|
/* context options */
|
|
|
|
ot1 = e_widget_frametable_add(evas, _("Binding Context"), 0);
|
|
|
|
{
|
|
|
|
rg = e_widget_radio_group_new((int *)(&(cfdata->binding_context)));
|
|
|
|
|
2006-02-09 15:24:06 -08:00
|
|
|
// first radio column
|
|
|
|
ob = e_widget_radio_add(evas, _("Any"), E_BINDING_CONTEXT_ANY, rg);
|
|
|
|
cfdata->gui.bind_context[E_BINDING_CONTEXT_ANY] = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 0, 0, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
ob = e_widget_radio_add(evas, _("Border"), E_BINDING_CONTEXT_BORDER, rg);
|
|
|
|
cfdata->gui.bind_context[E_BINDING_CONTEXT_BORDER] = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 0, 1, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
ob = e_widget_radio_add(evas, _("Zone"), E_BINDING_CONTEXT_ZONE, rg);
|
|
|
|
cfdata->gui.bind_context[E_BINDING_CONTEXT_ZONE] = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 0, 2, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
// second radio column
|
|
|
|
ob = e_widget_radio_add(evas, _("Container"), E_BINDING_CONTEXT_CONTAINER, rg);
|
|
|
|
cfdata->gui.bind_context[E_BINDING_CONTEXT_CONTAINER] = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 1, 0, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
ob = e_widget_radio_add(evas, _("Manager"), E_BINDING_CONTEXT_MANAGER, rg);
|
|
|
|
cfdata->gui.bind_context[E_BINDING_CONTEXT_MANAGER] = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 1, 1, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
ob = e_widget_radio_add(evas, _("Menu"), E_BINDING_CONTEXT_MENU, rg);
|
|
|
|
cfdata->gui.bind_context[E_BINDING_CONTEXT_MENU] = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 1, 2, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
// third radio column
|
|
|
|
ob = e_widget_radio_add(evas, _("Win List"), E_BINDING_CONTEXT_WINLIST, rg);
|
|
|
|
cfdata->gui.bind_context[E_BINDING_CONTEXT_WINLIST] = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 2, 0, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
ob = e_widget_radio_add(evas, _("Popup"), E_BINDING_CONTEXT_POPUP, rg);
|
|
|
|
cfdata->gui.bind_context[E_BINDING_CONTEXT_POPUP] = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 2, 1, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
ob = e_widget_radio_add(evas, _("None"), E_BINDING_CONTEXT_NONE, rg);
|
|
|
|
cfdata->gui.bind_context[E_BINDING_CONTEXT_NONE] = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 2, 2, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
// Fourth radio column
|
|
|
|
ob = e_widget_radio_add(evas, _("Unknown"), E_BINDING_CONTEXT_UNKNOWN, rg);
|
|
|
|
cfdata->gui.bind_context[E_BINDING_CONTEXT_UNKNOWN] = ob;
|
|
|
|
e_widget_disabled_set(ob, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 3, 0, 1, 1, 1, 1, 1, 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_framelist_object_append(of, ot1);
|
2006-07-02 04:05:59 -07:00
|
|
|
#endif
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
/* key action */
|
2006-07-02 04:05:59 -07:00
|
|
|
ot1 = e_widget_frametable_add(evas, _("Key & Action"), 0);
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-07-02 04:05:59 -07:00
|
|
|
ob = e_widget_label_add(evas, _("Binding"));
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 0, 0, 1, 1, 1, 1, 1, 1);
|
|
|
|
|
|
|
|
ob = e_widget_label_add(evas, _(":"));
|
|
|
|
e_widget_frametable_object_append(ot1, ob, 1, 0, 1, 1, 1, 1, 1, 1);
|
|
|
|
|
|
|
|
/* assign keybinding button */
|
|
|
|
cfdata->gui.btn_keybind = e_widget_button_add(evas, BTN_ASSIGN_KEYBINDING_TEXT, NULL,
|
|
|
|
_e_keybinding_keybind_cb_new_shortcut,
|
|
|
|
cfdata, NULL);
|
|
|
|
e_widget_disabled_set(cfdata->gui.btn_keybind, 1);
|
|
|
|
e_widget_min_size_set(cfdata->gui.btn_keybind, 180, 28);
|
|
|
|
e_widget_frametable_object_append(ot1, cfdata->gui.btn_keybind, 2, 0, 1, 1, 1, 1, 1, 1);
|
|
|
|
/****************/
|
|
|
|
|
|
|
|
ob = e_widget_label_add(evas, _("Action"));
|
|
|
|
e_widget_frametable_object_append(ot1, ob, 0, 1, 1, 1, 1, 1, 1, 1);
|
|
|
|
|
|
|
|
ob = e_widget_label_add(evas, _(":"));
|
|
|
|
e_widget_frametable_object_append(ot1, ob, 1, 1, 1, 1, 1, 1, 1, 1);
|
|
|
|
|
|
|
|
cfdata->gui.key_action = e_widget_entry_add(evas, &(cfdata->key_action));
|
|
|
|
e_widget_disabled_set(cfdata->gui.key_action, 1);
|
|
|
|
e_widget_min_size_set(cfdata->gui.key_action, 180, 25);
|
|
|
|
e_widget_frametable_object_append(ot1, cfdata->gui.key_action, 2, 1, 1, 1, 1, 1, 1, 1);
|
|
|
|
|
2006-07-02 04:05:59 -07:00
|
|
|
ob = e_widget_label_add(evas, _("Parameters"));
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_frametable_object_append(ot1, ob, 0, 2, 1, 1, 1, 1, 1, 1);
|
|
|
|
|
|
|
|
ob = e_widget_label_add(evas, _(":"));
|
|
|
|
e_widget_frametable_object_append(ot1, ob, 1, 2, 1, 1, 1, 1, 1, 1);
|
|
|
|
|
|
|
|
cfdata->gui.key_params = e_widget_entry_add(evas, &(cfdata->key_params));
|
|
|
|
e_widget_disabled_set(cfdata->gui.key_params, 1);
|
|
|
|
e_widget_min_size_set(cfdata->gui.key_params, 180, 25);
|
|
|
|
e_widget_frametable_object_append(ot1, cfdata->gui.key_params, 2, 2, 1, 1, 1, 1, 1, 1);
|
|
|
|
}
|
|
|
|
e_widget_framelist_object_append(of, ot1);
|
|
|
|
}
|
|
|
|
e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 1);
|
|
|
|
}
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
/*_update_keybinding_button(cfdata);
|
|
|
|
_update_add_delete_buttons(cfdata);
|
|
|
|
_update_context_radios(cfdata);
|
|
|
|
_update_action_param_entries(cfdata);*/
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
e_dialog_resizable_set(cfd->dia, 0);
|
|
|
|
return ot;
|
|
|
|
}
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
static void
|
|
|
|
_e_keybinding_binding_ilist_cb_change(void *data, Evas_Object *obj)
|
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
int indx;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!(cfdata = data)) return;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
if (cfdata->current_act)
|
2006-05-06 02:35:05 -07:00
|
|
|
if (_e_keybinding_keybind_cb_auto_apply(cfdata) != 1)
|
|
|
|
{
|
|
|
|
//TODO: message box which should ask if we really should proceed.
|
|
|
|
//If yes, then the current 'empty' binding will be deleted
|
|
|
|
//_keybind_delete_keybinding(cfdata);
|
|
|
|
}
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
if (!cfdata->current_act)
|
2006-05-06 02:35:05 -07:00
|
|
|
return;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
indx = e_widget_ilist_selected_get(cfdata->gui.binding_ilist);
|
|
|
|
if (indx < 0 || indx >= e_widget_ilist_count(cfdata->gui.binding_ilist))
|
|
|
|
return;
|
|
|
|
|
|
|
|
cfdata->current_act_selector = indx;
|
|
|
|
|
|
|
|
_e_keybinding_update_context_radios(cfdata);
|
|
|
|
_e_keybinding_update_action_param_entries(cfdata);
|
|
|
|
_e_keybinding_update_keybinding_button(cfdata);
|
|
|
|
_e_keybinding_update_add_delete_buttons(cfdata);
|
2006-03-04 16:30:28 -08:00
|
|
|
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
_e_keybinding_action_ilist_cb_change(void *data, Evas_Object *obj)
|
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
Evas_List *l, *l2;
|
|
|
|
ACTION_GROUP *actg = NULL;
|
|
|
|
ACTION2 *act = NULL;
|
|
|
|
char *label;
|
|
|
|
int done;
|
|
|
|
|
|
|
|
cfdata = data;
|
|
|
|
|
|
|
|
if (!cfdata) return;
|
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
if (cfdata->current_act)
|
2006-05-06 02:35:05 -07:00
|
|
|
if (_e_keybinding_keybind_cb_auto_apply(cfdata) != 1)
|
|
|
|
{
|
|
|
|
//TODO: message box which should ask if we really should proceed.
|
|
|
|
//If yes, then the current 'empty' binding will be deleted
|
|
|
|
//_keybind_delete_keybinding(cfdata);
|
|
|
|
}
|
|
|
|
_e_keybinding_default_keybinding_settings(cfdata);
|
|
|
|
|
|
|
|
label = strdup(e_widget_ilist_selected_label_get(obj));
|
|
|
|
|
|
|
|
done = 0;
|
|
|
|
for (l = action_group_list; l && !done; l = l->next)
|
|
|
|
{
|
|
|
|
actg = l->data;
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
for (l2 = actg->actions; l2 && !done; l2 = l2->next)
|
|
|
|
{
|
|
|
|
act = l2->data;
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!strcmp(act->action_name, label))
|
|
|
|
{
|
|
|
|
cfdata->current_act = act;
|
|
|
|
done = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
_e_keybinding_update_binding_list(cfdata);
|
|
|
|
_e_keybinding_update_add_delete_buttons(cfdata);
|
|
|
|
_e_keybinding_update_action_ilist_cur_selection_icon(cfdata);
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
#if 0
|
|
|
|
if (cfdata->changed == 0)
|
|
|
|
{
|
|
|
|
e_dialog_button_disable_num_set(cfdata->cfd->dia, 0, 1);
|
|
|
|
e_dialog_button_disable_num_set(cfdata->cfd->dia, 1, 1);
|
|
|
|
}
|
|
|
|
#endif
|
2006-03-04 16:30:28 -08:00
|
|
|
}
|
|
|
|
static void
|
|
|
|
_e_keybinding_default_keybinding_settings(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
|
|
|
if (!cfdata) return;
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
cfdata->current_act = NULL;
|
|
|
|
cfdata->current_act_selector = -1;
|
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
cfdata->binding_context = -1;
|
2006-03-04 16:30:28 -08:00
|
|
|
E_FREE(cfdata->key_action);
|
|
|
|
cfdata->key_action = strdup("");
|
|
|
|
E_FREE(cfdata->key_params);
|
|
|
|
cfdata->key_params = strdup("");
|
|
|
|
|
|
|
|
_e_keybinding_update_keybinding_button(cfdata);
|
|
|
|
_e_keybinding_update_add_delete_buttons(cfdata);
|
|
|
|
_e_keybinding_update_context_radios(cfdata);
|
|
|
|
_e_keybinding_update_action_param_entries(cfdata);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_keybinding_update_add_delete_buttons(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
|
|
|
if (!cfdata) return;
|
|
|
|
|
|
|
|
e_widget_disabled_set(cfdata->gui.btn_add, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.btn_del, 1);
|
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
if (!cfdata->current_act) return;
|
2006-03-04 16:30:28 -08:00
|
|
|
|
|
|
|
e_widget_disabled_set(cfdata->gui.btn_add, 0);
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (cfdata->current_act_selector >= 0)
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_disabled_set(cfdata->gui.btn_del, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_keybinding_update_keybinding_button(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
E_Config_Binding_Key *eb;
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!cfdata) return;
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
if (!cfdata->current_act || cfdata->current_act_selector < 0)
|
2006-05-06 02:35:05 -07:00
|
|
|
{
|
|
|
|
e_widget_disabled_set(cfdata->gui.btn_keybind, 1);
|
|
|
|
e_widget_button_label_set(cfdata->gui.btn_keybind, BTN_ASSIGN_KEYBINDING_TEXT);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eb = evas_list_nth(cfdata->current_act->key_bindings, cfdata->current_act_selector);
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.btn_keybind, 0);
|
|
|
|
if (eb && eb->key && eb->key[0])
|
|
|
|
{
|
|
|
|
char *b = _e_keybinding_get_keybinding_text(eb);
|
|
|
|
e_widget_button_label_set(cfdata->gui.btn_keybind, b);
|
|
|
|
free(b);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e_widget_button_label_set(cfdata->gui.btn_keybind, BTN_ASSIGN_KEYBINDING_TEXT);
|
|
|
|
}
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
2006-03-04 16:30:28 -08:00
|
|
|
static void
|
|
|
|
_e_keybinding_update_context_radios(E_Config_Dialog_Data *cfdata)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
E_Config_Binding_Key *eb;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!cfdata) return;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_NONE], 0);
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_UNKNOWN], 0);
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_BORDER], 0);
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_ZONE], 0);
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_CONTAINER], 0);
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_MANAGER], 0);
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_MENU], 0);
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_WINLIST], 0);
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_POPUP], 0);
|
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_ANY], 0);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_NONE], 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_UNKNOWN], 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_BORDER], 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_ZONE], 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_CONTAINER], 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_MANAGER], 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_MENU], 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_WINLIST], 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_POPUP], 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_ANY], 1);
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (cfdata->current_act_selector < 0) return;
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-02-26 07:17:37 -08:00
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_NONE], 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_UNKNOWN], 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_BORDER], 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_ZONE], 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_CONTAINER], 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_MANAGER], 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_MENU], 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_WINLIST], 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_POPUP], 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_ANY], 0);
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if ((eb = evas_list_nth(cfdata->current_act->key_bindings, cfdata->current_act_selector)) == NULL)
|
2006-02-09 15:24:06 -08:00
|
|
|
return;
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->context == E_BINDING_CONTEXT_NONE)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
|
|
|
cfdata->binding_context = E_BINDING_CONTEXT_NONE;
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_NONE], 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->context == E_BINDING_CONTEXT_UNKNOWN)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
|
|
|
cfdata->binding_context = E_BINDING_CONTEXT_UNKNOWN;
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_UNKNOWN], 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->context == E_BINDING_CONTEXT_BORDER)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
|
|
|
cfdata->binding_context = E_BINDING_CONTEXT_BORDER;
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_BORDER], 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->context == E_BINDING_CONTEXT_ZONE)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
|
|
|
cfdata->binding_context = E_BINDING_CONTEXT_ZONE;
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_ZONE], 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->context == E_BINDING_CONTEXT_CONTAINER)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
|
|
|
cfdata->binding_context = E_BINDING_CONTEXT_CONTAINER;
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_CONTAINER], 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->context == E_BINDING_CONTEXT_MANAGER)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
|
|
|
cfdata->binding_context = E_BINDING_CONTEXT_MANAGER;
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_MANAGER], 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->context == E_BINDING_CONTEXT_MENU)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
|
|
|
cfdata->binding_context = E_BINDING_CONTEXT_MENU;
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_MENU], 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->context == E_BINDING_CONTEXT_WINLIST)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
|
|
|
cfdata->binding_context = E_BINDING_CONTEXT_WINLIST;
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_WINLIST], 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->context == E_BINDING_CONTEXT_POPUP)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
|
|
|
cfdata->binding_context = E_BINDING_CONTEXT_POPUP;
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_POPUP], 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->context == E_BINDING_CONTEXT_ANY)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
|
|
|
cfdata->binding_context = E_BINDING_CONTEXT_ANY;
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_radio_toggle_set(cfdata->gui.bind_context[E_BINDING_CONTEXT_ANY], 1);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
static void
|
|
|
|
_e_keybinding_update_action_param_entries(E_Config_Dialog_Data *cfdata)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
E_Config_Binding_Key *eb;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!cfdata) return;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_entry_text_set(cfdata->gui.key_action, "");
|
|
|
|
e_widget_entry_text_set(cfdata->gui.key_params, "");
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
e_widget_disabled_set(cfdata->gui.key_action, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.key_params, 1);
|
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
if (!cfdata->current_act) return;
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!(eb = evas_list_nth(cfdata->current_act->key_bindings, cfdata->current_act_selector)))
|
2006-02-09 15:24:06 -08:00
|
|
|
return;
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (cfdata->key_action) E_FREE(cfdata->key_action);
|
|
|
|
cfdata->key_action = eb->action == NULL ? NULL : strdup(eb->action);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->action) e_widget_entry_text_set(cfdata->gui.key_action, eb->action);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (cfdata->key_params) E_FREE(cfdata->key_params);
|
|
|
|
cfdata->key_params = eb->params == NULL ? NULL : strdup(eb->params);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb->params) e_widget_entry_text_set(cfdata->gui.key_params, eb->params);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!(cfdata->current_act->restrictions & EDIT_RESTRICT_ACTION))
|
2006-02-09 15:24:06 -08:00
|
|
|
e_widget_disabled_set(cfdata->gui.key_action, 0);
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!(cfdata->current_act->restrictions & EDIT_RESTRICT_PARAMS))
|
2006-02-09 15:24:06 -08:00
|
|
|
e_widget_disabled_set(cfdata->gui.key_params, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-05-22 13:28:33 -07:00
|
|
|
_e_keybinding_cb_confirm_dialog_yes(void *data)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-05-22 13:28:33 -07:00
|
|
|
E_Config_Binding_Key *eb;
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-22 13:28:33 -07:00
|
|
|
if (!(cfdata = data))
|
|
|
|
if ((!cfdata->current_act) && (cfdata->current_act_selector < 0)) return;
|
|
|
|
|
|
|
|
eb = evas_list_nth(cfdata->current_act->key_bindings, cfdata->current_act_selector);
|
|
|
|
cfdata->current_act->key_bindings = evas_list_remove(cfdata->current_act->key_bindings, eb);
|
|
|
|
|
|
|
|
if (eb->key) evas_stringshare_del(eb->key);
|
|
|
|
if (eb->action) evas_stringshare_del(eb->action);
|
|
|
|
if (eb->params) evas_stringshare_del(eb->params);
|
|
|
|
E_FREE(eb);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-22 13:28:33 -07:00
|
|
|
if (cfdata->current_act_selector >= evas_list_count(cfdata->current_act->key_bindings))
|
|
|
|
cfdata->current_act_selector = evas_list_count(cfdata->current_act->key_bindings) - 1;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
_e_keybinding_update_binding_list(cfdata);
|
|
|
|
e_widget_ilist_go(cfdata->gui.binding_ilist);
|
2006-05-12 05:25:55 -07:00
|
|
|
e_widget_ilist_selected_set(cfdata->gui.binding_ilist, cfdata->current_act_selector);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
_e_keybinding_update_keybinding_button(cfdata);
|
|
|
|
_e_keybinding_update_add_delete_buttons(cfdata);
|
|
|
|
_e_keybinding_update_context_radios(cfdata);
|
|
|
|
_e_keybinding_update_action_param_entries(cfdata);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
// nice iface features //
|
|
|
|
_e_keybinding_update_action_ilist_cur_selection_icon(cfdata);
|
|
|
|
_e_keybinding_update_binding_ilist_cur_selection_icon(cfdata);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
//cfdata->changed = 1;
|
|
|
|
}
|
2006-05-22 13:28:33 -07:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
static void
|
2006-05-22 13:28:33 -07:00
|
|
|
_e_keybinding_keybind_cb_del_keybinding(void *data, void *data2)
|
2006-03-04 16:30:28 -08:00
|
|
|
{
|
2006-05-22 13:28:33 -07:00
|
|
|
char buf[4096];
|
|
|
|
E_Config_Dialog_Data *cfdata = data;
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!cfdata) return;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-06-03 03:19:11 -07:00
|
|
|
snprintf(buf, sizeof(buf), _("You requested to delete \"%s\" keybinding.<br>"
|
2006-05-22 13:28:33 -07:00
|
|
|
"<br>"
|
|
|
|
"Are you sure you want to delete it?"),
|
|
|
|
e_widget_ilist_selected_label_get(cfdata->gui.binding_ilist));
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-22 13:28:33 -07:00
|
|
|
e_confirm_dialog_show(_("Delete?"), "enlightenment/exit", buf, NULL, NULL,
|
|
|
|
_e_keybinding_cb_confirm_dialog_yes, NULL, cfdata, NULL);
|
2006-03-04 16:30:28 -08:00
|
|
|
|
|
|
|
}
|
2006-02-09 15:24:06 -08:00
|
|
|
static void
|
2006-03-04 16:30:28 -08:00
|
|
|
_e_keybinding_update_binding_ilist_cur_selection_icon(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2006-05-06 02:35:05 -07:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
static void
|
|
|
|
_e_keybinding_update_action_ilist_cur_selection_icon(E_Config_Dialog_Data *cfdata)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
Evas_Object *icon;
|
|
|
|
if (!cfdata || !cfdata->current_act) return;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (evas_list_count(cfdata->current_act->key_bindings) > 1)
|
|
|
|
{
|
|
|
|
icon = edje_object_add(cfdata->evas);
|
|
|
|
e_util_edje_icon_set(icon, ILIST_ICON_WITH_KEYBIND);
|
|
|
|
}
|
|
|
|
else if(evas_list_count(cfdata->current_act->key_bindings) == 1)
|
|
|
|
{
|
|
|
|
E_Config_Binding_Key *eb;
|
|
|
|
eb = evas_list_nth(cfdata->current_act->key_bindings, cfdata->current_act_selector);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (eb && eb->key && eb->key[0])
|
|
|
|
{
|
|
|
|
icon = edje_object_add(cfdata->evas);
|
|
|
|
e_util_edje_icon_set(icon, ILIST_ICON_WITH_KEYBIND);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
icon = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
icon = NULL;
|
|
|
|
e_widget_ilist_nth_icon_set(cfdata->gui.action_ilist,
|
|
|
|
e_widget_ilist_selected_get(cfdata->gui.action_ilist), icon);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
2006-05-06 02:35:05 -07:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
static char *
|
|
|
|
_e_keybinding_get_keybinding_text(E_Config_Binding_Key *bk)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
char b[256] = "";
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
if (!bk) return strdup(b);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
if (bk->modifiers & E_BINDING_MODIFIER_CTRL)
|
|
|
|
strcat(b,_("CTRL"));
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
if (bk->modifiers & E_BINDING_MODIFIER_ALT)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
if (b[0])
|
|
|
|
strcat(b," + ");
|
|
|
|
strcat(b,_("ALT"));
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
if (bk->modifiers & E_BINDING_MODIFIER_SHIFT)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
if (b[0])
|
|
|
|
strcat(b," + ");
|
|
|
|
strcat(b,_("SHIFT"));
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
if (bk->modifiers & E_BINDING_MODIFIER_WIN)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
if (b[0])
|
|
|
|
strcat(b," + ");
|
|
|
|
strcat(b,_("WIN"));
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
if (bk->key && bk->key[0])
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
if (b[0])
|
|
|
|
strcat(b," + ");
|
|
|
|
if (strlen(bk->key) == 1)
|
|
|
|
{
|
|
|
|
char *l = strdup(bk->key);
|
|
|
|
l[0] = (char)toupper(bk->key[0]);
|
|
|
|
strcat(b, l);
|
|
|
|
free(l);
|
|
|
|
}
|
2006-02-09 15:24:06 -08:00
|
|
|
else
|
2006-03-04 16:30:28 -08:00
|
|
|
strcat(b, bk->key );
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
if (!b[0])
|
|
|
|
strcpy(b, TEXT_NONE_ACTION_KEY);
|
|
|
|
return strdup(b);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-03-04 16:30:28 -08:00
|
|
|
_e_keybinding_update_binding_list(E_Config_Dialog_Data *cfdata)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
int i;
|
|
|
|
char buf[4096];
|
|
|
|
Evas_List *l;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-08 13:24:18 -07:00
|
|
|
if (!cfdata || !cfdata->current_act) return;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_ilist_clear(cfdata->gui.binding_ilist);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
for (l = cfdata->current_act->key_bindings, i = 0; l; l = l->next, i++)
|
|
|
|
{
|
|
|
|
char *b;
|
|
|
|
E_Config_Binding_Key *eb = l->data;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!eb) continue;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
b = _e_keybinding_get_keybinding_text(eb);
|
|
|
|
snprintf(buf, sizeof(buf), "%s %d : %s", TEXT_ACTION, i, b);
|
|
|
|
free(b);
|
|
|
|
e_widget_ilist_append(cfdata->gui.binding_ilist, NULL, buf, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
_e_keybinding_update_keybinding_button(cfdata);
|
|
|
|
_e_keybinding_update_add_delete_buttons(cfdata);
|
|
|
|
_e_keybinding_update_context_radios(cfdata);
|
|
|
|
_e_keybinding_update_action_param_entries(cfdata);
|
|
|
|
|
|
|
|
_e_keybinding_update_action_ilist_cur_selection_icon(cfdata);
|
|
|
|
_e_keybinding_update_binding_ilist_cur_selection_icon(cfdata);
|
2006-03-04 16:30:28 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_ilist_go(cfdata->gui.binding_ilist);
|
2006-05-12 05:25:55 -07:00
|
|
|
e_widget_ilist_selected_set(cfdata->gui.binding_ilist, cfdata->current_act_selector);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-03-04 16:30:28 -08:00
|
|
|
_e_keybinding_keybind_cb_add_keybinding(void *data, void *data2)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
E_Config_Binding_Key *eb;
|
|
|
|
E_Config_Dialog_Data *cfdata = data;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (!cfdata) return;
|
2006-05-08 13:24:18 -07:00
|
|
|
if (!cfdata->current_act) return;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
if (_e_keybinding_keybind_cb_auto_apply(cfdata) != 1)
|
|
|
|
{
|
|
|
|
//TODO: message box, that a keybinding cannot be added
|
|
|
|
//until the current is assigned.
|
|
|
|
}
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
eb = E_NEW(E_Config_Binding_Key, 1);
|
|
|
|
if (!eb) return;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
eb->context = E_BINDING_CONTEXT_ANY;
|
|
|
|
eb->key = evas_stringshare_add("");
|
|
|
|
eb->modifiers = E_BINDING_MODIFIER_NONE;
|
|
|
|
eb->action = !cfdata->current_act->action_cmd ? evas_stringshare_add("") :
|
|
|
|
evas_stringshare_add(cfdata->current_act->action_cmd);
|
|
|
|
eb->params = !cfdata->current_act->action_params ? evas_stringshare_add("") :
|
|
|
|
evas_stringshare_add(cfdata->current_act->action_params);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
cfdata->current_act->key_bindings = evas_list_append(cfdata->current_act->key_bindings, eb);
|
|
|
|
cfdata->current_act_selector = evas_list_count(cfdata->current_act->key_bindings) - 1;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
_e_keybinding_update_binding_list(cfdata);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
e_widget_ilist_selected_set(cfdata->gui.binding_ilist, cfdata->current_act_selector);
|
|
|
|
e_widget_ilist_go(cfdata->gui.binding_ilist);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
_e_keybinding_update_keybinding_button(cfdata);
|
|
|
|
_e_keybinding_update_add_delete_buttons(cfdata);
|
|
|
|
_e_keybinding_update_context_radios(cfdata);
|
|
|
|
_e_keybinding_update_action_param_entries(cfdata);
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-05-06 02:35:05 -07:00
|
|
|
// nice iface features //
|
|
|
|
_e_keybinding_update_action_ilist_cur_selection_icon(cfdata);
|
|
|
|
_e_keybinding_update_binding_ilist_cur_selection_icon(cfdata);
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
2006-05-06 02:35:05 -07:00
|
|
|
|
|
|
|
static int
|
2006-03-04 16:30:28 -08:00
|
|
|
_e_keybinding_keybind_cb_auto_apply(E_Config_Dialog_Data *cfdata)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
E_Config_Binding_Key *eb;
|
|
|
|
|
|
|
|
if (!cfdata) return 0;
|
2006-05-08 13:24:18 -07:00
|
|
|
if (!cfdata->current_act || cfdata->current_act_selector < 0) return 1;
|
2006-05-06 02:35:05 -07:00
|
|
|
|
|
|
|
eb = evas_list_nth(cfdata->current_act->key_bindings, cfdata->current_act_selector);
|
|
|
|
if (!eb) return 0;
|
|
|
|
|
|
|
|
eb->context = cfdata->binding_context;
|
|
|
|
eb->any_mod = 0;
|
|
|
|
if (eb->action) evas_stringshare_del(eb->action);
|
|
|
|
eb->action = (!cfdata->key_action || !cfdata->key_action[0]) ? NULL :
|
|
|
|
evas_stringshare_add(cfdata->key_action);
|
|
|
|
|
|
|
|
if (eb->params) evas_stringshare_del(eb->params);
|
|
|
|
eb->params = (!cfdata->key_params || !cfdata->key_params[0]) ? NULL :
|
|
|
|
evas_stringshare_add(cfdata->key_params);
|
|
|
|
return 1;
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
static void
|
|
|
|
_e_keybinding_keybind_cb_new_shortcut(void *data, void *data2)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
E_Config_Dialog_Data *cfdata = data;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
if (!cfdata || cfdata->locals.keybind_win != 0) return;
|
|
|
|
|
2006-08-14 08:22:46 -07:00
|
|
|
cfdata->locals.dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_keybind_getkey_dialog");
|
2006-03-04 16:30:28 -08:00
|
|
|
if (!cfdata->locals.dia) return;
|
|
|
|
e_dialog_title_set(cfdata->locals.dia, _("Binding Key Sequence"));
|
|
|
|
e_dialog_icon_set(cfdata->locals.dia, "enlightenment/e", 64);
|
|
|
|
e_dialog_text_set(cfdata->locals.dia, TEXT_PRESS_KEY_SEQUENCE);
|
|
|
|
e_win_centered_set(cfdata->locals.dia->win, 1);
|
2006-08-30 21:16:43 -07:00
|
|
|
e_win_borderless_set(cfdata->locals.dia->win, 1);
|
2006-03-04 16:30:28 -08:00
|
|
|
|
|
|
|
cfdata->locals.keybind_win = ecore_x_window_input_new(e_manager_current_get()->root,
|
|
|
|
0, 0, 1, 1);
|
|
|
|
ecore_x_window_show(cfdata->locals.keybind_win);
|
|
|
|
|
|
|
|
e_grabinput_get(cfdata->locals.keybind_win, 0, cfdata->locals.keybind_win);
|
|
|
|
|
|
|
|
cfdata->locals.handlers = evas_list_append(cfdata->locals.handlers,
|
|
|
|
ecore_event_handler_add(ECORE_X_EVENT_KEY_DOWN,
|
|
|
|
_e_keybinding_cb_shortcut_key_down,
|
|
|
|
cfdata));
|
|
|
|
cfdata->locals.handlers = evas_list_append(cfdata->locals.handlers,
|
|
|
|
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_DOWN,
|
|
|
|
_e_keybinding_cb_mouse_handler_dumb,
|
|
|
|
NULL));
|
|
|
|
cfdata->locals.handlers = evas_list_append(cfdata->locals.handlers,
|
|
|
|
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_BUTTON_UP,
|
|
|
|
_e_keybinding_cb_mouse_handler_dumb,
|
|
|
|
NULL));
|
|
|
|
cfdata->locals.handlers = evas_list_append(cfdata->locals.handlers,
|
|
|
|
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_WHEEL,
|
|
|
|
_e_keybinding_cb_mouse_handler_dumb, NULL));
|
|
|
|
e_dialog_show(cfdata->locals.dia);
|
|
|
|
}
|
|
|
|
static void
|
|
|
|
_e_keybinding_keybind_shortcut_wnd_hide(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
|
|
|
if (!cfdata) return;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
while (cfdata->locals.handlers)
|
2006-02-09 15:24:06 -08:00
|
|
|
{
|
2006-03-04 16:30:28 -08:00
|
|
|
ecore_event_handler_del(cfdata->locals.handlers->data);
|
|
|
|
cfdata->locals.handlers = evas_list_remove_list(cfdata->locals.handlers,
|
|
|
|
cfdata->locals.handlers);
|
|
|
|
}
|
|
|
|
cfdata->locals.handlers = NULL;
|
|
|
|
e_grabinput_release(cfdata->locals.keybind_win, cfdata->locals.keybind_win);
|
|
|
|
ecore_x_window_del(cfdata->locals.keybind_win);
|
|
|
|
cfdata->locals.keybind_win = 0;
|
2006-02-09 15:24:06 -08:00
|
|
|
|
2006-03-04 16:30:28 -08:00
|
|
|
e_object_del(E_OBJECT(cfdata->locals.dia));
|
|
|
|
cfdata->locals.dia = NULL;
|
|
|
|
}
|
|
|
|
static int
|
|
|
|
_e_keybinding_cb_shortcut_key_down(void *data, int type, void *event)
|
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
E_Config_Binding_Key *eb;
|
|
|
|
E_Config_Dialog_Data *cfdata = data;
|
|
|
|
Ecore_X_Event_Key_Down *ev = event;
|
2006-04-17 05:24:33 -07:00
|
|
|
|
|
|
|
if (ev->win != cfdata->locals.keybind_win) return 1;
|
|
|
|
|
|
|
|
if (!strcmp(ev->keyname, "Escape") &&
|
|
|
|
!(ev->modifiers & ECORE_X_MODIFIER_SHIFT) &&
|
|
|
|
!(ev->modifiers & ECORE_X_MODIFIER_CTRL) &&
|
|
|
|
!(ev->modifiers & ECORE_X_MODIFIER_ALT) &&
|
|
|
|
!(ev->modifiers & ECORE_X_MODIFIER_WIN))
|
|
|
|
{
|
|
|
|
_e_keybinding_keybind_shortcut_wnd_hide(cfdata);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
printf("'%s' '%s' '%s'\n", ev->keyname, ev->keysymbol, ev->key_compose);
|
|
|
|
if (!strcmp(ev->keyname, "Control_L") || !strcmp(ev->keyname, "Control_R") ||
|
|
|
|
!strcmp(ev->keyname, "Shift_L") || !strcmp(ev->keyname, "Shift_R") ||
|
|
|
|
!strcmp(ev->keyname, "Alt_L") || !strcmp(ev->keyname, "Alt_R") ||
|
|
|
|
!strcmp(ev->keyname, "Super_L") || !strcmp(ev->keyname, "Super_R"))
|
|
|
|
;
|
|
|
|
else
|
|
|
|
{
|
2006-05-08 13:24:18 -07:00
|
|
|
if (cfdata && cfdata->current_act && cfdata->current_act_selector >= 0)
|
2006-04-17 05:24:33 -07:00
|
|
|
{
|
2006-07-27 06:55:36 -07:00
|
|
|
ACTION_GROUP *actg;
|
|
|
|
ACTION2 *act;
|
2006-05-06 02:35:05 -07:00
|
|
|
Evas_List *l, *l2, *l3;
|
|
|
|
int found;
|
2006-04-17 05:24:33 -07:00
|
|
|
int mod = E_BINDING_MODIFIER_NONE;
|
2006-05-06 02:35:05 -07:00
|
|
|
|
2006-04-17 05:24:33 -07:00
|
|
|
if (ev->modifiers & ECORE_X_MODIFIER_SHIFT)
|
|
|
|
mod |= E_BINDING_MODIFIER_SHIFT;
|
|
|
|
if (ev->modifiers & ECORE_X_MODIFIER_CTRL)
|
|
|
|
mod |= E_BINDING_MODIFIER_CTRL;
|
|
|
|
if (ev->modifiers & ECORE_X_MODIFIER_ALT)
|
|
|
|
mod |= E_BINDING_MODIFIER_ALT;
|
|
|
|
if (ev->modifiers & ECORE_X_MODIFIER_WIN)
|
|
|
|
mod |= E_BINDING_MODIFIER_WIN;
|
2006-05-06 02:35:05 -07:00
|
|
|
|
|
|
|
found = 0;
|
|
|
|
for (l = action_group_list; l && !found; l = l->next)
|
2006-03-04 17:37:42 -08:00
|
|
|
{
|
2006-07-27 06:55:36 -07:00
|
|
|
actg = l->data;
|
2006-05-06 02:35:05 -07:00
|
|
|
for (l2 = actg->actions; l2 && !found; l2 = l2->next)
|
2006-04-17 05:24:33 -07:00
|
|
|
{
|
2006-07-27 06:55:36 -07:00
|
|
|
act = l2->data;
|
2006-05-06 02:35:05 -07:00
|
|
|
for (l3 = act->key_bindings; l3 && !found; l3 = l3->next)
|
|
|
|
{
|
|
|
|
eb = l3->data;
|
|
|
|
if (eb->modifiers == mod && !strcmp(ev->keyname, eb->key))
|
|
|
|
found = 1;
|
|
|
|
}
|
2006-04-17 05:24:33 -07:00
|
|
|
}
|
2006-03-04 17:37:42 -08:00
|
|
|
}
|
2006-05-06 02:35:05 -07:00
|
|
|
|
2006-04-17 05:24:33 -07:00
|
|
|
if (!found)
|
|
|
|
{
|
2006-05-06 02:35:05 -07:00
|
|
|
eb = evas_list_nth(cfdata->current_act->key_bindings,
|
|
|
|
cfdata->current_act_selector);
|
|
|
|
eb->modifiers = mod;
|
|
|
|
if (eb->key) evas_stringshare_del(eb->key);
|
|
|
|
eb->key = evas_stringshare_add(ev->keyname);
|
|
|
|
|
2006-04-17 05:24:33 -07:00
|
|
|
_e_keybinding_update_binding_list(cfdata);
|
|
|
|
}
|
|
|
|
else
|
2006-07-27 06:55:36 -07:00
|
|
|
{
|
|
|
|
char buf[4096];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf),
|
|
|
|
_("The binding key sequence, that you choose,"
|
|
|
|
" is already used by<br>"
|
|
|
|
"<hilight>%s</hilight> action.<br>"
|
|
|
|
"Please choose another binding key"
|
|
|
|
" sequence."),
|
|
|
|
act->action_name);
|
|
|
|
e_util_dialog_show(_("Binding Key Error"), buf);
|
|
|
|
}
|
2006-05-06 02:35:05 -07:00
|
|
|
|
2006-04-17 05:24:33 -07:00
|
|
|
}
|
2006-05-06 02:35:05 -07:00
|
|
|
_e_keybinding_keybind_shortcut_wnd_hide(cfdata);
|
2006-04-17 05:24:33 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
2006-03-04 16:30:28 -08:00
|
|
|
}
|
|
|
|
static int
|
|
|
|
_e_keybinding_cb_mouse_handler_dumb(void *data, int type, void *event)
|
|
|
|
{
|
2006-04-17 05:24:33 -07:00
|
|
|
return 1;
|
2006-02-09 15:24:06 -08:00
|
|
|
}
|
2006-05-06 02:35:05 -07:00
|
|
|
|
|
|
|
/*******************/
|
|
|
|
static int _action_group_list_sort_cb(void *e1, void *e2)
|
|
|
|
{
|
|
|
|
ACTION_GROUP *actg1 = e1;
|
|
|
|
ACTION_GROUP *actg2 = e2;
|
|
|
|
|
|
|
|
if (!e1) return 1;
|
|
|
|
if (!e2) return -1;
|
|
|
|
|
|
|
|
if (!strcmp(actg1->action_group, AG_UNSORTED)) return 1;
|
|
|
|
if (!strcmp(actg2->action_group, AG_UNSORTED)) return -1;
|
|
|
|
|
|
|
|
return strcmp(actg1->action_group, actg2->action_group);
|
|
|
|
}
|
|
|
|
static int _action_group_actions_list_sort_cb(void *e1, void *e2)
|
|
|
|
{
|
|
|
|
ACTION2 *act1 = e1;
|
|
|
|
ACTION2 *act2 = e2;
|
|
|
|
|
|
|
|
if (!e1) return 1;
|
|
|
|
if (!e2) return -1;
|
|
|
|
|
|
|
|
if (!strcmp(act1->action_name, AG_AN_UNKNOWN)) return 1;
|
|
|
|
if (!strcmp(act2->action_name, AG_AN_UNKNOWN)) return -1;
|
|
|
|
|
|
|
|
return strcmp(act1->action_name, act2->action_name);
|
|
|
|
}
|