'everything' module: formatting, whitespace cleanup

SVN revision: 41248
This commit is contained in:
Hannes Janetzek 2009-07-04 11:10:28 +00:00
parent 406acced00
commit 0236fd2006
8 changed files with 266 additions and 261 deletions

View File

@ -29,7 +29,7 @@ EAPI void *
e_modapi_init(E_Module *m)
{
char buf[4096];
snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/module.everything",
snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/module.everything",
e_user_homedir_get(), e_config_profile_get());
ecore_file_mkdir(buf);
@ -66,7 +66,7 @@ e_modapi_init(E_Module *m)
evry_conf->scroll_animate = 1;
evry_conf->scroll_speed = 0.5;
}
conf_module = m;
evry_init();
@ -155,7 +155,7 @@ _e_mod_action_exebuf_cb(E_Object *obj, const char *params)
if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
printf("zone %d %d\n", zone->x, zone->y);
if (zone) evry_show(zone);
}

View File

@ -22,14 +22,14 @@ struct _Evry_State
/* Eina_List *sel_items; */
char *input;
const char *request_type;
Eina_Bool initial;
/* this is for the case when the current plugin was not selected
manually and a higher priority (async) plugin retrieves
candidates, the higher priority plugin is made current */
Eina_Bool plugin_auto_selected;
};
static int _evry_cb_key_down(void *data, int type, void *event);
@ -72,8 +72,6 @@ static int _evry_plug_act_select_action(Evry_Item *item, const char *input);
static void _evry_plug_act_select_cleanup(void);
static void _evry_plug_act_select_item_icon_get(Evry_Item *it, Evas *e);
/* local subsystem globals */
static E_Popup *popup = NULL;
static Ecore_X_Window input_window = 0;
@ -100,7 +98,7 @@ EAPI int
evry_init(void)
{
_evry_plug_act_select_init();
return 1;
}
@ -167,7 +165,7 @@ evry_show(E_Zone *zone)
if (!popup) return 0;
ecore_x_netwm_window_type_set(popup->evas_win, ECORE_X_WINDOW_TYPE_UTILITY);
e_popup_layer_set(popup, 255);
evas_event_freeze(popup->evas);
evas_event_feed_mouse_in(popup->evas, ecore_x_current_time_get(), NULL);
@ -196,7 +194,7 @@ evry_show(E_Zone *zone)
edje_object_part_swallow(o_main, "e.swallow.bar", o);
evas_object_show(o);
o_selector = o;
evas_event_thaw(popup->evas);
handlers = eina_list_append
@ -216,7 +214,7 @@ evry_show(E_Zone *zone)
(ECORE_EVENT_MOUSE_WHEEL, _evry_cb_mouse_wheel, NULL));
_evry_push_state();
e_popup_show(popup);
return 1;
}
@ -229,17 +227,17 @@ evry_hide(void)
Evry_Plugin *plugin;
Eina_List *l;
Evry_State *s;
if (!popup) return;
evas_event_freeze(popup->evas);
_evry_list_clear();
EINA_LIST_FREE(stack, s)
{
Evry_Plugin *p;
free(s->input);
EINA_LIST_FREE(s->plugins, p)
@ -255,7 +253,7 @@ evry_hide(void)
}
stack = NULL;
cur_state = NULL;
if (update_timer)
{
ecore_timer_del(update_timer);
@ -271,9 +269,9 @@ evry_hide(void)
ecore_animator_del(scroll_animator);
scroll_animator = NULL;
}
e_popup_hide(popup);
evas_object_del(o_list);
o_list = NULL;
@ -295,7 +293,6 @@ evry_hide(void)
input_window = 0;
}
EAPI void
evry_plugin_async_update(Evry_Plugin *p, int action)
{
@ -317,17 +314,17 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
}
else
{
char buf[64];
char buf[64];
snprintf(buf, 64, "%s (%d)", p->name, eina_list_count(p->items));
edje_object_part_text_set(p->tab, "e.text.label", buf);
}
if ((!s->cur_plugin && s->cur_plugins) || (s->cur_plugin == p) ||
(s->plugin_auto_selected && (s->cur_plugin->prio > p->prio)))
{
if (!s->cur_plugin)
s->plugin_auto_selected = 1;
_evry_list_clear();
_evry_show_items(s->cur_plugins->data);
}
@ -335,6 +332,8 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
else if ((action == EVRY_ASYNC_UPDATE_CLEAR) && (s->cur_plugin == p))
{
_evry_list_clear();
/*XXX move this into list clear?*/
s->cur_items = NULL;
}
}
@ -347,22 +346,21 @@ _evry_cb_plugin_sort(const void *data1, const void *data2)
return p1->prio - p2->prio;
}
static int
_evry_push_state(void)
{
Evry_State *s;
Eina_List *l, *list = NULL;
Eina_List *l, *list = NULL;
const char *cur_type = "NONE";
Evry_Plugin *p;
s = cur_state;
if (s)
{
if (!s->cur_plugin || !s->sel_item)
return 0;
cur_type = s->cur_plugin->type_out;
/* current plugin provides no candidates to act on by others */
if (!s->cur_action && !strcmp(cur_type, "NONE"))
@ -380,13 +378,13 @@ _evry_push_state(void)
}
}
}
EINA_LIST_FOREACH(plugins, l, p)
{
{
if (strstr(p->type_in, cur_type))
{
/* printf("%s- in:%s out:%s\n", p->name, p->type_in, p->type_out); */
if (s && s->cur_action)
{
/* filter out plugins that dont provide the type
@ -397,19 +395,19 @@ _evry_push_state(void)
if (p->begin)
{
Evry_Item *sel_item = NULL;
Evry_Item *it = NULL;
if (s && (s->cur_plugin != action_selector))
sel_item = s->sel_item;
if (p->begin(sel_item))
it = s->sel_item;
if (p->begin(it))
list = eina_list_append(list, p);
}
else
list = eina_list_append(list, p);
}
}
if (s && !s->cur_action)
{
if (_evry_plug_act_select_actions_set())
@ -417,7 +415,7 @@ _evry_push_state(void)
list = eina_list_append(list, action_selector);
}
}
if (!list) return 0;
list = eina_list_sort(list, eina_list_count(list), _evry_cb_plugin_sort);
@ -480,7 +478,7 @@ _evry_pop_state(void)
{
Evry_Item *it = NULL;
int i = 0;
s = stack->data;
cur_state = s;
@ -489,7 +487,7 @@ _evry_pop_state(void)
_evry_pop_state();
return 0;
}
edje_object_part_text_set(o_main, "e.text.label", s->input);
if (s->sel_item)
@ -500,21 +498,21 @@ _evry_pop_state(void)
break;
else i++;
}
if (stack->next)
{
Evry_State *prev = stack->next->data;
it = prev->sel_item;
}
EINA_LIST_FOREACH(s->plugins, l, p)
if (p != s->cur_plugin && p->begin)
p->begin(it);
_evry_matches_update();
it = eina_list_nth(s->cur_plugin->items, i);
if (it)
{
if (s->sel_item) _evry_item_desel(s->sel_item);
@ -559,24 +557,24 @@ _evry_cb_key_down(void *data, int type, void *event)
if (s->sel_item)
{
if (!_evry_push_state())
_evry_plugin_action(0);
_evry_plugin_action(0);
}
}
/* _evry_plugin_next(); */
else if (!strcmp(ev->key, "Left") &&
((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) ||
(ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)))
_evry_pop_state();
/* _evry_plugin_prev(); */
_evry_pop_state();
/* _evry_plugin_prev(); */
else if (!strcmp(ev->key, "Right"))
_evry_plugin_next();
/* {
* if (s->sel_item)
* {
* if (!_evry_push_state())
* _evry_plugin_action(0);
* }
* } */
/* {
* if (s->sel_item)
* {
* if (!_evry_push_state())
* _evry_plugin_action(0);
* }
* } */
else if (!strcmp(ev->key, "Left"))
_evry_plugin_prev();
/* _evry_pop_state(); */
@ -594,10 +592,10 @@ _evry_cb_key_down(void *data, int type, void *event)
if (s->sel_item)
{
if (!_evry_push_state())
_evry_plugin_action(0);
_evry_plugin_action(0);
}
}
/* _evry_plugin_next(); */
/* _evry_plugin_next(); */
else if (!strcmp(ev->key, "u") &&
(ev->modifiers & ECORE_EVENT_MODIFIER_CTRL))
_evry_clear();
@ -608,7 +606,7 @@ _evry_cb_key_down(void *data, int type, void *event)
if (!_evry_pop_state())
evry_hide();
}
else if (!strcmp(ev->key, "BackSpace"))
_evry_backspace();
else if (!strcmp(ev->key, "Delete"))
@ -632,7 +630,7 @@ _evry_cb_mouse_down(void *data, int type, void *event)
{
Ecore_Event_Mouse_Button *ev;
Evry_State *s =cur_state;
ev = event;
if (ev->event_window != input_window) return 1;
@ -642,8 +640,8 @@ _evry_cb_mouse_down(void *data, int type, void *event)
{
if (s->sel_item) _evry_item_desel(s->sel_item);
s->sel_item = item_mouseover;
_evry_item_sel(s->sel_item);
}
_evry_item_sel(s->sel_item);
}
}
else
{
@ -657,31 +655,31 @@ static int
_evry_cb_mouse_up(void *data, int type, void *event)
{
Ecore_Event_Mouse_Button *ev;
ev = event;
if (ev->event_window != input_window) return 1;
if (item_mouseover)
{
if (ev->buttons == 1)
if (ev->buttons == 1)
_evry_plugin_action(1);
else if (ev->buttons == 3)
else if (ev->buttons == 3)
_evry_plugin_action(0);
}
else
{
evas_event_feed_mouse_up(popup->evas, ev->buttons, 0, ev->timestamp, NULL);
}
return 1;
}
static int
static int
_evry_cb_mouse_move(void *data, int type, void *event)
{
Ecore_Event_Mouse_Move *ev;
Evry_State *s =cur_state;
ev = event;
if (ev->event_window != input_window) return 1;
@ -695,7 +693,7 @@ _evry_cb_mouse_move(void *data, int type, void *event)
if (!s->sel_item || (s->sel_item != item_mouseover))
{
s->sel_item = item_mouseover;
_evry_item_sel(s->sel_item);
_evry_item_sel(s->sel_item);
}
}
}
@ -710,7 +708,7 @@ static int
_evry_cb_mouse_wheel(void *data, int type, void *event)
{
Ecore_Event_Mouse_Wheel *ev;
ev = event;
if (ev->event_window != input_window) return 1;
@ -719,35 +717,35 @@ _evry_cb_mouse_wheel(void *data, int type, void *event)
if (ev->z < 0) /* up */
{
int i;
for (i = ev->z; i < 0; i++) _evry_item_prev();
}
else if (ev->z > 0) /* down */
{
int i;
for (i = ev->z; i > 0; i--) _evry_item_next();
}
return 1;
}
static void
_evry_cb_item_mouse_in(void *data, Evas *evas, Evas_Object *obj,
void *event_info)
static void
_evry_cb_item_mouse_in(void *data, Evas *evas, Evas_Object *obj,
void *event_info)
{
Evry_State *s =cur_state;
if (!ev_last_is_mouse) return;
item_mouseover = data;
if (s->sel_item) _evry_item_desel(s->sel_item);
if (!(s->sel_item = data)) return;
_evry_item_sel(s->sel_item);
}
static void
_evry_cb_item_mouse_out(void *data, Evas *evas, Evas_Object *obj,
static void
_evry_cb_item_mouse_out(void *data, Evas *evas, Evas_Object *obj,
void *event_info)
{
item_mouseover = NULL;
@ -758,7 +756,7 @@ _evry_backspace(void)
{
int len, val, pos;
Evry_State *s = cur_state;
len = strlen(s->input);
if (len > 0)
{
@ -776,7 +774,7 @@ _evry_update(void)
{
Efreet_Desktop *desktop;
Evas_Object *o;
edje_object_part_text_set(o_main, "e.text.label", cur_state->input);
if (update_timer) ecore_timer_del(update_timer);
@ -810,7 +808,7 @@ _evry_plugin_action(int finished)
{
/* set cur_action and start plugins for second parameter (if required)*/
if (s->sel_item) _evry_plug_act_select_action(s->sel_item, s->input);
finished = 0;
}
else if (s->cur_action)
@ -826,7 +824,7 @@ _evry_plugin_action(int finished)
{
/* XXX use flags for return values */
int ret = 0;
if (s->cur_plugin->action)
{
ret = s->cur_plugin->action(s->sel_item, s->input);
@ -854,8 +852,8 @@ _evry_show_items(Evry_Plugin *p)
int mw, mh, h;
Evas_Object *o;
Evry_State *s = cur_state;
if (s->cur_plugin)
if (s->cur_plugin)
{
if (s->cur_plugin != p)
{
@ -865,14 +863,14 @@ _evry_show_items(Evry_Plugin *p)
}
else
edje_object_signal_emit(p->tab, "e,state,selected", "e");
if (s->cur_plugin != p)
s->sel_item = NULL;
s->cur_plugin = p;
s->cur_items = p->items;
evas_event_freeze(popup->evas);
evas_event_freeze(popup->evas);
e_box_freeze(o_list);
EINA_LIST_FOREACH(p->items, l, it)
@ -885,9 +883,9 @@ _evry_show_items(Evry_Plugin *p)
edje_object_part_text_set(o, "e.text.title", it->label);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN,
_evry_cb_item_mouse_in, it);
_evry_cb_item_mouse_in, it);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT,
_evry_cb_item_mouse_out, it);
_evry_cb_item_mouse_out, it);
evas_object_show(o);
p->icon_get(it, popup->evas);
@ -913,11 +911,11 @@ _evry_show_items(Evry_Plugin *p)
/* if (!s->sel_item && p->items)
* {
* s->sel_item = p->items->data;
* _evry_item_sel(s->sel_item);
* _evry_scroll_to(0);
* s->sel_item = p->items->data;
* _evry_item_sel(s->sel_item);
* _evry_scroll_to(0);
* } */
evas_event_thaw(popup->evas);
_evry_tab_scroll_to(p);
@ -930,20 +928,20 @@ _evry_matches_update(void)
Eina_List *l;
int items;
Evry_State *s = cur_state;
_evry_list_clear();
eina_list_free(s->cur_plugins);
s->cur_plugins = NULL;
s->sel_item = NULL;
EINA_LIST_FOREACH(s->plugins, l, p)
{
if (strlen(s->input) == 0)
items = !p->need_query ? p->fetch(NULL) : 0;
else
items = p->fetch(s->input);
if (!s->initial || (items && eina_list_count(p->items) > 0))
{
s->cur_plugins = eina_list_append(s->cur_plugins, p);
@ -954,10 +952,10 @@ _evry_matches_update(void)
p->tab = NULL;
}
}
EINA_LIST_FOREACH(s->cur_plugins, l, p)
_evry_plugin_selector_show(p);
if (s->cur_plugins)
{
if (s->cur_plugin && eina_list_data_find(s->cur_plugins, s->cur_plugin))
@ -978,7 +976,7 @@ _evry_list_clear(void)
Evry_State *s = cur_state;
Evry_Item *it;
Eina_List *l;
if (s && s->cur_items)
{
evas_event_freeze(popup->evas);
@ -1036,7 +1034,7 @@ _evry_tab_scroll_to(Evry_Plugin *p)
for(i = 0, l = cur_state->cur_plugins; l; l = l->next, i++)
if (l->data == p) break;
n = eina_list_count(cur_state->cur_plugins);
e_box_min_size_get(o_selector, &mw, NULL);
@ -1047,7 +1045,7 @@ _evry_tab_scroll_to(Evry_Plugin *p)
e_box_align_set(o_selector, 0.0, 0.5);
return;
}
if (n > 1)
{
align = (double)i / (double)(n - 1);
@ -1059,9 +1057,9 @@ _evry_tab_scroll_to(Evry_Plugin *p)
* scroll_animator = ecore_animator_add(_evry_animator, NULL);
* }
* else */
{
e_box_align_set(o_selector, 1.0 - align, 0.5);
}
{
e_box_align_set(o_selector, 1.0 - align, 0.5);
}
}
else
e_box_align_set(o_selector, 1.0, 0.5);
@ -1091,7 +1089,7 @@ _evry_item_next(void)
Evry_State *s = cur_state;
s->plugin_auto_selected = 0;
if (s->sel_item)
{
for (i = 0, l = s->cur_plugin->items; l; l = l->next, i++)
@ -1128,9 +1126,9 @@ _evry_item_prev(void)
Evry_State *s = cur_state;
s->plugin_auto_selected = 0;
if (s->sel_item)
{
{
_evry_item_desel(s->sel_item);
for (i = 0, l = s->cur_plugin->items; l; l = l->next, i++)
@ -1160,9 +1158,9 @@ _evry_plugin_next(void)
{
Eina_List *l;
Evry_State *s = cur_state;
if (!s->cur_plugin) return;
l = eina_list_data_find_list(s->cur_plugins, s->cur_plugin);
if (l && l->next)
@ -1179,14 +1177,13 @@ _evry_plugin_next(void)
}
}
static void
_evry_plugin_prev(void)
{
Eina_List *l;
Evry_Plugin *plugin;
Evry_State *s = cur_state;
if (!s->cur_plugin) return;
l = eina_list_data_find_list(s->cur_plugins, s->cur_plugin);
@ -1198,9 +1195,9 @@ _evry_plugin_prev(void)
_evry_show_items(l->prev->data);
}
else
{
{
l = eina_list_last(s->cur_plugins);
if (s->cur_plugin != l->data)
{
s->plugin_auto_selected = 0;
@ -1230,7 +1227,7 @@ _evry_animator(void *data)
{
double da;
int scroll_to = 1;
da = scroll_align - scroll_align_to;
if (da < 0.0) da = -da;
if (da < 0.01)
@ -1265,11 +1262,11 @@ _evry_plugin_selector_show(Evry_Plugin *p)
o = edje_object_add(popup->evas);
/* TODO move this to everything theme group !*/
e_theme_edje_object_set(o, "base/theme/widgets",
"e/widgets/toolbar/item");
"e/widgets/toolbar/item");
}
snprintf(buf, 64, "%s (%d)", p->name, eina_list_count(p->items));
edje_object_part_text_set(o, "e.text.label", buf);
edje_object_size_min_calc(o, &mw, &mh);
@ -1282,15 +1279,13 @@ _evry_plugin_selector_show(Evry_Plugin *p)
}
else
e_box_pack_end(o_selector, o);
evas_object_show(o);
e_box_pack_options_set(o, 1, 1, 0, 0, 0.5, 0.5, mw, mh, 9999, 9999);
e_box_thaw(o_selector);
p->tab = o;
}
static int
_evry_plug_act_select_init(void)
{
@ -1312,11 +1307,11 @@ _evry_plug_act_select_actions_set(void)
Eina_List *l;
Evry_State *s = cur_state;
Evry_Plugin *p = action_selector;
_evry_plug_act_select_cleanup();
const char *type = s->cur_plugin->type_out;
EINA_LIST_FOREACH(actions, l, act)
{
if (strstr(act->type_in1, type))
@ -1345,7 +1340,7 @@ _evry_plug_act_select_fetch(const char *input)
it = E_NEW(Evry_Item, 1);
it->label = eina_stringshare_add(act->name);
it->data[0] = act;
p->items = eina_list_append(p->items, it);
}
@ -1368,7 +1363,7 @@ _evry_plug_act_select_action(Evry_Item *it, const char *input)
static void
_evry_plug_act_select_cleanup(void)
{
Evry_Item *it;
Evry_Plugin *p = action_selector;
@ -1377,10 +1372,10 @@ _evry_plug_act_select_cleanup(void)
eina_stringshare_del(it->label);
E_FREE(it);
}
eina_list_free(cur_state->cur_actions);
cur_state->cur_actions = NULL;
p->items = NULL;
}
@ -1388,10 +1383,8 @@ static void
_evry_plug_act_select_item_icon_get(Evry_Item *it, Evas *e)
{
Evry_Action *act = it->data[0];
/* if (act->icon_get)
* it->o_icon = act->icon_get(act, e); */
}

View File

@ -24,7 +24,6 @@ static Evry_Action *act;
static Inst *inst;
EAPI int
evry_plug_apps_init(void)
{
@ -48,7 +47,7 @@ evry_plug_apps_init(void)
evry_action_register(act);
inst = NULL;
return 1;
}
@ -65,7 +64,7 @@ static int
_begin(Evry_Item *it)
{
const char *mime;
if (inst) return 0;
if (it)
@ -75,14 +74,14 @@ _begin(Evry_Item *it)
p->prio = 3;
if (!it->uri) return 0;
if (!it->mime)
mime = efreet_mime_type_get(it->uri);
else
mime = it->mime;
if (!mime) return 0;
inst = E_NEW(Inst, 1);
inst->candidate = it;
inst->apps = efreet_util_desktop_mime_list(mime);
@ -92,24 +91,23 @@ _begin(Evry_Item *it)
p->name = "Applications";
p->type_out = "APPLICATION";
p->prio = 1;
inst = E_NEW(Inst, 1);
}
return 1;
}
static int
_action(Evry_Item *it, const char *input)
{
E_Zone *zone;
Evry_App *app = NULL;
Efreet_Desktop *desktop = NULL;
Efreet_Desktop *desktop = NULL;
Eina_List *files = NULL;
if (it) app = it->data[0];
if (app && app->desktop)
{
desktop = app->desktop;
@ -118,7 +116,7 @@ _action(Evry_Item *it, const char *input)
{
if (app && app->file)
input = app->file;
desktop = efreet_desktop_empty_new("");
if (strchr(input, '%'))
{
@ -148,17 +146,16 @@ _action(Evry_Item *it, const char *input)
return EVRY_ACTION_FINISHED;
}
return EVRY_ACTION_CONTINUE;
}
static void
_list_free(void)
{
Evry_Item *it;
Evry_App *app;
EINA_LIST_FREE(p->items, it)
{
if (it->label) eina_stringshare_del(it->label);
@ -178,11 +175,10 @@ _cleanup(void)
eina_list_free(inst->apps);
E_FREE(inst);
}
inst = NULL;
}
static int
_fetch(const char *input)
{
@ -191,8 +187,8 @@ _fetch(const char *input)
char *file;
char match1[4096];
char match2[4096];
_list_free();
_list_free();
if (inst->apps)
{
@ -226,24 +222,24 @@ _fetch(const char *input)
}
}
}
if (!p->items && input)
{
snprintf(match1, sizeof(match1), "%s*", input);
l = efreet_util_desktop_exec_glob_list(match1);
EINA_LIST_FREE(l, desktop)
_item_add(desktop, NULL, 1);
snprintf(match1, sizeof(match1), "*%s*", input);
l = efreet_util_desktop_name_glob_list(match1);
EINA_LIST_FREE(l, desktop)
_item_add(desktop, NULL, 2);
_item_add(desktop, NULL, 2);
// TODO make these optional/configurable
l = efreet_util_desktop_generic_name_glob_list(match1);
EINA_LIST_FREE(l, desktop)
_item_add(desktop, NULL, 3);
_item_add(desktop, NULL, 3);
l = efreet_util_desktop_comment_glob_list(match1);
EINA_LIST_FREE(l, desktop)
@ -256,20 +252,20 @@ _fetch(const char *input)
EINA_LIST_FREE(l, file)
_item_add(NULL, file, 1);
}
if (inst->added)
{
eina_hash_free(inst->added);
inst->added = NULL;
}
if (p->items)
{
if (input)
p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort);
return 1;
}
return 0;
}
@ -291,10 +287,10 @@ _item_add(Efreet_Desktop *desktop, char *file, int prio)
if (cat && !strcmp(cat, "Screensaver"))
return;
}
file = desktop->exec;
}
if (!file) return;
if (!inst->added)
@ -308,13 +304,13 @@ _item_add(Efreet_Desktop *desktop, char *file, int prio)
int len;
char *tmp;
int found = 0;
if (eina_hash_find(inst->added, file))
return;
len = strlen(file);
tmp = ecore_file_app_exe_get(file);
snprintf(match, sizeof(match), "%s*", tmp);
snprintf(match, sizeof(match), "%s*", tmp);
l = efreet_util_desktop_exec_glob_list(match);
EINA_LIST_FREE(l, desktop)
@ -342,7 +338,7 @@ _item_add(Efreet_Desktop *desktop, char *file, int prio)
eina_hash_add(inst->added, file, desktop);
file = NULL;
}
it = E_NEW(Evry_Item, 1);
app = E_NEW(Evry_App, 1);
app->desktop = desktop;
@ -362,7 +358,7 @@ static void
_item_icon_get(Evry_Item *it, Evas *e)
{
Evry_App *app = it->data[0];
if (app->desktop)
it->o_icon = e_util_desktop_icon_add(app->desktop, 24, e);
@ -381,7 +377,7 @@ _cb_sort(const void *data1, const void *data2)
Evry_App *app1, *app2;
const char *e1, *e2;
double t1, t2;
it1 = data1;
it2 = data2;
app1 = it1->data[0];
@ -397,7 +393,6 @@ _cb_sort(const void *data1, const void *data2)
return (it1->priority - it2->priority);
// TODO compare exe strings?
else return 0;
}
static int
@ -409,12 +404,12 @@ _exec_action(void)
inst->candidate = act->thing2;
_action(act->thing1, NULL);
E_FREE(inst);
inst = NULL;
return 1;
}
return 0;
}

