2009-05-06 07:20:45 -07:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
/* TODO */
|
2010-05-06 06:09:14 -07:00
|
|
|
/* - mouse handlers
|
2009-08-10 04:36:37 -07:00
|
|
|
* - keybinding configuration
|
|
|
|
*/
|
2010-05-06 06:09:14 -07:00
|
|
|
|
2010-03-15 06:10:43 -07:00
|
|
|
#define INPUTLEN 256
|
2010-05-06 06:09:14 -07:00
|
|
|
#define MATCH_LAG 0.25
|
|
|
|
#define INITIAL_MATCH_LAG 0.3
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2010-04-01 22:31:02 -07:00
|
|
|
/* #undef DBG
|
|
|
|
* #define DBG(...) ERR(__VA_ARGS__) */
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
typedef struct _Evry_Window Evry_Window;
|
|
|
|
typedef struct _Evry_List_Window Evry_List_Window;
|
2009-06-21 03:31:38 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
struct _Evry_Window
|
|
|
|
{
|
|
|
|
E_Popup *popup;
|
|
|
|
Evas_Object *o_main;
|
|
|
|
|
2009-08-12 16:14:05 -07:00
|
|
|
Eina_Bool request_selection;
|
2009-08-18 17:27:41 -07:00
|
|
|
Eina_Bool plugin_dedicated;
|
2009-08-10 04:36:37 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evry_List_Window
|
|
|
|
{
|
|
|
|
E_Popup *popup;
|
|
|
|
Evas_Object *o_main;
|
2009-08-21 15:42:06 -07:00
|
|
|
Eina_Bool visible;
|
2009-08-10 04:36:37 -07:00
|
|
|
};
|
|
|
|
|
2009-08-27 13:52:14 -07:00
|
|
|
static void _evry_matches_update(Evry_Selector *sel, int async);
|
2009-08-10 04:36:37 -07:00
|
|
|
static void _evry_plugin_action(Evry_Selector *sel, int finished);
|
2009-08-21 15:42:06 -07:00
|
|
|
static void _evry_plugin_select(Evry_State *s, Evry_Plugin *p);
|
|
|
|
static void _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p);
|
2010-04-04 07:11:35 -07:00
|
|
|
static int _evry_backspace(Evry_Selector *sel);
|
|
|
|
static void _evry_update(Evry_Selector *sel, int fetch);
|
2009-08-21 15:42:06 -07:00
|
|
|
static void _evry_update_text_label(Evry_State *s);
|
2010-04-04 07:11:35 -07:00
|
|
|
static int _evry_clear(Evry_Selector *sel);
|
|
|
|
static int _evry_cb_update_timer(void *data);
|
2009-08-21 15:42:06 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static Evry_State *_evry_state_new(Evry_Selector *sel, Eina_List *plugins);
|
|
|
|
static void _evry_state_pop(Evry_Selector *sel);
|
|
|
|
|
|
|
|
static Evry_Selector *_evry_selector_new(int type);
|
|
|
|
static void _evry_selector_free(Evry_Selector *sel);
|
|
|
|
static void _evry_selector_activate(Evry_Selector *sel);
|
2010-04-23 15:26:48 -07:00
|
|
|
static void _evry_selectors_switch(int dir);
|
2009-08-10 04:36:37 -07:00
|
|
|
static void _evry_selector_update(Evry_Selector *sel);
|
|
|
|
static void _evry_selector_icon_set(Evry_Selector *sel);
|
2009-08-18 17:27:41 -07:00
|
|
|
static int _evry_selector_subjects_get(const char *plugin_name);
|
2009-08-10 04:36:37 -07:00
|
|
|
static int _evry_selector_actions_get(Evry_Item *it);
|
2009-08-21 15:42:06 -07:00
|
|
|
static int _evry_selector_objects_get(Evry_Action *act);
|
2010-04-25 15:12:54 -07:00
|
|
|
static void _evry_selector_update_actions(Evry_Selector *sel);
|
2010-04-27 20:22:40 -07:00
|
|
|
static Evry_Selector *_evry_selector_for_plugin_get(Evry_Plugin *p);
|
2009-08-21 15:42:06 -07:00
|
|
|
|
|
|
|
static Evry_Window *_evry_window_new(E_Zone *zone);
|
|
|
|
static void _evry_window_free(Evry_Window *win);
|
2009-08-10 04:36:37 -07:00
|
|
|
|
|
|
|
static Evry_List_Window *_evry_list_win_new(E_Zone *zone);
|
|
|
|
static void _evry_list_win_free(Evry_List_Window *win);
|
|
|
|
static void _evry_list_win_show(void);
|
2009-08-21 15:42:06 -07:00
|
|
|
static void _evry_list_win_update(Evry_State *s);
|
2009-08-16 20:30:04 -07:00
|
|
|
static void _evry_list_win_clear(int hide);
|
2009-08-17 16:54:16 -07:00
|
|
|
|
|
|
|
static void _evry_view_clear(Evry_State *s);
|
|
|
|
static void _evry_view_update(Evry_State *s, Evry_Plugin *plugin);
|
|
|
|
static int _evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev);
|
2009-08-21 01:19:30 -07:00
|
|
|
static int _evry_view_toggle(Evry_State *s, const char *trigger);
|
2009-08-20 14:39:01 -07:00
|
|
|
static void _evry_view_show(Evry_View *v);
|
2010-04-17 12:13:01 -07:00
|
|
|
static void _evry_view_hide(Evry_View *v, int slide);
|
2009-08-17 16:54:16 -07:00
|
|
|
|
|
|
|
static void _evry_item_desel(Evry_State *s, Evry_Item *it);
|
|
|
|
static void _evry_item_sel(Evry_State *s, Evry_Item *it);
|
2009-08-10 04:36:37 -07:00
|
|
|
|
2009-08-13 15:42:40 -07:00
|
|
|
static int _evry_cb_key_down(void *data, int type, void *event);
|
|
|
|
static int _evry_cb_selection_notify(void *data, int type, void *event);
|
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
/* local subsystem globals */
|
2009-08-10 04:36:37 -07:00
|
|
|
static Evry_Window *win = NULL;
|
|
|
|
static Evry_List_Window *list = NULL;
|
2009-06-08 09:01:27 -07:00
|
|
|
static Ecore_X_Window input_window = 0;
|
2009-06-24 13:02:37 -07:00
|
|
|
static Eina_List *handlers = NULL;
|
2009-08-27 19:25:13 -07:00
|
|
|
|
2009-08-21 15:42:06 -07:00
|
|
|
static Evry_Selector *selector = NULL;
|
|
|
|
|
2010-04-08 15:37:50 -07:00
|
|
|
Evry_Selector **selectors = NULL;
|
2009-05-06 07:20:45 -07:00
|
|
|
|
|
|
|
/* externally accessible functions */
|
2009-08-13 08:10:54 -07:00
|
|
|
int
|
2009-05-06 07:20:45 -07:00
|
|
|
evry_init(void)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-08-13 08:10:54 -07:00
|
|
|
int
|
2009-05-06 07:20:45 -07:00
|
|
|
evry_shutdown(void)
|
|
|
|
{
|
2010-05-01 12:27:26 -07:00
|
|
|
evry_hide(0);
|
2009-08-21 15:42:06 -07:00
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-04-07 08:03:27 -07:00
|
|
|
static int
|
|
|
|
_evry_cb_item_changed(void *data, int type, void *event)
|
|
|
|
{
|
|
|
|
Evry_Event_Item_Changed *ev = event;
|
|
|
|
Evry_Selector *sel;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
sel = selectors[i];
|
|
|
|
|
|
|
|
if (sel->state && sel->state->cur_item == ev->item)
|
|
|
|
{
|
2010-04-08 16:41:53 -07:00
|
|
|
_evry_selector_update(sel);
|
2010-04-26 11:21:09 -07:00
|
|
|
_evry_selector_update_actions(sel);
|
2010-04-07 08:03:27 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-04-08 16:29:35 -07:00
|
|
|
static Ecore_Timer *_show_timer = NULL;
|
|
|
|
|
|
|
|
static int
|
|
|
|
_cb_show_timer(void *data)
|
|
|
|
{
|
2010-04-08 16:41:53 -07:00
|
|
|
_show_timer = NULL;
|
|
|
|
|
2010-04-08 16:29:35 -07:00
|
|
|
if (evry_conf->views && selector->state)
|
|
|
|
{
|
2010-04-08 16:36:15 -07:00
|
|
|
Evry_View *view =evry_conf->views->data;
|
|
|
|
Evry_State *s = selector->state;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-04-20 11:49:42 -07:00
|
|
|
if (evry_conf->first_run)
|
|
|
|
{
|
2010-04-23 17:54:12 -07:00
|
|
|
_evry_view_toggle(s, "?");
|
2010-04-20 11:49:42 -07:00
|
|
|
evry_conf->first_run = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->view = view->create(view, s, list->o_main);
|
|
|
|
_evry_view_show(s->view);
|
|
|
|
}
|
2010-04-08 16:29:35 -07:00
|
|
|
}
|
2010-04-22 11:15:59 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-08 16:29:35 -07:00
|
|
|
_evry_list_win_show();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-13 08:10:54 -07:00
|
|
|
int
|
2009-08-18 17:27:41 -07:00
|
|
|
evry_show(E_Zone *zone, const char *params)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2010-05-01 12:27:26 -07:00
|
|
|
if (win)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Evry_Plugin *p;
|
|
|
|
|
|
|
|
if (!(params && eina_list_count(selectors[0]->states) == 1))
|
|
|
|
evry_hide(1);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2010-05-01 12:27:26 -07:00
|
|
|
if (selector && params)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(selectors[0]->plugins, l, p)
|
|
|
|
if (!strcmp(params, p->name)) break;
|
|
|
|
|
|
|
|
_evry_plugin_select(selector->state, p);
|
|
|
|
_evry_selector_update(selector);
|
|
|
|
_evry_view_update(selector->state, p);
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
2010-05-03 12:19:42 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
E_OBJECT_CHECK_RETURN(zone, 0);
|
|
|
|
E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-18 07:29:30 -07:00
|
|
|
input_window = ecore_x_window_input_new(zone->container->win,
|
|
|
|
zone->x, zone->y,
|
|
|
|
zone->w, zone->h);
|
2009-08-10 04:36:37 -07:00
|
|
|
ecore_x_window_show(input_window);
|
|
|
|
if (!e_grabinput_get(input_window, 1, input_window))
|
2010-04-08 15:37:50 -07:00
|
|
|
goto error1;
|
2009-08-10 04:36:37 -07:00
|
|
|
|
|
|
|
win = _evry_window_new(zone);
|
2010-04-08 15:37:50 -07:00
|
|
|
if (!win) goto error2;
|
2009-08-10 04:36:37 -07:00
|
|
|
|
|
|
|
list = _evry_list_win_new(zone);
|
2010-04-08 15:37:50 -07:00
|
|
|
if (!list) goto error2;
|
2009-07-07 09:30:11 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
list->visible = EINA_FALSE;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-30 05:01:50 -07:00
|
|
|
evry_history_load();
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-04-25 18:04:43 -07:00
|
|
|
if (params)
|
|
|
|
win->plugin_dedicated = EINA_TRUE;
|
|
|
|
|
2009-08-21 15:42:06 -07:00
|
|
|
selectors = E_NEW(Evry_Selector*, 3);
|
2010-04-27 20:22:40 -07:00
|
|
|
selectors[0] = _evry_selector_new(EVRY_PLUGIN_SUBJECT);
|
|
|
|
selectors[1] = _evry_selector_new(EVRY_PLUGIN_ACTION);
|
|
|
|
selectors[2] = _evry_selector_new(EVRY_PLUGIN_OBJECT);
|
2009-08-10 04:36:37 -07:00
|
|
|
|
|
|
|
handlers = eina_list_append
|
|
|
|
(handlers, ecore_event_handler_add
|
|
|
|
(ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL));
|
2009-08-12 15:34:07 -07:00
|
|
|
handlers = eina_list_append
|
|
|
|
(handlers, ecore_event_handler_add
|
|
|
|
(ECORE_X_EVENT_SELECTION_NOTIFY,
|
|
|
|
_evry_cb_selection_notify, win));
|
2010-04-07 08:03:27 -07:00
|
|
|
handlers = eina_list_append
|
|
|
|
(handlers, ecore_event_handler_add
|
|
|
|
(EVRY_EVENT_ITEM_CHANGED,
|
|
|
|
_evry_cb_item_changed, NULL));
|
2009-08-12 15:34:07 -07:00
|
|
|
|
2009-08-25 17:36:59 -07:00
|
|
|
e_popup_layer_set(list->popup, 255);
|
|
|
|
e_popup_layer_set(win->popup, 255);
|
|
|
|
e_popup_show(win->popup);
|
|
|
|
e_popup_show(list->popup);
|
2009-08-25 20:12:00 -07:00
|
|
|
|
2010-04-08 22:35:07 -07:00
|
|
|
_evry_selector_subjects_get(params);
|
|
|
|
_evry_selector_update(selectors[0]);
|
|
|
|
_evry_selector_activate(selectors[0]);
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-30 01:51:15 -07:00
|
|
|
if (!evry_conf->hide_input)
|
|
|
|
{
|
|
|
|
edje_object_part_text_set(win->o_main, "e.text.label", "Search:");
|
|
|
|
edje_object_part_text_set(list->o_main, "e.text.label", "Search:");
|
2010-04-08 22:35:07 -07:00
|
|
|
edje_object_signal_emit(list->o_main, "e,state,entry_show", "e");
|
2009-08-30 01:51:15 -07:00
|
|
|
}
|
2010-03-28 13:15:27 -07:00
|
|
|
|
|
|
|
if (!evry_conf->hide_list)
|
2010-04-22 11:15:59 -07:00
|
|
|
_show_timer = ecore_timer_add(0.01, _cb_show_timer, NULL);
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
return 1;
|
2009-07-07 09:30:11 -07:00
|
|
|
|
2010-04-08 15:37:50 -07:00
|
|
|
error2:
|
2009-08-10 04:36:37 -07:00
|
|
|
if (win)
|
|
|
|
_evry_window_free(win);
|
|
|
|
if (list)
|
|
|
|
_evry_list_win_free(list);
|
|
|
|
win = NULL;
|
|
|
|
list = NULL;
|
2010-04-08 15:37:50 -07:00
|
|
|
|
|
|
|
error1:
|
2009-08-10 04:36:37 -07:00
|
|
|
ecore_x_window_free(input_window);
|
|
|
|
input_window = 0;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-13 08:10:54 -07:00
|
|
|
void
|
2010-05-01 12:27:26 -07:00
|
|
|
evry_hide(int clear)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2009-12-23 13:46:39 -08:00
|
|
|
Ecore_Event_Handler *ev;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (!win) return;
|
|
|
|
|
2010-05-01 17:58:33 -07:00
|
|
|
if ((clear && selector) &&
|
2010-05-01 18:23:46 -07:00
|
|
|
((eina_list_count(selectors[0]->states) > 1) ||
|
|
|
|
(selectors[0]->state && selectors[0]->state->input[0])))
|
2010-05-01 12:27:26 -07:00
|
|
|
{
|
2010-05-01 17:58:33 -07:00
|
|
|
int slide = 0;
|
|
|
|
if (selector != selectors[0])
|
|
|
|
{
|
|
|
|
if (selector == selectors[1])
|
|
|
|
_evry_selectors_switch(-1);
|
|
|
|
else if (selector == selectors[2])
|
|
|
|
_evry_selectors_switch(1);
|
|
|
|
}
|
2010-05-03 12:19:42 -07:00
|
|
|
|
2010-05-01 12:27:26 -07:00
|
|
|
/* just to be sure */
|
|
|
|
selector = selectors[0];
|
|
|
|
|
|
|
|
while (selector->states->next)
|
2010-05-01 17:58:33 -07:00
|
|
|
{
|
|
|
|
slide = 1;
|
|
|
|
_evry_state_pop(selector);
|
|
|
|
}
|
2010-05-03 12:19:42 -07:00
|
|
|
|
|
|
|
_evry_clear(selector);
|
|
|
|
_evry_clear(selector);
|
2010-05-01 12:27:26 -07:00
|
|
|
Evry_State *s = selector->state;
|
|
|
|
selector->aggregator->fetch(selector->aggregator, s->input);
|
|
|
|
_evry_selector_update(selector);
|
|
|
|
_evry_update_text_label(s);
|
|
|
|
_evry_view_show(s->view);
|
2010-05-01 17:58:33 -07:00
|
|
|
s->view->update(s->view, slide);
|
2010-05-01 12:27:26 -07:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2010-05-03 12:19:42 -07:00
|
|
|
|
2010-04-08 15:37:50 -07:00
|
|
|
/* _evry_view_clear(selector->state); */
|
2010-04-08 16:29:35 -07:00
|
|
|
if (_show_timer)
|
2010-04-08 16:41:53 -07:00
|
|
|
ecore_timer_del(_show_timer);
|
2010-04-08 16:29:35 -07:00
|
|
|
_show_timer = NULL;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-13 15:42:40 -07:00
|
|
|
list->visible = EINA_FALSE;
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_selector_free(selectors[0]);
|
|
|
|
_evry_selector_free(selectors[1]);
|
|
|
|
_evry_selector_free(selectors[2]);
|
2009-08-21 15:42:06 -07:00
|
|
|
E_FREE(selectors);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2010-04-08 15:37:50 -07:00
|
|
|
selectors = NULL;
|
|
|
|
selector = NULL;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_list_win_free(list);
|
|
|
|
list = NULL;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_window_free(win);
|
|
|
|
win = NULL;
|
2009-07-07 09:30:11 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
EINA_LIST_FREE(handlers, ev)
|
|
|
|
ecore_event_handler_del(ev);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
ecore_x_window_free(input_window);
|
|
|
|
e_grabinput_release(input_window, input_window);
|
|
|
|
input_window = 0;
|
2009-08-30 05:01:50 -07:00
|
|
|
|
|
|
|
evry_history_unload();
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2009-08-22 14:22:38 -07:00
|
|
|
EAPI void
|
2010-04-27 20:22:40 -07:00
|
|
|
evry_clear_input(Evry_Plugin *p)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2010-04-27 20:22:40 -07:00
|
|
|
Evry_Selector *sel = _evry_selector_for_plugin_get(p);
|
|
|
|
|
|
|
|
if (sel != selector) return;
|
|
|
|
|
|
|
|
Evry_State *s = sel->state;
|
|
|
|
|
|
|
|
if (!s) return;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2010-04-22 16:03:47 -07:00
|
|
|
if (s->inp[0] != 0)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2010-04-22 16:03:47 -07:00
|
|
|
s->inp[0] = 0;
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
2010-04-22 16:03:47 -07:00
|
|
|
s->input = s->inp;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
|
|
|
_evry_update_text_label(s);
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2010-04-29 09:34:11 -07:00
|
|
|
//#define CHECK_REFS
|
2009-08-13 15:42:40 -07:00
|
|
|
|
2010-03-14 10:53:13 -07:00
|
|
|
#ifdef CHECK_REFS
|
2009-08-27 03:35:32 -07:00
|
|
|
static int item_cnt = 0;
|
|
|
|
#endif
|
2009-08-13 15:42:40 -07:00
|
|
|
|
2009-08-22 14:22:38 -07:00
|
|
|
EAPI Evry_Item *
|
2010-04-27 20:22:40 -07:00
|
|
|
evry_item_new(Evry_Item *base, Evry_Plugin *p, const char *label,
|
|
|
|
Evas_Object *(*icon_get) (Evry_Item *it, Evas *e),
|
|
|
|
void (*cb_free) (Evry_Item *item))
|
2009-06-24 13:02:37 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_Item *it;
|
2009-08-22 20:12:05 -07:00
|
|
|
if (base)
|
|
|
|
{
|
|
|
|
it = base;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
it = E_NEW(Evry_Item, 1);
|
|
|
|
if (!it) return NULL;
|
|
|
|
}
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2010-04-27 20:22:40 -07:00
|
|
|
if (p && EVRY_ITEM(p)->subtype)
|
2010-04-28 09:39:50 -07:00
|
|
|
it->type = EVRY_ITEM(p)->subtype;
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
it->plugin = p;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (label) it->label = eina_stringshare_add(label);
|
2009-08-21 19:11:35 -07:00
|
|
|
it->free = cb_free;
|
2010-04-27 20:22:40 -07:00
|
|
|
it->icon_get = icon_get;
|
2009-08-19 05:07:37 -07:00
|
|
|
|
2009-08-13 15:42:40 -07:00
|
|
|
it->ref = 1;
|
|
|
|
|
2009-08-27 03:35:32 -07:00
|
|
|
#ifdef CHECK_REFS
|
|
|
|
item_cnt++;
|
2010-04-29 09:34:11 -07:00
|
|
|
printf("%d, %d\t new : %s\n", it->ref, item_cnt, it->label);
|
2009-08-27 03:35:32 -07:00
|
|
|
#endif
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
return it;
|
2009-06-24 13:02:37 -07:00
|
|
|
}
|
|
|
|
|
2009-08-22 14:22:38 -07:00
|
|
|
EAPI void
|
2009-08-10 04:36:37 -07:00
|
|
|
evry_item_free(Evry_Item *it)
|
2009-06-24 13:02:37 -07:00
|
|
|
{
|
2009-08-13 15:42:40 -07:00
|
|
|
if (!it) return;
|
|
|
|
|
|
|
|
it->ref--;
|
|
|
|
|
2009-08-27 03:35:32 -07:00
|
|
|
#ifdef CHECK_REFS
|
|
|
|
printf("%d, %d\t free: %s\n", it->ref, item_cnt - 1, it->label);
|
|
|
|
#endif
|
|
|
|
|
2009-08-13 15:42:40 -07:00
|
|
|
if (it->ref > 0) return;
|
|
|
|
|
2009-08-27 03:35:32 -07:00
|
|
|
#ifdef CHECK_REFS
|
|
|
|
item_cnt--;
|
|
|
|
#endif
|
2009-08-13 15:42:40 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (it->label) eina_stringshare_del(it->label);
|
2009-08-30 06:35:06 -07:00
|
|
|
if (it->id) eina_stringshare_del(it->id);
|
2009-09-03 07:21:27 -07:00
|
|
|
if (it->context) eina_stringshare_del(it->context);
|
2010-04-13 15:15:56 -07:00
|
|
|
if (it->detail) eina_stringshare_del(it->detail);
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-22 20:12:05 -07:00
|
|
|
if (it->free)
|
|
|
|
it->free(it);
|
|
|
|
else
|
|
|
|
E_FREE(it);
|
2009-06-24 13:02:37 -07:00
|
|
|
}
|
|
|
|
|
2010-04-01 22:31:02 -07:00
|
|
|
static Evry_Selector *
|
2010-04-17 10:50:27 -07:00
|
|
|
_evry_selector_for_plugin_get(Evry_Plugin *p)
|
2010-04-01 22:31:02 -07:00
|
|
|
{
|
|
|
|
Evry_State *s;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
s = selectors[i]->state;
|
|
|
|
if (s && eina_list_data_find(s->plugins, p))
|
|
|
|
return selectors[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-04-25 15:12:54 -07:00
|
|
|
static int
|
|
|
|
_evry_timer_cb_actions_get(void *data)
|
|
|
|
{
|
|
|
|
Evry_Item *it = data;
|
|
|
|
Evry_Selector *sel = selectors[1];
|
|
|
|
Evry_State *s;
|
|
|
|
|
|
|
|
sel->update_timer = NULL;
|
|
|
|
|
|
|
|
_evry_selector_actions_get(it);
|
|
|
|
_evry_selector_update(sel);
|
|
|
|
|
|
|
|
if (selector == sel && selector->state)
|
|
|
|
{
|
|
|
|
s = sel->state;
|
|
|
|
if (s->view)
|
|
|
|
s->view->update(s->view, 0);
|
|
|
|
else
|
|
|
|
_evry_view_update(s, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_evry_selector_update_actions(Evry_Selector *sel)
|
2010-04-27 20:22:40 -07:00
|
|
|
{
|
2010-04-26 11:21:09 -07:00
|
|
|
Evry_Item *it = sel->state->cur_item;
|
|
|
|
sel = selectors[1];
|
|
|
|
if (sel->update_timer)
|
|
|
|
ecore_timer_del(sel->update_timer);
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2010-04-28 04:28:45 -07:00
|
|
|
/* _evry_timer_cb_actions_get(it); */
|
|
|
|
sel->update_timer = ecore_timer_add(0.1, _evry_timer_cb_actions_get, it);
|
2010-04-25 15:12:54 -07:00
|
|
|
}
|
|
|
|
|
2009-08-22 14:22:38 -07:00
|
|
|
EAPI void
|
2009-08-17 16:54:16 -07:00
|
|
|
evry_item_select(const Evry_State *state, Evry_Item *it)
|
|
|
|
{
|
|
|
|
Evry_State *s = (Evry_State *)state;
|
2010-04-02 09:28:19 -07:00
|
|
|
Evry_Selector *sel = selector;
|
2009-08-17 16:54:16 -07:00
|
|
|
|
2010-04-24 09:18:45 -07:00
|
|
|
if (!s && it)
|
|
|
|
{
|
|
|
|
sel = _evry_selector_for_plugin_get(it->plugin);
|
2010-04-27 20:22:40 -07:00
|
|
|
s = sel->state;
|
2010-04-24 09:18:45 -07:00
|
|
|
}
|
|
|
|
if (!s) return;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
s->plugin_auto_selected = EINA_FALSE;
|
|
|
|
s->item_auto_selected = EINA_FALSE;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_item_sel(s, it);
|
2010-04-07 08:03:27 -07:00
|
|
|
|
|
|
|
if (s == sel->state)
|
2010-04-27 20:22:40 -07:00
|
|
|
{
|
2010-04-25 15:12:54 -07:00
|
|
|
_evry_selector_update(sel);
|
2010-04-26 11:21:09 -07:00
|
|
|
if (selector == selectors[0])
|
|
|
|
_evry_selector_update_actions(sel);
|
2010-04-25 15:12:54 -07:00
|
|
|
}
|
2009-08-17 16:54:16 -07:00
|
|
|
}
|
|
|
|
|
2009-08-28 21:42:17 -07:00
|
|
|
EAPI void
|
|
|
|
evry_item_mark(const Evry_State *state, Evry_Item *it, Eina_Bool mark)
|
|
|
|
{
|
|
|
|
Evry_State *s = (Evry_State *)state;
|
|
|
|
|
2010-04-25 09:26:13 -07:00
|
|
|
if (mark && !it->marked)
|
|
|
|
{
|
|
|
|
it->marked = EINA_TRUE;
|
|
|
|
s->sel_items = eina_list_append(s->sel_items, it);
|
|
|
|
}
|
|
|
|
else if (it->marked)
|
|
|
|
{
|
|
|
|
it->marked = EINA_FALSE;
|
|
|
|
s->sel_items = eina_list_remove(s->sel_items, it);
|
|
|
|
}
|
2009-08-28 21:42:17 -07:00
|
|
|
}
|
|
|
|
|
2009-08-22 14:22:38 -07:00
|
|
|
EAPI void
|
2009-08-17 16:54:16 -07:00
|
|
|
evry_item_ref(Evry_Item *it)
|
2009-08-13 15:42:40 -07:00
|
|
|
{
|
|
|
|
it->ref++;
|
|
|
|
}
|
|
|
|
|
2009-08-22 14:22:38 -07:00
|
|
|
EAPI int
|
2009-08-17 16:54:16 -07:00
|
|
|
evry_list_win_show(void)
|
|
|
|
{
|
|
|
|
if (list->visible) return 0;
|
|
|
|
|
|
|
|
_evry_list_win_show();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-08-22 14:22:38 -07:00
|
|
|
EAPI void
|
2009-08-17 16:54:16 -07:00
|
|
|
evry_list_win_hide(void)
|
|
|
|
{
|
|
|
|
_evry_list_win_clear(1);
|
|
|
|
}
|
|
|
|
|
2009-08-22 14:22:38 -07:00
|
|
|
EAPI void
|
2009-08-14 02:35:51 -07:00
|
|
|
evry_plugin_async_update(Evry_Plugin *p, int action)
|
|
|
|
{
|
|
|
|
Evry_State *s;
|
|
|
|
Evry_Plugin *agg;
|
2010-04-01 22:31:02 -07:00
|
|
|
Evry_Selector *sel;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-14 02:35:51 -07:00
|
|
|
if (!win) return;
|
|
|
|
|
2010-04-01 22:31:02 -07:00
|
|
|
DBG("plugin: %s", p->name);
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2010-04-17 10:50:27 -07:00
|
|
|
sel = _evry_selector_for_plugin_get(p);
|
2010-04-01 22:31:02 -07:00
|
|
|
if (!sel || !sel->state) return;
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2010-04-01 22:31:02 -07:00
|
|
|
s = sel->state;
|
2010-04-30 15:12:02 -07:00
|
|
|
|
|
|
|
DBG("update %d %d %s", s->request, p->request, p->name);
|
|
|
|
|
|
|
|
if (s->request != p->request)
|
|
|
|
return;
|
2010-05-03 12:19:42 -07:00
|
|
|
|
2010-04-01 22:31:02 -07:00
|
|
|
agg = sel->aggregator;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-14 02:35:51 -07:00
|
|
|
if (action == EVRY_ASYNC_UPDATE_ADD)
|
|
|
|
{
|
|
|
|
if (!p->items)
|
|
|
|
{
|
|
|
|
/* remove plugin */
|
|
|
|
if (!eina_list_data_find(s->cur_plugins, p)) return;
|
|
|
|
|
|
|
|
s->cur_plugins = eina_list_remove(s->cur_plugins, p);
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-14 02:35:51 -07:00
|
|
|
if (s->plugin == p)
|
2009-08-20 14:39:01 -07:00
|
|
|
_evry_plugin_select(s, NULL);
|
2009-08-14 02:35:51 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* add plugin to current plugins*/
|
|
|
|
_evry_plugin_list_insert(s, p);
|
|
|
|
|
|
|
|
if (!s->plugin || !eina_list_data_find_list(s->cur_plugins, s->plugin))
|
2009-08-20 14:39:01 -07:00
|
|
|
_evry_plugin_select(s, NULL);
|
2009-08-14 02:35:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* update aggregator */
|
2010-04-01 21:19:38 -07:00
|
|
|
if ((eina_list_count(s->cur_plugins) > 1 ) ||
|
|
|
|
/* add aggregator for actions */
|
2010-04-01 22:31:02 -07:00
|
|
|
(sel == selectors[1] &&
|
2010-04-01 21:19:38 -07:00
|
|
|
(eina_list_count(s->cur_plugins) > 0 )))
|
2009-08-14 02:35:51 -07:00
|
|
|
{
|
|
|
|
/* add aggregator */
|
|
|
|
if (!(s->cur_plugins->data == agg))
|
|
|
|
{
|
|
|
|
s->cur_plugins = eina_list_prepend(s->cur_plugins, agg);
|
|
|
|
|
|
|
|
if (s->plugin_auto_selected)
|
2010-04-11 07:29:23 -07:00
|
|
|
_evry_plugin_select(s, NULL);
|
2009-08-14 02:35:51 -07:00
|
|
|
}
|
2009-08-31 03:30:55 -07:00
|
|
|
agg->fetch(agg, s->input[0] ? s->input : NULL);
|
2009-08-14 02:35:51 -07:00
|
|
|
}
|
2009-08-20 16:43:56 -07:00
|
|
|
else
|
|
|
|
{
|
2009-08-20 17:15:29 -07:00
|
|
|
if (s->cur_plugins && s->cur_plugins->data == agg)
|
2009-08-20 16:43:56 -07:00
|
|
|
{
|
2010-04-27 20:22:40 -07:00
|
|
|
agg->finish(agg);
|
2009-08-20 16:43:56 -07:00
|
|
|
s->cur_plugins = eina_list_remove(s->cur_plugins, agg);
|
|
|
|
}
|
|
|
|
}
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2010-04-25 18:04:43 -07:00
|
|
|
if (s->sel_items)
|
|
|
|
eina_list_free(s->sel_items);
|
|
|
|
s->sel_items = NULL;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2009-08-14 02:35:51 -07:00
|
|
|
/* plugin is visible */
|
|
|
|
if ((s->plugin == p) || (s->plugin == agg))
|
2010-04-01 22:31:02 -07:00
|
|
|
{
|
|
|
|
_evry_selector_update(sel);
|
|
|
|
}
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-20 14:39:01 -07:00
|
|
|
_evry_view_update(s, NULL);
|
2009-08-14 02:35:51 -07:00
|
|
|
}
|
2010-04-01 21:19:38 -07:00
|
|
|
else if (action == EVRY_ASYNC_UPDATE_REFRESH)
|
2010-03-14 10:53:13 -07:00
|
|
|
{
|
2010-04-08 16:41:53 -07:00
|
|
|
_evry_view_clear(s);
|
2010-04-01 21:19:38 -07:00
|
|
|
_evry_view_update(s, NULL);
|
2010-03-14 10:53:13 -07:00
|
|
|
}
|
2009-08-14 02:35:51 -07:00
|
|
|
}
|
|
|
|
|
2009-08-15 11:09:13 -07:00
|
|
|
|
2009-08-14 02:35:51 -07:00
|
|
|
/* local subsystem functions */
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static Evry_List_Window *
|
|
|
|
_evry_list_win_new(E_Zone *zone)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-30 11:34:39 -07:00
|
|
|
int x, y, w, mw, mh;
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_List_Window *list_win;
|
|
|
|
E_Popup *popup;
|
|
|
|
Evas_Object *o;
|
2010-04-16 10:24:35 -07:00
|
|
|
const char *tmp;
|
2010-04-20 14:20:30 -07:00
|
|
|
int offset_x, offset_y, offset_s = 0;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
if (!evry_conf->views) return NULL;
|
2009-08-16 10:12:18 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
popup = e_popup_new(zone, 0, 0, 1, 1);
|
2009-08-10 04:36:37 -07:00
|
|
|
if (!popup) return NULL;
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
list_win = E_NEW(Evry_List_Window, 1);
|
|
|
|
if (!list_win)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
e_object_del(E_OBJECT(popup));
|
|
|
|
return NULL;
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
2009-08-10 04:36:37 -07:00
|
|
|
list_win->popup = popup;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
o = edje_object_add(popup->evas);
|
2009-08-10 04:36:37 -07:00
|
|
|
list_win->o_main = o;
|
2009-05-06 07:20:45 -07:00
|
|
|
e_theme_edje_object_set(o, "base/theme/everything",
|
2009-08-20 14:39:01 -07:00
|
|
|
"e/modules/everything/list");
|
2009-08-28 23:29:24 -07:00
|
|
|
|
2010-04-16 10:24:35 -07:00
|
|
|
tmp = edje_object_data_get(o, "offset_x");
|
|
|
|
offset_x = tmp ? atoi(tmp) : 0;
|
|
|
|
tmp = edje_object_data_get(o, "offset_y");
|
|
|
|
offset_y = tmp ? atoi(tmp) : 0;
|
|
|
|
|
2009-08-28 23:29:24 -07:00
|
|
|
if (e_config->use_composite)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(o, "e,state,composited", "e");
|
|
|
|
edje_object_message_signal_process(o);
|
|
|
|
edje_object_calc_force(o);
|
2010-04-16 10:24:35 -07:00
|
|
|
|
|
|
|
tmp = edje_object_data_get(o, "shadow_offset");
|
|
|
|
offset_s = tmp ? atoi(tmp) : 0;
|
|
|
|
offset_y -= offset_s;
|
2009-08-30 11:34:39 -07:00
|
|
|
}
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-28 22:08:06 -07:00
|
|
|
edje_object_size_min_calc(o, &mw, &mh);
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-16 10:12:18 -07:00
|
|
|
if (mh == 0) mh = 200;
|
|
|
|
if (mw == 0) mw = win->popup->w / 2;
|
|
|
|
|
2009-08-30 11:34:39 -07:00
|
|
|
evry_conf->min_h = mh;
|
2010-04-08 16:41:53 -07:00
|
|
|
if (evry_conf->height > mh)
|
2009-08-30 11:34:39 -07:00
|
|
|
mh = evry_conf->height;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-04-16 10:24:35 -07:00
|
|
|
x = win->popup->x + offset_x;
|
|
|
|
y = (win->popup->y + win->popup->h) + offset_y;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-04-16 10:24:35 -07:00
|
|
|
w = win->popup->w - offset_x*2;
|
|
|
|
mh += offset_s;
|
2009-08-30 11:34:39 -07:00
|
|
|
e_popup_move_resize(popup, x, y, w, mh);
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
o = list_win->o_main;
|
2009-05-06 07:20:45 -07:00
|
|
|
evas_object_move(o, 0, 0);
|
2009-08-10 04:36:37 -07:00
|
|
|
evas_object_resize(o, list_win->popup->w, list_win->popup->h);
|
2009-05-06 07:20:45 -07:00
|
|
|
evas_object_show(o);
|
|
|
|
e_popup_edje_bg_object_set(popup, o);
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
return list_win;
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static void
|
|
|
|
_evry_list_win_free(Evry_List_Window *list_win)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
e_popup_hide(list_win->popup);
|
|
|
|
evas_event_freeze(list_win->popup->evas);
|
|
|
|
evas_object_del(list_win->o_main);
|
|
|
|
e_object_del(E_OBJECT(list_win->popup));
|
|
|
|
|
|
|
|
E_FREE(list_win);
|
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static void
|
|
|
|
_evry_list_win_show(void)
|
|
|
|
{
|
|
|
|
if (list->visible) return;
|
2009-06-21 03:31:38 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
list->visible = EINA_TRUE;
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_list_win_update(selector->state);
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
edje_object_signal_emit(list->o_main, "e,state,list_show", "e");
|
2009-08-25 17:36:59 -07:00
|
|
|
edje_object_signal_emit(list->o_main, "e,state,entry_show", "e");
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static void
|
2009-08-16 20:30:04 -07:00
|
|
|
_evry_list_win_clear(int hide)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
|
|
|
if (!list->visible) return;
|
2009-06-21 03:31:38 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
if (selector->state)
|
|
|
|
_evry_view_clear(selector->state);
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-16 20:30:04 -07:00
|
|
|
if (hide)
|
|
|
|
{
|
|
|
|
list->visible = EINA_FALSE;
|
|
|
|
edje_object_signal_emit(list->o_main, "e,state,list_hide", "e");
|
2009-08-25 17:36:59 -07:00
|
|
|
if (evry_conf->hide_input &&
|
|
|
|
(!selector->state || !selector->state->input ||
|
|
|
|
strlen(selector->state->input) == 0))
|
|
|
|
edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e");
|
2009-08-16 20:30:04 -07:00
|
|
|
}
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
2009-07-29 13:43:09 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static Evry_Window *
|
|
|
|
_evry_window_new(E_Zone *zone)
|
|
|
|
{
|
|
|
|
int x, y, mw, mh;
|
|
|
|
Evry_Window *win;
|
|
|
|
E_Popup *popup;
|
|
|
|
Evas_Object *o;
|
2010-04-16 10:24:35 -07:00
|
|
|
const char *tmp;
|
|
|
|
int offset_s = 0;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-16 10:12:18 -07:00
|
|
|
popup = e_popup_new(zone, 0, 0, 1, 1);
|
2009-08-10 04:36:37 -07:00
|
|
|
if (!popup) return NULL;
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
win = E_NEW(Evry_Window, 1);
|
|
|
|
if (!win)
|
|
|
|
{
|
|
|
|
e_object_del(E_OBJECT(popup));
|
|
|
|
return NULL;
|
|
|
|
}
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
win->popup = popup;
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
o = edje_object_add(popup->evas);
|
|
|
|
win->o_main = o;
|
|
|
|
e_theme_edje_object_set(o, "base/theme/everything",
|
2009-08-20 14:39:01 -07:00
|
|
|
"e/modules/everything/main");
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-28 23:29:24 -07:00
|
|
|
if (e_config->use_composite)
|
|
|
|
{
|
|
|
|
edje_object_signal_emit(o, "e,state,composited", "e");
|
|
|
|
edje_object_message_signal_process(o);
|
|
|
|
edje_object_calc_force(o);
|
2010-04-16 10:24:35 -07:00
|
|
|
|
|
|
|
tmp = edje_object_data_get(o, "shadow_offset");
|
|
|
|
offset_s = tmp ? atoi(tmp) : 0;
|
2009-08-28 23:29:24 -07:00
|
|
|
}
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-28 22:08:06 -07:00
|
|
|
edje_object_size_min_calc(o, &mw, &mh);
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2010-04-08 16:41:53 -07:00
|
|
|
if (evry_conf->width > mw)
|
2009-08-30 11:34:39 -07:00
|
|
|
mw = evry_conf->width;
|
2010-04-17 10:50:27 -07:00
|
|
|
evry_conf->width = mw;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-16 10:24:35 -07:00
|
|
|
mw += offset_s*2;
|
|
|
|
mh += offset_s*2;
|
2009-09-17 23:33:33 -07:00
|
|
|
x = (zone->w * evry_conf->rel_x) - (mw / 2);
|
|
|
|
y = (zone->h * evry_conf->rel_y) - (mh / 2);
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
e_popup_move_resize(popup, x, y, mw, mh);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
o = win->o_main;
|
|
|
|
e_popup_edje_bg_object_set(win->popup, o);
|
|
|
|
evas_object_move(o, 0, 0);
|
|
|
|
evas_object_resize(o, mw, mh);
|
|
|
|
evas_object_show(o);
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
ecore_x_netwm_window_type_set(popup->evas_win, ECORE_X_WINDOW_TYPE_UTILITY);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
return win;
|
2009-06-21 03:31:38 -07:00
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static void
|
|
|
|
_evry_window_free(Evry_Window *win)
|
2009-06-21 03:31:38 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
e_popup_hide(win->popup);
|
|
|
|
evas_event_freeze(win->popup->evas);
|
|
|
|
evas_object_del(win->o_main);
|
2009-08-25 17:36:59 -07:00
|
|
|
/* evas_event_thaw(win->popup->evas); */
|
2009-08-10 04:36:37 -07:00
|
|
|
e_object_del(E_OBJECT(win->popup));
|
|
|
|
E_FREE(win);
|
|
|
|
}
|
2009-08-25 13:52:40 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static Evry_Selector *
|
|
|
|
_evry_selector_new(int type)
|
|
|
|
{
|
2010-04-23 17:21:45 -07:00
|
|
|
Plugin_Config *pc;
|
|
|
|
Eina_List *l, *pcs;
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_Selector *sel = E_NEW(Evry_Selector, 1);
|
|
|
|
Evas_Object *o = edje_object_add(win->popup->evas);
|
|
|
|
sel->o_main = o;
|
|
|
|
e_theme_edje_object_set(o, "base/theme/everything",
|
2009-08-20 14:39:01 -07:00
|
|
|
"e/modules/everything/selector_item");
|
2009-08-10 04:36:37 -07:00
|
|
|
evas_object_show(o);
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2010-04-23 17:21:45 -07:00
|
|
|
sel->aggregator = evry_plug_aggregator_new(sel, type);
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-27 20:22:40 -07:00
|
|
|
if (type == EVRY_PLUGIN_SUBJECT)
|
2009-08-30 01:51:15 -07:00
|
|
|
{
|
|
|
|
sel->history = evry_hist->subjects;
|
2010-04-26 11:21:09 -07:00
|
|
|
sel->actions = evry_plug_actions_new(sel, type);
|
2009-08-30 01:51:15 -07:00
|
|
|
edje_object_part_swallow(win->o_main, "e.swallow.subject_selector", o);
|
2010-04-23 17:21:45 -07:00
|
|
|
pcs = evry_conf->conf_subjects;
|
2009-08-30 01:51:15 -07:00
|
|
|
}
|
2010-04-27 20:22:40 -07:00
|
|
|
else if (type == EVRY_PLUGIN_ACTION)
|
2009-08-30 01:51:15 -07:00
|
|
|
{
|
|
|
|
sel->history = evry_hist->actions;
|
2010-04-26 11:21:09 -07:00
|
|
|
sel->actions = evry_plug_actions_new(sel, type);
|
2009-08-30 01:51:15 -07:00
|
|
|
edje_object_part_swallow(win->o_main, "e.swallow.action_selector", o);
|
2010-04-23 17:21:45 -07:00
|
|
|
pcs = evry_conf->conf_actions;
|
2010-04-08 16:41:53 -07:00
|
|
|
}
|
2010-04-27 20:22:40 -07:00
|
|
|
else if (type == EVRY_PLUGIN_OBJECT)
|
2009-08-30 01:51:15 -07:00
|
|
|
{
|
|
|
|
sel->history = evry_hist->subjects;
|
|
|
|
edje_object_part_swallow(win->o_main, "e.swallow.object_selector", o);
|
2010-04-23 17:21:45 -07:00
|
|
|
pcs = evry_conf->conf_objects;
|
2009-08-30 01:51:15 -07:00
|
|
|
}
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-04-23 17:21:45 -07:00
|
|
|
EINA_LIST_FOREACH(pcs, l, pc)
|
2009-07-10 08:47:19 -07:00
|
|
|
{
|
2010-04-25 18:04:43 -07:00
|
|
|
if (!pc->enabled && !win->plugin_dedicated) continue;
|
2010-04-23 17:21:45 -07:00
|
|
|
if (!pc->plugin) continue;
|
|
|
|
if (pc->plugin == sel->aggregator) continue;
|
|
|
|
sel->plugins = eina_list_append(sel->plugins, pc->plugin);
|
2009-07-10 08:47:19 -07:00
|
|
|
}
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
return sel;
|
2009-07-10 08:47:19 -07:00
|
|
|
}
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static void
|
|
|
|
_evry_selector_free(Evry_Selector *sel)
|
2009-06-21 03:31:38 -07:00
|
|
|
{
|
2009-08-25 22:14:08 -07:00
|
|
|
if (sel->do_thumb)
|
|
|
|
e_thumb_icon_end(sel->o_thumb);
|
|
|
|
if (sel->o_thumb)
|
|
|
|
evas_object_del(sel->o_thumb);
|
2009-08-10 04:36:37 -07:00
|
|
|
if (sel->o_icon)
|
|
|
|
evas_object_del(sel->o_icon);
|
2009-08-25 13:52:40 -07:00
|
|
|
if (sel->o_main)
|
|
|
|
evas_object_del(sel->o_main);
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (list->visible && (sel == selector))
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_view_clear(sel->state);
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-13 15:42:40 -07:00
|
|
|
while (sel->states)
|
|
|
|
_evry_state_pop(sel);
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2010-04-23 17:21:45 -07:00
|
|
|
EVRY_PLUGIN_FREE(sel->aggregator);
|
|
|
|
EVRY_PLUGIN_FREE(sel->actions);
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-12 05:17:43 -07:00
|
|
|
if (sel->plugins) eina_list_free(sel->plugins);
|
2009-08-25 13:52:40 -07:00
|
|
|
|
2010-04-04 07:11:35 -07:00
|
|
|
if (sel->update_timer)
|
|
|
|
ecore_timer_del(sel->update_timer);
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
E_FREE(sel);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_evry_selector_activate(Evry_Selector *sel)
|
|
|
|
{
|
2009-08-17 16:54:16 -07:00
|
|
|
Evry_State *s;
|
2009-08-16 19:06:41 -07:00
|
|
|
|
2009-08-12 13:26:27 -07:00
|
|
|
if (selector)
|
2009-06-21 03:31:38 -07:00
|
|
|
{
|
2009-08-17 16:54:16 -07:00
|
|
|
s = selector->state;
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-12 11:47:46 -07:00
|
|
|
edje_object_signal_emit(selector->o_main, "e,state,unselected", "e");
|
2009-08-10 04:36:37 -07:00
|
|
|
edje_object_part_text_set(selector->o_main, "e.text.plugin", "");
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
if (s && s->view)
|
2009-08-19 05:07:37 -07:00
|
|
|
{
|
2010-04-17 12:13:01 -07:00
|
|
|
/* s->view->clear(s->view, 0); */
|
|
|
|
_evry_view_hide(s->view, 0);
|
2009-08-19 05:07:37 -07:00
|
|
|
}
|
2009-08-17 16:54:16 -07:00
|
|
|
|
2009-08-16 20:30:04 -07:00
|
|
|
_evry_list_win_clear(evry_conf->hide_list);
|
2009-06-24 13:02:37 -07:00
|
|
|
}
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
selector = sel;
|
2009-08-17 16:54:16 -07:00
|
|
|
s = selector->state;
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
edje_object_signal_emit(sel->o_main, "e,state,selected", "e");
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-16 19:06:41 -07:00
|
|
|
if (s)
|
2009-07-04 04:10:28 -07:00
|
|
|
{
|
2009-08-16 19:06:41 -07:00
|
|
|
_evry_update_text_label(s);
|
2009-08-10 04:36:37 -07:00
|
|
|
|
2009-08-28 21:42:17 -07:00
|
|
|
if (sel->state->cur_item)
|
2009-08-10 04:36:37 -07:00
|
|
|
edje_object_part_text_set(sel->o_main, "e.text.plugin",
|
2010-04-27 20:22:40 -07:00
|
|
|
EVRY_ITEM(s->cur_item->plugin)->label);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-20 14:39:01 -07:00
|
|
|
_evry_view_show(s->view);
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_list_win_update(s);
|
2009-06-21 03:31:38 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-25 22:14:08 -07:00
|
|
|
static void
|
|
|
|
_evry_selector_thumb_gen(void *data, Evas_Object *obj, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Coord w, h;
|
|
|
|
Evry_Selector *sel = data;
|
|
|
|
|
|
|
|
if (sel->o_icon)
|
2010-04-22 11:15:59 -07:00
|
|
|
{
|
|
|
|
evas_object_del(sel->o_icon);
|
|
|
|
sel->o_icon = NULL;
|
|
|
|
}
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-25 22:14:08 -07:00
|
|
|
e_icon_size_get(sel->o_thumb, &w, &h);
|
|
|
|
edje_extern_object_aspect_set(sel->o_thumb, EDJE_ASPECT_CONTROL_BOTH, w, h);
|
|
|
|
edje_object_part_swallow(sel->o_main, "e.swallow.thumb", sel->o_thumb);
|
|
|
|
evas_object_show(sel->o_thumb);
|
|
|
|
edje_object_signal_emit(sel->o_main, "e,action,thumb,show", "e");
|
|
|
|
sel->do_thumb = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it)
|
|
|
|
{
|
|
|
|
Evas_Coord w, h;
|
2010-05-03 12:19:42 -07:00
|
|
|
|
2009-08-25 22:14:08 -07:00
|
|
|
if (sel->do_thumb)
|
|
|
|
e_thumb_icon_end(sel->o_thumb);
|
|
|
|
|
|
|
|
if (sel->o_thumb)
|
|
|
|
evas_object_del(sel->o_thumb);
|
|
|
|
sel->o_thumb = NULL;
|
|
|
|
|
2010-04-28 06:54:35 -07:00
|
|
|
if (it->type != EVRY_TYPE_FILE) return 0;
|
2009-08-25 22:14:08 -07:00
|
|
|
|
2010-04-27 20:22:40 -07:00
|
|
|
GET_FILE(file, it);
|
2009-08-25 22:14:08 -07:00
|
|
|
|
2010-04-29 08:20:12 -07:00
|
|
|
if (!file->mime)
|
|
|
|
return 0;
|
2010-05-03 12:19:42 -07:00
|
|
|
|
2010-04-29 08:20:12 -07:00
|
|
|
if (!(evry_file_path_get(file)))
|
|
|
|
return 0;
|
2009-08-25 22:14:08 -07:00
|
|
|
|
|
|
|
if (!strncmp(file->mime, "image/", 6))
|
|
|
|
{
|
|
|
|
sel->o_thumb = e_thumb_icon_add(win->popup->evas);
|
|
|
|
evas_object_smart_callback_add(sel->o_thumb, "e_thumb_gen", _evry_selector_thumb_gen, sel);
|
|
|
|
edje_object_part_geometry_get(sel->o_main, "e.swallow.thumb", NULL, NULL, &w, &h);
|
2010-04-07 08:03:27 -07:00
|
|
|
e_thumb_icon_file_set(sel->o_thumb, file->path, NULL);
|
2009-08-25 22:14:08 -07:00
|
|
|
e_thumb_icon_size_set(sel->o_thumb, w, h);
|
|
|
|
e_thumb_icon_begin(sel->o_thumb);
|
|
|
|
sel->do_thumb = EINA_TRUE;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2009-08-25 13:52:40 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static void
|
|
|
|
_evry_selector_icon_set(Evry_Selector *sel)
|
2009-06-21 03:31:38 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_State *s = sel->state;
|
|
|
|
Evry_Item *it;
|
|
|
|
Evas_Object *o;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (!edje_object_part_exists(sel->o_main, "e.swallow.icons")) return;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (sel->o_icon)
|
2009-06-21 03:31:38 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
evas_object_del(sel->o_icon);
|
|
|
|
sel->o_icon = NULL;
|
|
|
|
}
|
2009-06-24 13:02:37 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (!s) return;
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-28 21:42:17 -07:00
|
|
|
it = s->cur_item;
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2010-04-27 20:22:40 -07:00
|
|
|
if (it)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2009-08-25 22:14:08 -07:00
|
|
|
if (!_evry_selector_thumb(sel, it))
|
2009-06-24 13:02:37 -07:00
|
|
|
{
|
2010-04-27 20:22:40 -07:00
|
|
|
o = evry_util_icon_get(it, win->popup->evas);
|
|
|
|
|
|
|
|
if (!o && it->plugin)
|
|
|
|
o = evry_util_icon_get(EVRY_ITEM(it->plugin), win->popup->evas);
|
|
|
|
|
2009-08-25 13:52:40 -07:00
|
|
|
if (o)
|
|
|
|
{
|
|
|
|
edje_object_part_swallow(sel->o_main, "e.swallow.icons", o);
|
|
|
|
evas_object_show(o);
|
|
|
|
sel->o_icon = o;
|
|
|
|
}
|
2009-06-21 03:31:38 -07:00
|
|
|
}
|
2009-08-25 13:52:40 -07:00
|
|
|
}
|
2009-08-25 22:14:08 -07:00
|
|
|
else if (it)
|
|
|
|
{
|
|
|
|
_evry_selector_thumb(sel, it);
|
|
|
|
}
|
2009-08-22 14:22:38 -07:00
|
|
|
|
2010-04-27 20:22:40 -07:00
|
|
|
if (!sel->o_icon && s->plugin && EVRY_ITEM(s->plugin)->icon)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2010-04-27 20:22:40 -07:00
|
|
|
o = evry_icon_theme_get(EVRY_ITEM(s->plugin)->icon, win->popup->evas);
|
2009-08-18 07:29:30 -07:00
|
|
|
if (o)
|
|
|
|
{
|
|
|
|
edje_object_part_swallow(sel->o_main, "e.swallow.icons", o);
|
|
|
|
evas_object_show(o);
|
|
|
|
sel->o_icon = o;
|
|
|
|
}
|
2009-06-21 03:31:38 -07:00
|
|
|
}
|
2009-06-24 13:02:37 -07:00
|
|
|
}
|
2009-06-21 03:31:38 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static void
|
|
|
|
_evry_selector_update(Evry_Selector *sel)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_State *s = sel->state;
|
2009-08-14 16:30:54 -07:00
|
|
|
Evry_Item *it = NULL;
|
2010-04-25 15:12:54 -07:00
|
|
|
Eina_Bool item_changed = EINA_FALSE;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2009-08-14 16:30:54 -07:00
|
|
|
if (s)
|
|
|
|
{
|
2009-08-28 21:42:17 -07:00
|
|
|
it = s->cur_item;
|
2009-08-11 10:03:36 -07:00
|
|
|
|
2009-08-14 16:30:54 -07:00
|
|
|
if (!s->plugin && it)
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_item_desel(s, NULL);
|
2009-08-14 16:30:54 -07:00
|
|
|
else if (it && !eina_list_data_find_list(s->plugin->items, it))
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_item_desel(s, NULL);
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2009-08-28 21:42:17 -07:00
|
|
|
it = s->cur_item;
|
2009-08-14 16:30:54 -07:00
|
|
|
|
|
|
|
if (s->plugin && (!it || s->item_auto_selected))
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2010-04-07 08:03:27 -07:00
|
|
|
it = NULL;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2009-08-14 16:30:54 -07:00
|
|
|
/* get first item */
|
2010-04-07 08:03:27 -07:00
|
|
|
if (!it && s->plugin->items)
|
2009-08-14 16:30:54 -07:00
|
|
|
{
|
|
|
|
it = s->plugin->items->data;
|
2010-04-07 08:03:27 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (it)
|
|
|
|
{
|
2009-08-14 16:30:54 -07:00
|
|
|
s->item_auto_selected = EINA_TRUE;
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_item_sel(s, it);
|
2009-08-14 16:30:54 -07:00
|
|
|
}
|
2010-04-25 15:12:54 -07:00
|
|
|
item_changed = EINA_TRUE;
|
2009-06-24 13:02:37 -07:00
|
|
|
}
|
|
|
|
}
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_selector_icon_set(sel);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (it)
|
2009-06-24 13:02:37 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
edje_object_part_text_set(sel->o_main, "e.text.label", it->label);
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (sel == selector)
|
2010-04-27 20:22:40 -07:00
|
|
|
edje_object_part_text_set(sel->o_main, "e.text.plugin", EVRY_ITEM(it->plugin)->label);
|
2009-08-10 04:36:37 -07:00
|
|
|
else
|
|
|
|
edje_object_part_text_set(sel->o_main, "e.text.plugin", "");
|
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
else
|
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
/* no items for this state - clear selector */
|
|
|
|
edje_object_part_text_set(sel->o_main, "e.text.label", "");
|
2009-08-12 12:00:25 -07:00
|
|
|
if (sel == selector && s && s->plugin)
|
2010-04-27 20:22:40 -07:00
|
|
|
edje_object_part_text_set(sel->o_main, "e.text.plugin", EVRY_ITEM(s->plugin)->label);
|
2009-08-10 04:36:37 -07:00
|
|
|
else
|
|
|
|
edje_object_part_text_set(sel->o_main, "e.text.plugin", "");
|
|
|
|
}
|
2010-05-03 12:19:42 -07:00
|
|
|
|
2010-05-02 04:31:01 -07:00
|
|
|
if (sel == selectors[0])
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2010-05-03 12:19:42 -07:00
|
|
|
if (item_changed)
|
2010-05-02 04:31:01 -07:00
|
|
|
{
|
|
|
|
_evry_selector_update_actions(sel);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sel = selectors[1];
|
|
|
|
if (sel->update_timer)
|
|
|
|
ecore_timer_del(sel->update_timer);
|
2010-05-03 12:19:42 -07:00
|
|
|
sel->update_timer = NULL;
|
2010-05-02 04:31:01 -07:00
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static void
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_list_win_update(Evry_State *s)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-17 16:54:16 -07:00
|
|
|
if (s != selector->state) return;
|
2009-08-10 04:36:37 -07:00
|
|
|
if (!list->visible) return;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2010-04-17 05:40:28 -07:00
|
|
|
if (s->changed)
|
|
|
|
_evry_view_update(s, s->plugin);
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static int
|
2009-08-18 17:27:41 -07:00
|
|
|
_evry_selector_subjects_get(const char *plugin_name)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
|
|
|
Eina_List *l, *plugins = NULL;
|
2010-05-01 12:27:26 -07:00
|
|
|
Evry_Plugin *p, *pp;
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_Selector *sel = selectors[0];
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2010-05-01 12:27:26 -07:00
|
|
|
EINA_LIST_FOREACH(sel->plugins, l, p)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2010-05-01 12:27:26 -07:00
|
|
|
if (plugin_name && strcmp(plugin_name, p->name))
|
2009-08-18 17:27:41 -07:00
|
|
|
continue;
|
|
|
|
|
2010-05-06 06:09:14 -07:00
|
|
|
/* if (!p->config->top_level)
|
|
|
|
* continue; */
|
|
|
|
|
2010-05-01 12:27:26 -07:00
|
|
|
if (p->begin)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2010-05-01 12:27:26 -07:00
|
|
|
if ((pp = p->begin(p, NULL)))
|
|
|
|
plugins = eina_list_append(plugins, pp);
|
2009-07-04 04:10:28 -07:00
|
|
|
}
|
2009-08-10 04:36:37 -07:00
|
|
|
else
|
2010-05-01 12:27:26 -07:00
|
|
|
plugins = eina_list_append(plugins, p);
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (!plugins) return 0;
|
|
|
|
|
|
|
|
_evry_state_new(sel, plugins);
|
2009-08-27 13:52:14 -07:00
|
|
|
_evry_matches_update(sel, 1);
|
2009-08-10 04:36:37 -07:00
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_selector_actions_get(Evry_Item *it)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
Eina_List *l, *plugins = NULL;
|
2010-04-27 20:22:40 -07:00
|
|
|
Evry_Plugin *p, *pp;
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_Selector *sel = selectors[1];
|
2009-08-25 20:12:00 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
while (sel->state)
|
|
|
|
_evry_state_pop(sel);
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-14 02:35:51 -07:00
|
|
|
if (!it) return 0;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2010-04-27 20:22:40 -07:00
|
|
|
EINA_LIST_FOREACH(sel->plugins, l, p)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2010-05-06 06:09:14 -07:00
|
|
|
/* if (!p->config->top_level)
|
|
|
|
* continue; */
|
|
|
|
|
2010-04-27 20:22:40 -07:00
|
|
|
if (p->begin)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2010-04-27 20:22:40 -07:00
|
|
|
if ((pp = p->begin(p, it)))
|
|
|
|
plugins = eina_list_append(plugins, pp);
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
if (!plugins) return 0;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_state_new(sel, plugins);
|
2009-08-27 13:52:14 -07:00
|
|
|
_evry_matches_update(sel, 1);
|
2009-08-10 04:36:37 -07:00
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-08-25 12:18:58 -07:00
|
|
|
/* find plugins that provide the second item required for an action */
|
2009-07-04 04:10:28 -07:00
|
|
|
static int
|
2009-08-21 15:42:06 -07:00
|
|
|
_evry_selector_objects_get(Evry_Action *act)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
Eina_List *l, *plugins = NULL;
|
2010-04-27 20:22:40 -07:00
|
|
|
Evry_Plugin *p, *pp;
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_Selector *sel = selectors[2];
|
|
|
|
Evry_Item *it;
|
2009-08-25 13:52:40 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
while (sel->state)
|
|
|
|
_evry_state_pop(sel);
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2010-04-29 08:20:12 -07:00
|
|
|
it = selectors[1]->state->cur_item;
|
2009-08-25 13:52:40 -07:00
|
|
|
|
2010-04-27 20:22:40 -07:00
|
|
|
EINA_LIST_FOREACH(sel->plugins, l, p)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2010-04-29 08:20:12 -07:00
|
|
|
DBG("p %s %d %d\n", p->name, EVRY_ITEM(p)->subtype, act->it2.type);
|
|
|
|
|
2010-05-06 06:09:14 -07:00
|
|
|
/* if (!p->config->top_level)
|
|
|
|
* continue; */
|
|
|
|
|
2010-04-28 09:39:50 -07:00
|
|
|
if (!CHECK_SUBTYPE(p, act->it2.type))
|
2009-08-25 12:18:58 -07:00
|
|
|
continue;
|
2009-08-25 13:52:40 -07:00
|
|
|
|
2010-04-27 20:22:40 -07:00
|
|
|
if (p->begin)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2010-04-29 08:20:12 -07:00
|
|
|
if ((pp = p->begin(p, it)))
|
2010-04-27 20:22:40 -07:00
|
|
|
plugins = eina_list_append(plugins, pp);
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
|
|
|
else
|
2010-04-27 20:22:40 -07:00
|
|
|
{
|
2010-05-02 04:31:01 -07:00
|
|
|
plugins = eina_list_append(plugins, p);
|
2010-04-27 20:22:40 -07:00
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-11 10:03:36 -07:00
|
|
|
if (!plugins) return 0;
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_state_new(sel, plugins);
|
2009-08-27 13:52:14 -07:00
|
|
|
_evry_matches_update(sel, 1);
|
2009-05-06 07:20:45 -07:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static Evry_State *
|
|
|
|
_evry_state_new(Evry_Selector *sel, Eina_List *plugins)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_State *s = E_NEW(Evry_State, 1);
|
2010-04-22 16:03:47 -07:00
|
|
|
s->inp = malloc(INPUTLEN);
|
|
|
|
s->inp[0] = 0;
|
|
|
|
s->input = s->inp;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
s->plugins = plugins;
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
sel->states = eina_list_prepend(sel->states, s);
|
|
|
|
sel->state = s;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
return s;
|
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static void
|
|
|
|
_evry_state_pop(Evry_Selector *sel)
|
|
|
|
{
|
|
|
|
Evry_Plugin *p;
|
2009-08-13 15:42:40 -07:00
|
|
|
Evry_State *s;
|
2010-05-06 06:09:14 -07:00
|
|
|
Evry_State *prev = NULL;
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-13 15:42:40 -07:00
|
|
|
s = sel->state;
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_item_desel(s, NULL);
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2010-04-22 16:03:47 -07:00
|
|
|
free(s->inp);
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
if (s->view)
|
2009-08-19 05:07:37 -07:00
|
|
|
s->view->destroy(s->view);
|
2009-08-16 19:06:41 -07:00
|
|
|
|
2010-05-06 06:09:14 -07:00
|
|
|
sel->states = eina_list_remove_list(sel->states, sel->states);
|
|
|
|
|
|
|
|
if (sel->states)
|
|
|
|
prev = sel->states->data;
|
|
|
|
|
2009-08-27 03:35:32 -07:00
|
|
|
EINA_LIST_FREE(s->plugins, p)
|
2010-05-06 06:09:14 -07:00
|
|
|
{
|
|
|
|
/* XXX skip non top-level plugins */
|
|
|
|
if (prev && eina_list_data_find(prev->plugins, p))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
p->finish(p);
|
|
|
|
}
|
|
|
|
|
2010-04-25 09:26:13 -07:00
|
|
|
if (s->sel_items)
|
|
|
|
eina_list_free(s->sel_items);
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2009-08-13 15:42:40 -07:00
|
|
|
E_FREE(s);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2010-05-06 06:09:14 -07:00
|
|
|
sel->state = prev;
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
|
|
|
|
2009-08-31 06:04:53 -07:00
|
|
|
int
|
|
|
|
evry_browse_item(Evry_Selector *sel)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2009-08-31 06:04:53 -07:00
|
|
|
if (!sel) sel = selector;
|
2010-05-06 06:09:14 -07:00
|
|
|
Evry_State *s, *new_state;
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_Item *it;
|
|
|
|
Eina_List *l, *plugins = NULL;
|
2010-04-27 20:22:40 -07:00
|
|
|
Evry_Plugin *p, *pp;
|
2009-08-24 21:23:11 -07:00
|
|
|
Evry_View *view = NULL;
|
2010-05-06 06:09:14 -07:00
|
|
|
int browse_aggregator = 0;
|
|
|
|
|
|
|
|
if (!(s = sel->state))
|
2009-08-31 06:04:53 -07:00
|
|
|
return 0;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-28 21:42:17 -07:00
|
|
|
it = s->cur_item;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-18 07:29:30 -07:00
|
|
|
if (!it || !it->browseable)
|
2009-08-24 21:23:11 -07:00
|
|
|
return 0;
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2010-05-03 12:19:42 -07:00
|
|
|
EINA_LIST_FOREACH(sel->plugins, l, p)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2010-05-03 12:19:42 -07:00
|
|
|
if (p == it->plugin)
|
|
|
|
continue;
|
2009-08-12 05:17:43 -07:00
|
|
|
|
2010-05-03 12:19:42 -07:00
|
|
|
if (!p->browse)
|
|
|
|
continue;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2010-05-03 12:19:42 -07:00
|
|
|
if ((pp = p->browse(p, it)))
|
|
|
|
plugins = eina_list_append(plugins, pp);
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2010-05-03 12:19:42 -07:00
|
|
|
/* FIXME this is a special case for actions */
|
|
|
|
if ((!plugins && it->plugin->browse) &&
|
|
|
|
(pp = it->plugin->browse(it->plugin, it)))
|
|
|
|
plugins = eina_list_append(plugins, pp);
|
|
|
|
|
2010-05-06 06:09:14 -07:00
|
|
|
if (!plugins && CHECK_TYPE(it, EVRY_TYPE_PLUGIN))
|
|
|
|
{
|
|
|
|
browse_aggregator = 1;
|
|
|
|
plugins = eina_list_append(plugins, it);
|
|
|
|
}
|
|
|
|
|
2009-08-31 06:04:53 -07:00
|
|
|
if (!plugins)
|
2010-04-27 20:22:40 -07:00
|
|
|
return 0;
|
2009-08-24 21:23:11 -07:00
|
|
|
|
2010-05-06 06:09:14 -07:00
|
|
|
if (!(new_state = _evry_state_new(sel, plugins)))
|
|
|
|
return 0;
|
|
|
|
|
2009-08-24 21:23:11 -07:00
|
|
|
if (s->view)
|
|
|
|
{
|
2010-04-17 12:13:01 -07:00
|
|
|
_evry_view_hide(s->view, 1);
|
2009-08-27 13:52:14 -07:00
|
|
|
view = s->view;
|
2009-08-24 21:23:11 -07:00
|
|
|
}
|
2009-08-25 13:52:40 -07:00
|
|
|
|
2010-05-06 06:09:14 -07:00
|
|
|
if (browse_aggregator)
|
|
|
|
{
|
|
|
|
evry_history_add(sel->history, s->cur_item, NULL, NULL);
|
|
|
|
snprintf(sel->state->input, INPUTLEN, "%s", s->input);
|
|
|
|
|
|
|
|
s = new_state;
|
|
|
|
/* if (sel->aggregator->fetch(sel->aggregator, input))
|
|
|
|
* _evry_plugin_list_insert(s, sel->aggregator); */
|
|
|
|
s->cur_plugins = eina_list_append(s->cur_plugins, it);
|
|
|
|
_evry_plugin_select(s, EVRY_PLUGIN(it));
|
|
|
|
}
|
|
|
|
else if (it->plugin->history)
|
|
|
|
{
|
|
|
|
evry_history_add(sel->history, s->cur_item, NULL, s->input);
|
|
|
|
_evry_matches_update(sel, 1);
|
|
|
|
s = new_state;
|
|
|
|
}
|
|
|
|
|
2009-08-19 05:07:37 -07:00
|
|
|
_evry_selector_update(sel);
|
2009-08-24 21:23:11 -07:00
|
|
|
|
2010-05-06 06:09:14 -07:00
|
|
|
|
|
|
|
if (view && list->visible)
|
2009-08-24 21:23:11 -07:00
|
|
|
{
|
|
|
|
s->view = view->create(view, s, list->o_main);
|
|
|
|
if (s->view)
|
|
|
|
{
|
|
|
|
_evry_view_show(s->view);
|
2010-04-17 10:50:27 -07:00
|
|
|
s->view->update(s->view, -1);
|
2009-08-24 21:23:11 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_update_text_label(sel->state);
|
2009-08-24 21:23:11 -07:00
|
|
|
|
|
|
|
return 1;
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
|
|
|
|
2010-04-23 15:26:48 -07:00
|
|
|
EAPI int
|
2009-08-31 06:04:53 -07:00
|
|
|
evry_browse_back(Evry_Selector *sel)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
|
|
|
Evry_State *s = sel->state;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-18 07:29:30 -07:00
|
|
|
if (!s || !sel->states->next)
|
2010-04-23 15:26:48 -07:00
|
|
|
return 0;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_state_pop(sel);
|
2009-08-13 15:42:40 -07:00
|
|
|
|
2009-08-19 05:07:37 -07:00
|
|
|
s = sel->state;
|
|
|
|
sel->aggregator->fetch(sel->aggregator, s->input);
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_selector_update(sel);
|
2009-08-19 05:07:37 -07:00
|
|
|
_evry_update_text_label(s);
|
2009-08-21 15:42:06 -07:00
|
|
|
_evry_view_show(s->view);
|
2010-04-17 10:50:27 -07:00
|
|
|
s->view->update(s->view, 1);
|
2010-04-23 15:26:48 -07:00
|
|
|
|
|
|
|
return 1;
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2009-07-04 04:10:28 -07:00
|
|
|
static void
|
2010-04-23 15:26:48 -07:00
|
|
|
_evry_selectors_switch(int dir)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_State *s = selector->state;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2010-04-08 16:41:53 -07:00
|
|
|
if (_show_timer)
|
|
|
|
_cb_show_timer(NULL);
|
|
|
|
|
2010-04-04 07:11:35 -07:00
|
|
|
if (selector->update_timer)
|
2009-08-12 13:26:27 -07:00
|
|
|
{
|
2009-08-27 13:52:14 -07:00
|
|
|
if ((selector == selectors[0]) ||
|
|
|
|
(selector == selectors[1]))
|
2009-08-12 13:26:27 -07:00
|
|
|
{
|
2009-08-27 13:52:14 -07:00
|
|
|
_evry_matches_update(selector, 0);
|
2009-08-12 13:26:27 -07:00
|
|
|
_evry_selector_update(selector);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-23 15:26:48 -07:00
|
|
|
if (selector == selectors[0] && dir > 0)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2009-08-28 21:42:17 -07:00
|
|
|
if (s->cur_item)
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_selector_activate(selectors[1]);
|
|
|
|
}
|
2010-04-23 15:26:48 -07:00
|
|
|
else if (selector == selectors[1] && dir > 0)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
|
|
|
int next_selector = 0;
|
2010-04-26 11:21:09 -07:00
|
|
|
Evry_Item *it;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2010-04-26 11:21:09 -07:00
|
|
|
if ((it = s->cur_item) &&
|
|
|
|
(it->plugin == selector->actions))
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2010-04-27 20:22:40 -07:00
|
|
|
GET_ACTION(act,it);
|
2010-04-28 06:54:35 -07:00
|
|
|
if (act->it2.type)
|
2010-04-26 11:21:09 -07:00
|
|
|
{
|
|
|
|
_evry_selector_objects_get(act);
|
|
|
|
_evry_selector_update(selectors[2]);
|
|
|
|
edje_object_signal_emit(win->o_main, "e,state,object_selector_show", "e");
|
|
|
|
next_selector = 2;
|
|
|
|
}
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
|
|
|
_evry_selector_activate(selectors[next_selector]);
|
|
|
|
}
|
2010-04-23 15:26:48 -07:00
|
|
|
else if (selector == selectors[1] && dir < 0)
|
|
|
|
{
|
|
|
|
_evry_selector_activate(selectors[0]);
|
2010-04-23 17:21:45 -07:00
|
|
|
edje_object_signal_emit(win->o_main, "e,state,object_selector_hide", "e");
|
2010-04-23 15:26:48 -07:00
|
|
|
}
|
|
|
|
else if (selector == selectors[2] && dir > 0)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
|
|
|
while (selector->states)
|
|
|
|
_evry_state_pop(selector);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2010-04-23 17:21:45 -07:00
|
|
|
edje_object_signal_emit(win->o_main, "e,state,object_selector_hide", "e");
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_selector_activate(selectors[0]);
|
|
|
|
}
|
2010-04-23 15:26:48 -07:00
|
|
|
else if (selector == selectors[2] && dir < 0)
|
|
|
|
{
|
|
|
|
_evry_selector_activate(selectors[1]);
|
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2009-08-21 01:19:30 -07:00
|
|
|
static int
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2010-04-20 08:22:01 -07:00
|
|
|
Ecore_Event_Key *ev = event;
|
|
|
|
Evry_State *s;
|
2009-08-17 16:54:16 -07:00
|
|
|
const char *key = NULL, *old;
|
|
|
|
|
2010-04-20 08:22:01 -07:00
|
|
|
if (ev->event_window != input_window)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (!strcmp(ev->key, "Escape"))
|
|
|
|
{
|
2010-05-01 12:27:26 -07:00
|
|
|
evry_hide(0);
|
2010-04-20 08:22:01 -07:00
|
|
|
return 1;
|
|
|
|
}
|
2010-05-01 12:27:26 -07:00
|
|
|
else if (ev->modifiers)
|
|
|
|
{
|
|
|
|
E_Action *act;
|
|
|
|
Eina_List *l;
|
|
|
|
E_Config_Binding_Key *bind;
|
|
|
|
E_Binding_Modifier mod;
|
|
|
|
|
|
|
|
for (l = e_config->key_bindings; l; l = l->next)
|
|
|
|
{
|
|
|
|
bind = l->data;
|
|
|
|
|
|
|
|
if (bind->action && strcmp(bind->action, "everything")) continue;
|
|
|
|
|
|
|
|
mod = 0;
|
|
|
|
|
2010-05-03 12:19:42 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
2010-05-01 12:27:26 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_SHIFT;
|
2010-05-03 12:19:42 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
|
2010-05-01 12:27:26 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_CTRL;
|
2010-05-03 12:19:42 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT)
|
2010-05-01 12:27:26 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_ALT;
|
2010-05-03 12:19:42 -07:00
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN)
|
2010-05-01 12:27:26 -07:00
|
|
|
mod |= E_BINDING_MODIFIER_WIN;
|
|
|
|
|
|
|
|
if (bind->key && (!strcmp(bind->key, ev->keyname)) &&
|
2010-05-03 12:19:42 -07:00
|
|
|
((bind->modifiers == mod) || (bind->any_mod)))
|
2010-05-01 12:27:26 -07:00
|
|
|
{
|
|
|
|
if (!(act = e_action_find(bind->action))) continue;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-05-01 12:27:26 -07:00
|
|
|
if (act->func.go)
|
|
|
|
act->func.go(E_OBJECT(win->popup->zone), bind->params);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-05-03 12:19:42 -07:00
|
|
|
|
2010-04-20 08:22:01 -07:00
|
|
|
if (!selector || !selector->state)
|
|
|
|
return 1;
|
2009-08-12 16:14:05 -07:00
|
|
|
|
2010-04-20 08:22:01 -07:00
|
|
|
win->request_selection = EINA_FALSE;
|
2010-05-01 12:27:26 -07:00
|
|
|
s = selector->state;
|
2009-08-17 16:54:16 -07:00
|
|
|
old = ev->key;
|
|
|
|
|
2010-05-01 12:27:26 -07:00
|
|
|
if (!strcmp(ev->key, "KP_Enter"))
|
|
|
|
{
|
|
|
|
key = eina_stringshare_add("Return");
|
|
|
|
}
|
|
|
|
else if (((evry_conf->quick_nav == 1) && (ev->modifiers & ECORE_EVENT_MODIFIER_ALT)) ||
|
2010-04-10 16:44:11 -07:00
|
|
|
((evry_conf->quick_nav == 2) && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)))
|
2009-08-17 16:54:16 -07:00
|
|
|
{
|
|
|
|
if (!strcmp(ev->key, "k") || (!strcmp(ev->key, "K")))
|
|
|
|
key = eina_stringshare_add("Up");
|
|
|
|
else if (!strcmp(ev->key, "j") || (!strcmp(ev->key, "J")))
|
|
|
|
key = eina_stringshare_add("Down");
|
|
|
|
else if (!strcmp(ev->key, "n") || (!strcmp(ev->key, "N")))
|
|
|
|
key = eina_stringshare_add("Next");
|
|
|
|
else if (!strcmp(ev->key, "p") || (!strcmp(ev->key, "P")))
|
|
|
|
key = eina_stringshare_add("Prior");
|
|
|
|
else if (!strcmp(ev->key, "l") || (!strcmp(ev->key, "L")))
|
|
|
|
key = eina_stringshare_add("Right");
|
|
|
|
else if (!strcmp(ev->key, "h") || (!strcmp(ev->key, "H")))
|
|
|
|
key = eina_stringshare_add("Left");
|
|
|
|
else if (!strcmp(ev->key, "i") || (!strcmp(ev->key, "I")))
|
|
|
|
key = eina_stringshare_add("Tab");
|
|
|
|
else if (!strcmp(ev->key, "m") || (!strcmp(ev->key, "M")))
|
|
|
|
key = eina_stringshare_add("Return");
|
|
|
|
else
|
|
|
|
key = eina_stringshare_add(ev->key);
|
2009-08-16 02:43:38 -07:00
|
|
|
|
2010-04-10 16:44:11 -07:00
|
|
|
ev->key = key;
|
|
|
|
}
|
|
|
|
else if (((evry_conf->quick_nav == 3) && (ev->modifiers & ECORE_EVENT_MODIFIER_ALT)) ||
|
|
|
|
((evry_conf->quick_nav == 4) && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)))
|
|
|
|
{
|
|
|
|
if (!strcmp(ev->key, "p") || (!strcmp(ev->key, "P")))
|
|
|
|
key = eina_stringshare_add("Up");
|
|
|
|
else if (!strcmp(ev->key, "n") || (!strcmp(ev->key, "N")))
|
|
|
|
key = eina_stringshare_add("Down");
|
|
|
|
else if (!strcmp(ev->key, "f") || (!strcmp(ev->key, "F")))
|
|
|
|
key = eina_stringshare_add("Right");
|
|
|
|
else if (!strcmp(ev->key, "b") || (!strcmp(ev->key, "B")))
|
|
|
|
key = eina_stringshare_add("Left");
|
|
|
|
else if (!strcmp(ev->key, "i") || (!strcmp(ev->key, "I")))
|
|
|
|
key = eina_stringshare_add("Tab");
|
|
|
|
else if (!strcmp(ev->key, "m") || (!strcmp(ev->key, "M")))
|
|
|
|
key = eina_stringshare_add("Return");
|
|
|
|
else
|
|
|
|
key = eina_stringshare_add(ev->key);
|
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
ev->key = key;
|
|
|
|
}
|
|
|
|
else
|
2009-08-16 02:43:38 -07:00
|
|
|
{
|
2009-08-17 16:54:16 -07:00
|
|
|
key = eina_stringshare_add(ev->key);
|
|
|
|
ev->key = key;
|
2009-08-16 02:43:38 -07:00
|
|
|
}
|
2009-08-17 16:54:16 -07:00
|
|
|
|
|
|
|
if (!list->visible && (!strcmp(key, "Down")))
|
2009-08-20 14:39:01 -07:00
|
|
|
_evry_list_win_show();
|
2010-04-15 06:58:44 -07:00
|
|
|
else if ((!strcmp(key, "ISO_Left_Tab") ||
|
|
|
|
(((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) ||
|
|
|
|
(ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) &&
|
|
|
|
(!strcmp(key, "Tab")))))
|
|
|
|
{
|
2010-04-15 08:46:12 -07:00
|
|
|
int action = 0;
|
|
|
|
char *input = NULL;
|
|
|
|
Evry_Item *it = s->cur_item;
|
|
|
|
|
|
|
|
evry_item_ref(it);
|
2010-04-15 08:57:28 -07:00
|
|
|
|
|
|
|
s->item_auto_selected = EINA_FALSE;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-15 08:46:12 -07:00
|
|
|
if (it->plugin->complete)
|
|
|
|
action = it->plugin->complete(it->plugin, it, &input);
|
|
|
|
else
|
|
|
|
evry_browse_item(selector);
|
|
|
|
|
2010-04-24 05:39:20 -07:00
|
|
|
if (input && action == EVRY_COMPLETE_INPUT)
|
2010-04-15 08:46:12 -07:00
|
|
|
{
|
2010-04-24 05:39:20 -07:00
|
|
|
snprintf(s->input, INPUTLEN - 1, "%s", input);
|
2010-04-15 14:42:30 -07:00
|
|
|
_evry_update_text_label(s);
|
2010-04-15 08:46:12 -07:00
|
|
|
_evry_cb_update_timer(selector);
|
|
|
|
evry_item_select(s, it);
|
|
|
|
}
|
2010-04-15 06:58:44 -07:00
|
|
|
|
2010-04-15 08:46:12 -07:00
|
|
|
E_FREE(input);
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-15 08:46:12 -07:00
|
|
|
evry_item_free(it);
|
2010-04-15 06:58:44 -07:00
|
|
|
}
|
2010-04-12 13:52:23 -07:00
|
|
|
else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
|
|
|
|
(!strcmp(key, "Delete") || !strcmp(key, "Insert")))
|
|
|
|
{
|
|
|
|
if (!s || !s->cur_item)
|
|
|
|
goto end;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-12 13:52:23 -07:00
|
|
|
int delete = (!strcmp(key, "Delete") && (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT));
|
|
|
|
int promote = (!strcmp(key, "Insert"));
|
|
|
|
History_Entry *he;
|
|
|
|
History_Item *hi;
|
|
|
|
Eina_List *l, *ll;
|
|
|
|
Evry_Item *it = s->cur_item;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-12 13:52:23 -07:00
|
|
|
if (!(he = eina_hash_find
|
|
|
|
(selector->history, (it->id ? it->id : it->label))))
|
|
|
|
goto end;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-12 13:52:23 -07:00
|
|
|
EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi)
|
|
|
|
{
|
|
|
|
if (hi->plugin != it->plugin->name)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (delete)
|
|
|
|
{
|
|
|
|
if (hi->input)
|
|
|
|
eina_stringshare_del(hi->input);
|
|
|
|
if (hi->plugin)
|
|
|
|
eina_stringshare_del(hi->plugin);
|
|
|
|
if (hi->context)
|
|
|
|
eina_stringshare_del(hi->context);
|
|
|
|
E_FREE(hi);
|
|
|
|
|
|
|
|
he->items = eina_list_remove_list(he->items, l);
|
|
|
|
}
|
|
|
|
else if (promote)
|
|
|
|
{
|
|
|
|
hi->count += 5;
|
2010-04-15 06:58:44 -07:00
|
|
|
hi->last_used = ecore_time_get();
|
2010-04-12 13:52:23 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hi->count -= 5;
|
|
|
|
if (hi->count < 0) hi->count = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (s->plugin == selector->aggregator)
|
|
|
|
selector->aggregator->fetch(selector->aggregator, s->input);
|
|
|
|
if (s->view)
|
2010-04-17 10:50:27 -07:00
|
|
|
s->view->update(s->view, 0);
|
2010-04-12 13:52:23 -07:00
|
|
|
}
|
2009-08-16 02:43:38 -07:00
|
|
|
else if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
|
|
|
|
{
|
2009-08-17 16:54:16 -07:00
|
|
|
if (!strcmp(key, "u"))
|
2009-08-16 02:43:38 -07:00
|
|
|
{
|
2010-04-04 07:11:35 -07:00
|
|
|
if (!_evry_clear(selector))
|
2009-08-31 06:04:53 -07:00
|
|
|
evry_browse_back(selector);
|
2009-08-16 02:43:38 -07:00
|
|
|
}
|
2009-08-17 18:00:18 -07:00
|
|
|
else if (!strcmp(key, "1"))
|
2009-08-21 01:19:30 -07:00
|
|
|
_evry_view_toggle(s, NULL);
|
2009-08-17 16:54:16 -07:00
|
|
|
else if (!strcmp(key, "Return"))
|
2009-08-16 02:43:38 -07:00
|
|
|
_evry_plugin_action(selector, 0);
|
2009-08-17 16:54:16 -07:00
|
|
|
else if (!strcmp(key, "v"))
|
2009-08-16 02:43:38 -07:00
|
|
|
{
|
|
|
|
win->request_selection = EINA_TRUE;
|
|
|
|
ecore_x_selection_primary_request
|
|
|
|
(win->popup->evas_win, ECORE_X_SELECTION_TARGET_UTF8_STRING);
|
|
|
|
}
|
2009-08-20 14:39:01 -07:00
|
|
|
else if (_evry_view_key_press(s, ev))
|
|
|
|
goto end;
|
2009-08-16 02:43:38 -07:00
|
|
|
}
|
2010-04-07 08:03:27 -07:00
|
|
|
/* let plugin intercept keypress */
|
|
|
|
else if (s->plugin && s->plugin->cb_key_down &&
|
|
|
|
s->plugin->cb_key_down(s->plugin, ev))
|
|
|
|
goto end;
|
|
|
|
/* let view intercept keypress */
|
2009-08-20 17:07:27 -07:00
|
|
|
else if (_evry_view_key_press(s, ev))
|
|
|
|
goto end;
|
2009-08-17 16:54:16 -07:00
|
|
|
else if (!strcmp(key, "Right"))
|
2010-04-23 15:26:48 -07:00
|
|
|
{
|
|
|
|
if (!evry_browse_item(selector) &&
|
|
|
|
(selector != selectors[2]))
|
|
|
|
_evry_selectors_switch(1);
|
|
|
|
}
|
2009-08-17 16:54:16 -07:00
|
|
|
else if (!strcmp(key, "Left"))
|
2010-04-23 15:26:48 -07:00
|
|
|
{
|
|
|
|
if (!evry_browse_back(selector))
|
|
|
|
_evry_selectors_switch(-1);
|
|
|
|
}
|
2009-08-17 16:54:16 -07:00
|
|
|
else if (!strcmp(key, "Return"))
|
2009-08-16 02:43:38 -07:00
|
|
|
{
|
|
|
|
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
|
|
|
|
_evry_plugin_action(selector, 0);
|
2009-08-31 06:04:53 -07:00
|
|
|
else /*if (!_evry_browse_item(selector))*/
|
2009-08-16 02:43:38 -07:00
|
|
|
_evry_plugin_action(selector, 1);
|
|
|
|
}
|
2009-08-17 16:54:16 -07:00
|
|
|
else if (!strcmp(key, "Tab"))
|
2010-04-23 15:26:48 -07:00
|
|
|
_evry_selectors_switch(1);
|
2009-08-17 16:54:16 -07:00
|
|
|
else if (!strcmp(key, "BackSpace"))
|
2009-08-24 21:23:11 -07:00
|
|
|
{
|
2010-04-04 07:11:35 -07:00
|
|
|
if (!_evry_backspace(selector))
|
2009-08-31 06:04:53 -07:00
|
|
|
evry_browse_back(selector);
|
2009-08-24 21:23:11 -07:00
|
|
|
}
|
2009-08-20 14:39:01 -07:00
|
|
|
else if (_evry_view_key_press(s, ev))
|
|
|
|
goto end;
|
|
|
|
else if ((ev->compose && !(ev->modifiers & ECORE_EVENT_MODIFIER_ALT)))
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2010-04-23 17:54:12 -07:00
|
|
|
int len = strlen(s->inp);
|
2010-04-22 11:15:59 -07:00
|
|
|
|
|
|
|
if (len == 0 && (_evry_view_toggle(s, ev->compose)))
|
|
|
|
goto end;
|
|
|
|
|
2009-08-21 01:19:30 -07:00
|
|
|
if (len < (INPUTLEN - strlen(ev->compose)))
|
2009-08-12 15:34:07 -07:00
|
|
|
{
|
2010-04-22 16:03:47 -07:00
|
|
|
strcat(s->inp, ev->compose);
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-22 14:10:16 -07:00
|
|
|
_evry_update(selector, 1);
|
2009-08-12 15:34:07 -07:00
|
|
|
}
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
2009-08-17 16:54:16 -07:00
|
|
|
|
2009-08-20 14:39:01 -07:00
|
|
|
end:
|
2009-08-17 16:54:16 -07:00
|
|
|
eina_stringshare_del(ev->key);
|
|
|
|
ev->key = old;
|
2009-08-10 04:36:37 -07:00
|
|
|
return 1;
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2009-08-24 21:23:11 -07:00
|
|
|
static int
|
2010-04-04 07:11:35 -07:00
|
|
|
_evry_backspace(Evry_Selector *sel)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2010-04-04 07:11:35 -07:00
|
|
|
Evry_State *s = sel->state;
|
2009-05-06 07:20:45 -07:00
|
|
|
int len, val, pos;
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2010-04-22 16:03:47 -07:00
|
|
|
len = strlen(s->inp);
|
2009-05-06 07:20:45 -07:00
|
|
|
if (len > 0)
|
|
|
|
{
|
2010-04-22 16:03:47 -07:00
|
|
|
pos = evas_string_char_prev_get(s->inp, len, &val);
|
2009-05-06 07:20:45 -07:00
|
|
|
if ((pos < len) && (pos >= 0))
|
|
|
|
{
|
2010-04-22 16:03:47 -07:00
|
|
|
val = *(s->inp + pos);
|
2009-08-20 16:43:56 -07:00
|
|
|
|
2010-04-22 16:03:47 -07:00
|
|
|
s->inp[pos] = 0;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2010-04-25 05:01:20 -07:00
|
|
|
if (s->trigger_active && s->inp[0] != 0)
|
|
|
|
s->input = s->inp + 1;
|
|
|
|
else
|
|
|
|
s->input = s->inp;
|
2009-08-20 16:43:56 -07:00
|
|
|
|
|
|
|
if ((pos == 0) || !isspace(val))
|
2010-04-04 07:11:35 -07:00
|
|
|
_evry_update(sel, 1);
|
2009-08-24 21:23:11 -07:00
|
|
|
|
|
|
|
return 1;
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
}
|
2009-08-24 21:23:11 -07:00
|
|
|
|
|
|
|
return 0;
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_update_text_label(Evry_State *s)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-25 17:36:59 -07:00
|
|
|
if (!list->visible && evry_conf->hide_input)
|
2009-08-16 20:30:04 -07:00
|
|
|
{
|
2010-04-22 16:03:47 -07:00
|
|
|
if (strlen(s->inp) > 0)
|
2009-08-16 20:30:04 -07:00
|
|
|
edje_object_signal_emit(list->o_main, "e,state,entry_show", "e");
|
|
|
|
else
|
|
|
|
edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e");
|
|
|
|
}
|
2009-08-17 16:54:16 -07:00
|
|
|
|
2010-04-22 16:03:47 -07:00
|
|
|
edje_object_part_text_set(win->o_main, "e.text.label", s->inp);
|
|
|
|
edje_object_part_text_set(list->o_main, "e.text.label", s->inp);
|
2009-08-10 04:36:37 -07:00
|
|
|
|
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
static void
|
2010-04-04 07:11:35 -07:00
|
|
|
_evry_update(Evry_Selector *sel, int fetch)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2010-04-04 07:11:35 -07:00
|
|
|
Evry_State *s = sel->state;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_update_text_label(s);
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-15 13:12:04 -07:00
|
|
|
if (fetch)
|
|
|
|
{
|
2010-04-04 07:11:35 -07:00
|
|
|
if (sel->update_timer)
|
|
|
|
ecore_timer_del(sel->update_timer);
|
|
|
|
|
|
|
|
sel->update_timer = ecore_timer_add(MATCH_LAG, _evry_cb_update_timer, sel);
|
2009-08-20 07:45:47 -07:00
|
|
|
|
2010-05-06 06:09:14 -07:00
|
|
|
/* if (s->plugin && !s->plugin->trigger) */
|
|
|
|
edje_object_signal_emit(list->o_main, "e,signal,update", "e");
|
2009-08-15 13:12:04 -07:00
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2009-06-21 03:31:38 -07:00
|
|
|
static int
|
2010-04-04 07:11:35 -07:00
|
|
|
_evry_cb_update_timer(void *data)
|
2009-06-21 03:31:38 -07:00
|
|
|
{
|
2010-04-04 07:11:35 -07:00
|
|
|
Evry_Selector *sel = data;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-04-04 07:11:35 -07:00
|
|
|
_evry_matches_update(sel, 1);
|
|
|
|
_evry_selector_update(sel);
|
|
|
|
_evry_list_win_update(sel->state);
|
|
|
|
sel->update_timer = NULL;
|
2009-08-12 05:17:43 -07:00
|
|
|
|
2009-06-21 03:31:38 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-08-16 02:43:38 -07:00
|
|
|
static int
|
2010-04-04 07:11:35 -07:00
|
|
|
_evry_clear(Evry_Selector *sel)
|
2009-06-24 13:02:37 -07:00
|
|
|
{
|
2010-04-04 07:11:35 -07:00
|
|
|
Evry_State *s = sel->state;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-04-24 17:31:11 -07:00
|
|
|
if (s->inp && s->inp[0] != 0)
|
2009-08-12 15:34:07 -07:00
|
|
|
{
|
2010-04-24 17:31:11 -07:00
|
|
|
if (s->trigger_active && s->inp[1] != 0)
|
|
|
|
{
|
|
|
|
s->inp[1] = 0;
|
|
|
|
s->input = s->inp + 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->inp[0] = 0;
|
|
|
|
s->input = s->inp;
|
|
|
|
}
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2010-04-04 07:11:35 -07:00
|
|
|
_evry_update(sel, 1);
|
2009-08-25 17:36:59 -07:00
|
|
|
if (!list->visible && evry_conf->hide_input)
|
2009-08-16 20:30:04 -07:00
|
|
|
edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e");
|
2009-08-16 02:43:38 -07:00
|
|
|
return 1;
|
2009-06-24 13:02:37 -07:00
|
|
|
}
|
2009-08-16 02:43:38 -07:00
|
|
|
return 0;
|
2009-06-24 13:02:37 -07:00
|
|
|
}
|
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
static void
|
2009-08-10 04:36:37 -07:00
|
|
|
_evry_plugin_action(Evry_Selector *sel, int finished)
|
2009-08-12 12:00:25 -07:00
|
|
|
{
|
2010-04-26 11:21:09 -07:00
|
|
|
Evry_State *s_subj, *s_act, *s_obj = NULL;
|
|
|
|
Evry_Item *it_subj, *it_act, *it_obj, *it;
|
2010-04-25 09:26:13 -07:00
|
|
|
Eina_List *l;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2010-04-08 16:29:35 -07:00
|
|
|
if (selectors[0]->update_timer)
|
|
|
|
{
|
|
|
|
_evry_matches_update(selectors[0], 0);
|
|
|
|
_evry_selector_update(selectors[0]);
|
|
|
|
}
|
2009-08-10 04:36:37 -07:00
|
|
|
|
2010-04-26 11:21:09 -07:00
|
|
|
if (!(s_subj = selectors[0]->state))
|
|
|
|
return;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-04-26 11:21:09 -07:00
|
|
|
if (!(it_subj = s_subj->cur_item))
|
2009-08-30 01:51:15 -07:00
|
|
|
return;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-04-08 16:29:35 -07:00
|
|
|
if (selector == selectors[0] &&
|
|
|
|
selectors[1]->update_timer)
|
2009-07-10 08:47:19 -07:00
|
|
|
{
|
2010-04-26 11:21:09 -07:00
|
|
|
_evry_selector_actions_get(it_subj);
|
2010-04-08 16:29:35 -07:00
|
|
|
|
|
|
|
if (!selectors[1]->state)
|
|
|
|
return;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-04-08 16:29:35 -07:00
|
|
|
_evry_selector_update(selectors[1]);
|
2009-07-10 08:47:19 -07:00
|
|
|
}
|
2009-08-10 04:36:37 -07:00
|
|
|
|
2010-04-26 11:21:09 -07:00
|
|
|
if (!(s_act = selectors[1]->state))
|
2009-08-30 01:51:15 -07:00
|
|
|
return;
|
2009-08-10 04:36:37 -07:00
|
|
|
|
2010-04-26 11:21:09 -07:00
|
|
|
if (!(it_act = s_act->cur_item))
|
|
|
|
return;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2010-04-28 09:39:50 -07:00
|
|
|
if (CHECK_TYPE(it_act, EVRY_TYPE_ACTION) ||
|
|
|
|
CHECK_SUBTYPE(it_act, EVRY_TYPE_ACTION))
|
2009-06-24 13:02:37 -07:00
|
|
|
{
|
2010-04-27 20:22:40 -07:00
|
|
|
GET_ACTION(act, it_act);
|
|
|
|
|
|
|
|
if (!act->action)
|
|
|
|
return;
|
|
|
|
|
2010-04-25 09:26:13 -07:00
|
|
|
/* get object item for action, when required */
|
2010-04-28 06:54:35 -07:00
|
|
|
if (act->it2.type)
|
2009-08-31 06:04:53 -07:00
|
|
|
{
|
2010-04-25 09:26:13 -07:00
|
|
|
/* check if object is provided */
|
2010-04-26 11:21:09 -07:00
|
|
|
if (selectors[2]->state)
|
2010-04-25 09:26:13 -07:00
|
|
|
{
|
2010-04-26 11:21:09 -07:00
|
|
|
s_obj = selectors[2]->state;
|
|
|
|
it_obj = s_obj->cur_item;
|
2010-04-25 09:26:13 -07:00
|
|
|
}
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2010-04-26 11:21:09 -07:00
|
|
|
if (!it_obj)
|
2010-04-25 09:26:13 -07:00
|
|
|
{
|
|
|
|
if (selectors[1] == selector)
|
|
|
|
_evry_selectors_switch(1);
|
|
|
|
return;
|
|
|
|
}
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2010-04-28 06:54:35 -07:00
|
|
|
act->it2.item = it_obj;
|
2009-08-31 06:04:53 -07:00
|
|
|
}
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2010-05-02 04:57:39 -07:00
|
|
|
if (s_obj && s_obj->sel_items && !(act->it2.accept_list))
|
2010-04-25 09:26:13 -07:00
|
|
|
{
|
2010-05-02 04:57:39 -07:00
|
|
|
EINA_LIST_FOREACH(s_obj->sel_items, l, it)
|
2010-04-25 09:26:13 -07:00
|
|
|
{
|
2010-05-02 04:57:39 -07:00
|
|
|
if (it->type != act->it2.type)
|
2010-04-25 09:26:13 -07:00
|
|
|
continue;
|
2010-05-02 04:57:39 -07:00
|
|
|
act->it2.item = it;
|
2010-04-25 09:26:13 -07:00
|
|
|
act->action(act);
|
|
|
|
}
|
|
|
|
}
|
2010-05-02 04:57:39 -07:00
|
|
|
else if (s_subj->sel_items && !(act->it1.accept_list))
|
2010-04-25 09:26:13 -07:00
|
|
|
{
|
2010-05-02 04:57:39 -07:00
|
|
|
EINA_LIST_FOREACH(s_subj->sel_items, l, it)
|
2010-04-25 09:26:13 -07:00
|
|
|
{
|
2010-05-02 04:57:39 -07:00
|
|
|
if (it->type != act->it1.type)
|
2010-04-25 09:26:13 -07:00
|
|
|
continue;
|
2010-05-02 04:57:39 -07:00
|
|
|
act->it1.item = it;
|
2010-04-25 09:26:13 -07:00
|
|
|
act->action(act);
|
|
|
|
}
|
|
|
|
}
|
2010-05-03 12:19:42 -07:00
|
|
|
else
|
2010-04-26 11:21:09 -07:00
|
|
|
{
|
2010-04-28 06:54:35 -07:00
|
|
|
act->it1.item = it_subj;
|
2010-05-02 04:57:39 -07:00
|
|
|
act->it1.items = s_subj->sel_items;
|
|
|
|
|
|
|
|
if (s_obj)
|
|
|
|
act->it2.items = s_obj->sel_items;
|
|
|
|
|
2010-04-26 11:21:09 -07:00
|
|
|
if (!act->action(act))
|
|
|
|
return;
|
|
|
|
}
|
2009-06-24 13:02:37 -07:00
|
|
|
}
|
2009-08-25 17:36:59 -07:00
|
|
|
else return;
|
2009-07-04 04:10:28 -07:00
|
|
|
|
2010-05-02 04:31:01 -07:00
|
|
|
if (s_subj && it_subj && it_subj->plugin->history)
|
2010-04-26 11:21:09 -07:00
|
|
|
evry_history_add(evry_hist->subjects, it_subj, NULL, s_subj->input);
|
|
|
|
|
2010-05-02 04:31:01 -07:00
|
|
|
if (s_act && it_act && it_act->plugin->history)
|
2010-04-26 11:21:09 -07:00
|
|
|
evry_history_add(evry_hist->actions, it_act, it_subj->context, s_act->input);
|
|
|
|
|
2010-05-02 04:31:01 -07:00
|
|
|
if (s_obj && it_obj && it_obj->plugin->history)
|
2010-04-26 11:21:09 -07:00
|
|
|
evry_history_add(evry_hist->subjects, it_obj, it_act->context, s_obj->input);
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
if (finished)
|
2010-05-01 12:27:26 -07:00
|
|
|
evry_hide(0);
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2009-08-20 14:39:01 -07:00
|
|
|
static void
|
|
|
|
_evry_view_show(Evry_View *v)
|
|
|
|
{
|
|
|
|
if (!v) return;
|
|
|
|
|
|
|
|
if (v->o_list)
|
|
|
|
{
|
|
|
|
edje_object_part_swallow(list->o_main, "e.swallow.list", v->o_list);
|
|
|
|
evas_object_show(v->o_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (v->o_bar)
|
|
|
|
{
|
|
|
|
edje_object_part_swallow(list->o_main, "e.swallow.bar", v->o_bar);
|
|
|
|
evas_object_show(v->o_bar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-04-17 12:13:01 -07:00
|
|
|
_evry_view_hide(Evry_View *v, int slide)
|
2009-08-20 14:39:01 -07:00
|
|
|
{
|
|
|
|
if (!v) return;
|
|
|
|
|
2010-04-17 12:13:01 -07:00
|
|
|
v->clear(v, slide);
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-20 14:39:01 -07:00
|
|
|
if (v->o_list)
|
|
|
|
{
|
|
|
|
edje_object_part_unswallow(list->o_main, v->o_list);
|
|
|
|
evas_object_hide(v->o_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (v->o_bar)
|
|
|
|
{
|
|
|
|
edje_object_part_unswallow(list->o_main, v->o_bar);
|
|
|
|
evas_object_hide(v->o_bar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
static void
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_view_update(Evry_State *s, Evry_Plugin *p)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
if (!list->visible) return;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-19 05:07:37 -07:00
|
|
|
if (!s->view)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-19 05:07:37 -07:00
|
|
|
Evry_View *view = evry_conf->views->data;
|
|
|
|
s->view = view->create(view, s, list->o_main);
|
2009-08-20 14:39:01 -07:00
|
|
|
_evry_view_show(s->view);
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
2009-06-08 06:44:11 -07:00
|
|
|
|
2009-08-19 05:07:37 -07:00
|
|
|
if (s->view)
|
2010-04-17 10:50:27 -07:00
|
|
|
s->view->update(s->view, 0);
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
|
|
|
|
2009-08-13 15:42:40 -07:00
|
|
|
static void
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_view_clear(Evry_State *s)
|
2009-08-13 15:42:40 -07:00
|
|
|
{
|
2009-08-19 05:07:37 -07:00
|
|
|
if (!s || !s->view) return;
|
2009-08-13 15:42:40 -07:00
|
|
|
|
2010-04-17 10:50:27 -07:00
|
|
|
s->view->clear(s->view, 0);
|
2009-08-17 16:54:16 -07:00
|
|
|
}
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
static int
|
|
|
|
_evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev)
|
|
|
|
{
|
2009-08-21 01:19:30 -07:00
|
|
|
if (!s || !s->view || !s->view->cb_key_down) return 0;
|
2009-08-19 05:07:37 -07:00
|
|
|
|
|
|
|
return s->view->cb_key_down(s->view, ev);
|
2009-08-13 15:42:40 -07:00
|
|
|
}
|
2009-08-10 04:36:37 -07:00
|
|
|
|
|
|
|
static int
|
2009-08-21 01:19:30 -07:00
|
|
|
_evry_view_toggle(Evry_State *s, const char *trigger)
|
2009-08-10 04:36:37 -07:00
|
|
|
{
|
2009-08-21 01:19:30 -07:00
|
|
|
Evry_View *view, *v = NULL;
|
2009-08-19 05:07:37 -07:00
|
|
|
Eina_List *l, *ll;
|
2010-04-20 11:49:42 -07:00
|
|
|
Eina_Bool triggered = FALSE;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-21 01:19:30 -07:00
|
|
|
if (trigger)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(evry_conf->views, ll, view)
|
|
|
|
{
|
|
|
|
if (view->trigger && !strncmp(trigger, view->trigger, 1) &&
|
|
|
|
(v = view->create(view, s, list->o_main)))
|
2010-04-20 11:49:42 -07:00
|
|
|
{
|
|
|
|
triggered = EINA_TRUE;
|
|
|
|
goto found;
|
|
|
|
}
|
2009-08-21 01:19:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-08-22 20:12:05 -07:00
|
|
|
if (s->view)
|
|
|
|
l = eina_list_data_find_list(evry_conf->views, s->view->id);
|
|
|
|
else
|
|
|
|
{
|
2009-08-22 21:48:17 -07:00
|
|
|
view = evry_conf->views->data;
|
|
|
|
v = view->create(view, s, list->o_main);
|
2009-08-22 20:12:05 -07:00
|
|
|
goto found;
|
|
|
|
}
|
2009-08-18 07:29:30 -07:00
|
|
|
|
2009-08-21 01:19:30 -07:00
|
|
|
if (l && l->next)
|
|
|
|
l = l->next;
|
|
|
|
else
|
|
|
|
l = evry_conf->views;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-21 01:19:30 -07:00
|
|
|
EINA_LIST_FOREACH(l, ll, view)
|
|
|
|
{
|
|
|
|
if ((!view->trigger) &&
|
|
|
|
((view == s->view->id) ||
|
|
|
|
(v = view->create(view, s, list->o_main))))
|
|
|
|
goto found;
|
|
|
|
}
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-21 01:19:30 -07:00
|
|
|
EINA_LIST_FOREACH(evry_conf->views, ll, view)
|
|
|
|
{
|
|
|
|
if ((!view->trigger) &&
|
|
|
|
((view == s->view->id) ||
|
|
|
|
(v = view->create(view, s, list->o_main))))
|
|
|
|
goto found;
|
|
|
|
}
|
2009-08-19 05:07:37 -07:00
|
|
|
}
|
2009-08-17 16:54:16 -07:00
|
|
|
|
2009-08-21 01:19:30 -07:00
|
|
|
found:
|
2009-08-19 05:07:37 -07:00
|
|
|
if (!v) return 0;
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2009-08-21 01:19:30 -07:00
|
|
|
_evry_list_win_show();
|
|
|
|
|
2009-08-19 05:07:37 -07:00
|
|
|
if (s->view)
|
|
|
|
{
|
2010-04-17 12:13:01 -07:00
|
|
|
_evry_view_hide(s->view, 0);
|
2009-08-19 05:07:37 -07:00
|
|
|
s->view->destroy(s->view);
|
2009-08-10 04:36:37 -07:00
|
|
|
}
|
2009-07-03 06:37:54 -07:00
|
|
|
|
2009-08-19 05:07:37 -07:00
|
|
|
s->view = v;
|
2009-08-22 21:48:17 -07:00
|
|
|
_evry_view_show(s->view);
|
2010-04-17 10:50:27 -07:00
|
|
|
view->update(s->view, 0);
|
2009-08-19 05:07:37 -07:00
|
|
|
|
2010-04-20 11:49:42 -07:00
|
|
|
return triggered;
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-27 13:52:14 -07:00
|
|
|
_evry_matches_update(Evry_Selector *sel, int async)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-10 04:36:37 -07:00
|
|
|
Evry_State *s = sel->state;
|
2009-06-21 03:31:38 -07:00
|
|
|
Evry_Plugin *p;
|
2009-05-06 07:20:45 -07:00
|
|
|
Eina_List *l;
|
2010-04-25 09:26:13 -07:00
|
|
|
Evry_Item *it;
|
2009-08-17 20:15:36 -07:00
|
|
|
const char *input;
|
2010-04-25 09:26:13 -07:00
|
|
|
|
2010-04-23 17:54:12 -07:00
|
|
|
s->changed = 1;
|
|
|
|
|
2010-04-22 16:03:47 -07:00
|
|
|
if (s->inp[0])
|
|
|
|
input = s->inp;
|
2009-08-17 20:15:36 -07:00
|
|
|
else
|
|
|
|
input = NULL;
|
2009-08-18 07:29:30 -07:00
|
|
|
|
2010-04-30 15:12:02 -07:00
|
|
|
s->request++;
|
|
|
|
DBG("matches update %d", s->request);
|
|
|
|
|
2010-04-25 09:26:13 -07:00
|
|
|
if (s->sel_items)
|
|
|
|
eina_list_free(s->sel_items);
|
|
|
|
s->sel_items = NULL;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2010-04-30 15:12:02 -07:00
|
|
|
if ((!input || !s->trigger_active) &&
|
|
|
|
(!win->plugin_dedicated))
|
2010-04-23 17:54:12 -07:00
|
|
|
{
|
2010-04-22 17:49:29 -07:00
|
|
|
EINA_LIST_FREE(s->cur_plugins, p);
|
|
|
|
s->trigger_active = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
2009-06-21 03:31:38 -07:00
|
|
|
{
|
2010-04-22 17:49:29 -07:00
|
|
|
EINA_LIST_FOREACH(s->cur_plugins, l, p)
|
2010-04-30 15:12:02 -07:00
|
|
|
{
|
2010-05-03 12:19:42 -07:00
|
|
|
p->request = s->request;
|
2010-04-30 15:12:02 -07:00
|
|
|
p->fetch(p, s->input);
|
|
|
|
}
|
2010-04-22 17:49:29 -07:00
|
|
|
}
|
|
|
|
|
2010-04-30 15:12:02 -07:00
|
|
|
/* check if input matches plugin trigger */
|
2010-04-22 17:49:29 -07:00
|
|
|
if (!s->cur_plugins && input)
|
|
|
|
{
|
|
|
|
int len_trigger = 0;
|
2010-04-23 13:48:22 -07:00
|
|
|
int len_inp = strlen(s->inp);
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-07-29 13:43:09 -07:00
|
|
|
EINA_LIST_FOREACH(s->plugins, l, p)
|
2009-07-09 15:58:40 -07:00
|
|
|
{
|
2010-04-23 13:48:22 -07:00
|
|
|
if (!p->config->trigger) continue;
|
|
|
|
int len = strlen(p->config->trigger);
|
2010-04-22 17:49:29 -07:00
|
|
|
|
|
|
|
if (len_trigger && len != len_trigger)
|
|
|
|
continue;
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2010-04-23 13:48:22 -07:00
|
|
|
if ((len_inp >= len) &&
|
|
|
|
(!strncmp(s->inp, p->config->trigger, len)))
|
2009-07-15 07:37:01 -07:00
|
|
|
{
|
2010-04-23 17:21:45 -07:00
|
|
|
len_trigger = len;
|
2009-08-14 02:35:51 -07:00
|
|
|
s->cur_plugins = eina_list_append(s->cur_plugins, p);
|
2010-04-30 15:12:02 -07:00
|
|
|
p->request = s->request;
|
2010-04-23 13:48:22 -07:00
|
|
|
if(len_inp == len)
|
|
|
|
p->fetch(p, NULL);
|
|
|
|
else
|
|
|
|
p->fetch(p, s->input + len);
|
2009-07-15 07:37:01 -07:00
|
|
|
}
|
2009-07-09 15:58:40 -07:00
|
|
|
}
|
2010-04-22 17:49:29 -07:00
|
|
|
if (s->cur_plugins)
|
|
|
|
{
|
|
|
|
s->trigger_active = EINA_TRUE;
|
2010-04-23 13:48:22 -07:00
|
|
|
/* replace trigger with indicator */
|
|
|
|
if (len_trigger > 1)
|
|
|
|
{
|
|
|
|
s->inp[0] = '>';
|
|
|
|
s->inp[1] = '\0';
|
|
|
|
}
|
2010-04-23 17:54:12 -07:00
|
|
|
s->input = s->inp + 1;
|
|
|
|
_evry_update_text_label(s);
|
2010-04-22 17:49:29 -07:00
|
|
|
}
|
2009-07-15 07:37:01 -07:00
|
|
|
}
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-07-15 07:37:01 -07:00
|
|
|
if (!s->cur_plugins)
|
|
|
|
{
|
2010-04-23 17:21:45 -07:00
|
|
|
s->input = s->inp;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2010-04-23 17:21:45 -07:00
|
|
|
EINA_LIST_FOREACH(s->plugins, l, p)
|
2009-07-29 13:43:09 -07:00
|
|
|
{
|
2010-05-06 06:09:14 -07:00
|
|
|
if ((p->config->top_level) && (sel == selectors[0]))
|
2010-05-02 04:31:01 -07:00
|
|
|
{
|
|
|
|
if ((p->config->trigger) && (p->config->trigger_only))
|
|
|
|
continue;
|
|
|
|
}
|
2010-05-03 12:19:42 -07:00
|
|
|
|
2010-04-17 05:40:28 -07:00
|
|
|
if (p == sel->aggregator)
|
|
|
|
continue;
|
2010-04-30 15:12:02 -07:00
|
|
|
|
2010-04-17 05:40:28 -07:00
|
|
|
/* dont wait for async plugin. use their current items */
|
2010-04-08 16:41:53 -07:00
|
|
|
if (!async && p->async_fetch && p->items)
|
2009-08-27 13:52:14 -07:00
|
|
|
{
|
|
|
|
s->cur_plugins = eina_list_append(s->cur_plugins, p);
|
2010-04-30 15:12:02 -07:00
|
|
|
continue;
|
2009-08-27 13:52:14 -07:00
|
|
|
}
|
2010-05-03 12:19:42 -07:00
|
|
|
|
2010-04-30 15:12:02 -07:00
|
|
|
p->request = s->request;
|
|
|
|
|
|
|
|
if ((p->fetch(p, input)) || (sel->states->next))
|
2009-08-27 13:52:14 -07:00
|
|
|
{
|
2010-04-30 15:12:02 -07:00
|
|
|
s->cur_plugins = eina_list_append(s->cur_plugins, p);
|
2009-08-27 13:52:14 -07:00
|
|
|
}
|
2009-07-29 13:43:09 -07:00
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2010-04-23 17:51:08 -07:00
|
|
|
if (sel->aggregator->fetch(sel->aggregator, input))
|
2010-04-23 17:54:12 -07:00
|
|
|
_evry_plugin_list_insert(s, sel->aggregator);
|
2010-04-23 17:51:08 -07:00
|
|
|
|
2010-04-11 07:29:23 -07:00
|
|
|
if (s->plugin_auto_selected ||
|
|
|
|
(s->plugin && (!eina_list_data_find(s->cur_plugins, s->plugin))))
|
|
|
|
_evry_plugin_select(s, NULL);
|
|
|
|
else
|
2010-04-23 17:54:12 -07:00
|
|
|
_evry_plugin_select(s, s->plugin);
|
|
|
|
|
2010-04-04 07:11:35 -07:00
|
|
|
if (sel->update_timer)
|
|
|
|
ecore_timer_del(sel->update_timer);
|
|
|
|
sel->update_timer = NULL;
|
2010-04-25 09:26:13 -07:00
|
|
|
|
|
|
|
if (s->plugin)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(s->plugin->items, l, it)
|
|
|
|
if (it->marked)
|
|
|
|
s->sel_items = eina_list_append(s->sel_items, it);
|
|
|
|
}
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_item_desel(Evry_State *s, Evry_Item *it)
|
2009-08-14 02:35:51 -07:00
|
|
|
{
|
2010-04-08 15:37:50 -07:00
|
|
|
if (!it)
|
|
|
|
it = s->cur_item;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-28 21:42:17 -07:00
|
|
|
if (s->cur_item)
|
2010-04-07 08:03:27 -07:00
|
|
|
{
|
2010-04-08 16:41:53 -07:00
|
|
|
it->selected = EINA_FALSE;
|
2010-04-08 15:37:50 -07:00
|
|
|
evry_item_free(it);
|
2010-04-07 08:03:27 -07:00
|
|
|
}
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-28 21:42:17 -07:00
|
|
|
s->cur_item = NULL;
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_item_sel(Evry_State *s, Evry_Item *it)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-28 21:42:17 -07:00
|
|
|
if (s->cur_item == it) return;
|
2009-08-12 11:47:46 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
_evry_item_desel(s, NULL);
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2009-08-17 16:54:16 -07:00
|
|
|
evry_item_ref(it);
|
2010-04-07 08:03:27 -07:00
|
|
|
it->selected = EINA_TRUE;
|
2010-04-08 16:41:53 -07:00
|
|
|
|
2009-08-28 21:42:17 -07:00
|
|
|
s->cur_item = it;
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-08-20 14:39:01 -07:00
|
|
|
_evry_plugin_select(Evry_State *s, Evry_Plugin *p)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-08-13 15:42:40 -07:00
|
|
|
if (!s || !s->cur_plugins) return;
|
2009-08-14 02:35:51 -07:00
|
|
|
|
2010-04-25 04:00:53 -07:00
|
|
|
if (p) s->plugin_auto_selected = EINA_FALSE;
|
2010-04-27 20:22:40 -07:00
|
|
|
|
2009-08-13 15:42:40 -07:00
|
|
|
if (!p && s->cur_plugins)
|
|
|
|
{
|
|
|
|
p = s->cur_plugins->data;
|
2009-08-14 02:35:51 -07:00
|
|
|
s->plugin_auto_selected = EINA_TRUE;
|
2009-08-13 15:42:40 -07:00
|
|
|
}
|
2010-04-23 17:21:45 -07:00
|
|
|
|
2009-08-25 17:53:12 -07:00
|
|
|
if (s->plugin != p)
|
2010-04-23 17:21:45 -07:00
|
|
|
_evry_item_desel(s, NULL);
|
2009-08-25 17:36:59 -07:00
|
|
|
|
2009-08-25 17:53:12 -07:00
|
|
|
s->plugin = p;
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2009-08-20 14:39:01 -07:00
|
|
|
void
|
|
|
|
evry_plugin_select(const Evry_State *s, Evry_Plugin *p)
|
2009-08-20 07:45:47 -07:00
|
|
|
{
|
2010-04-17 12:13:01 -07:00
|
|
|
Evry_Selector *sel;
|
2010-04-23 17:54:12 -07:00
|
|
|
|
2009-08-20 14:39:01 -07:00
|
|
|
_evry_plugin_select((Evry_State *) s, p);
|
2009-08-20 07:45:47 -07:00
|
|
|
|
2010-04-17 12:13:01 -07:00
|
|
|
sel = _evry_selector_for_plugin_get(p);
|
2010-04-23 17:54:12 -07:00
|
|
|
|
|
|
|
if (sel)
|
2010-04-17 12:13:01 -07:00
|
|
|
_evry_selector_update(sel);
|
2009-08-20 07:45:47 -07:00
|
|
|
}
|
|
|
|
|
2009-08-12 11:47:46 -07:00
|
|
|
static void
|
|
|
|
_evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Evry_Plugin *plugin;
|
2009-08-12 12:00:25 -07:00
|
|
|
|
2009-08-12 11:47:46 -07:00
|
|
|
EINA_LIST_FOREACH(s->cur_plugins, l, plugin)
|
|
|
|
if (p == plugin)
|
|
|
|
return;
|
|
|
|
else
|
|
|
|
if (p->config->priority < plugin->config->priority)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (l)
|
|
|
|
s->cur_plugins = eina_list_prepend_relative_list(s->cur_plugins, p, l);
|
|
|
|
else
|
|
|
|
s->cur_plugins = eina_list_append(s->cur_plugins, p);
|
|
|
|
}
|
|
|
|
|
2009-08-18 07:29:30 -07:00
|
|
|
static int
|
|
|
|
_evry_cb_selection_notify(void *data, int type, void *event)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Selection_Notify *ev;
|
2010-04-04 07:11:35 -07:00
|
|
|
/* FIXME Evry_Selector *sel = data; */
|
2009-08-18 07:29:30 -07:00
|
|
|
Evry_State *s = selector->state;
|
|
|
|
|
|
|
|
if (!s || (data != win)) return 1;
|
|
|
|
if (!win->request_selection) return 1;
|
|
|
|
|
|
|
|
win->request_selection = EINA_FALSE;
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
|
|
|
|
(ev->selection == ECORE_X_SELECTION_PRIMARY))
|
|
|
|
{
|
2010-04-23 17:54:12 -07:00
|
|
|
if (strcmp(ev->target, ECORE_X_SELECTION_TARGET_UTF8_STRING) == 0)
|
|
|
|
{
|
|
|
|
Ecore_X_Selection_Data_Text *text_data;
|
2009-08-18 07:29:30 -07:00
|
|
|
|
2010-04-23 17:54:12 -07:00
|
|
|
text_data = ev->data;
|
2009-08-18 07:29:30 -07:00
|
|
|
|
|
|
|
strncat(s->input, text_data->text, (INPUTLEN - strlen(s->input)) - 1);
|
2010-04-04 07:11:35 -07:00
|
|
|
_evry_update(selector, 1);
|
2010-04-23 17:54:12 -07:00
|
|
|
}
|
2009-08-18 07:29:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|