forked from enlightenment/enlightenment
More work on Desktop Locking:
* the config dialog is created. Now every one can set his/her personal password to unlock the desktop. Pam support is comming soon also. * a little bit redesined look and feel. * the config version is increased, since the new item is introduced. Some bug fixes in Keybinding config dialog. SVN revision: 20731
This commit is contained in:
parent
5528ac3840
commit
6f947b507c
|
@ -50,12 +50,12 @@ images {
|
|||
//align, 0.5 0.0;
|
||||
rel1
|
||||
{
|
||||
relative, 0.3 0.5;
|
||||
relative, 0.45 0.5;
|
||||
offset, 0 0;
|
||||
}
|
||||
rel2
|
||||
{
|
||||
relative, 0.3 0.5;
|
||||
relative, 0.45 0.5;
|
||||
offset, 0 0;
|
||||
}
|
||||
image
|
||||
|
|
|
@ -132,6 +132,7 @@ e_int_config_startup.h \
|
|||
e_int_config_performance.h \
|
||||
e_int_config_winlist.h \
|
||||
e_int_config_display.h \
|
||||
e_int_config_desklock.h \
|
||||
e_int_config_exebuf.h \
|
||||
e_int_config_cfgdialogs.h \
|
||||
e_deskpreview.h \
|
||||
|
@ -258,6 +259,7 @@ e_int_config_startup.c \
|
|||
e_int_config_performance.c \
|
||||
e_int_config_winlist.c \
|
||||
e_int_config_display.c \
|
||||
e_int_config_desklock.c \
|
||||
e_int_config_exebuf.c \
|
||||
e_int_config_cfgdialogs.c \
|
||||
e_deskpreview.c \
|
||||
|
|
|
@ -457,6 +457,7 @@ e_config_init(void)
|
|||
E_CONFIG_VAL(D, T, cfgdlg_default_mode, INT); /**/
|
||||
E_CONFIG_LIST(D, T, gadcons, _e_config_gadcon_edd);
|
||||
E_CONFIG_LIST(D, T, shelves, _e_config_shelf_edd);
|
||||
E_CONFIG_VAL(D, T, desklock_personal_passwd, STR);
|
||||
|
||||
e_config = e_config_domain_load("e", _e_config_edd);
|
||||
if (e_config)
|
||||
|
@ -608,6 +609,7 @@ e_config_init(void)
|
|||
e_config->cfgdlg_auto_apply = 0;
|
||||
e_config->cfgdlg_default_mode = 0;
|
||||
e_config->gadcons = NULL;
|
||||
e_config->desklock_personal_passwd = NULL;
|
||||
|
||||
/* FIXME: fill up default gadcons! */
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ typedef Eet_Data_Descriptor E_Config_DD;
|
|||
* versioning feature. the value of this is really irrelevant - just as
|
||||
* long as it increases every time we change something
|
||||
*/
|
||||
#define E_CONFIG_FILE_VERSION 138
|
||||
#define E_CONFIG_FILE_VERSION 139
|
||||
|
||||
#define E_EVAS_ENGINE_DEFAULT 0
|
||||
#define E_EVAS_ENGINE_SOFTWARE_X11 1
|
||||
|
@ -110,7 +110,7 @@ struct _E_Config
|
|||
Evas_List *font_defaults;
|
||||
Evas_List *themes;
|
||||
Evas_List *mouse_bindings;
|
||||
Evas_List *key_bindings;
|
||||
Evas_List *key_bindings; // GUI
|
||||
Evas_List *signal_bindings;
|
||||
Evas_List *wheel_bindings;
|
||||
Evas_List *path_append_data;
|
||||
|
@ -210,6 +210,7 @@ struct _E_Config
|
|||
int cfgdlg_default_mode; // GUI
|
||||
Evas_List *gadcons;
|
||||
Evas_List *shelves;
|
||||
char *desklock_personal_passwd; // GUI
|
||||
};
|
||||
|
||||
struct _E_Config_Module
|
||||
|
|
|
@ -70,6 +70,7 @@ e_configure_show(E_Container *con)
|
|||
e_configure_standard_item_add(eco, "enlightenment/mouse", _("Cursor Settings"), e_int_config_cursor);
|
||||
e_configure_standard_item_add(eco, "enlightenment/desktops", _("Desktop Settings"), e_int_config_desks);
|
||||
e_configure_standard_item_add(eco, "enlightenment/desktops", _("Display Settings"), e_int_config_display);
|
||||
e_configure_standard_item_add(eco, "enlightenment/desktops", _("Desktop Lock Settings"), e_int_config_desklock);
|
||||
e_configure_standard_item_add(eco, "enlightenment/e", _("Focus Settings"), e_int_config_focus);
|
||||
e_configure_standard_item_add(eco, "enlightenment/e", _("Key Binding Settings"), e_int_config_keybindings);
|
||||
e_configure_standard_item_add(eco, "enlightenment/favorites", _("Menu Settings"), e_int_config_menus);
|
||||
|
|
|
@ -5,15 +5,27 @@
|
|||
|
||||
#define PASSWD_LEN 256
|
||||
|
||||
|
||||
/**************************** private data ******************************/
|
||||
static Ecore_X_Window elock_wnd = 0;
|
||||
static Evas_List *handlers = NULL;
|
||||
static E_Popup *elock_wnd_popup = NULL;
|
||||
|
||||
static E_Popup *elock_wnd_popup = NULL;
|
||||
static Evas_Object *bg_object = NULL;
|
||||
static Evas_Object *passwd_entry = NULL;
|
||||
|
||||
struct _E_Desklock_Data
|
||||
{
|
||||
Ecore_X_Window elock_wnd;
|
||||
Evas_List *handlers;
|
||||
Evas_List *popus_wnd;
|
||||
Evas_Object *bg_object;
|
||||
};
|
||||
//static Evas_Object *passwd_entry = NULL;
|
||||
|
||||
static char passwd[PASSWD_LEN]="";
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
static int _e_desklock_cb_key_down(void *data, int type, void *event);
|
||||
static int _e_desklock_cb_mouse_down(void *data, int type, void *event);
|
||||
static int _e_desklock_cb_mouse_up(void *data, int type, void *event);
|
||||
|
@ -29,8 +41,6 @@ e_desklock_show(void)
|
|||
{
|
||||
//Evas_List *managers, *l, *l2, *l3;
|
||||
Evas_Object *eo;
|
||||
int x, y, w, h;
|
||||
//Evas_List *elock_wnd_list = NULL;
|
||||
|
||||
E_Zone *zone = NULL;
|
||||
|
||||
|
@ -45,12 +55,7 @@ e_desklock_show(void)
|
|||
ecore_x_window_show(elock_wnd);
|
||||
e_grabinput_get(elock_wnd, 0, elock_wnd);
|
||||
|
||||
x = zone->x;
|
||||
y = zone->y;
|
||||
w = zone->w;
|
||||
h = zone->h;
|
||||
|
||||
elock_wnd_popup = e_popup_new(zone, x, y, w, h);
|
||||
elock_wnd_popup = e_popup_new(zone, zone->x, zone->y, zone->w, zone->h);
|
||||
evas_event_feed_mouse_move(elock_wnd_popup->evas, -1000000, -1000000,
|
||||
ecore_x_current_time_get(), NULL);
|
||||
|
||||
|
@ -72,9 +77,9 @@ e_desklock_show(void)
|
|||
e_theme_edje_object_set(bg_object, "base/theme/desklock", "widgets/desklock/main");
|
||||
|
||||
|
||||
e_popup_move_resize(elock_wnd_popup, x, y, w, h);
|
||||
e_popup_move_resize(elock_wnd_popup, zone->x, zone->y, zone->w, zone->h);
|
||||
evas_object_move(bg_object, 0, 0);
|
||||
evas_object_resize(bg_object, w, h);
|
||||
evas_object_resize(bg_object, zone->w, zone->h);
|
||||
evas_object_show(bg_object);
|
||||
e_popup_edje_bg_object_set(elock_wnd_popup, bg_object);
|
||||
|
||||
|
@ -101,8 +106,6 @@ e_desklock_show(void)
|
|||
}
|
||||
|
||||
/*
|
||||
// TODO: I think that creation of the elock_wnd can be moved into the e_main.c.
|
||||
// Actually this lock wnd can be created just once. And then used.
|
||||
managers = e_manager_list();
|
||||
|
||||
for (l = managers; l; l = l->next)
|
||||
|
@ -223,8 +226,8 @@ _e_desklock_cb_key_down(void *data, int type, void *event)
|
|||
else if (!strcmp(ev->keysymbol, "KP_Enter"))
|
||||
{
|
||||
// here we have to go to auth
|
||||
if (1 || strcmp(passwd, "password") == 0)
|
||||
e_desklock_hide(); // Actually, escape MUST be ignored.
|
||||
if (strcmp(passwd, e_config->desklock_personal_passwd) == 0)
|
||||
e_desklock_hide();
|
||||
else
|
||||
; // report about invalid password
|
||||
memset(passwd, 0, sizeof(char) * PASSWD_LEN);
|
||||
|
@ -233,8 +236,8 @@ _e_desklock_cb_key_down(void *data, int type, void *event)
|
|||
else if (!strcmp(ev->keysymbol, "Return"))
|
||||
{
|
||||
// here we have to go to auth
|
||||
if (1 || strcmp(passwd, "password") == 0)
|
||||
e_desklock_hide(); // Actually, escape MUST be ignored.
|
||||
if (strcmp(passwd, e_config->desklock_personal_passwd) == 0)
|
||||
e_desklock_hide();
|
||||
else
|
||||
; // report about invalid password
|
||||
memset(passwd, 0, sizeof(char) * PASSWD_LEN);
|
||||
|
|
|
@ -111,6 +111,7 @@
|
|||
#include "e_int_config_performance.h"
|
||||
#include "e_int_config_winlist.h"
|
||||
#include "e_int_config_display.h"
|
||||
#include "e_int_config_desklock.h"
|
||||
#include "e_int_config_exebuf.h"
|
||||
#include "e_int_config_cfgdialogs.h"
|
||||
#include "e_deskpreview.h"
|
||||
|
|
|
@ -0,0 +1,203 @@
|
|||
#include "e.h"
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
static void _e_desklock_passwd_cb_change(void *data, Evas_Object *obj);
|
||||
static void _e_desklock_cb_show_passwd(void *data, Evas_Object *obj, const char *emission,
|
||||
const char *source);
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
char *desklock_passwd;
|
||||
char *desklock_passwd_cp;
|
||||
int show_password;
|
||||
|
||||
struct {
|
||||
Evas_Object *passwd_field;
|
||||
} gui;
|
||||
};
|
||||
|
||||
typedef struct _E_Widget_Entry_Data E_Widget_Entry_Data;
|
||||
typedef struct _E_Widget_Check_Data E_Widget_Check_Data;
|
||||
|
||||
struct _E_Widget_Entry_Data
|
||||
{
|
||||
Evas_Object *o_entry;
|
||||
Evas_Object *obj;
|
||||
char **valptr;
|
||||
void (*on_change_func) (void *data, Evas_Object *obj);
|
||||
void *on_change_data;
|
||||
};
|
||||
struct _E_Widget_Check_Data
|
||||
{
|
||||
Evas_Object *o_check;
|
||||
int *valptr;
|
||||
};
|
||||
|
||||
EAPI E_Config_Dialog *
|
||||
e_int_config_desklock(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;
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Desktop Lock Settings"), NULL, 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_desklock_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
// we have to read it from e_config->...
|
||||
if (e_config->desklock_personal_passwd)
|
||||
{
|
||||
cfdata->desklock_passwd = strdup(e_config->desklock_personal_passwd);
|
||||
cfdata->desklock_passwd_cp = strdup(e_config->desklock_personal_passwd);
|
||||
}
|
||||
cfdata->show_password = 0;
|
||||
}
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
cfdata->desklock_passwd = strdup("");
|
||||
cfdata->desklock_passwd_cp = strdup("");
|
||||
|
||||
return cfdata;
|
||||
}
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (!cfdata) return;
|
||||
|
||||
E_FREE(cfdata->desklock_passwd);
|
||||
E_FREE(cfdata->desklock_passwd_cp);
|
||||
|
||||
free(cfdata);
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (cfdata->desklock_passwd_cp)
|
||||
{
|
||||
if (e_config->desklock_personal_passwd)
|
||||
{
|
||||
if (strcmp(e_config->desklock_personal_passwd, cfdata->desklock_passwd_cp) == 0)
|
||||
return 1;
|
||||
evas_stringshare_del(e_config->desklock_personal_passwd);
|
||||
}
|
||||
e_config->desklock_personal_passwd = (char *)evas_stringshare_add(cfdata->desklock_passwd_cp);
|
||||
e_config_save_queue();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *o, *of, *ob;
|
||||
E_Widget_Check_Data *wd;
|
||||
|
||||
_fill_desklock_data(cfdata);
|
||||
|
||||
o = e_widget_list_add(evas, 0, 0);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Personalized Password:"), 0);
|
||||
|
||||
cfdata->gui.passwd_field = ob = e_widget_entry_add(evas, &(cfdata->desklock_passwd));
|
||||
_e_desklock_passwd_cb_change(cfdata, ob);
|
||||
e_widget_entry_on_change_callback_set(ob, _e_desklock_passwd_cb_change, cfdata);
|
||||
e_widget_min_size_set(ob, 200, 25);
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
ob = e_widget_check_add(evas, _("Show Password"), &(cfdata->show_password));
|
||||
wd = (E_Widget_Check_Data*)e_widget_data_get(ob);
|
||||
|
||||
edje_object_signal_callback_add(wd->o_check,"toggle_on", "", _e_desklock_cb_show_passwd, cfdata);
|
||||
edje_object_signal_callback_add(wd->o_check,"toggle_off", "", _e_desklock_cb_show_passwd, cfdata);
|
||||
|
||||
e_widget_framelist_object_append(of, ob);
|
||||
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
e_dialog_resizable_set(cfd->dia, 0);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
static void
|
||||
_e_desklock_passwd_cb_change(void *data, Evas_Object *obj)
|
||||
{
|
||||
E_Widget_Entry_Data *wd;
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
char *buf, *ptr;
|
||||
int i;
|
||||
|
||||
cfdata = data;
|
||||
|
||||
// here goes the hack to have e_widget_entry look like
|
||||
// password entry. However, I think, this should be implemented
|
||||
// at least on the e_widget_entry level. The best would be
|
||||
// e_entry.
|
||||
if (!cfdata->desklock_passwd[0])
|
||||
{
|
||||
E_FREE(cfdata->desklock_passwd_cp);
|
||||
cfdata->desklock_passwd_cp = strdup("");
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(cfdata->desklock_passwd) > strlen(cfdata->desklock_passwd_cp))
|
||||
{
|
||||
for (i = 0; i < strlen(cfdata->desklock_passwd_cp); i++)
|
||||
cfdata->desklock_passwd[i] = cfdata->desklock_passwd_cp[i];
|
||||
E_FREE(cfdata->desklock_passwd_cp);
|
||||
cfdata->desklock_passwd_cp = strdup(cfdata->desklock_passwd);
|
||||
}
|
||||
else if (strlen(cfdata->desklock_passwd) < strlen(cfdata->desklock_passwd_cp))
|
||||
{
|
||||
cfdata->desklock_passwd_cp[strlen(cfdata->desklock_passwd)] = 0;
|
||||
E_FREE(cfdata->desklock_passwd);
|
||||
cfdata->desklock_passwd = strdup(cfdata->desklock_passwd_cp);
|
||||
}
|
||||
else
|
||||
{
|
||||
E_FREE(cfdata->desklock_passwd);
|
||||
cfdata->desklock_passwd = strdup(cfdata->desklock_passwd_cp);
|
||||
}
|
||||
|
||||
wd = e_widget_data_get(obj);
|
||||
|
||||
if (cfdata->show_password)
|
||||
{
|
||||
e_entry_text_set(wd->o_entry, cfdata->desklock_passwd);
|
||||
return;
|
||||
}
|
||||
|
||||
for (ptr = cfdata->desklock_passwd; *ptr; ptr++) *ptr = '*';
|
||||
e_entry_text_set(wd->o_entry, cfdata->desklock_passwd);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_desklock_cb_show_passwd(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
E_Widget_Entry_Data *wd;
|
||||
|
||||
cfdata = data;
|
||||
_e_desklock_passwd_cb_change(cfdata, cfdata->gui.passwd_field);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#ifdef E_TYPEDEFS
|
||||
#else
|
||||
#ifndef E_INT_CONFIG_DESKLOCK_H
|
||||
#define E_INT_CONFIG_DESKLOCK_H
|
||||
|
||||
EAPI E_Config_Dialog *e_int_config_desklock(E_Container *con);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -8,6 +8,15 @@
|
|||
#define ILIST_ICON_WITH_KEYBIND "enlightenment/e"
|
||||
#define ILIST_ICON_WITHOUT_KEYBIND ""
|
||||
|
||||
#define _DEFAULT_ACTION 0
|
||||
#define _NONDEFAULT_ACTION 1
|
||||
|
||||
#define EDIT_RESTRICT_NONE (0 << 0)
|
||||
#define EDIT_RESTRICT_ACTION (1 << 0)
|
||||
#define EDIT_RESTRICT_PARAMS (1 << 1)
|
||||
|
||||
#define E_BINDING_CONTEXT_NUMBER 10
|
||||
|
||||
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);
|
||||
|
@ -38,143 +47,12 @@ typedef struct _E_Widget_Entry_Data E_Widget_Entry_Data;
|
|||
typedef struct _E_Smart_Item E_Smart_Item;
|
||||
typedef struct _E_Smart_Data E_Smart_Data;
|
||||
|
||||
struct _E_Smart_Data
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
Evas_Object *smart_obj;
|
||||
Evas_Object *box_obj;
|
||||
Evas_List *items;
|
||||
int selected;
|
||||
Evas_Coord icon_w, icon_h;
|
||||
unsigned char selector : 1;
|
||||
};
|
||||
|
||||
struct _E_Smart_Item
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
Evas_Object *base_obj;
|
||||
Evas_Object *icon_obj;
|
||||
void (*func) (void *data, void *data2);
|
||||
void (*func_hilight) (void *data, void *data2);
|
||||
void *data;
|
||||
void *data2;
|
||||
};
|
||||
|
||||
struct _E_Widget_IList_Data
|
||||
{
|
||||
Evas_Object *o_widget, *o_scrollframe, *o_ilist;
|
||||
Evas_List *callbacks;
|
||||
char **value;
|
||||
};
|
||||
|
||||
struct _E_Widget_Radio_Data
|
||||
{
|
||||
E_Radio_Group *group;
|
||||
Evas_Object *o_radio;
|
||||
int valnum;
|
||||
};
|
||||
|
||||
struct _E_Widget_Checkbox_Data
|
||||
{
|
||||
Evas_Object *o_check;
|
||||
int *valptr;
|
||||
};
|
||||
|
||||
struct _E_Widget_Button_Data
|
||||
{
|
||||
Evas_Object *o_button;
|
||||
Evas_Object *o_icon;
|
||||
void (*func) (void *data, void *data2);
|
||||
void *data;
|
||||
void *data2;
|
||||
};
|
||||
|
||||
struct _E_Widget_Entry_Data
|
||||
{
|
||||
Evas_Object *o_entry;
|
||||
Evas_Object *obj;
|
||||
char **valptr;
|
||||
void (*on_change_func) (void *data, Evas_Object *obj);
|
||||
void *on_change_data;
|
||||
};
|
||||
#define E_BINDING_CONTEXT_NUMBER 10
|
||||
|
||||
struct _E_Config_KeyBind
|
||||
{
|
||||
int acn;
|
||||
Evas_List *bk_list;
|
||||
};
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
Evas_List *key_bindings;
|
||||
|
||||
int cur_eckb_kb_sel;
|
||||
E_Config_KeyBind *cur_eckb;
|
||||
Evas *evas;
|
||||
|
||||
int binding_context;
|
||||
struct
|
||||
{
|
||||
int shift;
|
||||
int ctrl;
|
||||
int alt;
|
||||
int win;
|
||||
} bind_mod;
|
||||
char *key_bind;
|
||||
char *key_action;
|
||||
char *key_params;
|
||||
|
||||
struct
|
||||
{
|
||||
Evas_Object *ilist;
|
||||
/*Evas_Object *btn_add;
|
||||
Evas_Object *btn_del;*/
|
||||
|
||||
Evas_Object *btn_prev_keybind;
|
||||
Evas_Object *btn_next_keybind;
|
||||
Evas_Object *btn_add_keybind;
|
||||
Evas_Object *btn_del_keybind;
|
||||
|
||||
Evas_Object *bind_context[E_BINDING_CONTEXT_NUMBER];
|
||||
struct
|
||||
{
|
||||
Evas_Object *shift;
|
||||
Evas_Object *ctrl;
|
||||
Evas_Object *alt;
|
||||
Evas_Object *win;
|
||||
} bind_mod_obj;
|
||||
Evas_Object *key_bind;
|
||||
Evas_Object *key_action;
|
||||
Evas_Object *key_params;
|
||||
} gui;
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Key Binding Settings"), NULL, 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
/*typedef struct
|
||||
{
|
||||
char *key;
|
||||
int modifiers;
|
||||
int context;
|
||||
}KEY_ACTION_BINDING;
|
||||
|
||||
}KEY_ACTION_BINDING;*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -185,13 +63,6 @@ typedef struct
|
|||
int restrictions;
|
||||
}ACTION;
|
||||
|
||||
#define _DEFAULT_ACTION 0
|
||||
#define _NONDEFAULT_ACTION 1
|
||||
|
||||
#define EDIT_RESTRICT_NONE (0 << 0)
|
||||
#define EDIT_RESTRICT_ACTION (1 << 0)
|
||||
#define EDIT_RESTRICT_PARAMS (1 << 1)
|
||||
|
||||
const ACTION actions_predefined_names[ ] = {
|
||||
{"Flip Desktop Left", "desk_flip_by", "-1 0", _DEFAULT_ACTION,
|
||||
EDIT_RESTRICT_ACTION | EDIT_RESTRICT_PARAMS },
|
||||
|
@ -335,6 +206,136 @@ const ACTION actions_predefined_names[ ] = {
|
|||
{NULL, NULL, NULL, _NONDEFAULT_ACTION, EDIT_RESTRICT_NONE }
|
||||
};
|
||||
|
||||
struct _E_Smart_Data
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
|
||||
Evas_Object *smart_obj;
|
||||
Evas_Object *box_obj;
|
||||
Evas_List *items;
|
||||
int selected;
|
||||
Evas_Coord icon_w, icon_h;
|
||||
unsigned char selector : 1;
|
||||
};
|
||||
|
||||
struct _E_Smart_Item
|
||||
{
|
||||
E_Smart_Data *sd;
|
||||
Evas_Object *base_obj;
|
||||
Evas_Object *icon_obj;
|
||||
void (*func) (void *data, void *data2);
|
||||
void (*func_hilight) (void *data, void *data2);
|
||||
void *data;
|
||||
void *data2;
|
||||
};
|
||||
|
||||
struct _E_Widget_IList_Data
|
||||
{
|
||||
Evas_Object *o_widget, *o_scrollframe, *o_ilist;
|
||||
Evas_List *callbacks;
|
||||
char **value;
|
||||
};
|
||||
|
||||
struct _E_Widget_Radio_Data
|
||||
{
|
||||
E_Radio_Group *group;
|
||||
Evas_Object *o_radio;
|
||||
int valnum;
|
||||
};
|
||||
|
||||
struct _E_Widget_Checkbox_Data
|
||||
{
|
||||
Evas_Object *o_check;
|
||||
int *valptr;
|
||||
};
|
||||
|
||||
struct _E_Widget_Button_Data
|
||||
{
|
||||
Evas_Object *o_button;
|
||||
Evas_Object *o_icon;
|
||||
void (*func) (void *data, void *data2);
|
||||
void *data;
|
||||
void *data2;
|
||||
};
|
||||
|
||||
struct _E_Widget_Entry_Data
|
||||
{
|
||||
Evas_Object *o_entry;
|
||||
Evas_Object *obj;
|
||||
char **valptr;
|
||||
void (*on_change_func) (void *data, Evas_Object *obj);
|
||||
void *on_change_data;
|
||||
};
|
||||
|
||||
struct _E_Config_KeyBind
|
||||
{
|
||||
int acn;
|
||||
Evas_List *bk_list;
|
||||
};
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
Evas_List *key_bindings;
|
||||
|
||||
int cur_eckb_kb_sel;
|
||||
E_Config_KeyBind *cur_eckb;
|
||||
Evas *evas;
|
||||
|
||||
int binding_context;
|
||||
struct
|
||||
{
|
||||
int shift;
|
||||
int ctrl;
|
||||
int alt;
|
||||
int win;
|
||||
} bind_mod;
|
||||
char *key_bind;
|
||||
char *key_action;
|
||||
char *key_params;
|
||||
|
||||
struct
|
||||
{
|
||||
Evas_Object *ilist;
|
||||
/*Evas_Object *btn_add;
|
||||
Evas_Object *btn_del;*/
|
||||
|
||||
Evas_Object *btn_prev_keybind;
|
||||
Evas_Object *btn_next_keybind;
|
||||
Evas_Object *btn_add_keybind;
|
||||
Evas_Object *btn_del_keybind;
|
||||
|
||||
Evas_Object *bind_context[E_BINDING_CONTEXT_NUMBER];
|
||||
struct
|
||||
{
|
||||
Evas_Object *shift;
|
||||
Evas_Object *ctrl;
|
||||
Evas_Object *alt;
|
||||
Evas_Object *win;
|
||||
} bind_mod_obj;
|
||||
Evas_Object *key_bind;
|
||||
Evas_Object *key_action;
|
||||
Evas_Object *key_params;
|
||||
} gui;
|
||||
};
|
||||
|
||||
|
||||
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;
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Key Binding Settings"), NULL, 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_keybindings_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
|
@ -446,9 +447,9 @@ _create_data(E_Config_Dialog *cfd)
|
|||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
|
||||
cfdata->binding_context = E_BINDING_CONTEXT_ANY;
|
||||
cfdata->key_bind = NULL;
|
||||
cfdata->key_action = NULL;
|
||||
cfdata->key_params = NULL;
|
||||
cfdata->key_bind = strdup("");
|
||||
cfdata->key_action = strdup("");
|
||||
cfdata->key_params = strdup("");
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
|
@ -461,12 +462,9 @@ _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
E_Config_Binding_Key *bk;
|
||||
|
||||
|
||||
if (cfdata->key_bind)
|
||||
E_FREE(cfdata->key_bind);
|
||||
if (cfdata->key_action)
|
||||
E_FREE(cfdata->key_action);
|
||||
if (cfdata->key_params)
|
||||
E_FREE(cfdata->key_params);
|
||||
E_FREE(cfdata->key_bind);
|
||||
E_FREE(cfdata->key_action);
|
||||
E_FREE(cfdata->key_params);
|
||||
|
||||
size = evas_list_count(cfdata->key_bindings);
|
||||
for (i = 0; i < size; i++)
|
||||
|
@ -480,10 +478,9 @@ _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
bk = evas_list_nth(eckb->bk_list, j);
|
||||
if (bk)
|
||||
{
|
||||
if (bk->key) E_FREE(bk->key);
|
||||
if (bk->action) E_FREE(bk->action);
|
||||
if (bk->params) E_FREE(bk->params);
|
||||
|
||||
E_FREE(bk->key);
|
||||
E_FREE(bk->action);
|
||||
E_FREE(bk->params);
|
||||
E_FREE(bk);
|
||||
}
|
||||
}
|
||||
|
@ -558,7 +555,7 @@ _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
e_config_save_queue();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -781,7 +778,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
|||
e_widget_table_object_append(oft, of2, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||
}
|
||||
e_widget_list_object_append(o, oft, 1, 1, 0.5);
|
||||
e_dialog_resizable_set(cfd->dia, 1);
|
||||
e_dialog_resizable_set(cfd->dia, 0);
|
||||
return o;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue