forked from enlightenment/enlightenment
'everything'
- added history that should adapt sort list sorting to usage - conf dialog: moved plugiγ types to separate pages - fixed bug from shared hash of apps plugins SVN revision: 42095
This commit is contained in:
parent
c8e998c551
commit
c5507a54dd
|
@ -88,6 +88,7 @@ struct _Evry_Item
|
||||||
Evry_Plugin *plugin;
|
Evry_Plugin *plugin;
|
||||||
int ref;
|
int ref;
|
||||||
void (*free) (Evry_Item *item);
|
void (*free) (Evry_Item *item);
|
||||||
|
double usage;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evry_Item_App
|
struct _Evry_Item_App
|
||||||
|
@ -136,7 +137,8 @@ struct _Evry_Plugin
|
||||||
Evas_Object *(*icon_get) (Evry_Plugin *p, const Evry_Item *it, Evas *e);
|
Evas_Object *(*icon_get) (Evry_Plugin *p, const Evry_Item *it, Evas *e);
|
||||||
/* provide more information for a candidate */
|
/* provide more information for a candidate */
|
||||||
/* int (*candidate_info) (Evas *evas, Evry_Item *item); */
|
/* 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 */
|
/* optional: default action for this plugins items */
|
||||||
int (*action) (Evry_Plugin *p, const Evry_Item *item);
|
int (*action) (Evry_Plugin *p, const Evry_Item *item);
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,18 @@
|
||||||
|
|
||||||
#include "e_mod_main.h"
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
#define CONFIG_VERSION 3
|
#define CONFIG_VERSION 5
|
||||||
|
#define HISTORY_VERSION 1
|
||||||
|
|
||||||
/* actual module specifics */
|
/* actual module specifics */
|
||||||
static void _e_mod_action_exebuf_cb(E_Object *obj, const char *params);
|
static void _e_mod_action_cb(E_Object *obj, const char *params);
|
||||||
static int _e_mod_run_defer_cb(void *data);
|
static int _e_mod_run_defer_cb(void *data);
|
||||||
static void _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi);
|
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 _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_Int_Menu_Augmentation *maug = NULL;
|
||||||
static E_Action *act = NULL;
|
static E_Action *act = NULL;
|
||||||
|
@ -23,8 +28,13 @@ static E_Action *act = NULL;
|
||||||
static Eina_Array *plugins = NULL;
|
static Eina_Array *plugins = NULL;
|
||||||
static E_Config_DD *conf_edd = NULL;
|
static E_Config_DD *conf_edd = NULL;
|
||||||
static E_Config_DD *conf_item_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;
|
Config *evry_conf = NULL;
|
||||||
|
History *evry_hist = NULL;
|
||||||
|
|
||||||
/* module setup */
|
/* module setup */
|
||||||
EAPI E_Module_Api e_modapi =
|
EAPI E_Module_Api e_modapi =
|
||||||
|
@ -33,7 +43,6 @@ EAPI E_Module_Api e_modapi =
|
||||||
"Everything"
|
"Everything"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static Eina_Bool list_cb(Eina_Module *m, void *data)
|
static Eina_Bool list_cb(Eina_Module *m, void *data)
|
||||||
{
|
{
|
||||||
if (eina_module_load(m))
|
if (eina_module_load(m))
|
||||||
|
@ -50,67 +59,18 @@ e_modapi_init(E_Module *m)
|
||||||
char *file;
|
char *file;
|
||||||
E_Action *act;
|
E_Action *act;
|
||||||
|
|
||||||
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());
|
* e_user_homedir_get(), e_config_profile_get());
|
||||||
ecore_file_mkdir(buf);
|
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
_config_init();
|
||||||
|
_history_init();
|
||||||
|
|
||||||
/* search for plugins */
|
/* search for plugins */
|
||||||
eina_module_init();
|
eina_module_init();
|
||||||
|
|
||||||
snprintf(dir, sizeof(dir), "%s/enlightenment/everything_plugins", e_prefix_lib_get());
|
snprintf(dir, sizeof(dir), "%s/enlightenment/everything_plugins",
|
||||||
|
e_prefix_lib_get());
|
||||||
files = ecore_file_ls(dir);
|
files = ecore_file_ls(dir);
|
||||||
|
|
||||||
EINA_LIST_FREE(files, file)
|
EINA_LIST_FREE(files, file)
|
||||||
|
@ -127,20 +87,23 @@ e_modapi_init(E_Module *m)
|
||||||
act = e_action_add("everything");
|
act = e_action_add("everything");
|
||||||
if (act)
|
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"),
|
maug = e_int_menus_menu_augmentation_add("main/1",
|
||||||
"everything", "", NULL, 0);
|
_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"),
|
e_configure_registry_category_add("extensions", 80, _("Extensions"),
|
||||||
NULL, "preferences-extensions");
|
NULL, "preferences-extensions");
|
||||||
|
|
||||||
e_configure_registry_item_add("extensions/run_everything", 40, _("Run Everything"),
|
e_configure_registry_item_add("extensions/run_everything", 40,
|
||||||
NULL, "system-run", evry_config_dialog);
|
_("Run Everything"),
|
||||||
|
NULL, "system-run",
|
||||||
|
evry_config_dialog);
|
||||||
evry_init();
|
evry_init();
|
||||||
|
|
||||||
e_module_delayed_set(m, 1);
|
e_module_delayed_set(m, 1);
|
||||||
|
@ -152,7 +115,7 @@ EAPI int
|
||||||
e_modapi_shutdown(E_Module *m __UNUSED__)
|
e_modapi_shutdown(E_Module *m __UNUSED__)
|
||||||
{
|
{
|
||||||
E_Config_Dialog *cfd;
|
E_Config_Dialog *cfd;
|
||||||
|
|
||||||
evry_shutdown();
|
evry_shutdown();
|
||||||
|
|
||||||
/* remove module-supplied menu additions */
|
/* remove module-supplied menu additions */
|
||||||
|
@ -183,17 +146,15 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
||||||
e_configure_registry_item_del("extensions/run_everything");
|
e_configure_registry_item_del("extensions/run_everything");
|
||||||
e_configure_registry_category_del("extensions");
|
e_configure_registry_category_del("extensions");
|
||||||
|
|
||||||
if (evry_conf->plugins) eina_list_free(evry_conf->plugins);
|
_config_free();
|
||||||
if (evry_conf->actions) eina_list_free(evry_conf->actions);
|
_history_free();
|
||||||
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);
|
|
||||||
|
|
||||||
/* Clean EET */
|
/* Clean EET */
|
||||||
E_CONFIG_DD_FREE(conf_item_edd);
|
E_CONFIG_DD_FREE(conf_item_edd);
|
||||||
E_CONFIG_DD_FREE(conf_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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,12 +162,200 @@ EAPI int
|
||||||
e_modapi_save(E_Module *m __UNUSED__)
|
e_modapi_save(E_Module *m __UNUSED__)
|
||||||
{
|
{
|
||||||
e_config_domain_save("module.everything", conf_edd, evry_conf);
|
e_config_domain_save("module.everything", conf_edd, evry_conf);
|
||||||
|
|
||||||
return 1;
|
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 */
|
/* action callback */
|
||||||
static void
|
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;
|
E_Zone *zone = NULL;
|
||||||
|
|
||||||
|
@ -317,23 +466,6 @@ evry_plugin_free(Evry_Plugin *p, int free_pointer)
|
||||||
if (p->trigger) eina_stringshare_del(p->trigger);
|
if (p->trigger) eina_stringshare_del(p->trigger);
|
||||||
if (p->icon) eina_stringshare_del(p->icon);
|
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)
|
if (free_pointer)
|
||||||
E_FREE(p);
|
E_FREE(p);
|
||||||
}
|
}
|
||||||
|
@ -380,7 +512,6 @@ evry_plugin_register(Evry_Plugin *p, int priority)
|
||||||
{
|
{
|
||||||
Eina_List *l, *confs = NULL;
|
Eina_List *l, *confs = NULL;
|
||||||
Plugin_Config *pc;
|
Plugin_Config *pc;
|
||||||
Eina_Bool found = 0;
|
|
||||||
|
|
||||||
evry_conf->plugins = eina_list_append(evry_conf->plugins, p);
|
evry_conf->plugins = eina_list_append(evry_conf->plugins, p);
|
||||||
|
|
||||||
|
@ -392,15 +523,10 @@ evry_plugin_register(Evry_Plugin *p, int priority)
|
||||||
confs = evry_conf->conf_objects;
|
confs = evry_conf->conf_objects;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(confs, l, pc)
|
EINA_LIST_FOREACH(confs, l, pc)
|
||||||
{
|
if (pc->name && p->name && !strcmp(pc->name, p->name))
|
||||||
if (pc->name && p->name && !strcmp(pc->name, p->name))
|
break;
|
||||||
{
|
|
||||||
found = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found)
|
if (!pc)
|
||||||
{
|
{
|
||||||
pc = E_NEW(Plugin_Config, 1);
|
pc = E_NEW(Plugin_Config, 1);
|
||||||
pc->name = eina_stringshare_add(p->name);
|
pc->name = eina_stringshare_add(p->name);
|
||||||
|
@ -414,7 +540,6 @@ evry_plugin_register(Evry_Plugin *p, int priority)
|
||||||
* pc->trigger = eina_stringshare_add(plugin->trigger); */
|
* pc->trigger = eina_stringshare_add(plugin->trigger); */
|
||||||
|
|
||||||
p->config = pc;
|
p->config = pc;
|
||||||
|
|
||||||
evry_conf->plugins = eina_list_sort(evry_conf->plugins,
|
evry_conf->plugins = eina_list_sort(evry_conf->plugins,
|
||||||
eina_list_count(evry_conf->plugins),
|
eina_list_count(evry_conf->plugins),
|
||||||
_evry_cb_plugin_sort);
|
_evry_cb_plugin_sort);
|
||||||
|
@ -434,7 +559,6 @@ evry_plugin_register(Evry_Plugin *p, int priority)
|
||||||
e_action_predef_name_set(_("Everything"), buf,
|
e_action_predef_name_set(_("Everything"), buf,
|
||||||
"everything", p->name, NULL, 1);
|
"everything", p->name, NULL, 1);
|
||||||
}
|
}
|
||||||
/* TODO sorting, initialization, etc */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
typedef struct _Config Config;
|
typedef struct _Config Config;
|
||||||
typedef struct _Evry_Selector Evry_Selector;
|
typedef struct _Evry_Selector Evry_Selector;
|
||||||
typedef struct _Tab_View Tab_View;
|
typedef struct _Tab_View Tab_View;
|
||||||
|
typedef struct _History History;
|
||||||
|
typedef struct _History_Entry History_Entry;
|
||||||
|
typedef struct _History_Item History_Item;
|
||||||
|
|
||||||
struct _Config
|
struct _Config
|
||||||
{
|
{
|
||||||
|
@ -29,17 +32,38 @@ struct _Config
|
||||||
int hide_list;
|
int hide_list;
|
||||||
|
|
||||||
int quick_nav;
|
int quick_nav;
|
||||||
|
|
||||||
Eina_Hash *key_bindings;
|
|
||||||
|
|
||||||
/**/
|
|
||||||
Eina_List *plugins;
|
Eina_List *plugins;
|
||||||
Eina_List *actions;
|
Eina_List *actions;
|
||||||
Eina_List *views;
|
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
|
struct _Evry_Selector
|
||||||
{
|
{
|
||||||
Evas_Object *o_main;
|
Evas_Object *o_main;
|
||||||
|
@ -64,6 +88,8 @@ struct _Evry_Selector
|
||||||
|
|
||||||
Evas_Object *o_thumb;
|
Evas_Object *o_thumb;
|
||||||
Eina_Bool do_thumb;
|
Eina_Bool do_thumb;
|
||||||
|
|
||||||
|
Eina_Hash *history;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Tab_View
|
struct _Tab_View
|
||||||
|
@ -93,6 +119,7 @@ int evry_init(void);
|
||||||
int evry_shutdown(void);
|
int evry_shutdown(void);
|
||||||
int evry_show(E_Zone *zone, const char *params);
|
int evry_show(E_Zone *zone, const char *params);
|
||||||
void evry_hide(void);
|
void evry_hide(void);
|
||||||
|
void evry_save_history(void);
|
||||||
|
|
||||||
Evry_Plugin *evry_plug_aggregator_new(Evry_Selector *selector);
|
Evry_Plugin *evry_plug_aggregator_new(Evry_Selector *selector);
|
||||||
void evry_plug_aggregator_free(Evry_Plugin *plugin);
|
void evry_plug_aggregator_free(Evry_Plugin *plugin);
|
||||||
|
@ -104,6 +131,7 @@ EAPI Tab_View *evry_tab_view_new(const Evry_State *s, Evas *e);
|
||||||
EAPI void evry_tab_view_free(Tab_View *v);
|
EAPI void evry_tab_view_free(Tab_View *v);
|
||||||
|
|
||||||
extern Config *evry_conf;
|
extern Config *evry_conf;
|
||||||
|
extern History *evry_hist;
|
||||||
extern Evry_Selector **selectors;
|
extern Evry_Selector **selectors;
|
||||||
extern Evry_Plugin *action_selector;
|
extern Evry_Plugin *action_selector;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -81,6 +81,8 @@ static void _evry_item_sel(Evry_State *s, Evry_Item *it);
|
||||||
|
|
||||||
static int _evry_cb_key_down(void *data, int type, void *event);
|
static int _evry_cb_key_down(void *data, int type, void *event);
|
||||||
static int _evry_cb_selection_notify(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 */
|
/* local subsystem globals */
|
||||||
static Evry_Window *win = NULL;
|
static Evry_Window *win = NULL;
|
||||||
|
@ -163,7 +165,7 @@ evry_show(E_Zone *zone, const char *params)
|
||||||
|
|
||||||
if (!evry_conf->hide_input)
|
if (!evry_conf->hide_input)
|
||||||
edje_object_signal_emit(list->o_main, "e,state,entry_show", "e");
|
edje_object_signal_emit(list->o_main, "e,state,entry_show", "e");
|
||||||
|
|
||||||
handlers = eina_list_append
|
handlers = eina_list_append
|
||||||
(handlers, ecore_event_handler_add
|
(handlers, ecore_event_handler_add
|
||||||
(ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL));
|
(ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL));
|
||||||
|
@ -180,6 +182,12 @@ evry_show(E_Zone *zone, const char *params)
|
||||||
e_popup_show(win->popup);
|
e_popup_show(win->popup);
|
||||||
e_popup_show(list->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;
|
return 1;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -393,7 +401,7 @@ evry_plugin_async_update(Evry_Plugin *p, int action)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update aggregator */
|
/* update aggregator */
|
||||||
if (eina_list_count(s->cur_plugins) > 1)
|
if (eina_list_count(s->cur_plugins) > 0)
|
||||||
{
|
{
|
||||||
agg->fetch(agg, s->input);
|
agg->fetch(agg, s->input);
|
||||||
|
|
||||||
|
@ -447,12 +455,7 @@ _evry_list_win_new(E_Zone *zone)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
list_win->popup = popup;
|
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);
|
o = edje_object_add(popup->evas);
|
||||||
list_win->o_main = o;
|
list_win->o_main = o;
|
||||||
e_theme_edje_object_set(o, "base/theme/everything",
|
e_theme_edje_object_set(o, "base/theme/everything",
|
||||||
|
@ -470,9 +473,6 @@ _evry_list_win_new(E_Zone *zone)
|
||||||
|
|
||||||
edje_object_size_min_calc(o, &mw, &mh);
|
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 (mh == 0) mh = 200;
|
||||||
if (mw == 0) mw = win->popup->w / 2;
|
if (mw == 0) mw = win->popup->w / 2;
|
||||||
|
|
||||||
|
@ -486,9 +486,7 @@ _evry_list_win_new(E_Zone *zone)
|
||||||
evas_object_resize(o, list_win->popup->w, list_win->popup->h);
|
evas_object_resize(o, list_win->popup->w, list_win->popup->h);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
e_popup_edje_bg_object_set(popup, o);
|
e_popup_edje_bg_object_set(popup, o);
|
||||||
|
|
||||||
/* evas_event_thaw(popup->evas); */
|
|
||||||
|
|
||||||
return list_win;
|
return list_win;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,12 +607,22 @@ _evry_selector_new(int type)
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
|
|
||||||
if (type == type_subject)
|
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)
|
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)
|
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);
|
p = evry_plug_aggregator_new(sel);
|
||||||
|
|
||||||
sel->plugins = eina_list_append(sel->plugins, p);
|
sel->plugins = eina_list_append(sel->plugins, p);
|
||||||
|
@ -1052,6 +1060,8 @@ _evry_browse_item(Evry_Selector *sel)
|
||||||
|
|
||||||
if (!plugins) return 1;
|
if (!plugins) return 1;
|
||||||
|
|
||||||
|
_evry_history_item_add(sel->history, s);
|
||||||
|
|
||||||
if (s->view)
|
if (s->view)
|
||||||
{
|
{
|
||||||
_evry_view_hide(s->view);
|
_evry_view_hide(s->view);
|
||||||
|
@ -1352,6 +1362,102 @@ _evry_clear(Evry_State *s)
|
||||||
return 0;
|
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
|
static void
|
||||||
_evry_plugin_action(Evry_Selector *sel, int finished)
|
_evry_plugin_action(Evry_Selector *sel, int finished)
|
||||||
{
|
{
|
||||||
|
@ -1361,7 +1467,8 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
|
||||||
s_action = selectors[1]->state;
|
s_action = selectors[1]->state;
|
||||||
s_object = NULL;
|
s_object = NULL;
|
||||||
|
|
||||||
if (!s_subject || !s_action) return;
|
if (!s_subject || !s_action)
|
||||||
|
return;
|
||||||
|
|
||||||
if (update_timer)
|
if (update_timer)
|
||||||
{
|
{
|
||||||
|
@ -1372,7 +1479,8 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
|
||||||
update_timer = NULL;
|
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 (s_action->cur_item->plugin == action_selector)
|
||||||
{
|
{
|
||||||
|
@ -1382,7 +1490,8 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
|
||||||
if (selectors[2] == selector)
|
if (selectors[2] == selector)
|
||||||
it_object = selector->state->cur_item;
|
it_object = selector->state->cur_item;
|
||||||
|
|
||||||
if (act->type_in2 && !it_object) return;
|
if (act->type_in2 && !it_object)
|
||||||
|
return;
|
||||||
|
|
||||||
act->item2 = it_object;
|
act->item2 = it_object;
|
||||||
|
|
||||||
|
@ -1397,6 +1506,11 @@ _evry_plugin_action(Evry_Selector *sel, int finished)
|
||||||
}
|
}
|
||||||
else return;
|
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 */
|
/* let subject and object plugin know that an action was performed */
|
||||||
if (s_subject->plugin->action)
|
if (s_subject->plugin->action)
|
||||||
s_subject->plugin->action(s_subject->plugin, s_subject->cur_item);
|
s_subject->plugin->action(s_subject->plugin, s_subject->cur_item);
|
||||||
|
@ -1591,7 +1705,7 @@ _evry_matches_update(Evry_Selector *sel, int async)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eina_list_count(s->cur_plugins) > 1)
|
if (eina_list_count(s->cur_plugins) > 0)
|
||||||
{
|
{
|
||||||
sel->aggregator->fetch(sel->aggregator, s->input);
|
sel->aggregator->fetch(sel->aggregator, s->input);
|
||||||
s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator);
|
s->cur_plugins = eina_list_prepend(s->cur_plugins, sel->aggregator);
|
||||||
|
|
|
@ -21,6 +21,8 @@ struct _E_Config_Dialog_Data
|
||||||
int width, height;
|
int width, height;
|
||||||
int scroll_animate;
|
int scroll_animate;
|
||||||
|
|
||||||
|
char *cmd_terminal;
|
||||||
|
|
||||||
Evas_Object *l_subject;
|
Evas_Object *l_subject;
|
||||||
Evas_Object *l_action;
|
Evas_Object *l_action;
|
||||||
Evas_Object *l_object;
|
Evas_Object *l_object;
|
||||||
|
@ -73,6 +75,9 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
||||||
cfdata->p_action = eina_list_append(cfdata->p_action, p);
|
cfdata->p_action = eina_list_append(cfdata->p_action, p);
|
||||||
else if (p->type == type_object)
|
else if (p->type == type_object)
|
||||||
cfdata->p_object = eina_list_append(cfdata->p_object, p);
|
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 *
|
static void *
|
||||||
|
@ -91,7 +96,7 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||||
if (cfdata->p_subject) eina_list_free(cfdata->p_subject);
|
if (cfdata->p_subject) eina_list_free(cfdata->p_subject);
|
||||||
if (cfdata->p_action) eina_list_free(cfdata->p_action);
|
if (cfdata->p_action) eina_list_free(cfdata->p_action);
|
||||||
if (cfdata->p_object) eina_list_free(cfdata->p_object);
|
if (cfdata->p_object) eina_list_free(cfdata->p_object);
|
||||||
|
E_FREE(cfdata->cmd_terminal);
|
||||||
E_FREE(cfdata);
|
E_FREE(cfdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +121,10 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||||
eina_list_count(evry_conf->plugins),
|
eina_list_count(evry_conf->plugins),
|
||||||
_evry_cb_plugin_sort);
|
_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();
|
e_config_save_queue();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -209,9 +218,15 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
|
||||||
ob = e_widget_check_add(evas, _("Quick Navigation (ALT + h,j,k,l,n,p,m,i)"),
|
ob = e_widget_check_add(evas, _("Quick Navigation (ALT + h,j,k,l,n,p,m,i)"),
|
||||||
&(cfdata->quick_nav));
|
&(cfdata->quick_nav));
|
||||||
e_widget_framelist_object_append(of, ob);
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
|
||||||
|
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);
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
|
||||||
/* ob = e_widget_label_add(evas, _("Popup Width"));
|
/* ob = e_widget_label_add(evas, _("Popup Width"));
|
||||||
* e_widget_framelist_object_append(of, ob);
|
* e_widget_framelist_object_append(of, ob);
|
||||||
* ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"),
|
* ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"),
|
||||||
|
@ -235,10 +250,10 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
|
||||||
|
|
||||||
|
|
||||||
e_widget_toolbook_page_append(otb, NULL, _("General Settings"),
|
e_widget_toolbook_page_append(otb, NULL, _("General Settings"),
|
||||||
o, 0, 0, 0, 0, 0.5, 0.0);
|
o, 1, 0, 1, 0, 0.5, 0.0);
|
||||||
|
|
||||||
ob = e_widget_list_add(evas, 1, 1);
|
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);
|
o = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||||
cfdata->l_subject = o;
|
cfdata->l_subject = o;
|
||||||
/* e_widget_on_change_hook_set(ol, _avail_list_cb_change, cfdata); */
|
/* e_widget_on_change_hook_set(ol, _avail_list_cb_change, cfdata); */
|
||||||
|
@ -255,8 +270,12 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
|
||||||
cfdata->p_subject);
|
cfdata->p_subject);
|
||||||
e_widget_framelist_object_append(of, o);
|
e_widget_framelist_object_append(of, o);
|
||||||
e_widget_list_object_append(ob, of, 1, 1, 0.5);
|
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);
|
o = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||||
cfdata->l_action = o;
|
cfdata->l_action = o;
|
||||||
_fill_list(cfdata->p_action, o, 0);
|
_fill_list(cfdata->p_action, o, 0);
|
||||||
|
@ -272,8 +291,11 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
|
||||||
cfdata->p_action);
|
cfdata->p_action);
|
||||||
e_widget_framelist_object_append(of, o);
|
e_widget_framelist_object_append(of, o);
|
||||||
e_widget_list_object_append(ob, of, 1, 1, 0.5);
|
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);
|
o = e_widget_ilist_add(evas, 24, 24, NULL);
|
||||||
cfdata->l_object = o;
|
cfdata->l_object = o;
|
||||||
_fill_list(cfdata->p_object, o, 0);
|
_fill_list(cfdata->p_object, o, 0);
|
||||||
|
@ -290,9 +312,10 @@ _basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dial
|
||||||
e_widget_framelist_object_append(of, o);
|
e_widget_framelist_object_append(of, o);
|
||||||
e_widget_list_object_append(ob, of, 1, 1, 0.5);
|
e_widget_list_object_append(ob, of, 1, 1, 0.5);
|
||||||
|
|
||||||
e_widget_toolbook_page_append(otb, NULL, _("Plugins"),
|
e_widget_toolbook_page_append(otb, NULL, _("Object Plugins"),
|
||||||
ob, 0, 0, 0, 0, 0.5, 0.0);
|
ob, 1, 0, 1, 0, 0.5, 0.0);
|
||||||
e_widget_toolbook_page_show(otb, 1);
|
|
||||||
|
e_widget_toolbook_page_show(otb, 0);
|
||||||
|
|
||||||
return otb;
|
return otb;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,13 @@ _cb_sort_recent(const void *data1, const void *data2)
|
||||||
const Evry_Item *it1 = data1;
|
const Evry_Item *it1 = data1;
|
||||||
const Evry_Item *it2 = data2;
|
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) ||
|
if ((it1->plugin == action_selector) ||
|
||||||
(it2->plugin == action_selector))
|
(it2->plugin == action_selector))
|
||||||
{
|
{
|
||||||
|
@ -26,7 +33,7 @@ _cb_sort_recent(const void *data1, const void *data2)
|
||||||
- it2->plugin->config->priority);
|
- it2->plugin->config->priority);
|
||||||
else
|
else
|
||||||
return (it1->plugin->config->priority -
|
return (it1->plugin->config->priority -
|
||||||
(it1->plugin->config->priority + it2->priority));
|
(it2->plugin->config->priority + it2->priority));
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -38,6 +45,13 @@ _cb_sort(const void *data1, const void *data2)
|
||||||
const Evry_Item *it1 = data1;
|
const Evry_Item *it1 = data1;
|
||||||
const Evry_Item *it2 = data2;
|
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) ||
|
if ((it1->plugin == action_selector) ||
|
||||||
(it2->plugin == action_selector))
|
(it2->plugin == action_selector))
|
||||||
{
|
{
|
||||||
|
@ -87,6 +101,9 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
Eina_List *items = NULL;
|
Eina_List *items = NULL;
|
||||||
|
History_Entry *he;
|
||||||
|
History_Item *hi;
|
||||||
|
const char *id;
|
||||||
|
|
||||||
s = p->selector->state;
|
s = p->selector->state;
|
||||||
|
|
||||||
|
@ -115,11 +132,11 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!input[0] || eina_list_count(items) < 20)
|
if (!input[0] || eina_list_count(items) < 50)
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
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_data_find_list(items, ll->data))
|
||||||
{
|
{
|
||||||
|
@ -134,7 +151,34 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items) eina_list_free(items);
|
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])
|
if (input[0])
|
||||||
{
|
{
|
||||||
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
||||||
|
|
|
@ -104,9 +104,13 @@ _tabs_update(Tab_View *v)
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
e_box_pack_end(v->o_tabs, o);
|
e_box_pack_end(v->o_tabs, o);
|
||||||
|
|
||||||
e_box_pack_options_set(o, 1, 1, 1, 0, 0.0, 0.5,
|
if (eina_list_count(s->cur_plugins) == 2)
|
||||||
(tab->mw < tab->cw ? tab->cw : tab->mw), 10,
|
e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5,
|
||||||
(w ? w/3 : 150), 9999);
|
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)
|
if (s->plugin == p)
|
||||||
edje_object_signal_emit(o, "e,state,selected", "e");
|
edje_object_signal_emit(o, "e,state,selected", "e");
|
||||||
else
|
else
|
||||||
|
|
|
@ -11,6 +11,7 @@ struct _Plugin
|
||||||
Eina_List *apps_mime;
|
Eina_List *apps_mime;
|
||||||
Eina_List *apps_all;
|
Eina_List *apps_all;
|
||||||
const Evry_Item *candidate;
|
const Evry_Item *candidate;
|
||||||
|
Eina_Hash *added;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* taken from exebuf module */
|
/* taken from exebuf module */
|
||||||
|
@ -84,12 +85,19 @@ _begin_open_with(Evry_Plugin *plugin, const Evry_Item *item)
|
||||||
p->apps_mime = eina_list_prepend(p->apps_mime, desktop);
|
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;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evry_Plugin *
|
static Evry_Plugin *
|
||||||
_begin(Evry_Plugin *plugin, const Evry_Item *item)
|
_begin(Evry_Plugin *plugin, const Evry_Item *item)
|
||||||
{
|
{
|
||||||
|
PLUGIN(p, plugin);
|
||||||
|
|
||||||
/* taken from exebuf module */
|
/* taken from exebuf module */
|
||||||
char *path, *pp, *last;
|
char *path, *pp, *last;
|
||||||
E_Exe_List *el;
|
E_Exe_List *el;
|
||||||
|
@ -128,7 +136,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item)
|
||||||
|
|
||||||
exe_scan_idler = ecore_idler_add(_scan_idler, NULL);
|
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;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
@ -153,7 +161,12 @@ _cleanup(Evry_Plugin *plugin)
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
|
/* TODO popup end func !!!
|
||||||
|
- cleanup hash for open-with plugin */
|
||||||
eina_hash_free(added);
|
eina_hash_free(added);
|
||||||
|
added = NULL;
|
||||||
|
|
||||||
|
eina_hash_free(p->added);
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
||||||
|
@ -209,7 +222,7 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *tmp;
|
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 (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app))
|
||||||
{
|
{
|
||||||
|
@ -245,7 +258,7 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
|
||||||
|
|
||||||
if (!exe) return 0;
|
if (!exe) return 0;
|
||||||
|
|
||||||
if ((app = eina_hash_find(added, exe)) &&
|
if ((app = eina_hash_find(p->added, exe)) &&
|
||||||
(!desktop || (desktop == app->desktop)))
|
(!desktop || (desktop == app->desktop)))
|
||||||
{
|
{
|
||||||
if (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app))
|
if (!eina_list_data_find_list(EVRY_PLUGIN(p)->items, app))
|
||||||
|
@ -270,7 +283,7 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
|
||||||
app->desktop = desktop;
|
app->desktop = desktop;
|
||||||
if (file) app->file = eina_stringshare_add(file);
|
if (file) app->file = eina_stringshare_add(file);
|
||||||
|
|
||||||
eina_hash_add(added, exe, app);
|
eina_hash_add(p->added, exe, app);
|
||||||
|
|
||||||
if (desktop)
|
if (desktop)
|
||||||
{
|
{
|
||||||
|
@ -279,13 +292,13 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
|
||||||
if (tmp && strcmp(exe, tmp))
|
if (tmp && strcmp(exe, tmp))
|
||||||
{
|
{
|
||||||
evry_item_ref(EVRY_ITEM(app));
|
evry_item_ref(EVRY_ITEM(app));
|
||||||
eina_hash_add(added, tmp, app);
|
eina_hash_add(p->added, tmp, app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (file && strcmp(exe, file))
|
if (file && strcmp(exe, file))
|
||||||
{
|
{
|
||||||
evry_item_ref(EVRY_ITEM(app));
|
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;
|
EVRY_ITEM(app)->fuzzy_match = match;
|
||||||
|
@ -454,7 +467,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
|
|
||||||
if (!plugin->items) return 0;
|
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)
|
EINA_LIST_FOREACH(plugin->items, l, it)
|
||||||
it->priority = prio++;
|
it->priority = prio++;
|
||||||
|
|
|
@ -235,12 +235,27 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
|
||||||
return o;
|
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
|
static Eina_Bool
|
||||||
_init(void)
|
_init(void)
|
||||||
{
|
{
|
||||||
plugin = evry_plugin_new(NULL, "Windows", type_subject, NULL, "BORDER", 0, NULL, NULL,
|
plugin = evry_plugin_new(NULL, "Windows", type_subject, NULL, "BORDER", 0, NULL, NULL,
|
||||||
_begin, _cleanup, _fetch, NULL, _item_icon_get, NULL, NULL);
|
_begin, _cleanup, _fetch, NULL, _item_icon_get, NULL, NULL);
|
||||||
|
|
||||||
|
plugin->item_id = &_item_id;
|
||||||
|
|
||||||
evry_plugin_register(plugin, 2);
|
evry_plugin_register(plugin, 2);
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
|
|
|
@ -448,6 +448,14 @@ _open_term_action(Evry_Action *act)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
_item_id(Evry_Plugin *p, const Evry_Item *item)
|
||||||
|
{
|
||||||
|
ITEM_FILE(file, item);
|
||||||
|
|
||||||
|
return file->uri;
|
||||||
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_init(void)
|
_init(void)
|
||||||
{
|
{
|
||||||
|
@ -459,6 +467,9 @@ _init(void)
|
||||||
_begin, _cleanup, _fetch, NULL, _icon_get,
|
_begin, _cleanup, _fetch, NULL, _icon_get,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
|
p1->item_id = &_item_id;
|
||||||
|
p1->item_id = &_item_id;
|
||||||
|
|
||||||
evry_plugin_register(p1, 3);
|
evry_plugin_register(p1, 3);
|
||||||
evry_plugin_register(p2, 1);
|
evry_plugin_register(p2, 1);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include "Evry.h"
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
|
|
||||||
/* TODO check if trackerd is running and version */
|
/* TODO check if trackerd is running and version */
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ struct _Plugin
|
||||||
static E_DBus_Connection *conn = NULL;
|
static E_DBus_Connection *conn = NULL;
|
||||||
static Eina_List *plugins = NULL;
|
static Eina_List *plugins = NULL;
|
||||||
static int _prio = 5;
|
static int _prio = 5;
|
||||||
|
static int active = 0;
|
||||||
|
|
||||||
static Evry_Plugin *
|
static Evry_Plugin *
|
||||||
_begin(Evry_Plugin *plugin, const Evry_Item *it)
|
_begin(Evry_Plugin *plugin, const Evry_Item *it)
|
||||||
|
@ -170,6 +169,7 @@ _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error)
|
||||||
if (dbus_error_is_set(error))
|
if (dbus_error_is_set(error))
|
||||||
{
|
{
|
||||||
_cleanup(EVRY_PLUGIN(p));
|
_cleanup(EVRY_PLUGIN(p));
|
||||||
|
active = 0;
|
||||||
printf("Error: %s - %s\n", error->name, error->message);
|
printf("Error: %s - %s\n", error->name, error->message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -253,6 +253,47 @@ _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error)
|
||||||
evry_plugin_async_update(EVRY_PLUGIN(p), EVRY_ASYNC_UPDATE_ADD);
|
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
|
static int
|
||||||
_fetch(Evry_Plugin *plugin, const char *input)
|
_fetch(Evry_Plugin *plugin, const char *input)
|
||||||
{
|
{
|
||||||
|
@ -305,6 +346,13 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!active)
|
||||||
|
_get_version();
|
||||||
|
|
||||||
|
if (active != 2)
|
||||||
|
return 0;
|
||||||
|
|
||||||
p->active++;
|
p->active++;
|
||||||
|
|
||||||
msg = dbus_message_new_method_call("org.freedesktop.Tracker",
|
msg = dbus_message_new_method_call("org.freedesktop.Tracker",
|
||||||
|
@ -377,70 +425,7 @@ _plugin_new(const char *name, int type, char *service, int max_hits, int begin)
|
||||||
evry_plugin_register(EVRY_PLUGIN(p), _prio++);
|
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
|
static Eina_Bool
|
||||||
|
|
Loading…
Reference in New Issue