'everything' module: added config options to not hide input or list

SVN revision: 41830
This commit is contained in:
Hannes Janetzek 2009-08-17 03:30:04 +00:00
parent 0970a9894c
commit 06bacad65f
4 changed files with 85 additions and 48 deletions

View File

@ -9,6 +9,8 @@
#include "e_mod_main.h" #include "e_mod_main.h"
#define CONFIG_VERSION 1
/* actual module specifics */ /* actual module specifics */
static void _e_mod_action_exebuf_cb(E_Object *obj, const char *params); static void _e_mod_action_exebuf_cb(E_Object *obj, const char *params);
static int _e_mod_run_defer_cb(void *data); static int _e_mod_run_defer_cb(void *data);
@ -70,36 +72,35 @@ e_modapi_init(E_Module *m)
#undef D #undef D
#define T Config #define T Config
#define D conf_edd #define D conf_edd
E_CONFIG_VAL(D, T, version, INT);
E_CONFIG_VAL(D, T, width, INT); E_CONFIG_VAL(D, T, width, INT);
E_CONFIG_VAL(D, T, height, INT); E_CONFIG_VAL(D, T, height, INT);
E_CONFIG_VAL(D, T, rel_x, DOUBLE); E_CONFIG_VAL(D, T, rel_x, DOUBLE);
E_CONFIG_VAL(D, T, rel_y, DOUBLE); E_CONFIG_VAL(D, T, rel_y, DOUBLE);
E_CONFIG_VAL(D, T, scroll_animate, INT); E_CONFIG_VAL(D, T, scroll_animate, INT);
E_CONFIG_VAL(D, T, scroll_speed, DOUBLE); E_CONFIG_VAL(D, T, scroll_speed, DOUBLE);
E_CONFIG_VAL(D, T, hide_input, INT);
E_CONFIG_VAL(D, T, hide_list, INT);
E_CONFIG_LIST(D, T, plugins_conf, conf_item_edd); E_CONFIG_LIST(D, T, plugins_conf, conf_item_edd);
#undef T #undef T
#undef D #undef D
evry_conf = e_config_domain_load("module.everything", conf_edd); evry_conf = e_config_domain_load("module.everything", conf_edd);
if (!evry_conf) if (!evry_conf || (evry_conf->version == CONFIG_VERSION))
{ {
evry_conf = E_NEW(Config, 1); evry_conf = E_NEW(Config, 1);
evry_conf->version = CONFIG_VERSION;
evry_conf->rel_x = 50.0; evry_conf->rel_x = 50.0;
evry_conf->rel_y = 50.0; evry_conf->rel_y = 50.0;
evry_conf->width = 400; evry_conf->width = 400;
evry_conf->height = 350; evry_conf->height = 350;
evry_conf->scroll_animate = 1; evry_conf->scroll_animate = 0;
evry_conf->scroll_speed = 0.08; evry_conf->scroll_speed = 0.08;
evry_conf->hide_input = 0;
evry_conf->hide_input = 1;
} }
/* evry_conf->history = eina_hash_string_superfast_new(NULL); */ /* search for plugins */
evry_conf->width = 380;
evry_conf->height = 235;
evry_conf->scroll_animate = 0;
/* conf_module = m; */
evry_init();
eina_module_init(); eina_module_init();
snprintf(dir, sizeof(dir), "%s/enlightenment/everything_plugins", e_prefix_lib_get()); snprintf(dir, sizeof(dir), "%s/enlightenment/everything_plugins", e_prefix_lib_get());
@ -130,6 +131,8 @@ e_modapi_init(E_Module *m)
e_configure_registry_category_add("extensions", 80, _("Extensions"), NULL, "preferences-extensions"); e_configure_registry_category_add("extensions", 80, _("Extensions"), NULL, "preferences-extensions");
e_configure_registry_item_add("extensions/run_everything", 40, _("Run Everything"), NULL, "system-run", evry_config_dialog); e_configure_registry_item_add("extensions/run_everything", 40, _("Run Everything"), NULL, "system-run", evry_config_dialog);
evry_init();
e_module_delayed_set(m, 1); e_module_delayed_set(m, 1);
return m; return m;

View File

