From: Enlightenment S. <no-...@en...> - 2009-05-06 14:49:09
|
Log: everything module: remove old files Author: jeffdameth Date: 2009-05-06 07:49:01 -0700 (Wed, 06 May 2009) New Revision: 40528 Removed: trunk/e/src/modules/everything/evry_app.c trunk/e/src/modules/everything/evry_border.c Deleted: trunk/e/src/modules/everything/evry_app.c Deleted: trunk/e/src/modules/everything/evry_border.c |
From: Enlightenment S. <no-...@en...> - 2009-06-08 14:12:04
|
Log: 'everything' module - fix segv on command execution - cleanups Author: jeffdameth Date: 2009-06-08 06:44:11 -0700 (Mon, 08 Jun 2009) New Revision: 40967 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-08 12:26:46 UTC (rev 40966) +++ trunk/e/src/modules/everything/evry.c 2009-06-08 13:44:11 UTC (rev 40967) @@ -51,8 +51,8 @@ static double scroll_align_to; static double scroll_align; static int plugin_count; -static Evry_Plugin *plugin_selected; -static int toolbar_nr; +static Evry_Plugin *cur_source; +static Eina_List *cur_sources = NULL; static int ev_last_is_mouse; @@ -192,11 +192,8 @@ if (!popup) return; if (update_timer) - { - ecore_timer_del(update_timer); - update_timer = NULL; - } - + ecore_timer_del(update_timer); + evas_event_freeze(popup->evas); _evry_matches_clear(); e_popup_hide(popup); @@ -230,7 +227,7 @@ free(cmd_buf); cmd_buf = NULL; - plugin_selected = NULL; + cur_source = NULL; item_selected = NULL; item_mouseover = NULL; } @@ -254,16 +251,13 @@ _evry_plugin_next(); else if (!strcmp(ev->key, "Left")) _evry_plugin_prev(); - else if (!strcmp(ev->key, "Return")) - _evry_action(1); else if (!strcmp(ev->key, "Return") && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) _evry_action(0); + else if (!strcmp(ev->key, "Return")) + _evry_action(1); /* else if (!strcmp(ev->key, "Tab")) - * _evry_complete(); - * else if (!strcmp(ev->key, "Return")) - * _evry_exec(); - */ + * _evry_complete(); */ else if (!strcmp(ev->key, "u") && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) _evry_clear(); @@ -281,9 +275,6 @@ { strcat(cmd_buf, ev->compose); _evry_update(); - if (!update_timer) - update_timer = - ecore_timer_add(MATCH_LAG, _evry_update_timer, NULL); } } } @@ -415,29 +406,9 @@ static void _evry_cb_plugin_sel(void *data1, void *data2) { - Evry_Plugin *plugin; - Eina_List *l; - int i = 0; + if (cur_source == data1) return; - if (plugin_selected == data1) return; - - _evry_list_clear(); - plugin_selected = data1; - - for (l = plugins; l; l = l->next) - { - plugin = l->data; - - if (!plugin->candidates) continue; - - if (plugin == plugin_selected) - { - _evry_show_candidates(plugin); - toolbar_nr = i; - e_widget_toolbar_item_select(o_toolbar, toolbar_nr); - } - else i++; - } + _evry_show_candidates(data1); } static void @@ -453,8 +424,6 @@ { cmd_buf[pos] = 0; _evry_update(); - if (!update_timer) - update_timer = ecore_timer_add(MATCH_LAG, _evry_update_timer, NULL); } } } @@ -466,18 +435,20 @@ Evas_Object *o; edje_object_part_text_set(o_main, "e.text.label", cmd_buf); + if (icon_object) evas_object_del(icon_object); icon_object = NULL; - if (!cmd_buf[0]) return; + if (update_timer) ecore_timer_del(update_timer); + update_timer = ecore_timer_add(MATCH_LAG, _evry_update_timer, NULL); } static void _evry_action(int finished) { - if (plugin_selected && item_selected) + if (cur_source && item_selected) { - plugin_selected->action(item_selected); + cur_source->action(item_selected); } else e_exec(popup->zone, NULL, cmd_buf, NULL, "everything"); @@ -505,10 +476,14 @@ Eina_List *l; int mw, mh, h; Evas_Object *o; + int i = 0; + _evry_list_clear(); + cur_source = plugin; + e_box_freeze(o_list); - EINA_LIST_FOREACH(plugin->candidates, l, it) + EINA_LIST_FOREACH(cur_source->candidates, l, it) { o = edje_object_add(popup->evas); it->o_bg = o; @@ -523,8 +498,7 @@ _evry_cb_item_mouse_out, it); evas_object_show(o); - /* XXX eek*/ - plugin->icon_get(it, popup->evas); + cur_source->icon_get(it, popup->evas); if (edje_object_part_exists(o, "e.swallow.icons") && it->o_icon) { edje_object_part_swallow(o, "e.swallow.icons", it->o_icon); @@ -549,21 +523,29 @@ else e_box_align_set(o_list, 0.5, 1.0); + EINA_LIST_FOREACH(cur_sources, l, plugin) + if (plugin == cur_source) + break; + else i++; + + e_widget_toolbar_item_select(o_toolbar, i); + evas_event_thaw(popup->evas); } static void _evry_matches_update() { - Evry_Plugin *plugin, *first = NULL; + Evry_Plugin *plugin; Eina_List *l; char buf[64]; int candidates; _evry_matches_clear(); plugin_count = 0; - toolbar_nr = 0; - + eina_list_free(cur_sources); + cur_sources = NULL; + EINA_LIST_FOREACH(plugins, l, plugin) { if (strlen(cmd_buf) == 0) @@ -583,39 +565,26 @@ NULL, buf, _evry_cb_plugin_sel, plugin, NULL); - if (!first) - first = plugin; - /* if (!plugin_selected) - * { - * plugin_selected = plugin; - * } - * else */ - if (plugin == plugin_selected) - toolbar_nr = plugin_count; - + cur_sources = eina_list_append(cur_sources, plugin); plugin_count++; } } - if ((toolbar_nr == 0) && (plugin_count > 0)) + if (!cur_source && (plugin_count > 0)) { - plugin_selected = first; + _evry_show_candidates(cur_sources->data); } - if (plugin_selected) + else if (cur_source) { - _evry_show_candidates(plugin_selected); - e_widget_toolbar_item_select(o_toolbar, toolbar_nr); + _evry_show_candidates(cur_source); } } static void _evry_item_remove(Evry_Item *it) { - /* if (ev_last_mouse == it) - * ev_last_mouse = NULL; */ - evas_object_del(it->o_bg); if (it->o_icon) evas_object_del(it->o_icon); it->o_icon = NULL; @@ -649,11 +618,11 @@ Evry_Item *it; Eina_List *l; - if (plugin_selected) + if (cur_source) { evas_event_freeze(popup->evas); e_box_freeze(o_list); - EINA_LIST_FOREACH(plugin_selected->candidates, l, it) + EINA_LIST_FOREACH(cur_source->candidates, l, it) _evry_item_remove(it); e_box_thaw(o_list); evas_event_thaw(popup->evas); @@ -667,7 +636,7 @@ { int n, h, mh; - n = eina_list_count(plugin_selected->candidates); + n = eina_list_count(cur_source->candidates); e_box_min_size_get(o_list, NULL, &mh); evas_object_geometry_get(o_list, NULL, NULL, NULL, &h); @@ -727,7 +696,7 @@ if (item_selected) { - for (i = 0, l = plugin_selected->candidates; l; l = l->next, i++) + for (i = 0, l = cur_source->candidates; l; l = l->next, i++) { if (l->data == item_selected) { @@ -742,9 +711,9 @@ } } } - else if (plugin_selected->candidates) + else if (cur_source->candidates) { - item_selected = plugin_selected->candidates->data; + item_selected = cur_source->candidates->data; _evry_item_sel(item_selected); _evry_scroll_to(0); } @@ -763,7 +732,7 @@ { _evry_item_desel(item_selected); - for (i = 0, l = plugin_selected->candidates; l; l = l->next, i++) + for (i = 0, l = cur_source->candidates; l; l = l->next, i++) { if (l->data == item_selected) { @@ -790,48 +759,19 @@ { Eina_List *l; Evry_Plugin *plugin; - Evry_Item *it; - int changed = 0; - int i; - if (!plugin_selected) return; + if (!cur_source) return; - l = eina_list_data_find_list(plugins, plugin_selected); + l = eina_list_data_find_list(cur_sources, cur_source); if (l && l->next) { - for (l = l->next; l; l = l->next) - { - plugin = l->data; - if (plugin->candidates) - { - toolbar_nr++; - changed = 1; - break; - } - } + _evry_show_candidates(l->next->data); } - if (!changed) + else if (cur_source != cur_sources->data) { - for (l = plugins; l; l = l->next) - { - plugin = l->data; - if ((plugin != plugin_selected) && plugin->candidates) - { - changed = 1; - toolbar_nr = 0; - break; - } - } + _evry_show_candidates(cur_sources->data); } - if (changed) - { - _evry_list_clear(); - - plugin_selected = plugin; - _evry_show_candidates(plugin); - e_widget_toolbar_item_select(o_toolbar, toolbar_nr); - } } @@ -840,46 +780,18 @@ { Eina_List *l; Evry_Plugin *plugin; - Evry_Item *it; - int changed = 0; - int i; - if (!plugin_selected) return; + if (!cur_source) return; - l = eina_list_data_find_list(plugins, plugin_selected); + l = eina_list_data_find_list(plugins, cur_source); if (l && l->prev) { - for (l = l->prev; l; l = l->prev) - { - plugin = l->data; - if (plugin->candidates) - { - toolbar_nr--; - changed = 1; - break; - } - } + _evry_show_candidates(l->prev->data); } - if (!changed) + else if (cur_source != eina_list_last(cur_sources)->data) { - for (l = eina_list_last(plugins); l; l = l->prev) - { - plugin = l->data; - if ((plugin != plugin_selected) && plugin->candidates) - { - changed = 1; - toolbar_nr = plugin_count - 1; - break; - } - } + _evry_show_candidates(eina_list_last(cur_sources)->data); } - if (changed) - { - _evry_list_clear(); - - plugin_selected = plugin; - _evry_show_candidates(plugin); - e_widget_toolbar_item_select(o_toolbar, toolbar_nr); - } } + |
From: Enlightenment S. <no-...@en...> - 2009-06-08 16:01:30
|
Log: 'everything' module: set update_timer NULL on hide Author: jeffdameth Date: 2009-06-08 09:01:27 -0700 (Mon, 08 Jun 2009) New Revision: 40973 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-08 15:45:02 UTC (rev 40972) +++ trunk/e/src/modules/everything/evry.c 2009-06-08 16:01:27 UTC (rev 40973) @@ -36,26 +36,29 @@ /* local subsystem globals */ static E_Popup *popup = NULL; +static Ecore_X_Window input_window = 0; static Evas_Object *o_list = NULL; static Evas_Object *o_main = NULL; static Evas_Object *icon_object = NULL; static Evas_Object *o_toolbar = NULL; static char *cmd_buf = NULL; static Eina_List *handlers = NULL; -static Ecore_X_Window input_window = 0; +static Ecore_Timer *update_timer = NULL; static Eina_List *plugins = NULL; -static Ecore_Timer *update_timer = NULL; -/* static Ecore_Animator *animator = NULL; */ -static Evry_Item *item_selected = NULL; -static Evry_Item *item_mouseover = NULL; -static double scroll_align_to; -static double scroll_align; static int plugin_count; static Evry_Plugin *cur_source; static Eina_List *cur_sources = NULL; +static Evry_Item *item_selected = NULL; +static Evry_Item *item_mouseover = NULL; + static int ev_last_is_mouse; +/* static Ecore_Animator *animator = NULL; */ +static double scroll_align_to; +static double scroll_align; + + /* externally accessible functions */ EAPI int evry_init(void) @@ -192,7 +195,10 @@ if (!popup) return; if (update_timer) - ecore_timer_del(update_timer); + { + ecore_timer_del(update_timer); + update_timer = NULL; + } evas_event_freeze(popup->evas); _evry_matches_clear(); @@ -789,9 +795,14 @@ { _evry_show_candidates(l->prev->data); } - else if (cur_source != eina_list_last(cur_sources)->data) - { - _evry_show_candidates(eina_list_last(cur_sources)->data); + else + { + l = eina_list_last(cur_sources); + + if (cur_source != l->data) + { + _evry_show_candidates(l->data); + } } } |
From: Enlightenment S. <no-...@en...> - 2009-06-08 16:37:43
|
Log: 'everything' module: - fix update matches to show the right current source - beginning to add settings Author: jeffdameth Date: 2009-06-08 09:37:40 -0700 (Mon, 08 Jun 2009) New Revision: 40974 Modified: trunk/e/src/modules/everything/e_mod_main.c trunk/e/src/modules/everything/e_mod_main.h trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/e_mod_main.c =================================================================== --- trunk/e/src/modules/everything/e_mod_main.c 2009-06-08 16:01:27 UTC (rev 40973) +++ trunk/e/src/modules/everything/e_mod_main.c 2009-06-08 16:37:40 UTC (rev 40974) @@ -14,6 +14,10 @@ static E_Action *act = NULL; static E_Int_Menu_Augmentation *maug = NULL; +static E_Config_DD *conf_edd = NULL; +static E_Config_DD *conf_item_edd = NULL; +Config *evry_conf; + /* module setup */ EAPI E_Module_Api e_modapi = { @@ -24,6 +28,41 @@ EAPI void * e_modapi_init(E_Module *m) { + char buf[4096]; + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/module.everything", + e_user_homedir_get(), e_config_profile_get()); + ecore_file_mkdir(buf); + + conf_item_edd = E_CONFIG_DD_NEW("Source_Config", Source_Config); +#undef T +#undef D +#define T Source_Config +#define D conf_item_edd + E_CONFIG_VAL(D, T, name, STR); + E_CONFIG_VAL(D, T, min_query, INT); + conf_edd = E_CONFIG_DD_NEW("Config", Config); +#undef T +#undef D +#define T Config +#define D conf_edd + E_CONFIG_VAL(D, T, width, INT); + E_CONFIG_VAL(D, T, height, INT); + E_CONFIG_VAL(D, T, rel_x, DOUBLE); + E_CONFIG_VAL(D, T, rel_y, DOUBLE); + E_CONFIG_LIST(D, T, sources, conf_item_edd); +#undef T +#undef D + evry_conf = e_config_domain_load("module.everything", conf_edd); + + if (!evry_conf) + { + evry_conf = E_NEW(Config, 1); + evry_conf->rel_x = 50.0; + evry_conf->rel_y = 50.0; + evry_conf->width = 400; + evry_conf->height = 350; + } + conf_module = m; evry_init(); @@ -67,12 +106,17 @@ evry_shutdown(); conf_module = NULL; + + /* Clean EET */ + E_CONFIG_DD_FREE(conf_item_edd); + E_CONFIG_DD_FREE(conf_edd); return 1; } EAPI int e_modapi_save(E_Module *m) { + e_config_domain_save("module.everything", conf_edd, evry_conf); return 1; } Modified: trunk/e/src/modules/everything/e_mod_main.h =================================================================== --- trunk/e/src/modules/everything/e_mod_main.h 2009-06-08 16:01:27 UTC (rev 40973) +++ trunk/e/src/modules/everything/e_mod_main.h 2009-06-08 16:37:40 UTC (rev 40974) @@ -10,6 +10,30 @@ #undef E_TYPEDEFS #include "evry.h" +typedef struct _Config Config; +typedef struct _Source_Config Source_Config; + +struct _Config +{ + /* position */ + double rel_x, rel_y; + /* size */ + int width, height; + + /* generic plugin config */ + Eina_List *sources; +}; + +struct _Source_Config +{ + const char *name; + + /* minimum input chars to query this source */ + int min_query; +}; + + + EAPI extern E_Module_Api e_modapi; EAPI void *e_modapi_init (E_Module *m); @@ -25,4 +49,6 @@ EAPI int evry_plug_config_init(void); EAPI int evry_plug_config_shutdown(void); +extern Config *evry_conf; + #endif Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-08 16:01:27 UTC (rev 40973) +++ trunk/e/src/modules/everything/evry.c 2009-06-08 16:37:40 UTC (rev 40974) @@ -2,8 +2,6 @@ #include "e_mod_main.h" #include "evry.h" -#define WIDTH 400 -#define HEIGHT 350 #define INPUTLEN 40 #define MATCH_LAG 0.33 @@ -91,7 +89,7 @@ evry_show(E_Zone *zone) { Evas_Object *o; - int x, y, w, h; + int x, y; E_OBJECT_CHECK_RETURN(zone, 0); E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); @@ -108,12 +106,10 @@ return 0; } - w = WIDTH; - h = HEIGHT; - x = zone->x + (zone->w / 2) - (w / 2); - y = zone->y + (zone->h / 2) - (h / 2); + x = zone->x + (zone->w / 2) - (evry_conf->width / 2); + y = zone->y + (zone->h / 2) - (evry_conf->height / 2); - popup = e_popup_new(zone, x, y, w, h); + popup = e_popup_new(zone, x, y, evry_conf->width, evry_conf->height); if (!popup) return 0; cmd_buf = malloc(INPUTLEN); @@ -146,7 +142,7 @@ o = o_main; evas_object_move(o, 0, 0); - evas_object_resize(o, w, h); + evas_object_resize(o, evry_conf->width, evry_conf->height); evas_object_show(o); e_popup_edje_bg_object_set(popup, o); @@ -567,17 +563,16 @@ snprintf(buf, 64, "%s (%d)", plugin->name, eina_list_count(plugin->candidates)); - e_widget_toolbar_item_append(o_toolbar, - NULL, buf, - _evry_cb_plugin_sel, - plugin, NULL); + e_widget_toolbar_item_append(o_toolbar, NULL, buf, + _evry_cb_plugin_sel, plugin, NULL); cur_sources = eina_list_append(cur_sources, plugin); plugin_count++; } } - if (!cur_source && (plugin_count > 0)) + if ((!cur_source || !eina_list_data_find(cur_sources, cur_source)) && + (plugin_count > 0)) { _evry_show_candidates(cur_sources->data); } |
From: Enlightenment S. <no-...@en...> - 2009-06-11 14:50:41
|
Log: 'everything' module: - fix possible segv in evry_plug_config - enabled main menu augmentation - smooth scrolling is back Author: jeffdameth Date: 2009-06-11 07:50:34 -0700 (Thu, 11 Jun 2009) New Revision: 41007 Modified: trunk/e/src/modules/everything/e_mod_main.c trunk/e/src/modules/everything/e_mod_main.h trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_config.c Modified: trunk/e/src/modules/everything/e_mod_main.c =================================================================== --- trunk/e/src/modules/everything/e_mod_main.c 2009-06-11 13:33:43 UTC (rev 41006) +++ trunk/e/src/modules/everything/e_mod_main.c 2009-06-11 14:50:34 UTC (rev 41007) @@ -49,6 +49,8 @@ E_CONFIG_VAL(D, T, height, INT); E_CONFIG_VAL(D, T, rel_x, DOUBLE); E_CONFIG_VAL(D, T, rel_y, DOUBLE); + E_CONFIG_VAL(D, T, scroll_animate, INT); + E_CONFIG_VAL(D, T, scroll_speed, DOUBLE); E_CONFIG_LIST(D, T, sources, conf_item_edd); #undef T #undef D @@ -61,6 +63,8 @@ evry_conf->rel_y = 50.0; evry_conf->width = 400; evry_conf->height = 350; + evry_conf->scroll_animate = 1; + evry_conf->scroll_speed = 0.5; } conf_module = m; @@ -78,8 +82,11 @@ e_action_predef_name_set(_("Launch"), _("Run Everything Dialog"), "everything", NULL, NULL, 0); } - /* maug = e_int_menus_menu_augmentation_add("main/1", _e_mod_menu_add, NULL, NULL, NULL); */ + + maug = e_int_menus_menu_augmentation_add("main/1", _e_mod_menu_add, NULL, NULL, NULL); + e_module_delayed_set(m, 1); + return m; } @@ -87,11 +94,11 @@ e_modapi_shutdown(E_Module *m) { /* remove module-supplied menu additions */ - /* if (maug) - * { - * e_int_menus_menu_augmentation_del("main/1", maug); - * maug = NULL; - * } */ + if (maug) + { + e_int_menus_menu_augmentation_del("main/1", maug); + maug = NULL; + } /* remove module-supplied action */ if (act) { @@ -159,13 +166,13 @@ } /* menu item add hook */ -/* static void - * _e_mod_menu_add(void *data, E_Menu *m) - * { - * E_Menu_Item *mi; - * - * mi = e_menu_item_new(m); - * e_menu_item_label_set(mi, _("Run Command")); - * e_util_menu_item_theme_icon_set(mi, "system-run"); - * e_menu_item_callback_set(mi, _e_mod_run_cb, NULL); - * } */ +static void +_e_mod_menu_add(void *data, E_Menu *m) +{ + E_Menu_Item *mi; + + mi = e_menu_item_new(m); + e_menu_item_label_set(mi, _("Run Everything")); + e_util_menu_item_theme_icon_set(mi, "system-run"); + e_menu_item_callback_set(mi, _e_mod_run_cb, NULL); +} Modified: trunk/e/src/modules/everything/e_mod_main.h =================================================================== --- trunk/e/src/modules/everything/e_mod_main.h 2009-06-11 13:33:43 UTC (rev 41006) +++ trunk/e/src/modules/everything/e_mod_main.h 2009-06-11 14:50:34 UTC (rev 41007) @@ -22,6 +22,9 @@ /* generic plugin config */ Eina_List *sources; + + int scroll_animate; + double scroll_speed; }; struct _Source_Config Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-11 13:33:43 UTC (rev 41006) +++ trunk/e/src/modules/everything/evry.c 2009-06-11 14:50:34 UTC (rev 41007) @@ -31,7 +31,10 @@ static void _evry_item_remove(Evry_Item *it); static void _evry_action(int finished); static void _evry_cb_plugin_sel(void *data1, void *data2); +static int _evry_animator(void *data); +static int _evry_scroll_timer(void *data); + /* local subsystem globals */ static E_Popup *popup = NULL; static Ecore_X_Window input_window = 0; @@ -42,19 +45,20 @@ static char *cmd_buf = NULL; static Eina_List *handlers = NULL; static Ecore_Timer *update_timer = NULL; -static Eina_List *plugins = NULL; -static int plugin_count; + +static Eina_List *sources = NULL; +static Eina_List *cur_sources = NULL; static Evry_Plugin *cur_source; -static Eina_List *cur_sources = NULL; static Evry_Item *item_selected = NULL; static Evry_Item *item_mouseover = NULL; -static int ev_last_is_mouse; -/* static Ecore_Animator *animator = NULL; */ +static Ecore_Animator *scroll_animator = NULL; +static Ecore_Timer *scroll_timer = NULL; static double scroll_align_to; static double scroll_align; +static int ev_last_is_mouse; /* externally accessible functions */ @@ -74,14 +78,14 @@ EAPI void evry_plugin_add(Evry_Plugin *plugin) { - plugins = eina_list_append(plugins, plugin); + sources = eina_list_append(sources, plugin); /* TODO sorting, initialization, etc */ } EAPI void evry_plugin_remove(Evry_Plugin *plugin) { - plugins = eina_list_remove(plugins, plugin); + sources = eina_list_remove(sources, plugin); /* cleanup */ } @@ -195,13 +199,23 @@ ecore_timer_del(update_timer); update_timer = NULL; } + if (scroll_timer) + { + ecore_timer_del(scroll_timer); + scroll_timer = NULL; + } + if (scroll_animator) + { + ecore_animator_del(scroll_animator); + scroll_animator = NULL; + } evas_event_freeze(popup->evas); _evry_matches_clear(); e_popup_hide(popup); e_box_freeze(o_list); - EINA_LIST_FOREACH(plugins, l, plugin) + EINA_LIST_FOREACH(sources, l, plugin) { plugin->cleanup(); } @@ -542,13 +556,14 @@ Eina_List *l; char buf[64]; int candidates; + int plugin_count = 0; + + _evry_matches_clear(); - _evry_matches_clear(); - plugin_count = 0; eina_list_free(cur_sources); cur_sources = NULL; - EINA_LIST_FOREACH(plugins, l, plugin) + EINA_LIST_FOREACH(sources, l, plugin) { if (strlen(cmd_buf) == 0) { @@ -609,7 +624,7 @@ _evry_list_clear(); - EINA_LIST_FOREACH(plugins, l, plugin) + EINA_LIST_FOREACH(sources, l, plugin) plugin->cleanup(); } @@ -647,19 +662,18 @@ if (n > 1) { scroll_align_to = (double)i / (double)(n - 1); - /* if (e_config->everything_scroll_animate) - * { - * eap_scroll_to = 1; - * if (!eap_scroll_timer) - * eap_scroll_timer = ecore_timer_add(0.01, _evry_eap_scroll_timer, NULL); - * if (!animator) - * animator = ecore_animator_add(_evry_animator, NULL); - * } - * else */ - { - scroll_align = scroll_align_to; - e_box_align_set(o_list, 0.5, 1.0 - scroll_align); - } + if (evry_conf->scroll_animate) + { + if (!scroll_timer) + scroll_timer = ecore_timer_add(0.01, _evry_scroll_timer, NULL); + if (!scroll_animator) + scroll_animator = ecore_animator_add(_evry_animator, NULL); + } + else + { + scroll_align = scroll_align_to; + e_box_align_set(o_list, 0.5, 1.0 - scroll_align); + } } else e_box_align_set(o_list, 0.5, 1.0); @@ -784,7 +798,7 @@ if (!cur_source) return; - l = eina_list_data_find_list(plugins, cur_source); + l = eina_list_data_find_list(cur_sources, cur_source); if (l && l->prev) { @@ -801,3 +815,37 @@ } } +static int +_evry_scroll_timer(void *data) +{ + if (scroll_animator) + { + double spd; + + spd = evry_conf->scroll_speed; + scroll_align = (scroll_align * (1.0 - spd)) + (scroll_align_to * spd); + return 1; + } + scroll_timer = NULL; + return 0; +} + +static int +_evry_animator(void *data) +{ + double da; + int scroll_to = 1; + + da = scroll_align - scroll_align_to; + if (da < 0.0) da = -da; + if (da < 0.01) + { + scroll_align = scroll_align_to; + scroll_to = 0; + } + e_box_align_set(o_list, 0.5, 1.0 - scroll_align); + if (scroll_to) return 1; + scroll_animator = NULL; + return 0; +} + Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-06-11 13:33:43 UTC (rev 41006) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-06-11 14:50:34 UTC (rev 41007) @@ -61,9 +61,6 @@ } } - printf("path: %s\n", buf); - - if (found) e_configure_registry_call(buf, con, NULL); @@ -140,7 +137,7 @@ _evry_plug_config_item_icon_get(Evry_Item *it, Evas *e) { E_Configure_It *eci = it->data; - Evas_Object *o; + Evas_Object *o = NULL; if (eci->icon) { |
From: Enlightenment S. <no-...@en...> - 2009-06-21 10:32:40
|
Log: 'everything' module: - added (still simple) plugins for tracker, file-open and directory browser - 'tab' shows available actions for a candidate Author: jeffdameth Date: 2009-06-21 03:31:38 -0700 (Sun, 21 Jun 2009) New Revision: 41135 Added: trunk/e/src/modules/everything/evry_config.c trunk/e/src/modules/everything/evry_plug_dir_browse.c trunk/e/src/modules/everything/evry_plug_file_open.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/Makefile.am trunk/e/src/modules/everything/e_mod_main.c trunk/e/src/modules/everything/e_mod_main.h trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry.h trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_config.c Modified: trunk/e/src/modules/everything/Makefile.am =================================================================== --- trunk/e/src/modules/everything/Makefile.am 2009-06-20 19:13:11 UTC (rev 41134) +++ trunk/e/src/modules/everything/Makefile.am 2009-06-21 10:31:38 UTC (rev 41135) @@ -22,9 +22,12 @@ e_mod_main.h \ evry.c \ evry.h \ + evry_plug_config.c \ evry_plug_apps.c \ + evry_plug_file_open.c \ + evry_plug_tracker.c \ evry_plug_border.c \ - evry_plug_config.c + evry_plug_dir_browse.c module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LDFLAGS = -module -avoid-version @@ -32,3 +35,4 @@ uninstall: rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE) + Modified: trunk/e/src/modules/everything/e_mod_main.c =================================================================== --- trunk/e/src/modules/everything/e_mod_main.c 2009-06-20 19:13:11 UTC (rev 41134) +++ trunk/e/src/modules/everything/e_mod_main.c 2009-06-21 10:31:38 UTC (rev 41135) @@ -73,6 +73,9 @@ evry_plug_border_init(); evry_plug_apps_init(); evry_plug_config_init(); + evry_plug_dir_browse_init(); + evry_plug_file_open_init(); + evry_plug_tracker_init(); /* add module supplied action */ act = e_action_add("everything"); @@ -110,6 +113,9 @@ evry_plug_border_shutdown(); evry_plug_apps_shutdown(); evry_plug_config_shutdown(); + evry_plug_dir_browse_shutdown(); + evry_plug_file_open_shutdown(); + evry_plug_tracker_shutdown(); evry_shutdown(); conf_module = NULL; Modified: trunk/e/src/modules/everything/e_mod_main.h =================================================================== --- trunk/e/src/modules/everything/e_mod_main.h 2009-06-20 19:13:11 UTC (rev 41134) +++ trunk/e/src/modules/everything/e_mod_main.h 2009-06-21 10:31:38 UTC (rev 41135) @@ -25,6 +25,8 @@ int scroll_animate; double scroll_speed; + + int auto_select_first; }; struct _Source_Config @@ -52,6 +54,15 @@ EAPI int evry_plug_config_init(void); EAPI int evry_plug_config_shutdown(void); +EAPI int evry_plug_tracker_init(void); +EAPI int evry_plug_tracker_shutdown(void); + +EAPI int evry_plug_dir_browse_init(void); +EAPI int evry_plug_dir_browse_shutdown(void); + +EAPI int evry_plug_file_open_init(void); +EAPI int evry_plug_file_open_shutdown(void); + extern Config *evry_conf; #endif Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-20 19:13:11 UTC (rev 41134) +++ trunk/e/src/modules/everything/evry.c 2009-06-21 10:31:38 UTC (rev 41135) @@ -5,6 +5,19 @@ #define INPUTLEN 40 #define MATCH_LAG 0.33 + +typedef struct _Evry_State Evry_State; + +struct _Evry_State +{ + Eina_List *cur_plugins; + Eina_List *plugins; + Evry_Plugin *cur_plugin; + Evry_Item *sel_item; + /* Eina_List *sel_items; */ + char *input; +}; + static int _evry_cb_key_down(void *data, int type, void *event); static int _evry_cb_key_down(void *data, int type, void *event); static int _evry_cb_mouse_down(void *data, int type, void *event); @@ -15,9 +28,8 @@ static void _evry_cb_item_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info); static void _evry_backspace(void); static void _evry_update(void); -static void _evry_matches_clear(void); static void _evry_list_clear(void); -static void _evry_show_candidates(Evry_Plugin *plugin); +static void _evry_show_items(Evry_Plugin *plugin); static int _evry_update_timer(void *data); static void _evry_matches_update(void); static void _evry_clear(void); @@ -28,29 +40,30 @@ static void _evry_scroll_to(int i); static void _evry_item_desel(Evry_Item *it); static void _evry_item_sel(Evry_Item *it); -static void _evry_item_remove(Evry_Item *it); static void _evry_action(int finished); +static void _evry_action_select(void); static void _evry_cb_plugin_sel(void *data1, void *data2); static int _evry_animator(void *data); static int _evry_scroll_timer(void *data); +static int _evry_push_state(void); +static int _evry_pop_state(void); +static void _evry_plugin_selector_append(Evry_Plugin *p); - /* local subsystem globals */ static E_Popup *popup = NULL; static Ecore_X_Window input_window = 0; static Evas_Object *o_list = NULL; static Evas_Object *o_main = NULL; -static Evas_Object *icon_object = NULL; -static Evas_Object *o_toolbar = NULL; -static char *cmd_buf = NULL; +static Evas_Object *o_selector = NULL; +static Evas_Object *o_selector_frame = NULL; static Eina_List *handlers = NULL; static Ecore_Timer *update_timer = NULL; -static Eina_List *sources = NULL; -static Eina_List *cur_sources = NULL; -static Evry_Plugin *cur_source; +static Eina_List *plugins = NULL; +static Evry_State *cur_state = NULL; +static Eina_List *stack = NULL; -static Evry_Item *item_selected = NULL; +static int ev_last_is_mouse; static Evry_Item *item_mouseover = NULL; static Ecore_Animator *scroll_animator = NULL; @@ -58,9 +71,7 @@ static double scroll_align_to; static double scroll_align; -static int ev_last_is_mouse; - /* externally accessible functions */ EAPI int evry_init(void) @@ -76,16 +87,16 @@ } EAPI void -evry_plugin_add(Evry_Plugin *plugin) +evry_plugin_register(Evry_Plugin_Class *plugin) { - sources = eina_list_append(sources, plugin); + plugins = eina_list_append(plugins, plugin); /* TODO sorting, initialization, etc */ } EAPI void -evry_plugin_remove(Evry_Plugin *plugin) +evry_plugin_unregister(Evry_Plugin_Class *plugin) { - sources = eina_list_remove(sources, plugin); + plugins = eina_list_remove(plugins, plugin); /* cleanup */ } @@ -116,16 +127,7 @@ popup = e_popup_new(zone, x, y, evry_conf->width, evry_conf->height); if (!popup) return 0; - cmd_buf = malloc(INPUTLEN); - if (!cmd_buf) - { - e_object_del(E_OBJECT(popup)); - return 0; - } - ecore_x_netwm_window_type_set(popup->evas_win, ECORE_X_WINDOW_TYPE_UTILITY); - - cmd_buf[0] = 0; e_popup_layer_set(popup, 255); evas_event_freeze(popup->evas); @@ -135,7 +137,6 @@ o_main = o; e_theme_edje_object_set(o, "base/theme/everything", "e/widgets/everything/main"); - edje_object_part_text_set(o, "e.text.label", cmd_buf); o = e_box_add(popup->evas); o_list = o; @@ -150,12 +151,13 @@ evas_object_show(o); e_popup_edje_bg_object_set(popup, o); - o = e_widget_toolbar_add(popup->evas, 48 * e_scale, 48 * e_scale); - e_widget_toolbar_scrollable_set(o, 0); + o = e_box_add(popup->evas); + e_box_orientation_set(o, 1); + e_box_homogenous_set(o, 1); edje_object_part_swallow(o_main, "e.swallow.bar", o); evas_object_show(o); - o_toolbar = o; - + o_selector = o; + evas_event_thaw(popup->evas); handlers = eina_list_append @@ -174,11 +176,7 @@ (handlers, ecore_event_handler_add (ECORE_EVENT_MOUSE_WHEEL, _evry_cb_mouse_wheel, NULL)); - _evry_matches_update(); - - ev_last_is_mouse = 0; - item_mouseover = NULL; - item_selected = NULL; + _evry_push_state(); e_popup_show(popup); return 1; @@ -191,9 +189,26 @@ char *str; Evry_Plugin *plugin; Eina_List *l; - + Evry_State *s; + if (!popup) return; + evas_event_freeze(popup->evas); + + _evry_list_clear(); + + EINA_LIST_FREE(stack, s) + { + Evry_Plugin *p; + + free(s->input); + + EINA_LIST_FREE(s->plugins, p) + p->class->free(p); + } + stack = NULL; + cur_state = NULL; + if (update_timer) { ecore_timer_del(update_timer); @@ -210,22 +225,13 @@ scroll_animator = NULL; } - evas_event_freeze(popup->evas); - _evry_matches_clear(); e_popup_hide(popup); - - e_box_freeze(o_list); - EINA_LIST_FOREACH(sources, l, plugin) - { - plugin->cleanup(); - } - e_box_thaw(o_list); - + evas_object_del(o_list); o_list = NULL; - evas_object_del(o_toolbar); - o_toolbar = NULL; + evas_object_del(o_selector); + o_selector = NULL; evas_object_del(o_main); o_main = NULL; @@ -240,21 +246,172 @@ ecore_x_window_free(input_window); e_grabinput_release(input_window, input_window); input_window = 0; - free(cmd_buf); - cmd_buf = NULL; +} - cur_source = NULL; - item_selected = NULL; - item_mouseover = NULL; + +EAPI void +evry_plugin_async_update(Evry_Plugin *plugin, int state) +{ + Evry_State *s; + + if (!popup) return; + + s = cur_state; + + if (!eina_list_data_find(s->cur_plugins, plugin)) + { + s->cur_plugins = eina_list_append(s->cur_plugins, plugin); + _evry_plugin_selector_append(plugin); + } + + if (s->cur_plugin && eina_list_data_find(s->cur_plugins, s->cur_plugin)) + _evry_show_items(s->cur_plugin); + else if (!s->cur_plugin && s->cur_plugins) + _evry_show_items(s->cur_plugins->data); + else if (s->cur_plugins && !eina_list_data_find(s->cur_plugins, s->cur_plugin)) + _evry_show_items(s->cur_plugins->data); } /* local subsystem functions */ static int +_evry_push_state(void) +{ + Evry_State *s; + Eina_List *l, *list = NULL; + Evry_Plugin_Class *pc; + const char *expect_type = "NONE"; + Evry_Plugin *p; + + s = cur_state; + + if (s) + { + expect_type = s->cur_plugin->class->type_out; + if (!strcmp(expect_type, "NONE") || !s->sel_item) + return 0; + } + + EINA_LIST_FOREACH(plugins, l, pc) + { + if (strstr(pc->type_in, expect_type)) + { + p = pc->new(); + + if (!p) continue; + + if (cur_state && p->begin) + { + if (p->begin(p, cur_state->sel_item)) + list = eina_list_append(list, p); + else + p->class->free(p); + } + else + list = eina_list_append(list, p); + } + } + + if (!list) return 0; + + _evry_list_clear(); + + if (s) + { + EINA_LIST_FOREACH(s->cur_plugins, l, p) + { + evas_object_del(p->tab); + p->tab = NULL; + } + } + + s = E_NEW(Evry_State, 1); + s->input = malloc(INPUTLEN); + s->input[0] = 0; + s->plugins = list; + s->cur_plugins = NULL; + s->sel_item = NULL; + cur_state = s; + stack = eina_list_prepend(stack, s); + + edje_object_part_text_set(o_main, "e.text.label", s->input); + + ev_last_is_mouse = 0; + item_mouseover = NULL; + + _evry_matches_update(); + + return 1; +} + +static int +_evry_pop_state(void) +{ + Evry_State *s = cur_state; + Evry_Plugin *p; + Eina_List *l; + + _evry_list_clear(); + + EINA_LIST_FREE(s->cur_plugins, p) + { + evas_object_del(p->tab); + p->tab = NULL; + } + + free(s->input); + + EINA_LIST_FOREACH(s->plugins, l, p) + p->class->free(p); + + E_FREE(s); + + stack = eina_list_remove_list(stack, stack); + + if (stack) + { + s = stack->data; + cur_state = s; + + edje_object_part_text_set(o_main, "e.text.label", s->input); + + EINA_LIST_FOREACH(s->cur_plugins, l, p) + _evry_plugin_selector_append(p); + + _evry_show_items(s->cur_plugin); + + if (s->sel_item) + { + Evry_Item *it; + int i = 0; + + _evry_item_sel(s->sel_item); + + EINA_LIST_FOREACH(s->cur_plugin->items, l, it) + if (it == s->sel_item) + break; + else i++; + + _evry_scroll_to(i); + } + } + else + { + cur_state = NULL; + evry_hide(); + } + + ev_last_is_mouse = 0; + item_mouseover = NULL; +} + + +static int _evry_cb_key_down(void *data, int type, void *event) { Ecore_Event_Key *ev; - + Evry_State *s = cur_state; ev_last_is_mouse = 0; + item_mouseover = NULL; ev = event; if (ev->event_window != input_window) return 1; @@ -272,13 +429,15 @@ _evry_action(0); else if (!strcmp(ev->key, "Return")) _evry_action(1); - /* else if (!strcmp(ev->key, "Tab")) - * _evry_complete(); */ + else if (!strcmp(ev->key, "Tab")) + _evry_push_state(); else if (!strcmp(ev->key, "u") && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) _evry_clear(); - else if (!strcmp(ev->key, "Escape")) - evry_hide(); + else if ((!strcmp(ev->key, "Escape")) || + (!strcmp(ev->key, "g") && + (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL))) + _evry_pop_state(); else if (!strcmp(ev->key, "BackSpace")) _evry_backspace(); else if (!strcmp(ev->key, "Delete")) @@ -287,9 +446,9 @@ { if (ev->compose) { - if ((strlen(cmd_buf) < (INPUTLEN - strlen(ev->compose)))) + if ((strlen(s->input) < (INPUTLEN - strlen(ev->compose)))) { - strcat(cmd_buf, ev->compose); + strcat(s->input, ev->compose); _evry_update(); } } @@ -301,17 +460,18 @@ _evry_cb_mouse_down(void *data, int type, void *event) { Ecore_Event_Mouse_Button *ev; + Evry_State *s =cur_state; ev = event; if (ev->event_window != input_window) return 1; if (item_mouseover) { - if (item_selected != item_mouseover) + if (s->sel_item != item_mouseover) { - if (item_selected) _evry_item_desel(item_selected); - item_selected = item_mouseover; - _evry_item_sel(item_selected); + if (s->sel_item) _evry_item_desel(s->sel_item); + s->sel_item = item_mouseover; + _evry_item_sel(s->sel_item); } } else @@ -349,7 +509,8 @@ _evry_cb_mouse_move(void *data, int type, void *event) { Ecore_Event_Mouse_Move *ev; - + Evry_State *s =cur_state; + ev = event; if (ev->event_window != input_window) return 1; @@ -358,12 +519,12 @@ ev_last_is_mouse = 1; if (item_mouseover) { - if (item_selected && (item_selected != item_mouseover)) - _evry_item_desel(item_selected); - if (!item_selected || (item_selected != item_mouseover)) + if (s->sel_item && (s->sel_item != item_mouseover)) + _evry_item_desel(s->sel_item); + if (!s->sel_item || (s->sel_item != item_mouseover)) { - item_selected = item_mouseover; - _evry_item_sel(item_selected); + s->sel_item = item_mouseover; + _evry_item_sel(s->sel_item); } } } @@ -403,12 +564,15 @@ _evry_cb_item_mouse_in(void *data, Evas *evas, Evas_Object *obj, void *event_info) { - item_mouseover = data; + Evry_State *s =cur_state; + if (!ev_last_is_mouse) return; - if (item_selected) _evry_item_desel(item_selected); - if (!(item_selected = data)) return; - _evry_item_sel(item_selected); + item_mouseover = data; + + if (s->sel_item) _evry_item_desel(s->sel_item); + if (!(s->sel_item = data)) return; + _evry_item_sel(s->sel_item); } static void @@ -418,27 +582,19 @@ item_mouseover = NULL; } - static void -_evry_cb_plugin_sel(void *data1, void *data2) -{ - if (cur_source == data1) return; - - _evry_show_candidates(data1); -} - -static void _evry_backspace(void) { int len, val, pos; - - len = strlen(cmd_buf); + Evry_State *s = cur_state; + + len = strlen(s->input); if (len > 0) { - pos = evas_string_char_prev_get(cmd_buf, len, &val); + pos = evas_string_char_prev_get(s->input, len, &val); if ((pos < len) && (pos >= 0)) { - cmd_buf[pos] = 0; + s->input[pos] = 0; _evry_update(); } } @@ -449,25 +605,38 @@ { Efreet_Desktop *desktop; Evas_Object *o; + + edje_object_part_text_set(o_main, "e.text.label", cur_state->input); - edje_object_part_text_set(o_main, "e.text.label", cmd_buf); - - if (icon_object) evas_object_del(icon_object); - icon_object = NULL; - if (update_timer) ecore_timer_del(update_timer); update_timer = ecore_timer_add(MATCH_LAG, _evry_update_timer, NULL); } +static int +_evry_update_timer(void *data) +{ + _evry_matches_update(); + update_timer = NULL; + return 0; +} + static void _evry_action(int finished) { - if (cur_source && item_selected) + Evry_State *s = cur_state; + + if (s->cur_plugin && s->sel_item) { - cur_source->action(item_selected); + if (!s->cur_plugin->action || + !s->cur_plugin->action(s->cur_plugin, s->sel_item)) + { + /* _evry_action_select(); */ + _evry_push_state(); + finished = 0; + } } else - e_exec(popup->zone, NULL, cmd_buf, NULL, "everything"); + e_exec(popup->zone, NULL, s->input, NULL, "everything"); if (finished) evry_hide(); @@ -476,9 +645,9 @@ static void _evry_clear(void) { - if (cmd_buf[0] != 0) + if (cur_state->input[0] != 0) { - cmd_buf[0] = 0; + cur_state->input[0] = 0; _evry_update(); if (!update_timer) update_timer = ecore_timer_add(MATCH_LAG, _evry_update_timer, NULL); @@ -486,20 +655,33 @@ } static void -_evry_show_candidates(Evry_Plugin *plugin) +_evry_show_items(Evry_Plugin *p) { Evry_Item *it; Eina_List *l; int mw, mh, h; Evas_Object *o; - int i = 0; + Evry_State *s = cur_state; + + _evry_list_clear(); - _evry_list_clear(); - cur_source = plugin; + if (s->cur_plugin) + edje_object_signal_emit(s->cur_plugin->tab, "e,state,unselected", "e"); + + if (s->cur_plugin != p) + s->sel_item = NULL; + s->cur_plugin = p; + + /* XXX remove this */ + if (!s->cur_plugin) return; + + edje_object_signal_emit(p->tab, "e,state,selected", "e"); + + evas_event_freeze(popup->evas); e_box_freeze(o_list); - EINA_LIST_FOREACH(cur_source->candidates, l, it) + EINA_LIST_FOREACH(p->items, l, it) { o = edje_object_add(popup->evas); it->o_bg = o; @@ -514,7 +696,7 @@ _evry_cb_item_mouse_out, it); evas_object_show(o); - cur_source->icon_get(it, popup->evas); + p->icon_get(p, it, popup->evas); if (edje_object_part_exists(o, "e.swallow.icons") && it->o_icon) { edje_object_part_swallow(o, "e.swallow.icons", it->o_icon); @@ -522,13 +704,7 @@ } edje_object_size_min_calc(o, &mw, &mh); e_box_pack_end(o_list, o); - e_box_pack_options_set(o, - 1, 1, /* fill */ - 1, 0, /* expand */ - 0.5, 0.5, /* align */ - mw, mh, /* min */ - 9999, mh /* max */ - ); + e_box_pack_options_set(o, 1, 1, 1, 0, 0.5, 0.5, mw, mh, 9999, mh); } e_box_thaw(o_list); @@ -539,112 +715,83 @@ else e_box_align_set(o_list, 0.5, 1.0); - EINA_LIST_FOREACH(cur_sources, l, plugin) - if (plugin == cur_source) - break; - else i++; + /* TODO add option */ - e_widget_toolbar_item_select(o_toolbar, i); + if (p->items) + { + s->sel_item = p->items->data; + _evry_item_sel(s->sel_item); + _evry_scroll_to(0); + } evas_event_thaw(popup->evas); } static void -_evry_matches_update() +_evry_matches_update(void) { - Evry_Plugin *plugin; + Evry_Plugin *p; Eina_List *l; - char buf[64]; - int candidates; - int plugin_count = 0; + int items; + Evry_State *s = cur_state; - _evry_matches_clear(); - - eina_list_free(cur_sources); - cur_sources = NULL; + _evry_list_clear(); - EINA_LIST_FOREACH(sources, l, plugin) + EINA_LIST_FREE(s->cur_plugins, p) { - if (strlen(cmd_buf) == 0) - { - candidates = !plugin->need_query ? plugin->fetch(NULL) : 0; - } + evas_object_del(p->tab); + p->tab = NULL; + } + + s->cur_plugins = NULL; + s->sel_item = NULL; + + EINA_LIST_FOREACH(s->plugins, l, p) + { + if (strlen(s->input) == 0) + items = !p->class->need_query ? p->fetch(p, NULL) : 0; else + items = p->fetch(p, s->input); + + if (items && eina_list_count(p->items) > 0) { - candidates = plugin->fetch(cmd_buf); + s->cur_plugins = eina_list_append(s->cur_plugins, p); + _evry_plugin_selector_append(p); } - if (candidates) - { - snprintf(buf, 64, "%s (%d)", plugin->name, - eina_list_count(plugin->candidates)); - - e_widget_toolbar_item_append(o_toolbar, NULL, buf, - _evry_cb_plugin_sel, plugin, NULL); - - cur_sources = eina_list_append(cur_sources, plugin); - plugin_count++; - } } - - if ((!cur_source || !eina_list_data_find(cur_sources, cur_source)) && - (plugin_count > 0)) + + if ((s->cur_plugins) && + (!s->cur_plugin || !eina_list_data_find(s->cur_plugins, s->cur_plugin))) { - _evry_show_candidates(cur_sources->data); + _evry_show_items(s->cur_plugins->data); } - - else if (cur_source) + else if (s->cur_plugin) { - _evry_show_candidates(cur_source); + _evry_show_items(s->cur_plugin); } } static void -_evry_item_remove(Evry_Item *it) -{ - evas_object_del(it->o_bg); - if (it->o_icon) evas_object_del(it->o_icon); - it->o_icon = NULL; -} - -static void -_evry_matches_clear(void) -{ - Evry_Plugin *plugin; - Eina_List *l; - - // FIXME add toolbar item remove method or use sth different - evas_object_del(o_toolbar); - Evas_Object *o = e_widget_toolbar_add(popup->evas, - 48 * e_scale, - 48 * e_scale); - e_widget_toolbar_scrollable_set(o, 0); - edje_object_part_swallow(o_main, "e.swallow.bar", o); - evas_object_show(o); - o_toolbar = o; - - _evry_list_clear(); - - EINA_LIST_FOREACH(sources, l, plugin) - plugin->cleanup(); -} - -static void _evry_list_clear(void) { - Evry_Item *it; - Eina_List *l; + Evry_State *s = cur_state; - if (cur_source) + if (s && s->cur_plugin) { + Evry_Item *it; + Eina_List *l; + evas_event_freeze(popup->evas); e_box_freeze(o_list); - EINA_LIST_FOREACH(cur_source->candidates, l, it) - _evry_item_remove(it); + EINA_LIST_FOREACH(s->cur_plugin->items, l, it) + { + evas_object_del(it->o_bg); + if (it->o_icon) evas_object_del(it->o_icon); + it->o_icon = NULL; + } e_box_thaw(o_list); evas_event_thaw(popup->evas); } - - item_selected = NULL; } static void @@ -652,7 +799,7 @@ { int n, h, mh; - n = eina_list_count(cur_source->candidates); + n = eina_list_count(cur_state->cur_plugin->items); e_box_min_size_get(o_list, NULL, &mh); evas_object_geometry_get(o_list, NULL, NULL, NULL, &h); @@ -695,46 +842,39 @@ edje_object_signal_emit(it->o_icon, "e,state,selected", "e"); } -static int -_evry_update_timer(void *data) -{ - _evry_matches_update(); - update_timer = NULL; - return 0; -} - static void _evry_item_next(void) { Eina_List *l; int i; + Evry_State *s = cur_state; - if (item_selected) + if (s->sel_item) { - for (i = 0, l = cur_source->candidates; l; l = l->next, i++) + for (i = 0, l = s->cur_plugin->items; l; l = l->next, i++) { - if (l->data == item_selected) + if (l->data == s->sel_item) { if (l->next) { - _evry_item_desel(item_selected); - item_selected = l->next->data; - _evry_item_sel(item_selected); + _evry_item_desel(s->sel_item); + s->sel_item = l->next->data; + _evry_item_sel(s->sel_item); _evry_scroll_to(i + 1); } break; } } } - else if (cur_source->candidates) + else if (s->cur_plugin->items) { - item_selected = cur_source->candidates->data; - _evry_item_sel(item_selected); + s->sel_item = s->cur_plugin->items->data; + _evry_item_sel(s->sel_item); _evry_scroll_to(0); } - /* if (item_selected) - * edje_object_part_text_set(o_main, "e.text.label", item_selected->label); */ + /* if (s->sel_item) + * edje_object_part_text_set(o_main, "e.text.label", s->sel_item->label); */ } static void @@ -742,31 +882,32 @@ { Eina_List *l; int i; + Evry_State *s = cur_state; - if (item_selected) + if (s->sel_item) { - _evry_item_desel(item_selected); + _evry_item_desel(s->sel_item); - for (i = 0, l = cur_source->candidates; l; l = l->next, i++) + for (i = 0, l = s->cur_plugin->items; l; l = l->next, i++) { - if (l->data == item_selected) + if (l->data == s->sel_item) { if (l->prev) { - item_selected = l->prev->data; - _evry_item_sel(item_selected); + s->sel_item = l->prev->data; + _evry_item_sel(s->sel_item); _evry_scroll_to(i - 1); } else - item_selected = NULL; + s->sel_item = NULL; break; } } } - /* if (item_selected) - * edje_object_part_text_set(o_main, "e.text.label", item_selected->label); + /* if (s->sel_item) + * edje_object_part_text_set(o_main, "e.text.label", s->sel_item->label); * else - * edje_object_part_text_set(o_main, "e.text.label", cmd_buf); */ + * edje_object_part_text_set(o_main, "e.text.label", input); */ } static void @@ -774,18 +915,19 @@ { Eina_List *l; Evry_Plugin *plugin; + Evry_State *s = cur_state; + + if (!s->cur_plugin) return; - if (!cur_source) return; + l = eina_list_data_find_list(s->cur_plugins, s->cur_plugin); - l = eina_list_data_find_list(cur_sources, cur_source); - if (l && l->next) { - _evry_show_candidates(l->next->data); + _evry_show_items(l->next->data); } - else if (cur_source != cur_sources->data) + else if (s->cur_plugin != s->cur_plugins->data) { - _evry_show_candidates(cur_sources->data); + _evry_show_items(s->cur_plugins->data); } } @@ -795,22 +937,23 @@ { Eina_List *l; Evry_Plugin *plugin; + Evry_State *s = cur_state; + + if (!s->cur_plugin) return; - if (!cur_source) return; + l = eina_list_data_find_list(s->cur_plugins, s->cur_plugin); - l = eina_list_data_find_list(cur_sources, cur_source); - if (l && l->prev) { - _evry_show_candidates(l->prev->data); + _evry_show_items(l->prev->data); } else { - l = eina_list_last(cur_sources); + l = eina_list_last(s->cur_plugins); - if (cur_source != l->data) + if (s->cur_plugin != l->data) { - _evry_show_candidates(l->data); + _evry_show_items(l->data); } } } @@ -849,3 +992,29 @@ return 0; } +static void +_evry_plugin_selector_append(Evry_Plugin *p) +{ + Evas_Object *o; + Evas_Coord mw = 0, mh = 0; + + o = edje_object_add(popup->evas); + e_theme_edje_object_set(o, "base/theme/widgets", + "e/widgets/toolbar/item"); + + edje_object_part_text_set(o, "e.text.label", p->class->name); + + edje_object_size_min_calc(o, &mw, &mh); + e_box_pack_end(o_selector, o); + + evas_object_show(o); + e_box_pack_options_set(o, + 1, 1, /* fill */ + 0, 0, /* expand */ + 0.5, 0.5, /* align */ + mw, mh, /* min */ + 9999, 9999 /* max */ + ); + + p->tab = o; +} Modified: trunk/e/src/modules/everything/evry.h =================================================================== --- trunk/e/src/modules/everything/evry.h 2009-06-20 19:13:11 UTC (rev 41134) +++ trunk/e/src/modules/everything/evry.h 2009-06-21 10:31:38 UTC (rev 41135) @@ -4,6 +4,8 @@ #ifdef E_TYPEDEFS typedef struct _Evry_Plugin Evry_Plugin; +/* TODO find a better name - Registry ? */ +typedef struct _Evry_Plugin_Class Evry_Plugin_Class; typedef struct _Evry_Item Evry_Item; typedef struct _Evry_Action Evry_Action; typedef struct _Evry_Config Evry_Config; @@ -29,8 +31,12 @@ struct _Evry_Item { const char *label; + + const char *uri; + const char *mime; + + /* set by icon_get plugin method */ Evas_Object *o_icon; - unsigned int type; /* TODO */ /* used by 'everything' for display */ Evas_Object *o_bg; @@ -38,55 +44,61 @@ /* these are only for internally use by plugins */ /* used e.g. as pointer for item data (Efreet_Desktop) or */ /* for internal stuff, like priority hints for sorting, etc */ - void *data; + void *data[4]; int priority; }; -struct _Evry_Plugin +struct _Evry_Plugin_Class { const char *name; - const char *type; - Evas_Object *o_icon; - + + const char *type_in; + const char *type_out; + /* sync/async ?*/ - unsigned int async_query; + unsigned char async_query : 1; /* whether candidates can be shown without input: e.g. borders, history */ /* if 0 fetch MUST provide all candidates when string is NULL */ - // TODO better use 'need_query_length' ? - unsigned int need_query; + unsigned char need_query : 1; - /* run when 'everything' is shown */ - void (*begin) (void); + Evry_Plugin *(*new) (void); + void (*free) (Evry_Plugin *p); + + Evas_Object *(*config_page) (void); + void (*config_apply) (void); + Eina_List *instances; +}; + + +struct _Evry_Plugin +{ + Evry_Plugin_Class *class; + + /* run when plugin is activated. */ + int (*begin) (Evry_Plugin *p, Evry_Item *item); + /* get candidates matching string, fills 'candidates' list */ - int (*fetch) (char *string); + int (*fetch) (Evry_Plugin *p, char *string); /* run action with a given candidate - TODO register actions per candidate type */ - int (*action) (Evry_Item *item); + int (*action) (Evry_Plugin *p, Evry_Item *item); /* run before new query and when hiding 'everything' */ - void (*cleanup) (void); + void (*cleanup) (Evry_Plugin *p); - void (*icon_get) (Evry_Item *it, Evas *e); + void (*icon_get) (Evry_Plugin *p, Evry_Item *it, Evas *e); /* provide more information for a candidate */ /* int (*candidate_info) (Evas *evas, Evry_Item *item); */ - Evas_Object *(*config_page) (void); - void (*config_apply) (void); - - /* Evry_Plugin_State state; */ - Eina_List *candidates; -}; + Eina_List *items; -struct _Evry_Action -{ - const char *name; - const char *type; - int (*func) (Evry_Item *item); -}; + Evas_Object *tab; + void *priv; +}; struct _Evry_Config { @@ -108,12 +120,10 @@ EAPI int evry_show(E_Zone *zone); EAPI void evry_hide(void); -EAPI void evry_plugin_add(Evry_Plugin *plugin); -EAPI void evry_plugin_remove(Evry_Plugin *plugin); -EAPI void evry_action_add(Evry_Action *action); -EAPI void evry_action_remove(Evry_Action *action); +EAPI void evry_plugin_register(Evry_Plugin_Class *pc); +EAPI void evry_plugin_unregister(Evry_Plugin_Class *pc); -/* EAPI void evry_plugin_async_update(Evry_Plugin *plugin, int state); */ +EAPI void evry_plugin_async_update(Evry_Plugin *plugin, int state); EAPI Evas* evry_evas_get(void); #endif Added: trunk/e/src/modules/everything/evry_config.c Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-06-20 19:13:11 UTC (rev 41134) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-06-21 10:31:38 UTC (rev 41135) @@ -1,30 +1,34 @@ #include "e.h" #include "e_mod_main.h" -static Eina_Hash *added = NULL; -static Evry_Plugin plugin; +typedef struct _Inst Inst; -static int _evry_plug_apps_fetch(char *string); -static int _evry_plug_apps_action(Evry_Item *item); -static void _evry_plug_apps_cleanup(void); -static void _evry_plug_apps_item_add(Efreet_Desktop *desktop, char *file, int prio); -static int _evry_plug_apps_cb_sort(const void *data1, const void *data2); -static void _evry_plug_apps_item_icon_get(Evry_Item *it, Evas *e); +struct _Inst +{ + Eina_Hash *added; +}; +static Evry_Plugin *_plug_apps_new(); +static void _plug_apps_free(Evry_Plugin *p); +static int _plug_apps_fetch(Evry_Plugin *p, char *string); +static int _plug_apps_action(Evry_Plugin *p, Evry_Item *item); +static void _plug_apps_cleanup(Evry_Plugin *p); +static void _plug_apps_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio); +static int _plug_apps_cb_sort(const void *data1, const void *data2); +static void _plug_apps_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static Evry_Plugin_Class class; + EAPI int evry_plug_apps_init(void) { - plugin.name = "Applications"; - plugin.type = "APPLICATION"; - plugin.need_query = 0; - plugin.fetch = &_evry_plug_apps_fetch; - plugin.action = &_evry_plug_apps_action; - plugin.cleanup = &_evry_plug_apps_cleanup; - plugin.icon_get = &_evry_plug_apps_item_icon_get; - plugin.candidates = NULL; - - evry_plugin_add(&plugin); + class.name = "Applications"; + class.type_in = "NONE"; + class.type_out = "APPLICATION"; + class.need_query = 0; + class.new = &_plug_apps_new; + class.free = &_plug_apps_free; + evry_plugin_register(&class); return 1; } @@ -32,18 +36,47 @@ EAPI int evry_plug_apps_shutdown(void) { - evry_plugin_remove(&plugin); + evry_plugin_unregister(&class); return 1; } +static Evry_Plugin * +_plug_apps_new() +{ + Evry_Plugin *p = E_NEW(Evry_Plugin, 1); + p->class = &class; + p->fetch = &_plug_apps_fetch; + p->action = &_plug_apps_action; + p->cleanup = &_plug_apps_cleanup; + p->icon_get = &_plug_apps_item_icon_get; + p->items = NULL; + + Inst *inst = E_NEW(Inst, 1); + inst->added = NULL; + p->priv = inst; + + return p; +} + +static void +_plug_apps_free(Evry_Plugin *p) +{ + Inst *inst = p->priv; + + _plug_apps_cleanup(p); + + E_FREE(inst); + E_FREE(p); +} + static int -_evry_plug_apps_action(Evry_Item *item) +_plug_apps_action(Evry_Plugin *p, Evry_Item *item) { E_Zone *zone; Evry_App *app; - app = item->data; + app = item->data[0]; zone = e_util_zone_current_get(e_manager_current_get()); if (app->desktop) @@ -55,72 +88,72 @@ } static void -_evry_plug_apps_cleanup(void) +_plug_apps_cleanup(Evry_Plugin *p) { Evry_Item *it; Evry_App *app; - EINA_LIST_FREE(plugin.candidates, it) + EINA_LIST_FREE(p->items, it) { if (it->label) eina_stringshare_del(it->label); if (it->o_icon) evas_object_del(it->o_icon); - app = it->data; + app = it->data[0]; free(app); free(it); } } static int -_evry_plug_apps_fetch(char *string) +_plug_apps_fetch(Evry_Plugin *p, char *string) { char buf[4096]; Eina_List *list; Efreet_Desktop *desktop; char *file; + Inst *inst = p->priv; - _evry_plug_apps_cleanup(); + _plug_apps_cleanup(p); if (string) { snprintf(buf, sizeof(buf), "%s*", string); list = efreet_util_desktop_exec_glob_list(buf); EINA_LIST_FREE(list, desktop) - _evry_plug_apps_item_add(desktop, NULL, 1); + _plug_apps_item_add(p, desktop, NULL, 1); snprintf(buf, sizeof(buf), "*%s*", string); list = efreet_util_desktop_name_glob_list(buf); EINA_LIST_FREE(list, desktop) - _evry_plug_apps_item_add(desktop, NULL, 2); + _plug_apps_item_add(p, desktop, NULL, 2); // TODO make these optional/configurable snprintf(buf, sizeof(buf), "*%s*", string); list = efreet_util_desktop_generic_name_glob_list(buf); EINA_LIST_FREE(list, desktop) - _evry_plug_apps_item_add(desktop, NULL, 3); + _plug_apps_item_add(p, desktop, NULL, 3); snprintf(buf, sizeof(buf), "*%s*", string); list = efreet_util_desktop_comment_glob_list(buf); EINA_LIST_FREE(list, desktop) - _evry_plug_apps_item_add(desktop, NULL, 3); + _plug_apps_item_add(p, desktop, NULL, 3); } else { // TODO option for popular/recent list = e_exehist_list_get(); EINA_LIST_FREE(list, file) - _evry_plug_apps_item_add(NULL, file, 1); + _plug_apps_item_add(p, NULL, file, 1); } - if (added) + if (inst->added) { - eina_hash_free(added); - added = NULL; + eina_hash_free(inst->added); + inst->added = NULL; if (string) - plugin.candidates = - eina_list_sort(plugin.candidates, - eina_list_count(plugin.candidates), - _evry_plug_apps_cb_sort); + p->items = eina_list_sort(p->items, + eina_list_count(p->items), + _plug_apps_cb_sort); return 1; } @@ -128,26 +161,27 @@ } static void -_evry_plug_apps_item_add(Efreet_Desktop *desktop, char *file, int prio) +_plug_apps_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio) { Evry_Item *it; Evry_App *app; - + Inst *inst = p->priv; + if (desktop) file = ecore_file_app_exe_get(desktop->exec); if (!file) return; - if (eina_hash_find(added, file)) + if (eina_hash_find(inst->added, file)) { if (desktop) free(file); return; } - if (!added) - added = eina_hash_string_superfast_new(NULL); + if (!inst->added) + inst->added = eina_hash_string_superfast_new(NULL); - eina_hash_add(added, file, file); + eina_hash_add(inst->added, file, file); if (desktop) { @@ -164,7 +198,7 @@ app = calloc(1, sizeof(Evry_App)); app->desktop = desktop; app->file = file; - it->data = app; + it->data[0] = app; it->priority = prio; if (desktop) it->label = eina_stringshare_add(desktop->name); @@ -172,20 +206,20 @@ it->label = eina_stringshare_add(file); it->o_icon = NULL; - plugin.candidates = eina_list_append(plugin.candidates, it); + p->items = eina_list_append(p->items, it); } static void -_evry_plug_apps_item_icon_get(Evry_Item *it, Evas *e) +_plug_apps_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { - Evry_App *app = it->data; + Evry_App *app = it->data[0]; if (app->desktop) it->o_icon = e_util_desktop_icon_add(app->desktop, 24, e); } static int -_evry_plug_apps_cb_sort(const void *data1, const void *data2) +_plug_apps_cb_sort(const void *data1, const void *data2) { const Evry_Item *it1, *it2; Evry_App *app1, *app2; @@ -194,8 +228,8 @@ it1 = data1; it2 = data2; - app1 = it1->data; - app2 = it2->data; + app1 = it1->data[0]; + app2 = it2->data[0]; e1 = efreet_util_path_to_file_id(app1->desktop->orig_path); e2 = efreet_util_path_to_file_id(app2->desktop->orig_path); t1 = e_exehist_newest_run_get(e1); Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-06-20 19:13:11 UTC (rev 41134) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-06-21 10:31:38 UTC (rev 41135) @@ -1,32 +1,53 @@ #include "e.h" #include "e_mod_main.h" -static Evry_Plugin plugin; -static Evry_Action act_close; +typedef struct _Inst Inst; -static int _evry_plug_border_fetch(char *string); -static int _evry_plug_border_action(Evry_Item *item); -static void _evry_plug_border_cleanup(void); -static void _evry_plug_border_item_add(E_Border *bd, int prio); -static int _evry_plug_border_cb_sort(const void *data1, const void *data2); -static void _evry_plug_border_item_icon_get(Evry_Item *it, Evas *e); +struct _Inst +{ + E_Border *border; +}; +static Evry_Plugin * _src_border_new(void); +static void _src_border_free(Evry_Plugin *p); +static int _src_border_fetch(Evry_Plugin *p, char *string); +static int _src_border_action(Evry_Plugin *p, Evry_Item *item); +static void _src_border_cleanup(Evry_Plugin *p); +static void _src_border_item_add(Evry_Plugin *p, E_Border *bd, int prio); +static int _src_border_cb_sort(const void *data1, const void *data2); +static void _src_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); + +static Evry_Plugin * _act_border_new(void); +static void _act_border_free(Evry_Plugin *p); +static int _act_border_begin(Evry_Plugin *p, Evry_Item *item); +static int _act_border_fetch(Evry_Plugin *p, char *string); +static int _act_border_action(Evry_Plugin *p, Evry_Item *item); +static void _act_border_cleanup(Evry_Plugin *p); +static void _act_border_item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon); +static void _act_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); + +static Evry_Plugin_Class source; +static Evry_Plugin_Class action; + + EAPI int evry_plug_border_init(void) { - plugin.name = "Windows"; - plugin.type = "BORDER"; - plugin.need_query = 0; - plugin.fetch = &_evry_plug_border_fetch; - plugin.action = &_evry_plug_border_action; - plugin.cleanup = &_evry_plug_border_cleanup; - plugin.icon_get = &_evry_plug_border_item_icon_get; - plugin.candidates = NULL; - evry_plugin_add(&plugin); + source.name = "Windows"; + source.type_in = "NONE"; + source.type_out = "BORDER"; + source.need_query = 0; + source.new = &_src_border_new; + source.free = &_src_border_free; + evry_plugin_register(&source); - /* act_close.name = "Close"; - * act_close.type = "BORDER"; - * evry_action_add(&act_close); */ + action.name = "Window Action"; + action.type_in = "BORDER"; + action.type_out = "NONE"; + action.need_query = 0; + action.new = &_act_border_new; + action.free = &_act_border_free; + evry_plugin_register(&action); return 1; } @@ -34,19 +55,43 @@ EAPI int evry_plug_border_shutdown(void) { - evry_plugin_remove(&plugin); - /* evry_action_remove(&act_close); */ + evry_plugin_unregister(&source); + evry_plugin_unregister(&action); return 1; } +static Evry_Plugin * +_src_border_new() +{ + Evry_Plugin *p; + + p = E_NEW(Evry_Plugin, 1); + p->class = &source; + p->fetch = &_src_border_fetch; + p->action = &_src_border_action; + p->cleanup = &_src_border_cleanup; + p->icon_get = &_src_border_item_icon_get; + p->items = NULL; + + return p; +} + +static void +_src_border_free(Evry_Plugin *p) +{ + _src_border_cleanup(p); + E_FREE(p); +} + + static int -_evry_plug_border_action(Evry_Item *item) +_src_border_action(Evry_Plugin *p, Evry_Item *item) { E_Border *bd; E_Zone *zone; - bd = (E_Border *)item->data; + bd = (E_Border *)item->data[0]; zone = e_util_zone_current_get(e_manager_current_get()); if (bd->desk != (e_desk_current_get(zone))) @@ -67,13 +112,13 @@ } static void -_evry_plug_border_cleanup(void) +_src_border_cleanup(Evry_Plugin *p) { Evry_Item *it; - EINA_LIST_FREE(plugin.candidates, it) + EINA_LIST_FREE(p->items, it) { - if (it->data) e_object_unref(E_OBJECT(it->data)); + /* if (it->data[0]) e_object_unref(E_OBJECT(it->data[0])); */ if (it->label) eina_stringshare_del(it->label); if (it->o_icon) evas_object_del(it->o_icon); free(it); @@ -81,7 +126,7 @@ } static int -_evry_plug_border_fetch(char *string) +_src_border_fetch(Evry_Plugin *p, char *string) { E_Manager *man; E_Zone *zone; @@ -92,7 +137,7 @@ E_Border *bd; E_Border_List *bl; - _evry_plug_border_cleanup(); + _src_border_cleanup(p); man = e_manager_current_get(); zone = e_util_zone_current_get(man); @@ -109,24 +154,25 @@ if (zone == bd->zone) { if (!string) - _evry_plug_border_item_add(bd, 1); - else if (bd->client.icccm.name && e_util_glob_case_match(bd->client.icccm.name, match1)) - _evry_plug_border_item_add(bd, 1); + _src_border_item_add(p, bd, 1); + else if (bd->client.icccm.name && + e_util_glob_case_match(bd->client.icccm.name, match1)) + _src_border_item_add(p, bd, 1); else if (e_util_glob_case_match(e_border_name_get(bd), match1)) - _evry_plug_border_item_add(bd, 1); - else if (bd->client.icccm.name && e_util_glob_case_match(bd->client.icccm.name, match2)) - _evry_plug_border_item_add(bd, 2); + _src_border_item_add(p, bd, 1); + else if (bd->client.icccm.name && + e_util_glob_case_match(bd->client.icccm.name, match2)) + _src_border_item_add(p, bd, 2); else if (e_util_glob_case_match(e_border_name_get(bd), match2)) - _evry_plug_border_item_add(bd, 2); + _src_border_item_add(p, bd, 2); } } e_container_border_list_free(bl); - if (eina_list_count(plugin.candidates) > 0) + if (eina_list_count(p->items) > 0) { - plugin.candidates = eina_list_sort(plugin.candidates, - eina_list_count(plugin.candidates), - _evry_plug_border_cb_sort); + p->items = eina_list_sort(p->items, eina_list_count(p->items), + _src_border_cb_sort); return 1; } @@ -134,30 +180,28 @@ } static void -_evry_plug_border_item_icon_get( Evry_Item *it, Evas *e) +_src_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { - it->o_icon = e_border_icon_add(((E_Border *)it->data), e); + it->o_icon = e_border_icon_add(((E_Border *)it->data[0]), e); } static void -_evry_plug_border_item_add(E_Border *bd, int prio) +_src_border_item_add(Evry_Plugin *p, E_Border *bd, int prio) { Evry_Item *it; it = calloc(1, sizeof(Evry_Item)); - e_object_ref(E_OBJECT(bd)); - it->data = bd; + /* e_object_ref(E_OBJECT(bd)); */ + it->data[0] = bd; it->priority = prio; it->label = eina_stringshare_add(e_border_name_get(bd)); - it->o_icon = NULL; //e_border_icon_add(bd, evry_evas_get()); - plugin.candidates = eina_list_append(plugin.candidates, it); + p->items = eina_list_append(p->items, it); } - -// TODO sort by focus history and name? +/* TODO sort by focus history and name? */ static int -_evry_plug_border_cb_sort(const void *data1, const void *data2) +_src_border_cb_sort(const void *data1, const void *data2) { const Evry_Item *it1, *it2; @@ -166,3 +210,122 @@ return (it1->priority - it2->priority); } + + + +static Evry_Plugin * +_act_border_new() +{ + Evry_Plugin *p; + Inst *inst; + + p = E_NEW(Evry_Plugin, 1); + p->class = &source; + p->begin = &_act_border_begin; + p->fetch = &_act_border_fetch; + p->action = &_act_border_action; + p->cleanup = &_act_border_cleanup; + p->icon_get = &_act_border_item_icon_get; + p->items = NULL; + + inst = E_NEW(Inst, 1); + p->priv = inst; + + return p; +} + +static void +_act_border_free(Evry_Plugin *p) +{ + Inst *inst = p->priv; + + /* if (inst->border) e_object_unref(E_OBJECT(inst->border)); */ + + _act_border_cleanup(p); + + E_FREE(p); + E_FREE(inst); +} + +static void +_act_cb_border_close(E_Border *bd) +{ + if (!bd->lock_close) e_border_act_close_begin(bd); +} + +static void +_act_cb_border_minimize(E_Border *bd) +{ + if (!bd->lock_user_iconify) e_border_iconify(bd); +} + +static int +_act_border_begin(Evry_Plugin *p, Evry_Item *item) +{ + Inst *inst = p->priv; + E_Border *bd; + + bd = item->data[0]; + /* e_object_ref(E_OBJECT(bd)); */ + inst->border = bd; + + return 1; +} + +static int +_act_border_fetch(Evry_Plugin *p, char *string) +{ + _act_border_cleanup(p); + + _act_border_item_add(p, _("Iconify"), _act_cb_border_minimize, + "e/widgets/border/default/minimize"); + + _act_border_item_add(p, _("Close"), _act_cb_border_close, + "e/widgets/border/default/close"); + return 1; +} + +static int +_act_border_action(Evry_Plugin *p, Evry_Item *item) +{ + Inst *inst = p->priv; + + void (*border_action) (E_Border *bd); + border_action = item->data[0]; + border_action(inst->border); + return 1; +} + +static void +_act_border_cleanup(Evry_Plugin *p) +{ + Evry_Item *it; + + EINA_LIST_FREE(p->items, it) + { + if (it->data[1]) eina_stringshare_del(it->data[1]); + if (it->label) eina_stringshare_del(it->label); + if (it->o_icon) evas_object_del(it->o_icon); + free(it); + } +} + +static void +_act_border_item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon) +{ + Evry_Item *it; + + it = calloc(1, sizeof(Evry_Item)); + it->data[0] = action_cb; + it->data[1] = (void *) eina_stringshare_add(icon); + it->label = eina_stringshare_add(label); + p->items = eina_list_append(p->items, it); +} + +static void +_act_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) +{ + it->o_icon = edje_object_add(e); + e_theme_edje_object_set(it->o_icon, "base/theme/borders", (const char *)it->data[1]); +} + Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-06-20 19:13:11 UTC (rev 41134) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-06-21 10:31:38 UTC (rev 41135) @@ -1,39 +1,59 @@ #include "e.h" #include "e_mod_main.h" -static Evry_Plugin plugin; +static Evry_Plugin_Class class; +static Evry_Plugin *_plug_config_new(); +static void _plug_config_free(Evry_Plugin *p); +static int _plug_config_fetch(Evry_Plugin *p, char *string); +static int _plug_config_action(Evry_Plugin *p, Evry_Item *item); +static void _plug_config_cleanup(Evry_Plugin *p); +static void _plug_config_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio); +static void _plug_config_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static int _plug_config_cb_sort(const void *data1, const void *data2); -static int _evry_plug_config_fetch(char *string); -static int _evry_plug_config_action(Evry_Item *item); -static void _evry_plug_config_cleanup(void); -static void _evry_plug_config_item_add(E_Configure_It *eci, int prio); -static int _evry_plug_config_cb_sort(const void *data1, const void *data2); -static void _evry_plug_config_item_icon_get(Evry_Item *it, Evas *e); - EAPI int evry_plug_config_init(void) { - plugin.name = "Settings"; - plugin.fetch = &_evry_plug_config_fetch; - plugin.action = &_evry_plug_config_action; - plugin.cleanup = &_evry_plug_config_cleanup; - plugin.icon_get = &_evry_plug_config_item_icon_get; - plugin.candidates = NULL; - evry_plugin_add(&plugin); - + class.name = "Settings"; + class.type_in = "NONE"; + class.type_out = "NONE"; + class.instances = NULL; + class.new = &_plug_config_new; + class.free = &_plug_config_free; + evry_plugin_register(&class); return 1; } EAPI int evry_plug_config_shutdown(void) { - evry_plugin_remove(&plugin); + evry_plugin_unregister(&class); return 1; } +static Evry_Plugin * +_plug_config_new() +{ + Evry_Plugin *p = E_NEW(Evry_Plugin, 1); + p->class = &class; + p->fetch = &_plug_config_fetch; + p->action = &_plug_config_action; + p->cleanup = &_plug_config_cleanup; + p->icon_get = &_plug_config_item_icon_get; + p->items = NULL; +} + + +static void +_plug_config_free(Evry_Plugin *p) +{ + _plug_config_cleanup(p); + E_FREE(p); +} + static int -_evry_plug_config_action(Evry_Item *item) +_plug_config_action(Evry_Plugin *p, Evry_Item *item) { E_Configure_It *eci, *eci2; E_Container *con; @@ -42,13 +62,13 @@ char buf[1024]; int found = 0; - eci = item->data; + eci = item->data[0]; con = e_container_current_get(e_manager_current_get()); - for (l = e_configure_registry; l; l = l->next) + for (l = e_configure_registry; l && !found; l = l->next) { ecat = l->data; - for (ll = ecat->items; ll; ll = ll->next) + for (ll = ecat->items; ll && !found; ll = ll->next) { eci2 = ll->data; if (eci == eci2) @@ -68,13 +88,12 @@ } static void -_evry_plug_config_cleanup(void) +_plug_config_cleanup(Evry_Plugin *p) { Evry_Item *it; - EINA_LIST_FREE(plugin.candidates, it) + EINA_LIST_FREE(p->items, it) { - /* if (it->data) */ if (it->label) eina_stringshare_del(it->label); if (it->o_icon) evas_object_del(it->o_icon); free(it); @@ -82,7 +101,7 @@ } static int -_evry_plug_config_fetch(char *string) +_plug_config_fetch(Evry_Plugin *p, char *string) { E_Manager *man; E_Zone *zone; @@ -93,7 +112,7 @@ E_Configure_Cat *ecat; E_Configure_It *eci; - _evry_plug_config_cleanup(); + _plug_config_cleanup(p); snprintf(match1, sizeof(match1), "%s*", string); snprintf(match2, sizeof(match2), "*%s*", string); @@ -109,24 +128,23 @@ if (eci->pri >= 0) { if (e_util_glob_case_match(eci->label, match1)) - _evry_plug_config_item_add(eci, 1); + _plug_config_item_add(p, eci, 1); else if (e_util_glob_case_match(eci->label, match2)) - _evry_plug_config_item_add(eci, 2); + _plug_config_item_add(p, eci, 2); else if (e_util_glob_case_match(ecat->label, match1)) - _evry_plug_config_item_add(eci, 3); + _plug_config_item_add(p, eci, 3); else if (e_util_glob_case_match(ecat->label, match2)) - _evry_plug_config_item_add(eci, 4); + _plug_config_item_add(p, eci, 4); } } } } - if (eina_list_count(plugin.candidates) > 0) + if (eina_list_count(p->items) > 0) { - plugin.candidates = - eina_list_sort(plugin.candidates, - eina_list_count(plugin.candidates), - _evry_plug_config_cb_sort); + p->items = eina_list_sort(p->items, + eina_list_count(p->items), + _plug_config_cb_sort); return 1; } @@ -134,9 +152,9 @@ } static void -_evry_plug_config_item_icon_get(Evry_Item *it, Evas *e) +_plug_config_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { - E_Configure_It *eci = it->data; + E_Configure_It *eci = it->data[0]; Evas_Object *o = NULL; if (eci->icon) @@ -153,23 +171,23 @@ } static void -_evry_plug_config_item_add(E_Configure_It *eci, int prio) +_plug_config_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio) { Evry_Item *it; it = calloc(1, sizeof(Evry_Item)); - it->data = eci; + it->data[0] = eci; it->priority = prio; it->label = eina_stringshare_add(eci->label); it->o_icon = NULL; - plugin.candidates = eina_list_append(plugin.candidates, it); + p->items = eina_list_append(p->items, it); } // TODO sort name? static int -_evry_plug_config_cb_sort(const void *data1, const void *data2) +_plug_config_cb_sort(const void *data1, const void *data2) { const Evry_Item *it1, *it2; Added: trunk/e/src/modules/everything/evry_plug_dir_browse.c Added: trunk/e/src/modules/everything/evry_plug_file_open.c Added: trunk/e/src/modules/everything/evry_plug_tracker.c |
From: Enlightenment S. <no-...@en...> - 2009-06-21 10:39:54
|
Log: 'everything' module: keep selected candidate when popping to previous candidate list Author: jeffdameth Date: 2009-06-21 03:37:12 -0700 (Sun, 21 Jun 2009) New Revision: 41137 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-21 10:32:21 UTC (rev 41136) +++ trunk/e/src/modules/everything/evry.c 2009-06-21 10:37:12 UTC (rev 41137) @@ -717,7 +717,7 @@ /* TODO add option */ - if (p->items) + if (!s->sel_item && p->items) { s->sel_item = p->items->data; _evry_item_sel(s->sel_item); |
From: Enlightenment S. <no-...@en...> - 2009-06-21 14:28:20
|
Log: 'everything' module: fix segv Author: jeffdameth Date: 2009-06-21 07:28:17 -0700 (Sun, 21 Jun 2009) New Revision: 41139 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-21 12:58:51 UTC (rev 41138) +++ trunk/e/src/modules/everything/evry.c 2009-06-21 14:28:17 UTC (rev 41139) @@ -866,7 +866,7 @@ } } } - else if (s->cur_plugin->items) + else if (s->cur_plugin && s->cur_plugin->items) { s->sel_item = s->cur_plugin->items->data; _evry_item_sel(s->sel_item); |
From: Enlightenment S. <no-...@en...> - 2009-06-21 15:20:18
|
Log: 'everything' module: fix segv on tab with no candidate Author: jeffdameth Date: 2009-06-21 08:20:15 -0700 (Sun, 21 Jun 2009) New Revision: 41140 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-21 14:28:17 UTC (rev 41139) +++ trunk/e/src/modules/everything/evry.c 2009-06-21 15:20:15 UTC (rev 41140) @@ -430,7 +430,10 @@ else if (!strcmp(ev->key, "Return")) _evry_action(1); else if (!strcmp(ev->key, "Tab")) - _evry_push_state(); + { + if (s->sel_item) + _evry_push_state(); + } else if (!strcmp(ev->key, "u") && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) _evry_clear(); |
From: Enlightenment S. <no-...@en...> - 2009-06-21 21:16:05
|
Log: 'everything' module: merge file-open with apps plugin - changed api to pass input to action: e.g. open-with accepts now commands, if no item is selected Author: jeffdameth Date: 2009-06-21 14:16:02 -0700 (Sun, 21 Jun 2009) New Revision: 41146 Removed: trunk/e/src/modules/everything/evry_plug_file_open.c Modified: trunk/e/src/modules/everything/Makefile.am trunk/e/src/modules/everything/e_mod_main.c trunk/e/src/modules/everything/e_mod_main.h trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry.h trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_config.c trunk/e/src/modules/everything/evry_plug_dir_browse.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/Makefile.am =================================================================== --- trunk/e/src/modules/everything/Makefile.am 2009-06-21 21:14:49 UTC (rev 41145) +++ trunk/e/src/modules/everything/Makefile.am 2009-06-21 21:16:02 UTC (rev 41146) @@ -24,7 +24,6 @@ evry.h \ evry_plug_config.c \ evry_plug_apps.c \ - evry_plug_file_open.c \ evry_plug_tracker.c \ evry_plug_border.c \ evry_plug_dir_browse.c Modified: trunk/e/src/modules/everything/e_mod_main.c =================================================================== --- trunk/e/src/modules/everything/e_mod_main.c 2009-06-21 21:14:49 UTC (rev 41145) +++ trunk/e/src/modules/everything/e_mod_main.c 2009-06-21 21:16:02 UTC (rev 41146) @@ -74,7 +74,6 @@ evry_plug_apps_init(); evry_plug_config_init(); evry_plug_dir_browse_init(); - evry_plug_file_open_init(); evry_plug_tracker_init(); /* add module supplied action */ @@ -114,7 +113,6 @@ evry_plug_apps_shutdown(); evry_plug_config_shutdown(); evry_plug_dir_browse_shutdown(); - evry_plug_file_open_shutdown(); evry_plug_tracker_shutdown(); evry_shutdown(); Modified: trunk/e/src/modules/everything/e_mod_main.h =================================================================== --- trunk/e/src/modules/everything/e_mod_main.h 2009-06-21 21:14:49 UTC (rev 41145) +++ trunk/e/src/modules/everything/e_mod_main.h 2009-06-21 21:16:02 UTC (rev 41146) @@ -60,9 +60,6 @@ EAPI int evry_plug_dir_browse_init(void); EAPI int evry_plug_dir_browse_shutdown(void); -EAPI int evry_plug_file_open_init(void); -EAPI int evry_plug_file_open_shutdown(void); - extern Config *evry_conf; #endif Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-21 21:14:49 UTC (rev 41145) +++ trunk/e/src/modules/everything/evry.c 2009-06-21 21:16:02 UTC (rev 41146) @@ -16,6 +16,9 @@ Evry_Item *sel_item; /* Eina_List *sel_items; */ char *input; + + Eina_Bool initial; + Eina_Bool get_parameter; /* TODO better name !*/ }; static int _evry_cb_key_down(void *data, int type, void *event); @@ -48,7 +51,9 @@ static int _evry_push_state(void); static int _evry_pop_state(void); static void _evry_plugin_selector_append(Evry_Plugin *p); +static int _evry_cb_plugin_sort(const void *data1, const void *data2); + /* local subsystem globals */ static E_Popup *popup = NULL; static Ecore_X_Window input_window = 0; @@ -274,6 +279,15 @@ /* local subsystem functions */ static int +_evry_cb_plugin_sort(const void *data1, const void *data2) +{ + const Evry_Plugin *p1 = data1; + const Evry_Plugin *p2 = data2; + return p1->class->prio - p2->class->prio; +} + + +static int _evry_push_state(void) { Evry_State *s; @@ -281,7 +295,7 @@ Evry_Plugin_Class *pc; const char *expect_type = "NONE"; Evry_Plugin *p; - + s = cur_state; if (s) @@ -310,9 +324,11 @@ list = eina_list_append(list, p); } } - + if (!list) return 0; + list = eina_list_sort(list, eina_list_count(list), _evry_cb_plugin_sort); + _evry_list_clear(); if (s) @@ -330,6 +346,7 @@ s->plugins = list; s->cur_plugins = NULL; s->sel_item = NULL; + s->initial = (cur_state ? 0 : 1); cur_state = s; stack = eina_list_prepend(stack, s); @@ -627,19 +644,18 @@ _evry_action(int finished) { Evry_State *s = cur_state; - - if (s->cur_plugin && s->sel_item) + + if (s->cur_plugin && (s->sel_item || s->input)) { if (!s->cur_plugin->action || - !s->cur_plugin->action(s->cur_plugin, s->sel_item)) + !s->cur_plugin->action(s->cur_plugin, s->sel_item, s->input)) { - /* _evry_action_select(); */ _evry_push_state(); finished = 0; } } - else - e_exec(popup->zone, NULL, s->input, NULL, "everything"); + else if (s->initial) + e_exec(popup->zone, NULL, s->input, NULL, NULL /* "everything" */); if (finished) evry_hide(); @@ -756,7 +772,7 @@ else items = p->fetch(p, s->input); - if (items && eina_list_count(p->items) > 0) + if (!s->initial || (items && eina_list_count(p->items) > 0)) { s->cur_plugins = eina_list_append(s->cur_plugins, p); _evry_plugin_selector_append(p); @@ -1000,12 +1016,16 @@ { Evas_Object *o; Evas_Coord mw = 0, mh = 0; - + char buf[64]; + o = edje_object_add(popup->evas); + /* TODO move this to everything theme group !*/ e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/toolbar/item"); - edje_object_part_text_set(o, "e.text.label", p->class->name); + snprintf(buf, 64, "%s (%d)", p->class->name, eina_list_count(p->items)); + + edje_object_part_text_set(o, "e.text.label", buf); edje_object_size_min_calc(o, &mw, &mh); e_box_pack_end(o_selector, o); @@ -1021,3 +1041,5 @@ p->tab = o; } + + Modified: trunk/e/src/modules/everything/evry.h =================================================================== --- trunk/e/src/modules/everything/evry.h 2009-06-21 21:14:49 UTC (rev 41145) +++ trunk/e/src/modules/everything/evry.h 2009-06-21 21:16:02 UTC (rev 41146) @@ -55,6 +55,9 @@ const char *type_in; const char *type_out; + /* TODO option */ + int prio; + /* sync/async ?*/ unsigned char async_query : 1; @@ -80,11 +83,11 @@ int (*begin) (Evry_Plugin *p, Evry_Item *item); /* get candidates matching string, fills 'candidates' list */ - int (*fetch) (Evry_Plugin *p, char *string); + int (*fetch) (Evry_Plugin *p, const char *input); /* run action with a given candidate - TODO register actions per candidate type */ - int (*action) (Evry_Plugin *p, Evry_Item *item); + int (*action) (Evry_Plugin *p, Evry_Item *item, const char *input); /* run before new query and when hiding 'everything' */ void (*cleanup) (Evry_Plugin *p); Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-06-21 21:14:49 UTC (rev 41145) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-06-21 21:16:02 UTC (rev 41146) @@ -6,18 +6,24 @@ struct _Inst { Eina_Hash *added; + + Eina_List *apps; + Evry_Item *candidate; }; -static Evry_Plugin *_plug_apps_new(); -static void _plug_apps_free(Evry_Plugin *p); -static int _plug_apps_fetch(Evry_Plugin *p, char *string); -static int _plug_apps_action(Evry_Plugin *p, Evry_Item *item); -static void _plug_apps_cleanup(Evry_Plugin *p); -static void _plug_apps_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio); -static int _plug_apps_cb_sort(const void *data1, const void *data2); -static void _plug_apps_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static Evry_Plugin *_plug_new(); +static Evry_Plugin *_plug_new2(); +static void _plug_free(Evry_Plugin *p); +static int _begin(Evry_Plugin *p, Evry_Item *item); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); +static void _cleanup(Evry_Plugin *p); +static void _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio); +static int _cb_sort(const void *data1, const void *data2); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); static Evry_Plugin_Class class; +static Evry_Plugin_Class class2; EAPI int evry_plug_apps_init(void) @@ -26,10 +32,20 @@ class.type_in = "NONE"; class.type_out = "APPLICATION"; class.need_query = 0; - class.new = &_plug_apps_new; - class.free = &_plug_apps_free; + class.new = &_plug_new; + class.free = &_plug_free; + class.prio = 1; evry_plugin_register(&class); - + + class2.name = "Open With.."; + class2.type_in = "FILE"; + class2.type_out = "APPLICATION"; + class2.need_query = 0; + class2.new = &_plug_new2; + class2.free = &_plug_free; + class2.prio = 3; + evry_plugin_register(&class2); + return 1; } @@ -37,19 +53,20 @@ evry_plug_apps_shutdown(void) { evry_plugin_unregister(&class); + evry_plugin_unregister(&class2); return 1; } static Evry_Plugin * -_plug_apps_new() +_plug_new() { Evry_Plugin *p = E_NEW(Evry_Plugin, 1); p->class = &class; - p->fetch = &_plug_apps_fetch; - p->action = &_plug_apps_action; - p->cleanup = &_plug_apps_cleanup; - p->icon_get = &_plug_apps_item_icon_get; + p->fetch = &_fetch; + p->action = &_action; + p->cleanup = &_cleanup; + p->icon_get = &_item_icon_get; p->items = NULL; Inst *inst = E_NEW(Inst, 1); @@ -59,36 +76,130 @@ return p; } +static Evry_Plugin * +_plug_new2() +{ + Evry_Plugin *p = E_NEW(Evry_Plugin, 1); + p->class = &class2; + p->begin = &_begin; + p->fetch = &_fetch; + p->action = &_action; + p->cleanup = &_cleanup; + p->icon_get = &_item_icon_get; + p->items = NULL; + + Inst *inst = E_NEW(Inst, 1); + inst->added = NULL; + p->priv = inst; + + return p; +} + static void -_plug_apps_free(Evry_Plugin *p) +_plug_free(Evry_Plugin *p) { Inst *inst = p->priv; - _plug_apps_cleanup(p); - + _cleanup(p); + if (inst->apps) eina_list_free(inst->apps); + E_FREE(inst); E_FREE(p); } static int -_plug_apps_action(Evry_Plugin *p, Evry_Item *item) +_begin(Evry_Plugin *p, Evry_Item *it) { + Inst *inst; + const char *mime; + + _cleanup(p); + + if (!it || !it->uri) return 0; + inst = p->priv; + inst->candidate = it; + + if (!it->mime) + mime = efreet_mime_type_get(it->uri); + else + mime = it->mime; + + if (!mime) return 0; + + /* if (!strcmp(mime, "Folder")) + * { + * apps = + * } + * else */ + + inst->apps = efreet_util_desktop_mime_list(mime); + + return 1; +} + + +static int +_action(Evry_Plugin *p, Evry_Item *it, const char *input) +{ E_Zone *zone; Evry_App *app; + Efreet_Desktop *desktop = NULL; + Eina_List *files = NULL; + Inst *inst = p->priv; + int ret = 0; - app = item->data[0]; + app = it->data[0]; zone = e_util_zone_current_get(e_manager_current_get()); + if (inst->candidate) + files = eina_list_append(files, inst->candidate->uri); + if (app->desktop) - e_exec(zone, app->desktop, NULL, NULL, "everything"); - else - e_exec(zone, NULL, app->file, NULL, "everything"); + { + desktop = app->desktop; + } + else if (input || app->file) + { + if (app->file) + input = app->file; + + desktop = efreet_desktop_empty_new(""); + if (strchr(input, '%')) + { + desktop->exec = strdup(input); + } + else + { + int len = strlen(input) + 4; + desktop->exec = malloc(len); + if (desktop->exec) + snprintf(desktop->exec, len, "%s %%U", input); + } + } - return 1; + if (desktop) + { + e_exec(zone, desktop, NULL, files, NULL /*"everything"*/); + + if (!it) + efreet_desktop_free(desktop); + + ret = 1; + } + + eina_list_free(files); + + + /* if (app->desktop) + * e_exec(zone, app->desktop, NULL, NULL, "everything"); + * else + * e_exec(zone, NULL, app->file, NULL, "everything"); */ + + return ret; } static void -_plug_apps_cleanup(Evry_Plugin *p) +_cleanup(Evry_Plugin *p) { Evry_Item *it; Evry_App *app; @@ -104,56 +215,92 @@ } static int -_plug_apps_fetch(Evry_Plugin *p, char *string) +_fetch(Evry_Plugin *p, const char *input) { - char buf[4096]; - Eina_List *list; + Eina_List *l; Efreet_Desktop *desktop; char *file; + char match1[4096]; + char match2[4096]; + Inst *inst = p->priv; - _plug_apps_cleanup(p); + _cleanup(p); - if (string) + if (inst->apps) { - snprintf(buf, sizeof(buf), "%s*", string); - list = efreet_util_desktop_exec_glob_list(buf); - EINA_LIST_FREE(list, desktop) - _plug_apps_item_add(p, desktop, NULL, 1); + if (!input) + { + EINA_LIST_FOREACH(inst->apps, l, desktop) + _item_add(p, desktop, NULL, 1); + } + else + { + snprintf(match1, sizeof(match1), "%s*", input); + snprintf(match2, sizeof(match2), "*%s*", input); + + EINA_LIST_FOREACH(inst->apps, l, desktop) + { + if (desktop->name) + { + if (e_util_glob_case_match(desktop->name, match1)) + _item_add(p, desktop, NULL, 1); + else if (e_util_glob_case_match(desktop->name, match2)) + _item_add(p, desktop, NULL, 2); + else if (desktop->comment) + { + if (e_util_glob_case_match(desktop->comment, match1)) + _item_add(p, desktop, NULL, 3); + else if (e_util_glob_case_match(desktop->comment, match2)) + _item_add(p, desktop, NULL, 4); + } + } + } + } + } - snprintf(buf, sizeof(buf), "*%s*", string); - list = efreet_util_desktop_name_glob_list(buf); - EINA_LIST_FREE(list, desktop) - _plug_apps_item_add(p, desktop, NULL, 2); + + if (!p->items && input) + { + snprintf(match1, sizeof(match1), "%s*", input); + l = efreet_util_desktop_exec_glob_list(match1); + EINA_LIST_FREE(l, desktop) + _item_add(p, desktop, NULL, 1); + + snprintf(match1, sizeof(match1), "*%s*", input); + l = efreet_util_desktop_name_glob_list(match1); + EINA_LIST_FREE(l, desktop) + _item_add(p, desktop, NULL, 2); // TODO make these optional/configurable - snprintf(buf, sizeof(buf), "*%s*", string); - list = efreet_util_desktop_generic_name_glob_list(buf); - EINA_LIST_FREE(list, desktop) - _plug_apps_item_add(p, desktop, NULL, 3); + l = efreet_util_desktop_generic_name_glob_list(match1); + EINA_LIST_FREE(l, desktop) + _item_add(p, desktop, NULL, 3); - snprintf(buf, sizeof(buf), "*%s*", string); - list = efreet_util_desktop_comment_glob_list(buf); - EINA_LIST_FREE(list, desktop) - _plug_apps_item_add(p, desktop, NULL, 3); + l = efreet_util_desktop_comment_glob_list(match1); + EINA_LIST_FREE(l, desktop) + _item_add(p, desktop, NULL, 3); } - else + else if (!p->items) { // TODO option for popular/recent - list = e_exehist_list_get(); - EINA_LIST_FREE(list, file) - _plug_apps_item_add(p, NULL, file, 1); + l = e_exehist_list_get(); + EINA_LIST_FREE(l, file) + _item_add(p, NULL, file, 1); } if (inst->added) { eina_hash_free(inst->added); inst->added = NULL; - - if (string) + } + + if (p->items) + { + if (input) p->items = eina_list_sort(p->items, eina_list_count(p->items), - _plug_apps_cb_sort); + _cb_sort); return 1; } @@ -161,27 +308,34 @@ } static void -_plug_apps_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio) +_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio) { Evry_Item *it; Evry_App *app; Inst *inst = p->priv; + Efreet_Desktop *desktop2; if (desktop) file = ecore_file_app_exe_get(desktop->exec); if (!file) return; - - if (eina_hash_find(inst->added, file)) + + if (desktop) { - if (desktop) free(file); - return; + if ((desktop2 = eina_hash_find(inst->added, file))) + { + if (desktop == desktop2) + { + free(file); + return; + } + } } if (!inst->added) inst->added = eina_hash_string_superfast_new(NULL); - eina_hash_add(inst->added, file, file); + eina_hash_add(inst->added, file, desktop); if (desktop) { @@ -210,7 +364,7 @@ } static void -_plug_apps_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { Evry_App *app = it->data[0]; @@ -219,7 +373,7 @@ } static int -_plug_apps_cb_sort(const void *data1, const void *data2) +_cb_sort(const void *data1, const void *data2) { const Evry_Item *it1, *it2; Evry_App *app1, *app2; Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-06-21 21:14:49 UTC (rev 41145) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-06-21 21:16:02 UTC (rev 41146) @@ -10,8 +10,8 @@ static Evry_Plugin * _src_border_new(void); static void _src_border_free(Evry_Plugin *p); -static int _src_border_fetch(Evry_Plugin *p, char *string); -static int _src_border_action(Evry_Plugin *p, Evry_Item *item); +static int _src_border_fetch(Evry_Plugin *p, const char *input); +static int _src_border_action(Evry_Plugin *p, Evry_Item *item, const char *input); static void _src_border_cleanup(Evry_Plugin *p); static void _src_border_item_add(Evry_Plugin *p, E_Border *bd, int prio); static int _src_border_cb_sort(const void *data1, const void *data2); @@ -20,8 +20,8 @@ static Evry_Plugin * _act_border_new(void); static void _act_border_free(Evry_Plugin *p); static int _act_border_begin(Evry_Plugin *p, Evry_Item *item); -static int _act_border_fetch(Evry_Plugin *p, char *string); -static int _act_border_action(Evry_Plugin *p, Evry_Item *item); +static int _act_border_fetch(Evry_Plugin *p, const char *input); +static int _act_border_action(Evry_Plugin *p, Evry_Item *item, const char *input); static void _act_border_cleanup(Evry_Plugin *p); static void _act_border_item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon); static void _act_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); @@ -37,6 +37,7 @@ source.type_in = "NONE"; source.type_out = "BORDER"; source.need_query = 0; + source.prio = 0; source.new = &_src_border_new; source.free = &_src_border_free; evry_plugin_register(&source); @@ -45,6 +46,7 @@ action.type_in = "BORDER"; action.type_out = "NONE"; action.need_query = 0; + action.prio = 0; action.new = &_act_border_new; action.free = &_act_border_free; evry_plugin_register(&action); @@ -86,12 +88,14 @@ static int -_src_border_action(Evry_Plugin *p, Evry_Item *item) +_src_border_action(Evry_Plugin *p, Evry_Item *it, const char *input) { E_Border *bd; E_Zone *zone; + + if (!it) return 0; - bd = (E_Border *)item->data[0]; + bd = (E_Border *)it->data[0]; zone = e_util_zone_current_get(e_manager_current_get()); if (bd->desk != (e_desk_current_get(zone))) @@ -126,7 +130,7 @@ } static int -_src_border_fetch(Evry_Plugin *p, char *string) +_src_border_fetch(Evry_Plugin *p, const char *input) { E_Manager *man; E_Zone *zone; @@ -142,10 +146,10 @@ man = e_manager_current_get(); zone = e_util_zone_current_get(man); - if (string) + if (input) { - snprintf(match1, sizeof(match1), "%s*", string); - snprintf(match2, sizeof(match2), "*%s*", string); + snprintf(match1, sizeof(match1), "%s*", input); + snprintf(match2, sizeof(match2), "*%s*", input); } bl = e_container_border_list_first(e_container_current_get(man)); @@ -153,7 +157,7 @@ { if (zone == bd->zone) { - if (!string) + if (!input) _src_border_item_add(p, bd, 1); else if (bd->client.icccm.name && e_util_glob_case_match(bd->client.icccm.name, match1)) @@ -273,7 +277,7 @@ } static int -_act_border_fetch(Evry_Plugin *p, char *string) +_act_border_fetch(Evry_Plugin *p, const char *input) { _act_border_cleanup(p); @@ -286,7 +290,7 @@ } static int -_act_border_action(Evry_Plugin *p, Evry_Item *item) +_act_border_action(Evry_Plugin *p, Evry_Item *item, const char *input) { Inst *inst = p->priv; Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-06-21 21:14:49 UTC (rev 41145) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-06-21 21:16:02 UTC (rev 41146) @@ -2,14 +2,14 @@ #include "e_mod_main.h" static Evry_Plugin_Class class; -static Evry_Plugin *_plug_config_new(); -static void _plug_config_free(Evry_Plugin *p); -static int _plug_config_fetch(Evry_Plugin *p, char *string); -static int _plug_config_action(Evry_Plugin *p, Evry_Item *item); -static void _plug_config_cleanup(Evry_Plugin *p); -static void _plug_config_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio); -static void _plug_config_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); -static int _plug_config_cb_sort(const void *data1, const void *data2); +static Evry_Plugin *_plug_new(); +static void _plug_free(Evry_Plugin *p); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); +static void _cleanup(Evry_Plugin *p); +static void _item_add(Evry_Plugin *p, E_Configure_It *eci, int prio); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static int _cb_sort(const void *data1, const void *data2); EAPI int evry_plug_config_init(void) @@ -18,8 +18,8 @@ class.type_in = "NONE"; class.type_out = "NONE"; class.instances = NULL; - class.new = &_plug_config_new; - class.free = &_plug_config_free; + class.new = &_plug_new; + class.free = &_plug_free; evry_plugin_register(&class); return 1; } @@ -33,27 +33,27 @@ } static Evry_Plugin * -_plug_config_new() +_plug_new() { Evry_Plugin *p = E_NEW(Evry_Plugin, 1); p->class = &class; - p->fetch = &_plug_config_fetch; - p->action = &_plug_config_action; - p->cleanup = &_plug_config_cleanup; - p->icon_get = &_plug_config_item_icon_get; + p->fetch = &_fetch; + p->action = &_action; + p->cleanup = &_cleanup; + p->icon_get = &_item_icon_get; p->items = NULL; } static void -_plug_config_free(Evry_Plugin *p) +_plug_free(Evry_Plugin *p) { - _plug_config_cleanup(p); + _cleanup(p); E_FREE(p); } static int -_plug_config_action(Evry_Plugin *p, Evry_Item *item) +_action(Evry_Plugin *p, Evry_Item *it, const char *input) { E_Configure_It *eci, *eci2; E_Container *con; @@ -61,8 +61,10 @@ Eina_List *l, *ll; char buf[1024]; int found = 0; + + if (!it) return 0; - eci = item->data[0]; + eci = it->data[0]; con = e_container_current_get(e_manager_current_get()); for (l = e_configure_registry; l && !found; l = l->next) @@ -88,7 +90,7 @@ } static void -_plug_config_cleanup(Evry_Plugin *p) +_cleanup(Evry_Plugin *p) { Evry_Item *it; @@ -101,7 +103,7 @@ } static int -_plug_config_fetch(Evry_Plugin *p, char *string) +_fetch(Evry_Plugin *p, const char *input) { E_Manager *man; E_Zone *zone; @@ -112,10 +114,10 @@ E_Configure_Cat *ecat; E_Configure_It *eci; - _plug_config_cleanup(p); + _cleanup(p); - snprintf(match1, sizeof(match1), "%s*", string); - snprintf(match2, sizeof(match2), "*%s*", string); + snprintf(match1, sizeof(match1), "%s*", input); + snprintf(match2, sizeof(match2), "*%s*", input); for (l = e_configure_registry; l; l = l->next) { @@ -128,13 +130,13 @@ if (eci->pri >= 0) { if (e_util_glob_case_match(eci->label, match1)) - _plug_config_item_add(p, eci, 1); + _item_add(p, eci, 1); else if (e_util_glob_case_match(eci->label, match2)) - _plug_config_item_add(p, eci, 2); + _item_add(p, eci, 2); else if (e_util_glob_case_match(ecat->label, match1)) - _plug_config_item_add(p, eci, 3); + _item_add(p, eci, 3); else if (e_util_glob_case_match(ecat->label, match2)) - _plug_config_item_add(p, eci, 4); + _item_add(p, eci, 4); } } } @@ -144,7 +146,7 @@ { p->items = eina_list_sort(p->items, eina_list_count(p->items), - _plug_config_cb_sort); + _cb_sort); return 1; } @@ -152,7 +154,7 @@ } static void -_plug_config_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { E_Configure_It *eci = it->data[0]; Evas_Object *o = NULL; @@ -171,7 +173,7 @@ } static void -_plug_config_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio) +_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio) { Evry_Item *it; @@ -187,7 +189,7 @@ // TODO sort name? static int -_plug_config_cb_sort(const void *data1, const void *data2) +_cb_sort(const void *data1, const void *data2) { const Evry_Item *it1, *it2; Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-06-21 21:14:49 UTC (rev 41145) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-06-21 21:16:02 UTC (rev 41146) @@ -8,16 +8,16 @@ const char *directory; }; -static Evry_Plugin *_plug_dir_browse_new(); -static void _plug_dir_browse_free(Evry_Plugin *p); -static int _plug_dir_browse_begin(Evry_Plugin *p, Evry_Item *item); -static int _plug_dir_browse_fetch(Evry_Plugin *p, char *string); -static int _plug_dir_browse_action(Evry_Plugin *p, Evry_Item *item); -static void _plug_dir_browse_cleanup(Evry_Plugin *p); -static int _plug_dir_browse_cb_sort(const void *data1, const void *data2); -static void _plug_dir_browse_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); -static void _plug_dir_browse_list_free(Evry_Plugin *p); -static Evry_Item *_plug_dir_browse_item_fill(const char *directory, const char *file); +static Evry_Plugin *_plug_new(); +static void _plug_free(Evry_Plugin *p); +static int _begin(Evry_Plugin *p, Evry_Item *item); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); +static void _cleanup(Evry_Plugin *p); +static int _cb_sort(const void *data1, const void *data2); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static void _list_free(Evry_Plugin *p); +static Evry_Item *_item_fill(const char *directory, const char *file); static Evry_Plugin_Class class; @@ -27,8 +27,9 @@ class.name = "Browse Files"; class.type_in = "NONE|FILE"; class.type_out = "FILE"; - class.new = &_plug_dir_browse_new; - class.free = &_plug_dir_browse_free; + class.prio = 2; + class.new = &_plug_new; + class.free = &_plug_free; evry_plugin_register(&class); return 1; @@ -43,15 +44,15 @@ } static Evry_Plugin * -_plug_dir_browse_new() +_plug_new() { Evry_Plugin *p = E_NEW(Evry_Plugin, 1); p->class = &class; - p->begin = &_plug_dir_browse_begin; - p->fetch = &_plug_dir_browse_fetch; - p->action = &_plug_dir_browse_action; - p->cleanup = &_plug_dir_browse_cleanup; - p->icon_get = &_plug_dir_browse_item_icon_get; + p->begin = &_begin; + p->fetch = &_fetch; + p->action = &_action; + p->cleanup = &_cleanup; + p->icon_get = &_item_icon_get; p->items = NULL; Inst *inst = E_NEW(Inst, 1); @@ -62,9 +63,9 @@ } static void -_plug_dir_browse_free(Evry_Plugin *p) +_plug_free(Evry_Plugin *p) { - _plug_dir_browse_cleanup(p); + _cleanup(p); Inst *inst = p->priv; eina_stringshare_del(inst->directory); @@ -74,13 +75,13 @@ static int -_plug_dir_browse_action(Evry_Plugin *p, Evry_Item *item) +_action(Evry_Plugin *p, Evry_Item *item, const char *input) { return 0; } static void -_plug_dir_browse_list_free(Evry_Plugin *p) +_list_free(Evry_Plugin *p) { Evry_Item *it; @@ -97,13 +98,13 @@ static void -_plug_dir_browse_cleanup(Evry_Plugin *p) +_cleanup(Evry_Plugin *p) { - _plug_dir_browse_list_free(p); + _list_free(p); } static int -_plug_dir_browse_begin(Evry_Plugin *p, Evry_Item *item) +_begin(Evry_Plugin *p, Evry_Item *item) { Inst *inst = p->priv; @@ -111,7 +112,6 @@ { eina_stringshare_del(inst->directory); inst->directory = eina_stringshare_add(item->uri); - printf("dir: %s\n", inst->directory); return 1; } @@ -121,7 +121,7 @@ /* based on directory-watcher from drawer module */ static int -_plug_dir_browse_fetch(Evry_Plugin *p, char *string) +_fetch(Evry_Plugin *p, const char *input) { Eina_List *files; char *file; @@ -130,24 +130,24 @@ char match2[4096]; Inst *inst = p->priv; - _plug_dir_browse_list_free(p); + _list_free(p); files = ecore_file_ls(inst->directory); - if (string) + if (input) { - snprintf(match1, sizeof(match1), "%s*", string); - snprintf(match2, sizeof(match2), "*%s*", string); + snprintf(match1, sizeof(match1), "%s*", input); + snprintf(match2, sizeof(match2), "*%s*", input); } EINA_LIST_FREE(files, file) { if ((file[0] == '.') || - (string && + (input && (!e_util_glob_case_match(file, match1)) && (!e_util_glob_case_match(file, match2)))) goto end; - it = _plug_dir_browse_item_fill(inst->directory, file); + it = _item_fill(inst->directory, file); if (it) p->items = eina_list_append(p->items, it); @@ -161,7 +161,7 @@ /* based on directory-watcher from drawer module */ static Evry_Item * -_plug_dir_browse_item_fill(const char *directory, const char *file) +_item_fill(const char *directory, const char *file) { Evry_Item *it = NULL; char buf[4096]; @@ -209,7 +209,7 @@ } static void -_plug_dir_browse_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { char *item_path; @@ -230,7 +230,7 @@ } static int -_plug_dir_browse_cb_sort(const void *data1, const void *data2) +_cb_sort(const void *data1, const void *data2) { const Evry_Item *it1, *it2; Deleted: trunk/e/src/modules/everything/evry_plug_file_open.c Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-06-21 21:14:49 UTC (rev 41145) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-06-21 21:16:02 UTC (rev 41146) @@ -10,14 +10,14 @@ E_DBus_Connection *conn; }; -static Evry_Plugin *_plug_tracker_new(); -static void _plug_tracker_free(Evry_Plugin *p); -static int _plug_tracker_fetch(Evry_Plugin *p, char *string); -static int _plug_tracker_action(Evry_Plugin *p, Evry_Item *item); -static void _plug_tracker_cleanup(Evry_Plugin *p); -static void _plug_tracker_item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio); -static void _plug_tracker_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); -static void _plug_tracker_dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error); +static Evry_Plugin *_plug_new(); +static void _plug_free(Evry_Plugin *p); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); +static void _cleanup(Evry_Plugin *p); +static void _item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static void _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error); static Evry_Plugin_Class class; @@ -28,8 +28,8 @@ class.type_in = "NONE"; class.type_out = "FILE"; class.need_query = 1; - class.new = &_plug_tracker_new; - class.free = &_plug_tracker_free; + class.new = &_plug_new; + class.free = &_plug_free; evry_plugin_register(&class); return 1; @@ -44,7 +44,7 @@ } static Evry_Plugin * -_plug_tracker_new() +_plug_new() { Evry_Plugin *p; Inst *inst; @@ -54,10 +54,10 @@ p = E_NEW(Evry_Plugin, 1); p->class = &class; - p->fetch = &_plug_tracker_fetch; - p->action = &_plug_tracker_action; - p->cleanup = &_plug_tracker_cleanup; - p->icon_get = &_plug_tracker_item_icon_get; + p->fetch = &_fetch; + p->action = &_action; + p->cleanup = &_cleanup; + p->icon_get = &_item_icon_get; p->items = NULL; inst = E_NEW(Inst, 1); @@ -68,11 +68,11 @@ } static void -_plug_tracker_free(Evry_Plugin *p) +_plug_free(Evry_Plugin *p) { Inst *inst = p->priv; - _plug_tracker_cleanup(p); + _cleanup(p); e_dbus_connection_close(inst->conn); E_FREE(inst); @@ -80,13 +80,13 @@ } static int -_plug_tracker_action(Evry_Plugin *p, Evry_Item *it) +_action(Evry_Plugin *p, Evry_Item *it, const char *input) { return 0; } static void -_plug_tracker_cleanup(Evry_Plugin *p) +_cleanup(Evry_Plugin *p) { Evry_Item *it; @@ -101,7 +101,7 @@ } static int -_plug_tracker_fetch(Evry_Plugin *p, char *string) +_fetch(Evry_Plugin *p, const char *input) { Eina_List *list; DBusMessage *msg; @@ -113,10 +113,10 @@ char *match; Inst *inst = p->priv; - _plug_tracker_cleanup(p); + _cleanup(p); - match = malloc(sizeof(char) * strlen(string) + 2); - sprintf(match, "%s*", string); + match = malloc(sizeof(char) * strlen(input) + 2); + sprintf(match, "%s*", input); msg = dbus_message_new_method_call("org.freedesktop.Tracker", "/org/freedesktop/Tracker/Search", @@ -129,7 +129,7 @@ dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &match); dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &offset); dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &max_hits); - e_dbus_message_send(inst->conn, msg, _plug_tracker_dbus_cb_reply, -1, p); + e_dbus_message_send(inst->conn, msg, _dbus_cb_reply, -1, p); dbus_message_unref(msg); free(match); @@ -138,7 +138,7 @@ } static void -_plug_tracker_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { char *item_path; @@ -158,7 +158,7 @@ } static void -_plug_tracker_item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio) +_item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio) { Evry_Item *it; @@ -173,7 +173,7 @@ } static void -_plug_tracker_dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error) +_dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error) { DBusMessageIter array, iter, item; char *val; @@ -207,7 +207,7 @@ if (uri && service && mime) { - _plug_tracker_item_add(p, uri, service, mime, 1); + _item_add(p, uri, service, mime, 1); } } |
From: Enlightenment S. <no-...@en...> - 2009-06-21 21:27:36
|
Log: 'everything' module: fix segv when launching command with no plugin selected Author: jeffdameth Date: 2009-06-21 14:27:33 -0700 (Sun, 21 Jun 2009) New Revision: 41148 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-21 21:18:44 UTC (rev 41147) +++ trunk/e/src/modules/everything/evry.c 2009-06-21 21:27:33 UTC (rev 41148) @@ -779,15 +779,18 @@ } } - if ((s->cur_plugins) && - (!s->cur_plugin || !eina_list_data_find(s->cur_plugins, s->cur_plugin))) + if (s->cur_plugins) { - _evry_show_items(s->cur_plugins->data); + if (s->cur_plugin && eina_list_data_find(s->cur_plugins, s->cur_plugin)) + { + _evry_show_items(s->cur_plugin); + } + else + { + _evry_show_items(s->cur_plugins->data); + } } - else if (s->cur_plugin) - { - _evry_show_items(s->cur_plugin); - } + else s->cur_plugin = NULL; } static void |
From: Enlightenment S. <no-...@en...> - 2009-06-21 22:40:24
|
Log: 'everything' module: folder icon :) Author: jeffdameth Date: 2009-06-21 15:40:21 -0700 (Sun, 21 Jun 2009) New Revision: 41149 Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-06-21 21:27:33 UTC (rev 41148) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-06-21 22:40:21 UTC (rev 41149) @@ -218,7 +218,7 @@ if (!strcmp(it->mime, "Folder")) { it->o_icon = edje_object_add(e); - e_theme_edje_object_set(it->o_icon, "base/theme/fileman", "e/icons/fileman/folder"); + e_theme_edje_object_set(it->o_icon, "base/theme/fileman", "e/icons/folder"); } else { |
From: Enlightenment S. <no-...@en...> - 2009-06-21 23:25:42
|
Log: 'everything' module: mo icons Author: jeffdameth Date: 2009-06-21 16:25:39 -0700 (Sun, 21 Jun 2009) New Revision: 41153 Modified: trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_dir_browse.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-06-21 22:53:51 UTC (rev 41152) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-06-21 23:25:39 UTC (rev 41153) @@ -370,6 +370,13 @@ if (app->desktop) it->o_icon = e_util_desktop_icon_add(app->desktop, 24, e); + + if (!it->o_icon) + { + it->o_icon = edje_object_add(e); + /* e_util_icon_theme_set(it->o_icon, "system-run") */ + e_theme_edje_object_set(it->o_icon, "base/theme/fileman", "e/icons/system-run"); + } } static int Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-06-21 22:53:51 UTC (rev 41152) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-06-21 23:25:39 UTC (rev 41153) @@ -155,8 +155,15 @@ free(file); } - - return 1; + + if (eina_list_count(p->items) > 0) + { + p->items = eina_list_sort(p->items, eina_list_count(p->items), + _cb_sort); + return 1; + } + + return 0; } /* based on directory-watcher from drawer module */ @@ -170,11 +177,9 @@ it = E_NEW(Evry_Item, 1); snprintf(buf, sizeof(buf), "%s/%s", directory, file); - - it->uri = eina_stringshare_add(buf); - if ((e_util_glob_case_match(buf, "*.desktop")) || - (e_util_glob_case_match(buf, "*.directory"))) + if ((e_util_glob_case_match(file, "*.desktop")) || + (e_util_glob_case_match(file, "*.directory"))) { Efreet_Desktop *desktop; @@ -188,21 +193,28 @@ file_path = eina_stringshare_add(buf); - mime = e_fm_mime_filename_get(file_path); + it->uri = file_path; + + mime = efreet_mime_globs_type_get(file_path); if (mime) { it->mime = eina_stringshare_add(mime); - it->priority = 2; + it->priority = 0; } else if (ecore_file_is_dir(file_path)) { it->mime = eina_stringshare_add("Folder"); it->priority = 1; } - else + else if ((mime = efreet_mime_type_get(file_path))) { + it->mime = eina_stringshare_add(mime); + it->priority = 0; + } + else + { it->mime = eina_stringshare_add("None"); - it->priority = 2; + it->priority = 0; } return it; @@ -226,6 +238,11 @@ if (item_path) it->o_icon = e_util_icon_add(item_path, e); + else + { + it->o_icon = edje_object_add(e); + e_theme_edje_object_set(it->o_icon, "base/theme/fileman", "e/icons/fileman/file"); + } } } @@ -237,5 +254,5 @@ it1 = data1; it2 = data2; - return (it1->priority - it2->priority); + return (it2->priority - it1->priority); } Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-06-21 22:53:51 UTC (rev 41152) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-06-21 23:25:39 UTC (rev 41153) @@ -145,8 +145,8 @@ if (!strcmp(it->mime, "Folder")) { it->o_icon = edje_object_add(e); - e_theme_edje_object_set(it->o_icon, "base/theme/fileman", - "e/icons/fileman/folder"); + /* e_util_icon_theme_set(it->o_icon, "folder"); */ + e_theme_edje_object_set(it->o_icon, "base/theme/fileman", "e/icons/folder"); } else { @@ -154,6 +154,12 @@ if (item_path) it->o_icon = e_util_icon_add(item_path, e); + else + { + it->o_icon = edje_object_add(e); + /* e_util_icon_theme_set(it->o_icon, "file"); */ + e_theme_edje_object_set(it->o_icon, "base/theme/fileman", "e/icons/fileman/file"); + } } } |
From: Enlightenment S. <no-...@en...> - 2009-06-21 23:39:30
|
Log: 'everything' module: fix dir-browse sort ordering Author: jeffdameth Date: 2009-06-21 16:39:24 -0700 (Sun, 21 Jun 2009) New Revision: 41154 Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-06-21 23:25:39 UTC (rev 41153) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-06-21 23:39:24 UTC (rev 41154) @@ -142,12 +142,27 @@ EINA_LIST_FREE(files, file) { - if ((file[0] == '.') || - (input && - (!e_util_glob_case_match(file, match1)) && - (!e_util_glob_case_match(file, match2)))) - goto end; - it = _item_fill(inst->directory, file); + it = NULL; + + if (file[0] == '.') goto end; + + if (input) + { + if (e_util_glob_case_match(file, match1)) + { + it = _item_fill(inst->directory, file); + it->priority += 1; + } + else if (e_util_glob_case_match(file, match2)) + { + it = _item_fill(inst->directory, file); + } + } + else + { + it = _item_fill(inst->directory, file); + } + if (it) p->items = eina_list_append(p->items, it); @@ -254,5 +269,8 @@ it1 = data1; it2 = data2; - return (it2->priority - it1->priority); + if (it2->priority - it1->priority) + return (it2->priority - it1->priority); + else + return strcasecmp(it1->label, it2->label); } |
From: Enlightenment S. <no-...@en...> - 2009-06-22 18:34:56
|
Log: 'everything' module: fix segv on open-with with custom command - fix issue with finding .desktops for exehist items Author: jeffdameth Date: 2009-06-22 11:33:17 -0700 (Mon, 22 Jun 2009) New Revision: 41162 Modified: trunk/e/src/modules/everything/evry_plug_apps.c Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-06-22 17:38:56 UTC (rev 41161) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-06-22 18:33:17 UTC (rev 41162) @@ -142,25 +142,24 @@ _action(Evry_Plugin *p, Evry_Item *it, const char *input) { E_Zone *zone; - Evry_App *app; + Evry_App *app = NULL; Efreet_Desktop *desktop = NULL; Eina_List *files = NULL; Inst *inst = p->priv; int ret = 0; - app = it->data[0]; - zone = e_util_zone_current_get(e_manager_current_get()); - + if (it) app = it->data[0]; + if (inst->candidate) files = eina_list_append(files, inst->candidate->uri); - if (app->desktop) + if (app && app->desktop) { desktop = app->desktop; } - else if (input || app->file) + else { - if (app->file) + if (app && app->file) input = app->file; desktop = efreet_desktop_empty_new(""); @@ -179,6 +178,7 @@ if (desktop) { + zone = e_util_zone_current_get(e_manager_current_get()); e_exec(zone, desktop, NULL, files, NULL /*"everything"*/); if (!it) @@ -188,13 +188,7 @@ } eina_list_free(files); - - /* if (app->desktop) - * e_exec(zone, app->desktop, NULL, NULL, "everything"); - * else - * e_exec(zone, NULL, app->file, NULL, "everything"); */ - return ret; } @@ -314,39 +308,57 @@ Evry_App *app; Inst *inst = p->priv; Efreet_Desktop *desktop2; - + if (desktop) - file = ecore_file_app_exe_get(desktop->exec); + file = desktop->exec; if (!file) return; - if (desktop) - { - if ((desktop2 = eina_hash_find(inst->added, file))) - { - if (desktop == desktop2) - { - free(file); - return; - } - } - } - if (!inst->added) inst->added = eina_hash_string_superfast_new(NULL); - eina_hash_add(inst->added, file, desktop); + if (!desktop) + { + char match[4096]; + Eina_List *l; + int len; + char *tmp; + int found = 0; + + if (eina_hash_find(inst->added, file)) + return; + + len = strlen(file); + tmp = ecore_file_app_exe_get(file); + snprintf(match, sizeof(match), "%s*", tmp); + l = efreet_util_desktop_exec_glob_list(match); + + EINA_LIST_FREE(l, desktop) + { + if (desktop->exec && !strncmp(file, desktop->exec, len)) + { + found = 1; + break; + } + } + + eina_list_free(l); + free(tmp); + + if (!found) + eina_hash_add(inst->added, file, file); + } + if (desktop) { - free(file); + if ((desktop2 = eina_hash_find(inst->added, file))) + if (desktop == desktop2) + return; + + eina_hash_add(inst->added, file, desktop); file = NULL; } - else - { - desktop = efreet_util_desktop_exec_find(file); - if (desktop) file = NULL; - } it = calloc(1, sizeof(Evry_Item)); app = calloc(1, sizeof(Evry_App)); |
From: Enlightenment S. <no-...@en...> - 2009-06-24 20:02:41
|
Log: 'everything' module: added open-file sub action for apps (try tab on an app) - added Evry_Action which allows to add actions to item types that are provided by other source plugins. The action can act on two items, e.g. select an app -> chose action 'open file' -> all plugins which provide FILE are queried -> select file -> enter executes app with given file - moved back to static plugin instances, plugin that can be instantiated recursively must thandle this in begin/cleanup functions (see dir_browse) Author: jeffdameth Date: 2009-06-24 13:02:37 -0700 (Wed, 24 Jun 2009) New Revision: 41189 Added: trunk/e/src/modules/everything/evry_plug_border_act.c Modified: trunk/e/src/modules/everything/Makefile.am trunk/e/src/modules/everything/e_mod_main.c trunk/e/src/modules/everything/e_mod_main.h trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry.h trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_config.c trunk/e/src/modules/everything/evry_plug_dir_browse.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/Makefile.am =================================================================== --- trunk/e/src/modules/everything/Makefile.am 2009-06-24 19:38:23 UTC (rev 41188) +++ trunk/e/src/modules/everything/Makefile.am 2009-06-24 20:02:37 UTC (rev 41189) @@ -23,11 +23,13 @@ evry.c \ evry.h \ evry_plug_config.c \ + evry_plug_dir_browse.c \ evry_plug_apps.c \ evry_plug_tracker.c \ evry_plug_border.c \ - evry_plug_dir_browse.c + evry_plug_border_act.c + module_la_LIBADD = @e_libs@ @dlopen_libs@ module_la_LDFLAGS = -module -avoid-version module_la_DEPENDENCIES = $(top_builddir)/config.h Modified: trunk/e/src/modules/everything/e_mod_main.c =================================================================== --- trunk/e/src/modules/everything/e_mod_main.c 2009-06-24 19:38:23 UTC (rev 41188) +++ trunk/e/src/modules/everything/e_mod_main.c 2009-06-24 20:02:37 UTC (rev 41189) @@ -70,11 +70,12 @@ conf_module = m; evry_init(); - evry_plug_border_init(); - evry_plug_apps_init(); evry_plug_config_init(); evry_plug_dir_browse_init(); + evry_plug_apps_init(); evry_plug_tracker_init(); + evry_plug_border_init(); + evry_plug_border_act_init(); /* add module supplied action */ act = e_action_add("everything"); @@ -109,11 +110,12 @@ act = NULL; } - evry_plug_border_shutdown(); - evry_plug_apps_shutdown(); evry_plug_config_shutdown(); evry_plug_dir_browse_shutdown(); + evry_plug_apps_shutdown(); evry_plug_tracker_shutdown(); + evry_plug_border_shutdown(); + evry_plug_border_act_shutdown(); evry_shutdown(); conf_module = NULL; Modified: trunk/e/src/modules/everything/e_mod_main.h =================================================================== --- trunk/e/src/modules/everything/e_mod_main.h 2009-06-24 19:38:23 UTC (rev 41188) +++ trunk/e/src/modules/everything/e_mod_main.h 2009-06-24 20:02:37 UTC (rev 41189) @@ -51,6 +51,9 @@ EAPI int evry_plug_border_init(void); EAPI int evry_plug_border_shutdown(void); +EAPI int evry_plug_border_act_init(void); +EAPI int evry_plug_border_act_shutdown(void); + EAPI int evry_plug_config_init(void); EAPI int evry_plug_config_shutdown(void); Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-24 19:38:23 UTC (rev 41188) +++ trunk/e/src/modules/everything/evry.c 2009-06-24 20:02:37 UTC (rev 41189) @@ -10,15 +10,20 @@ struct _Evry_State { + Eina_List *cur_items; Eina_List *cur_plugins; Eina_List *plugins; Evry_Plugin *cur_plugin; Evry_Item *sel_item; + + Eina_List *cur_actions; + Evry_Action *cur_action; + /* Eina_List *sel_items; */ char *input; - + const char *request_type; + Eina_Bool initial; - Eina_Bool get_parameter; /* TODO better name !*/ }; static int _evry_cb_key_down(void *data, int type, void *event); @@ -53,34 +58,42 @@ static void _evry_plugin_selector_append(Evry_Plugin *p); static int _evry_cb_plugin_sort(const void *data1, const void *data2); +static int _evry_plug_act_select_init(void); +static int _evry_plug_act_select_actions_set(void); +static int _evry_plug_act_select_fetch(const char *input); +static int _evry_plug_act_select_action(Evry_Item *item, const char *input); +static void _evry_plug_act_select_cleanup(void); +static void _evry_plug_act_select_item_icon_get(Evry_Item *it, Evas *e); + + /* local subsystem globals */ static E_Popup *popup = NULL; static Ecore_X_Window input_window = 0; +static Eina_List *handlers = NULL; +static Ecore_Timer *update_timer = NULL; static Evas_Object *o_list = NULL; static Evas_Object *o_main = NULL; static Evas_Object *o_selector = NULL; static Evas_Object *o_selector_frame = NULL; -static Eina_List *handlers = NULL; -static Ecore_Timer *update_timer = NULL; - -static Eina_List *plugins = NULL; -static Evry_State *cur_state = NULL; -static Eina_List *stack = NULL; - -static int ev_last_is_mouse; +static int ev_last_is_mouse; static Evry_Item *item_mouseover = NULL; - static Ecore_Animator *scroll_animator = NULL; static Ecore_Timer *scroll_timer = NULL; static double scroll_align_to; static double scroll_align; +static Eina_List *plugins = NULL; +static Eina_List *actions = NULL; +static Evry_State *cur_state = NULL; +static Eina_List *stack = NULL; +static Evry_Plugin *action_selector = NULL; - /* externally accessible functions */ EAPI int evry_init(void) { + _evry_plug_act_select_init(); + return 1; } @@ -92,19 +105,33 @@ } EAPI void -evry_plugin_register(Evry_Plugin_Class *plugin) +evry_plugin_register(Evry_Plugin *plugin) { plugins = eina_list_append(plugins, plugin); /* TODO sorting, initialization, etc */ } EAPI void -evry_plugin_unregister(Evry_Plugin_Class *plugin) +evry_plugin_unregister(Evry_Plugin *plugin) { plugins = eina_list_remove(plugins, plugin); /* cleanup */ } +EAPI void +evry_action_register(Evry_Action *action) +{ + actions = eina_list_append(actions, action); + /* TODO sorting, initialization, etc */ +} + +EAPI void +evry_action_unregister(Evry_Action *action) +{ + actions = eina_list_remove(actions, action); + /* cleanup */ +} + EAPI int evry_show(E_Zone *zone) { @@ -209,7 +236,7 @@ free(s->input); EINA_LIST_FREE(s->plugins, p) - p->class->free(p); + p->cleanup(); } stack = NULL; cur_state = NULL; @@ -255,7 +282,7 @@ EAPI void -evry_plugin_async_update(Evry_Plugin *plugin, int state) +evry_plugin_async_update(Evry_Plugin *p, int state) { Evry_State *s; @@ -263,18 +290,23 @@ s = cur_state; - if (!eina_list_data_find(s->cur_plugins, plugin)) + if (!eina_list_data_find(s->cur_plugins, p)) { - s->cur_plugins = eina_list_append(s->cur_plugins, plugin); - _evry_plugin_selector_append(plugin); + s->cur_plugins = eina_list_append(s->cur_plugins, p); + _evry_plugin_selector_append(p); } - - if (s->cur_plugin && eina_list_data_find(s->cur_plugins, s->cur_plugin)) - _evry_show_items(s->cur_plugin); - else if (!s->cur_plugin && s->cur_plugins) - _evry_show_items(s->cur_plugins->data); - else if (s->cur_plugins && !eina_list_data_find(s->cur_plugins, s->cur_plugin)) - _evry_show_items(s->cur_plugins->data); + else + { + char buf[64]; + snprintf(buf, 64, "%s (%d)", p->name, eina_list_count(p->items)); + edje_object_part_text_set(p->tab, "e.text.label", buf); + } + + if (!s->cur_plugin && s->cur_plugins) + { + _evry_list_clear(); + _evry_show_items(s->cur_plugins->data); + } } /* local subsystem functions */ @@ -283,7 +315,7 @@ { const Evry_Plugin *p1 = data1; const Evry_Plugin *p2 = data2; - return p1->class->prio - p2->class->prio; + return p1->prio - p2->prio; } @@ -292,43 +324,67 @@ { Evry_State *s; Eina_List *l, *list = NULL; - Evry_Plugin_Class *pc; - const char *expect_type = "NONE"; + const char *cur_type = "NONE"; Evry_Plugin *p; s = cur_state; if (s) { - expect_type = s->cur_plugin->class->type_out; - if (!strcmp(expect_type, "NONE") || !s->sel_item) + if (!s->cur_plugin || !s->sel_item) return 0; + + cur_type = s->cur_plugin->type_out; + /* current plugin provides no candidates to act on by others */ + if (!s->cur_action && !strcmp(cur_type, "NONE")) + return 0; + + EINA_LIST_FOREACH(s->plugins, l, p) + if (p != s->cur_plugin) + p->cleanup(); } - - EINA_LIST_FOREACH(plugins, l, pc) + + EINA_LIST_FOREACH(plugins, l, p) { - if (strstr(pc->type_in, expect_type)) + if (strstr(p->type_in, cur_type)) { - p = pc->new(); + /* printf("%s- in:%s out:%s\n", p->name, p->type_in, p->type_out); */ + + if (s && s->cur_action) + { + /* filter out plugins that dont provide the type + requested by current action */ + if (strcmp(p->type_out, s->request_type)) + continue; + } - if (!p) continue; - - if (cur_state && p->begin) + if (p->begin) { - if (p->begin(p, cur_state->sel_item)) + Evry_Item *sel_item = NULL; + + if (s && (s->cur_plugin != action_selector)) + sel_item = s->sel_item; + + if (p->begin(sel_item)) list = eina_list_append(list, p); - else - p->class->free(p); } else list = eina_list_append(list, p); } } + if (s && !s->cur_action) + { + if (_evry_plug_act_select_actions_set()) + { + list = eina_list_append(list, action_selector); + } + } + if (!list) return 0; list = eina_list_sort(list, eina_list_count(list), _evry_cb_plugin_sort); - + _evry_list_clear(); if (s) @@ -346,7 +402,17 @@ s->plugins = list; s->cur_plugins = NULL; s->sel_item = NULL; - s->initial = (cur_state ? 0 : 1); + if (cur_state) + { + s->request_type = cur_state->request_type; + s->cur_action = cur_state->cur_action; + s->initial = 0; + } + else + { + s->initial = 1; + } + cur_state = s; stack = eina_list_prepend(stack, s); @@ -366,7 +432,9 @@ Evry_State *s = cur_state; Evry_Plugin *p; Eina_List *l; - + + if (!stack || !stack->next) return 0; + _evry_list_clear(); EINA_LIST_FREE(s->cur_plugins, p) @@ -378,7 +446,7 @@ free(s->input); EINA_LIST_FOREACH(s->plugins, l, p) - p->class->free(p); + p->cleanup(); E_FREE(s); @@ -386,42 +454,65 @@ if (stack) { + Evry_Item *it = NULL; + int i = 0; + s = stack->data; cur_state = s; + if (s->cur_plugin && s->cur_plugin == action_selector) + { + _evry_pop_state(); + return 0; + } + edje_object_part_text_set(o_main, "e.text.label", s->input); - EINA_LIST_FOREACH(s->cur_plugins, l, p) - _evry_plugin_selector_append(p); - - _evry_show_items(s->cur_plugin); - if (s->sel_item) { Evry_Item *it; - int i = 0; - - _evry_item_sel(s->sel_item); - EINA_LIST_FOREACH(s->cur_plugin->items, l, it) if (it == s->sel_item) break; else i++; - + } + + if (stack->next) + { + Evry_State *prev = stack->next->data; + it = prev->sel_item; + } + + EINA_LIST_FOREACH(s->plugins, l, p) + if (p != s->cur_plugin && p->begin) + p->begin(it); + + _evry_matches_update(); + + it = eina_list_nth(s->cur_plugin->items, i); + + if (it) + { + _evry_item_desel(s->sel_item); + s->sel_item = it; + _evry_item_sel(s->sel_item); _evry_scroll_to(i); } } - else - { - cur_state = NULL; - evry_hide(); - } + /* else + * { + * cur_state = NULL; + * evry_hide(); + * } */ + ev_last_is_mouse = 0; item_mouseover = NULL; + + return 1; } - +/* TODO config options for users preferred keys */ static int _evry_cb_key_down(void *data, int type, void *event) { @@ -437,27 +528,63 @@ _evry_item_prev(); else if (!strcmp(ev->key, "Down")) _evry_item_next(); + else if (!strcmp(ev->key, "Right") && + ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) || + (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) + { + if (s->sel_item) + { + if (!_evry_push_state()) + _evry_action(0); + } + } + /* _evry_plugin_next(); */ + else if (!strcmp(ev->key, "Left") && + ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) || + (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) + _evry_pop_state(); + /* _evry_plugin_prev(); */ else if (!strcmp(ev->key, "Right")) _evry_plugin_next(); + /* { + * if (s->sel_item) + * { + * if (!_evry_push_state()) + * _evry_action(0); + * } + * } */ else if (!strcmp(ev->key, "Left")) _evry_plugin_prev(); + /* _evry_pop_state(); */ else if (!strcmp(ev->key, "Return") && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) _evry_action(0); else if (!strcmp(ev->key, "Return")) _evry_action(1); + else if (!strcmp(ev->key, "Tab") && + ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) || + (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) + _evry_plugin_prev(); else if (!strcmp(ev->key, "Tab")) { - if (s->sel_item) - _evry_push_state(); + if (s->sel_item) + { + if (!_evry_push_state()) + _evry_action(0); + } } + /* _evry_plugin_next(); */ else if (!strcmp(ev->key, "u") && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) _evry_clear(); else if ((!strcmp(ev->key, "Escape")) || (!strcmp(ev->key, "g") && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL))) - _evry_pop_state(); + { + if (!_evry_pop_state()) + evry_hide(); + } + else if (!strcmp(ev->key, "BackSpace")) _evry_backspace(); else if (!strcmp(ev->key, "Delete")) @@ -641,17 +768,42 @@ } static void +_evry_clear(void) +{ + if (cur_state->input[0] != 0) + { + cur_state->input[0] = 0; + _evry_update(); + } +} + +static void _evry_action(int finished) { Evry_State *s = cur_state; - if (s->cur_plugin && (s->sel_item || s->input)) + if (s->cur_plugin == action_selector) { + /* set cur_action and start plugins for second parameter (if required)*/ + if (s->sel_item) _evry_plug_act_select_action(s->sel_item, s->input); + + finished = 0; + } + else if (s->cur_action) + { + if (s->sel_item && (!strcmp(s->cur_plugin->type_out, s->request_type))) + { + s->cur_action->thing2 = s->sel_item; + s->cur_action->action(); + } + } + else if (s->cur_plugin && (s->sel_item || s->input)) + { if (!s->cur_plugin->action || - !s->cur_plugin->action(s->cur_plugin, s->sel_item, s->input)) + !s->cur_plugin->action(s->sel_item, s->input)) { _evry_push_state(); - finished = 0; + finished = 0; } } else if (s->initial) @@ -662,18 +814,6 @@ } static void -_evry_clear(void) -{ - if (cur_state->input[0] != 0) - { - cur_state->input[0] = 0; - _evry_update(); - if (!update_timer) - update_timer = ecore_timer_add(MATCH_LAG, _evry_update_timer, NULL); - } -} - -static void _evry_show_items(Evry_Plugin *p) { Evry_Item *it; @@ -682,8 +822,6 @@ Evas_Object *o; Evry_State *s = cur_state; - _evry_list_clear(); - if (s->cur_plugin) edje_object_signal_emit(s->cur_plugin->tab, "e,state,unselected", "e"); @@ -691,10 +829,8 @@ s->sel_item = NULL; s->cur_plugin = p; + s->cur_items = p->items; - /* XXX remove this */ - if (!s->cur_plugin) return; - edje_object_signal_emit(p->tab, "e,state,selected", "e"); evas_event_freeze(popup->evas); @@ -715,7 +851,7 @@ _evry_cb_item_mouse_out, it); evas_object_show(o); - p->icon_get(p, it, popup->evas); + p->icon_get(it, popup->evas); if (edje_object_part_exists(o, "e.swallow.icons") && it->o_icon) { edje_object_part_swallow(o, "e.swallow.icons", it->o_icon); @@ -768,9 +904,9 @@ EINA_LIST_FOREACH(s->plugins, l, p) { if (strlen(s->input) == 0) - items = !p->class->need_query ? p->fetch(p, NULL) : 0; + items = !p->need_query ? p->fetch(NULL) : 0; else - items = p->fetch(p, s->input); + items = p->fetch(s->input); if (!s->initial || (items && eina_list_count(p->items) > 0)) { @@ -782,30 +918,29 @@ if (s->cur_plugins) { if (s->cur_plugin && eina_list_data_find(s->cur_plugins, s->cur_plugin)) - { - _evry_show_items(s->cur_plugin); - } + _evry_show_items(s->cur_plugin); else - { - _evry_show_items(s->cur_plugins->data); - } + _evry_show_items(s->cur_plugins->data); } - else s->cur_plugin = NULL; + else + { + s->cur_plugin = NULL; + s->cur_items = NULL; + } } static void _evry_list_clear(void) { Evry_State *s = cur_state; - - if (s && s->cur_plugin) + Evry_Item *it; + Eina_List *l; + + if (s && s->cur_items) { - Evry_Item *it; - Eina_List *l; - evas_event_freeze(popup->evas); e_box_freeze(o_list); - EINA_LIST_FOREACH(s->cur_plugin->items, l, it) + EINA_LIST_FOREACH(s->cur_items, l, it) { evas_object_del(it->o_bg); if (it->o_icon) evas_object_del(it->o_icon); @@ -945,10 +1080,12 @@ if (l && l->next) { + _evry_list_clear(); _evry_show_items(l->next->data); } else if (s->cur_plugin != s->cur_plugins->data) { + _evry_list_clear(); _evry_show_items(s->cur_plugins->data); } } @@ -967,6 +1104,7 @@ if (l && l->prev) { + _evry_list_clear(); _evry_show_items(l->prev->data); } else @@ -975,6 +1113,7 @@ if (s->cur_plugin != l->data) { + _evry_list_clear(); _evry_show_items(l->data); } } @@ -1026,23 +1165,123 @@ e_theme_edje_object_set(o, "base/theme/widgets", "e/widgets/toolbar/item"); - snprintf(buf, 64, "%s (%d)", p->class->name, eina_list_count(p->items)); + snprintf(buf, 64, "%s (%d)", p->name, eina_list_count(p->items)); edje_object_part_text_set(o, "e.text.label", buf); edje_object_size_min_calc(o, &mw, &mh); + e_box_freeze(o_selector); e_box_pack_end(o_selector, o); evas_object_show(o); - e_box_pack_options_set(o, - 1, 1, /* fill */ - 0, 0, /* expand */ - 0.5, 0.5, /* align */ - mw, mh, /* min */ - 9999, 9999 /* max */ - ); - + e_box_pack_options_set(o, 1, 1, 0, 0, 0.5, 0.5, mw, mh, 9999, 9999); + e_box_thaw(o_selector); p->tab = o; } + +static int +_evry_plug_act_select_init(void) +{ + Evry_Plugin *p = E_NEW(Evry_Plugin, 1); + p->name = "Select Action"; + p->type_in = "ANY"; + p->type_out = "NONE"; + p->cleanup = &_evry_plug_act_select_cleanup; + p->fetch = &_evry_plug_act_select_fetch; + p->action = &_evry_plug_act_select_action; + p->icon_get = &_evry_plug_act_select_item_icon_get; + action_selector = p; +} + +static int +_evry_plug_act_select_actions_set(void) +{ + Evry_Action *act; + Eina_List *l; + Evry_State *s = cur_state; + Evry_Plugin *p = action_selector; + + _evry_plug_act_select_cleanup(); + + const char *type = s->cur_plugin->type_out; + + EINA_LIST_FOREACH(actions, l, act) + { + if (strstr(act->type_in1, type)) + { + act->thing1 = s->sel_item; + s->cur_actions = eina_list_append(s->cur_actions, act); + } + } + + if (s->cur_actions) return 1; + + return 0; +} + +static int +_evry_plug_act_select_fetch(const char *input) +{ + Evry_Plugin *p = action_selector; + Evry_Action *act; + Eina_List *l; + + EINA_LIST_FOREACH(actions, l, act) + { + Evry_Item *it; + + it = E_NEW(Evry_Item, 1); + it->label = eina_stringshare_add(act->name); + it->data[0] = act; + + p->items = eina_list_append(p->items, it); + } + + if (p->items) return 1; + + return 0; +} + +static int +_evry_plug_act_select_action(Evry_Item *it, const char *input) +{ + Evry_Action *act = it->data[0]; + cur_state->cur_action = act; + + cur_state->request_type = act->type_in2; + + return _evry_push_state(); +} + +static void +_evry_plug_act_select_cleanup(void) +{ + + Evry_Item *it; + Evry_Plugin *p = action_selector; + + EINA_LIST_FREE(p->items, it) + { + eina_stringshare_del(it->label); + E_FREE(it); + } + + eina_list_free(cur_state->cur_actions); + cur_state->cur_actions = NULL; + + p->items = NULL; +} + +static void +_evry_plug_act_select_item_icon_get(Evry_Item *it, Evas *e) +{ + Evry_Action *act = it->data[0]; + + /* if (act->icon_get) + * it->o_icon = act->icon_get(act, e); */ + + +} + Modified: trunk/e/src/modules/everything/evry.h =================================================================== --- trunk/e/src/modules/everything/evry.h 2009-06-24 19:38:23 UTC (rev 41188) +++ trunk/e/src/modules/everything/evry.h 2009-06-24 20:02:37 UTC (rev 41189) @@ -4,8 +4,6 @@ #ifdef E_TYPEDEFS typedef struct _Evry_Plugin Evry_Plugin; -/* TODO find a better name - Registry ? */ -typedef struct _Evry_Plugin_Class Evry_Plugin_Class; typedef struct _Evry_Item Evry_Item; typedef struct _Evry_Action Evry_Action; typedef struct _Evry_Config Evry_Config; @@ -34,21 +32,19 @@ const char *uri; const char *mime; - - /* set by icon_get plugin method */ - Evas_Object *o_icon; - - /* used by 'everything' for display */ - Evas_Object *o_bg; /* these are only for internally use by plugins */ /* used e.g. as pointer for item data (Efreet_Desktop) or */ /* for internal stuff, like priority hints for sorting, etc */ void *data[4]; int priority; + + /* not to be set by plugin! */ + Evas_Object *o_icon; + Evas_Object *o_bg; }; - -struct _Evry_Plugin_Class + +struct _Evry_Plugin { const char *name; @@ -61,46 +57,59 @@ /* sync/async ?*/ unsigned char async_query : 1; - /* whether candidates can be shown without input: e.g. borders, history */ - /* if 0 fetch MUST provide all candidates when string is NULL */ + /* whether candidates can be shown without input + * e.g. borders, app history */ unsigned char need_query : 1; - - Evry_Plugin *(*new) (void); - void (*free) (Evry_Plugin *p); - - Evas_Object *(*config_page) (void); - void (*config_apply) (void); - - Eina_List *instances; -}; - - -struct _Evry_Plugin -{ - Evry_Plugin_Class *class; - + /* run when plugin is activated. */ - int (*begin) (Evry_Plugin *p, Evry_Item *item); + int (*begin) (Evry_Item *item); /* get candidates matching string, fills 'candidates' list */ - int (*fetch) (Evry_Plugin *p, const char *input); + int (*fetch) (const char *input); - /* run action with a given candidate - TODO register actions per - candidate type */ - int (*action) (Evry_Plugin *p, Evry_Item *item, const char *input); + /* default action for this plugins items */ + int (*action) (Evry_Item *item, const char *input); /* run before new query and when hiding 'everything' */ - void (*cleanup) (Evry_Plugin *p); + void (*cleanup) (void); - void (*icon_get) (Evry_Plugin *p, Evry_Item *it, Evas *e); + /* TODO return icon */ + void (*icon_get) (Evry_Item *it, Evas *e); /* provide more information for a candidate */ /* int (*candidate_info) (Evas *evas, Evry_Item *item); */ Eina_List *items; + + Evas_Object *(*config_page) (void); + void (*config_apply) (void); + /* for internal use by plugin */ + Eina_List *states; + void *priv; + + /* not to be set by plugin! */ Evas_Object *tab; +}; + +struct _Evry_Action +{ + const char *name; + const char *type_in1; + const char *type_in2; + const char *type_out; + + Evry_Item *thing1; + Evry_Item *thing2; + + int (*action) (void); + + void (*icon_get) (Evry_Plugin *p, Evry_Item *it, Evas *e); + void *priv; + + /* not to be set by plugin! */ + Evas_Object *o_icon; }; struct _Evry_Config @@ -123,8 +132,10 @@ EAPI int evry_show(E_Zone *zone); EAPI void evry_hide(void); -EAPI void evry_plugin_register(Evry_Plugin_Class *pc); -EAPI void evry_plugin_unregister(Evry_Plugin_Class *pc); +EAPI void evry_plugin_register(Evry_Plugin *p); +EAPI void evry_plugin_unregister(Evry_Plugin *p); +EAPI void evry_action_register(Evry_Action *act); +EAPI void evry_action_unregister(Evry_Action *act); EAPI void evry_plugin_async_update(Evry_Plugin *plugin, int state); Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-06-24 19:38:23 UTC (rev 41188) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-06-24 20:02:37 UTC (rev 41189) @@ -6,153 +6,110 @@ struct _Inst { Eina_Hash *added; - Eina_List *apps; Evry_Item *candidate; }; -static Evry_Plugin *_plug_new(); -static Evry_Plugin *_plug_new2(); -static void _plug_free(Evry_Plugin *p); -static int _begin(Evry_Plugin *p, Evry_Item *item); -static int _fetch(Evry_Plugin *p, const char *input); -static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); -static void _cleanup(Evry_Plugin *p); -static void _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio); +static int _begin(Evry_Item *item); +static int _fetch(const char *input); +static int _action(Evry_Item *item, const char *input); +static void _cleanup(void); +static void _item_add(Efreet_Desktop *desktop, char *file, int prio); static int _cb_sort(const void *data1, const void *data2); -static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static void _item_icon_get(Evry_Item *it, Evas *e); +static int _exec_action(void); -static Evry_Plugin_Class class; -static Evry_Plugin_Class class2; +static Evry_Plugin *p; +static Evry_Action *act; +static Inst *inst; -EAPI int -evry_plug_apps_init(void) -{ - class.name = "Applications"; - class.type_in = "NONE"; - class.type_out = "APPLICATION"; - class.need_query = 0; - class.new = &_plug_new; - class.free = &_plug_free; - class.prio = 1; - evry_plugin_register(&class); - class2.name = "Open With.."; - class2.type_in = "FILE"; - class2.type_out = "APPLICATION"; - class2.need_query = 0; - class2.new = &_plug_new2; - class2.free = &_plug_free; - class2.prio = 3; - evry_plugin_register(&class2); - return 1; -} - EAPI int -evry_plug_apps_shutdown(void) +evry_plug_apps_init(void) { - evry_plugin_unregister(&class); - evry_plugin_unregister(&class2); - - return 1; -} - -static Evry_Plugin * -_plug_new() -{ - Evry_Plugin *p = E_NEW(Evry_Plugin, 1); - p->class = &class; + p = E_NEW(Evry_Plugin, 1); + p->type_in = "NONE|FILE"; + p->type_out = "NONE"; + p->need_query = 0; + p->begin = &_begin; p->fetch = &_fetch; p->action = &_action; p->cleanup = &_cleanup; p->icon_get = &_item_icon_get; - p->items = NULL; + evry_plugin_register(p); - Inst *inst = E_NEW(Inst, 1); - inst->added = NULL; - p->priv = inst; + act = E_NEW(Evry_Action, 1); + act->name = "Open File..."; + act->type_in1 = "APPLICATION"; + act->type_in2 = "FILE"; + act->type_out = "NONE"; + act->action =_exec_action; + evry_action_register(act); - return p; + inst = NULL; + + return 1; } -static Evry_Plugin * -_plug_new2() +EAPI int +evry_plug_apps_shutdown(void) { - Evry_Plugin *p = E_NEW(Evry_Plugin, 1); - p->class = &class2; - p->begin = &_begin; - p->fetch = &_fetch; - p->action = &_action; - p->cleanup = &_cleanup; - p->icon_get = &_item_icon_get; - p->items = NULL; + evry_plugin_unregister(p); + evry_action_unregister(act); - Inst *inst = E_NEW(Inst, 1); - inst->added = NULL; - p->priv = inst; - - return p; + return 1; } -static void -_plug_free(Evry_Plugin *p) -{ - Inst *inst = p->priv; - - _cleanup(p); - if (inst->apps) eina_list_free(inst->apps); - - E_FREE(inst); - E_FREE(p); -} - static int -_begin(Evry_Plugin *p, Evry_Item *it) +_begin(Evry_Item *it) { - Inst *inst; const char *mime; - _cleanup(p); + if (inst) return 0; - if (!it || !it->uri) return 0; - inst = p->priv; - inst->candidate = it; + if (it) + { + p->name = "Open With..."; + p->type_out = "NONE"; + p->prio = 3; + + if (!it->uri) return 0; - if (!it->mime) - mime = efreet_mime_type_get(it->uri); + if (!it->mime) + mime = efreet_mime_type_get(it->uri); + else + mime = it->mime; + + if (!mime) return 0; + + inst = E_NEW(Inst, 1); + inst->candidate = it; + inst->apps = efreet_util_desktop_mime_list(mime); + } else - mime = it->mime; + { + p->name = "Applications"; + p->type_out = "APPLICATION"; + p->prio = 1; + + inst = E_NEW(Inst, 1); + } - if (!mime) return 0; - - /* if (!strcmp(mime, "Folder")) - * { - * apps = - * } - * else */ - - inst->apps = efreet_util_desktop_mime_list(mime); - return 1; } static int -_action(Evry_Plugin *p, Evry_Item *it, const char *input) +_action(Evry_Item *it, const char *input) { E_Zone *zone; Evry_App *app = NULL; Efreet_Desktop *desktop = NULL; Eina_List *files = NULL; - Inst *inst = p->priv; - int ret = 0; if (it) app = it->data[0]; - - if (inst->candidate) - files = eina_list_append(files, inst->candidate->uri); - + if (app && app->desktop) { desktop = app->desktop; @@ -178,22 +135,26 @@ if (desktop) { + if (inst->candidate) + files = eina_list_append(files, inst->candidate->uri); + zone = e_util_zone_current_get(e_manager_current_get()); e_exec(zone, desktop, NULL, files, NULL /*"everything"*/); if (!it) efreet_desktop_free(desktop); - - ret = 1; + + eina_list_free(files); + + return 1; } - eina_list_free(files); - - return ret; + return 0; } + static void -_cleanup(Evry_Plugin *p) +_list_free(void) { Evry_Item *it; Evry_App *app; @@ -201,15 +162,29 @@ EINA_LIST_FREE(p->items, it) { if (it->label) eina_stringshare_del(it->label); - if (it->o_icon) evas_object_del(it->o_icon); app = it->data[0]; free(app); free(it); } } +static void +_cleanup(void) +{ + _list_free(); + + if (inst) + { + eina_list_free(inst->apps); + E_FREE(inst); + } + + inst = NULL; +} + + static int -_fetch(Evry_Plugin *p, const char *input) +_fetch(const char *input) { Eina_List *l; Efreet_Desktop *desktop; @@ -217,16 +192,14 @@ char match1[4096]; char match2[4096]; - Inst *inst = p->priv; - - _cleanup(p); + _list_free(); if (inst->apps) { if (!input) { EINA_LIST_FOREACH(inst->apps, l, desktop) - _item_add(p, desktop, NULL, 1); + _item_add(desktop, NULL, 1); } else { @@ -235,19 +208,20 @@ EINA_LIST_FOREACH(inst->apps, l, desktop) { - if (desktop->name) - { - if (e_util_glob_case_match(desktop->name, match1)) - _item_add(p, desktop, NULL, 1); - else if (e_util_glob_case_match(desktop->name, match2)) - _item_add(p, desktop, NULL, 2); - else if (desktop->comment) - { - if (e_util_glob_case_match(desktop->comment, match1)) - _item_add(p, desktop, NULL, 3); - else if (e_util_glob_case_match(desktop->comment, match2)) - _item_add(p, desktop, NULL, 4); - } + if (e_util_glob_case_match(desktop->exec, match1)) + _item_add(desktop, NULL, 1); + else if (e_util_glob_case_match(desktop->exec, match2)) + _item_add(desktop, NULL, 2); + else if (e_util_glob_case_match(desktop->name, match1)) + _item_add(desktop, NULL, 1); + else if (e_util_glob_case_match(desktop->name, match2)) + _item_add(desktop, NULL, 2); + else if (desktop->comment) + { + if (e_util_glob_case_match(desktop->comment, match1)) + _item_add(desktop, NULL, 3); + else if (e_util_glob_case_match(desktop->comment, match2)) + _item_add(desktop, NULL, 4); } } } @@ -259,28 +233,28 @@ snprintf(match1, sizeof(match1), "%s*", input); l = efreet_util_desktop_exec_glob_list(match1); EINA_LIST_FREE(l, desktop) - _item_add(p, desktop, NULL, 1); + _item_add(desktop, NULL, 1); snprintf(match1, sizeof(match1), "*%s*", input); l = efreet_util_desktop_name_glob_list(match1); EINA_LIST_FREE(l, desktop) - _item_add(p, desktop, NULL, 2); + _item_add(desktop, NULL, 2); // TODO make these optional/configurable l = efreet_util_desktop_generic_name_glob_list(match1); EINA_LIST_FREE(l, desktop) - _item_add(p, desktop, NULL, 3); + _item_add(desktop, NULL, 3); l = efreet_util_desktop_comment_glob_list(match1); EINA_LIST_FREE(l, desktop) - _item_add(p, desktop, NULL, 3); + _item_add(desktop, NULL, 3); } else if (!p->items) { // TODO option for popular/recent l = e_exehist_list_get(); EINA_LIST_FREE(l, file) - _item_add(p, NULL, file, 1); + _item_add(NULL, file, 1); } if (inst->added) @@ -292,9 +266,7 @@ if (p->items) { if (input) - p->items = eina_list_sort(p->items, - eina_list_count(p->items), - _cb_sort); + p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); return 1; } @@ -302,16 +274,27 @@ } static void -_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio) +_item_add(Efreet_Desktop *desktop, char *file, int prio) { Evry_Item *it; Evry_App *app; - Inst *inst = p->priv; Efreet_Desktop *desktop2; if (desktop) - file = desktop->exec; + { + Eina_List *l; + char *cat; + /* ignore screensaver.. */ + EINA_LIST_FOREACH(desktop->categories, l, cat) + { + if (cat && !strcmp(cat, "Screensaver")) + return; + } + + file = desktop->exec; + } + if (!file) return; if (!inst->added) @@ -376,7 +359,7 @@ } static void -_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) +_item_icon_get(Evry_Item *it, Evas *e) { Evry_App *app = it->data[0]; @@ -416,3 +399,22 @@ else return 0; } + +static int +_exec_action(void) +{ + if (act->thing1 && act->thing2) + { + inst = E_NEW(Inst, 1); + inst->candidate = act->thing2; + + _action(act->thing1, NULL); + + E_FREE(inst); + inst = NULL; + + return 1; + } + + return 0; +} Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-06-24 19:38:23 UTC (rev 41188) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-06-24 20:02:37 UTC (rev 41189) @@ -8,48 +8,29 @@ E_Border *border; }; -static Evry_Plugin * _src_border_new(void); -static void _src_border_free(Evry_Plugin *p); -static int _src_border_fetch(Evry_Plugin *p, const char *input); -static int _src_border_action(Evry_Plugin *p, Evry_Item *item, const char *input); -static void _src_border_cleanup(Evry_Plugin *p); -static void _src_border_item_add(Evry_Plugin *p, E_Border *bd, int prio); -static int _src_border_cb_sort(const void *data1, const void *data2); -static void _src_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static int _fetch(const char *input); +static int _action(Evry_Item *item, const char *input); +static void _cleanup(void); +static void _item_add(E_Border *bd, int prio); +static int _cb_sort(const void *data1, const void *data2); +static void _item_icon_get(Evry_Item *it, Evas *e); -static Evry_Plugin * _act_border_new(void); -static void _act_border_free(Evry_Plugin *p); -static int _act_border_begin(Evry_Plugin *p, Evry_Item *item); -static int _act_border_fetch(Evry_Plugin *p, const char *input); -static int _act_border_action(Evry_Plugin *p, Evry_Item *item, const char *input); -static void _act_border_cleanup(Evry_Plugin *p); -static void _act_border_item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon); -static void _act_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static Evry_Plugin *p; -static Evry_Plugin_Class source; -static Evry_Plugin_Class action; - - EAPI int evry_plug_border_init(void) { - source.name = "Windows"; - source.type_in = "NONE"; - source.type_out = "BORDER"; - source.need_query = 0; - source.prio = 0; - source.new = &_src_border_new; - source.free = &_src_border_free; - evry_plugin_register(&source); - - action.name = "Window Action"; - action.type_in = "BORDER"; - action.type_out = "NONE"; - action.need_query = 0; - action.prio = 0; - action.new = &_act_border_new; - action.free = &_act_border_free; - evry_plugin_register(&action); + p = E_NEW(Evry_Plugin, 1); + p->name = "Windows"; + p->type_in = "NONE"; + p->type_out = "BORDER"; + p->need_query = 0; + p->prio = 0; + p->fetch = &_fetch; + p->action = &_action; + p->cleanup = &_cleanup; + p->icon_get = &_item_icon_get; + evry_plugin_register(p); return 1; } @@ -57,38 +38,14 @@ EAPI int evry_plug_border_shutdown(void) { - evry_plugin_unregister(&source); - evry_plugin_unregister(&action); - + evry_plugin_unregister(p); + E_FREE(p); + return 1; } -static Evry_Plugin * -_src_border_new() -{ - Evry_Plugin *p; - - p = E_NEW(Evry_Plugin, 1); - p->class = &source; - p->fetch = &_src_border_fetch; - p->action = &_src_border_action; - p->cleanup = &_src_border_cleanup; - p->icon_get = &_src_border_item_icon_get; - p->items = NULL; - - return p; -} - -static void -_src_border_free(Evry_Plugin *p) -{ - _src_border_cleanup(p); - E_FREE(p); -} - - static int -_src_border_action(Evry_Plugin *p, Evry_Item *it, const char *input) +_action(Evry_Item *it, const char *input) { E_Border *bd; E_Zone *zone; @@ -116,7 +73,7 @@ } static void -_src_border_cleanup(Evry_Plugin *p) +_cleanup() { Evry_Item *it; @@ -124,13 +81,12 @@ { /* if (it->data[0]) e_object_unref(E_OBJECT(it->data[0])); */ if (it->label) eina_stringshare_del(it->label); - if (it->o_icon) evas_object_del(it->o_icon); free(it); } } static int -_src_border_fetch(Evry_Plugin *p, const char *input) +_fetch(const char *input) { E_Manager *man; E_Zone *zone; @@ -141,7 +97,7 @@ E_Border *bd; E_Border_List *bl; - _src_border_cleanup(p); + _cleanup(); man = e_manager_current_get(); zone = e_util_zone_current_get(man); @@ -158,25 +114,24 @@ if (zone == bd->zone) { if (!input) - _src_border_item_add(p, bd, 1); + _item_add(bd, 1); else if (bd->client.icccm.name && e_util_glob_case_match(bd->client.icccm.name, match1)) - _src_border_item_add(p, bd, 1); + _item_add(bd, 1); else if (e_util_glob_case_match(e_border_name_get(bd), match1)) - _src_border_item_add(p, bd, 1); + _item_add(bd, 1); else if (bd->client.icccm.name && e_util_glob_case_match(bd->client.icccm.name, match2)) - _src_border_item_add(p, bd, 2); + _item_add(bd, 2); else if (e_util_glob_case_match(e_border_name_get(bd), match2)) - _src_border_item_add(p, bd, 2); + _item_add(bd, 2); } } e_container_border_list_free(bl); if (eina_list_count(p->items) > 0) { - p->items = eina_list_sort(p->items, eina_list_count(p->items), - _src_border_cb_sort); + p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); return 1; } @@ -184,13 +139,13 @@ } static void -_src_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) +_item_icon_get(Evry_Item *it, Evas *e) { it->o_icon = e_border_icon_add(((E_Border *)it->data[0]), e); } static void -_src_border_item_add(Evry_Plugin *p, E_Border *bd, int prio) +_item_add(E_Border *bd, int prio) { Evry_Item *it; @@ -205,7 +160,7 @@ /* TODO sort by focus history and name? */ static int -_src_border_cb_sort(const void *data1, const void *data2) +_cb_sort(const void *data1, const void *data2) { const Evry_Item *it1, *it2; @@ -215,121 +170,3 @@ return (it1->priority - it2->priority); } - - -static Evry_Plugin * -_act_border_new() -{ - Evry_Plugin *p; - Inst *inst; - - p = E_NEW(Evry_Plugin, 1); - p->class = &source; - p->begin = &_act_border_begin; - p->fetch = &_act_border_fetch; - p->action = &_act_border_action; - p->cleanup = &_act_border_cleanup; - p->icon_get = &_act_border_item_icon_get; - p->items = NULL; - - inst = E_NEW(Inst, 1); - p->priv = inst; - - return p; -} - -static void -_act_border_free(Evry_Plugin *p) -{ - Inst *inst = p->priv; - - /* if (inst->border) e_object_unref(E_OBJECT(inst->border)); */ - - _act_border_cleanup(p); - - E_FREE(p); - E_FREE(inst); -} - -static void -_act_cb_border_close(E_Border *bd) -{ - if (!bd->lock_close) e_border_act_close_begin(bd); -} - -static void -_act_cb_border_minimize(E_Border *bd) -{ - if (!bd->lock_user_iconify) e_border_iconify(bd); -} - -static int -_act_border_begin(Evry_Plugin *p, Evry_Item *item) -{ - Inst *inst = p->priv; - E_Border *bd; - - bd = item->data[0]; - /* e_object_ref(E_OBJECT(bd)); */ - inst->border = bd; - - return 1; -} - -static int -_act_border_fetch(Evry_Plugin *p, const char *input) -{ - _act_border_cleanup(p); - - _act_border_item_add(p, _("Iconify"), _act_cb_border_minimize, - "e/widgets/border/default/minimize"); - - _act_border_item_add(p, _("Close"), _act_cb_border_close, - "e/widgets/border/default/close"); - return 1; -} - -static int -_act_border_action(Evry_Plugin *p, Evry_Item *item, const char *input) -{ - Inst *inst = p->priv; - - void (*border_action) (E_Border *bd); - border_action = item->data[0]; - border_action(inst->border); - return 1; -} - -static void -_act_border_cleanup(Evry_Plugin *p) -{ - Evry_Item *it; - - EINA_LIST_FREE(p->items, it) - { - if (it->data[1]) eina_stringshare_del(it->data[1]); - if (it->label) eina_stringshare_del(it->label); - if (it->o_icon) evas_object_del(it->o_icon); - free(it); - } -} - -static void -_act_border_item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon) -{ - Evry_Item *it; - - it = calloc(1, sizeof(Evry_Item)); - it->data[0] = action_cb; - it->data[1] = (void *) eina_stringshare_add(icon); - it->label = eina_stringshare_add(label); - p->items = eina_list_append(p->items, it); -} - -static void -_act_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) -{ - it->o_icon = edje_object_add(e); - e_theme_edje_object_set(it->o_icon, "base/theme/borders", (const char *)it->data[1]); -} - Added: trunk/e/src/modules/everything/evry_plug_border_act.c Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-06-24 19:38:23 UTC (rev 41188) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-06-24 20:02:37 UTC (rev 41189) @@ -1,59 +1,43 @@ #include "e.h" #include "e_mod_main.h" -static Evry_Plugin_Class class; -static Evry_Plugin *_plug_new(); -static void _plug_free(Evry_Plugin *p); -static int _fetch(Evry_Plugin *p, const char *input); -static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); -static void _cleanup(Evry_Plugin *p); -static void _item_add(Evry_Plugin *p, E_Configure_It *eci, int prio); -static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static int _fetch(const char *input); +static int _action(Evry_Item *item, const char *input); +static void _cleanup(void); +static void _item_add(E_Configure_It *eci, int prio); +static void _item_icon_get(Evry_Item *it, Evas *e); static int _cb_sort(const void *data1, const void *data2); +static Evry_Plugin *p; + EAPI int evry_plug_config_init(void) { - class.name = "Settings"; - class.type_in = "NONE"; - class.type_out = "NONE"; - class.instances = NULL; - class.new = &_plug_new; - class.free = &_plug_free; - evry_plugin_register(&class); + p = E_NEW(Evry_Plugin, 1); + p->name = "Settings"; + p->type_in = "NONE"; + p->type_out = "NONE"; + p->prio = 4; + p->fetch = &_fetch; + p->action = &_action; + p->cleanup = &_cleanup; + p->icon_get = &_item_icon_get; + + evry_plugin_register(p); return 1; } EAPI int evry_plug_config_shutdown(void) { - evry_plugin_unregister(&class); + evry_plugin_unregister(p); + E_FREE(p); return 1; } -static Evry_Plugin * -_plug_new() -{ - Evry_Plugin *p = E_NEW(Evry_Plugin, 1); - p->class = &class; - p->fetch = &_fetch; - p->action = &_action; - p->cleanup = &_cleanup; - p->icon_get = &_item_icon_get; - p->items = NULL; -} - - -static void -_plug_free(Evry_Plugin *p) -{ - _cleanup(p); - E_FREE(p); -} - static int -_action(Evry_Plugin *p, Evry_Item *it, const char *input) +_action(Evry_Item *it, const char *input) { E_Configure_It *eci, *eci2; E_Container *con; @@ -90,20 +74,19 @@ } static void -_cleanup(Evry_Plugin *p) +_cleanup(void) { Evry_Item *it; EINA_LIST_FREE(p->items, it) { if (it->label) eina_stringshare_del(it->label); - if (it->o_icon) evas_object_del(it->o_icon); free(it); } } static int -_fetch(Evry_Plugin *p, const char *input) +_fetch(const char *input) { E_Manager *man; E_Zone *zone; @@ -114,7 +97,7 @@ E_Configure_Cat *ecat; E_Configure_It *eci; - _cleanup(p); + _cleanup(); snprintf(match1, sizeof(match1), "%s*", input); snprintf(match2, sizeof(match2), "*%s*", input); @@ -130,13 +113,13 @@ if (eci->pri >= 0) { if (e_util_glob_case_match(eci->label, match1)) - _item_add(p, eci, 1); + _item_add(eci, 1); else if (e_util_glob_case_match(eci->label, match2)) - _item_add(p, eci, 2); + _item_add(eci, 2); else if (e_util_glob_case_match(ecat->label, match1)) - _item_add(p, eci, 3); + _item_add(eci, 3); else if (e_util_glob_case_match(ecat->label, match2)) - _item_add(p, eci, 4); + _item_add(eci, 4); } } } @@ -144,9 +127,7 @@ if (eina_list_count(p->items) > 0) { - p->items = eina_list_sort(p->items, - eina_list_count(p->items), - _cb_sort); + p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); return 1; } @@ -154,7 +135,7 @@ } static void -_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) +_item_icon_get(Evry_Item *it, Evas *e) { E_Configure_It *eci = it->data[0]; Evas_Object *o = NULL; @@ -173,7 +154,7 @@ } static void -_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio) +_item_add(E_Configure_It *eci, int prio) { Evry_Item *it; @@ -186,8 +167,6 @@ p->items = eina_list_append(p->items, it); } - -// TODO sort name? static int _cb_sort(const void *data1, const void *data2) { @@ -196,5 +175,7 @@ it1 = data1; it2 = data2; + /* TODO sort by name? */ + return (it1->priority - it2->priority); } Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-06-24 19:38:23 UTC (rev 41188) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-06-24 20:02:37 UTC (rev 41189) @@ -1,87 +1,86 @@ #include "e.h" #include "e_mod_main.h" -typedef struct _Inst Inst; +typedef struct _State State; -struct _Inst +struct _State { const char *directory; + Eina_List *items; }; -static Evry_Plugin *_plug_new(); -static void _plug_free(Evry_Plugin *p); -static int _begin(Evry_Plugin *p, Evry_Item *item); -static int _fetch(Evry_Plugin *p, const char *input); -static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); -static void _cleanup(Evry_Plugin *p); +static int _begin(Evry_Item *it); +static int _fetch(const char *input); +static int _action(Evry_Item *it, const char *input); +static void _cleanup(void); static int _cb_sort(const void *data1, const void *data2); -static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); -static void _list_free(Evry_Plugin *p); +static void _item_icon_get(Evry_Item *it, Evas *e); +static void _list_free(void); static Evry_Item *_item_fill(const char *directory, const char *file); -static Evry_Plugin_Class class; +static Evry_Plugin *p; EAPI int evry_plug_dir_browse_init(void) { - class.name = "Browse Files"; - class.type_in = "NONE|FILE"; - class.type_out = "FILE"; - class.prio = 2; - class.new = &_plug_new; - class.free = &_plug_free; - evry_plugin_register(&class); + p = E_NEW(Evry_Plugin, 1); + p->name = "Browse Files"; + p->type_in = "NONE|FILE"; + p->type_out = "FILE"; + p->prio = 2; + p->begin = &_begin; + p->fetch = &_fetch; + p->action = &_action; + p->cleanup = &_cleanup; + p->icon_get = &_item_icon_get; + evry_plugin_register(p); + return 1; } EAPI int evry_plug_dir_browse_shutdown(void) { - evry_plugin_unregister(&class); + evry_plugin_unregister(p); + E_FREE(p); return 1; } -static Evry_Plugin * -_plug_new() +static int +_begin(Evry_Item *it) { - Evry_Plugin *p = E_NEW(Evry_Plugin, 1); - p->class = &class; - p->begin = &_begin; - p->fetch = &_fetch; - p->action = &_action; - p->cleanup = &_cleanup; - p->icon_get = &_item_icon_get; - p->items = NULL; + State *s; + + if (it) + { + if (!it->uri || !ecore_file_is_dir(it->uri)) + return 0; - Inst *inst = E_NEW(Inst, 1); - inst->directory = eina_stringshare_add(e_user_homedir_get()); - p->priv = inst; + s = E_NEW(State, 1); + s->directory = eina_stringshare_add(it->uri); + } + else + { + s = E_NEW(State, 1); + s->directory = eina_stringshare_add(e_user_homedir_get()); + } - return p; + p->states = eina_list_prepend(p->states, s); + p->items = NULL; + + return 1; } -static void -_plug_free(Evry_Plugin *p) -{ - _cleanup(p); - - Inst *inst = p->priv; - eina_stringshare_del(inst->directory); - E_FREE(inst); - E_FREE(p); -} - - static int -_action(Evry_Plugin *p, Evry_Item *item, const char *input) +_action(Evry_Item *it, const char *input) { return 0; } static void -_list_free(Evry_Plugin *p) +_list_free() { Evry_Item *it; @@ -90,7 +89,6 @@ if (it->label) eina_stringshare_del(it->label); if (it->uri) eina_stringshare_del(it->uri); if (it->mime) eina_stringshare_del(it->mime); - if (it->o_icon) evas_object_del(it->o_icon); free(it); } @@ -98,41 +96,43 @@ static void -_cleanup(Evry_Plugin *p) +_cleanup() { - _list_free(p); -} + State *s; + + if (!p->states) return; -static int -_begin(Evry_Plugin *p, Evry_Item *item) -{ - Inst *inst = p->priv; + s = p->states->data; - if (item->uri && ecore_file_is_dir(item->uri)) + _list_free(); + + eina_stringshare_del(s->directory); + + E_FREE(s); + + p->states = eina_list_remove_list(p->states, p->states); + + if (p->states) { - eina_stringshare_del(inst->directory); - inst->directory = eina_stringshare_add(item->uri); - - return 1; + s = p->states->data; + p->items = s->items; } - - return 0; } /* based on directory-watcher from drawer module */ static int -_fetch(Evry_Plugin *p, const char *input) +_fetch(const char *input) { Eina_List *files; char *file; Evry_Item *it; char match1[4096]; char match2[4096]; - Inst *inst = p->priv; + State *s = p->states->data; - _list_free(p); + _list_free(); - files = ecore_file_ls(inst->directory); + files = ecore_file_ls(s->directory); if (input) { @@ -144,37 +144,41 @@ { it = NULL; - if (file[0] == '.') goto end; + if (file[0] == '.') + { + free(file); + continue; + } if (input) { if (e_util_glob_case_match(file, match1)) { - it = _item_fill(inst->directory, file); + it = _item_fill(s->directory, file); it->priority += 1; } else if (e_util_glob_case_match(file, match2)) { - it = _item_fill(inst->directory, file); + it = _item_fill(s->directory, file); } } else { - it = _item_fill(inst->directory, file); + it = _item_fill(s->directory, file); } if (it) p->items = eina_list_append(p->items, it); - end: free(file); - } if (eina_list_count(p->items) > 0) { p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); + s->items = p->items; + return 1; } @@ -236,7 +240,7 @@ } static void -_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) +_item_icon_get(Evry_Item *it, Evas *e) { char *item_path; Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-06-24 19:38:23 UTC (rev 41188) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-06-24 20:02:37 UTC (rev 41189) @@ -10,83 +10,67 @@ E_DBus_Connection *conn; }; -static Evry_Plugin *_plug_new(); -static void _plug_free(Evry_Plugin *p); -static int _fetch(Evry_Plugin *p, const char *input); -static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); -static void _cleanup(Evry_Plugin *p); -static void _item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio); -static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static int _fetch(const char *input); +static int _action(Evry_Item *it, const char *input); +static void _cleanup(void); +static void _item_add(char *file, char *service, char *mime, int prio); +static void _item_icon_get(Evry_Item *it, Evas *e); static void _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error); -static Evry_Plugin_Class class; +static Evry_Plugin *p; +static Inst *inst; EAPI int evry_plug_tracker_init(void) { - class.name = "Search Files"; - class.type_in = "NONE"; - class.type_out = "FILE"; - class.need_query = 1; - class.new = &_plug_new; - class.free = &_plug_free; - evry_plugin_register(&class); - - return 1; -} - -EAPI int -evry_plug_tracker_shutdown(void) -{ - evry_plugin_unregister(&class); - - return 1; -} - -static Evry_Plugin * -_plug_new() -{ - Evry_Plugin *p; - Inst *inst; E_DBus_Connection *conn = e_dbus_bus_get(DBUS_BUS_SESSION); - if (!conn) return NULL; - + if (!conn) return 0; + p = E_NEW(Evry_Plugin, 1); - p->class = &class; + p->name = "Search Files"; + p->type_in = "NONE"; + p->type_out = "FILE"; + p->need_query = 1; + p->prio = 3; p->fetch = &_fetch; p->action = &_action; p->cleanup = &_cleanup; p->icon_get = &_item_icon_get; - p->items = NULL; - + inst = E_NEW(Inst, 1); - inst->conn = conn; - p->priv = inst; + inst->conn = conn; + + evry_plugin_register(p); - return p; + return 1; } -static void -_plug_free(Evry_Plugin *p) +EAPI int +evry_plug_tracker_shutdown(void) { - Inst *inst = p->priv; - - _cleanup(p); - e_dbus_connection_close(inst->conn); + evry_plugin_unregister(p); - E_FREE(inst); - E_FREE(p); + if (inst) + { + if (inst->conn) + e_dbus_connection_close(inst->conn); + E_FREE(inst); + } + + if (p) E_FREE(p); + + return 1; } static int -_action(Evry_Plugin *p, Evry_Item *it, const char *input) +_action(Evry_Item *it, const char *input) { return 0; } static void -_cleanup(Evry_Plugin *p) +_cleanup(void) { Evry_Item *it; @@ -95,13 +79,12 @@ if (it->mime) eina_stringshare_del(it->mime); if (it->uri) eina_stringshare_del(it->uri); if (it->label) eina_stringshare_del(it->label); - if (it->o_icon) evas_object_del(it->o_icon); free(it); } } static int -_fetch(Evry_Plugin *p, const char *input) +_fetch(const char *input) { Eina_List *list; DBusMessage *msg; @@ -111,9 +94,8 @@ int max_hits = 50; char *service = "Files"; char *match; - Inst *inst = p->priv; - _cleanup(p); + _cleanup(); match = malloc(sizeof(char) * strlen(input) + 2); sprintf(match, "%s*", input); @@ -129,7 +111,7 @@ dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &match); dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &offset); dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &max_hits); - e_dbus_message_send(inst->conn, msg, _dbus_cb_reply, -1, p); + e_dbus_message_send(inst->conn, msg, _dbus_cb_reply, -1, NULL); dbus_message_unref(msg); free(match); @@ -138,7 +120,7 @@ } static void -_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) +_item_icon_get(Evry_Item *it, Evas *e) { char *item_path; @@ -164,7 +146,7 @@ } static void -_item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio) +_item_add(char *file, char *service, char *mime, int prio) { Evry_Item *it; @@ -183,7 +165,6 @@ { DBusMessageIter array, iter, item; char *val; - Evry_Plugin *p = data; if (dbus_error_is_set(error)) { @@ -213,7 +194,7 @@ if (uri && service && mime) { - _item_add(p, uri, service, mime, 1); + _item_add(uri, service, mime, 1); } } |
From: Enlightenment S. <no-...@en...> - 2009-06-25 05:56:08
|
Log: 'everything' module: show on current zone Author: jeffdameth Date: 2009-06-24 22:56:02 -0700 (Wed, 24 Jun 2009) New Revision: 41192 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-06-25 04:20:34 UTC (rev 41191) +++ trunk/e/src/modules/everything/evry.c 2009-06-25 05:56:02 UTC (rev 41192) @@ -153,8 +153,8 @@ return 0; } - x = zone->x + (zone->w / 2) - (evry_conf->width / 2); - y = zone->y + (zone->h / 2) - (evry_conf->height / 2); + x = (zone->w / 2) - (evry_conf->width / 2); + y = (zone->h / 2) - (evry_conf->height / 2); popup = e_popup_new(zone, x, y, evry_conf->width, evry_conf->height); if (!popup) return 0; |
From: Enlightenment S. <no-...@en...> - 2009-07-03 14:28:53
|
Log: 'everythin' module: - added initial version of calculator frontend (only bc for now) - return without candidate selected adds current result to the history - return on candidate puts result in clipboard - scrolling for the plugin selector tabs - fix segv when popping a state without a selected candidate Author: jeffdameth Date: 2009-07-03 06:37:54 -0700 (Fri, 03 Jul 2009) New Revision: 41242 Added: trunk/e/src/modules/everything/evry_plug_calc.c Modified: trunk/e/src/modules/everything/Makefile.am trunk/e/src/modules/everything/e_mod_main.c trunk/e/src/modules/everything/e_mod_main.h trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry.h trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_border_act.c trunk/e/src/modules/everything/evry_plug_config.c trunk/e/src/modules/everything/evry_plug_dir_browse.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/Makefile.am =================================================================== --- trunk/e/src/modules/everything/Makefile.am 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/Makefile.am 2009-07-03 13:37:54 UTC (rev 41242) @@ -26,6 +26,7 @@ evry_plug_dir_browse.c \ evry_plug_apps.c \ evry_plug_tracker.c \ + evry_plug_calc.c \ evry_plug_border.c \ evry_plug_border_act.c Modified: trunk/e/src/modules/everything/e_mod_main.c =================================================================== --- trunk/e/src/modules/everything/e_mod_main.c 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/e_mod_main.c 2009-07-03 13:37:54 UTC (rev 41242) @@ -76,6 +76,7 @@ evry_plug_tracker_init(); evry_plug_border_init(); evry_plug_border_act_init(); + evry_plug_calc_init(); /* add module supplied action */ act = e_action_add("everything"); @@ -116,6 +117,7 @@ evry_plug_tracker_shutdown(); evry_plug_border_shutdown(); evry_plug_border_act_shutdown(); + evry_plug_calc_shutdown(); evry_shutdown(); conf_module = NULL; @@ -151,6 +153,9 @@ zone = e_util_zone_current_get(e_manager_current_get()); } if (!zone) zone = e_util_zone_current_get(e_manager_current_get()); + + printf("zone %d %d\n", zone->x, zone->y); + if (zone) evry_show(zone); } Modified: trunk/e/src/modules/everything/e_mod_main.h =================================================================== --- trunk/e/src/modules/everything/e_mod_main.h 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/e_mod_main.h 2009-07-03 13:37:54 UTC (rev 41242) @@ -63,6 +63,9 @@ EAPI int evry_plug_dir_browse_init(void); EAPI int evry_plug_dir_browse_shutdown(void); +EAPI int evry_plug_calc_init(void); +EAPI int evry_plug_calc_shutdown(void); + extern Config *evry_conf; #endif Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/evry.c 2009-07-03 13:37:54 UTC (rev 41242) @@ -24,6 +24,12 @@ const char *request_type; Eina_Bool initial; + + /* this is for the case when the current plugin was not selected + manually and a higher priority (async) plugin retrieves + candidates, the higher priority plugin is made current */ + Eina_Bool plugin_auto_selected; + }; static int _evry_cb_key_down(void *data, int type, void *event); @@ -46,6 +52,7 @@ static void _evry_plugin_next(void); static void _evry_plugin_prev(void); static void _evry_scroll_to(int i); +static void _evry_tab_scroll_to(Evry_Plugin *p); static void _evry_item_desel(Evry_Item *it); static void _evry_item_sel(Evry_Item *it); static void _evry_action(int finished); @@ -55,7 +62,7 @@ static int _evry_scroll_timer(void *data); static int _evry_push_state(void); static int _evry_pop_state(void); -static void _evry_plugin_selector_append(Evry_Plugin *p); +static void _evry_plugin_selector_show(Evry_Plugin *p); static int _evry_cb_plugin_sort(const void *data1, const void *data2); static int _evry_plug_act_select_init(void); @@ -282,30 +289,44 @@ EAPI void -evry_plugin_async_update(Evry_Plugin *p, int state) +evry_plugin_async_update(Evry_Plugin *p, int action) { Evry_State *s; if (!popup) return; s = cur_state; - - if (!eina_list_data_find(s->cur_plugins, p)) + + if (action == 1) { - s->cur_plugins = eina_list_append(s->cur_plugins, p); - _evry_plugin_selector_append(p); + if (!eina_list_data_find(s->cur_plugins, p)) + { + s->cur_plugins = eina_list_append(s->cur_plugins, p); + s->cur_plugins = eina_list_sort(s->cur_plugins, + eina_list_count(s->cur_plugins), + _evry_cb_plugin_sort); + _evry_plugin_selector_show(p); + } + else + { + char buf[64]; + snprintf(buf, 64, "%s (%d)", p->name, eina_list_count(p->items)); + edje_object_part_text_set(p->tab, "e.text.label", buf); + } + + if ((!s->cur_plugin && s->cur_plugins) || (s->cur_plugin == p) || + (s->plugin_auto_selected && (s->cur_plugin->prio > p->prio))) + { + if (!s->cur_plugin) + s->plugin_auto_selected = 1; + + _evry_list_clear(); + _evry_show_items(s->cur_plugins->data); + } } - else + else if ((action == 0) && (s->cur_plugin == p)) { - char buf[64]; - snprintf(buf, 64, "%s (%d)", p->name, eina_list_count(p->items)); - edje_object_part_text_set(p->tab, "e.text.label", buf); - } - - if (!s->cur_plugin && s->cur_plugins) - { _evry_list_clear(); - _evry_show_items(s->cur_plugins->data); } } @@ -402,6 +423,8 @@ s->plugins = list; s->cur_plugins = NULL; s->sel_item = NULL; + s->plugin_auto_selected = 1; + if (cur_state) { s->request_type = cur_state->request_type; @@ -493,7 +516,7 @@ if (it) { - _evry_item_desel(s->sel_item); + if (s->sel_item) _evry_item_desel(s->sel_item); s->sel_item = it; _evry_item_sel(s->sel_item); _evry_scroll_to(i); @@ -791,6 +814,7 @@ } else if (s->cur_action) { + /* */ if (s->sel_item && (!strcmp(s->cur_plugin->type_out, s->request_type))) { s->cur_action->thing2 = s->sel_item; @@ -799,12 +823,20 @@ } else if (s->cur_plugin && (s->sel_item || s->input)) { - if (!s->cur_plugin->action || - !s->cur_plugin->action(s->sel_item, s->input)) + /* XXX use flags for return values */ + int ret = 0; + + if (s->cur_plugin->action) { + ret = s->cur_plugin->action(s->sel_item, s->input); + } + if (ret == EVRY_ACTION_OTHER) + { _evry_push_state(); finished = 0; } + else if (ret == EVRY_ACTION_CONTINUE) + finished = 0; } else if (s->initial) e_exec(popup->zone, NULL, s->input, NULL, NULL /* "everything" */); @@ -872,14 +904,16 @@ /* TODO add option */ - if (!s->sel_item && p->items) - { - s->sel_item = p->items->data; - _evry_item_sel(s->sel_item); - _evry_scroll_to(0); - } + /* if (!s->sel_item && p->items) + * { + * s->sel_item = p->items->data; + * _evry_item_sel(s->sel_item); + * _evry_scroll_to(0); + * } */ evas_event_thaw(popup->evas); + + _evry_tab_scroll_to(p); } static void @@ -911,7 +945,7 @@ if (!s->initial || (items && eina_list_count(p->items) > 0)) { s->cur_plugins = eina_list_append(s->cur_plugins, p); - _evry_plugin_selector_append(p); + _evry_plugin_selector_show(p); } } @@ -984,6 +1018,43 @@ } static void +_evry_tab_scroll_to(Evry_Plugin *p) +{ + int n, w, mw, i; + double align; + + Eina_List *l; + + for(i = 0, l = cur_state->cur_plugins; l; l = l->next, i++) + if (l->data == p) break; + + n = eina_list_count(cur_state->cur_plugins); + + e_box_min_size_get(o_selector, &mw, NULL); + evas_object_geometry_get(o_selector, NULL, NULL, &w, NULL); + + if (mw <= w) return; + + if (n > 1) + { + align = (double)i / (double)(n - 1); + /* if (evry_conf->scroll_animate) + * { + * if (!scroll_timer) + * scroll_timer = ecore_timer_add(0.01, _evry_scroll_timer, NULL); + * if (!scroll_animator) + * scroll_animator = ecore_animator_add(_evry_animator, NULL); + * } + * else */ + { + e_box_align_set(o_selector, 1.0 - align, 0.5); + } + } + else + e_box_align_set(o_selector, 1.0, 0.5); +} + +static void _evry_item_desel(Evry_Item *it) { edje_object_signal_emit(it->o_bg, "e,state,unselected", "e"); @@ -1005,6 +1076,8 @@ Eina_List *l; int i; Evry_State *s = cur_state; + + s->plugin_auto_selected = 0; if (s->sel_item) { @@ -1040,9 +1113,11 @@ Eina_List *l; int i; Evry_State *s = cur_state; + + s->plugin_auto_selected = 0; if (s->sel_item) - { + { _evry_item_desel(s->sel_item); for (i = 0, l = s->cur_plugin->items; l; l = l->next, i++) @@ -1071,20 +1146,21 @@ _evry_plugin_next(void) { Eina_List *l; - Evry_Plugin *plugin; Evry_State *s = cur_state; if (!s->cur_plugin) return; - + l = eina_list_data_find_list(s->cur_plugins, s->cur_plugin); if (l && l->next) { + s->plugin_auto_selected = 0; _evry_list_clear(); _evry_show_items(l->next->data); } else if (s->cur_plugin != s->cur_plugins->data) { + s->plugin_auto_selected = 0; _evry_list_clear(); _evry_show_items(s->cur_plugins->data); } @@ -1104,15 +1180,17 @@ if (l && l->prev) { + s->plugin_auto_selected = 0; _evry_list_clear(); _evry_show_items(l->prev->data); } else - { + { l = eina_list_last(s->cur_plugins); if (s->cur_plugin != l->data) { + s->plugin_auto_selected = 0; _evry_list_clear(); _evry_show_items(l->data); } @@ -1154,12 +1232,14 @@ } static void -_evry_plugin_selector_append(Evry_Plugin *p) +_evry_plugin_selector_show(Evry_Plugin *p) { Evas_Object *o; Evas_Coord mw = 0, mh = 0; char buf[64]; - + Eina_List *l; + Evry_State *s = cur_state; + o = edje_object_add(popup->evas); /* TODO move this to everything theme group !*/ e_theme_edje_object_set(o, "base/theme/widgets", @@ -1171,8 +1251,16 @@ edje_object_size_min_calc(o, &mw, &mh); e_box_freeze(o_selector); - e_box_pack_end(o_selector, o); + l = eina_list_data_find_list(s->cur_plugins, p); + if (l && l->next) + { + Evry_Plugin *p2 = l->next->data; + e_box_pack_before(o_selector, o, p2->tab); + } + else + e_box_pack_end(o_selector, o); + evas_object_show(o); e_box_pack_options_set(o, 1, 1, 0, 0, 0.5, 0.5, mw, mh, 9999, 9999); e_box_thaw(o_selector); Modified: trunk/e/src/modules/everything/evry.h =================================================================== --- trunk/e/src/modules/everything/evry.h 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/evry.h 2009-07-03 13:37:54 UTC (rev 41242) @@ -9,6 +9,7 @@ typedef struct _Evry_Config Evry_Config; typedef struct _Evry_App Evry_App; + /* typedef enum _Evry_Plugin_Type * { * EVRY_SYNC, @@ -22,6 +23,12 @@ * EVRY_STATE_FINISHED, * } Evry_Plugin_State; */ + +#define EVRY_ACTION_OTHER 0 +#define EVRY_ACTION_FINISHED 1 +#define EVRY_ACTION_CONTINUE 2 + + #else #ifndef EVRY_H #define EVRY_H @@ -55,12 +62,12 @@ int prio; /* sync/async ?*/ - unsigned char async_query : 1; + Eina_Bool async_query; /* whether candidates can be shown without input * e.g. borders, app history */ - unsigned char need_query : 1; - + Eina_Bool need_query; + /* run when plugin is activated. */ int (*begin) (Evry_Item *item); @@ -84,7 +91,6 @@ void (*config_apply) (void); /* for internal use by plugin */ - Eina_List *states; void *priv; /* not to be set by plugin! */ Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-07-03 13:37:54 UTC (rev 41242) @@ -146,10 +146,10 @@ eina_list_free(files); - return 1; + return EVRY_ACTION_FINISHED; } - return 0; + return EVRY_ACTION_CONTINUE; } @@ -163,8 +163,8 @@ { if (it->label) eina_stringshare_del(it->label); app = it->data[0]; - free(app); - free(it); + E_FREE(app); + E_FREE(it); } } @@ -343,8 +343,8 @@ file = NULL; } - it = calloc(1, sizeof(Evry_Item)); - app = calloc(1, sizeof(Evry_App)); + it = E_NEW(Evry_Item, 1); + app = E_NEW(Evry_App, 1); app->desktop = desktop; app->file = file; it->data[0] = app; Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-07-03 13:37:54 UTC (rev 41242) @@ -50,7 +50,7 @@ E_Border *bd; E_Zone *zone; - if (!it) return 0; + if (!it) return EVRY_ACTION_CONTINUE; bd = (E_Border *)it->data[0]; zone = e_util_zone_current_get(e_manager_current_get()); @@ -69,7 +69,7 @@ /* e_border_focus_set(bd, 1, 1); */ e_border_focus_set_with_pointer(bd); - return 1; + return EVRY_ACTION_FINISHED; } static void @@ -81,7 +81,7 @@ { /* if (it->data[0]) e_object_unref(E_OBJECT(it->data[0])); */ if (it->label) eina_stringshare_del(it->label); - free(it); + E_FREE(it); } } @@ -149,7 +149,7 @@ { Evry_Item *it; - it = calloc(1, sizeof(Evry_Item)); + it = E_NEW(Evry_Item, 1); /* e_object_ref(E_OBJECT(bd)); */ it->data[0] = bd; it->priority = prio; Modified: trunk/e/src/modules/everything/evry_plug_border_act.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border_act.c 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/evry_plug_border_act.c 2009-07-03 13:37:54 UTC (rev 41242) @@ -94,7 +94,8 @@ void (*border_action) (E_Border *bd); border_action = item->data[0]; border_action(inst->border); - return 1; + + return EVRY_ACTION_FINISHED; } static void @@ -106,7 +107,7 @@ { if (it->data[1]) eina_stringshare_del(it->data[1]); if (it->label) eina_stringshare_del(it->label); - free(it); + E_FREE(it); } } @@ -115,7 +116,7 @@ { Evry_Item *it; - it = calloc(1, sizeof(Evry_Item)); + it = E_NEW(Evry_Item, 1); it->data[0] = action_cb; it->data[1] = (void *) eina_stringshare_add(icon); it->label = eina_stringshare_add(label); Added: trunk/e/src/modules/everything/evry_plug_calc.c Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-07-03 13:37:54 UTC (rev 41242) @@ -46,7 +46,7 @@ char buf[1024]; int found = 0; - if (!it) return 0; + if (!it) return EVRY_ACTION_CONTINUE; eci = it->data[0]; con = e_container_current_get(e_manager_current_get()); @@ -70,7 +70,7 @@ if (found) e_configure_registry_call(buf, con, NULL); - return 1; + return EVRY_ACTION_FINISHED; } static void @@ -81,7 +81,7 @@ EINA_LIST_FREE(p->items, it) { if (it->label) eina_stringshare_del(it->label); - free(it); + E_FREE(it); } } @@ -158,7 +158,7 @@ { Evry_Item *it; - it = calloc(1, sizeof(Evry_Item)); + it = E_NEW(Evry_Item, 1); it->data[0] = eci; it->priority = prio; it->label = eina_stringshare_add(eci->label); Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-07-03 13:37:54 UTC (rev 41242) @@ -19,6 +19,7 @@ static Evry_Item *_item_fill(const char *directory, const char *file); static Evry_Plugin *p; +static Eina_List *stack = NULL; EAPI int evry_plug_dir_browse_init(void) @@ -67,7 +68,7 @@ s->directory = eina_stringshare_add(e_user_homedir_get()); } - p->states = eina_list_prepend(p->states, s); + stack = eina_list_prepend(stack, s); p->items = NULL; return 1; @@ -76,7 +77,7 @@ static int _action(Evry_Item *it, const char *input) { - return 0; + return EVRY_ACTION_OTHER; } static void @@ -100,9 +101,9 @@ { State *s; - if (!p->states) return; + if (!stack) return; - s = p->states->data; + s = stack->data; _list_free(); @@ -110,11 +111,11 @@ E_FREE(s); - p->states = eina_list_remove_list(p->states, p->states); + stack = eina_list_remove_list(stack, stack); - if (p->states) + if (stack) { - s = p->states->data; + s = stack->data; p->items = s->items; } } @@ -128,7 +129,7 @@ Evry_Item *it; char match1[4096]; char match2[4096]; - State *s = p->states->data; + State *s = stack->data; _list_free(); Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-07-03 12:39:32 UTC (rev 41241) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-07-03 13:37:54 UTC (rev 41242) @@ -66,7 +66,7 @@ static int _action(Evry_Item *it, const char *input) { - return 0; + return EVRY_ACTION_OTHER; } static void |
From: Enlightenment S. <no-...@en...> - 2009-07-03 15:56:27
|
Log: 'everything' module: no more flickering of tabs when updating input - cleanups Author: jeffdameth Date: 2009-07-03 08:56:21 -0700 (Fri, 03 Jul 2009) New Revision: 41243 Modified: trunk/e/src/modules/everything/evry.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-07-03 13:37:54 UTC (rev 41242) +++ trunk/e/src/modules/everything/evry.c 2009-07-03 15:56:21 UTC (rev 41243) @@ -55,7 +55,7 @@ static void _evry_tab_scroll_to(Evry_Plugin *p); static void _evry_item_desel(Evry_Item *it); static void _evry_item_sel(Evry_Item *it); -static void _evry_action(int finished); +static void _evry_plugin_action(int finished); static void _evry_action_select(void); static void _evry_cb_plugin_sel(void *data1, void *data2); static int _evry_animator(void *data); @@ -243,7 +243,15 @@ free(s->input); EINA_LIST_FREE(s->plugins, p) - p->cleanup(); + { + p->cleanup(); + + if (p->tab) + { + evas_object_del(p->tab); + p->tab = NULL; + } + } } stack = NULL; cur_state = NULL; @@ -361,8 +369,16 @@ return 0; EINA_LIST_FOREACH(s->plugins, l, p) - if (p != s->cur_plugin) - p->cleanup(); + { + if (p != s->cur_plugin) + p->cleanup(); + + if (p->tab) + { + evas_object_del(p->tab); + p->tab = NULL; + } + } } EINA_LIST_FOREACH(plugins, l, p) @@ -408,15 +424,6 @@ _evry_list_clear(); - if (s) - { - EINA_LIST_FOREACH(s->cur_plugins, l, p) - { - evas_object_del(p->tab); - p->tab = NULL; - } - } - s = E_NEW(Evry_State, 1); s->input = malloc(INPUTLEN); s->input[0] = 0; @@ -460,12 +467,6 @@ _evry_list_clear(); - EINA_LIST_FREE(s->cur_plugins, p) - { - evas_object_del(p->tab); - p->tab = NULL; - } - free(s->input); EINA_LIST_FOREACH(s->plugins, l, p) @@ -558,7 +559,7 @@ if (s->sel_item) { if (!_evry_push_state()) - _evry_action(0); + _evry_plugin_action(0); } } /* _evry_plugin_next(); */ @@ -573,7 +574,7 @@ * if (s->sel_item) * { * if (!_evry_push_state()) - * _evry_action(0); + * _evry_plugin_action(0); * } * } */ else if (!strcmp(ev->key, "Left")) @@ -581,9 +582,9 @@ /* _evry_pop_state(); */ else if (!strcmp(ev->key, "Return") && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) - _evry_action(0); + _evry_plugin_action(0); else if (!strcmp(ev->key, "Return")) - _evry_action(1); + _evry_plugin_action(1); else if (!strcmp(ev->key, "Tab") && ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) || (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) @@ -593,7 +594,7 @@ if (s->sel_item) { if (!_evry_push_state()) - _evry_action(0); + _evry_plugin_action(0); } } /* _evry_plugin_next(); */ @@ -663,9 +664,9 @@ if (item_mouseover) { if (ev->buttons == 1) - _evry_action(1); + _evry_plugin_action(1); else if (ev->buttons == 3) - _evry_action(0); + _evry_plugin_action(0); } else { @@ -801,7 +802,7 @@ } static void -_evry_action(int finished) +_evry_plugin_action(int finished) { Evry_State *s = cur_state; @@ -855,16 +856,22 @@ Evry_State *s = cur_state; if (s->cur_plugin) - edje_object_signal_emit(s->cur_plugin->tab, "e,state,unselected", "e"); - + { + if (s->cur_plugin != p) + { + edje_object_signal_emit(s->cur_plugin->tab, "e,state,unselected", "e"); + edje_object_signal_emit(p->tab, "e,state,selected", "e"); + } + } + else + edje_object_signal_emit(p->tab, "e,state,selected", "e"); + if (s->cur_plugin != p) s->sel_item = NULL; s->cur_plugin = p; s->cur_items = p->items; - edje_object_signal_emit(p->tab, "e,state,selected", "e"); - evas_event_freeze(popup->evas); e_box_freeze(o_list); @@ -925,13 +932,8 @@ Evry_State *s = cur_state; _evry_list_clear(); - - EINA_LIST_FREE(s->cur_plugins, p) - { - evas_object_del(p->tab); - p->tab = NULL; - } - + eina_list_free(s->cur_plugins); + s->cur_plugins = NULL; s->sel_item = NULL; @@ -945,10 +947,17 @@ if (!s->initial || (items && eina_list_count(p->items) > 0)) { s->cur_plugins = eina_list_append(s->cur_plugins, p); - _evry_plugin_selector_show(p); } + else if (p->tab) + { + evas_object_del(p->tab); + p->tab = NULL; + } } + EINA_LIST_FOREACH(s->cur_plugins, l, p) + _evry_plugin_selector_show(p); + if (s->cur_plugins) { if (s->cur_plugin && eina_list_data_find(s->cur_plugins, s->cur_plugin)) @@ -1033,8 +1042,12 @@ e_box_min_size_get(o_selector, &mw, NULL); evas_object_geometry_get(o_selector, NULL, NULL, &w, NULL); - if (mw <= w) return; - + if (mw <= w) + { + e_box_align_set(o_selector, 0.0, 0.5); + return; + } + if (n > 1) { align = (double)i / (double)(n - 1); @@ -1239,24 +1252,33 @@ char buf[64]; Eina_List *l; Evry_State *s = cur_state; + + e_box_freeze(o_selector); + + if (p->tab) + { + o = p->tab; + e_box_unpack(p->tab); + } + else + { + o = edje_object_add(popup->evas); + /* TODO move this to everything theme group !*/ + e_theme_edje_object_set(o, "base/theme/widgets", + "e/widgets/toolbar/item"); + } - o = edje_object_add(popup->evas); - /* TODO move this to everything theme group !*/ - e_theme_edje_object_set(o, "base/theme/widgets", - "e/widgets/toolbar/item"); - snprintf(buf, 64, "%s (%d)", p->name, eina_list_count(p->items)); edje_object_part_text_set(o, "e.text.label", buf); edje_object_size_min_calc(o, &mw, &mh); - e_box_freeze(o_selector); l = eina_list_data_find_list(s->cur_plugins, p); - if (l && l->next) + if (l && l->prev) { - Evry_Plugin *p2 = l->next->data; - e_box_pack_before(o_selector, o, p2->tab); + Evry_Plugin *p2 = l->prev->data; + e_box_pack_after(o_selector, o, p2->tab); } else e_box_pack_end(o_selector, o); |
From: Enlightenment S. <no-...@en...> - 2009-07-03 16:34:39
|
Log: 'everything' module: calc: put result in primary selection AND clipboard Author: jeffdameth Date: 2009-07-03 09:34:33 -0700 (Fri, 03 Jul 2009) New Revision: 41245 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry.h trunk/e/src/modules/everything/evry_plug_calc.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-07-03 16:05:05 UTC (rev 41244) +++ trunk/e/src/modules/everything/evry.c 2009-07-03 16:34:33 UTC (rev 41245) @@ -305,7 +305,7 @@ s = cur_state; - if (action == 1) + if (action == EVRY_ASYNC_UPDATE_ADD) { if (!eina_list_data_find(s->cur_plugins, p)) { @@ -332,7 +332,7 @@ _evry_show_items(s->cur_plugins->data); } } - else if ((action == 0) && (s->cur_plugin == p)) + else if ((action == EVRY_ASYNC_UPDATE_CLEAR) && (s->cur_plugin == p)) { _evry_list_clear(); } Modified: trunk/e/src/modules/everything/evry.h =================================================================== --- trunk/e/src/modules/everything/evry.h 2009-07-03 16:05:05 UTC (rev 41244) +++ trunk/e/src/modules/everything/evry.h 2009-07-03 16:34:33 UTC (rev 41245) @@ -28,6 +28,8 @@ #define EVRY_ACTION_FINISHED 1 #define EVRY_ACTION_CONTINUE 2 +#define EVRY_ASYNC_UPDATE_ADD 0 +#define EVRY_ASYNC_UPDATE_CLEAR 1 #else #ifndef EVRY_H Modified: trunk/e/src/modules/everything/evry_plug_calc.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_calc.c 2009-07-03 16:05:05 UTC (rev 41244) +++ trunk/e/src/modules/everything/evry_plug_calc.c 2009-07-03 16:34:33 UTC (rev 41245) @@ -119,7 +119,7 @@ Evry_Item *it2 = p->items->data; _item_add((char *) it2->label, 1); - evry_plugin_async_update(p, 1); + evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); } return EVRY_ACTION_CONTINUE; @@ -129,6 +129,9 @@ /* XXX on which windows must the selection be set? */ ecore_x_selection_primary_set(e_manager_current_get()->win, it->label, strlen(it->label)); + ecore_x_selection_clipboard_set(e_manager_current_get()->win, + it->label, strlen(it->label)); + if (p->items->data == it) { Evry_Item *it2 = p->items->data; @@ -180,7 +183,7 @@ if (data != p) return 1; - evry_plugin_async_update(p, 0); + evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); for (l = ev->lines; l && l->line; l++) { @@ -195,7 +198,7 @@ _item_add(l->line, 1); } - evry_plugin_async_update(p, 1); + evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); return 1; } Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-07-03 16:05:05 UTC (rev 41244) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-07-03 16:34:33 UTC (rev 41245) @@ -202,6 +202,6 @@ } } - if (p->items) evry_plugin_async_update(p, 1); + if (p->items) evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); } |
From: Enlightenment S. <no-...@en...> - 2009-07-04 11:10:42
|
Log: 'everything' module: formatting, whitespace cleanup Author: jeffdameth Date: 2009-07-04 04:10:28 -0700 (Sat, 04 Jul 2009) New Revision: 41248 Modified: trunk/e/src/modules/everything/e_mod_main.c trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_border_act.c trunk/e/src/modules/everything/evry_plug_calc.c trunk/e/src/modules/everything/evry_plug_config.c trunk/e/src/modules/everything/evry_plug_dir_browse.c Modified: trunk/e/src/modules/everything/e_mod_main.c =================================================================== --- trunk/e/src/modules/everything/e_mod_main.c 2009-07-04 02:16:45 UTC (rev 41247) +++ trunk/e/src/modules/everything/e_mod_main.c 2009-07-04 11:10:28 UTC (rev 41248) @@ -29,7 +29,7 @@ e_modapi_init(E_Module *m) { char buf[4096]; - snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/module.everything", + snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/module.everything", e_user_homedir_get(), e_config_profile_get()); ecore_file_mkdir(buf); @@ -66,7 +66,7 @@ evry_conf->scroll_animate = 1; evry_conf->scroll_speed = 0.5; } - + conf_module = m; evry_init(); @@ -155,7 +155,7 @@ if (!zone) zone = e_util_zone_current_get(e_manager_current_get()); printf("zone %d %d\n", zone->x, zone->y); - + if (zone) evry_show(zone); } Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-07-04 02:16:45 UTC (rev 41247) +++ trunk/e/src/modules/everything/evry.c 2009-07-04 11:10:28 UTC (rev 41248) @@ -22,14 +22,14 @@ /* Eina_List *sel_items; */ char *input; const char *request_type; - + Eina_Bool initial; /* this is for the case when the current plugin was not selected manually and a higher priority (async) plugin retrieves candidates, the higher priority plugin is made current */ Eina_Bool plugin_auto_selected; - + }; static int _evry_cb_key_down(void *data, int type, void *event); @@ -72,8 +72,6 @@ static void _evry_plug_act_select_cleanup(void); static void _evry_plug_act_select_item_icon_get(Evry_Item *it, Evas *e); - - /* local subsystem globals */ static E_Popup *popup = NULL; static Ecore_X_Window input_window = 0; @@ -100,7 +98,7 @@ evry_init(void) { _evry_plug_act_select_init(); - + return 1; } @@ -167,7 +165,7 @@ if (!popup) return 0; ecore_x_netwm_window_type_set(popup->evas_win, ECORE_X_WINDOW_TYPE_UTILITY); - + e_popup_layer_set(popup, 255); evas_event_freeze(popup->evas); evas_event_feed_mouse_in(popup->evas, ecore_x_current_time_get(), NULL); @@ -196,7 +194,7 @@ edje_object_part_swallow(o_main, "e.swallow.bar", o); evas_object_show(o); o_selector = o; - + evas_event_thaw(popup->evas); handlers = eina_list_append @@ -216,7 +214,7 @@ (ECORE_EVENT_MOUSE_WHEEL, _evry_cb_mouse_wheel, NULL)); _evry_push_state(); - + e_popup_show(popup); return 1; } @@ -229,17 +227,17 @@ Evry_Plugin *plugin; Eina_List *l; Evry_State *s; - + if (!popup) return; evas_event_freeze(popup->evas); _evry_list_clear(); - + EINA_LIST_FREE(stack, s) { Evry_Plugin *p; - + free(s->input); EINA_LIST_FREE(s->plugins, p) @@ -255,7 +253,7 @@ } stack = NULL; cur_state = NULL; - + if (update_timer) { ecore_timer_del(update_timer); @@ -271,9 +269,9 @@ ecore_animator_del(scroll_animator); scroll_animator = NULL; } - + e_popup_hide(popup); - + evas_object_del(o_list); o_list = NULL; @@ -295,7 +293,6 @@ input_window = 0; } - EAPI void evry_plugin_async_update(Evry_Plugin *p, int action) { @@ -317,17 +314,17 @@ } else { - char buf[64]; + char buf[64]; snprintf(buf, 64, "%s (%d)", p->name, eina_list_count(p->items)); edje_object_part_text_set(p->tab, "e.text.label", buf); } - + if ((!s->cur_plugin && s->cur_plugins) || (s->cur_plugin == p) || (s->plugin_auto_selected && (s->cur_plugin->prio > p->prio))) { if (!s->cur_plugin) s->plugin_auto_selected = 1; - + _evry_list_clear(); _evry_show_items(s->cur_plugins->data); } @@ -335,6 +332,8 @@ else if ((action == EVRY_ASYNC_UPDATE_CLEAR) && (s->cur_plugin == p)) { _evry_list_clear(); + /*XXX move this into list clear?*/ + s->cur_items = NULL; } } @@ -347,22 +346,21 @@ return p1->prio - p2->prio; } - static int _evry_push_state(void) { Evry_State *s; - Eina_List *l, *list = NULL; + Eina_List *l, *list = NULL; const char *cur_type = "NONE"; Evry_Plugin *p; - + s = cur_state; if (s) { if (!s->cur_plugin || !s->sel_item) return 0; - + cur_type = s->cur_plugin->type_out; /* current plugin provides no candidates to act on by others */ if (!s->cur_action && !strcmp(cur_type, "NONE")) @@ -380,13 +378,13 @@ } } } - + EINA_LIST_FOREACH(plugins, l, p) - { + { if (strstr(p->type_in, cur_type)) { /* printf("%s- in:%s out:%s\n", p->name, p->type_in, p->type_out); */ - + if (s && s->cur_action) { /* filter out plugins that dont provide the type @@ -397,19 +395,19 @@ if (p->begin) { - Evry_Item *sel_item = NULL; - + Evry_Item *it = NULL; + if (s && (s->cur_plugin != action_selector)) - sel_item = s->sel_item; - - if (p->begin(sel_item)) + it = s->sel_item; + + if (p->begin(it)) list = eina_list_append(list, p); } else list = eina_list_append(list, p); } } - + if (s && !s->cur_action) { if (_evry_plug_act_select_actions_set()) @@ -417,7 +415,7 @@ list = eina_list_append(list, action_selector); } } - + if (!list) return 0; list = eina_list_sort(list, eina_list_count(list), _evry_cb_plugin_sort); @@ -480,7 +478,7 @@ { Evry_Item *it = NULL; int i = 0; - + s = stack->data; cur_state = s; @@ -489,7 +487,7 @@ _evry_pop_state(); return 0; } - + edje_object_part_text_set(o_main, "e.text.label", s->input); if (s->sel_item) @@ -500,21 +498,21 @@ break; else i++; } - + if (stack->next) { Evry_State *prev = stack->next->data; it = prev->sel_item; } - + EINA_LIST_FOREACH(s->plugins, l, p) if (p != s->cur_plugin && p->begin) p->begin(it); _evry_matches_update(); - + it = eina_list_nth(s->cur_plugin->items, i); - + if (it) { if (s->sel_item) _evry_item_desel(s->sel_item); @@ -559,24 +557,24 @@ if (s->sel_item) { if (!_evry_push_state()) - _evry_plugin_action(0); + _evry_plugin_action(0); } } /* _evry_plugin_next(); */ else if (!strcmp(ev->key, "Left") && ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) || (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) - _evry_pop_state(); - /* _evry_plugin_prev(); */ + _evry_pop_state(); + /* _evry_plugin_prev(); */ else if (!strcmp(ev->key, "Right")) _evry_plugin_next(); - /* { - * if (s->sel_item) - * { - * if (!_evry_push_state()) - * _evry_plugin_action(0); - * } - * } */ + /* { + * if (s->sel_item) + * { + * if (!_evry_push_state()) + * _evry_plugin_action(0); + * } + * } */ else if (!strcmp(ev->key, "Left")) _evry_plugin_prev(); /* _evry_pop_state(); */ @@ -594,10 +592,10 @@ if (s->sel_item) { if (!_evry_push_state()) - _evry_plugin_action(0); + _evry_plugin_action(0); } } - /* _evry_plugin_next(); */ + /* _evry_plugin_next(); */ else if (!strcmp(ev->key, "u") && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) _evry_clear(); @@ -608,7 +606,7 @@ if (!_evry_pop_state()) evry_hide(); } - + else if (!strcmp(ev->key, "BackSpace")) _evry_backspace(); else if (!strcmp(ev->key, "Delete")) @@ -632,7 +630,7 @@ { Ecore_Event_Mouse_Button *ev; Evry_State *s =cur_state; - + ev = event; if (ev->event_window != input_window) return 1; @@ -642,8 +640,8 @@ { if (s->sel_item) _evry_item_desel(s->sel_item); s->sel_item = item_mouseover; - _evry_item_sel(s->sel_item); - } + _evry_item_sel(s->sel_item); + } } else { @@ -657,31 +655,31 @@ _evry_cb_mouse_up(void *data, int type, void *event) { Ecore_Event_Mouse_Button *ev; - + ev = event; if (ev->event_window != input_window) return 1; if (item_mouseover) { - if (ev->buttons == 1) + if (ev->buttons == 1) _evry_plugin_action(1); - else if (ev->buttons == 3) + else if (ev->buttons == 3) _evry_plugin_action(0); } else { evas_event_feed_mouse_up(popup->evas, ev->buttons, 0, ev->timestamp, NULL); } - + return 1; } -static int +static int _evry_cb_mouse_move(void *data, int type, void *event) { Ecore_Event_Mouse_Move *ev; Evry_State *s =cur_state; - + ev = event; if (ev->event_window != input_window) return 1; @@ -695,7 +693,7 @@ if (!s->sel_item || (s->sel_item != item_mouseover)) { s->sel_item = item_mouseover; - _evry_item_sel(s->sel_item); + _evry_item_sel(s->sel_item); } } } @@ -710,7 +708,7 @@ _evry_cb_mouse_wheel(void *data, int type, void *event) { Ecore_Event_Mouse_Wheel *ev; - + ev = event; if (ev->event_window != input_window) return 1; @@ -719,35 +717,35 @@ if (ev->z < 0) /* up */ { int i; - + for (i = ev->z; i < 0; i++) _evry_item_prev(); } else if (ev->z > 0) /* down */ { int i; - + for (i = ev->z; i > 0; i--) _evry_item_next(); } return 1; } -static void -_evry_cb_item_mouse_in(void *data, Evas *evas, Evas_Object *obj, - void *event_info) +static void +_evry_cb_item_mouse_in(void *data, Evas *evas, Evas_Object *obj, + void *event_info) { Evry_State *s =cur_state; - + if (!ev_last_is_mouse) return; item_mouseover = data; - + if (s->sel_item) _evry_item_desel(s->sel_item); if (!(s->sel_item = data)) return; _evry_item_sel(s->sel_item); } -static void -_evry_cb_item_mouse_out(void *data, Evas *evas, Evas_Object *obj, +static void +_evry_cb_item_mouse_out(void *data, Evas *evas, Evas_Object *obj, void *event_info) { item_mouseover = NULL; @@ -758,7 +756,7 @@ { int len, val, pos; Evry_State *s = cur_state; - + len = strlen(s->input); if (len > 0) { @@ -776,7 +774,7 @@ { Efreet_Desktop *desktop; Evas_Object *o; - + edje_object_part_text_set(o_main, "e.text.label", cur_state->input); if (update_timer) ecore_timer_del(update_timer); @@ -810,7 +808,7 @@ { /* set cur_action and start plugins for second parameter (if required)*/ if (s->sel_item) _evry_plug_act_select_action(s->sel_item, s->input); - + finished = 0; } else if (s->cur_action) @@ -826,7 +824,7 @@ { /* XXX use flags for return values */ int ret = 0; - + if (s->cur_plugin->action) { ret = s->cur_plugin->action(s->sel_item, s->input); @@ -854,8 +852,8 @@ int mw, mh, h; Evas_Object *o; Evry_State *s = cur_state; - - if (s->cur_plugin) + + if (s->cur_plugin) { if (s->cur_plugin != p) { @@ -865,14 +863,14 @@ } else edje_object_signal_emit(p->tab, "e,state,selected", "e"); - + if (s->cur_plugin != p) s->sel_item = NULL; - + s->cur_plugin = p; s->cur_items = p->items; - - evas_event_freeze(popup->evas); + + evas_event_freeze(popup->evas); e_box_freeze(o_list); EINA_LIST_FOREACH(p->items, l, it) @@ -885,9 +883,9 @@ edje_object_part_text_set(o, "e.text.title", it->label); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, - _evry_cb_item_mouse_in, it); + _evry_cb_item_mouse_in, it); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, - _evry_cb_item_mouse_out, it); + _evry_cb_item_mouse_out, it); evas_object_show(o); p->icon_get(it, popup->evas); @@ -913,11 +911,11 @@ /* if (!s->sel_item && p->items) * { - * s->sel_item = p->items->data; - * _evry_item_sel(s->sel_item); - * _evry_scroll_to(0); + * s->sel_item = p->items->data; + * _evry_item_sel(s->sel_item); + * _evry_scroll_to(0); * } */ - + evas_event_thaw(popup->evas); _evry_tab_scroll_to(p); @@ -930,20 +928,20 @@ Eina_List *l; int items; Evry_State *s = cur_state; - + _evry_list_clear(); eina_list_free(s->cur_plugins); s->cur_plugins = NULL; s->sel_item = NULL; - + EINA_LIST_FOREACH(s->plugins, l, p) { if (strlen(s->input) == 0) items = !p->need_query ? p->fetch(NULL) : 0; else items = p->fetch(s->input); - + if (!s->initial || (items && eina_list_count(p->items) > 0)) { s->cur_plugins = eina_list_append(s->cur_plugins, p); @@ -954,10 +952,10 @@ p->tab = NULL; } } - + EINA_LIST_FOREACH(s->cur_plugins, l, p) _evry_plugin_selector_show(p); - + if (s->cur_plugins) { if (s->cur_plugin && eina_list_data_find(s->cur_plugins, s->cur_plugin)) @@ -978,7 +976,7 @@ Evry_State *s = cur_state; Evry_Item *it; Eina_List *l; - + if (s && s->cur_items) { evas_event_freeze(popup->evas); @@ -1036,7 +1034,7 @@ for(i = 0, l = cur_state->cur_plugins; l; l = l->next, i++) if (l->data == p) break; - + n = eina_list_count(cur_state->cur_plugins); e_box_min_size_get(o_selector, &mw, NULL); @@ -1047,7 +1045,7 @@ e_box_align_set(o_selector, 0.0, 0.5); return; } - + if (n > 1) { align = (double)i / (double)(n - 1); @@ -1059,9 +1057,9 @@ * scroll_animator = ecore_animator_add(_evry_animator, NULL); * } * else */ - { - e_box_align_set(o_selector, 1.0 - align, 0.5); - } + { + e_box_align_set(o_selector, 1.0 - align, 0.5); + } } else e_box_align_set(o_selector, 1.0, 0.5); @@ -1091,7 +1089,7 @@ Evry_State *s = cur_state; s->plugin_auto_selected = 0; - + if (s->sel_item) { for (i = 0, l = s->cur_plugin->items; l; l = l->next, i++) @@ -1128,9 +1126,9 @@ Evry_State *s = cur_state; s->plugin_auto_selected = 0; - + if (s->sel_item) - { + { _evry_item_desel(s->sel_item); for (i = 0, l = s->cur_plugin->items; l; l = l->next, i++) @@ -1160,9 +1158,9 @@ { Eina_List *l; Evry_State *s = cur_state; - + if (!s->cur_plugin) return; - + l = eina_list_data_find_list(s->cur_plugins, s->cur_plugin); if (l && l->next) @@ -1179,14 +1177,13 @@ } } - static void _evry_plugin_prev(void) { Eina_List *l; Evry_Plugin *plugin; Evry_State *s = cur_state; - + if (!s->cur_plugin) return; l = eina_list_data_find_list(s->cur_plugins, s->cur_plugin); @@ -1198,9 +1195,9 @@ _evry_show_items(l->prev->data); } else - { + { l = eina_list_last(s->cur_plugins); - + if (s->cur_plugin != l->data) { s->plugin_auto_selected = 0; @@ -1230,7 +1227,7 @@ { double da; int scroll_to = 1; - + da = scroll_align - scroll_align_to; if (da < 0.0) da = -da; if (da < 0.01) @@ -1265,11 +1262,11 @@ o = edje_object_add(popup->evas); /* TODO move this to everything theme group !*/ e_theme_edje_object_set(o, "base/theme/widgets", - "e/widgets/toolbar/item"); + "e/widgets/toolbar/item"); } - + snprintf(buf, 64, "%s (%d)", p->name, eina_list_count(p->items)); - + edje_object_part_text_set(o, "e.text.label", buf); edje_object_size_min_calc(o, &mw, &mh); @@ -1282,15 +1279,13 @@ } else e_box_pack_end(o_selector, o); - + evas_object_show(o); e_box_pack_options_set(o, 1, 1, 0, 0, 0.5, 0.5, mw, mh, 9999, 9999); e_box_thaw(o_selector); p->tab = o; } - - static int _evry_plug_act_select_init(void) { @@ -1312,11 +1307,11 @@ Eina_List *l; Evry_State *s = cur_state; Evry_Plugin *p = action_selector; - + _evry_plug_act_select_cleanup(); - + const char *type = s->cur_plugin->type_out; - + EINA_LIST_FOREACH(actions, l, act) { if (strstr(act->type_in1, type)) @@ -1345,7 +1340,7 @@ it = E_NEW(Evry_Item, 1); it->label = eina_stringshare_add(act->name); it->data[0] = act; - + p->items = eina_list_append(p->items, it); } @@ -1368,7 +1363,7 @@ static void _evry_plug_act_select_cleanup(void) { - + Evry_Item *it; Evry_Plugin *p = action_selector; @@ -1377,10 +1372,10 @@ eina_stringshare_del(it->label); E_FREE(it); } - + eina_list_free(cur_state->cur_actions); cur_state->cur_actions = NULL; - + p->items = NULL; } @@ -1388,10 +1383,8 @@ _evry_plug_act_select_item_icon_get(Evry_Item *it, Evas *e) { Evry_Action *act = it->data[0]; - + /* if (act->icon_get) * it->o_icon = act->icon_get(act, e); */ - - } Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-07-04 02:16:45 UTC (rev 41247) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-07-04 11:10:28 UTC (rev 41248) @@ -24,7 +24,6 @@ static Inst *inst; - EAPI int evry_plug_apps_init(void) { @@ -48,7 +47,7 @@ evry_action_register(act); inst = NULL; - + return 1; } @@ -65,7 +64,7 @@ _begin(Evry_Item *it) { const char *mime; - + if (inst) return 0; if (it) @@ -75,14 +74,14 @@ p->prio = 3; if (!it->uri) return 0; - + if (!it->mime) mime = efreet_mime_type_get(it->uri); else mime = it->mime; - + if (!mime) return 0; - + inst = E_NEW(Inst, 1); inst->candidate = it; inst->apps = efreet_util_desktop_mime_list(mime); @@ -92,24 +91,23 @@ p->name = "Applications"; p->type_out = "APPLICATION"; p->prio = 1; - + inst = E_NEW(Inst, 1); } - + return 1; } - static int _action(Evry_Item *it, const char *input) { E_Zone *zone; Evry_App *app = NULL; - Efreet_Desktop *desktop = NULL; + Efreet_Desktop *desktop = NULL; Eina_List *files = NULL; if (it) app = it->data[0]; - + if (app && app->desktop) { desktop = app->desktop; @@ -118,7 +116,7 @@ { if (app && app->file) input = app->file; - + desktop = efreet_desktop_empty_new(""); if (strchr(input, '%')) { @@ -148,17 +146,16 @@ return EVRY_ACTION_FINISHED; } - + return EVRY_ACTION_CONTINUE; } - static void _list_free(void) { Evry_Item *it; Evry_App *app; - + EINA_LIST_FREE(p->items, it) { if (it->label) eina_stringshare_del(it->label); @@ -178,11 +175,10 @@ eina_list_free(inst->apps); E_FREE(inst); } - + inst = NULL; } - static int _fetch(const char *input) { @@ -191,9 +187,9 @@ char *file; char match1[4096]; char match2[4096]; - - _list_free(); + _list_free(); + if (inst->apps) { if (!input) @@ -226,24 +222,24 @@ } } } - - + + if (!p->items && input) { snprintf(match1, sizeof(match1), "%s*", input); l = efreet_util_desktop_exec_glob_list(match1); EINA_LIST_FREE(l, desktop) _item_add(desktop, NULL, 1); - + snprintf(match1, sizeof(match1), "*%s*", input); l = efreet_util_desktop_name_glob_list(match1); EINA_LIST_FREE(l, desktop) - _item_add(desktop, NULL, 2); + _item_add(desktop, NULL, 2); // TODO make these optional/configurable l = efreet_util_desktop_generic_name_glob_list(match1); EINA_LIST_FREE(l, desktop) - _item_add(desktop, NULL, 3); + _item_add(desktop, NULL, 3); l = efreet_util_desktop_comment_glob_list(match1); EINA_LIST_FREE(l, desktop) @@ -256,20 +252,20 @@ EINA_LIST_FREE(l, file) _item_add(NULL, file, 1); } - + if (inst->added) { eina_hash_free(inst->added); inst->added = NULL; } - + if (p->items) { if (input) p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); return 1; } - + return 0; } @@ -291,10 +287,10 @@ if (cat && !strcmp(cat, "Screensaver")) return; } - + file = desktop->exec; } - + if (!file) return; if (!inst->added) @@ -308,13 +304,13 @@ int len; char *tmp; int found = 0; - + if (eina_hash_find(inst->added, file)) return; len = strlen(file); tmp = ecore_file_app_exe_get(file); - snprintf(match, sizeof(match), "%s*", tmp); + snprintf(match, sizeof(match), "%s*", tmp); l = efreet_util_desktop_exec_glob_list(match); EINA_LIST_FREE(l, desktop) @@ -342,7 +338,7 @@ eina_hash_add(inst->added, file, desktop); file = NULL; } - + it = E_NEW(Evry_Item, 1); app = E_NEW(Evry_App, 1); app->desktop = desktop; @@ -362,7 +358,7 @@ _item_icon_get(Evry_Item *it, Evas *e) { Evry_App *app = it->data[0]; - + if (app->desktop) it->o_icon = e_util_desktop_icon_add(app->desktop, 24, e); @@ -381,7 +377,7 @@ Evry_App *app1, *app2; const char *e1, *e2; double t1, t2; - + it1 = data1; it2 = data2; app1 = it1->data[0]; @@ -397,7 +393,6 @@ return (it1->priority - it2->priority); // TODO compare exe strings? else return 0; - } static int @@ -409,12 +404,12 @@ inst->candidate = act->thing2; _action(act->thing1, NULL); - + E_FREE(inst); inst = NULL; - + return 1; } - + return 0; } Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-07-04 02:16:45 UTC (rev 41247) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-07-04 11:10:28 UTC (rev 41248) @@ -1,13 +1,6 @@ #include "e.h" #include "e_mod_main.h" -typedef struct _Inst Inst; - -struct _Inst -{ - E_Border *border; -}; - static int _fetch(const char *input); static int _action(Evry_Item *item, const char *input); static void _cleanup(void); @@ -17,6 +10,7 @@ static Evry_Plugin *p; + EAPI int evry_plug_border_init(void) { @@ -31,7 +25,7 @@ p->cleanup = &_cleanup; p->icon_get = &_item_icon_get; evry_plugin_register(p); - + return 1; } @@ -39,7 +33,7 @@ evry_plug_border_shutdown(void) { evry_plugin_unregister(p); - E_FREE(p); + E_FREE(p); return 1; } @@ -51,13 +45,13 @@ E_Zone *zone; if (!it) return EVRY_ACTION_CONTINUE; - + bd = (E_Border *)it->data[0]; zone = e_util_zone_current_get(e_manager_current_get()); - + if (bd->desk != (e_desk_current_get(zone))) e_desk_show(bd->desk); - + if (bd->shaded) e_border_unshade(bd, E_DIRECTION_UP); @@ -68,7 +62,7 @@ /* e_border_focus_set(bd, 1, 1); */ e_border_focus_set_with_pointer(bd); - + return EVRY_ACTION_FINISHED; } @@ -90,24 +84,24 @@ { E_Manager *man; E_Zone *zone; - + char match1[4096]; char match2[4096]; Eina_List *list; E_Border *bd; E_Border_List *bl; - _cleanup(); + _cleanup(); man = e_manager_current_get(); zone = e_util_zone_current_get(man); - + if (input) { snprintf(match1, sizeof(match1), "%s*", input); snprintf(match2, sizeof(match2), "*%s*", input); } - + bl = e_container_border_list_first(e_container_current_get(man)); while ((bd = e_container_border_list_next(bl))) { @@ -140,21 +134,21 @@ static void _item_icon_get(Evry_Item *it, Evas *e) -{ - it->o_icon = e_border_icon_add(((E_Border *)it->data[0]), e); +{ + it->o_icon = e_border_icon_add(((E_Border *)it->data[0]), e); } static void _item_add(E_Border *bd, int prio) { - Evry_Item *it; + Evry_Item *it; it = E_NEW(Evry_Item, 1); /* e_object_ref(E_OBJECT(bd)); */ it->data[0] = bd; it->priority = prio; it->label = eina_stringshare_add(e_border_name_get(bd)); - + p->items = eina_list_append(p->items, it); } @@ -163,7 +157,7 @@ _cb_sort(const void *data1, const void *data2) { const Evry_Item *it1, *it2; - + it1 = data1; it2 = data2; Modified: trunk/e/src/modules/everything/evry_plug_border_act.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border_act.c 2009-07-04 02:16:45 UTC (rev 41247) +++ trunk/e/src/modules/everything/evry_plug_border_act.c 2009-07-04 11:10:28 UTC (rev 41248) @@ -15,10 +15,10 @@ static void _item_icon_get(Evry_Item *it, Evas *e); static void _item_add(const char *label, void (*action_cb) (E_Border *bd), const char *icon); - static Evry_Plugin *p; static Inst *inst; + EAPI int evry_plug_border_act_init(void) { @@ -45,9 +45,9 @@ evry_plug_border_act_shutdown(void) { evry_plugin_unregister(p); - E_FREE(p); + E_FREE(p); E_FREE(inst); - + return 1; } @@ -81,10 +81,10 @@ _cleanup(); _item_add(_("Iconify"), _act_cb_border_minimize, - "e/widgets/border/default/minimize"); + "e/widgets/border/default/minimize"); _item_add(_("Close"), _act_cb_border_close, - "e/widgets/border/default/close"); + "e/widgets/border/default/close"); return 1; } @@ -114,13 +114,13 @@ static void _item_add(const char *label, void (*action_cb) (E_Border *bd), const char *icon) { - Evry_Item *it; + Evry_Item *it; it = E_NEW(Evry_Item, 1); it->data[0] = action_cb; it->data[1] = (void *) eina_stringshare_add(icon); it->label = eina_stringshare_add(label); - p->items = eina_list_append(p->items, it); + p->items = eina_list_append(p->items, it); } static void Modified: trunk/e/src/modules/everything/evry_plug_calc.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_calc.c 2009-07-04 02:16:45 UTC (rev 41247) +++ trunk/e/src/modules/everything/evry_plug_calc.c 2009-07-04 11:10:28 UTC (rev 41248) @@ -1,3 +1,6 @@ +#include "e.h" +#include "e_mod_main.h" + /* TODO * - dc support? */ @@ -2,5 +5,2 @@ -#include "e.h" -#include "e_mod_main.h" - static int _begin(Evry_Item *it); @@ -12,12 +12,9 @@ static void _item_add(char *output, int prio); static int _cb_sort(const void *data1, const void *data2); static void _item_icon_get(Evry_Item *it, Evas *e); - static int _cb_data(void *data, int type, void *event); - static Evry_Plugin *p; - static Ecore_Exe *exe = NULL; static Eina_List *history = NULL; static Ecore_Event_Handler *data_handler = NULL; @@ -40,7 +37,7 @@ p->cleanup = &_cleanup; p->icon_get = &_item_icon_get; evry_plugin_register(p); - + return 1; } @@ -48,15 +45,15 @@ evry_plug_calc_shutdown(void) { Evry_Item *it; - + EINA_LIST_FREE(p->items, it) { if (it->label) eina_stringshare_del(it->label); free(it); } - + evry_plugin_unregister(p); - E_FREE(p); + E_FREE(p); return 1; } @@ -66,7 +63,7 @@ { data_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _cb_data, p); - + exe = ecore_exe_pipe_run("bc", ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_READ_LINE_BUFFERED | @@ -77,9 +74,10 @@ static void _cleanup() { - Evry_Item *it; + Evry_Item *it, *it2; int i = 0; - + Eina_List *l, *ll; + EINA_LIST_FREE(p->items, it) { if (i < 10) @@ -95,7 +93,7 @@ ecore_event_handler_del(data_handler); data_handler = NULL; - + ecore_exe_quit(exe); exe = NULL; } @@ -116,12 +114,36 @@ { if (p->items) { - Evry_Item *it2 = p->items->data; - - _item_add((char *) it2->label, 1); - evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); + Eina_List *l; + Evry_Item *it2; + + evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); + + /* remove duplicates */ + if (p->items->next) + { + EINA_LIST_FOREACH(p->items->next, l, it2) + { + if (!strcmp(it->label, it2->label)) + break; + it2 = NULL; + } + + if (it2) + { + p->items = eina_list_remove(p->items, it2); + eina_stringshare_del(it2->label); + E_FREE(it2); + } + } + + it = p->items->data; + + _item_add((char *) it->label, 1); } - + + evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); + return EVRY_ACTION_CONTINUE; } else @@ -150,28 +172,28 @@ p->items = history; history = NULL; } - + _send_input(input); - + return 1; } static void _item_icon_get(Evry_Item *it, Evas *e) -{ +{ it->o_icon = NULL; } static void _item_add(char *output, int prio) { - Evry_Item *it; + Evry_Item *it; it = E_NEW(Evry_Item, 1); it->priority = prio; it->label = eina_stringshare_add(output); - + p->items = eina_list_prepend(p->items, it); } @@ -180,7 +202,7 @@ { Ecore_Exe_Event_Data *ev = event; Ecore_Exe_Event_Data_Line *l; - + if (data != p) return 1; evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR); @@ -199,6 +221,6 @@ } evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); - + return 1; } Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-07-04 02:16:45 UTC (rev 41247) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-07-04 11:10:28 UTC (rev 41248) @@ -10,6 +10,7 @@ static Evry_Plugin *p; + EAPI int evry_plug_config_init(void) { @@ -32,7 +33,7 @@ { evry_plugin_unregister(p); E_FREE(p); - + return 1; } @@ -47,7 +48,7 @@ int found = 0; if (!it) return EVRY_ACTION_CONTINUE; - + eci = it->data[0]; con = e_container_current_get(e_manager_current_get()); @@ -61,15 +62,15 @@ { found = 1; snprintf(buf, sizeof(buf), "%s/%s", - ecat->cat, + ecat->cat, eci->item); } } } if (found) - e_configure_registry_call(buf, con, NULL); - + e_configure_registry_call(buf, con, NULL); + return EVRY_ACTION_FINISHED; } @@ -90,15 +91,15 @@ { E_Manager *man; E_Zone *zone; - + char match1[4096]; char match2[4096]; Eina_List *l, *ll; E_Configure_Cat *ecat; E_Configure_It *eci; - - _cleanup(); + _cleanup(); + snprintf(match1, sizeof(match1), "%s*", input); snprintf(match2, sizeof(match2), "*%s*", input); @@ -124,7 +125,7 @@ } } } - + if (eina_list_count(p->items) > 0) { p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); @@ -139,8 +140,8 @@ { E_Configure_It *eci = it->data[0]; Evas_Object *o = NULL; - - if (eci->icon) + + if (eci->icon) { o = e_icon_add(e); if (!e_util_icon_theme_set(o, eci->icon)) @@ -156,14 +157,14 @@ static void _item_add(E_Configure_It *eci, int prio) { - Evry_Item *it; + Evry_Item *it; it = E_NEW(Evry_Item, 1); it->data[0] = eci; it->priority = prio; it->label = eina_stringshare_add(eci->label); - it->o_icon = NULL; - + it->o_icon = NULL; + p->items = eina_list_append(p->items, it); } @@ -171,11 +172,11 @@ _cb_sort(const void *data1, const void *data2) { const Evry_Item *it1, *it2; - + it1 = data1; it2 = data2; /* TODO sort by name? */ - + return (it1->priority - it2->priority); } Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-07-04 02:16:45 UTC (rev 41247) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-07-04 11:10:28 UTC (rev 41248) @@ -21,6 +21,7 @@ static Evry_Plugin *p; static Eina_List *stack = NULL; + EAPI int evry_plug_dir_browse_init(void) { @@ -45,7 +46,7 @@ { evry_plugin_unregister(p); E_FREE(p); - + return 1; } @@ -53,30 +54,30 @@ _begin(Evry_Item *it) { State *s; - + if (it) { if (!it->uri || !ecore_file_is_dir(it->uri)) return 0; - s = E_NEW(State, 1); + s = E_NEW(State, 1); s->directory = eina_stringshare_add(it->uri); } else { - s = E_NEW(State, 1); - s->directory = eina_stringshare_add(e_user_homedir_get()); + s = E_NEW(State, 1); + s->directory = eina_stringshare_add(e_user_homedir_get()); } stack = eina_list_prepend(stack, s); p->items = NULL; - + return 1; } static int _action(Evry_Item *it, const char *input) -{ +{ return EVRY_ACTION_OTHER; } @@ -95,20 +96,19 @@ } } - static void _cleanup() { State *s; - + if (!stack) return; s = stack->data; - + _list_free(); - + eina_stringshare_del(s->directory); - + E_FREE(s); stack = eina_list_remove_list(stack, stack); @@ -130,9 +130,9 @@ char match1[4096]; char match2[4096]; State *s = stack->data; - + _list_free(); - + files = ecore_file_ls(s->directory); if (input) @@ -144,13 +144,13 @@ EINA_LIST_FREE(files, file) { it = NULL; - + if (file[0] == '.') { free(file); continue; } - + if (input) { if (e_util_glob_case_match(file, match1)) @@ -167,7 +167,7 @@ { it = _item_fill(s->directory, file); } - + if (it) p->items = eina_list_append(p->items, it); @@ -179,7 +179,7 @@ p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort); s->items = p->items; - + return 1; } @@ -197,7 +197,7 @@ it = E_NEW(Evry_Item, 1); snprintf(buf, sizeof(buf), "%s/%s", directory, file); - + if ((e_util_glob_case_match(file, "*.desktop")) || (e_util_glob_case_match(file, "*.directory"))) { @@ -214,7 +214,7 @@ file_path = eina_stringshare_add(buf); it->uri = file_path; - + mime = efreet_mime_globs_type_get(file_path); if (mime) { @@ -231,12 +231,12 @@ it->mime = eina_stringshare_add(mime); it->priority = 0; } - else + else { it->mime = eina_stringshare_add("None"); it->priority = 0; } - + return it; } @@ -246,7 +246,7 @@ char *item_path; if (!it->mime) return; - + if (!strcmp(it->mime, "Folder")) { it->o_icon = edje_object_add(e); @@ -270,11 +270,11 @@ _cb_sort(const void *data1, const void *data2) { const Evry_Item *it1, *it2; - + it1 = data1; it2 = data2; - if (it2->priority - it1->priority) + if (it2->priority - it1->priority) return (it2->priority - it1->priority); else return strcasecmp(it1->label, it2->label); |
From: Enlightenment S. <no-...@en...> - 2009-07-06 12:09:06
|
Log: 'everything' module: start of config dialog - fix segv possible segv when popping a state from action-seletor Author: jeffdameth Date: 2009-07-06 05:08:57 -0700 (Mon, 06 Jul 2009) New Revision: 41254 Modified: trunk/e/src/modules/everything/Makefile.am trunk/e/src/modules/everything/e_mod_main.c trunk/e/src/modules/everything/e_mod_main.h trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_config.c Modified: trunk/e/src/modules/everything/Makefile.am =================================================================== --- trunk/e/src/modules/everything/Makefile.am 2009-07-06 11:37:19 UTC (rev 41253) +++ trunk/e/src/modules/everything/Makefile.am 2009-07-06 12:08:57 UTC (rev 41254) @@ -21,7 +21,8 @@ module_la_SOURCES = e_mod_main.c \ e_mod_main.h \ evry.c \ - evry.h \ + evry.h \ + evry_config.c \ evry_plug_config.c \ evry_plug_dir_browse.c \ evry_plug_apps.c \ Modified: trunk/e/src/modules/everything/e_mod_main.c =================================================================== --- trunk/e/src/modules/everything/e_mod_main.c 2009-07-06 11:37:19 UTC (rev 41253) +++ trunk/e/src/modules/everything/e_mod_main.c 2009-07-06 12:08:57 UTC (rev 41254) @@ -10,7 +10,7 @@ static void _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_mod_menu_add(void *data, E_Menu *m); -static E_Module *conf_module = NULL; +/* static E_Module *conf_module = NULL; */ static E_Action *act = NULL; static E_Int_Menu_Augmentation *maug = NULL; @@ -67,7 +67,9 @@ evry_conf->scroll_speed = 0.5; } - conf_module = m; + evry_conf->scroll_speed = 0.08; + + /* conf_module = m; */ evry_init(); evry_plug_config_init(); @@ -89,6 +91,9 @@ maug = e_int_menus_menu_augmentation_add("main/1", _e_mod_menu_add, NULL, NULL, NULL); + e_configure_registry_category_add("advanced", 80, _("Advanced"), NULL, "preferences-advanced"); + e_configure_registry_item_add("advanced/run_everything", 40, _("Run Everything"), NULL, "system-run", evry_config_dialog); + e_module_delayed_set(m, 1); return m; @@ -97,6 +102,8 @@ EAPI int e_modapi_shutdown(E_Module *m) { + E_Config_Dialog *cfd; + /* remove module-supplied menu additions */ if (maug) { @@ -120,8 +127,12 @@ evry_plug_calc_shutdown(); evry_shutdown(); - conf_module = NULL; + /* conf_module = NULL; */ + while ((cfd = e_config_dialog_get("E", "_config_everything_dialog"))) e_object_del(E_OBJECT(cfd)); + e_configure_registry_item_del("advanced/run_everything"); + e_configure_registry_category_del("advanced"); + /* Clean EET */ E_CONFIG_DD_FREE(conf_item_edd); E_CONFIG_DD_FREE(conf_edd); Modified: trunk/e/src/modules/everything/e_mod_main.h =================================================================== --- trunk/e/src/modules/everything/e_mod_main.h 2009-07-06 11:37:19 UTC (rev 41253) +++ trunk/e/src/modules/everything/e_mod_main.h 2009-07-06 12:08:57 UTC (rev 41254) @@ -35,6 +35,8 @@ /* minimum input chars to query this source */ int min_query; + + int priority; }; @@ -45,6 +47,9 @@ EAPI int e_modapi_shutdown (E_Module *m); EAPI int e_modapi_save (E_Module *m); +EAPI E_Config_Dialog *evry_config_dialog(E_Container *con, const char *params); + + EAPI int evry_plug_apps_init(void); EAPI int evry_plug_apps_shutdown(void); Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-07-06 11:37:19 UTC (rev 41253) +++ trunk/e/src/modules/everything/evry.c 2009-07-06 12:08:57 UTC (rev 41254) @@ -45,7 +45,7 @@ static void _evry_list_clear(void); static void _evry_show_items(Evry_Plugin *plugin); static int _evry_update_timer(void *data); -static void _evry_matches_update(void); +static void _evry_matches_update(Evry_Plugin *cur_plugin); static void _evry_clear(void); static void _evry_item_next(void); static void _evry_item_prev(void); @@ -449,7 +449,7 @@ ev_last_is_mouse = 0; item_mouseover = NULL; - _evry_matches_update(); + _evry_matches_update(s->cur_plugin); return 1; } @@ -457,12 +457,17 @@ static int _evry_pop_state(void) { - Evry_State *s = cur_state; + Evry_State *s, *last_state; Evry_Plugin *p; Eina_List *l; if (!stack || !stack->next) return 0; + s = cur_state; + + stack = eina_list_remove_list(stack, stack); + last_state = stack->data; + _evry_list_clear(); free(s->input); @@ -472,22 +477,14 @@ E_FREE(s); - stack = eina_list_remove_list(stack, stack); - if (stack) { Evry_Item *it = NULL; int i = 0; - s = stack->data; + s = last_state; cur_state = s; - if (s->cur_plugin && s->cur_plugin == action_selector) - { - _evry_pop_state(); - return 0; - } - edje_object_part_text_set(o_main, "e.text.label", s->input); if (s->sel_item) @@ -509,7 +506,9 @@ if (p != s->cur_plugin && p->begin) p->begin(it); - _evry_matches_update(); + p = s->cur_plugin; + s->cur_plugin = NULL; + _evry_matches_update(p); it = eina_list_nth(s->cur_plugin->items, i); @@ -784,7 +783,7 @@ static int _evry_update_timer(void *data) { - _evry_matches_update(); + _evry_matches_update(cur_state->cur_plugin); update_timer = NULL; return 0; } @@ -870,6 +869,19 @@ s->cur_plugin = p; s->cur_items = p->items; + if (scroll_timer) + { + ecore_timer_del(scroll_timer); + scroll_timer = NULL; + } + if (scroll_animator) + { + ecore_animator_del(scroll_animator); + scroll_animator = NULL; + } + + scroll_align = 0; + evas_event_freeze(popup->evas); e_box_freeze(o_list); @@ -922,7 +934,7 @@ } static void -_evry_matches_update(void) +_evry_matches_update(Evry_Plugin *cur_plugin) { Evry_Plugin *p; Eina_List *l; @@ -946,20 +958,24 @@ { s->cur_plugins = eina_list_append(s->cur_plugins, p); } - else if (p->tab) + } + + EINA_LIST_FOREACH(plugins, l, p) + { + if (p->tab && !eina_list_data_find(s->cur_plugins, p)) { evas_object_del(p->tab); p->tab = NULL; } } - + EINA_LIST_FOREACH(s->cur_plugins, l, p) _evry_plugin_selector_show(p); if (s->cur_plugins) { - if (s->cur_plugin && eina_list_data_find(s->cur_plugins, s->cur_plugin)) - _evry_show_items(s->cur_plugin); + if (cur_plugin && eina_list_data_find(s->cur_plugins, cur_plugin)) + _evry_show_items(cur_plugin); else _evry_show_items(s->cur_plugins->data); } @@ -1213,7 +1229,6 @@ if (scroll_animator) { double spd; - spd = evry_conf->scroll_speed; scroll_align = (scroll_align * (1.0 - spd)) + (scroll_align_to * spd); return 1; @@ -1226,7 +1241,7 @@ _evry_animator(void *data) { double da; - int scroll_to = 1; + Eina_Bool scroll_to = 1; da = scroll_align - scroll_align_to; if (da < 0.0) da = -da; @@ -1333,6 +1348,8 @@ Evry_Action *act; Eina_List *l; + if (p->items) return 1; + EINA_LIST_FOREACH(actions, l, act) { Evry_Item *it; @@ -1377,6 +1394,12 @@ cur_state->cur_actions = NULL; p->items = NULL; + + if (p->tab) + { + evas_object_del(p->tab); + p->tab = NULL; + } } static void Modified: trunk/e/src/modules/everything/evry_config.c =================================================================== --- trunk/e/src/modules/everything/evry_config.c 2009-07-06 11:37:19 UTC (rev 41253) +++ trunk/e/src/modules/everything/evry_config.c 2009-07-06 12:08:57 UTC (rev 41254) @@ -2,6 +2,7 @@ #include "e_mod_main.h" #include "evry.h" +/* typedef struct _E_Config_Dialog_Data E_Config_Dialog_Data; */ static void *_create_data (E_Config_Dialog *cfd); static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); @@ -11,27 +12,14 @@ struct _E_Config_Dialog_Data { - /* Basic */ - int max_exe_list; - int max_eap_list; - int max_hist_list; + int width, height; + int scroll_animate; - /* Advanced */ - double scroll_speed; - double pos_align_x; - double pos_align_y; - double pos_size_w; - double pos_size_h; - int pos_min_w; - int pos_min_h; - int pos_max_w; - int pos_max_h; - char *term_cmd; }; -E_Config_Dialog * -e_int_config_exebuf(E_Container *con, const char *params __UNUSED__) +EAPI E_Config_Dialog * +evry_config_dialog(E_Container *con, const char *params __UNUSED__) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; @@ -55,23 +43,9 @@ static void _fill_data(E_Config_Dialog_Data *cfdata) { - /* Basic */ - cfdata->max_exe_list = e_config->exebuf_max_exe_list; - cfdata->max_eap_list = e_config->exebuf_max_eap_list; - cfdata->max_hist_list = e_config->exebuf_max_hist_list; - cfdata->scroll_animate = e_config->exebuf_scroll_animate; - /* Advanced */ - cfdata->scroll_speed = e_config->exebuf_scroll_speed; - cfdata->pos_align_x = e_config->exebuf_pos_align_x; - cfdata->pos_align_y = e_config->exebuf_pos_align_y; - cfdata->pos_size_w = e_config->exebuf_pos_size_w; - cfdata->pos_size_h = e_config->exebuf_pos_size_h; - cfdata->pos_min_w = e_config->exebuf_pos_min_w; - cfdata->pos_min_h = e_config->exebuf_pos_min_h; - cfdata->pos_max_w = e_config->exebuf_pos_max_w; - cfdata->pos_max_h = e_config->exebuf_pos_max_h; - if (e_config->exebuf_term_cmd) - cfdata->term_cmd = strdup(e_config->exebuf_term_cmd); + cfdata->scroll_animate = evry_conf->scroll_animate; + cfdata->height = evry_conf->height; + cfdata->width = evry_conf->width; } static void * @@ -87,19 +61,16 @@ static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - scroll_list = eina_list_free(scroll_list); - - E_FREE(cfdata->term_cmd); E_FREE(cfdata); } static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - e_config->exebuf_max_exe_list = cfdata->max_exe_list; - e_config->exebuf_max_eap_list = cfdata->max_eap_list; - e_config->exebuf_max_hist_list = cfdata->max_hist_list; - e_config->exebuf_scroll_animate = cfdata->scroll_animate; + evry_conf->width = cfdata->width; + evry_conf->height = cfdata->height; + evry_conf->scroll_animate = cfdata->scroll_animate; + e_config_save_queue(); return 1; } @@ -112,19 +83,16 @@ o = e_widget_list_add(evas, 0, 0); of = e_widget_framelist_add(evas, _("General Settings"), 0); - ob = e_widget_label_add(evas, _("Maximum Number of Matched Apps to List")); + ob = e_widget_label_add(evas, _("Popup Width")); e_widget_framelist_object_append(of, ob); - ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 50, 5, 0, NULL, &(cfdata->max_eap_list), 200); + ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 300, 800, 5, 0, NULL, &(cfdata->width), 200); e_widget_framelist_object_append(of, ob); - ob = e_widget_label_add(evas, _("Maximum Number of Matched Exes to List")); + + 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"), 10, 50, 5, 0, NULL, &(cfdata->max_exe_list), 200); + 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); - ob = e_widget_label_add(evas, _("Maximum History to List")); - e_widget_framelist_object_append(of, ob); - ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 10, 200, 5, 0, NULL, &(cfdata->max_hist_list), 200); - 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_check_add(evas, _("Scroll Animate"), &(cfdata->scroll_animate)); |
From: Enlightenment S. <no-...@en...> - 2009-07-07 16:30:18
|
Log: 'everything' module: added config for plugin order - pass plugin instance to plugin functions.. again Author: jeffdameth Date: 2009-07-07 09:30:11 -0700 (Tue, 07 Jul 2009) New Revision: 41265 Modified: trunk/e/src/modules/everything/Makefile.am trunk/e/src/modules/everything/e_mod_main.c trunk/e/src/modules/everything/e_mod_main.h trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry.h trunk/e/src/modules/everything/evry_config.c trunk/e/src/modules/everything/evry_plug_apps.c trunk/e/src/modules/everything/evry_plug_border.c trunk/e/src/modules/everything/evry_plug_border_act.c trunk/e/src/modules/everything/evry_plug_calc.c trunk/e/src/modules/everything/evry_plug_config.c trunk/e/src/modules/everything/evry_plug_dir_browse.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/Makefile.am =================================================================== --- trunk/e/src/modules/everything/Makefile.am 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/Makefile.am 2009-07-07 16:30:11 UTC (rev 41265) @@ -21,7 +21,6 @@ module_la_SOURCES = e_mod_main.c \ e_mod_main.h \ evry.c \ - evry.h \ evry_config.c \ evry_plug_config.c \ evry_plug_dir_browse.c \ Modified: trunk/e/src/modules/everything/e_mod_main.c =================================================================== --- trunk/e/src/modules/everything/e_mod_main.c 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/e_mod_main.c 2009-07-07 16:30:11 UTC (rev 41265) @@ -1,7 +1,7 @@ /* * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ -#include "e.h" + #include "e_mod_main.h" /* actual module specifics */ @@ -16,7 +16,7 @@ static E_Config_DD *conf_edd = NULL; static E_Config_DD *conf_item_edd = NULL; -Config *evry_conf; +Config *evry_conf = NULL; /* module setup */ EAPI E_Module_Api e_modapi = @@ -33,13 +33,16 @@ e_user_homedir_get(), e_config_profile_get()); ecore_file_mkdir(buf); - conf_item_edd = E_CONFIG_DD_NEW("Source_Config", Source_Config); + conf_item_edd = E_CONFIG_DD_NEW("Plugin_Config", Plugin_Config); #undef T #undef D -#define T Source_Config +#define T Plugin_Config #define D conf_item_edd E_CONFIG_VAL(D, T, name, STR); E_CONFIG_VAL(D, T, min_query, INT); + E_CONFIG_VAL(D, T, loaded, INT); + E_CONFIG_VAL(D, T, enabled, INT); + E_CONFIG_VAL(D, T, priority, INT); conf_edd = E_CONFIG_DD_NEW("Config", Config); #undef T #undef D @@ -51,7 +54,7 @@ E_CONFIG_VAL(D, T, rel_y, DOUBLE); E_CONFIG_VAL(D, T, scroll_animate, INT); E_CONFIG_VAL(D, T, scroll_speed, DOUBLE); - E_CONFIG_LIST(D, T, sources, conf_item_edd); + E_CONFIG_LIST(D, T, plugins_conf, conf_item_edd); #undef T #undef D evry_conf = e_config_domain_load("module.everything", conf_edd); @@ -64,10 +67,8 @@ evry_conf->width = 400; evry_conf->height = 350; evry_conf->scroll_animate = 1; - evry_conf->scroll_speed = 0.5; + evry_conf->scroll_speed = 0.08; } - - evry_conf->scroll_speed = 0.08; /* conf_module = m; */ evry_init(); Modified: trunk/e/src/modules/everything/e_mod_main.h =================================================================== --- trunk/e/src/modules/everything/e_mod_main.h 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/e_mod_main.h 2009-07-07 16:30:11 UTC (rev 41265) @@ -1,18 +1,32 @@ /* * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ + +#include "e.h" + #ifndef E_MOD_MAIN_H #define E_MOD_MAIN_H #define E_TYPEDEFS 1 -#include "evry.h" - +typedef struct _Evry_Plugin Evry_Plugin; +typedef struct _Evry_Item Evry_Item; +typedef struct _Evry_Action Evry_Action; +typedef struct _Evry_Config Evry_Config; +typedef struct _Evry_App Evry_App; #undef E_TYPEDEFS -#include "evry.h" typedef struct _Config Config; -typedef struct _Source_Config Source_Config; +typedef struct _Plugin_Config Plugin_Config; + +#define EVRY_ACTION_OTHER 0 +#define EVRY_ACTION_FINISHED 1 +#define EVRY_ACTION_CONTINUE 2 + +#define EVRY_ASYNC_UPDATE_ADD 0 +#define EVRY_ASYNC_UPDATE_CLEAR 1 + + struct _Config { /* position */ @@ -21,34 +35,144 @@ int width, height; /* generic plugin config */ - Eina_List *sources; + Eina_List *plugins_conf; int scroll_animate; double scroll_speed; int auto_select_first; + + /**/ + Eina_List *plugins; + }; -struct _Source_Config +struct _Plugin_Config { const char *name; + int loaded; + int enabled; + /* minimum input chars to query this source */ int min_query; int priority; }; + +struct _Evry_Item +{ + const char *label; + + const char *uri; + const char *mime; + /* these are only for internally use by plugins */ + /* used e.g. as pointer for item data (Efreet_Desktop) or */ + /* for internal stuff, like priority hints for sorting, etc */ + void *data[4]; + int priority; + /* not to be set by plugin! */ + Evas_Object *o_icon; + Evas_Object *o_bg; +}; + +struct _Evry_Plugin +{ + const char *name; + + const char *type_in; + const char *type_out; + + /* sync/async ?*/ + Eina_Bool async_query; + + /* whether candidates can be shown without input + * e.g. borders, app history */ + Eina_Bool need_query; + + /* run when plugin is activated. */ + int (*begin) (Evry_Plugin *p, Evry_Item *item); + + /* get candidates matching string, fills 'candidates' list */ + int (*fetch) (Evry_Plugin *p, const char *input); + + /* default action for this plugins items */ + int (*action) (Evry_Plugin *p, Evry_Item *item, const char *input); + + /* run before new query and when hiding 'everything' */ + void (*cleanup) (Evry_Plugin *p); + + /* TODO return icon */ + void (*icon_get) (Evry_Plugin *p, Evry_Item *it, Evas *e); + /* provide more information for a candidate */ + /* int (*candidate_info) (Evas *evas, Evry_Item *item); */ + + Eina_List *items; + + Evas_Object *(*config_page) (void); + void (*config_apply) (void); + + /* for internal use by plugin */ + void *priv; + + /* not to be set by plugin! */ + Evas_Object *tab; + Plugin_Config *config; +}; + +struct _Evry_Action +{ + const char *name; + + const char *type_in1; + const char *type_in2; + const char *type_out; + + Evry_Item *thing1; + Evry_Item *thing2; + + int (*action) (void); + + void (*icon_get) (Evry_Plugin *p, Evry_Item *it, Evas *e); + + void *priv; + + /* not to be set by plugin! */ + Evas_Object *o_icon; +}; + +struct _Evry_Config +{ + Eina_List *plugin_order; + +}; + + +struct _Evry_App +{ + const char *file; + Efreet_Desktop *desktop; +}; + EAPI extern E_Module_Api e_modapi; EAPI void *e_modapi_init (E_Module *m); EAPI int e_modapi_shutdown (E_Module *m); EAPI int e_modapi_save (E_Module *m); - EAPI E_Config_Dialog *evry_config_dialog(E_Container *con, const char *params); +EAPI int evry_init(void); +EAPI int evry_shutdown(void); +EAPI int evry_show(E_Zone *zone); +EAPI void evry_hide(void); +EAPI void evry_plugin_register(Evry_Plugin *p); +EAPI void evry_plugin_unregister(Evry_Plugin *p); +EAPI void evry_action_register(Evry_Action *act); +EAPI void evry_action_unregister(Evry_Action *act); +EAPI void evry_plugin_async_update(Evry_Plugin *plugin, int state); EAPI int evry_plug_apps_init(void); EAPI int evry_plug_apps_shutdown(void); Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/evry.c 2009-07-07 16:30:11 UTC (rev 41265) @@ -1,6 +1,5 @@ #include "e.h" #include "e_mod_main.h" -#include "evry.h" #define INPUTLEN 40 #define MATCH_LAG 0.33 @@ -63,14 +62,14 @@ static int _evry_push_state(void); static int _evry_pop_state(void); static void _evry_plugin_selector_show(Evry_Plugin *p); -static int _evry_cb_plugin_sort(const void *data1, const void *data2); +static int _evry_cb_plugin_sort(const void *data1, const void *data2); static int _evry_plug_act_select_init(void); static int _evry_plug_act_select_actions_set(void); -static int _evry_plug_act_select_fetch(const char *input); -static int _evry_plug_act_select_action(Evry_Item *item, const char *input); -static void _evry_plug_act_select_cleanup(void); -static void _evry_plug_act_select_item_icon_get(Evry_Item *it, Evas *e); +static int _evry_plug_act_select_fetch(Evry_Plugin *p, const char *input); +static int _evry_plug_act_select_action(Evry_Plugin *p, Evry_Item *item, const char *input); +static void _evry_plug_act_select_cleanup(Evry_Plugin *p); +static void _evry_plug_act_select_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); /* local subsystem globals */ static E_Popup *popup = NULL; @@ -87,7 +86,7 @@ static Ecore_Timer *scroll_timer = NULL; static double scroll_align_to; static double scroll_align; -static Eina_List *plugins = NULL; +/* static Eina_List *plugins = NULL; */ static Eina_List *actions = NULL; static Evry_State *cur_state = NULL; static Eina_List *stack = NULL; @@ -112,14 +111,44 @@ EAPI void evry_plugin_register(Evry_Plugin *plugin) { - plugins = eina_list_append(plugins, plugin); + Eina_List *l; + Plugin_Config *pc; + Eina_Bool found = 0; + + evry_conf->plugins = eina_list_append(evry_conf->plugins, plugin); + + EINA_LIST_FOREACH(evry_conf->plugins_conf, l, pc) + { + if (pc->name && plugin->name && !strcmp(pc->name, plugin->name)) + { + found = 1; + break; + } + } + + if (!found) + { + pc = E_NEW(Plugin_Config, 1); + pc->name = eina_stringshare_add(plugin->name); + pc->enabled = 1; + pc->priority = eina_list_count(evry_conf->plugins); + + evry_conf->plugins_conf = eina_list_append(evry_conf->plugins_conf, pc); + } + + plugin->config = pc; + + evry_conf->plugins = eina_list_sort(evry_conf->plugins, + eina_list_count(evry_conf->plugins), + _evry_cb_plugin_sort); + /* TODO sorting, initialization, etc */ } EAPI void evry_plugin_unregister(Evry_Plugin *plugin) { - plugins = eina_list_remove(plugins, plugin); + evry_conf->plugins = eina_list_remove(evry_conf->plugins, plugin); /* cleanup */ } @@ -242,7 +271,7 @@ EINA_LIST_FREE(s->plugins, p) { - p->cleanup(); + p->cleanup(p); if (p->tab) { @@ -307,9 +336,6 @@ if (!eina_list_data_find(s->cur_plugins, p)) { s->cur_plugins = eina_list_append(s->cur_plugins, p); - s->cur_plugins = eina_list_sort(s->cur_plugins, - eina_list_count(s->cur_plugins), - _evry_cb_plugin_sort); _evry_plugin_selector_show(p); } else @@ -320,7 +346,7 @@ } if ((!s->cur_plugin && s->cur_plugins) || (s->cur_plugin == p) || - (s->plugin_auto_selected && (s->cur_plugin->prio > p->prio))) + (s->plugin_auto_selected && (s->cur_plugin->config->priority > p->config->priority))) { if (!s->cur_plugin) s->plugin_auto_selected = 1; @@ -343,7 +369,7 @@ { const Evry_Plugin *p1 = data1; const Evry_Plugin *p2 = data2; - return p1->prio - p2->prio; + return p1->config->priority - p2->config->priority; } static int @@ -369,7 +395,7 @@ EINA_LIST_FOREACH(s->plugins, l, p) { if (p != s->cur_plugin) - p->cleanup(); + p->cleanup(p); if (p->tab) { @@ -379,8 +405,10 @@ } } - EINA_LIST_FOREACH(plugins, l, p) + EINA_LIST_FOREACH(evry_conf->plugins, l, p) { + if (!p->config->enabled) continue; + if (strstr(p->type_in, cur_type)) { /* printf("%s- in:%s out:%s\n", p->name, p->type_in, p->type_out); */ @@ -400,7 +428,7 @@ if (s && (s->cur_plugin != action_selector)) it = s->sel_item; - if (p->begin(it)) + if (p->begin(p, it)) list = eina_list_append(list, p); } else @@ -418,7 +446,7 @@ if (!list) return 0; - list = eina_list_sort(list, eina_list_count(list), _evry_cb_plugin_sort); + /* list = eina_list_sort(list, eina_list_count(list), _evry_cb_plugin_sort); */ _evry_list_clear(); @@ -473,7 +501,7 @@ free(s->input); EINA_LIST_FOREACH(s->plugins, l, p) - p->cleanup(); + p->cleanup(p); E_FREE(s); @@ -504,7 +532,7 @@ EINA_LIST_FOREACH(s->plugins, l, p) if (p != s->cur_plugin && p->begin) - p->begin(it); + p->begin(p, it); p = s->cur_plugin; s->cur_plugin = NULL; @@ -806,7 +834,7 @@ if (s->cur_plugin == action_selector) { /* set cur_action and start plugins for second parameter (if required)*/ - if (s->sel_item) _evry_plug_act_select_action(s->sel_item, s->input); + if (s->sel_item) _evry_plug_act_select_action(s->cur_plugin, s->sel_item, s->input); finished = 0; } @@ -826,7 +854,7 @@ if (s->cur_plugin->action) { - ret = s->cur_plugin->action(s->sel_item, s->input); + ret = s->cur_plugin->action(s->cur_plugin, s->sel_item, s->input); } if (ret == EVRY_ACTION_OTHER) { @@ -900,7 +928,7 @@ _evry_cb_item_mouse_out, it); evas_object_show(o); - p->icon_get(it, popup->evas); + p->icon_get(p, it, popup->evas); if (edje_object_part_exists(o, "e.swallow.icons") && it->o_icon) { edje_object_part_swallow(o, "e.swallow.icons", it->o_icon); @@ -950,9 +978,9 @@ EINA_LIST_FOREACH(s->plugins, l, p) { if (strlen(s->input) == 0) - items = !p->need_query ? p->fetch(NULL) : 0; + items = !p->need_query ? p->fetch(p, NULL) : 0; else - items = p->fetch(s->input); + items = p->fetch(p, s->input); if (!s->initial || (items && eina_list_count(p->items) > 0)) { @@ -960,8 +988,10 @@ } } - EINA_LIST_FOREACH(plugins, l, p) + EINA_LIST_FOREACH(evry_conf->plugins, l, p) { + if (!p->config->enabled) continue; + if (p->tab && !eina_list_data_find(s->cur_plugins, p)) { evas_object_del(p->tab); @@ -1323,7 +1353,7 @@ Evry_State *s = cur_state; Evry_Plugin *p = action_selector; - _evry_plug_act_select_cleanup(); + _evry_plug_act_select_cleanup(p); const char *type = s->cur_plugin->type_out; @@ -1342,9 +1372,8 @@ } static int -_evry_plug_act_select_fetch(const char *input) +_evry_plug_act_select_fetch(Evry_Plugin *p, const char *input) { - Evry_Plugin *p = action_selector; Evry_Action *act; Eina_List *l; @@ -1367,7 +1396,7 @@ } static int -_evry_plug_act_select_action(Evry_Item *it, const char *input) +_evry_plug_act_select_action(Evry_Plugin *p, Evry_Item *it, const char *input) { Evry_Action *act = it->data[0]; cur_state->cur_action = act; @@ -1378,11 +1407,9 @@ } static void -_evry_plug_act_select_cleanup(void) +_evry_plug_act_select_cleanup(Evry_Plugin *p) { - Evry_Item *it; - Evry_Plugin *p = action_selector; EINA_LIST_FREE(p->items, it) { @@ -1403,7 +1430,7 @@ } static void -_evry_plug_act_select_item_icon_get(Evry_Item *it, Evas *e) +_evry_plug_act_select_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { Evry_Action *act = it->data[0]; Modified: trunk/e/src/modules/everything/evry.h =================================================================== --- trunk/e/src/modules/everything/evry.h 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/evry.h 2009-07-07 16:30:11 UTC (rev 41265) @@ -1,13 +1,11 @@ /* * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ + +#include "e_mod_main.h" + #ifdef E_TYPEDEFS -typedef struct _Evry_Plugin Evry_Plugin; -typedef struct _Evry_Item Evry_Item; -typedef struct _Evry_Action Evry_Action; -typedef struct _Evry_Config Evry_Config; -typedef struct _Evry_App Evry_App; /* typedef enum _Evry_Plugin_Type @@ -97,6 +95,7 @@ /* not to be set by plugin! */ Evas_Object *tab; + Plugin_Config *config; }; struct _Evry_Action Modified: trunk/e/src/modules/everything/evry_config.c =================================================================== --- trunk/e/src/modules/everything/evry_config.c 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/evry_config.c 2009-07-07 16:30:11 UTC (rev 41265) @@ -1,6 +1,5 @@ -#include "e.h" + #include "e_mod_main.h" -#include "evry.h" /* typedef struct _E_Config_Dialog_Data E_Config_Dialog_Data; */ @@ -15,6 +14,9 @@ int width, height; int scroll_animate; + + Evas_Object *l_avail; + }; @@ -75,10 +77,88 @@ return 1; } +static void +_fill_list(Evas_Object *obj, int enabled) +{ + Evas *evas; + Evas_Coord w; + Eina_List *l; + Evry_Plugin *p; + + /* freeze evas, edje, and list widget */ + evas = evas_object_evas_get(obj); + evas_event_freeze(evas); + edje_freeze(); + e_widget_ilist_freeze(obj); + e_widget_ilist_clear(obj); + + EINA_LIST_FOREACH(evry_conf->plugins, l, p) + e_widget_ilist_append(obj, NULL, p->name, NULL, p, NULL); + + e_widget_ilist_go(obj); + e_widget_min_size_get(obj, &w, NULL); + e_widget_min_size_set(obj, w > 180 ? w : 180, 200); + e_widget_ilist_thaw(obj); + edje_thaw(); + evas_event_thaw(evas); +} + +static void +_plugin_move(Evas_Object *list, int dir) +{ + int sel; + Eina_List *l1, *l2; + + sel = e_widget_ilist_selected_get(list); + + if (sel >= 0) + { + Evry_Plugin *p; + Evas *evas; + int prio = 0; + + l1 = eina_list_nth_list(evry_conf->plugins, sel); + l2 = eina_list_nth_list(evry_conf->plugins, sel + dir); + + if (!l1 || !l2) return; + p = l1->data; + l1->data = l2->data; + l2->data = p; + + _fill_list(list, 0); + e_widget_ilist_selected_set(list, sel + dir); + + EINA_LIST_FOREACH(evry_conf->plugins, l1, p) + p->config->priority = prio++; + } +} + +static void +_plugin_move_up_cb(void *data, void *data2) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = data; + + _plugin_move(cfdata->l_avail, -1); +} + +static void +_plugin_move_down_cb(void *data, void *data2) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = data; + + _plugin_move(cfdata->l_avail, 1); +} + static Evas_Object * _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) { - Evas_Object *o, *of, *ob; + Evas_Object *o, *of, *ob, *otb; + + otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale); o = e_widget_list_add(evas, 0, 0); @@ -98,5 +178,23 @@ 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); - return o; + + e_widget_toolbook_page_append(otb, NULL, _("General Settings"), o, 0, 0, 0, 0, 0.5, 0.0); + e_widget_toolbook_page_show(otb, 0); + + of = e_widget_framelist_add(evas, _("Available Plugins"), 0); + o = e_widget_ilist_add(evas, 24, 24, NULL); + cfdata->l_avail = o; + /* e_widget_ilist_multi_select_set(ol, 1); */ + /* e_widget_on_change_hook_set(ol, _avail_list_cb_change, cfdata); */ + _fill_list(o, 0); + e_widget_framelist_object_append(of, o); + o = e_widget_button_add(evas, _("Move Up"), NULL, _plugin_move_up_cb, cfdata, NULL); + e_widget_framelist_object_append(of, o); + o = e_widget_button_add(evas, _("Move Down"), NULL, _plugin_move_down_cb, cfdata, NULL); + e_widget_framelist_object_append(of, o); + + e_widget_toolbook_page_append(otb, NULL, _("Plugins"), of, 0, 0, 0, 0, 0.5, 0.0); + + return otb; } Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-07-07 16:30:11 UTC (rev 41265) @@ -10,16 +10,17 @@ Evry_Item *candidate; }; -static int _begin(Evry_Item *item); -static int _fetch(const char *input); -static int _action(Evry_Item *item, const char *input); -static void _cleanup(void); -static void _item_add(Efreet_Desktop *desktop, char *file, int prio); +static int _begin(Evry_Plugin *p, Evry_Item *item); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); +static void _cleanup(Evry_Plugin *p); +static void _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio); static int _cb_sort(const void *data1, const void *data2); -static void _item_icon_get(Evry_Item *it, Evas *e); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); static int _exec_action(void); -static Evry_Plugin *p; +static Evry_Plugin *p1; +static Evry_Plugin *p2; static Evry_Action *act; static Inst *inst; @@ -27,23 +28,36 @@ EAPI int evry_plug_apps_init(void) { - p = E_NEW(Evry_Plugin, 1); - p->type_in = "NONE|FILE"; - p->type_out = "NONE"; - p->need_query = 0; - p->begin = &_begin; - p->fetch = &_fetch; - p->action = &_action; - p->cleanup = &_cleanup; - p->icon_get = &_item_icon_get; - evry_plugin_register(p); + p1 = E_NEW(Evry_Plugin, 1); + p1->name = "Applications"; + p1->type_in = "NONE"; + p1->type_out = "APPLICATION"; + p1->need_query = 0; + p1->begin = &_begin; + p1->fetch = &_fetch; + p1->action = &_action; + p1->cleanup = &_cleanup; + p1->icon_get = &_item_icon_get; + evry_plugin_register(p1); + p2 = E_NEW(Evry_Plugin, 1); + p2->name = "Open With..."; + p2->type_in = "FILE"; + p2->type_out = "NONE"; + p2->need_query = 0; + p2->begin = &_begin; + p2->fetch = &_fetch; + p2->action = &_action; + p2->cleanup = &_cleanup; + p2->icon_get = &_item_icon_get; + evry_plugin_register(p2); + act = E_NEW(Evry_Action, 1); act->name = "Open File..."; act->type_in1 = "APPLICATION"; act->type_in2 = "FILE"; act->type_out = "NONE"; - act->action =_exec_action; + act->action = &_exec_action; evry_action_register(act); inst = NULL; @@ -54,14 +68,15 @@ EAPI int evry_plug_apps_shutdown(void) { - evry_plugin_unregister(p); + evry_plugin_unregister(p1); + evry_plugin_unregister(p2); evry_action_unregister(act); return 1; } static int -_begin(Evry_Item *it) +_begin(Evry_Plugin *p, Evry_Item *it) { const char *mime; @@ -69,10 +84,6 @@ if (it) { - p->name = "Open With..."; - p->type_out = "NONE"; - p->prio = 3; - if (!it->uri) return 0; if (!it->mime) @@ -88,10 +99,6 @@ } else { - p->name = "Applications"; - p->type_out = "APPLICATION"; - p->prio = 1; - inst = E_NEW(Inst, 1); } @@ -99,7 +106,7 @@ } static int -_action(Evry_Item *it, const char *input) +_action(Evry_Plugin *p, Evry_Item *it, const char *input) { E_Zone *zone; Evry_App *app = NULL; @@ -151,7 +158,7 @@ } static void -_list_free(void) +_list_free(Evry_Plugin *p) { Evry_Item *it; Evry_App *app; @@ -166,9 +173,9 @@ } static void -_cleanup(void) +_cleanup(Evry_Plugin *p) { - _list_free(); + _list_free(p); if (inst) { @@ -180,7 +187,7 @@ } static int -_fetch(const char *input) +_fetch(Evry_Plugin *p, const char *input) { Eina_List *l; Efreet_Desktop *desktop; @@ -188,14 +195,14 @@ char match1[4096]; char match2[4096]; - _list_free(); + _list_free(p); if (inst->apps) { if (!input) { EINA_LIST_FOREACH(inst->apps, l, desktop) - _item_add(desktop, NULL, 1); + _item_add(p, desktop, NULL, 1); } else { @@ -205,19 +212,19 @@ EINA_LIST_FOREACH(inst->apps, l, desktop) { if (e_util_glob_case_match(desktop->exec, match1)) - _item_add(desktop, NULL, 1); + _item_add(p, desktop, NULL, 1); else if (e_util_glob_case_match(desktop->exec, match2)) - _item_add(desktop, NULL, 2); + _item_add(p, desktop, NULL, 2); else if (e_util_glob_case_match(desktop->name, match1)) - _item_add(desktop, NULL, 1); - else if (e_util_glob_case_match(desktop->name, match2)) - _item_add(desktop, NULL, 2); + _item_add(p, desktop, NULL, 1); + else if (p, e_util_glob_case_match(desktop->name, match2)) + _item_add(p, desktop, NULL, 2); else if (desktop->comment) { if (e_util_glob_case_match(desktop->comment, match1)) - _item_add(desktop, NULL, 3); + _item_add(p, desktop, NULL, 3); else if (e_util_glob_case_match(desktop->comment, match2)) - _item_add(desktop, NULL, 4); + _item_add(p, desktop, NULL, 4); } } } @@ -229,28 +236,28 @@ snprintf(match1, sizeof(match1), "%s*", input); l = efreet_util_desktop_exec_glob_list(match1); EINA_LIST_FREE(l, desktop) - _item_add(desktop, NULL, 1); + _item_add(p, desktop, NULL, 1); snprintf(match1, sizeof(match1), "*%s*", input); l = efreet_util_desktop_name_glob_list(match1); EINA_LIST_FREE(l, desktop) - _item_add(desktop, NULL, 2); + _item_add(p, desktop, NULL, 2); // TODO make these optional/configurable l = efreet_util_desktop_generic_name_glob_list(match1); EINA_LIST_FREE(l, desktop) - _item_add(desktop, NULL, 3); + _item_add(p, desktop, NULL, 3); l = efreet_util_desktop_comment_glob_list(match1); EINA_LIST_FREE(l, desktop) - _item_add(desktop, NULL, 3); + _item_add(p, desktop, NULL, 3); } else if (!p->items) { // TODO option for popular/recent l = e_exehist_list_get(); EINA_LIST_FREE(l, file) - _item_add(NULL, file, 1); + _item_add(p, NULL, file, 1); } if (inst->added) @@ -270,7 +277,7 @@ } static void -_item_add(Efreet_Desktop *desktop, char *file, int prio) +_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio) { Evry_Item *it; Evry_App *app; @@ -355,7 +362,7 @@ } static void -_item_icon_get(Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { Evry_App *app = it->data[0]; @@ -396,14 +403,14 @@ } static int -_exec_action(void) +_exec_action() { if (act->thing1 && act->thing2) { inst = E_NEW(Inst, 1); inst->candidate = act->thing2; - _action(act->thing1, NULL); + _action(NULL, act->thing1, NULL); E_FREE(inst); inst = NULL; Modified: trunk/e/src/modules/everything/evry_plug_border.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border.c 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/evry_plug_border.c 2009-07-07 16:30:11 UTC (rev 41265) @@ -1,12 +1,12 @@ #include "e.h" #include "e_mod_main.h" -static int _fetch(const char *input); -static int _action(Evry_Item *item, const char *input); -static void _cleanup(void); -static void _item_add(E_Border *bd, int prio); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); +static void _cleanup(Evry_Plugin *p); +static void _item_add(Evry_Plugin *p, E_Border *bd, int prio); static int _cb_sort(const void *data1, const void *data2); -static void _item_icon_get(Evry_Item *it, Evas *e); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); static Evry_Plugin *p; @@ -19,7 +19,6 @@ p->type_in = "NONE"; p->type_out = "BORDER"; p->need_query = 0; - p->prio = 0; p->fetch = &_fetch; p->action = &_action; p->cleanup = &_cleanup; @@ -39,7 +38,7 @@ } static int -_action(Evry_Item *it, const char *input) +_action(Evry_Plugin *p, Evry_Item *it, const char *input) { E_Border *bd; E_Zone *zone; @@ -67,7 +66,7 @@ } static void -_cleanup() +_cleanup(Evry_Plugin *p) { Evry_Item *it; @@ -80,7 +79,7 @@ } static int -_fetch(const char *input) +_fetch(Evry_Plugin *p, const char *input) { E_Manager *man; E_Zone *zone; @@ -91,7 +90,7 @@ E_Border *bd; E_Border_List *bl; - _cleanup(); + _cleanup(p); man = e_manager_current_get(); zone = e_util_zone_current_get(man); @@ -108,17 +107,17 @@ if (zone == bd->zone) { if (!input) - _item_add(bd, 1); + _item_add(p, bd, 1); else if (bd->client.icccm.name && e_util_glob_case_match(bd->client.icccm.name, match1)) - _item_add(bd, 1); + _item_add(p, bd, 1); else if (e_util_glob_case_match(e_border_name_get(bd), match1)) - _item_add(bd, 1); + _item_add(p, bd, 1); else if (bd->client.icccm.name && e_util_glob_case_match(bd->client.icccm.name, match2)) - _item_add(bd, 2); + _item_add(p, bd, 2); else if (e_util_glob_case_match(e_border_name_get(bd), match2)) - _item_add(bd, 2); + _item_add(p, bd, 2); } } e_container_border_list_free(bl); @@ -133,13 +132,13 @@ } static void -_item_icon_get(Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { it->o_icon = e_border_icon_add(((E_Border *)it->data[0]), e); } static void -_item_add(E_Border *bd, int prio) +_item_add(Evry_Plugin *p, E_Border *bd, int prio) { Evry_Item *it; Modified: trunk/e/src/modules/everything/evry_plug_border_act.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_border_act.c 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/evry_plug_border_act.c 2009-07-07 16:30:11 UTC (rev 41265) @@ -8,12 +8,12 @@ E_Border *border; }; -static int _begin(Evry_Item *item); -static int _fetch(const char *input); -static int _action(Evry_Item *item, const char *input); -static void _cleanup(void); -static void _item_icon_get(Evry_Item *it, Evas *e); -static void _item_add(const char *label, void (*action_cb) (E_Border *bd), const char *icon); +static int _begin(Evry_Plugin *p, Evry_Item *item); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); +static void _cleanup(Evry_Plugin *p); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static void _item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon); static Evry_Plugin *p; static Inst *inst; @@ -27,7 +27,6 @@ p->type_in = "BORDER"; p->type_out = "NONE"; p->need_query = 0; - p->prio = 0; p->begin = &_begin; p->fetch = &_fetch; p->action = &_action; @@ -64,7 +63,7 @@ } static int -_begin(Evry_Item *item) +_begin(Evry_Plugin *p, Evry_Item *item) { E_Border *bd; @@ -76,20 +75,20 @@ } static int -_fetch(const char *input) +_fetch(Evry_Plugin *p, const char *input) { - _cleanup(); + _cleanup(p); - _item_add(_("Iconify"), _act_cb_border_minimize, + _item_add(p, _("Iconify"), _act_cb_border_minimize, "e/widgets/border/default/minimize"); - _item_add(_("Close"), _act_cb_border_close, + _item_add(p, _("Close"), _act_cb_border_close, "e/widgets/border/default/close"); return 1; } static int -_action(Evry_Item *item, const char *input) +_action(Evry_Plugin *p, Evry_Item *item, const char *input) { void (*border_action) (E_Border *bd); border_action = item->data[0]; @@ -99,7 +98,7 @@ } static void -_cleanup(void) +_cleanup(Evry_Plugin *p) { Evry_Item *it; @@ -112,7 +111,7 @@ } static void -_item_add(const char *label, void (*action_cb) (E_Border *bd), const char *icon) +_item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon) { Evry_Item *it; @@ -124,7 +123,7 @@ } static void -_item_icon_get(Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { it->o_icon = edje_object_add(e); e_theme_edje_object_set(it->o_icon, "base/theme/borders", (const char *)it->data[1]); Modified: trunk/e/src/modules/everything/evry_plug_calc.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_calc.c 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/evry_plug_calc.c 2009-07-07 16:30:11 UTC (rev 41265) @@ -5,13 +5,13 @@ * - dc support? */ -static int _begin(Evry_Item *it); -static int _fetch(const char *input); -static int _action(Evry_Item *item, const char *input); -static void _cleanup(void); -static void _item_add(char *output, int prio); +static int _begin(Evry_Plugin *p, Evry_Item *it); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); +static void _cleanup(Evry_Plugin *p); +static void _item_add(Evry_Plugin *p, char *output, int prio); static int _cb_sort(const void *data1, const void *data2); -static void _item_icon_get(Evry_Item *it, Evas *e); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); static int _cb_data(void *data, int type, void *event); static Evry_Plugin *p; @@ -29,7 +29,6 @@ p->type_in = "NONE"; p->type_out = "NONE"; p->need_query = 0; - p->prio = 6; p->async_query = 1; p->begin = &_begin; p->fetch = &_fetch; @@ -59,7 +58,7 @@ } static int -_begin(Evry_Item *it) +_begin(Evry_Plugin *p, Evry_Item *it) { data_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _cb_data, p); @@ -72,7 +71,7 @@ } static void -_cleanup() +_cleanup(Evry_Plugin *p) { Evry_Item *it, *it2; int i = 0; @@ -108,7 +107,7 @@ } static int -_action(Evry_Item *it, const char *input) +_action(Evry_Plugin *p, Evry_Item *it, const char *input) { if (!it) { @@ -139,7 +138,7 @@ it = p->items->data; - _item_add((char *) it->label, 1); + _item_add(p, (char *) it->label, 1); } evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); @@ -157,7 +156,7 @@ if (p->items->data == it) { Evry_Item *it2 = p->items->data; - _item_add((char *) it2->label, 1); + _item_add(p, (char *) it2->label, 1); } } @@ -165,7 +164,7 @@ } static int -_fetch(const char *input) +_fetch(Evry_Plugin *p, const char *input) { if (history) { @@ -179,13 +178,13 @@ } static void -_item_icon_get(Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { it->o_icon = NULL; } static void -_item_add(char *output, int prio) +_item_add(Evry_Plugin *p, char *output, int prio) { Evry_Item *it; @@ -217,7 +216,7 @@ it->label = eina_stringshare_add(l->line); } else - _item_add(l->line, 1); + _item_add(p, l->line, 1); } evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD); Modified: trunk/e/src/modules/everything/evry_plug_config.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_config.c 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/evry_plug_config.c 2009-07-07 16:30:11 UTC (rev 41265) @@ -1,11 +1,11 @@ #include "e.h" #include "e_mod_main.h" -static int _fetch(const char *input); -static int _action(Evry_Item *item, const char *input); -static void _cleanup(void); -static void _item_add(E_Configure_It *eci, int prio); -static void _item_icon_get(Evry_Item *it, Evas *e); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *item, const char *input); +static void _cleanup(Evry_Plugin *p); +static void _item_add(Evry_Plugin *p, E_Configure_It *eci, int prio); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); static int _cb_sort(const void *data1, const void *data2); static Evry_Plugin *p; @@ -18,7 +18,6 @@ p->name = "Settings"; p->type_in = "NONE"; p->type_out = "NONE"; - p->prio = 4; p->fetch = &_fetch; p->action = &_action; p->cleanup = &_cleanup; @@ -38,7 +37,7 @@ } static int -_action(Evry_Item *it, const char *input) +_action(Evry_Plugin *p, Evry_Item *it, const char *input) { E_Configure_It *eci, *eci2; E_Container *con; @@ -75,7 +74,7 @@ } static void -_cleanup(void) +_cleanup(Evry_Plugin *p) { Evry_Item *it; @@ -87,7 +86,7 @@ } static int -_fetch(const char *input) +_fetch(Evry_Plugin *p, const char *input) { E_Manager *man; E_Zone *zone; @@ -98,7 +97,7 @@ E_Configure_Cat *ecat; E_Configure_It *eci; - _cleanup(); + _cleanup(p); snprintf(match1, sizeof(match1), "%s*", input); snprintf(match2, sizeof(match2), "*%s*", input); @@ -114,13 +113,13 @@ if (eci->pri >= 0) { if (e_util_glob_case_match(eci->label, match1)) - _item_add(eci, 1); + _item_add(p, eci, 1); else if (e_util_glob_case_match(eci->label, match2)) - _item_add(eci, 2); + _item_add(p, eci, 2); else if (e_util_glob_case_match(ecat->label, match1)) - _item_add(eci, 3); + _item_add(p, eci, 3); else if (e_util_glob_case_match(ecat->label, match2)) - _item_add(eci, 4); + _item_add(p, eci, 4); } } } @@ -136,7 +135,7 @@ } static void -_item_icon_get(Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { E_Configure_It *eci = it->data[0]; Evas_Object *o = NULL; @@ -155,7 +154,7 @@ } static void -_item_add(E_Configure_It *eci, int prio) +_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio) { Evry_Item *it; Modified: trunk/e/src/modules/everything/evry_plug_dir_browse.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/evry_plug_dir_browse.c 2009-07-07 16:30:11 UTC (rev 41265) @@ -9,14 +9,14 @@ Eina_List *items; }; -static int _begin(Evry_Item *it); -static int _fetch(const char *input); -static int _action(Evry_Item *it, const char *input); -static void _cleanup(void); +static int _begin(Evry_Plugin *p, Evry_Item *it); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *it, const char *input); +static void _cleanup(Evry_Plugin *p); static int _cb_sort(const void *data1, const void *data2); -static void _item_icon_get(Evry_Item *it, Evas *e); -static void _list_free(void); -static Evry_Item *_item_fill(const char *directory, const char *file); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); +static void _list_free(Evry_Plugin *p); +static Evry_Item *_item_fill(Evry_Plugin *p, const char *directory, const char *file); static Evry_Plugin *p; static Eina_List *stack = NULL; @@ -29,7 +29,6 @@ p->name = "Browse Files"; p->type_in = "NONE|FILE"; p->type_out = "FILE"; - p->prio = 2; p->begin = &_begin; p->fetch = &_fetch; p->action = &_action; @@ -51,7 +50,7 @@ } static int -_begin(Evry_Item *it) +_begin(Evry_Plugin *p, Evry_Item *it) { State *s; @@ -76,13 +75,13 @@ } static int -_action(Evry_Item *it, const char *input) +_action(Evry_Plugin *p, Evry_Item *it, const char *input) { return EVRY_ACTION_OTHER; } static void -_list_free() +_list_free(Evry_Plugin *p) { Evry_Item *it; @@ -97,7 +96,7 @@ } static void -_cleanup() +_cleanup(Evry_Plugin *p) { State *s; @@ -105,7 +104,7 @@ s = stack->data; - _list_free(); + _list_free(p); eina_stringshare_del(s->directory); @@ -122,7 +121,7 @@ /* based on directory-watcher from drawer module */ static int -_fetch(const char *input) +_fetch(Evry_Plugin *p, const char *input) { Eina_List *files; char *file; @@ -131,7 +130,7 @@ char match2[4096]; State *s = stack->data; - _list_free(); + _list_free(p); files = ecore_file_ls(s->directory); @@ -155,17 +154,17 @@ { if (e_util_glob_case_match(file, match1)) { - it = _item_fill(s->directory, file); + it = _item_fill(p, s->directory, file); it->priority += 1; } else if (e_util_glob_case_match(file, match2)) { - it = _item_fill(s->directory, file); + it = _item_fill(p, s->directory, file); } } else { - it = _item_fill(s->directory, file); + it = _item_fill(p, s->directory, file); } if (it) @@ -188,7 +187,7 @@ /* based on directory-watcher from drawer module */ static Evry_Item * -_item_fill(const char *directory, const char *file) +_item_fill(Evry_Plugin *p, const char *directory, const char *file) { Evry_Item *it = NULL; char buf[4096]; @@ -241,7 +240,7 @@ } static void -_item_icon_get(Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { char *item_path; Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-07-07 13:49:07 UTC (rev 41264) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-07-07 16:30:11 UTC (rev 41265) @@ -10,11 +10,11 @@ E_DBus_Connection *conn; }; -static int _fetch(const char *input); -static int _action(Evry_Item *it, const char *input); -static void _cleanup(void); -static void _item_add(char *file, char *service, char *mime, int prio); -static void _item_icon_get(Evry_Item *it, Evas *e); +static int _fetch(Evry_Plugin *p, const char *input); +static int _action(Evry_Plugin *p, Evry_Item *it, const char *input); +static void _cleanup(Evry_Plugin *p); +static void _item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio); +static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e); static void _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error); static Evry_Plugin *p; @@ -32,7 +32,6 @@ p->type_in = "NONE"; p->type_out = "FILE"; p->need_query = 1; - p->prio = 3; p->fetch = &_fetch; p->action = &_action; p->cleanup = &_cleanup; @@ -64,13 +63,13 @@ } static int -_action(Evry_Item *it, const char *input) +_action(Evry_Plugin *p, Evry_Item *it, const char *input) { return EVRY_ACTION_OTHER; } static void -_cleanup(void) +_cleanup(Evry_Plugin *p) { Evry_Item *it; @@ -84,7 +83,7 @@ } static int -_fetch(const char *input) +_fetch(Evry_Plugin *p, const char *input) { Eina_List *list; DBusMessage *msg; @@ -95,7 +94,7 @@ char *service = "Files"; char *match; - _cleanup(); + _cleanup(p); match = malloc(sizeof(char) * strlen(input) + 2); sprintf(match, "%s*", input); @@ -120,7 +119,7 @@ } static void -_item_icon_get(Evry_Item *it, Evas *e) +_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e) { char *item_path; @@ -146,7 +145,7 @@ } static void -_item_add(char *file, char *service, char *mime, int prio) +_item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio) { Evry_Item *it; @@ -194,7 +193,7 @@ if (uri && service && mime) { - _item_add(uri, service, mime, 1); + _item_add(p, uri, service, mime, 1); } } |
From: Enlightenment S. <no-...@en...> - 2009-07-07 16:31:17
|
Log: 'everything' module: moved things to e_mod_main.h Author: jeffdameth Date: 2009-07-07 09:31:10 -0700 (Tue, 07 Jul 2009) New Revision: 41266 Removed: trunk/e/src/modules/everything/evry.h Deleted: trunk/e/src/modules/everything/evry.h |
From: Enlightenment S. <no-...@en...> - 2009-07-07 17:37:40
|
Log: 'everything' module: update exehist Author: jeffdameth Date: 2009-07-07 10:37:31 -0700 (Tue, 07 Jul 2009) New Revision: 41267 Modified: trunk/e/src/modules/everything/evry_plug_apps.c Modified: trunk/e/src/modules/everything/evry_plug_apps.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_apps.c 2009-07-07 16:31:10 UTC (rev 41266) +++ trunk/e/src/modules/everything/evry_plug_apps.c 2009-07-07 17:37:31 UTC (rev 41267) @@ -144,8 +144,9 @@ files = eina_list_append(files, inst->candidate->uri); zone = e_util_zone_current_get(e_manager_current_get()); - e_exec(zone, desktop, NULL, files, NULL /*"everything"*/); + e_exec(zone, desktop, NULL, files, "everything"); + if (!it) efreet_desktop_free(desktop); |