View File

@ -1,13 +1,6 @@
#include "e.h"
#include "e_mod_main.h"
typedef struct _Inst Inst;
struct _Inst
{
E_Border *border;
};
static int _fetch(const char *input);
static int _action(Evry_Item *item, const char *input);
static void _cleanup(void);
@ -17,6 +10,7 @@ static void _item_icon_get(Evry_Item *it, Evas *e);
static Evry_Plugin *p;
EAPI int
evry_plug_border_init(void)
{
@ -31,7 +25,7 @@ evry_plug_border_init(void)
p->cleanup = &_cleanup;
p->icon_get = &_item_icon_get;
evry_plugin_register(p);
return 1;
}
@ -39,7 +33,7 @@ EAPI int
evry_plug_border_shutdown(void)
{
evry_plugin_unregister(p);
E_FREE(p);
E_FREE(p);
return 1;
}
@ -51,13 +45,13 @@ _action(Evry_Item *it, const char *input)
E_Zone *zone;
if (!it) return EVRY_ACTION_CONTINUE;
bd = (E_Border *)it->data[0];
zone = e_util_zone_current_get(e_manager_current_get());
if (bd->desk != (e_desk_current_get(zone)))
e_desk_show(bd->desk);
if (bd->shaded)
e_border_unshade(bd, E_DIRECTION_UP);
@ -68,7 +62,7 @@ _action(Evry_Item *it, const char *input)
/* e_border_focus_set(bd, 1, 1); */
e_border_focus_set_with_pointer(bd);
return EVRY_ACTION_FINISHED;
}
@ -90,24 +84,24 @@ _fetch(const char *input)
{
E_Manager *man;
E_Zone *zone;
char match1[4096];
char match2[4096];
Eina_List *list;
E_Border *bd;
E_Border_List *bl;
_cleanup();
_cleanup();
man = e_manager_current_get();
zone = e_util_zone_current_get(man);
if (input)
{
snprintf(match1, sizeof(match1), "%s*", input);
snprintf(match2, sizeof(match2), "*%s*", input);
}
bl = e_container_border_list_first(e_container_current_get(man));
while ((bd = e_container_border_list_next(bl)))
{
@ -140,21 +134,21 @@ _fetch(const char *input)
static void
_item_icon_get(Evry_Item *it, Evas *e)
{
it->o_icon = e_border_icon_add(((E_Border *)it->data[0]), e);
{
it->o_icon = e_border_icon_add(((E_Border *)it->data[0]), e);
}
static void
_item_add(E_Border *bd, int prio)
{
Evry_Item *it;
Evry_Item *it;
it = E_NEW(Evry_Item, 1);
/* e_object_ref(E_OBJECT(bd)); */
it->data[0] = bd;
it->priority = prio;
it->label = eina_stringshare_add(e_border_name_get(bd));
p->items = eina_list_append(p->items, it);
}
@ -163,7 +157,7 @@ static int
_cb_sort(const void *data1, const void *data2)
{
const Evry_Item *it1, *it2;
it1 = data1;
it2 = data2;

View File

@ -15,10 +15,10 @@ static void _cleanup(void);
static void _item_icon_get(Evry_Item *it, Evas *e);
static void _item_add(const char *label, void (*action_cb) (E_Border *bd), const char *icon);
static Evry_Plugin *p;
static Inst *inst;
EAPI int
evry_plug_border_act_init(void)
{
@ -45,9 +45,9 @@ EAPI int
evry_plug_border_act_shutdown(void)
{
evry_plugin_unregister(p);
E_FREE(p);
E_FREE(p);
E_FREE(inst);
return 1;
}
@ -81,10 +81,10 @@ _fetch(const char *input)
_cleanup();
_item_add(_("Iconify"), _act_cb_border_minimize,
"e/widgets/border/default/minimize");
"e/widgets/border/default/minimize");
_item_add(_("Close"), _act_cb_border_close,
"e/widgets/border/default/close");
"e/widgets/border/default/close");
return 1;
}
@ -114,13 +114,13 @@ _cleanup(void)
static void
_item_add(const char *label, void (*action_cb) (E_Border *bd), const char *icon)
{
Evry_Item *it;
Evry_Item *it;
it = E_NEW(Evry_Item, 1);
it->data[0] = action_cb;
it->data[1] = (void *) eina_stringshare_add(icon);
it->label = eina_stringshare_add(label);
p->items = eina_list_append(p->items, it);
p->items = eina_list_append(p->items, it);
}
static void

View File

@ -1,10 +1,10 @@
#include "e.h"
#include "e_mod_main.h"
/* TODO
* - dc support?
*/
#include "e.h"
#include "e_mod_main.h"
static int _begin(Evry_Item *it);
static int _fetch(const char *input);
static int _action(Evry_Item *item, const char *input);
@ -12,12 +12,9 @@ static void _cleanup(void);
static void _item_add(char *output, int prio);
static int _cb_sort(const void *data1, const void *data2);
static void _item_icon_get(Evry_Item *it, Evas *e);
static int _cb_data(void *data, int type, void *event);
static Evry_Plugin *p;
static Ecore_Exe *exe = NULL;
static Eina_List *history = NULL;
static Ecore_Event_Handler *data_handler = NULL;
@ -40,7 +37,7 @@ evry_plug_calc_init(void)
p->cleanup = &_cleanup;
p->icon_get = &_item_icon_get;
evry_plugin_register(p);
return 1;
}
@ -48,15 +45,15 @@ EAPI int
evry_plug_calc_shutdown(void)
{
Evry_Item *it;
EINA_LIST_FREE(p->items, it)
{
if (it->label) eina_stringshare_del(it->label);
free(it);
}
evry_plugin_unregister(p);
E_FREE(p);
E_FREE(p);
return 1;
}
@ -66,7 +63,7 @@ _begin(Evry_Item *it)
{
data_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, _cb_data, p);
exe = ecore_exe_pipe_run("bc",
ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_READ_LINE_BUFFERED |
@ -77,9 +74,10 @@ _begin(Evry_Item *it)
static void
_cleanup()
{
Evry_Item *it;
Evry_Item *it, *it2;
int i = 0;
Eina_List *l, *ll;
EINA_LIST_FREE(p->items, it)
{
if (i < 10)
@ -95,7 +93,7 @@ _cleanup()
ecore_event_handler_del(data_handler);
data_handler = NULL;
ecore_exe_quit(exe);
exe = NULL;
}
@ -116,12 +114,36 @@ _action(Evry_Item *it, const char *input)
{
if (p->items)
{
Evry_Item *it2 = p->items->data;
_item_add((char *) it2->label, 1);
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD);
Eina_List *l;
Evry_Item *it2;
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR);
/* remove duplicates */
if (p->items->next)
{
EINA_LIST_FOREACH(p->items->next, l, it2)
{
if (!strcmp(it->label, it2->label))
break;
it2 = NULL;
}
if (it2)
{
p->items = eina_list_remove(p->items, it2);
eina_stringshare_del(it2->label);
E_FREE(it2);
}
}
it = p->items->data;
_item_add((char *) it->label, 1);
}
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD);
return EVRY_ACTION_CONTINUE;
}
else
@ -150,28 +172,28 @@ _fetch(const char *input)
p->items = history;
history = NULL;
}
_send_input(input);
return 1;
}
static void
_item_icon_get(Evry_Item *it, Evas *e)
{
{
it->o_icon = NULL;
}
static void
_item_add(char *output, int prio)
{
Evry_Item *it;
Evry_Item *it;
it = E_NEW(Evry_Item, 1);
it->priority = prio;
it->label = eina_stringshare_add(output);
p->items = eina_list_prepend(p->items, it);
}
@ -180,7 +202,7 @@ _cb_data(void *data, int type, void *event)
{
Ecore_Exe_Event_Data *ev = event;
Ecore_Exe_Event_Data_Line *l;
if (data != p) return 1;
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_CLEAR);
@ -199,6 +221,6 @@ _cb_data(void *data, int type, void *event)
}
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD);
return 1;
}