@ -8,6 +8,7 @@ typedef struct _Config Config;
struct _Config struct _Config
{ {
int version;
/* position */ /* position */
double rel_x, rel_y; double rel_x, rel_y;
/* size */ /* size */
@ -19,8 +20,9 @@ struct _Config
int scroll_animate; int scroll_animate;
double scroll_speed; double scroll_speed;
int auto_select_first; int hide_input;
int hide_list;
Eina_Hash *key_bindings; Eina_Hash *key_bindings;
/**/ /**/

View File

@ -128,7 +128,7 @@ static int _evry_selector_objects_get(const char *type);
static Evry_List_Window *_evry_list_win_new(E_Zone *zone); static Evry_List_Window *_evry_list_win_new(E_Zone *zone);
static void _evry_list_win_free(Evry_List_Window *win); static void _evry_list_win_free(Evry_List_Window *win);
static void _evry_list_win_show(void); static void _evry_list_win_show(void);
static void _evry_list_win_hide(void); static void _evry_list_win_clear(int hide);
static void _evry_list_clear_list(Evry_State *s); static void _evry_list_clear_list(Evry_State *s);
static void _evry_list_update(Evry_State *s); static void _evry_list_update(Evry_State *s);
static void _evry_list_show_items(Evry_State *s, Evry_Plugin *plugin); static void _evry_list_show_items(Evry_State *s, Evry_Plugin *plugin);
@ -244,6 +244,9 @@ evry_show(E_Zone *zone)
} }
e_box_align_set(list->o_tabs, 0.0, 0.5); e_box_align_set(list->o_tabs, 0.0, 0.5);
if (!evry_conf->hide_input)
edje_object_signal_emit(list->o_main, "e,state,entry_show", "e");
handlers = eina_list_append handlers = eina_list_append
(handlers, ecore_event_handler_add (handlers, ecore_event_handler_add
(ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL)); (ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL));
@ -699,15 +702,13 @@ _evry_list_win_show(void)
} }
static void static void
_evry_list_win_hide(void) _evry_list_win_clear(int hide)
{ {
Eina_List *l; Eina_List *l;
Evry_Plugin *p; Evry_Plugin *p;
if (!list->visible) return; if (!list->visible) return;
list->visible = EINA_FALSE;
EINA_LIST_FOREACH(selector->plugins, l, p) EINA_LIST_FOREACH(selector->plugins, l, p)
{ {
e_box_unpack(p->tab); e_box_unpack(p->tab);
@ -716,7 +717,13 @@ _evry_list_win_hide(void)
} }
_evry_list_clear_list(selector->state); _evry_list_clear_list(selector->state);
edje_object_signal_emit(list->o_main, "e,state,list_hide", "e"); if (hide)
{
list->visible = EINA_FALSE;
edje_object_signal_emit(list->o_main, "e,state,list_hide", "e");
}
/* e_popup_hide(list->popup); */ /* e_popup_hide(list->popup); */
} }
@ -857,7 +864,7 @@ _evry_selector_activate(Evry_Selector *sel)
p->tab = NULL; p->tab = NULL;
} }
_evry_list_win_hide(); _evry_list_win_clear(evry_conf->hide_list);
_evry_plugin_show(selector->state, NULL); _evry_plugin_show(selector->state, NULL);
} }
@ -878,6 +885,7 @@ _evry_selector_activate(Evry_Selector *sel)
_evry_list_tabs_update(s); _evry_list_tabs_update(s);
_evry_plugin_show(s, s->plugin); _evry_plugin_show(s, s->plugin);
_evry_list_show_items(s, s->plugin); _evry_list_show_items(s, s->plugin);
_evry_list_scroll_to(s, s->sel_item);
} }
} }
} }
@ -1261,6 +1269,9 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
(strcmp(ev->key, "Tab")) && (strcmp(ev->key, "Tab")) &&
(strcmp(ev->key, "Escape"))) (strcmp(ev->key, "Escape")))
{ {
if (!list->visible)
_evry_list_win_show();
if (s->plugin->cb_key_down(s->plugin, ev)) if (s->plugin->cb_key_down(s->plugin, ev))
return 1; return 1;
} }
@ -1384,11 +1395,14 @@ _evry_backspace(Evry_State *s)
static void static void
_evry_update_text_label(Evry_State *s) _evry_update_text_label(Evry_State *s)
{ {
if (strlen(s->input) > 0) if (evry_conf->hide_input)
edje_object_signal_emit(list->o_main, "e,state,entry_show", "e"); {
else if (strlen(s->input) > 0)
edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e"); edje_object_signal_emit(list->o_main, "e,state,entry_show", "e");
else
edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e");
}
edje_object_part_text_set(win->o_main, "e.text.label", s->input); edje_object_part_text_set(win->o_main, "e.text.label", s->input);
edje_object_part_text_set(list->o_main, "e.text.label", s->input); edje_object_part_text_set(list->o_main, "e.text.label", s->input);
@ -1433,7 +1447,8 @@ _evry_clear(Evry_State *s)
{ {
s->input[0] = 0; s->input[0] = 0;
_evry_update(s, 1); _evry_update(s, 1);
edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e"); if (evry_conf->hide_input)
edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e");
return 1; return 1;
} }
return 0; return 0;
@ -1915,7 +1930,7 @@ _evry_list_item_prev(Evry_State *s)
} }
} }
_evry_list_win_hide(); _evry_list_win_clear(1);
} }
static void static void

