added evry_plug_collection which can hold other plugins.
- currently only registers 'Start', - TODO config dialog to create and edit collections settings plugin: added config categories. view: double click on browsable items now browses it. - click action to run or right click to run and continue SVN revision: 49255
This commit is contained in:
parent
5e42f12ffb
commit
b2de5ef2ef
|
@ -38,6 +38,7 @@ module_la_SOURCES = $(EVRYHEADERS) \
|
|||
evry_view_help.c \
|
||||
evry_plug_clipboard.c \
|
||||
evry_plug_text.c \
|
||||
evry_plug_collection.c \
|
||||
md5.h \
|
||||
md5.c
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ 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 _plugin_config_free(void);
|
||||
static int _cleanup_history(void *data);
|
||||
static void _evry_type_init(const char *type);
|
||||
|
||||
|
@ -24,7 +23,7 @@ static Ecore_Timer *cleanup_timer;
|
|||
|
||||
static E_Config_DD *conf_edd = NULL;
|
||||
static E_Config_DD *plugin_conf_edd = NULL;
|
||||
static E_Config_DD *plugin_setting_edd = NULL;
|
||||
static E_Config_DD *collection_conf_edd = NULL;
|
||||
|
||||
Evry_Config *evry_conf = NULL;
|
||||
int _evry_events[4];
|
||||
|
@ -68,11 +67,13 @@ e_modapi_init(E_Module *m)
|
|||
evry_history_init();
|
||||
|
||||
evry_plug_actions_init();
|
||||
evry_plug_collection_init();
|
||||
evry_plug_clipboard_init();
|
||||
evry_plug_text_init();
|
||||
evry_view_init();
|
||||
evry_view_help_init();
|
||||
|
||||
|
||||
/* add module supplied action */
|
||||
act = e_action_add("everything");
|
||||
if (act)
|
||||
|
@ -119,6 +120,7 @@ e_modapi_init(E_Module *m)
|
|||
SET(plugin_register);
|
||||
SET(plugin_unregister);
|
||||
SET(plugin_update);
|
||||
SET(plugin_find);
|
||||
SET(action_new);
|
||||
SET(action_free);
|
||||
SET(action_register);
|
||||
|
@ -177,6 +179,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
|||
evry_view_help_shutdown();
|
||||
evry_plug_clipboard_shutdown();
|
||||
evry_plug_text_shutdown();
|
||||
evry_plug_collection_shutdown();
|
||||
evry_plug_actions_shutdown();
|
||||
|
||||
_config_free();
|
||||
|
@ -207,7 +210,6 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
|||
/* Clean EET */
|
||||
E_CONFIG_DD_FREE(conf_edd);
|
||||
E_CONFIG_DD_FREE(plugin_conf_edd);
|
||||
E_CONFIG_DD_FREE(plugin_setting_edd);
|
||||
|
||||
if (cleanup_timer)
|
||||
ecore_timer_del(cleanup_timer);
|
||||
|
@ -329,6 +331,8 @@ _cleanup_history(void *data)
|
|||
static void
|
||||
_config_init()
|
||||
{
|
||||
Plugin_Config *pc, *pcc;
|
||||
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Plugin_Config
|
||||
|
@ -343,6 +347,7 @@ _config_init()
|
|||
E_CONFIG_VAL(D, T, aggregate, INT);
|
||||
E_CONFIG_VAL(D, T, top_level, INT);
|
||||
E_CONFIG_VAL(D, T, min_query, INT);
|
||||
E_CONFIG_LIST(D, T, plugins, plugin_conf_edd);
|
||||
#undef T
|
||||
#undef D
|
||||
#define T Evry_Config
|
||||
|
@ -368,6 +373,7 @@ _config_init()
|
|||
E_CONFIG_LIST(D, T, conf_actions, plugin_conf_edd);
|
||||
E_CONFIG_LIST(D, T, conf_objects, plugin_conf_edd);
|
||||
E_CONFIG_LIST(D, T, conf_views, plugin_conf_edd);
|
||||
E_CONFIG_LIST(D, T, collections, plugin_conf_edd);
|
||||
E_CONFIG_VAL(D, T, first_run, UCHAR);
|
||||
#undef T
|
||||
#undef D
|
||||
|
@ -402,46 +408,87 @@ _config_init()
|
|||
evry_conf->view_zoom = 0;
|
||||
evry_conf->cycle_mode = 0;
|
||||
evry_conf->history_sort_mode = 0;
|
||||
evry_conf->edge_width = 390;
|
||||
evry_conf->edge_height = 495;
|
||||
evry_conf->edge_width = 370;
|
||||
evry_conf->edge_height = 435;
|
||||
evry_conf->first_run = EINA_TRUE;
|
||||
|
||||
pcc = E_NEW(Plugin_Config, 1);
|
||||
pcc->name = eina_stringshare_add("Start");
|
||||
pcc->enabled = EINA_FALSE;
|
||||
pcc->aggregate = EINA_FALSE;
|
||||
pcc->top_level = EINA_TRUE;
|
||||
pcc->view_mode = VIEW_MODE_THUMB;
|
||||
evry_conf->collections = eina_list_append(evry_conf->collections, pcc);
|
||||
|
||||
pc = E_NEW(Plugin_Config, 1);
|
||||
pc->name = eina_stringshare_add("Windows");
|
||||
pc->enabled = EINA_TRUE;
|
||||
pc->view_mode = VIEW_MODE_NONE;
|
||||
pcc->plugins = eina_list_append(pcc->plugins, pc);
|
||||
|
||||
pc = E_NEW(Plugin_Config, 1);
|
||||
pc->name = eina_stringshare_add("Settings");
|
||||
pc->enabled = EINA_TRUE;
|
||||
pc->view_mode = VIEW_MODE_NONE;
|
||||
pcc->plugins = eina_list_append(pcc->plugins, pc);
|
||||
|
||||
pc = E_NEW(Plugin_Config, 1);
|
||||
pc->name = eina_stringshare_add("Files");
|
||||
pc->enabled = EINA_TRUE;
|
||||
pc->view_mode = VIEW_MODE_NONE;
|
||||
pcc->plugins = eina_list_append(pcc->plugins, pc);
|
||||
|
||||
pc = E_NEW(Plugin_Config, 1);
|
||||
pc->name = eina_stringshare_add("Applications");
|
||||
pc->enabled = EINA_TRUE;
|
||||
pc->view_mode = VIEW_MODE_NONE;
|
||||
pcc->plugins = eina_list_append(pcc->plugins, pc);
|
||||
IFMODCFGEND;
|
||||
|
||||
evry_conf->version = MOD_CONFIG_FILE_VERSION;
|
||||
}
|
||||
|
||||
static void
|
||||
_plugin_config_free(void)
|
||||
_config_free(void)
|
||||
{
|
||||
Plugin_Config *pc;
|
||||
Plugin_Config *pc, *pc2;
|
||||
|
||||
EINA_LIST_FREE(evry_conf->collections, pc)
|
||||
{
|
||||
EINA_LIST_FREE(pc->plugins, pc2)
|
||||
{
|
||||
IF_RELEASE(pc2->name);
|
||||
IF_RELEASE(pc2->trigger);
|
||||
E_FREE(pc2);
|
||||
}
|
||||
}
|
||||
|
||||
EINA_LIST_FREE(evry_conf->conf_subjects, pc)
|
||||
{
|
||||
if (pc->name) eina_stringshare_del(pc->name);
|
||||
if (pc->trigger) eina_stringshare_del(pc->trigger);
|
||||
if (pc->plugin) evry_plugin_free(pc->plugin);
|
||||
IF_RELEASE(pc->name);
|
||||
IF_RELEASE(pc->trigger);
|
||||
if (pc->plugin)
|
||||
evry_plugin_free(pc->plugin);
|
||||
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);
|
||||
if (pc->plugin) evry_plugin_free(pc->plugin);
|
||||
IF_RELEASE(pc->name);
|
||||
IF_RELEASE(pc->trigger);
|
||||
if (pc->plugin)
|
||||
evry_plugin_free(pc->plugin);
|
||||
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);
|
||||
if (pc->plugin) evry_plugin_free(pc->plugin);
|
||||
IF_RELEASE(pc->name);
|
||||
IF_RELEASE(pc->trigger);
|
||||
if (pc->plugin)
|
||||
evry_plugin_free(pc->plugin);
|
||||
E_FREE(pc);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_config_free(void)
|
||||
{
|
||||
_plugin_config_free();
|
||||
|
||||
E_FREE(evry_conf);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "e.h"
|
||||
#include "evry_api.h"
|
||||
|
||||
#define MOD_CONFIG_FILE_EPOCH 0x0003
|
||||
#define MOD_CONFIG_FILE_EPOCH 0x0004
|
||||
#define MOD_CONFIG_FILE_GENERATION 0x0001
|
||||
#define MOD_CONFIG_FILE_VERSION \
|
||||
((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION)
|
||||
|
@ -166,6 +166,7 @@ struct _Config
|
|||
Eina_List *conf_actions;
|
||||
Eina_List *conf_objects;
|
||||
Eina_List *conf_views;
|
||||
Eina_List *collections;
|
||||
|
||||
int scroll_animate;
|
||||
double scroll_speed;
|
||||
|
@ -239,6 +240,7 @@ const char *evry_file_url_get(Evry_Item_File *file);
|
|||
|
||||
int evry_plugin_register(Evry_Plugin *p, int type, int priority);
|
||||
void evry_plugin_unregister(Evry_Plugin *p);
|
||||
Evry_Plugin *evry_plugin_find(const char *name);
|
||||
void evry_action_register(Evry_Action *act, int priority);
|
||||
void evry_action_unregister(Evry_Action *act);
|
||||
void evry_view_register(Evry_View *view, int priority);
|
||||
|
@ -289,6 +291,9 @@ void evry_plug_clipboard_shutdown(void);
|
|||
Eina_Bool evry_plug_text_init(void);
|
||||
void evry_plug_text_shutdown(void);
|
||||
|
||||
Eina_Bool evry_plug_collection_init(void);
|
||||
void evry_plug_collection_shutdown(void);
|
||||
|
||||
int evry_init(void);
|
||||
int evry_shutdown(void);
|
||||
int evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params);
|
||||
|
|
|
@ -1619,14 +1619,19 @@ _evry_state_pop(Evry_Selector *sel, int immediate)
|
|||
|
||||
EINA_LIST_FREE(s->plugins, p)
|
||||
{
|
||||
/* FIXME use it->free cb also for plugin instances*/
|
||||
|
||||
/* skip non top-level plugins */
|
||||
if (prev && eina_list_data_find(prev->plugins, p))
|
||||
{
|
||||
p->state = prev;
|
||||
continue;
|
||||
}
|
||||
|
||||
p->finish(p);
|
||||
|
||||
if (EVRY_ITEM(p)->ref == 0)
|
||||
p->finish(p);
|
||||
else
|
||||
p->state = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1709,6 +1714,8 @@ evry_browse_item(Evry_Item *it)
|
|||
{
|
||||
if ((p->browse) && (pp = p->browse(p, it)))
|
||||
{
|
||||
printf("append %s\n", pp->name);
|
||||
|
||||
plugins = eina_list_append(plugins, pp);
|
||||
}
|
||||
}
|
||||
|
@ -1717,6 +1724,7 @@ evry_browse_item(Evry_Item *it)
|
|||
if ((!(plugins) && (it->plugin->browse)) &&
|
||||
(pp = it->plugin->browse(it->plugin, it)))
|
||||
{
|
||||
printf("append 2%s\n", pp->name);
|
||||
plugins = eina_list_append(plugins, pp);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "evry_types.h"
|
||||
|
||||
#define EVRY_API_VERSION 25
|
||||
#define EVRY_API_VERSION 26
|
||||
|
||||
#define EVRY_ACTION_OTHER 0
|
||||
#define EVRY_ACTION_FINISHED 1
|
||||
|
@ -83,7 +83,8 @@ struct _Evry_API
|
|||
int (*plugin_register)(Evry_Plugin *p, int type, int priority);
|
||||
void (*plugin_unregister)(Evry_Plugin *p);
|
||||
void (*plugin_update)(Evry_Plugin *plugin, int state);
|
||||
|
||||
Evry_Plugin *(*plugin_find)(const char *name);
|
||||
|
||||
Evry_Action *(*action_new)(const char *name, const char *label,
|
||||
Evry_Type type1, Evry_Type type2,
|
||||
const char *icon,
|
||||
|
|
|
@ -33,7 +33,7 @@ struct _Plugin_Page
|
|||
int enabled;
|
||||
int min_query;
|
||||
Plugin_Config *cur;
|
||||
} ;
|
||||
};
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
|
@ -193,7 +193,7 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, int enabled __UNUSED__)
|
|||
Eina_List *l;
|
||||
Plugin_Config *pc;
|
||||
Evas_Object *end;
|
||||
|
||||
|
||||
/* freeze evas, edje, and list widget */
|
||||
evas = evas_object_evas_get(obj);
|
||||
evas_event_freeze(evas);
|
||||
|
@ -584,7 +584,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdat
|
|||
e_widget_framelist_object_append(of, ob);
|
||||
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||
|
||||
|
||||
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Geometry"),
|
||||
o, 1, 0, 1, 0, 0.5, 0.0);
|
||||
|
||||
|
@ -593,3 +593,149 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdat
|
|||
|
||||
return otb;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
#if 0
|
||||
static void *_cat_create_data(E_Config_Dialog *cfd);
|
||||
static void _cat_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static Evas_Object *_cat_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
static int _cat_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
|
||||
static E_Config_Dialog *
|
||||
evry_categories_conf_dialog(E_Container *con, const char *params)
|
||||
{
|
||||
E_Config_Dialog *cfd = NULL;
|
||||
E_Config_Dialog_View *v = NULL;
|
||||
char buf[4096];
|
||||
|
||||
if (e_config_dialog_find(_config_path, _config_path))
|
||||
return NULL;
|
||||
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
if (!v) return NULL;
|
||||
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.create_widgets = _basic_create_widgets;
|
||||
v->basic.apply_cfdata = _basic_apply;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/e-module.edj", _conf->module->dir);
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Everything Categories"),
|
||||
_config_path, _config_path, buf, 0, v, NULL);
|
||||
|
||||
_conf->cfd = cfd;
|
||||
return cfd;
|
||||
}
|
||||
|
||||
static void *
|
||||
_cat_create_data(E_Config_Dialog *cfd)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata = NULL;
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
|
||||
cfdata->page[0].configs = eina_list_clone(_conf->plugins);
|
||||
|
||||
/* #define CP(_name) cfdata->_name = strdup(_conf->_name);
|
||||
* #define C(_name) cfdata->_name = _conf->_name;
|
||||
*
|
||||
* #undef CP
|
||||
* #undef C */
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_cat_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
if (cfdata->page[0].configs) eina_list_free(cfdata->page[0].configs);
|
||||
|
||||
_conf->cfd = NULL;
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
static int
|
||||
_cat_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
int i = 0;
|
||||
Plugin_Config *pc;
|
||||
|
||||
_conf->plugins = eina_list_clone(cfdata->page[0].configs);
|
||||
|
||||
pc = cfdata->page[i].cur;
|
||||
|
||||
if (pc)
|
||||
{
|
||||
if (pc->trigger)
|
||||
eina_stringshare_del(pc->trigger);
|
||||
|
||||
if (cfdata->page[i].trigger[0])
|
||||
pc->trigger = eina_stringshare_add(cfdata->page[i].trigger);
|
||||
else
|
||||
pc->trigger = NULL;
|
||||
|
||||
pc->trigger_only = cfdata->page[i].trigger_only;
|
||||
pc->view_mode = cfdata->page[i].view_mode;
|
||||
pc->enabled = cfdata->page[i].enabled;
|
||||
pc->aggregate = cfdata->page[i].aggregate;
|
||||
pc->top_level = cfdata->page[i].top_level;
|
||||
pc->min_query = cfdata->page[i].min_query;
|
||||
}
|
||||
|
||||
/* #define CP(_name) \
|
||||
* if (_conf->_name) \
|
||||
* eina_stringshare_del(_conf->_name); \
|
||||
* _conf->_name = eina_stringshare_add(cfdata->_name);
|
||||
* #define C(_name) _conf->_name = cfdata->_name;
|
||||
*
|
||||
* #undef CP
|
||||
* #undef C */
|
||||
|
||||
e_config_domain_save(_config_domain, _conf_edd, _conf);
|
||||
e_config_save_queue();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
_cat_plugin_move(Eina_List *plugins, Evas_Object *list, int dir)
|
||||
{
|
||||
int sel;
|
||||
Eina_List *l1, *l2;
|
||||
|
||||
sel = e_widget_ilist_selected_get(list);
|
||||
|
||||
Plugin_Config *pc;
|
||||
int prio = 0;
|
||||
|
||||
l1 = eina_list_nth_list(plugins, sel);
|
||||
l2 = eina_list_nth_list(plugins, sel + dir);
|
||||
|
||||
if (!l1 || !l2) return;
|
||||
pc = l1->data;
|
||||
l1->data = l2->data;
|
||||
l2->data = pc;
|
||||
|
||||
_fill_list(plugins, list, 0);
|
||||
e_widget_ilist_selected_set(list, sel + dir);
|
||||
|
||||
EINA_LIST_FOREACH(plugins, l1, pc)
|
||||
pc->priority = prio++;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_cat_basic_create_widgets(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *o, *of, *ob, *otb;
|
||||
|
||||
otb = e_widget_toolbook_add(e, 48 * e_scale, 48 * e_scale);
|
||||
|
||||
ob = _create_plugin_page(cfdata, e, &cfdata->page[0]);
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Plugins"),
|
||||
ob, 1, 0, 1, 0, 0.5, 0.0);
|
||||
|
||||
e_widget_toolbook_page_show(otb, 0);
|
||||
|
||||
return otb;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -62,6 +62,8 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
|||
|
||||
GET_PLUGIN(p, plugin);
|
||||
|
||||
EINA_LIST_FREE(p->actions, act);
|
||||
|
||||
if (!(CHECK_TYPE(it, EVRY_TYPE_PLUGIN)))
|
||||
{
|
||||
EINA_LIST_FOREACH(evry_conf->actions, l, act)
|
||||
|
@ -69,23 +71,16 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
|||
if (!((!act->it1.type) ||
|
||||
(CHECK_TYPE(it, act->it1.type)) ||
|
||||
(CHECK_SUBTYPE(it, act->it1.type))))
|
||||
{
|
||||
p->actions = eina_list_remove(p->actions, act);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
|
||||
if (act->check_item && !(act->check_item(act, it)))
|
||||
{
|
||||
p->actions = eina_list_remove(p->actions, act);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
|
||||
act->base.plugin = plugin;
|
||||
act->it1.item = it;
|
||||
EVRY_ITEM(act)->hi = NULL;
|
||||
|
||||
if (!eina_list_data_find_list(p->actions, act))
|
||||
p->actions = eina_list_append(p->actions, act);
|
||||
p->actions = eina_list_append(p->actions, act);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,12 +90,9 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
|
|||
{
|
||||
act->base.plugin = plugin;
|
||||
|
||||
if (!eina_list_data_find_list(p->actions, act))
|
||||
{
|
||||
act->it1.item = EVRY_ITEM(it->plugin);
|
||||
EVRY_ITEM(act)->hi = NULL;
|
||||
p->actions = eina_list_append(p->actions, act);
|
||||
}
|
||||
act->it1.item = EVRY_ITEM(it->plugin);
|
||||
EVRY_ITEM(act)->hi = NULL;
|
||||
p->actions = eina_list_append(p->actions, act);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,11 +184,13 @@ evry_plug_actions_new(Evry_Selector *sel, int type)
|
|||
|
||||
if (type == EVRY_PLUGIN_SUBJECT)
|
||||
{
|
||||
plugin = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL, 0, NULL, _finish, _fetch, NULL);
|
||||
plugin = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL, 0,
|
||||
NULL, _finish, _fetch, NULL);
|
||||
}
|
||||
else if (type == EVRY_PLUGIN_ACTION)
|
||||
{
|
||||
plugin = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL, 0, _begin, _finish, _fetch, NULL);
|
||||
plugin = EVRY_PLUGIN_NEW(Plugin, N_("Actions"), NULL, 0,
|
||||
_begin, _finish, _fetch, NULL);
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
|
|
|
@ -90,9 +90,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
|||
* it->fuzzy_match = ;
|
||||
* } */
|
||||
|
||||
IF_RELEASE(it->detail);
|
||||
snprintf(buf, sizeof(buf), "%d %s", eina_list_count(pp->items), _("Items"));
|
||||
if (it->detail)
|
||||
eina_stringshare_del(it->detail);
|
||||
it->detail = eina_stringshare_add(buf);
|
||||
|
||||
items = eina_list_append(items, it);
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||
*/
|
||||
|
||||
#include "e_mod_main.h"
|
||||
|
||||
|
||||
typedef struct _Plugin Plugin;
|
||||
|
||||
struct _Plugin
|
||||
{
|
||||
Evry_Plugin base;
|
||||
const char *input;
|
||||
Eina_List *items;
|
||||
};
|
||||
|
||||
static Eina_List *plugins = NULL;
|
||||
static const char _module_icon[] = "start";
|
||||
static Evry_Type COLLECTION_PLUGIN;
|
||||
|
||||
|
||||
static Evry_Plugin *
|
||||
_browse(Evry_Plugin *plugin, const Evry_Item *item)
|
||||
{
|
||||
Evry_Plugin *inst;
|
||||
Evry_Plugin *pp;
|
||||
|
||||
Plugin_Config *pc;
|
||||
|
||||
if (!CHECK_TYPE(item, COLLECTION_PLUGIN))
|
||||
return NULL;
|
||||
|
||||
pc = item->data;
|
||||
pp = pc->plugin;
|
||||
|
||||
GET_PLUGIN(p, item->plugin);
|
||||
|
||||
if (pp->begin && (inst = pp->begin(pp, NULL)))
|
||||
{
|
||||
inst->config = pc;
|
||||
return inst;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Evry_Plugin *
|
||||
_begin(Evry_Plugin *plugin, const Evry_Item *item)
|
||||
{
|
||||
Evry_Plugin *pp;
|
||||
Plugin_Config *pc;
|
||||
Evry_Item *it;
|
||||
Plugin *p;
|
||||
Eina_List *l;
|
||||
|
||||
EVRY_PLUGIN_INSTANCE(p, plugin);
|
||||
|
||||
EINA_LIST_FOREACH(plugin->config->plugins, l, pc)
|
||||
{
|
||||
if (!pc->enabled)
|
||||
continue;
|
||||
|
||||
if ((pp = evry_plugin_find(pc->name)))
|
||||
{
|
||||
GET_ITEM(itp, pp);
|
||||
it = EVRY_ITEM_NEW(Evry_Item, EVRY_PLUGIN(p), itp->label, NULL, NULL);
|
||||
if (itp->icon) it->icon = eina_stringshare_ref(itp->icon);
|
||||
pc->plugin = pp;
|
||||
it->data = pc;
|
||||
it->browseable = EINA_TRUE;
|
||||
p->base.items = eina_list_append(p->base.items, it);
|
||||
}
|
||||
}
|
||||
|
||||
return EVRY_PLUGIN(p);
|
||||
}
|
||||
|
||||
static void
|
||||
_finish(Evry_Plugin *plugin)
|
||||
{
|
||||
Evry_Plugin *inst;
|
||||
|
||||
GET_PLUGIN(p, plugin);
|
||||
|
||||
EVRY_PLUGIN_ITEMS_FREE(p);
|
||||
|
||||
IF_RELEASE(p->input);
|
||||
|
||||
E_FREE(p);
|
||||
}
|
||||
|
||||
static int
|
||||
_fetch(Evry_Plugin *plugin, const char *input)
|
||||
{
|
||||
GET_PLUGIN(p, plugin);
|
||||
|
||||
return !!(p->base.items);
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
evry_plug_collection_init(void)
|
||||
{
|
||||
Evry_Plugin *p;
|
||||
Plugin_Config *pc, *pcc;
|
||||
Eina_List *l;
|
||||
|
||||
COLLECTION_PLUGIN = evry_type_register("COLLECTION_PLUGIN");
|
||||
|
||||
EINA_LIST_FOREACH(evry_conf->collections, l, pc)
|
||||
{
|
||||
p = EVRY_PLUGIN_NEW(Evry_Plugin, N_(pc->name),
|
||||
_module_icon, COLLECTION_PLUGIN,
|
||||
_begin, _finish, _fetch, NULL);
|
||||
p->browse = &_browse;
|
||||
p->config = pc;
|
||||
pc->plugin = p;
|
||||
if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 1))
|
||||
{
|
||||
p->config->aggregate = EINA_FALSE;
|
||||
}
|
||||
plugins = eina_list_append(plugins, p);
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
evry_plug_collection_shutdown(void)
|
||||
{
|
||||
Evry_Plugin *p;
|
||||
|
||||
EINA_LIST_FREE(plugins, p)
|
||||
EVRY_PLUGIN_FREE(p);
|
||||
}
|
|
@ -119,6 +119,7 @@ _evry_plugin_action_browse(Evry_Action *act)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME check for name already used */
|
||||
int
|
||||
evry_plugin_register(Evry_Plugin *p, int type, int priority)
|
||||
{
|
||||
|
@ -131,45 +132,6 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority)
|
|||
if (type < 0 || type > 2)
|
||||
return 0;
|
||||
|
||||
conf[0] = evry_conf->conf_subjects;
|
||||
conf[1] = evry_conf->conf_actions;
|
||||
conf[2] = evry_conf->conf_objects;
|
||||
|
||||
EINA_LIST_FOREACH(conf[type], l, pc)
|
||||
if (pc->name && p->name && !strcmp(pc->name, p->name))
|
||||
break;
|
||||
|
||||
if (!pc)
|
||||
{
|
||||
new_conf = 1;
|
||||
pc = E_NEW(Plugin_Config, 1);
|
||||
pc->name = eina_stringshare_add(p->name);
|
||||
pc->enabled = 1;
|
||||
pc->priority = priority ? priority : 100;
|
||||
pc->view_mode = VIEW_MODE_NONE;
|
||||
pc->aggregate = EINA_TRUE;
|
||||
pc->top_level = EINA_TRUE;
|
||||
|
||||
conf[type] = eina_list_append(conf[type], pc);
|
||||
}
|
||||
if (pc->trigger && strlen(pc->trigger) == 0)
|
||||
{
|
||||
eina_stringshare_del(pc->trigger);
|
||||
pc->trigger = NULL;
|
||||
}
|
||||
|
||||
p->config = pc;
|
||||
pc->plugin = p;
|
||||
|
||||
conf[type] = eina_list_sort(conf[type], -1, _evry_cb_plugin_sort);
|
||||
|
||||
/* EINA_LIST_FOREACH(conf[type], l, pc)
|
||||
* pc->priority = i++; */
|
||||
|
||||
evry_conf->conf_subjects = conf[0];
|
||||
evry_conf->conf_actions = conf[1];
|
||||
evry_conf->conf_objects = conf[2];
|
||||
|
||||
if (type == EVRY_PLUGIN_SUBJECT)
|
||||
{
|
||||
char buf[256];
|
||||
|
@ -191,6 +153,53 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority)
|
|||
evry_action_register(act, 1);
|
||||
actions = eina_list_append(actions, act);
|
||||
}
|
||||
|
||||
conf[0] = evry_conf->conf_subjects;
|
||||
conf[1] = evry_conf->conf_actions;
|
||||
conf[2] = evry_conf->conf_objects;
|
||||
|
||||
/* collection plugin sets its own config */
|
||||
if (p->config)
|
||||
{
|
||||
conf[type] = eina_list_append(conf[type], p->config);
|
||||
}
|
||||
else
|
||||
{
|
||||
EINA_LIST_FOREACH(conf[type], l, pc)
|
||||
if (pc->name && p->name && !strcmp(pc->name, p->name))
|
||||
break;
|
||||
|
||||
if (!pc)
|
||||
{
|
||||
new_conf = 1;
|
||||
pc = E_NEW(Plugin_Config, 1);
|
||||
pc->name = eina_stringshare_add(p->name);
|
||||
pc->enabled = 1;
|
||||
pc->priority = priority ? priority : 100;
|
||||
pc->view_mode = VIEW_MODE_NONE;
|
||||
pc->aggregate = EINA_TRUE;
|
||||
pc->top_level = EINA_TRUE;
|
||||
|
||||
conf[type] = eina_list_append(conf[type], pc);
|
||||
}
|
||||
if (pc->trigger && strlen(pc->trigger) == 0)
|
||||
{
|
||||
eina_stringshare_del(pc->trigger);
|
||||
pc->trigger = NULL;
|
||||
}
|
||||
|
||||
p->config = pc;
|
||||
pc->plugin = p;
|
||||
|
||||
conf[type] = eina_list_sort(conf[type], -1, _evry_cb_plugin_sort);
|
||||
|
||||
/* EINA_LIST_FOREACH(conf[type], l, pc)
|
||||
* pc->priority = i++; */
|
||||
}
|
||||
|
||||
evry_conf->conf_subjects = conf[0];
|
||||
evry_conf->conf_actions = conf[1];
|
||||
evry_conf->conf_objects = conf[2];
|
||||
|
||||
return new_conf;
|
||||
}
|
||||
|
@ -209,3 +218,25 @@ evry_plugin_unregister(Evry_Plugin *p)
|
|||
e_action_predef_name_del(_("Everything"), buf);
|
||||
}
|
||||
}
|
||||
|
||||
Evry_Plugin *
|
||||
evry_plugin_find(const char *name)
|
||||
{
|
||||
Plugin_Config *pc = NULL;
|
||||
Eina_List *l;
|
||||
const char *n = eina_stringshare_add(name);
|
||||
|
||||
EINA_LIST_FOREACH(evry_conf->conf_subjects, l, pc)
|
||||
{
|
||||
if (!pc->enabled) continue;
|
||||
if (!pc->plugin) continue;
|
||||
if (pc->name == n)
|
||||
break;
|
||||
}
|
||||
|
||||
eina_stringshare_del(n);
|
||||
|
||||
if (!pc) return NULL;
|
||||
|
||||
return pc->plugin;
|
||||
}
|
||||
|
|
|
@ -238,6 +238,8 @@ struct _Plugin_Config
|
|||
|
||||
/* do not set! */
|
||||
Evry_Plugin *plugin;
|
||||
|
||||
Eina_List *plugins;
|
||||
};
|
||||
|
||||
struct _History_Item
|
||||
|
|
|
@ -357,12 +357,6 @@ evry_util_plugin_items_add(Evry_Plugin *p, Eina_List *items, const char *input,
|
|||
Evry_Item *it;
|
||||
int match = 0;
|
||||
|
||||
if (p->items)
|
||||
{
|
||||
ERR("items not cleared");
|
||||
return 1;
|
||||
}
|
||||
|
||||
EINA_LIST_FOREACH(items, l, it)
|
||||
{
|
||||
it->fuzzy_match = 0;
|
||||
|
@ -590,7 +584,6 @@ evry_util_icon_get(Evry_Item *it, Evas *e)
|
|||
return o;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file)
|
||||
{
|
||||
|
|
|
@ -216,7 +216,10 @@ _item_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
evry_item_select(sd->view->state, it->item);
|
||||
_pan_item_select(it->obj, it, 0);
|
||||
|
||||
evry_plugin_action(1);
|
||||
if (it->item->browseable)
|
||||
evry_browse_item(it->item);
|
||||
else
|
||||
evry_plugin_action(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -360,40 +363,46 @@ _e_smart_reconfigure_do(void *data)
|
|||
int size;
|
||||
int cnt = eina_list_count(sd->items);
|
||||
double col = 1;
|
||||
|
||||
int width = sd->w - 8;
|
||||
|
||||
if (cnt < 5)
|
||||
{
|
||||
col = 2;
|
||||
aspect_w = sd->w * 2;
|
||||
aspect_w = width * 2;
|
||||
}
|
||||
else if ((cnt < 9) && (sd->h > sd->w))
|
||||
{
|
||||
col = 2;
|
||||
aspect_w = width * 3;
|
||||
}
|
||||
else if (cnt < 10)
|
||||
{
|
||||
col = 3;
|
||||
aspect_w = sd->w * 3;
|
||||
aspect_w = width * 3;
|
||||
}
|
||||
else if (sd->view->zoom == 0)
|
||||
{
|
||||
size = 96;
|
||||
aspect_w *= 1 + (sd->h / size);
|
||||
col = sd->w / size;
|
||||
aspect_w = width * (1 + (sd->h / size));
|
||||
col = width / size;
|
||||
}
|
||||
else if (sd->view->zoom == 1)
|
||||
{
|
||||
size = 128;
|
||||
col = sd->w / size;
|
||||
aspect_w *= 1 + (sd->h / size);
|
||||
col = width / size;
|
||||
aspect_w = width * (1 + (sd->h / size));
|
||||
}
|
||||
|
||||
else /* if (sd->view->zoom == 2) */
|
||||
{
|
||||
size = 256;
|
||||
col = sd->w / size;
|
||||
aspect_w *= (sd->h / size);
|
||||
size = 192;
|
||||
col = width / size;
|
||||
aspect_w = width * (sd->h / size);
|
||||
}
|
||||
|
||||
if (col < 1) col = 1;
|
||||
|
||||
iw = sd->w / col;
|
||||
iw = width / col;
|
||||
aspect_w /= col;
|
||||
}
|
||||
|
||||
|
@ -1408,7 +1417,9 @@ _view_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
goto end;
|
||||
|
||||
sel = sd->view->state->selector;
|
||||
|
||||
if (!sel || !sel->states)
|
||||
return;
|
||||
|
||||
diff_x = abs(ev->cur.canvas.x - sd->mouse_x);
|
||||
diff_y = abs(ev->cur.canvas.y - sd->mouse_y);
|
||||
|
||||
|
@ -1419,7 +1430,7 @@ _view_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
|||
goto end;
|
||||
}
|
||||
|
||||
if (sel->states->next || (sel != sel->win->selectors[0]))
|
||||
if ((sel->states->next) || (sel != sel->win->selectors[0]))
|
||||
edje_object_signal_emit(sd->view->bg, "e,action,show,back", "e");
|
||||
|
||||
if (sd->it_down)
|
||||
|
|
Loading…
Reference in New Issue