View File

@ -10,6 +10,7 @@ static int _cb_sort(const void *data1, const void *data2);
static Evry_Plugin *p;
EAPI int
evry_plug_config_init(void)
{
@ -32,7 +33,7 @@ evry_plug_config_shutdown(void)
{
evry_plugin_unregister(p);
E_FREE(p);
return 1;
}
@ -47,7 +48,7 @@ _action(Evry_Item *it, const char *input)
int found = 0;
if (!it) return EVRY_ACTION_CONTINUE;
eci = it->data[0];
con = e_container_current_get(e_manager_current_get());
@ -61,15 +62,15 @@ _action(Evry_Item *it, const char *input)
{
found = 1;
snprintf(buf, sizeof(buf), "%s/%s",
ecat->cat,
ecat->cat,
eci->item);
}
}
}
if (found)
e_configure_registry_call(buf, con, NULL);
e_configure_registry_call(buf, con, NULL);
return EVRY_ACTION_FINISHED;
}
@ -90,14 +91,14 @@ _fetch(const char *input)
{
E_Manager *man;
E_Zone *zone;
char match1[4096];
char match2[4096];
Eina_List *l, *ll;
E_Configure_Cat *ecat;
E_Configure_It *eci;
_cleanup();
_cleanup();
snprintf(match1, sizeof(match1), "%s*", input);
snprintf(match2, sizeof(match2), "*%s*", input);
@ -124,7 +125,7 @@ _fetch(const char *input)
}
}
}
if (eina_list_count(p->items) > 0)
{
p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort);
@ -139,8 +140,8 @@ _item_icon_get(Evry_Item *it, Evas *e)
{
E_Configure_It *eci = it->data[0];
Evas_Object *o = NULL;
if (eci->icon)
if (eci->icon)
{
o = e_icon_add(e);
if (!e_util_icon_theme_set(o, eci->icon))
@ -156,14 +157,14 @@ _item_icon_get(Evry_Item *it, Evas *e)
static void
_item_add(E_Configure_It *eci, int prio)
{
Evry_Item *it;
Evry_Item *it;
it = E_NEW(Evry_Item, 1);
it->data[0] = eci;
it->priority = prio;
it->label = eina_stringshare_add(eci->label);
it->o_icon = NULL;
it->o_icon = NULL;
p->items = eina_list_append(p->items, it);
}
@ -171,11 +172,11 @@ static int
_cb_sort(const void *data1, const void *data2)
{
const Evry_Item *it1, *it2;
it1 = data1;
it2 = data2;
/* TODO sort by name? */
return (it1->priority - it2->priority);
}

View File

@ -21,6 +21,7 @@ static Evry_Item *_item_fill(const char *directory, const char *file);
static Evry_Plugin *p;
static Eina_List *stack = NULL;
EAPI int
evry_plug_dir_browse_init(void)
{
@ -45,7 +46,7 @@ evry_plug_dir_browse_shutdown(void)
{
evry_plugin_unregister(p);
E_FREE(p);
return 1;
}
@ -53,30 +54,30 @@ static int
_begin(Evry_Item *it)
{
State *s;
if (it)
{
if (!it->uri || !ecore_file_is_dir(it->uri))
return 0;
s = E_NEW(State, 1);
s = E_NEW(State, 1);
s->directory = eina_stringshare_add(it->uri);
}
else
{
s = E_NEW(State, 1);
s->directory = eina_stringshare_add(e_user_homedir_get());
s = E_NEW(State, 1);
s->directory = eina_stringshare_add(e_user_homedir_get());
}
stack = eina_list_prepend(stack, s);
p->items = NULL;
return 1;
}
static int
_action(Evry_Item *it, const char *input)
{
{
return EVRY_ACTION_OTHER;
}
@ -95,20 +96,19 @@ _list_free()
}
}
static void
_cleanup()
{
State *s;
if (!stack) return;
s = stack->data;
_list_free();
eina_stringshare_del(s->directory);
E_FREE(s);
stack = eina_list_remove_list(stack, stack);
@ -130,9 +130,9 @@ _fetch(const char *input)
char match1[4096];
char match2[4096];
State *s = stack->data;
_list_free();
files = ecore_file_ls(s->directory);
if (input)
@ -144,13 +144,13 @@ _fetch(const char *input)
EINA_LIST_FREE(files, file)
{
it = NULL;
if (file[0] == '.')
{
free(file);
continue;
}
if (input)
{
if (e_util_glob_case_match(file, match1))
@ -167,7 +167,7 @@ _fetch(const char *input)
{
it = _item_fill(s->directory, file);
}
if (it)
p->items = eina_list_append(p->items, it);
@ -179,7 +179,7 @@ _fetch(const char *input)
p->items = eina_list_sort(p->items, eina_list_count(p->items),
_cb_sort);
s->items = p->items;
return 1;
}
@ -197,7 +197,7 @@ _item_fill(const char *directory, const char *file)
it = E_NEW(Evry_Item, 1);
snprintf(buf, sizeof(buf), "%s/%s", directory, file);
if ((e_util_glob_case_match(file, "*.desktop")) ||
(e_util_glob_case_match(file, "*.directory")))
{
@ -214,7 +214,7 @@ _item_fill(const char *directory, const char *file)
file_path = eina_stringshare_add(buf);
it->uri = file_path;
mime = efreet_mime_globs_type_get(file_path);
if (mime)
{
@ -231,12 +231,12 @@ _item_fill(const char *directory, const char *file)
it->mime = eina_stringshare_add(mime);
it->priority = 0;
}
else
else
{
it->mime = eina_stringshare_add("None");
it->priority = 0;
}
return it;
}
@ -246,7 +246,7 @@ _item_icon_get(Evry_Item *it, Evas *e)
char *item_path;
if (!it->mime) return;
if (!strcmp(it->mime, "Folder"))
{
it->o_icon = edje_object_add(e);
@ -270,11 +270,11 @@ static int
_cb_sort(const void *data1, const void *data2)
{
const Evry_Item *it1, *it2;
it1 = data1;
it2 = data2;
if (it2->priority - it1->priority)
if (it2->priority - it1->priority)
return (it2->priority - it1->priority);
else
return strcasecmp(it1->label, it2->label);