View File

@ -13,8 +13,10 @@ static Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas,
struct _E_Config_Dialog_Data struct _E_Config_Dialog_Data
{ {
int width, height; int hide_input;
int hide_list;
int width, height;
int scroll_animate; int scroll_animate;
Evas_Object *l_subject; Evas_Object *l_subject;
@ -55,10 +57,12 @@ _fill_data(E_Config_Dialog_Data *cfdata)
Eina_List *l; Eina_List *l;
Evry_Plugin *p; Evry_Plugin *p;
cfdata->scroll_animate = evry_conf->scroll_animate; /* cfdata->scroll_animate = evry_conf->scroll_animate;
cfdata->height = evry_conf->height; * cfdata->height = evry_conf->height;
cfdata->width = evry_conf->width; * cfdata->width = evry_conf->width; */
cfdata->hide_list = evry_conf->hide_list;
cfdata->hide_input = evry_conf->hide_input;
EINA_LIST_FOREACH(evry_conf->plugins, l, p) EINA_LIST_FOREACH(evry_conf->plugins, l, p)
if (p->type == type_subject) if (p->type == type_subject)
cfdata->p_subject = eina_list_append(cfdata->p_subject, p); cfdata->p_subject = eina_list_append(cfdata->p_subject, p);
@ -99,9 +103,11 @@ _evry_cb_plugin_sort(const void *data1, const void *data2)
static int static int
_basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{ {
evry_conf->width = cfdata->width; /* evry_conf->width = cfdata->width;
evry_conf->height = cfdata->height; * evry_conf->height = cfdata->height;
evry_conf->scroll_animate = cfdata->scroll_animate; * evry_conf->scroll_animate = cfdata->scroll_animate; */
evry_conf->hide_input = cfdata->hide_input;
evry_conf->hide_list = cfdata->hide_list;
evry_conf->plugins = eina_list_sort(evry_conf->plugins, evry_conf->plugins = eina_list_sort(evry_conf->plugins,
eina_list_count(evry_conf->plugins), eina_list_count(evry_conf->plugins),
@ -188,26 +194,37 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
o = e_widget_list_add(evas, 0, 0); o = e_widget_list_add(evas, 0, 0);
of = e_widget_framelist_add(evas, _("General Settings"), 0); of = e_widget_framelist_add(evas, _("General Settings"), 0);
ob = e_widget_label_add(evas, _("Popup Width"));
e_widget_framelist_object_append(of, ob); ob = e_widget_check_add(evas, _("Hide input when inactive"),
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), &(cfdata->hide_input));
300, 800, 5, 0, NULL,
&(cfdata->width), 200);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(evas, _("Popup Height")); ob = e_widget_check_add(evas, _("Hide list"),
e_widget_framelist_object_append(of, ob); &(cfdata->hide_list));
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"),
200, 800, 5, 0, NULL,
&(cfdata->height), 200);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5); e_widget_list_object_append(o, of, 1, 1, 0.5);
of = e_widget_framelist_add(evas, _("Scroll Settings"), 0); /* ob = e_widget_label_add(evas, _("Popup Width"));
ob = e_widget_check_add(evas, _("Scroll Animate"), * e_widget_framelist_object_append(of, ob);
&(cfdata->scroll_animate)); * ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"),
e_widget_framelist_object_append(of, ob); * 300, 800, 5, 0, NULL,
e_widget_list_object_append(o, of, 1, 1, 0.5); * &(cfdata->width), 200);
* e_widget_framelist_object_append(of, ob);
*
* ob = e_widget_label_add(evas, _("Popup Height"));
* e_widget_framelist_object_append(of, ob);
* ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"),
* 200, 800, 5, 0, NULL,
* &(cfdata->height), 200);
* e_widget_framelist_object_append(of, ob);
* e_widget_list_object_append(o, of, 1, 1, 0.5); */
/* of = e_widget_framelist_add(evas, _("Scroll Settings"), 0);
* ob = e_widget_check_add(evas, _("Scroll Animate"),
* &(cfdata->scroll_animate));
* e_widget_framelist_object_append(of, ob);
* e_widget_list_object_append(o, of, 1, 1, 0.5); */
e_widget_toolbook_page_append(otb, NULL, _("General Settings"), e_widget_toolbook_page_append(otb, NULL, _("General Settings"),
o, 0, 0, 0, 0, 0.5, 0.0); o, 0, 0, 0, 0, 0.5, 0.0);