Evry_Plugin *plugin;
int ref;
void (*free) (Evry_Item *item);
+ double usage;
};
struct _Evry_Item_App
Evas_Object *(*icon_get) (Evry_Plugin *p, const Evry_Item *it, Evas *e);
/* provide more information for a candidate */
/* int (*candidate_info) (Evas *evas, Evry_Item *item); */
-
+ const char *(*item_id) (Evry_Plugin *p, const Evry_Item *it);
+
/* optional: default action for this plugins items */
int (*action) (Evry_Plugin *p, const Evry_Item *item);
#include "e_mod_main.h"
-#define CONFIG_VERSION 3
+#define CONFIG_VERSION 5
+#define HISTORY_VERSION 1
/* actual module specifics */
-static void _e_mod_action_exebuf_cb(E_Object *obj, const char *params);
+static void _e_mod_action_cb(E_Object *obj, const char *params);
static int _e_mod_run_defer_cb(void *data);
static void _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_mod_menu_add(void *data, E_Menu *m);
+static void _config_init(void);
+static void _config_free(void);
+static void _history_init(void);
+static void _history_free(void);
static E_Int_Menu_Augmentation *maug = NULL;
static E_Action *act = NULL;
static Eina_Array *plugins = NULL;
static E_Config_DD *conf_edd = NULL;
static E_Config_DD *conf_item_edd = NULL;
+static E_Config_DD *hist_entry_edd = NULL;
+static E_Config_DD *hist_item_edd = NULL;
+static E_Config_DD *hist_edd = NULL;
+
Config *evry_conf = NULL;
+History *evry_hist = NULL;
/* module setup */
EAPI E_Module_Api e_modapi =
"Everything"
};
-
static Eina_Bool list_cb(Eina_Module *m, void *data)
{
if (eina_module_load(m))
char *file;
E_Action *act;
- snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/module.everything",
- e_user_homedir_get(), e_config_profile_get());
- ecore_file_mkdir(buf);
-
- conf_item_edd = E_CONFIG_DD_NEW("Plugin_Config", Plugin_Config);
-#undef T
-#undef D
-#define T Plugin_Config
-#define D conf_item_edd
- E_CONFIG_VAL(D, T, name, STR);
- E_CONFIG_VAL(D, T, trigger, STR);
- E_CONFIG_VAL(D, T, min_query, INT);
- E_CONFIG_VAL(D, T, loaded, INT);
- E_CONFIG_VAL(D, T, enabled, INT);
- E_CONFIG_VAL(D, T, priority, INT);
- conf_edd = E_CONFIG_DD_NEW("Config", Config);
-#undef T
-#undef D
-#define T Config
-#define D conf_edd
- E_CONFIG_VAL(D, T, version, INT);
- E_CONFIG_VAL(D, T, width, INT);
- E_CONFIG_VAL(D, T, height, INT);
- E_CONFIG_VAL(D, T, rel_x, DOUBLE);
- E_CONFIG_VAL(D, T, rel_y, DOUBLE);
- E_CONFIG_VAL(D, T, scroll_animate, INT);
- E_CONFIG_VAL(D, T, scroll_speed, DOUBLE);
- E_CONFIG_VAL(D, T, hide_input, INT);
- E_CONFIG_VAL(D, T, hide_list, INT);
- E_CONFIG_VAL(D, T, quick_nav, INT);
- E_CONFIG_LIST(D, T, conf_subjects, conf_item_edd);
- E_CONFIG_LIST(D, T, conf_actions, conf_item_edd);
- E_CONFIG_LIST(D, T, conf_objects, conf_item_edd);
- E_CONFIG_LIST(D, T, conf_views, conf_item_edd);
-#undef T
-#undef D
- evry_conf = e_config_domain_load("module.everything", conf_edd);
-
- if (!evry_conf || (evry_conf->version != CONFIG_VERSION))
- {
- evry_conf = E_NEW(Config, 1);
- evry_conf->version = CONFIG_VERSION;
- evry_conf->rel_x = 50.0;
- evry_conf->rel_y = 50.0;
- evry_conf->width = 400;
- evry_conf->height = 350;
- evry_conf->scroll_animate = 0;
- evry_conf->scroll_speed = 0.08;
- evry_conf->hide_input = 0;
- evry_conf->hide_list = 1;
- evry_conf->quick_nav = 1;
- evry_conf->conf_subjects = NULL;
- evry_conf->conf_actions = NULL;
- evry_conf->conf_objects = NULL;
- evry_conf->conf_views = NULL;
- }
+ /* snprintf(buf, sizeof(buf), "%s/.e/e/config/%s/module.everything",
+ * e_user_homedir_get(), e_config_profile_get());
+ * ecore_file_mkdir(buf); */
+ _config_init();
+ _history_init();
+
/* search for plugins */
eina_module_init();
- snprintf(dir, sizeof(dir), "%s/enlightenment/everything_plugins", e_prefix_lib_get());
+ snprintf(dir, sizeof(dir), "%s/enlightenment/everything_plugins",
+ e_prefix_lib_get());
files = ecore_file_ls(dir);
EINA_LIST_FREE(files, file)
act = e_action_add("everything");
if (act)
{
- act->func.go = _e_mod_action_exebuf_cb;
+ act->func.go = _e_mod_action_cb;
+ e_action_predef_name_set(_("Everything"),
+ _("Show Everything Dialog"),
+ "everything", "", NULL, 0);
}
- e_action_predef_name_set(_("Everything"), _("Show Everything Dialog"),
- "everything", "", NULL, 0);
-
- maug = e_int_menus_menu_augmentation_add("main/1", _e_mod_menu_add, NULL, NULL, NULL);
+ maug = e_int_menus_menu_augmentation_add("main/1",
+ _e_mod_menu_add,
+ NULL, NULL, NULL);
e_configure_registry_category_add("extensions", 80, _("Extensions"),
NULL, "preferences-extensions");
- e_configure_registry_item_add("extensions/run_everything", 40, _("Run Everything"),
- NULL, "system-run", evry_config_dialog);
-
+ e_configure_registry_item_add("extensions/run_everything", 40,
+ _("Run Everything"),
+ NULL, "system-run",
+ evry_config_dialog);
evry_init();
e_module_delayed_set(m, 1);
e_modapi_shutdown(E_Module *m __UNUSED__)
{
E_Config_Dialog *cfd;
-
+
evry_shutdown();
/* remove module-supplied menu additions */
e_configure_registry_item_del("extensions/run_everything");
e_configure_registry_category_del("extensions");
- if (evry_conf->plugins) eina_list_free(evry_conf->plugins);
- if (evry_conf->actions) eina_list_free(evry_conf->actions);
- if (evry_conf->conf_subjects) eina_list_free(evry_conf->conf_subjects);
- if (evry_conf->conf_actions) eina_list_free(evry_conf->conf_actions);
- if (evry_conf->conf_objects) eina_list_free(evry_conf->conf_objects);
-
- E_FREE(evry_conf);
+ _config_free();
+ _history_free();
/* Clean EET */
E_CONFIG_DD_FREE(conf_item_edd);
E_CONFIG_DD_FREE(conf_edd);
+ E_CONFIG_DD_FREE(hist_item_edd);
+ E_CONFIG_DD_FREE(hist_entry_edd);
+ E_CONFIG_DD_FREE(hist_edd);
return 1;
}
e_modapi_save(E_Module *m __UNUSED__)
{
e_config_domain_save("module.everything", conf_edd, evry_conf);
+
+ return 1;
+}
+
+void
+evry_save_history(void)
+{
+ e_config_domain_save("module.everything.history", hist_edd, evry_hist);
+}
+
+
+static void
+_config_init()
+{
+#undef T
+#undef D
+#define T Plugin_Config
+#define D conf_item_edd
+ conf_item_edd = E_CONFIG_DD_NEW("Plugin_Config", Plugin_Config);
+ E_CONFIG_VAL(D, T, name, STR);
+ E_CONFIG_VAL(D, T, trigger, STR);
+ E_CONFIG_VAL(D, T, min_query, INT);
+ E_CONFIG_VAL(D, T, loaded, INT);
+ E_CONFIG_VAL(D, T, enabled, INT);
+ E_CONFIG_VAL(D, T, priority, INT);
+#undef T
+#undef D
+
+#define T Config
+#define D conf_edd
+ conf_edd = E_CONFIG_DD_NEW("Config", Config);
+ E_CONFIG_VAL(D, T, version, INT);
+ E_CONFIG_VAL(D, T, width, INT);
+ E_CONFIG_VAL(D, T, height, INT);
+ E_CONFIG_VAL(D, T, rel_x, DOUBLE);
+ E_CONFIG_VAL(D, T, rel_y, DOUBLE);
+ E_CONFIG_VAL(D, T, scroll_animate, INT);
+ E_CONFIG_VAL(D, T, scroll_speed, DOUBLE);
+ E_CONFIG_VAL(D, T, hide_input, INT);
+ E_CONFIG_VAL(D, T, hide_list, INT);
+ E_CONFIG_VAL(D, T, quick_nav, INT);
+ E_CONFIG_VAL(D, T, cmd_terminal, STR);
+ E_CONFIG_LIST(D, T, conf_subjects, conf_item_edd);
+ E_CONFIG_LIST(D, T, conf_actions, conf_item_edd);
+ E_CONFIG_LIST(D, T, conf_objects, conf_item_edd);
+ E_CONFIG_LIST(D, T, conf_views, conf_item_edd);
+#undef T
+#undef D
+ evry_conf = e_config_domain_load("module.everything", conf_edd);
+
+ if (evry_conf && evry_conf->version != CONFIG_VERSION)
+ {
+ _config_free();
+ evry_conf = NULL;
+ }
+
+ if (!evry_conf)
+ {
+ evry_conf = E_NEW(Config, 1);
+ evry_conf->version = CONFIG_VERSION;
+ evry_conf->rel_x = 50.0;
+ evry_conf->rel_y = 50.0;
+ evry_conf->width = 400;
+ evry_conf->height = 350;
+ evry_conf->scroll_animate = 0;
+ evry_conf->scroll_speed = 0.08;
+ evry_conf->hide_input = 0;
+ evry_conf->hide_list = 1;
+ evry_conf->quick_nav = 1;
+ evry_conf->conf_subjects = NULL;
+ evry_conf->conf_actions = NULL;
+ evry_conf->conf_objects = NULL;
+ evry_conf->conf_views = NULL;
+ evry_conf->cmd_terminal = eina_stringshare_add("/usr/bin/xterm");
+ }
+}
+
+
+static void
+_config_free(void)
+{
+ Plugin_Config *pc;
+
+ /* free config */
+ if (evry_conf->cmd_terminal)
+ eina_stringshare_del(evry_conf->cmd_terminal);
+ EINA_LIST_FREE(evry_conf->conf_subjects, pc)
+ {
+ if (pc->name) eina_stringshare_del(pc->name);
+ if (pc->trigger) eina_stringshare_del(pc->trigger);
+ E_FREE(pc);
+ }
+ EINA_LIST_FREE(evry_conf->conf_actions, pc)
+ {
+ if (pc->name) eina_stringshare_del(pc->name);
+ if (pc->trigger) eina_stringshare_del(pc->trigger);
+ E_FREE(pc);
+ }
+ EINA_LIST_FREE(evry_conf->conf_objects, pc)
+ {
+ if (pc->name) eina_stringshare_del(pc->name);
+ if (pc->trigger) eina_stringshare_del(pc->trigger);
+ E_FREE(pc);
+ }
+ E_FREE(evry_conf);
+}
+
+
+static void
+_history_init(void)
+{
+#undef T
+#undef D
+#define T History_Item
+#define D hist_item_edd
+ hist_item_edd = E_CONFIG_DD_NEW("History_Item", History_Item);
+ E_CONFIG_VAL(D, T, plugin, STR);
+ E_CONFIG_VAL(D, T, context, STR);
+ E_CONFIG_VAL(D, T, input, STR);
+ E_CONFIG_VAL(D, T, last_used, DOUBLE);
+ E_CONFIG_VAL(D, T, count, INT);
+#undef T
+#undef D
+
+#define T History_Entry
+#define D hist_entry_edd
+ hist_entry_edd = E_CONFIG_DD_NEW("History_Entry", History_Entry);
+ E_CONFIG_LIST(D, T, items, hist_item_edd);
+#undef T
+#undef D
+
+#define T History
+#define D hist_edd
+ hist_edd = E_CONFIG_DD_NEW("History_Item", History);
+ E_CONFIG_VAL(D, T, version, INT);
+ E_CONFIG_HASH(D, T, subjects, hist_entry_edd);
+ E_CONFIG_HASH(D, T, actions, hist_entry_edd);
+#undef T
+#undef D
+ evry_hist = e_config_domain_load("module.everything.history", hist_edd);
+
+ if (evry_hist && evry_hist->version != HISTORY_VERSION)
+ {
+ _history_free();
+ evry_hist = NULL;
+ }
+
+ if (!evry_hist)
+ {
+ evry_hist = E_NEW(History, 1);
+ evry_hist->version = HISTORY_VERSION;
+
+ }
+ if (!evry_hist->subjects)
+ evry_hist->subjects = eina_hash_string_superfast_new(NULL);
+ if (!evry_hist->actions)
+ evry_hist->actions = eina_hash_string_superfast_new(NULL);
+
+}
+
+static Eina_Bool
+_hist_free_cb(const Eina_Hash *hash, const void *key, void *data, void *fdata)
+{
+ History_Entry *he = data;
+ History_Item *hi;
+
+ EINA_LIST_FREE(he->items, hi)
+ {
+ 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);
+ }
+
+ E_FREE(he);
return 1;
}
+static void
+_history_free(void)
+{
+ eina_hash_foreach(evry_hist->subjects, _hist_free_cb, NULL);
+ eina_hash_foreach(evry_hist->actions, _hist_free_cb, NULL);
+
+ E_FREE(evry_hist);
+}
+
+
/* action callback */
static void
-_e_mod_action_exebuf_cb(E_Object *obj, const char *params)
+_e_mod_action_cb(E_Object *obj, const char *params)
{
E_Zone *zone = NULL;
if (p->trigger) eina_stringshare_del(p->trigger);
if (p->icon) eina_stringshare_del(p->icon);
- if (p->config)
- {
- if (p->type == type_subject)
- evry_conf->conf_subjects = eina_list_remove(evry_conf->conf_subjects, p->config);
- else if (p->type == type_action)
- evry_conf->conf_actions = eina_list_remove(evry_conf->conf_actions, p->config);
- else if (p->type == type_object)
- evry_conf->conf_objects = eina_list_remove(evry_conf->conf_objects, p->config);
-
- if (p->config->name)
- eina_stringshare_del(p->config->name);
- if (p->config->trigger)
- eina_stringshare_del(p->config->trigger);
-
- E_FREE(p->config);
- }
-
if (free_pointer)
E_FREE(p);
}
{
Eina_List *l, *confs = NULL;
Plugin_Config *pc;
- Eina_Bool found = 0;
evry_conf->plugins = eina_list_append(evry_conf->plugins, p);
confs = evry_conf->conf_objects;
EINA_LIST_FOREACH(confs, l, pc)
- {
- if (pc->name && p->name && !strcmp(pc->name, p->name))
- {
- found = 1;
- break;
- }
- }
+ if (pc->name && p->name && !strcmp(pc->name, p->name))
+ break;
- if (!found)
+ if (!pc)
{
pc = E_NEW(Plugin_Config, 1);
pc->name = eina_stringshare_add(p->name);
* pc->trigger = eina_stringshare_add(plugin->trigger); */
p->config = pc;
-
evry_conf->plugins = eina_list_sort(evry_conf->plugins,
eina_list_count(evry_conf->plugins),
_evry_cb_plugin_sort);
e_action_predef_name_set(_("Everything"), buf,
"everything", p->name, NULL, 1);
}
- /* TODO sorting, initialization, etc */
}
void
typedef struct _Config Config;
typedef struct _Evry_Selector Evry_Selector;
typedef struct _Tab_View Tab_View;
+typedef struct _History History;
+typedef struct _History_Entry History_Entry;
+typedef struct _History_Item History_Item;
struct _Config
{
int hide_list;
int quick_nav;
-
- Eina_Hash *key_bindings;
-
- /**/
+
Eina_List *plugins;
Eina_List *actions;
Eina_List *views;
- Eina_Hash *history;
+ const char *cmd_terminal;
};
+
+
+struct _History_Item
+{
+ const char *plugin;
+ const char *context;
+ const char *input;
+ double last_used;
+ int count;
+};
+
+struct _History_Entry
+{
+ Eina_List *items;
+};
+
+struct _History
+{
+ int version;
+ Eina_Hash *subjects;
+ Eina_Hash *actions;
+};
+
+
struct _Evry_Selector
{
Evas_Object *o_main;
Evas_Object *o_thumb;
Eina_Bool do_thumb;
+
+ Eina_Hash *history;
};
struct _Tab_View
int evry_shutdown(void);
int evry_show(E_Zone *zone, const char *params);
void evry_hide(void);
+void evry_save_history(void);
Evry_Plugin *evry_plug_aggregator_new(Evry_Selector *selector);
void evry_plug_aggregator_free(Evry_Plugin *plugin);
EAPI void evry_tab_view_free(Tab_View *v);
extern Config *evry_conf;
+extern History *evry_hist;
extern Evry_Selector **selectors;
extern Evry_Plugin *action_selector;
#endif
static int _evry_cb_key_down(void *data, int type, void *event);
static int _evry_cb_selection_notify(void *data, int type, void *event);
+static void _evry_history_item_add(Eina_Hash *hist, Evry_State *s);
+
/* local subsystem globals */
static Evry_Window *win = NULL;
if (!evry_conf->hide_input)
edje_object_signal_emit(list->o_main, "e,state,entry_show", "e");
-
+
handlers = eina_list_append
(handlers, ecore_event_handler_add
(ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL));
e_popup_show(win->popup);
e_popup_show(list->popup);
+ 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:");
+ }
+
return 1;
error:
}
/* update aggregator */
- if (eina_list_count(s->cur_plugins) > 1)
+ if (eina_list_count(s->cur_plugins) > 0)
{
agg->fetch(agg, s->input);
return NULL;
}
list_win->popup = popup;
-
- /* evas_event_freeze(popup->evas);
- * evas_event_feed_mouse_in(popup->evas, ecore_x_current_time_get(), NULL);
- * evas_event_feed_mouse_move(popup->evas, -1000000, -1000000,
- * ecore_x_current_time_get(), NULL); */
-
+
o = edje_object_add(popup->evas);
list_win->o_main = o;
e_theme_edje_object_set(o, "base/theme/everything",
edje_object_size_min_calc(o, &mw, &mh);
- printf("list min size %d %d - %d\n", mw, mh, atoi(offset_y));
-
-
if (mh == 0) mh = 200;
if (mw == 0) mw = win->popup->w / 2;
evas_object_resize(o, list_win->popup->w, list_win->popup->h);
evas_object_show(o);
e_popup_edje_bg_object_set(popup, o);
-
- /* evas_event_thaw(popup->evas); */
-
+
return list_win;
}
evas_object_show(o);
if (type == type_subject)
- edje_object_part_swallow(win->o_main, "e.swallow.subject_selector", o);
+ {
+ sel->history = evry_hist->subjects;
+ edje_object_part_swallow(win->o_main, "e.swallow.subject_selector", o);
+ }
else if (type == type_action)
- edje_object_part_swallow(win->o_main, "e.swallow.action_selector", o);
+ {
+ sel->history = evry_hist->actions;
+ edje_object_part_swallow(win->o_main, "e.swallow.action_selector", o);
+ }
+
else if (type == type_object)
- edje_object_part_swallow(win->o_main, "e.swallow.object_selector", o);
-
+ {
+ sel->history = evry_hist->subjects;
+ edje_object_part_swallow(win->o_main, "e.swallow.object_selector", o);
+ }
+
p = evry_plug_aggregator_new(sel);
sel->plugins = eina_list_append(sel->plugins, p);
if (!plugins) return 1;
+ _evry_history_item_add(sel->history, s);
+
if (s->view)
{
_evry_view_hide(s->view);
return 0;
}
+static void
+_evry_history_item_add(Eina_Hash *hist, Evry_State *s)
+{
+ History_Entry *he;
+ History_Item *hi;
+ Evry_Item *it;
+ Eina_List *l;
+ const char *id;
+
+ if (!s) return;
+
+ it = s->cur_item;
+ if (!it) return;
+
+ if (it->plugin->item_id)
+ id = it->plugin->item_id(it->plugin, it);
+ else
+ id = it->label;
+
+ he = eina_hash_find(hist, id);
+ if (he)
+ {
+ /* found history entry */
+ EINA_LIST_FOREACH(he->items, l, hi)
+ if (hi->plugin == it->plugin->name) break;
+
+ if (hi)
+ {
+ /* found history item */
+ if (hi->input)
+ {
+ if (!s->input || !strncmp (hi->input, s->input, strlen(s->input)))
+ {
+ /* s->input matches hi->input and is equal or shorter */
+ hi->count++;
+ hi->last_used /= 1000.0;
+ hi->last_used += ecore_time_get();
+ }
+ else if (s->input)
+ {
+ if (!strncmp (hi->input, s->input, strlen(hi->input)))
+ {
+ /* s->input matches hi->input but is longer */
+ eina_stringshare_del(hi->input);
+ hi->input = eina_stringshare_add(s->input);
+ }
+ else
+ {
+ /* s->input is different from hi->input
+ -> create new item */
+ hi = NULL;
+ }
+ }
+ }
+ else
+ {
+ /* remember input for item */
+ hi->count++;
+ hi->last_used /= 2.0;
+ hi->last_used += ecore_time_get();
+
+ if (s->input)
+ hi->input = eina_stringshare_add(s->input);
+ }
+ }
+
+ if (!hi)
+ {
+ hi = E_NEW(History_Item, 1);
+ hi->plugin = eina_stringshare_ref(it->plugin->name);
+ hi->last_used = ecore_time_get();
+ hi->count = 1;
+ if (s->input)
+ hi->input = eina_stringshare_add(s->input);
+
+ he->items = eina_list_append(he->items, hi);
+ }
+ }
+ else
+ {
+ he = E_NEW(History_Entry, 1);
+ hi = E_NEW(History_Item, 1);
+ hi->plugin = eina_stringshare_ref(it->plugin->name);
+ hi->last_used = ecore_time_get();
+ hi->count = 1;
+ if (s->input)
+ hi->input = eina_stringshare_add(s->input);
+
+ he->items = eina_list_append(he->items, hi);
+ eina_hash_add(hist, id, he);
+ }
+ evry_save_history();
+
+}
+
+
static void
_evry_plugin_action(Evry_Selector *sel, int finished)
{
s_action = selectors[1]->state;
s_object = NULL;
- if (!s_subject || !s_action) return;
+ if (!s_subject || !s_action)
+ return;
if (update_timer)
{
update_timer = NULL;
}
- if (!s_subject->cur_item || !s_action->cur_item) return;
+ if (!s_subject->cur_item || !s_action->cur_item)
+ return;
if (s_action->cur_item->plugin == action_selector)
{
if (selectors[2] == selector)
it_object = selector->state->cur_item;
- if (act->type_in2 && !it_object) return;
+ if (act->type_in2 && !it_object)
+ return;
act->item2 = it_object;
}
else return;
+ _evry_history_item_add(evry_hist->subjects, s_subject);
+ _evry_history_item_add(evry_hist->actions, s_action);
+ _evry_history_item_add(evry_hist->subjects, s_object);
+
+
/* let subject and object plugin know that an action was performed */
if (s_subject->plugin->action)
s_subject->plugin->action(s_subject->plugin, s_subject->cur_item);
}
}
- if (eina_list_count(s->cur_plugins) > 1)
+ if (eina_list_count(s->cur_plugins) > 0)
{
sel->aggregator->fetch(sel->aggregator, s->input);
s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator);
int width, height;
int scroll_animate;
+ char *cmd_terminal;
+
Evas_Object *l_subject;
Evas_Object *l_action;
Evas_Object *l_object;
cfdata->p_action = eina_list_append(cfdata->p_action, p);
else if (p->type == type_object)
cfdata->p_object = eina_list_append(cfdata->p_object, p);
+
+ if (evry_conf->cmd_terminal)
+ cfdata->cmd_terminal = strdup(evry_conf->cmd_terminal);
}
static void *
if (cfdata->p_subject) eina_list_free(cfdata->p_subject);
if (cfdata->p_action) eina_list_free(cfdata->p_action);
if (cfdata->p_object) eina_list_free(cfdata->p_object);
-
+ E_FREE(cfdata->cmd_terminal);
E_FREE(cfdata);
}
eina_list_count(evry_conf->plugins),
_evry_cb_plugin_sort);
+ if (evry_conf->cmd_terminal)
+ eina_stringshare_del(evry_conf->cmd_terminal);
+ evry_conf->cmd_terminal = eina_stringshare_add(cfdata->cmd_terminal);
+
e_config_save_queue();
return 1;
}
ob = e_widget_check_add(evas, _("Quick Navigation (ALT + h,j,k,l,n,p,m,i)"),
&(cfdata->quick_nav));
e_widget_framelist_object_append(of, ob);
- e_widget_list_object_append(o, of, 1, 1, 0.5);
+ ob = e_widget_label_add(evas, _("Terminal Command"));
+ e_widget_framelist_object_append(of, ob);
+ ob = e_widget_entry_add(evas, &(cfdata->cmd_terminal), NULL, NULL, NULL);
+ e_widget_framelist_object_append(of, ob);
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+
/* ob = e_widget_label_add(evas, _("Popup Width"));
* e_widget_framelist_object_append(of, ob);
* ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"),
e_widget_toolbook_page_append(otb, NULL, _("General Settings"),
- o, 0, 0, 0, 0, 0.5, 0.0);
+ o, 1, 0, 1, 0, 0.5, 0.0);
ob = e_widget_list_add(evas, 1, 1);
- of = e_widget_framelist_add(evas, _("Subject Plugins"), 0);
+ of = e_widget_framelist_add(evas, _("Active Plugins"), 0);
o = e_widget_ilist_add(evas, 24, 24, NULL);
cfdata->l_subject = o;
/* e_widget_on_change_hook_set(ol, _avail_list_cb_change, cfdata); */
cfdata->p_subject);
e_widget_framelist_object_append(of, o);
e_widget_list_object_append(ob, of, 1, 1, 0.5);
+ e_widget_toolbook_page_append(otb, NULL, _("Subject Plugins"),
+ of, 1, 0, 1, 0, 0.5, 0.0);
+
- of = e_widget_framelist_add(evas, _("Action Plugins"), 0);
+ ob = e_widget_list_add(evas, 1, 1);
+ of = e_widget_framelist_add(evas, _("Active Plugins"), 0);
o = e_widget_ilist_add(evas, 24, 24, NULL);
cfdata->l_action = o;
_fill_list(cfdata->p_action, o, 0);
cfdata->p_action);
e_widget_framelist_object_append(of, o);
e_widget_list_object_append(ob, of, 1, 1, 0.5);
+ e_widget_toolbook_page_append(otb, NULL, _("Action Plugins"),
+ of, 1, 0, 1, 0, 0.5, 0.0);
- of = e_widget_framelist_add(evas, _("Object Plugins"), 0);
+ ob = e_widget_list_add(evas, 1, 1);
+ of = e_widget_framelist_add(evas, _("Active Plugins"), 0);
o = e_widget_ilist_add(evas, 24, 24, NULL);
cfdata->l_object = o;
_fill_list(cfdata->p_object, o, 0);
e_widget_framelist_object_append(of, o);
e_widget_list_object_append(ob, of, 1, 1, 0.5);
- e_widget_toolbook_page_append(otb, NULL, _("Plugins"),
- ob, 0, 0, 0, 0, 0.5, 0.0);
- e_widget_toolbook_page_show(otb, 1);
+ e_widget_toolbook_page_append(otb, NULL, _("Object Plugins"),
+ ob, 1, 0, 1, 0, 0.5, 0.0);
+
+ e_widget_toolbook_page_show(otb, 0);
return otb;
}
const Evry_Item *it1 = data1;
const Evry_Item *it2 = data2;
+ if (it1->usage && it2->usage)
+ return (it2->usage - it1->usage);
+ if (it1->usage && !it2->usage)
+ return -1;
+ if (it2->usage && !it1->usage)
+ return 1;
+
if ((it1->plugin == action_selector) ||
(it2->plugin == action_selector))
{
- it2->plugin->config->priority);
else
return (it1->plugin->config->priority -
- (it1->plugin->config->priority + it2->priority));
+ (it2->plugin->config->priority + it2->priority));
}
return -1;
const Evry_Item *it1 = data1;
const Evry_Item *it2 = data2;
+ if (it1->usage && it2->usage)
+ return (it2->usage - it1->usage);
+ if (it1->usage && !it2->usage)
+ return -1;
+ if (it2->usage && !it1->usage)
+ return 1;
+
if ((it1->plugin == action_selector) ||
(it2->plugin == action_selector))
{
Evry_Item *it;
int cnt = 0;
Eina_List *items = NULL;
+ History_Entry *he;
+ History_Item *hi;
+ const char *id;
s = p->selector->state;
}
}
- if (!input[0] || eina_list_count(items) < 20)
+ if (!input[0] || eina_list_count(items) < 50)
{
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
{
- for (cnt = 0, ll = pp->items; ll && cnt < 15; ll = ll->next, cnt++)
+ for (cnt = 0, ll = pp->items; ll && cnt < 50; ll = ll->next, cnt++)
{
if (!items || !eina_list_data_find_list(items, ll->data))
{
}
if (items) eina_list_free(items);
+
+ EINA_LIST_FOREACH(EVRY_PLUGIN(p)->items, l, it)
+ {
+ cnt = 1;
+ if (it->usage) continue;
+
+ if (it->plugin->item_id)
+ id = it->plugin->item_id(it->plugin, it);
+ else
+ id = it->label;
+ if ((he = eina_hash_find(p->selector->history, id)))
+ {
+ EINA_LIST_FOREACH(he->items, ll, hi)
+ {
+ if ((hi->plugin == it->plugin->name) &&
+ ((!input[0]) || (!input[0] && !hi->input) ||
+ (!strncmp(input, hi->input, strlen(input))) ||
+ (!strncmp(input, hi->input, strlen(hi->input)))))
+ {
+ cnt++;
+ it->usage += hi->last_used;
+ }
+ }
+ it->usage /= (double)cnt;
+ }
+ }
+
if (input[0])
{
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
evas_object_show(o);
e_box_pack_end(v->o_tabs, o);
- e_box_pack_options_set(o, 1, 1, 1, 0, 0.0, 0.5,
- (tab->mw < tab->cw ? tab->cw : tab->mw), 10,
- (w ? w/3 : 150), 9999);
+ if (eina_list_count(s->cur_plugins) == 2)
+ e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5,
+ 120, 10, 120, 9999);
+ else
+ e_box_pack_options_set(o, 1, 1, 1, 0, 0.0, 0.5,
+ (tab->mw < tab->cw ? tab->cw : tab->mw), 10,
+ (w ? w/3 : 120), 9999);
if (s->plugin == p)
edje_object_signal_emit(o, "e,state,selected", "e");
else
Eina_List *apps_mime;
Eina_List *apps_all;
const Evry_Item *candidate;
+ Eina_Hash *added;
};
/* taken from exebuf module */
p->apps_mime = eina_list_prepend(p->apps_mime, desktop);
}
+ p->added = added;
+ if (!p->added)
+ p->added = eina_hash_string_small_new(_hash_free);
+ added = p->added;
+
return plugin;
}
static Evry_Plugin *
_begin(Evry_Plugin *plugin, const Evry_Item *item)
{
+ PLUGIN(p, plugin);
+
/* taken from exebuf module */
char *path, *pp, *last;
E_Exe_List *el;
exe_scan_idler = ecore_idler_add(_scan_idler, NULL);
- added = eina_hash_string_small_new(_hash_free);
+ p->added = eina_hash_string_small_new(_hash_free);
return plugin;
}
Efreet_Desktop *desktop;
char *str;
+ /* TODO popup end func !!!
+ - cleanup hash for open-with plugin */
eina_hash_free(added);
+ added = NULL;
+
+ eina_hash_free(p->added);
EVRY_PLUGIN_ITEMS_CLEAR(p);
char buf[1024];
char *tmp;
- if ((app = eina_hash_find(added, file)))
+ if ((app = eina_hash_find(p->added, file)))
{
if (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app))
{
if (!exe) return 0;
- if ((app = eina_hash_find(added, exe)) &&
+ if ((app = eina_hash_find(p->added, exe)) &&
(!desktop || (desktop == app->desktop)))
{
if (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app))
app->desktop = desktop;
if (file) app->file = eina_stringshare_add(file);
- eina_hash_add(added, exe, app);
+ eina_hash_add(p->added, exe, app);
if (desktop)
{
if (tmp && strcmp(exe, tmp))
{
evry_item_ref(EVRY_ITEM(app));
- eina_hash_add(added, tmp, app);
+ eina_hash_add(p->added, tmp, app);
}
}
if (file && strcmp(exe, file))
{
evry_item_ref(EVRY_ITEM(app));
- eina_hash_add(added, file, app);
+ eina_hash_add(p->added, file, app);
}
EVRY_ITEM(app)->fuzzy_match = match;
if (!plugin->items) return 0;
- EVRY_PLUGIN_ITEMS_SORT(plugin, _cb_sort);
+ if (plugin->type != type_action || input)
+ EVRY_PLUGIN_ITEMS_SORT(plugin, _cb_sort);
EINA_LIST_FOREACH(plugin->items, l, it)
it->priority = prio++;
return o;
}
+static const char *
+_item_id(Evry_Plugin *p, const Evry_Item *it)
+{
+ E_Border *bd = it->data;
+ if (bd->client.icccm.class)
+ return (bd->client.icccm.class);
+ if (bd->client.icccm.name)
+ return (bd->client.icccm.name);
+ else
+ return NULL;
+}
+
+
static Eina_Bool
_init(void)
{
plugin = evry_plugin_new(NULL, "Windows", type_subject, NULL, "BORDER", 0, NULL, NULL,
_begin, _cleanup, _fetch, NULL, _item_icon_get, NULL, NULL);
+ plugin->item_id = &_item_id;
+
evry_plugin_register(plugin, 2);
return EINA_TRUE;
return ret;
}
+static const char *
+_item_id(Evry_Plugin *p, const Evry_Item *item)
+{
+ ITEM_FILE(file, item);
+
+ return file->uri;
+}
+
static Eina_Bool
_init(void)
{
_begin, _cleanup, _fetch, NULL, _icon_get,
NULL, NULL);
+ p1->item_id = &_item_id;
+ p1->item_id = &_item_id;
+
evry_plugin_register(p1, 3);
evry_plugin_register(p2, 1);
-#include "Evry.h"
-
+#include "e_mod_main.h"
/* TODO check if trackerd is running and version */
static E_DBus_Connection *conn = NULL;
static Eina_List *plugins = NULL;
static int _prio = 5;
-
+static int active = 0;
static Evry_Plugin *
_begin(Evry_Plugin *plugin, const Evry_Item *it)
if (dbus_error_is_set(error))
{
_cleanup(EVRY_PLUGIN(p));
+ active = 0;
printf("Error: %s - %s\n", error->name, error->message);
return;
}
evry_plugin_async_update(EVRY_PLUGIN(p), EVRY_ASYNC_UPDATE_ADD);
}
+static void
+_dbus_cb_version(void *data, DBusMessage *msg, DBusError *error)
+{
+ DBusMessageIter iter;
+ int version = 0;
+
+ if (dbus_error_is_set(error))
+ {
+ printf("Error: %s - %s\n", error->name, error->message);
+ return;
+ }
+
+ dbus_message_iter_init(msg, &iter);
+
+ if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_INT32)
+ dbus_message_iter_get_basic(&iter, &version);
+
+ printf("tracker version %d\n", version);
+
+ if (version < 690)
+ active = 0;
+ else
+ active = 2;
+}
+
+static void
+_get_version(void)
+{
+ DBusMessage *msg;
+
+ msg = dbus_message_new_method_call("org.freedesktop.Tracker",
+ "/org/freedesktop/Tracker",
+ "org.freedesktop.Tracker",
+ "GetVersion");
+
+ e_dbus_message_send(conn, msg, _dbus_cb_version, -1, NULL);
+ dbus_message_unref(msg);
+
+ active = 1;
+}
+
static int
_fetch(Evry_Plugin *plugin, const char *input)
{
return 0;
}
+
+ if (!active)
+ _get_version();
+
+ if (active != 2)
+ return 0;
+
p->active++;
msg = dbus_message_new_method_call("org.freedesktop.Tracker",
evry_plugin_register(EVRY_PLUGIN(p), _prio++);
}
-static void
-_dbus_cb_version(void *data, DBusMessage *msg, DBusError *error)
-{
- DBusMessageIter iter;
- Plugin *p;
- int version = 0;
-
- if (dbus_error_is_set(error))
- {
- printf("Error: %s - %s\n", error->name, error->message);
- e_dbus_connection_close(conn);
-
- EINA_LIST_FREE(plugins, p)
- {
- if (p->condition[0]) free(p->condition);
-
- EVRY_PLUGIN_FREE(p);
- }
- return;
- }
-
- dbus_message_iter_init(msg, &iter);
-
- if (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_INT32)
- dbus_message_iter_get_basic(&iter, &version);
-
- printf("tracker version %d\n", version);
-
- if (version < 690)
- {
- e_dbus_connection_close(conn);
-
- EINA_LIST_FREE(plugins, p)
- {
- if (p->condition[0]) free(p->condition);
-
- EVRY_PLUGIN_FREE(p);
- }
- }
-}
-
-
-static void
-_get_version(void)
-{
- DBusMessage *msg;
-
- msg = dbus_message_new_method_call("org.freedesktop.Tracker",
- "/org/freedesktop/Tracker",
- "org.freedesktop.Tracker",
- "GetVersion");
-
- e_dbus_message_send(conn, msg, _dbus_cb_version, -1, NULL);
- dbus_message_unref(msg);
-}
-
-/* static Evry_Plugin *
- * _begin_subject(Evry_Plugin *plugin, const Evry_Item *it)
- * {
- * if (!conn) return NULL;
- *
- * return plugin;
- * } */
static Eina_Bool