forked from enlightenment/enlightenment
'everything' module:
- support the inheritance of plugins for plugins with one instances per state (dir_browse) - moved internal plugins action_selector and aggregator to separate files - all type_in/out checks are now done with pointer comparison SVN revision: 41920
This commit is contained in:
parent
f8c05999e4
commit
a9589df2e7
|
@ -76,11 +76,12 @@ struct _Evry_Plugin
|
||||||
/* whether the plugin uses evry_async_update to add new items */
|
/* whether the plugin uses evry_async_update to add new items */
|
||||||
int async_fetch;
|
int async_fetch;
|
||||||
|
|
||||||
/* run when plugin is activated. when return true plugin is added
|
/* list of items visible for everything */
|
||||||
to the list of current plugins and queried for results */
|
Eina_List *items;
|
||||||
int (*begin) (Evry_Plugin *p, const Evry_Item *item);
|
|
||||||
|
|
||||||
int (*browse) (Evry_Plugin *p, const Evry_Item *item);
|
/* run when plugin is activated. when return plugin is added
|
||||||
|
to the list of current plugins and queried for results */
|
||||||
|
Evry_Plugin *(*begin) (Evry_Plugin *p, const Evry_Item *item);
|
||||||
|
|
||||||
/* get candidates matching string, fills 'candidates' list */
|
/* get candidates matching string, fills 'candidates' list */
|
||||||
int (*fetch) (Evry_Plugin *p, const char *input);
|
int (*fetch) (Evry_Plugin *p, const char *input);
|
||||||
|
@ -95,15 +96,9 @@ struct _Evry_Plugin
|
||||||
/* optional: default action for this plugins items */
|
/* optional: default action for this plugins items */
|
||||||
int (*action) (Evry_Plugin *p, const Evry_Item *item, const char *input);
|
int (*action) (Evry_Plugin *p, const Evry_Item *item, const char *input);
|
||||||
|
|
||||||
|
|
||||||
Eina_List *items;
|
|
||||||
|
|
||||||
Evas_Object *(*config_page) (Evry_Plugin *p);
|
Evas_Object *(*config_page) (Evry_Plugin *p);
|
||||||
void (*config_apply) (Evry_Plugin *p);
|
void (*config_apply) (Evry_Plugin *p);
|
||||||
|
|
||||||
/* only for internal use by plugin */
|
|
||||||
void *private;
|
|
||||||
|
|
||||||
/* not to be set by plugin! */
|
/* not to be set by plugin! */
|
||||||
Plugin_Config *config;
|
Plugin_Config *config;
|
||||||
};
|
};
|
||||||
|
@ -157,7 +152,8 @@ struct _Evry_Action
|
||||||
|
|
||||||
const char *type_in1;
|
const char *type_in1;
|
||||||
const char *type_in2;
|
const char *type_in2;
|
||||||
|
const char *type_out;
|
||||||
|
|
||||||
int (*action) (Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, const char *input);
|
int (*action) (Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, const char *input);
|
||||||
|
|
||||||
int (*check_item) (Evry_Action *act, const Evry_Item *it);
|
int (*check_item) (Evry_Action *act, const Evry_Item *it);
|
||||||
|
@ -207,24 +203,24 @@ EAPI Evas_Object *evry_icon_theme_get(const char *icon, Evas *e);
|
||||||
|
|
||||||
EAPI int evry_fuzzy_match(const char *str, const char *match);
|
EAPI int evry_fuzzy_match(const char *str, const char *match);
|
||||||
|
|
||||||
EAPI Evry_Plugin *evry_plugin_new(const char *name, int type,
|
EAPI Evry_Plugin *evry_plugin_new(Evry_Plugin *base, const char *name, int type,
|
||||||
const char *type_in, const char *type_out,
|
const char *type_in, const char *type_out,
|
||||||
int async_fetch, const char *icon, const char *trigger,
|
int async_fetch, const char *icon, const char *trigger,
|
||||||
int (*begin) (Evry_Plugin *p, const Evry_Item *item),
|
Evry_Plugin *(*begin) (Evry_Plugin *p, const Evry_Item *item),
|
||||||
void (*cleanup) (Evry_Plugin *p),
|
void (*cleanup) (Evry_Plugin *p),
|
||||||
int (*fetch) (Evry_Plugin *p, const char *input),
|
int (*fetch) (Evry_Plugin *p, const char *input),
|
||||||
int (*action) (Evry_Plugin *p, const Evry_Item *item, const char *input),
|
int (*action) (Evry_Plugin *p, const Evry_Item *item, const char *input),
|
||||||
int (*browse) (Evry_Plugin *p, const Evry_Item *item),
|
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),
|
Evas_Object *(*config_page) (Evry_Plugin *p),
|
||||||
Evas_Object *(*config_page) (Evry_Plugin *p),
|
void (*config_apply) (Evry_Plugin *p));
|
||||||
void (*config_apply) (Evry_Plugin *p));
|
|
||||||
|
|
||||||
EAPI void evry_plugin_free(Evry_Plugin *p);
|
EAPI void evry_plugin_free(Evry_Plugin *p, int free_pointer);
|
||||||
|
|
||||||
|
|
||||||
EAPI Evry_Action *evry_action_new(const char *name, const char *type_in1, const char *type_in2, const char *icon,
|
EAPI Evry_Action *evry_action_new(const char *name, const char *type_in1, const char *type_in2, const char *type_out,
|
||||||
int (*action) (Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, const char *input),
|
const char *icon,
|
||||||
int (*check_item) (Evry_Action *act, const Evry_Item *it),
|
int (*action) (Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, const char *input),
|
||||||
Evas_Object *(*icon_get) (Evry_Action *act, Evas *e));
|
int (*check_item) (Evry_Action *act, const Evry_Item *it),
|
||||||
|
Evas_Object *(*icon_get) (Evry_Action *act, Evas *e));
|
||||||
|
|
||||||
EAPI void evry_action_free(Evry_Action *act);
|
EAPI void evry_action_free(Evry_Action *act);
|
||||||
|
|
|
@ -27,7 +27,9 @@ module_la_SOURCES = $(EVRYHEADERS) \
|
||||||
e_mod_main.c \
|
e_mod_main.c \
|
||||||
e_mod_main.h \
|
e_mod_main.h \
|
||||||
evry.c \
|
evry.c \
|
||||||
evry_config.c
|
evry_config.c \
|
||||||
|
evry_plug_aggregator.c \
|
||||||
|
evry_plug_actions.c
|
||||||
|
|
||||||
|
|
||||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||||
|
|
|
@ -42,8 +42,6 @@ static Eina_Bool list_cb(Eina_Module *m, void *data)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EAPI void *
|
EAPI void *
|
||||||
e_modapi_init(E_Module *m)
|
e_modapi_init(E_Module *m)
|
||||||
{
|
{
|
||||||
|
@ -168,10 +166,6 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
||||||
e_action_del("everything");
|
e_action_del("everything");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* conf_module = NULL; */
|
|
||||||
if (evry_conf->plugins) eina_list_free(evry_conf->plugins);
|
|
||||||
if (evry_conf->actions) eina_list_free(evry_conf->actions);
|
|
||||||
|
|
||||||
if (plugins)
|
if (plugins)
|
||||||
{
|
{
|
||||||
eina_module_list_unload(plugins);
|
eina_module_list_unload(plugins);
|
||||||
|
@ -187,6 +181,8 @@ 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);
|
||||||
|
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_subjects) eina_list_free(evry_conf->conf_subjects);
|
||||||
if (evry_conf->conf_actions) eina_list_free(evry_conf->conf_actions);
|
if (evry_conf->conf_actions) eina_list_free(evry_conf->conf_actions);
|
||||||
if (evry_conf->conf_objects) eina_list_free(evry_conf->conf_objects);
|
if (evry_conf->conf_objects) eina_list_free(evry_conf->conf_objects);
|
||||||
|
@ -272,19 +268,23 @@ _evry_cb_plugin_sort(const void *data1, const void *data2)
|
||||||
}
|
}
|
||||||
|
|
||||||
Evry_Plugin *
|
Evry_Plugin *
|
||||||
evry_plugin_new(const char *name, int type,
|
evry_plugin_new(Evry_Plugin *base, const char *name, int type,
|
||||||
const char *type_in, const char *type_out,
|
const char *type_in, const char *type_out,
|
||||||
int async_fetch, const char *icon, const char *trigger,
|
int async_fetch, const char *icon, const char *trigger,
|
||||||
int (*begin) (Evry_Plugin *p, const Evry_Item *item),
|
Evry_Plugin *(*begin) (Evry_Plugin *p, const Evry_Item *item),
|
||||||
void (*cleanup) (Evry_Plugin *p),
|
void (*cleanup) (Evry_Plugin *p),
|
||||||
int (*fetch) (Evry_Plugin *p, const char *input),
|
int (*fetch) (Evry_Plugin *p, const char *input),
|
||||||
int (*action) (Evry_Plugin *p, const Evry_Item *item, const char *input),
|
int (*action) (Evry_Plugin *p, const Evry_Item *item, const char *input),
|
||||||
int (*browse) (Evry_Plugin *p, const Evry_Item *item),
|
|
||||||
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),
|
||||||
Evas_Object *(*config_page) (Evry_Plugin *p),
|
Evas_Object *(*config_page) (Evry_Plugin *p),
|
||||||
void (*config_apply) (Evry_Plugin *p))
|
void (*config_apply) (Evry_Plugin *p))
|
||||||
{
|
{
|
||||||
Evry_Plugin *p = E_NEW(Evry_Plugin, 1);
|
Evry_Plugin *p;
|
||||||
|
|
||||||
|
if (base)
|
||||||
|
p = base;
|
||||||
|
else
|
||||||
|
p = E_NEW(Evry_Plugin, 1);
|
||||||
|
|
||||||
p->name = eina_stringshare_add(name);
|
p->name = eina_stringshare_add(name);
|
||||||
p->type = type;
|
p->type = type;
|
||||||
|
@ -298,7 +298,6 @@ evry_plugin_new(const char *name, int type,
|
||||||
p->fetch = fetch;
|
p->fetch = fetch;
|
||||||
p->icon_get = icon_get;
|
p->icon_get = icon_get;
|
||||||
p->action = action;
|
p->action = action;
|
||||||
p->browse = browse;
|
|
||||||
p->config_page = config_page;
|
p->config_page = config_page;
|
||||||
p->config_apply = config_apply;
|
p->config_apply = config_apply;
|
||||||
|
|
||||||
|
@ -306,7 +305,7 @@ evry_plugin_new(const char *name, int type,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evry_plugin_free(Evry_Plugin *p)
|
evry_plugin_free(Evry_Plugin *p, int free_pointer)
|
||||||
{
|
{
|
||||||
evry_plugin_unregister(p);
|
evry_plugin_unregister(p);
|
||||||
|
|
||||||
|
@ -325,13 +324,14 @@ evry_plugin_free(Evry_Plugin *p)
|
||||||
|
|
||||||
E_FREE(p->config);
|
E_FREE(p->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
E_FREE(p);
|
if (free_pointer)
|
||||||
|
E_FREE(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Evry_Action *
|
Evry_Action *
|
||||||
evry_action_new(const char *name, const char *type_in1, const char *type_in2, const char *icon,
|
evry_action_new(const char *name, const char *type_in1, const char *type_in2, const char *type_out, const char *icon,
|
||||||
int (*action) (Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, const char *input),
|
int (*action) (Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2, const char *input),
|
||||||
int (*check_item) (Evry_Action *act, const Evry_Item *it),
|
int (*check_item) (Evry_Action *act, const Evry_Item *it),
|
||||||
Evas_Object *(*icon_get) (Evry_Action *act, Evas *e))
|
Evas_Object *(*icon_get) (Evry_Action *act, Evas *e))
|
||||||
|
@ -340,6 +340,7 @@ evry_action_new(const char *name, const char *type_in1, const char *type_in2, co
|
||||||
act->name = eina_stringshare_add(name);
|
act->name = eina_stringshare_add(name);
|
||||||
act->type_in1 = (type_in1 ? eina_stringshare_add(type_in1) : NULL);
|
act->type_in1 = (type_in1 ? eina_stringshare_add(type_in1) : NULL);
|
||||||
act->type_in2 = (type_in2 ? eina_stringshare_add(type_in2) : NULL);
|
act->type_in2 = (type_in2 ? eina_stringshare_add(type_in2) : NULL);
|
||||||
|
act->type_out = (type_out ? eina_stringshare_add(type_out) : NULL);
|
||||||
act->action = action;
|
act->action = action;
|
||||||
act->check_item = check_item;
|
act->check_item = check_item;
|
||||||
act->icon = (icon ? eina_stringshare_add(icon) : NULL);
|
act->icon = (icon ? eina_stringshare_add(icon) : NULL);
|
||||||
|
@ -356,6 +357,7 @@ evry_action_free(Evry_Action *act)
|
||||||
if (act->name) eina_stringshare_del(act->name);
|
if (act->name) eina_stringshare_del(act->name);
|
||||||
if (act->type_in1) eina_stringshare_del(act->type_in1);
|
if (act->type_in1) eina_stringshare_del(act->type_in1);
|
||||||
if (act->type_in2) eina_stringshare_del(act->type_in2);
|
if (act->type_in2) eina_stringshare_del(act->type_in2);
|
||||||
|
if (act->type_out) eina_stringshare_del(act->type_out);
|
||||||
if (act->icon) eina_stringshare_del(act->icon);
|
if (act->icon) eina_stringshare_del(act->icon);
|
||||||
|
|
||||||
E_FREE(act);
|
E_FREE(act);
|
||||||
|
@ -479,3 +481,81 @@ evry_view_unregister(Evry_View *view)
|
||||||
{
|
{
|
||||||
evry_conf->views = eina_list_remove(evry_conf->views, view);
|
evry_conf->views = eina_list_remove(evry_conf->views, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* taken from e_utils. just changed 48 to 72.. we need
|
||||||
|
evry_icon_theme_set(Evas_Object *obj, const char *icon,
|
||||||
|
size:small, mid, large) imo */
|
||||||
|
static int
|
||||||
|
_evry_icon_theme_set(Evas_Object *obj, const char *icon)
|
||||||
|
{
|
||||||
|
const char *file;
|
||||||
|
char buf[4096];
|
||||||
|
|
||||||
|
if ((!icon) || (!icon[0])) return 0;
|
||||||
|
snprintf(buf, sizeof(buf), "e/icons/%s", icon);
|
||||||
|
file = e_theme_edje_file_get("base/theme/icons", buf);
|
||||||
|
if (file[0])
|
||||||
|
{
|
||||||
|
e_icon_file_edje_set(obj, file, buf);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_evry_icon_fdo_set(Evas_Object *obj, const char *icon)
|
||||||
|
{
|
||||||
|
char *path = NULL;
|
||||||
|
unsigned int size;
|
||||||
|
|
||||||
|
if ((!icon) || (!icon[0])) return 0;
|
||||||
|
size = e_util_icon_size_normalize(72 * e_scale);
|
||||||
|
path = efreet_icon_path_find(e_config->icon_theme, icon, size);
|
||||||
|
|
||||||
|
if (!path) return 0;
|
||||||
|
e_icon_file_set(obj, path);
|
||||||
|
E_FREE(path);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
evry_icon_theme_get(const char *icon, Evas *e)
|
||||||
|
{
|
||||||
|
Evas_Object *o = e_icon_add(e);
|
||||||
|
|
||||||
|
if (e_config->icon_theme_overrides)
|
||||||
|
{
|
||||||
|
if (_evry_icon_fdo_set(o, icon) ||
|
||||||
|
_evry_icon_theme_set(o, icon))
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_evry_icon_theme_set(o, icon) ||
|
||||||
|
_evry_icon_fdo_set(o, icon))
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
evas_object_del(o);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
evry_icon_mime_get(const char *mime, Evas *e)
|
||||||
|
{
|
||||||
|
char *icon;
|
||||||
|
|
||||||
|
icon = efreet_mime_type_icon_get(mime, e_config->icon_theme, 64);
|
||||||
|
|
||||||
|
if (icon)
|
||||||
|
return e_util_icon_add(icon, e);
|
||||||
|
else
|
||||||
|
return evry_icon_theme_get("none", e);
|
||||||
|
|
||||||
|
free(icon);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
|
|
||||||
typedef struct _Config Config;
|
typedef struct _Config Config;
|
||||||
|
typedef struct _Evry_Selector Evry_Selector;
|
||||||
|
|
||||||
struct _Config
|
struct _Config
|
||||||
{
|
{
|
||||||
|
@ -37,6 +38,27 @@ struct _Config
|
||||||
Eina_Hash *history;
|
Eina_Hash *history;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _Evry_Selector
|
||||||
|
{
|
||||||
|
Evas_Object *o_main;
|
||||||
|
Evas_Object *o_icon;
|
||||||
|
|
||||||
|
/* current state */
|
||||||
|
Evry_State *state;
|
||||||
|
|
||||||
|
/* stack of states (for browseable plugins) */
|
||||||
|
Eina_List *states;
|
||||||
|
|
||||||
|
/* provides collection of items from other plugins */
|
||||||
|
Evry_Plugin *aggregator;
|
||||||
|
|
||||||
|
/* */
|
||||||
|
Eina_List *actions;
|
||||||
|
|
||||||
|
/* all plugins that belong to this selector*/
|
||||||
|
Eina_List *plugins;
|
||||||
|
};
|
||||||
|
|
||||||
EAPI extern E_Module_Api e_modapi;
|
EAPI extern E_Module_Api e_modapi;
|
||||||
|
|
||||||
EAPI void *e_modapi_init (E_Module *m);
|
EAPI void *e_modapi_init (E_Module *m);
|
||||||
|
@ -49,6 +71,13 @@ 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);
|
||||||
|
|
||||||
|
Evry_Plugin *evry_plug_aggregator_new(Evry_Selector *selector);
|
||||||
|
void evry_plug_aggregator_free(Evry_Plugin *plugin);
|
||||||
|
|
||||||
|
Evry_Plugin *evry_plug_actions_new(void);
|
||||||
|
void evry_plug_actions_free(Evry_Plugin *plugin);
|
||||||
|
|
||||||
extern Config *evry_conf;
|
extern Config *evry_conf;
|
||||||
|
extern Evry_Selector **selectors;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,29 +17,7 @@
|
||||||
|
|
||||||
typedef struct _Evry_Window Evry_Window;
|
typedef struct _Evry_Window Evry_Window;
|
||||||
typedef struct _Evry_List_Window Evry_List_Window;
|
typedef struct _Evry_List_Window Evry_List_Window;
|
||||||
typedef struct _Evry_Selector Evry_Selector;
|
|
||||||
|
|
||||||
/* */
|
|
||||||
struct _Evry_Selector
|
|
||||||
{
|
|
||||||
Evas_Object *o_main;
|
|
||||||
Evas_Object *o_icon;
|
|
||||||
|
|
||||||
/* current state */
|
|
||||||
Evry_State *state;
|
|
||||||
|
|
||||||
/* stack of states (for browseable plugins) */
|
|
||||||
Eina_List *states;
|
|
||||||
|
|
||||||
/* provides collection of items from other plugins */
|
|
||||||
Evry_Plugin *aggregator;
|
|
||||||
|
|
||||||
/* */
|
|
||||||
Eina_List *actions;
|
|
||||||
|
|
||||||
/* all plugins that belong to this selector*/
|
|
||||||
Eina_List *plugins;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _Evry_Window
|
struct _Evry_Window
|
||||||
{
|
{
|
||||||
|
@ -54,45 +32,46 @@ struct _Evry_List_Window
|
||||||
{
|
{
|
||||||
E_Popup *popup;
|
E_Popup *popup;
|
||||||
Evas_Object *o_main;
|
Evas_Object *o_main;
|
||||||
|
Eina_Bool visible;
|
||||||
|
|
||||||
Eina_Bool visible;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void _evry_matches_update(Evry_Selector *sel);
|
static void _evry_matches_update(Evry_Selector *sel);
|
||||||
static void _evry_plugin_action(Evry_Selector *sel, int finished);
|
static void _evry_plugin_action(Evry_Selector *sel, int finished);
|
||||||
static void _evry_backspace(Evry_State *s);
|
|
||||||
static void _evry_update(Evry_State *s, int fetch);
|
|
||||||
static int _evry_clear(Evry_State *s);
|
|
||||||
static int _evry_update_timer(void *data);
|
|
||||||
static Evry_State *_evry_state_new(Evry_Selector *sel, Eina_List *plugins);
|
|
||||||
static void _evry_state_pop(Evry_Selector *sel);
|
|
||||||
static void _evry_update_text_label(Evry_State *s);
|
|
||||||
static void _evry_browse_item(Evry_Selector *sel);
|
|
||||||
static void _evry_browse_back(Evry_Selector *sel);
|
|
||||||
static void _evry_selectors_switch(void);
|
|
||||||
static void _evry_plugin_select(Evry_State *s, Evry_Plugin *p);
|
static void _evry_plugin_select(Evry_State *s, Evry_Plugin *p);
|
||||||
static void _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p);
|
static void _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p);
|
||||||
|
static void _evry_backspace(Evry_State *s);
|
||||||
|
static void _evry_update(Evry_State *s, int fetch);
|
||||||
|
static void _evry_update_text_label(Evry_State *s);
|
||||||
|
static int _evry_clear(Evry_State *s);
|
||||||
|
static int _evry_update_timer(void *data);
|
||||||
|
|
||||||
|
static Evry_State *_evry_state_new(Evry_Selector *sel, Eina_List *plugins);
|
||||||
|
static void _evry_state_pop(Evry_Selector *sel);
|
||||||
|
|
||||||
static Evry_Window *_evry_window_new(E_Zone *zone);
|
|
||||||
static void _evry_window_free(Evry_Window *win);
|
|
||||||
static Evry_Selector *_evry_selector_new(int type);
|
static Evry_Selector *_evry_selector_new(int type);
|
||||||
static void _evry_selector_free(Evry_Selector *sel);
|
static void _evry_selector_free(Evry_Selector *sel);
|
||||||
static void _evry_selector_activate(Evry_Selector *sel);
|
static void _evry_selector_activate(Evry_Selector *sel);
|
||||||
|
static void _evry_selectors_switch(void);
|
||||||
static void _evry_selector_update(Evry_Selector *sel);
|
static void _evry_selector_update(Evry_Selector *sel);
|
||||||
static void _evry_selector_icon_set(Evry_Selector *sel);
|
static void _evry_selector_icon_set(Evry_Selector *sel);
|
||||||
static int _evry_selector_subjects_get(const char *plugin_name);
|
static int _evry_selector_subjects_get(const char *plugin_name);
|
||||||
static int _evry_selector_actions_get(Evry_Item *it);
|
static int _evry_selector_actions_get(Evry_Item *it);
|
||||||
static int _evry_selector_objects_get(const char *type);
|
static int _evry_selector_objects_get(Evry_Action *act);
|
||||||
|
|
||||||
|
static void _evry_browse_item(Evry_Selector *sel);
|
||||||
|
static void _evry_browse_back(Evry_Selector *sel);
|
||||||
|
|
||||||
|
static Evry_Window *_evry_window_new(E_Zone *zone);
|
||||||
|
static void _evry_window_free(Evry_Window *win);
|
||||||
|
|
||||||
static Evry_List_Window *_evry_list_win_new(E_Zone *zone);
|
static Evry_List_Window *_evry_list_win_new(E_Zone *zone);
|
||||||
static void _evry_list_win_free(Evry_List_Window *win);
|
static void _evry_list_win_free(Evry_List_Window *win);
|
||||||
static void _evry_list_win_show(void);
|
static void _evry_list_win_show(void);
|
||||||
|
static void _evry_list_win_update(Evry_State *s);
|
||||||
static void _evry_list_win_clear(int hide);
|
static void _evry_list_win_clear(int hide);
|
||||||
|
|
||||||
static void _evry_view_clear(Evry_State *s);
|
static void _evry_view_clear(Evry_State *s);
|
||||||
static void _evry_list_win_update(Evry_State *s);
|
|
||||||
static void _evry_view_update(Evry_State *s, Evry_Plugin *plugin);
|
static void _evry_view_update(Evry_State *s, Evry_Plugin *plugin);
|
||||||
static int _evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev);
|
static int _evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev);
|
||||||
static int _evry_view_toggle(Evry_State *s, const char *trigger);
|
static int _evry_view_toggle(Evry_State *s, const char *trigger);
|
||||||
|
@ -102,20 +81,6 @@ static void _evry_view_hide(Evry_View *v);
|
||||||
static void _evry_item_desel(Evry_State *s, Evry_Item *it);
|
static void _evry_item_desel(Evry_State *s, Evry_Item *it);
|
||||||
static void _evry_item_sel(Evry_State *s, Evry_Item *it);
|
static void _evry_item_sel(Evry_State *s, Evry_Item *it);
|
||||||
|
|
||||||
static int _evry_plug_actions_init(void);
|
|
||||||
static void _evry_plug_actions_free(void);
|
|
||||||
static int _evry_plug_actions_begin(Evry_Plugin *p, const Evry_Item *it);
|
|
||||||
static int _evry_plug_actions_fetch(Evry_Plugin *p, const char *input);
|
|
||||||
static void _evry_plug_actions_cleanup(Evry_Plugin *p);
|
|
||||||
static Evas_Object *_evry_plug_actions_item_icon_get(Evry_Plugin *p, const Evry_Item *it, Evas *e);
|
|
||||||
|
|
||||||
static Evry_Plugin *_evry_plug_aggregator_new(void);
|
|
||||||
static void _evry_plug_aggregator_free(Evry_Plugin *p);
|
|
||||||
static int _evry_plug_aggregator_fetch(Evry_Plugin *p, const char *input);
|
|
||||||
static int _evry_plug_aggregator_action(Evry_Plugin *p, const Evry_Item *item, const char *input);
|
|
||||||
static void _evry_plug_aggregator_cleanup(Evry_Plugin *p);
|
|
||||||
static Evas_Object *_evry_plug_aggregator_item_icon_get(Evry_Plugin *p, const Evry_Item *it, Evas *e);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
@ -125,16 +90,16 @@ static Evry_List_Window *list = NULL;
|
||||||
static Ecore_X_Window input_window = 0;
|
static Ecore_X_Window input_window = 0;
|
||||||
static Eina_List *handlers = NULL;
|
static Eina_List *handlers = NULL;
|
||||||
static Ecore_Timer *update_timer = NULL;
|
static Ecore_Timer *update_timer = NULL;
|
||||||
static Evry_Selector *selectors[3];
|
|
||||||
static Evry_Selector *selector = NULL;
|
|
||||||
static Evry_Plugin *action_selector = NULL;
|
static Evry_Plugin *action_selector = NULL;
|
||||||
|
static Evry_Selector *selector = NULL;
|
||||||
|
|
||||||
|
Evry_Selector **selectors;
|
||||||
|
|
||||||
/* externally accessible functions */
|
/* externally accessible functions */
|
||||||
int
|
int
|
||||||
evry_init(void)
|
evry_init(void)
|
||||||
{
|
{
|
||||||
_evry_plug_actions_init();
|
action_selector = evry_plug_actions_new();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +107,8 @@ int
|
||||||
evry_shutdown(void)
|
evry_shutdown(void)
|
||||||
{
|
{
|
||||||
evry_hide();
|
evry_hide();
|
||||||
_evry_plug_actions_free();
|
|
||||||
|
evry_plug_actions_free(action_selector);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -170,7 +136,7 @@ evry_show(E_Zone *zone, const char *params)
|
||||||
|
|
||||||
list->visible = EINA_FALSE;
|
list->visible = EINA_FALSE;
|
||||||
|
|
||||||
/* TODO check NULL */
|
selectors = E_NEW(Evry_Selector*, 3);
|
||||||
selectors[0] = _evry_selector_new(type_subject);
|
selectors[0] = _evry_selector_new(type_subject);
|
||||||
selectors[1] = _evry_selector_new(type_action);
|
selectors[1] = _evry_selector_new(type_action);
|
||||||
selectors[2] = _evry_selector_new(type_object);
|
selectors[2] = _evry_selector_new(type_object);
|
||||||
|
@ -238,10 +204,8 @@ evry_hide(void)
|
||||||
_evry_selector_free(selectors[0]);
|
_evry_selector_free(selectors[0]);
|
||||||
_evry_selector_free(selectors[1]);
|
_evry_selector_free(selectors[1]);
|
||||||
_evry_selector_free(selectors[2]);
|
_evry_selector_free(selectors[2]);
|
||||||
selectors[0] = NULL;
|
|
||||||
selectors[1] = NULL;
|
|
||||||
selectors[2] = NULL;
|
|
||||||
selector = NULL;
|
selector = NULL;
|
||||||
|
E_FREE(selectors);
|
||||||
|
|
||||||
_evry_list_win_free(list);
|
_evry_list_win_free(list);
|
||||||
list = NULL;
|
list = NULL;
|
||||||
|
@ -742,8 +706,8 @@ _evry_selector_new(int type)
|
||||||
else if (type == type_object)
|
else if (type == type_object)
|
||||||
edje_object_part_swallow(win->o_main, "e.swallow.object_selector", o);
|
edje_object_part_swallow(win->o_main, "e.swallow.object_selector", o);
|
||||||
|
|
||||||
p = _evry_plug_aggregator_new();
|
p = evry_plug_aggregator_new(sel);
|
||||||
p->private = sel;
|
|
||||||
sel->plugins = eina_list_append(sel->plugins, p);
|
sel->plugins = eina_list_append(sel->plugins, p);
|
||||||
sel->aggregator = p;
|
sel->aggregator = p;
|
||||||
|
|
||||||
|
@ -770,7 +734,7 @@ _evry_selector_free(Evry_Selector *sel)
|
||||||
while (sel->states)
|
while (sel->states)
|
||||||
_evry_state_pop(sel);
|
_evry_state_pop(sel);
|
||||||
|
|
||||||
_evry_plug_aggregator_free(sel->aggregator);
|
evry_plug_aggregator_free(sel->aggregator);
|
||||||
|
|
||||||
if (sel->plugins) eina_list_free(sel->plugins);
|
if (sel->plugins) eina_list_free(sel->plugins);
|
||||||
E_FREE(sel);
|
E_FREE(sel);
|
||||||
|
@ -926,27 +890,26 @@ static int
|
||||||
_evry_selector_subjects_get(const char *plugin_name)
|
_evry_selector_subjects_get(const char *plugin_name)
|
||||||
{
|
{
|
||||||
Eina_List *l, *plugins = NULL;
|
Eina_List *l, *plugins = NULL;
|
||||||
Evry_Plugin *p;
|
Evry_Plugin *p, *plugin;
|
||||||
Evry_Selector *sel = selectors[0];
|
Evry_Selector *sel = selectors[0];
|
||||||
|
|
||||||
EINA_LIST_FOREACH(sel->plugins, l, p)
|
EINA_LIST_FOREACH(sel->plugins, l, plugin)
|
||||||
{
|
{
|
||||||
if (plugin_name && strcmp(plugin_name, p->name))
|
if (plugin_name && strcmp(plugin_name, plugin->name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (p->begin)
|
if (plugin->begin)
|
||||||
{
|
{
|
||||||
if (p->begin(p, NULL))
|
if ((p = plugin->begin(plugin, NULL)))
|
||||||
plugins = eina_list_append(plugins, p);
|
plugins = eina_list_append(plugins, p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
plugins = eina_list_append(plugins, p);
|
plugins = eina_list_append(plugins, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugins) return 0;
|
if (!plugins) return 0;
|
||||||
|
|
||||||
_evry_state_new(sel, plugins);
|
_evry_state_new(sel, plugins);
|
||||||
|
|
||||||
_evry_matches_update(sel);
|
_evry_matches_update(sel);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -956,7 +919,7 @@ static int
|
||||||
_evry_selector_actions_get(Evry_Item *it)
|
_evry_selector_actions_get(Evry_Item *it)
|
||||||
{
|
{
|
||||||
Eina_List *l, *plugins = NULL;
|
Eina_List *l, *plugins = NULL;
|
||||||
Evry_Plugin *p;
|
Evry_Plugin *p, *plugin;
|
||||||
Evry_Selector *sel = selectors[1];
|
Evry_Selector *sel = selectors[1];
|
||||||
const char *type_out;
|
const char *type_out;
|
||||||
|
|
||||||
|
@ -967,61 +930,64 @@ _evry_selector_actions_get(Evry_Item *it)
|
||||||
|
|
||||||
type_out = it->plugin->type_out;
|
type_out = it->plugin->type_out;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(sel->plugins, l, p)
|
EINA_LIST_FOREACH(sel->plugins, l, plugin)
|
||||||
{
|
{
|
||||||
if ((p == action_selector) || (p == sel->aggregator) ||
|
if ((plugin == action_selector) || (plugin == sel->aggregator) ||
|
||||||
(p->type_in && type_out && p->type_in == type_out))
|
(plugin->type_in && type_out && plugin->type_in == type_out))
|
||||||
{
|
{
|
||||||
if (p->begin)
|
if (plugin->begin)
|
||||||
{
|
{
|
||||||
if (p->begin(p, it))
|
if ((p = plugin->begin(plugin, it)))
|
||||||
plugins = eina_list_append(plugins, p);
|
plugins = eina_list_append(plugins, p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
plugins = eina_list_append(plugins, p);
|
plugins = eina_list_append(plugins, plugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugins) return 0;
|
if (!plugins) return 0;
|
||||||
|
|
||||||
_evry_state_new(sel, plugins);
|
_evry_state_new(sel, plugins);
|
||||||
|
|
||||||
_evry_matches_update(sel);
|
_evry_matches_update(sel);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_evry_selector_objects_get(const char *type)
|
_evry_selector_objects_get(Evry_Action *act)
|
||||||
{
|
{
|
||||||
Eina_List *l, *plugins = NULL;
|
Eina_List *l, *plugins = NULL;
|
||||||
Evry_Plugin *p;
|
Evry_Plugin *p, *plugin;
|
||||||
Evry_Selector *sel = selectors[2];
|
Evry_Selector *sel = selectors[2];
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
|
const char *type_in = act->type_in2;
|
||||||
|
|
||||||
while (sel->state)
|
while (sel->state)
|
||||||
_evry_state_pop(sel);
|
_evry_state_pop(sel);
|
||||||
|
|
||||||
it = selectors[0]->state->sel_item;
|
it = selectors[0]->state->sel_item;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(sel->plugins, l, p)
|
EINA_LIST_FOREACH(sel->plugins, l, plugin)
|
||||||
{
|
{
|
||||||
if (strcmp(p->type_out, type) &&
|
if ((plugin->type_out != type_in) &&
|
||||||
(p != sel->aggregator)) continue;
|
(plugin != sel->aggregator)) continue;
|
||||||
|
|
||||||
if (p->begin)
|
if (plugin->begin)
|
||||||
{
|
{
|
||||||
if (p->begin(p, it))
|
if ((act->type_out) &&
|
||||||
|
(act->type_out == plugin->type_in) &&
|
||||||
|
(p = plugin->begin(plugin, it)))
|
||||||
|
plugins = eina_list_append(plugins, p);
|
||||||
|
else if (p = plugin->begin(plugin, NULL))
|
||||||
plugins = eina_list_append(plugins, p);
|
plugins = eina_list_append(plugins, p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
plugins = eina_list_append(plugins, p);
|
plugins = eina_list_append(plugins, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugins) return 0;
|
if (!plugins) return 0;
|
||||||
|
|
||||||
_evry_state_new(sel, plugins);
|
_evry_state_new(sel, plugins);
|
||||||
|
|
||||||
_evry_matches_update(sel);
|
_evry_matches_update(sel);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1075,7 +1041,7 @@ _evry_browse_item(Evry_Selector *sel)
|
||||||
Evry_State *s = sel->state;
|
Evry_State *s = sel->state;
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
Eina_List *l, *plugins = NULL;
|
Eina_List *l, *plugins = NULL;
|
||||||
Evry_Plugin *p;
|
Evry_Plugin *p, *plugin;
|
||||||
const char *type_out;
|
const char *type_out;
|
||||||
|
|
||||||
it = s->sel_item;
|
it = s->sel_item;
|
||||||
|
@ -1088,12 +1054,13 @@ _evry_browse_item(Evry_Selector *sel)
|
||||||
if (!type_out)
|
if (!type_out)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(sel->plugins, l, p)
|
EINA_LIST_FOREACH(sel->plugins, l, plugin)
|
||||||
{
|
{
|
||||||
if (!p->browse || !p->type_in || p->type_in != type_out)
|
if ((!plugin->begin || !plugin->type_in) ||
|
||||||
|
(plugin->type_in != type_out))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (p->browse(p, it))
|
if ((p = plugin->begin(plugin, it)))
|
||||||
plugins = eina_list_append(plugins, p);
|
plugins = eina_list_append(plugins, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1122,12 +1089,9 @@ _evry_browse_back(Evry_Selector *sel)
|
||||||
|
|
||||||
sel->aggregator->fetch(sel->aggregator, s->input);
|
sel->aggregator->fetch(sel->aggregator, s->input);
|
||||||
_evry_selector_update(sel);
|
_evry_selector_update(sel);
|
||||||
|
|
||||||
_evry_view_show(s->view);
|
|
||||||
|
|
||||||
/*** _evry_tabs_update(s); */
|
|
||||||
|
|
||||||
_evry_update_text_label(s);
|
_evry_update_text_label(s);
|
||||||
|
|
||||||
|
_evry_view_show(s->view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1159,10 +1123,12 @@ _evry_selectors_switch(void)
|
||||||
int next_selector = 0;
|
int next_selector = 0;
|
||||||
Evry_Action *act;
|
Evry_Action *act;
|
||||||
|
|
||||||
if (s->sel_item && (s->sel_item->plugin == action_selector) &&
|
if ((s->sel_item) &&
|
||||||
(act = s->sel_item->data[0]) && act->type_in2)
|
(s->sel_item->plugin == action_selector) &&
|
||||||
|
(act = s->sel_item->data[0]) &&
|
||||||
|
(act->type_in2))
|
||||||
{
|
{
|
||||||
_evry_selector_objects_get(act->type_in2);
|
_evry_selector_objects_get(act);
|
||||||
_evry_selector_update(selectors[2]);
|
_evry_selector_update(selectors[2]);
|
||||||
edje_object_signal_emit(win->o_main,
|
edje_object_signal_emit(win->o_main,
|
||||||
"e,state,object_selector_show", "e");
|
"e,state,object_selector_show", "e");
|
||||||
|
@ -1519,7 +1485,7 @@ _evry_view_toggle(Evry_State *s, const char *trigger)
|
||||||
{
|
{
|
||||||
if (view->trigger && !strncmp(trigger, view->trigger, 1) &&
|
if (view->trigger && !strncmp(trigger, view->trigger, 1) &&
|
||||||
(v = view->create(view, s, list->o_main)))
|
(v = view->create(view, s, list->o_main)))
|
||||||
break;
|
goto found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1675,283 +1641,6 @@ evry_plugin_select(const Evry_State *s, Evry_Plugin *p)
|
||||||
_evry_selector_update(selector);
|
_evry_selector_update(selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
_evry_fuzzy_sort_cb(const void *data1, const void *data2)
|
|
||||||
{
|
|
||||||
const Evry_Item *it1 = data1;
|
|
||||||
const Evry_Item *it2 = data2;
|
|
||||||
|
|
||||||
if ((it1->plugin == it2->plugin) &&
|
|
||||||
(it1->priority - it2->priority))
|
|
||||||
return (it1->priority - it2->priority);
|
|
||||||
|
|
||||||
if (it1->fuzzy_match || it2->fuzzy_match)
|
|
||||||
{
|
|
||||||
if (it1->fuzzy_match && !it2->fuzzy_match)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!it1->fuzzy_match && it2->fuzzy_match)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if (it1->fuzzy_match - it2->fuzzy_match)
|
|
||||||
return (it1->fuzzy_match - it2->fuzzy_match);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (it1->plugin->config->priority - it2->plugin->config->priority)
|
|
||||||
return (it1->plugin->config->priority - it2->plugin->config->priority);
|
|
||||||
|
|
||||||
if (it1->priority - it2->priority)
|
|
||||||
return (it1->priority - it2->priority);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* action selector plugin: provides list of actions registered for
|
|
||||||
candidate types provided by current plugin */
|
|
||||||
static int
|
|
||||||
_evry_plug_actions_init(void)
|
|
||||||
{
|
|
||||||
Evry_Plugin *p;
|
|
||||||
|
|
||||||
p = evry_plugin_new("Select Action", type_action, "", "", 0, NULL, NULL,
|
|
||||||
_evry_plug_actions_begin,
|
|
||||||
_evry_plug_actions_cleanup,
|
|
||||||
_evry_plug_actions_fetch,
|
|
||||||
NULL, NULL,
|
|
||||||
_evry_plug_actions_item_icon_get,
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
action_selector = p;
|
|
||||||
evry_plugin_register(p, 2);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_evry_plug_actions_free(void)
|
|
||||||
{
|
|
||||||
Evry_Plugin *p = action_selector;
|
|
||||||
|
|
||||||
eina_stringshare_del(p->config->name);
|
|
||||||
E_FREE(p->config);
|
|
||||||
evry_plugin_free(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_evry_plug_actions_begin(Evry_Plugin *p, const Evry_Item *it)
|
|
||||||
{
|
|
||||||
Evry_Action *act;
|
|
||||||
Eina_List *l;
|
|
||||||
Evry_Selector *sel = selectors[1];
|
|
||||||
|
|
||||||
_evry_plug_actions_cleanup(p);
|
|
||||||
|
|
||||||
if (!it) return 0;
|
|
||||||
|
|
||||||
const char *type = it->plugin->type_out;
|
|
||||||
|
|
||||||
if (!type) return 0;
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(evry_conf->actions, l, act)
|
|
||||||
{
|
|
||||||
if (act->type_in1 && (act->type_in1 == type) &&
|
|
||||||
(!act->check_item || act->check_item(act, it)))
|
|
||||||
{
|
|
||||||
sel->actions = eina_list_append(sel->actions, act);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sel->actions) return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_evry_plug_actions_fetch(Evry_Plugin *p, const char *input)
|
|
||||||
{
|
|
||||||
Evry_Action *act;
|
|
||||||
Eina_List *l;
|
|
||||||
Evry_Item *it;
|
|
||||||
Evry_Selector *sel = selectors[1];
|
|
||||||
int match = 0;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(p->items, it)
|
|
||||||
evry_item_free(it);
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(sel->actions, l, act)
|
|
||||||
{
|
|
||||||
if (input)
|
|
||||||
match = evry_fuzzy_match(act->name, input);
|
|
||||||
|
|
||||||
if (!input || match)
|
|
||||||
{
|
|
||||||
it = evry_item_new(p, act->name, NULL);
|
|
||||||
it->fuzzy_match = match;
|
|
||||||
it->data[0] = act;
|
|
||||||
p->items = eina_list_append(p->items, it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input)
|
|
||||||
p->items = eina_list_sort(p->items, eina_list_count(p->items), _evry_fuzzy_sort_cb);
|
|
||||||
|
|
||||||
if (p->items) return 1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_evry_plug_actions_cleanup(Evry_Plugin *p)
|
|
||||||
{
|
|
||||||
Evry_Item *it;
|
|
||||||
Evry_Selector *sel = selectors[1];
|
|
||||||
|
|
||||||
EINA_LIST_FREE(p->items, it)
|
|
||||||
evry_item_free(it);
|
|
||||||
|
|
||||||
if (sel->actions) eina_list_free(sel->actions);
|
|
||||||
sel->actions = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_evry_plug_actions_item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
|
|
||||||
{
|
|
||||||
Evas_Object *o = NULL;
|
|
||||||
Evry_Action *act = it->data[0];
|
|
||||||
|
|
||||||
if (!act) return NULL;
|
|
||||||
|
|
||||||
if (act->icon_get)
|
|
||||||
o = act->icon_get(act, e);
|
|
||||||
else if (act->icon)
|
|
||||||
o = evry_icon_theme_get(act->icon, e);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evry_Plugin *
|
|
||||||
_evry_plug_aggregator_new(void)
|
|
||||||
{
|
|
||||||
Evry_Plugin *p;
|
|
||||||
Plugin_Config *pc;
|
|
||||||
|
|
||||||
p = evry_plugin_new("All", 0, "", "", 0, NULL, NULL,
|
|
||||||
NULL,
|
|
||||||
_evry_plug_aggregator_cleanup,
|
|
||||||
_evry_plug_aggregator_fetch,
|
|
||||||
_evry_plug_aggregator_action,
|
|
||||||
NULL,
|
|
||||||
_evry_plug_aggregator_item_icon_get,
|
|
||||||
NULL, NULL);
|
|
||||||
|
|
||||||
pc = E_NEW(Plugin_Config, 1);
|
|
||||||
pc->name = eina_stringshare_add(p->name);
|
|
||||||
pc->enabled = 1;
|
|
||||||
pc->priority = -1;
|
|
||||||
p->config = pc;
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_evry_plug_aggregator_free(Evry_Plugin *p)
|
|
||||||
{
|
|
||||||
if (p->config->name) eina_stringshare_del(p->config->name);
|
|
||||||
E_FREE(p->config);
|
|
||||||
evry_plugin_free(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
_evry_plug_aggregator_fetch(Evry_Plugin *p, const char *input)
|
|
||||||
{
|
|
||||||
Evry_Selector *selector = p->private;
|
|
||||||
Evry_State *s = selector->state;
|
|
||||||
Eina_List *l, *ll;
|
|
||||||
Evry_Plugin *plugin;
|
|
||||||
Evry_Item *it;
|
|
||||||
int cnt = 0;
|
|
||||||
Eina_List *items = NULL;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(p->items, it)
|
|
||||||
evry_item_free(it);
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(s->cur_plugins, l, plugin)
|
|
||||||
cnt += eina_list_count(plugin->items);
|
|
||||||
|
|
||||||
|
|
||||||
if (input[0])
|
|
||||||
{
|
|
||||||
EINA_LIST_FOREACH(s->cur_plugins, l, plugin)
|
|
||||||
{
|
|
||||||
EINA_LIST_FOREACH(plugin->items, ll, it)
|
|
||||||
{
|
|
||||||
if (!it->fuzzy_match)
|
|
||||||
it->fuzzy_match = evry_fuzzy_match(it->label, input);
|
|
||||||
|
|
||||||
if (it->fuzzy_match || selector == selectors[2])
|
|
||||||
{
|
|
||||||
evry_item_ref(it);
|
|
||||||
items = eina_list_append(items, it);
|
|
||||||
p->items = eina_list_append(p->items, it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!input[0] || eina_list_count(items) < 20)
|
|
||||||
{
|
|
||||||
EINA_LIST_FOREACH(s->cur_plugins, l, plugin)
|
|
||||||
{
|
|
||||||
for (cnt = 0, ll = plugin->items; ll && cnt < 15; ll = ll->next, cnt++)
|
|
||||||
{
|
|
||||||
if (!items || !eina_list_data_find_list(items, ll->data))
|
|
||||||
{
|
|
||||||
it = ll->data;
|
|
||||||
|
|
||||||
evry_item_ref(it);
|
|
||||||
it->fuzzy_match = 0;
|
|
||||||
p->items = eina_list_append(p->items, it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (items) eina_list_free(items);
|
|
||||||
|
|
||||||
if (input[0])
|
|
||||||
p->items = eina_list_sort(p->items, eina_list_count(p->items), _evry_fuzzy_sort_cb);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_evry_plug_aggregator_action(Evry_Plugin *p, const Evry_Item *it, const char *input)
|
|
||||||
{
|
|
||||||
if (it->plugin && it->plugin->action)
|
|
||||||
return it->plugin->action(it->plugin, it, input);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_evry_plug_aggregator_cleanup(Evry_Plugin *p)
|
|
||||||
{
|
|
||||||
Evry_Item *it;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(p->items, it)
|
|
||||||
evry_item_free(it);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_evry_plug_aggregator_item_icon_get(Evry_Plugin *p, const Evry_Item *it, Evas *e)
|
|
||||||
{
|
|
||||||
if (it->plugin && it->plugin->icon_get)
|
|
||||||
return it->plugin->icon_get(it->plugin, it, e);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p)
|
_evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
|
@ -2000,79 +1689,3 @@ _evry_cb_selection_notify(void *data, int type, void *event)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* taken from e_utils. just changed 48 to 72.. we need
|
|
||||||
evry_icon_theme_set(Evas_Object *obj, const char *icon,
|
|
||||||
size:small, mid, large) imo */
|
|
||||||
static int
|
|
||||||
_evry_icon_theme_set(Evas_Object *obj, const char *icon)
|
|
||||||
{
|
|
||||||
const char *file;
|
|
||||||
char buf[4096];
|
|
||||||
|
|
||||||
if ((!icon) || (!icon[0])) return 0;
|
|
||||||
snprintf(buf, sizeof(buf), "e/icons/%s", icon);
|
|
||||||
file = e_theme_edje_file_get("base/theme/icons", buf);
|
|
||||||
if (file[0])
|
|
||||||
{
|
|
||||||
e_icon_file_edje_set(obj, file, buf);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_evry_icon_fdo_set(Evas_Object *obj, const char *icon)
|
|
||||||
{
|
|
||||||
char *path = NULL;
|
|
||||||
unsigned int size;
|
|
||||||
|
|
||||||
if ((!icon) || (!icon[0])) return 0;
|
|
||||||
size = e_util_icon_size_normalize(72 * e_scale);
|
|
||||||
path = efreet_icon_path_find(e_config->icon_theme, icon, size);
|
|
||||||
|
|
||||||
if (!path) return 0;
|
|
||||||
e_icon_file_set(obj, path);
|
|
||||||
E_FREE(path);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Evas_Object *
|
|
||||||
evry_icon_theme_get(const char *icon, Evas *e)
|
|
||||||
{
|
|
||||||
Evas_Object *o = e_icon_add(e);
|
|
||||||
|
|
||||||
if (e_config->icon_theme_overrides)
|
|
||||||
{
|
|
||||||
if (_evry_icon_fdo_set(o, icon) ||
|
|
||||||
_evry_icon_theme_set(o, icon))
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (_evry_icon_theme_set(o, icon) ||
|
|
||||||
_evry_icon_fdo_set(o, icon))
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
evas_object_del(o);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Evas_Object *
|
|
||||||
evry_icon_mime_get(const char *mime, Evas *e)
|
|
||||||
{
|
|
||||||
char *icon;
|
|
||||||
|
|
||||||
icon = efreet_mime_type_icon_get(mime, e_config->icon_theme, 64);
|
|
||||||
|
|
||||||
if (icon)
|
|
||||||
return e_util_icon_add(icon, e);
|
|
||||||
else
|
|
||||||
return evry_icon_theme_get("none", e);
|
|
||||||
|
|
||||||
free(icon);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
|
/* action selector plugin: provides list of actions registered for
|
||||||
|
candidate types provided by current plugin */
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cleanup(Evry_Plugin *p)
|
||||||
|
{
|
||||||
|
Evry_Item *it;
|
||||||
|
Evry_Selector *sel = selectors[1];
|
||||||
|
|
||||||
|
EINA_LIST_FREE(p->items, it)
|
||||||
|
evry_item_free(it);
|
||||||
|
|
||||||
|
if (sel->actions) eina_list_free(sel->actions);
|
||||||
|
sel->actions = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evry_Plugin *
|
||||||
|
_begin(Evry_Plugin *p, const Evry_Item *it)
|
||||||
|
{
|
||||||
|
Evry_Action *act;
|
||||||
|
Eina_List *l;
|
||||||
|
Evry_Selector *sel = selectors[1];
|
||||||
|
|
||||||
|
_cleanup(p);
|
||||||
|
|
||||||
|
if (!it) return NULL;
|
||||||
|
|
||||||
|
const char *type = it->plugin->type_out;
|
||||||
|
|
||||||
|
if (!type) return NULL;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(evry_conf->actions, l, act)
|
||||||
|
{
|
||||||
|
if (act->type_in1 && (act->type_in1 == type) &&
|
||||||
|
(!act->check_item || act->check_item(act, it)))
|
||||||
|
{
|
||||||
|
sel->actions = eina_list_append(sel->actions, act);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sel->actions) return NULL;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_cb_sort(const void *data1, const void *data2)
|
||||||
|
{
|
||||||
|
const Evry_Item *it1 = data1;
|
||||||
|
const Evry_Item *it2 = data2;
|
||||||
|
|
||||||
|
if ((it1->plugin == it2->plugin) &&
|
||||||
|
(it1->priority - it2->priority))
|
||||||
|
return (it1->priority - it2->priority);
|
||||||
|
|
||||||
|
if (it1->fuzzy_match || it2->fuzzy_match)
|
||||||
|
{
|
||||||
|
if (it1->fuzzy_match && !it2->fuzzy_match)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!it1->fuzzy_match && it2->fuzzy_match)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (it1->fuzzy_match - it2->fuzzy_match)
|
||||||
|
return (it1->fuzzy_match - it2->fuzzy_match);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it1->plugin->config->priority - it2->plugin->config->priority)
|
||||||
|
return (it1->plugin->config->priority - it2->plugin->config->priority);
|
||||||
|
|
||||||
|
if (it1->priority - it2->priority)
|
||||||
|
return (it1->priority - it2->priority);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_fetch(Evry_Plugin *p, const char *input)
|
||||||
|
{
|
||||||
|
Evry_Action *act;
|
||||||
|
Eina_List *l;
|
||||||
|
Evry_Item *it;
|
||||||
|
Evry_Selector *sel = selectors[1];
|
||||||
|
int match = 0;
|
||||||
|
|
||||||
|
EINA_LIST_FREE(p->items, it)
|
||||||
|
evry_item_free(it);
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(sel->actions, l, act)
|
||||||
|
{
|
||||||
|
if (input)
|
||||||
|
match = evry_fuzzy_match(act->name, input);
|
||||||
|
|
||||||
|
if (!input || match)
|
||||||
|
{
|
||||||
|
it = evry_item_new(p, act->name, NULL);
|
||||||
|
it->fuzzy_match = match;
|
||||||
|
it->data[0] = act;
|
||||||
|
p->items = eina_list_append(p->items, it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input)
|
||||||
|
p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort);
|
||||||
|
|
||||||
|
if (p->items) return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
|
||||||
|
{
|
||||||
|
Evas_Object *o = NULL;
|
||||||
|
Evry_Action *act = it->data[0];
|
||||||
|
|
||||||
|
if (!act) return NULL;
|
||||||
|
|
||||||
|
if (act->icon_get)
|
||||||
|
o = act->icon_get(act, e);
|
||||||
|
else if (act->icon)
|
||||||
|
o = evry_icon_theme_get(act->icon, e);
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
Evry_Plugin *
|
||||||
|
evry_plug_actions_new(void)
|
||||||
|
{
|
||||||
|
Evry_Plugin *p;
|
||||||
|
|
||||||
|
p = evry_plugin_new(NULL, "Select Action", type_action, "", "", 0, NULL, NULL,
|
||||||
|
_begin, _cleanup, _fetch, NULL, _icon_get, NULL, NULL);
|
||||||
|
|
||||||
|
evry_plugin_register(p, 2);
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evry_plug_actions_free(Evry_Plugin *plugin)
|
||||||
|
{
|
||||||
|
evry_plugin_free(plugin, 1);
|
||||||
|
}
|
|
@ -0,0 +1,165 @@
|
||||||
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _Plugin Plugin;
|
||||||
|
|
||||||
|
struct _Plugin
|
||||||
|
{
|
||||||
|
Evry_Plugin base;
|
||||||
|
Evry_Selector *selector;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
_cb_sort(const void *data1, const void *data2)
|
||||||
|
{
|
||||||
|
const Evry_Item *it1 = data1;
|
||||||
|
const Evry_Item *it2 = data2;
|
||||||
|
|
||||||
|
if ((it1->plugin == it2->plugin) &&
|
||||||
|
(it1->priority - it2->priority))
|
||||||
|
return (it1->priority - it2->priority);
|
||||||
|
|
||||||
|
if (it1->fuzzy_match || it2->fuzzy_match)
|
||||||
|
{
|
||||||
|
if (it1->fuzzy_match && !it2->fuzzy_match)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (!it1->fuzzy_match && it2->fuzzy_match)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (it1->fuzzy_match - it2->fuzzy_match)
|
||||||
|
return (it1->fuzzy_match - it2->fuzzy_match);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it1->plugin->config->priority - it2->plugin->config->priority)
|
||||||
|
return (it1->plugin->config->priority - it2->plugin->config->priority);
|
||||||
|
|
||||||
|
if (it1->priority - it2->priority)
|
||||||
|
return (it1->priority - it2->priority);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_fetch(Evry_Plugin *plugin, const char *input)
|
||||||
|
{
|
||||||
|
Plugin *p = (Plugin *) plugin;
|
||||||
|
Evry_Plugin *pp;
|
||||||
|
Evry_State *s;
|
||||||
|
Eina_List *l, *ll;
|
||||||
|
Evry_Item *it;
|
||||||
|
int cnt = 0;
|
||||||
|
Eina_List *items = NULL;
|
||||||
|
|
||||||
|
s = p->selector->state;
|
||||||
|
|
||||||
|
EINA_LIST_FREE(p->base.items, it)
|
||||||
|
evry_item_free(it);
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
||||||
|
cnt += eina_list_count(pp->items);
|
||||||
|
|
||||||
|
|
||||||
|
if (input[0])
|
||||||
|
{
|
||||||
|
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
||||||
|
{
|
||||||
|
EINA_LIST_FOREACH(pp->items, ll, it)
|
||||||
|
{
|
||||||
|
if (!it->fuzzy_match)
|
||||||
|
it->fuzzy_match = evry_fuzzy_match(it->label, input);
|
||||||
|
|
||||||
|
if (it->fuzzy_match || p->selector == selectors[2])
|
||||||
|
{
|
||||||
|
evry_item_ref(it);
|
||||||
|
items = eina_list_append(items, it);
|
||||||
|
p->base.items = eina_list_append(p->base.items, it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!input[0] || eina_list_count(items) < 20)
|
||||||
|
{
|
||||||
|
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
||||||
|
{
|
||||||
|
for (cnt = 0, ll = pp->items; ll && cnt < 15; ll = ll->next, cnt++)
|
||||||
|
{
|
||||||
|
if (!items || !eina_list_data_find_list(items, ll->data))
|
||||||
|
{
|
||||||
|
it = ll->data;
|
||||||
|
|
||||||
|
evry_item_ref(it);
|
||||||
|
it->fuzzy_match = 0;
|
||||||
|
p->base.items = eina_list_append(p->base.items, it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (items) eina_list_free(items);
|
||||||
|
|
||||||
|
if (input[0])
|
||||||
|
p->base.items = eina_list_sort
|
||||||
|
(p->base.items, eina_list_count(p->base.items), _cb_sort);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_action(Evry_Plugin *plugin, const Evry_Item *it, const char *input)
|
||||||
|
{
|
||||||
|
if (it->plugin && it->plugin->action)
|
||||||
|
return it->plugin->action(it->plugin, it, input);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cleanup(Evry_Plugin *plugin)
|
||||||
|
{
|
||||||
|
Evry_Item *it;
|
||||||
|
|
||||||
|
EINA_LIST_FREE(plugin->items, it)
|
||||||
|
evry_item_free(it);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_icon_get(Evry_Plugin *p, const Evry_Item *it, Evas *e)
|
||||||
|
{
|
||||||
|
if (it->plugin && it->plugin->icon_get)
|
||||||
|
return it->plugin->icon_get(it->plugin, it, e);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Evry_Plugin *
|
||||||
|
evry_plug_aggregator_new(Evry_Selector *selector)
|
||||||
|
{
|
||||||
|
Plugin *p;
|
||||||
|
Plugin_Config *pc;
|
||||||
|
|
||||||
|
p = E_NEW(Plugin, 1);
|
||||||
|
evry_plugin_new(&p->base, "All", 0, "", "", 0, NULL, NULL,
|
||||||
|
NULL, _cleanup, _fetch, _action, _icon_get,
|
||||||
|
NULL, NULL);
|
||||||
|
|
||||||
|
pc = E_NEW(Plugin_Config, 1);
|
||||||
|
pc->enabled = 1;
|
||||||
|
pc->priority = -1;
|
||||||
|
p->base.config = pc;
|
||||||
|
|
||||||
|
p->selector = selector;
|
||||||
|
|
||||||
|
return &p->base;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evry_plug_aggregator_free(Evry_Plugin *plugin)
|
||||||
|
{
|
||||||
|
Plugin *p = (Plugin *) plugin;
|
||||||
|
|
||||||
|
evry_plugin_free(&p->base, 0);
|
||||||
|
E_FREE(p);
|
||||||
|
}
|
|
@ -1,17 +1,18 @@
|
||||||
#include "Evry.h"
|
#include "Evry.h"
|
||||||
|
|
||||||
typedef struct _Inst Inst;
|
typedef struct _Plugin Plugin;
|
||||||
|
|
||||||
struct _Inst
|
struct _Plugin
|
||||||
{
|
{
|
||||||
|
Evry_Plugin base;
|
||||||
Eina_Hash *added;
|
Eina_Hash *added;
|
||||||
Eina_List *apps_mime;
|
Eina_List *apps_mime;
|
||||||
Eina_List *apps_all;
|
Eina_List *apps_all;
|
||||||
const Evry_Item *candidate;
|
const Evry_Item *candidate;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Evry_Plugin *p1;
|
static Plugin *p1;
|
||||||
static Evry_Plugin *p2;
|
static Plugin *p2;
|
||||||
static Evry_Action *act;
|
static Evry_Action *act;
|
||||||
static Evry_Action *act1;
|
static Evry_Action *act1;
|
||||||
static Evry_Action *act2;
|
static Evry_Action *act2;
|
||||||
|
@ -20,52 +21,44 @@ static Evry_Action *act4;
|
||||||
static Eina_List *exe_path = NULL;
|
static Eina_List *exe_path = NULL;
|
||||||
|
|
||||||
|
|
||||||
static int
|
static Evry_Plugin *
|
||||||
_begin(Evry_Plugin *p, const Evry_Item *it)
|
_begin(Evry_Plugin *plugin, const Evry_Item *it)
|
||||||
{
|
{
|
||||||
|
Plugin *p = (Plugin*) plugin;
|
||||||
const char *mime;
|
const char *mime;
|
||||||
Inst *inst = NULL;
|
|
||||||
|
|
||||||
if (it)
|
if (it)
|
||||||
{
|
{
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
|
|
||||||
if (!it->uri) return 0;
|
if (!it->uri) return NULL;
|
||||||
|
|
||||||
if (!it->mime)
|
if (!it->mime)
|
||||||
mime = efreet_mime_type_get(it->uri);
|
mime = efreet_mime_type_get(it->uri);
|
||||||
else
|
else
|
||||||
mime = it->mime;
|
mime = it->mime;
|
||||||
|
|
||||||
/* TODO show plugin for items without mimetype ? */
|
if (!mime) return NULL;
|
||||||
if (!mime) return 0;
|
|
||||||
|
|
||||||
inst = E_NEW(Inst, 1);
|
p->candidate = it;
|
||||||
inst->candidate = it;
|
p->apps_mime = efreet_util_desktop_mime_list(mime);
|
||||||
inst->apps_mime = efreet_util_desktop_mime_list(mime);
|
|
||||||
desktop = e_exehist_mime_desktop_get(mime);
|
desktop = e_exehist_mime_desktop_get(mime);
|
||||||
if (desktop)
|
if (desktop)
|
||||||
{
|
{
|
||||||
efreet_desktop_ref(desktop);
|
efreet_desktop_ref(desktop);
|
||||||
inst->apps_mime = eina_list_prepend(inst->apps_mime, desktop);
|
p->apps_mime = eina_list_prepend(p->apps_mime, desktop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
inst = E_NEW(Inst, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
p->private = inst;
|
return &p->base;
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_list_free(Evry_Plugin *p)
|
_list_free(Evry_Plugin *plugin)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
|
|
||||||
EINA_LIST_FREE(p->items, it)
|
EINA_LIST_FREE(plugin->items, it)
|
||||||
evry_item_free(it);
|
evry_item_free(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,33 +74,26 @@ _item_free(Evry_Item *it)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cleanup(Evry_Plugin *p)
|
_cleanup(Evry_Plugin *plugin)
|
||||||
{
|
{
|
||||||
Inst *inst = p->private;
|
Plugin *p = (Plugin*) plugin;
|
||||||
|
Efreet_Desktop *desktop;
|
||||||
|
|
||||||
_list_free(p);
|
_list_free(plugin);
|
||||||
|
|
||||||
if (inst)
|
EINA_LIST_FREE(p->apps_mime, desktop)
|
||||||
{
|
efreet_desktop_free(desktop);
|
||||||
Efreet_Desktop *desktop;
|
|
||||||
EINA_LIST_FREE(inst->apps_mime, desktop)
|
|
||||||
efreet_desktop_free(desktop);
|
|
||||||
EINA_LIST_FREE(inst->apps_all, desktop)
|
|
||||||
efreet_desktop_free(desktop);
|
|
||||||
|
|
||||||
E_FREE(inst);
|
EINA_LIST_FREE(p->apps_all, desktop)
|
||||||
}
|
efreet_desktop_free(desktop);
|
||||||
|
|
||||||
p->private = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int match)
|
_item_add(Plugin *p, Efreet_Desktop *desktop, char *file, int match)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
Evry_App *app;
|
Evry_App *app;
|
||||||
Efreet_Desktop *d2;
|
Efreet_Desktop *d2;
|
||||||
Inst *inst = p->private;
|
|
||||||
int already_refd = 0;
|
int already_refd = 0;
|
||||||
|
|
||||||
if (desktop)
|
if (desktop)
|
||||||
|
@ -122,7 +108,7 @@ _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int match)
|
||||||
int len;
|
int len;
|
||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
if (eina_hash_find(inst->added, file))
|
if (eina_hash_find(p->added, file))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
len = strlen(file);
|
len = strlen(file);
|
||||||
|
@ -144,26 +130,26 @@ _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int match)
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
if (!desktop)
|
if (!desktop)
|
||||||
eina_hash_add(inst->added, file, file);
|
eina_hash_add(p->added, file, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desktop)
|
if (desktop)
|
||||||
{
|
{
|
||||||
if ((d2 = eina_hash_find(inst->added, file)) &&
|
if ((d2 = eina_hash_find(p->added, file)) &&
|
||||||
((desktop == d2) ||
|
((desktop == d2) ||
|
||||||
(!strcmp(desktop->exec, d2->exec))))
|
(!strcmp(desktop->exec, d2->exec))))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!already_refd)
|
if (!already_refd)
|
||||||
efreet_desktop_ref(desktop);
|
efreet_desktop_ref(desktop);
|
||||||
eina_hash_add(inst->added, file, desktop);
|
eina_hash_add(p->added, file, desktop);
|
||||||
file = NULL;
|
file = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desktop)
|
if (desktop)
|
||||||
it = evry_item_new(p, desktop->name, _item_free);
|
it = evry_item_new(&p->base, desktop->name, _item_free);
|
||||||
else
|
else
|
||||||
it = evry_item_new(p, file, _item_free);
|
it = evry_item_new(&p->base, file, _item_free);
|
||||||
|
|
||||||
app = E_NEW(Evry_App, 1);
|
app = E_NEW(Evry_App, 1);
|
||||||
app->desktop = desktop;
|
app->desktop = desktop;
|
||||||
|
@ -171,13 +157,13 @@ _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int match)
|
||||||
it->data[0] = app;
|
it->data[0] = app;
|
||||||
it->fuzzy_match = match;
|
it->fuzzy_match = match;
|
||||||
|
|
||||||
p->items = eina_list_append(p->items, it);
|
p->base.items = eina_list_append(p->base.items, it);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_add_desktop_list(Evry_Plugin *p, Eina_List *apps, const char *input)
|
_add_desktop_list(Plugin *p, Eina_List *apps, const char *input)
|
||||||
{
|
{
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
@ -185,7 +171,7 @@ _add_desktop_list(Evry_Plugin *p, Eina_List *apps, const char *input)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(apps, l, desktop)
|
EINA_LIST_FOREACH(apps, l, desktop)
|
||||||
{
|
{
|
||||||
if (eina_list_count(p->items) > 199) continue;
|
if (eina_list_count(p->base.items) > 199) continue;
|
||||||
if (!desktop->name || !desktop->exec) continue;
|
if (!desktop->name || !desktop->exec) continue;
|
||||||
|
|
||||||
char *exec = strrchr(desktop->exec, '/');
|
char *exec = strrchr(desktop->exec, '/');
|
||||||
|
@ -245,29 +231,27 @@ _cb_sort(const void *data1, const void *data2)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_fetch(Evry_Plugin *p, const char *input)
|
_fetch(Evry_Plugin *plugin, const char *input)
|
||||||
{
|
{
|
||||||
|
Plugin *p = (Plugin*) plugin;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
char *file;
|
char *file;
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
Evry_App *app;
|
Evry_App *app;
|
||||||
Inst *inst = p->private;
|
|
||||||
|
|
||||||
inst->added = eina_hash_string_small_new(NULL);
|
p->added = eina_hash_string_small_new(NULL);
|
||||||
|
|
||||||
_list_free(p);
|
_list_free(plugin);
|
||||||
|
|
||||||
/* add apps for a given mimetype */
|
/* add apps for a given mimetype */
|
||||||
if (p->type == type_action)
|
if (p->base.type == type_action)
|
||||||
{
|
{
|
||||||
if (input)
|
if (input)
|
||||||
{
|
_add_desktop_list(p, p->apps_mime, input);
|
||||||
_add_desktop_list(p, inst->apps_mime, input);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EINA_LIST_FOREACH(inst->apps_mime, l, desktop)
|
EINA_LIST_FOREACH(p->apps_mime, l, desktop)
|
||||||
_item_add(p, desktop, NULL, 1);
|
_item_add(p, desktop, NULL, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,16 +259,16 @@ _fetch(Evry_Plugin *p, const char *input)
|
||||||
/* add apps matching input */
|
/* add apps matching input */
|
||||||
if (input)
|
if (input)
|
||||||
{
|
{
|
||||||
if (!inst->apps_all)
|
if (!p->apps_all)
|
||||||
{
|
{
|
||||||
Eina_List *apps = NULL;
|
Eina_List *apps = NULL;
|
||||||
Eina_List *stuff;
|
Eina_List *cats;
|
||||||
Eina_List *l, *ll;
|
Eina_List *l, *ll;
|
||||||
|
|
||||||
apps = efreet_util_desktop_name_glob_list("*");
|
apps = efreet_util_desktop_name_glob_list("*");
|
||||||
stuff = efreet_util_desktop_category_list("Screensaver");
|
cats = efreet_util_desktop_category_list("Screensaver");
|
||||||
|
|
||||||
EINA_LIST_FOREACH(stuff, l, desktop)
|
EINA_LIST_FOREACH(cats, l, desktop)
|
||||||
{
|
{
|
||||||
ll = eina_list_data_find_list(apps, desktop);
|
ll = eina_list_data_find_list(apps, desktop);
|
||||||
if (ll)
|
if (ll)
|
||||||
|
@ -292,16 +276,15 @@ _fetch(Evry_Plugin *p, const char *input)
|
||||||
efreet_desktop_free(desktop);
|
efreet_desktop_free(desktop);
|
||||||
apps = eina_list_remove_list(apps, ll);
|
apps = eina_list_remove_list(apps, ll);
|
||||||
}
|
}
|
||||||
/* efreet_desktop_free(desktop); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inst->apps_all = apps;
|
p->apps_all = apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
_add_desktop_list(p, inst->apps_all, input);
|
_add_desktop_list(p, p->apps_all, input);
|
||||||
}
|
}
|
||||||
/* add exe history items */
|
/* add exe history items */
|
||||||
else if (!p->items)
|
else if (!plugin->items)
|
||||||
{
|
{
|
||||||
l = e_exehist_list_get();
|
l = e_exehist_list_get();
|
||||||
EINA_LIST_FREE(l, file)
|
EINA_LIST_FREE(l, file)
|
||||||
|
@ -309,7 +292,7 @@ _fetch(Evry_Plugin *p, const char *input)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* show 'Run Command' item */
|
/* show 'Run Command' item */
|
||||||
if (input || p == p2)
|
if (input)
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
char *end;
|
char *end;
|
||||||
|
@ -317,60 +300,53 @@ _fetch(Evry_Plugin *p, const char *input)
|
||||||
char cmd[1024];
|
char cmd[1024];
|
||||||
char path[1024];
|
char path[1024];
|
||||||
|
|
||||||
if (input)
|
snprintf(cmd, sizeof(cmd), "%s", input);
|
||||||
|
|
||||||
|
if ((end = strchr(input, ' ')))
|
||||||
{
|
{
|
||||||
snprintf(cmd, sizeof(cmd), "%s", input);
|
int len = (end - input) + 1;
|
||||||
|
if (len >= 0)
|
||||||
|
snprintf(cmd, len, "%s", input);
|
||||||
|
}
|
||||||
|
|
||||||
if ((end = strchr(input, ' ')))
|
EINA_LIST_FOREACH(exe_path, l, dir)
|
||||||
|
{
|
||||||
|
snprintf(path, sizeof(path), "%s/%s", dir, cmd);
|
||||||
|
if (ecore_file_exists(path))
|
||||||
{
|
{
|
||||||
int len = (end - input) + 1;
|
found = 1;
|
||||||
if (len >= 0)
|
break;
|
||||||
snprintf(cmd, len, "%s", input);
|
|
||||||
}
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(exe_path, l, dir)
|
|
||||||
{
|
|
||||||
snprintf(path, sizeof(path), "%s/%s", dir, cmd);
|
|
||||||
if (ecore_file_exists(path))
|
|
||||||
{
|
|
||||||
found = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found || p == p2)
|
if (found)
|
||||||
{
|
{
|
||||||
it = evry_item_new(p, _("Run Command"), _item_free);
|
it = evry_item_new(plugin, _("Run Command"), _item_free);
|
||||||
app = E_NEW(Evry_App, 1);
|
app = E_NEW(Evry_App, 1);
|
||||||
if (input)
|
app->file = eina_stringshare_add(input);
|
||||||
app->file = eina_stringshare_add(input);
|
|
||||||
else
|
|
||||||
app->file = eina_stringshare_add("");
|
|
||||||
it->data[0] = app;
|
it->data[0] = app;
|
||||||
it->priority = 9999;
|
it->priority = 9999;
|
||||||
p->items = eina_list_append(p->items, it);
|
plugin->items = eina_list_append(plugin->items, it);
|
||||||
|
|
||||||
snprintf(cmd, sizeof(cmd), "xterm -hold -e %s", input);
|
snprintf(cmd, sizeof(cmd), "xterm -hold -e %s", input);
|
||||||
it = evry_item_new(p, _("Run in Terminal"), _item_free);
|
it = evry_item_new(plugin, _("Run in Terminal"), _item_free);
|
||||||
app = E_NEW(Evry_App, 1);
|
app = E_NEW(Evry_App, 1);
|
||||||
if (input)
|
app->file = eina_stringshare_add(cmd);
|
||||||
app->file = eina_stringshare_add(cmd);
|
|
||||||
else
|
|
||||||
app->file = eina_stringshare_add("");
|
|
||||||
it->data[0] = app;
|
it->data[0] = app;
|
||||||
it->priority = 1000;
|
it->priority = 1000;
|
||||||
p->items = eina_list_append(p->items, it);
|
plugin->items = eina_list_append(plugin->items, it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
eina_hash_free(inst->added);
|
eina_hash_free(p->added);
|
||||||
|
|
||||||
if (p->items)
|
if (plugin->items)
|
||||||
{
|
{
|
||||||
int prio = 0;
|
int prio = 0;
|
||||||
p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort);
|
|
||||||
EINA_LIST_FOREACH(p->items, l, it)
|
l = plugin->items;
|
||||||
|
plugin->items = eina_list_sort(l, eina_list_count(l), _cb_sort);
|
||||||
|
EINA_LIST_FOREACH(plugin->items, l, it)
|
||||||
it->priority = prio++;
|
it->priority = prio++;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -525,11 +501,12 @@ _exec_border_action(Evry_Action *act, const Evry_Item *it1, const Evry_Item *it2
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_open_with_action(Evry_Plugin *p, const Evry_Item *it, const char *input __UNUSED__)
|
_open_with_action(Evry_Plugin *plugin, const Evry_Item *it, const char *input __UNUSED__)
|
||||||
{
|
{
|
||||||
Inst *inst = p->private;
|
Plugin *p = (Plugin*) plugin;
|
||||||
if (inst->candidate)
|
|
||||||
return _app_action(it, inst->candidate);
|
if (p->candidate)
|
||||||
|
return _app_action(it, p->candidate);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -649,30 +626,36 @@ _init(void)
|
||||||
{
|
{
|
||||||
char *path, *p, *last;
|
char *path, *p, *last;
|
||||||
|
|
||||||
p1 = evry_plugin_new("Applications", type_subject, "", "APPLICATION", 0, NULL, NULL,
|
p1 = E_NEW(Plugin, 1);
|
||||||
_begin, _cleanup, _fetch, NULL, NULL,
|
evry_plugin_new(&p1->base, "Applications", type_subject, "", "APPLICATION", 0, NULL, NULL,
|
||||||
_icon_get, NULL, NULL);
|
_begin, _cleanup, _fetch, NULL, _icon_get, NULL, NULL);
|
||||||
|
|
||||||
p2 = evry_plugin_new("Open With...", type_action, "FILE", "", 0, NULL, NULL,
|
p2 = E_NEW(Plugin, 1);
|
||||||
_begin, _cleanup, _fetch, _open_with_action, NULL,
|
evry_plugin_new(&p2->base, "Open With...", type_action, "FILE", "", 0, NULL, NULL,
|
||||||
_icon_get, NULL, NULL);
|
_begin, _cleanup, _fetch, _open_with_action,
|
||||||
|
_icon_get, NULL, NULL);
|
||||||
|
|
||||||
evry_plugin_register(p1, 1);
|
evry_plugin_register(&p1->base, 1);
|
||||||
evry_plugin_register(p2, 3);
|
evry_plugin_register(&p2->base, 3);
|
||||||
|
|
||||||
act = evry_action_new("Launch", "APPLICATION", NULL, "everything-launch",
|
act = evry_action_new("Launch", "APPLICATION", NULL, NULL,
|
||||||
|
"everything-launch",
|
||||||
_exec_app_action, _exec_app_check_item, NULL);
|
_exec_app_action, _exec_app_check_item, NULL);
|
||||||
|
|
||||||
act1 = evry_action_new("Open File...", "APPLICATION", "FILE", "document-open",
|
act1 = evry_action_new("Open File...", "APPLICATION", "FILE", "APPLICATION",
|
||||||
|
"document-open",
|
||||||
_exec_app_action, _exec_app_check_item, NULL);
|
_exec_app_action, _exec_app_check_item, NULL);
|
||||||
|
|
||||||
act2 = evry_action_new("Edit Application Entry", "APPLICATION", NULL, "everything-launch",
|
act2 = evry_action_new("Edit Application Entry", "APPLICATION", NULL, NULL,
|
||||||
|
"everything-launch",
|
||||||
_edit_app_action, _edit_app_check_item, NULL);
|
_edit_app_action, _edit_app_check_item, NULL);
|
||||||
|
|
||||||
act3 = evry_action_new("New Application Entry", "APPLICATION", NULL, "everything-launch",
|
act3 = evry_action_new("New Application Entry", "APPLICATION", NULL, NULL,
|
||||||
|
"everything-launch",
|
||||||
_new_app_action, _new_app_check_item, NULL);
|
_new_app_action, _new_app_check_item, NULL);
|
||||||
|
|
||||||
act4 = evry_action_new("Open File...", "BORDER", "FILE", "everything-launch",
|
act4 = evry_action_new("Open File...", "BORDER", "FILE", NULL,
|
||||||
|
"everything-launch",
|
||||||
_exec_border_action, _exec_border_check_item, NULL);
|
_exec_border_action, _exec_border_check_item, NULL);
|
||||||
|
|
||||||
evry_action_register(act);
|
evry_action_register(act);
|
||||||
|
@ -709,8 +692,11 @@ _shutdown(void)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
evry_plugin_free(p1);
|
evry_plugin_free(&p1->base, 0);
|
||||||
evry_plugin_free(p2);
|
evry_plugin_free(&p2->base, 0);
|
||||||
|
E_FREE(p1);
|
||||||
|
E_FREE(p2);
|
||||||
|
|
||||||
evry_action_free(act);
|
evry_action_free(act);
|
||||||
evry_action_free(act1);
|
evry_action_free(act1);
|
||||||
evry_action_free(act2);
|
evry_action_free(act2);
|
||||||
|
|
|
@ -21,7 +21,7 @@ struct _Plugin
|
||||||
Eina_Bool is_first;
|
Eina_Bool is_first;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Plugin *_singleton = NULL;
|
static Plugin *plugin = NULL;
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_exe_restart(Plugin *p)
|
_exe_restart(Plugin *p)
|
||||||
|
@ -187,7 +187,7 @@ _cb_data(void *data, int type __UNUSED__, void *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_ADD);
|
evry_plugin_async_update(plugin, EVRY_ASYNC_UPDATE_ADD);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
if (!input) return 0;
|
if (!input) return 0;
|
||||||
|
|
||||||
if (!p->handler.data && !_begin(plugin, NULL)) return 0;
|
if (!p->handler.data && !_begin(plugin, NULL)) return 0;
|
||||||
|
|
||||||
len = sizeof(LANG_MODIFIER) - 1;
|
len = sizeof(LANG_MODIFIER) - 1;
|
||||||
if (strncmp(input, LANG_MODIFIER, len) == 0)
|
if (strncmp(input, LANG_MODIFIER, len) == 0)
|
||||||
{
|
{
|
||||||
|
@ -331,42 +331,27 @@ _init(void)
|
||||||
{
|
{
|
||||||
Plugin *p;
|
Plugin *p;
|
||||||
|
|
||||||
if (_singleton)
|
|
||||||
return EINA_TRUE;
|
|
||||||
|
|
||||||
p = E_NEW(Plugin, 1);
|
p = E_NEW(Plugin, 1);
|
||||||
p->base.name = "Spell Checker";
|
evry_plugin_new(&p->base, "Spell Checker", type_subject, "", "TEXT", 1,
|
||||||
p->base.type = type_subject;
|
"accessories-dictionary", TRIGGER,
|
||||||
p->base.type_out = eina_stringshare_add("TEXT");
|
NULL, _cleanup, _fetch, NULL, NULL, NULL, NULL);
|
||||||
p->base.icon = "accessories-dictionary";
|
|
||||||
p->base.trigger = TRIGGER;
|
|
||||||
p->base.fetch = _fetch;
|
|
||||||
p->base.cleanup = _cleanup;
|
|
||||||
|
|
||||||
evry_plugin_register(&p->base, 100);
|
evry_plugin_register(&p->base, 100);
|
||||||
|
|
||||||
_singleton = p;
|
plugin = p;
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_shutdown(void)
|
_shutdown(void)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
|
||||||
Plugin *p;
|
Plugin *p;
|
||||||
|
|
||||||
if (!_singleton)
|
p = plugin;
|
||||||
return;
|
|
||||||
|
|
||||||
p = _singleton;
|
_cleanup(&p->base);
|
||||||
_singleton = NULL;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(p->base.items, it)
|
evry_plugin_free(&p->base, 0);
|
||||||
evry_item_free(it);
|
|
||||||
|
|
||||||
eina_stringshare_del(p->base.type_out);
|
|
||||||
|
|
||||||
evry_plugin_unregister(&p->base);
|
|
||||||
E_FREE(p);
|
E_FREE(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,14 @@ _cb_border_remove(void *data, int type, void *event)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static Evry_Plugin *
|
||||||
_begin(Evry_Plugin *p, const Evry_Item *it)
|
_begin(Evry_Plugin *p, const Evry_Item *it)
|
||||||
{
|
{
|
||||||
handlers = eina_list_append
|
handlers = eina_list_append
|
||||||
(handlers, ecore_event_handler_add
|
(handlers, ecore_event_handler_add
|
||||||
(E_EVENT_BORDER_REMOVE, _cb_border_remove, NULL));
|
(E_EVENT_BORDER_REMOVE, _cb_border_remove, NULL));
|
||||||
|
|
||||||
return 1;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -218,8 +218,8 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_init(void)
|
_init(void)
|
||||||
{
|
{
|
||||||
p = evry_plugin_new("Windows", type_subject, NULL, "BORDER", 0, NULL, NULL,
|
p = evry_plugin_new(NULL, "Windows", type_subject, NULL, "BORDER", 0, NULL, NULL,
|
||||||
_begin, _cleanup, _fetch, NULL, NULL, _item_icon_get, NULL, NULL);
|
_begin, _cleanup, _fetch, NULL, _item_icon_get, NULL, NULL);
|
||||||
|
|
||||||
evry_plugin_register(p, 2);
|
evry_plugin_register(p, 2);
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ _init(void)
|
||||||
static void
|
static void
|
||||||
_shutdown(void)
|
_shutdown(void)
|
||||||
{
|
{
|
||||||
evry_plugin_free(p);
|
evry_plugin_free(p, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ _act_cb_border_unminimize(E_Border *bd)
|
||||||
if (!bd->lock_user_iconify) e_border_uniconify(bd);
|
if (!bd->lock_user_iconify) e_border_uniconify(bd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static Evry_Plugin *
|
||||||
_begin(Evry_Plugin *p __UNUSED__, const Evry_Item *item)
|
_begin(Evry_Plugin *p __UNUSED__, const Evry_Item *item)
|
||||||
{
|
{
|
||||||
E_Border *bd;
|
E_Border *bd;
|
||||||
|
@ -92,7 +92,7 @@ _begin(Evry_Plugin *p __UNUSED__, const Evry_Item *item)
|
||||||
/* e_object_ref(E_OBJECT(bd)); */
|
/* e_object_ref(E_OBJECT(bd)); */
|
||||||
inst->border = bd;
|
inst->border = bd;
|
||||||
|
|
||||||
return 1;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -212,8 +212,8 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_init(void)
|
_init(void)
|
||||||
{
|
{
|
||||||
p = evry_plugin_new("Window Action", type_action, "BORDER", NULL, 0, NULL, NULL,
|
p = evry_plugin_new(NULL, "Window Action", type_action, "BORDER", NULL, 0, NULL, NULL,
|
||||||
_begin, _cleanup, _fetch, _action, NULL, _item_icon_get, NULL, NULL);
|
_begin, _cleanup, _fetch, _action, _item_icon_get, NULL, NULL);
|
||||||
|
|
||||||
evry_plugin_register(p, 1);
|
evry_plugin_register(p, 1);
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ _init(void)
|
||||||
static void
|
static void
|
||||||
_shutdown(void)
|
_shutdown(void)
|
||||||
{
|
{
|
||||||
evry_plugin_free(p);
|
evry_plugin_free(p, 1);
|
||||||
E_FREE(inst);
|
E_FREE(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ static int error = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static Evry_Plugin *
|
||||||
_begin(Evry_Plugin *p, const Evry_Item *item __UNUSED__)
|
_begin(Evry_Plugin *p, const Evry_Item *item __UNUSED__)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
|
@ -34,7 +34,7 @@ _begin(Evry_Plugin *p, const Evry_Item *item __UNUSED__)
|
||||||
it = evry_item_new(p, "0", NULL);
|
it = evry_item_new(p, "0", NULL);
|
||||||
p->items = eina_list_prepend(p->items, it);
|
p->items = eina_list_prepend(p->items, it);
|
||||||
|
|
||||||
return 1;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -207,8 +207,8 @@ _cb_del(void *data __UNUSED__, int type __UNUSED__, void *event)
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_init(void)
|
_init(void)
|
||||||
{
|
{
|
||||||
p1 = evry_plugin_new("Calculator", type_subject, NULL, "TEXT", 1, "accessories-calculator", "=",
|
p1 = evry_plugin_new(NULL, "Calculator", type_subject, NULL, "TEXT", 1, "accessories-calculator", "=",
|
||||||
_begin, _cleanup, _fetch, _action, NULL, NULL, NULL, NULL);
|
_begin, _cleanup, _fetch, _action, NULL, NULL, NULL);
|
||||||
|
|
||||||
evry_plugin_register(p1, 0);
|
evry_plugin_register(p1, 0);
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ _shutdown(void)
|
||||||
EINA_LIST_FREE(history, result)
|
EINA_LIST_FREE(history, result)
|
||||||
eina_stringshare_del(result);
|
eina_stringshare_del(result);
|
||||||
|
|
||||||
evry_plugin_free(p1);
|
evry_plugin_free(p1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ _init(void)
|
||||||
Ecore_X_Window win = ecore_x_window_new(0, 0, 0, 1, 1);
|
Ecore_X_Window win = ecore_x_window_new(0, 0, 0, 1, 1);
|
||||||
if (!win) return EINA_FALSE;
|
if (!win) return EINA_FALSE;
|
||||||
|
|
||||||
act = evry_action_new("Copy to Clipboard", "TEXT", NULL, "edit-copy",
|
act = evry_action_new("Copy to Clipboard", "TEXT", NULL, NULL, "edit-copy",
|
||||||
_action, _check_item, NULL);
|
_action, _check_item, NULL);
|
||||||
|
|
||||||
evry_action_register(act);
|
evry_action_register(act);
|
||||||
|
|
|
@ -130,10 +130,10 @@ _action(Evry_Action *act, const Evry_Item *it, const Evry_Item *it2 __UNUSED__,
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_init(void)
|
_init(void)
|
||||||
{
|
{
|
||||||
p = evry_plugin_new("Settings", type_subject, NULL, "E_SETTINGS", 0, NULL, NULL,
|
p = evry_plugin_new(NULL, "Settings", type_subject, NULL, "E_SETTINGS", 0, NULL, NULL,
|
||||||
NULL, _cleanup, _fetch, NULL, NULL, _item_icon_get, NULL, NULL);
|
NULL, _cleanup, _fetch, NULL, _item_icon_get, NULL, NULL);
|
||||||
|
|
||||||
act = evry_action_new("Show Dialog", "E_SETTINGS", NULL, "preferences-advanced",
|
act = evry_action_new("Show Dialog", "E_SETTINGS", NULL, NULL, "preferences-advanced",
|
||||||
_action, NULL, NULL);
|
_action, NULL, NULL);
|
||||||
|
|
||||||
evry_plugin_register(p, 10);
|
evry_plugin_register(p, 10);
|
||||||
|
@ -145,7 +145,9 @@ _init(void)
|
||||||
static void
|
static void
|
||||||
_shutdown(void)
|
_shutdown(void)
|
||||||
{
|
{
|
||||||
evry_plugin_free(p);
|
evry_plugin_free(p, 1);
|
||||||
|
|
||||||
|
|
||||||
evry_action_free(act);
|
evry_action_free(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,30 +3,33 @@
|
||||||
|
|
||||||
#define MAX_ITEMS 100
|
#define MAX_ITEMS 100
|
||||||
|
|
||||||
typedef struct _State State;
|
typedef struct _Plugin Plugin;
|
||||||
|
|
||||||
struct _State
|
struct _Plugin
|
||||||
{
|
{
|
||||||
|
Evry_Plugin base;
|
||||||
|
|
||||||
const char *directory;
|
const char *directory;
|
||||||
/* all files of directory */
|
/* all files of directory */
|
||||||
Eina_List *items;
|
Eina_List *items;
|
||||||
/* current list of files */
|
/* current list of files */
|
||||||
Eina_List *cur;
|
Eina_List *cur;
|
||||||
Eina_Bool command;
|
Eina_Bool command;
|
||||||
|
Ecore_Idler *idler;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Evry_Plugin *p1;
|
static Evry_Plugin *p1;
|
||||||
static Evry_Plugin *p2;
|
static Evry_Plugin *p2;
|
||||||
static Evry_Action *act;
|
static Evry_Action *act;
|
||||||
static Ecore_Idler *idler = NULL;
|
|
||||||
|
|
||||||
static Evry_Item *
|
static Evry_Item *
|
||||||
_item_add(Evry_Plugin *p, const char *directory, const char *file)
|
_item_add(Plugin *p, const char *directory, const char *file)
|
||||||
{
|
{
|
||||||
Evry_Item *it = NULL;
|
Evry_Item *it = NULL;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
|
||||||
it = evry_item_new(p, file, NULL);
|
it = evry_item_new(&p->base, file, NULL);
|
||||||
if (!it) return NULL;
|
if (!it) return NULL;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", directory, file);
|
snprintf(buf, sizeof(buf), "%s/%s", directory, file);
|
||||||
|
@ -94,15 +97,12 @@ _cb_sort(const void *data1, const void *data2)
|
||||||
static int
|
static int
|
||||||
_dirbrowse_idler(void *data)
|
_dirbrowse_idler(void *data)
|
||||||
{
|
{
|
||||||
Evry_Plugin *p = data;
|
Plugin *p = data;
|
||||||
State *s = ((Eina_List *)p->private)->data;
|
|
||||||
int cnt = 10;
|
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
|
int cnt = 10;
|
||||||
|
|
||||||
if (!idler) return 0;
|
EINA_LIST_FOREACH(p->items, l, it)
|
||||||
|
|
||||||
EINA_LIST_FOREACH(s->items, l, it)
|
|
||||||
{
|
{
|
||||||
if (!it->mime)
|
if (!it->mime)
|
||||||
{
|
{
|
||||||
|
@ -112,38 +112,28 @@ _dirbrowse_idler(void *data)
|
||||||
if (cnt == 0) break;
|
if (cnt == 0) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!s->command)
|
l = p->base.items;
|
||||||
|
|
||||||
|
p->base.items = eina_list_sort(l, eina_list_count(l), _cb_sort);
|
||||||
|
evry_plugin_async_update(&p->base, EVRY_ASYNC_UPDATE_ADD);
|
||||||
|
|
||||||
|
if (cnt > 0)
|
||||||
{
|
{
|
||||||
if (eina_list_count(p->items) > 0)
|
p->idler = NULL;
|
||||||
{
|
return 0;
|
||||||
p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort);
|
|
||||||
s->cur = p->items;
|
|
||||||
}
|
|
||||||
|
|
||||||
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD);
|
|
||||||
|
|
||||||
if (cnt > 0)
|
|
||||||
{
|
|
||||||
idler = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_push_directory(Evry_Plugin *p, State *s)
|
_read_directory(Plugin *p)
|
||||||
{
|
{
|
||||||
char *file;
|
char *file;
|
||||||
Eina_List *files;
|
Eina_List *files;
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
Eina_List *stack = p->private;
|
|
||||||
|
|
||||||
/* previous states items are saved in s->items !*/
|
files = ecore_file_ls(p->directory);
|
||||||
p->items = NULL;
|
|
||||||
|
|
||||||
files = ecore_file_ls(s->directory);
|
|
||||||
|
|
||||||
EINA_LIST_FREE(files, file)
|
EINA_LIST_FREE(files, file)
|
||||||
{
|
{
|
||||||
|
@ -155,164 +145,141 @@ _push_directory(Evry_Plugin *p, State *s)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
it = _item_add(p, s->directory, file);
|
it = _item_add(p, p->directory, file);
|
||||||
|
|
||||||
if (it)
|
if (it)
|
||||||
s->items = eina_list_append(s->items, it);
|
p->items = eina_list_append(p->items, it);
|
||||||
|
|
||||||
free(file);
|
free(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idler)
|
p->idler = ecore_idler_add(_dirbrowse_idler, p);
|
||||||
ecore_idler_del(idler);
|
|
||||||
|
|
||||||
idler = ecore_idler_add(_dirbrowse_idler, p);
|
|
||||||
|
|
||||||
stack = eina_list_prepend(stack, s);
|
|
||||||
p->private = stack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static Evry_Plugin *
|
||||||
_begin(Evry_Plugin *p, const Evry_Item *item __UNUSED__)
|
_begin(Evry_Plugin *plugin, const Evry_Item *it)
|
||||||
{
|
{
|
||||||
State *s;
|
Plugin *p;
|
||||||
|
|
||||||
s = E_NEW(State, 1);
|
/* is FILE ? */
|
||||||
s->directory = eina_stringshare_add(e_user_homedir_get());
|
if (it && (it->plugin->type_out == plugin->type_in))
|
||||||
_push_directory(p, s);
|
{
|
||||||
|
if (!it->uri || !ecore_file_is_dir(it->uri))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return 1;
|
p = E_NEW(Plugin, 1);
|
||||||
}
|
p->base = *plugin;
|
||||||
|
|
||||||
static int
|
p->directory = eina_stringshare_add(it->uri);
|
||||||
_browse(Evry_Plugin *p, const Evry_Item *it_file)
|
}
|
||||||
{
|
else
|
||||||
State *s;
|
{
|
||||||
|
p = E_NEW(Plugin, 1);
|
||||||
|
p->base = *plugin;
|
||||||
|
|
||||||
if (!it_file || !it_file->uri || !ecore_file_is_dir(it_file->uri))
|
p->directory = eina_stringshare_add(e_user_homedir_get());
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
_read_directory(p);
|
||||||
|
|
||||||
s = E_NEW(State, 1);
|
return &p->base;
|
||||||
s->directory = eina_stringshare_add(it_file->uri);
|
|
||||||
_push_directory(p, s);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cleanup(Evry_Plugin *p)
|
_cleanup(Evry_Plugin *plugin)
|
||||||
{
|
{
|
||||||
State *s;
|
Plugin *p = (Plugin*) plugin;
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
Eina_List *stack = p->private;
|
|
||||||
|
|
||||||
if (!stack) return;
|
if (p->directory)
|
||||||
|
eina_stringshare_del(p->directory);
|
||||||
|
|
||||||
s = stack->data;
|
EINA_LIST_FREE(p->items, it)
|
||||||
|
|
||||||
if (s->directory) eina_stringshare_del(s->directory);
|
|
||||||
|
|
||||||
EINA_LIST_FREE(s->items, it)
|
|
||||||
evry_item_free(it);
|
evry_item_free(it);
|
||||||
|
|
||||||
if (idler)
|
if (p->idler)
|
||||||
{
|
ecore_idler_del(p->idler);
|
||||||
ecore_idler_del(idler);
|
|
||||||
idler = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
E_FREE(s);
|
if (plugin->items)
|
||||||
|
eina_list_free(plugin->items);
|
||||||
|
|
||||||
if (p->items) eina_list_free(p->items);
|
E_FREE(p);
|
||||||
p->items = NULL;
|
|
||||||
|
|
||||||
stack = eina_list_remove_list(stack, stack);
|
|
||||||
p->private = stack;
|
|
||||||
|
|
||||||
if (stack)
|
|
||||||
{
|
|
||||||
s = stack->data;
|
|
||||||
p->items = s->cur;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_fetch(Evry_Plugin *p, const char *input)
|
_fetch(Evry_Plugin *plugin, const char *input)
|
||||||
{
|
{
|
||||||
|
Plugin *p = (Plugin*) plugin;
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
State *s = ((Eina_List *)p->private)->data;
|
|
||||||
|
|
||||||
if (!s->command)
|
if (!p->command)
|
||||||
{
|
{
|
||||||
if (p->items) eina_list_free(p->items);
|
if (p->base.items) eina_list_free(p->base.items);
|
||||||
p->items = NULL;
|
plugin->items = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* input is command ? */
|
/* input is command ? */
|
||||||
if (input)
|
if (input)
|
||||||
{
|
{
|
||||||
if (!strncmp(input, "/", 1))
|
if (!strncmp(input, "/", 1))
|
||||||
{
|
{
|
||||||
if (s->command) return 1;
|
if (p->command) return 1;
|
||||||
|
|
||||||
it = evry_item_new(p, "/", NULL);
|
it = evry_item_new(&p->base, "/", NULL);
|
||||||
if (!it) return 0;
|
if (!it) return 0;
|
||||||
it->uri = eina_stringshare_add("/");
|
it->uri = eina_stringshare_add("/");
|
||||||
p->items = eina_list_append(p->items, it);
|
p->base.items = eina_list_append(p->base.items, it);
|
||||||
s->cur = p->items;
|
p->command = EINA_TRUE;
|
||||||
s->command = EINA_TRUE;
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
else if (!strncmp(input, "..", 2))
|
||||||
else if (!strncmp(input, "..", 2))
|
{
|
||||||
{
|
char *end;
|
||||||
char *end;
|
char dir[4096];
|
||||||
char dir[4096];
|
char *tmp;
|
||||||
char *tmp;
|
int prio = 0;
|
||||||
int prio = 0;
|
|
||||||
|
|
||||||
if (s->command) return 1;
|
if (p->command) return 1;
|
||||||
|
|
||||||
if (!strcmp(s->directory, "/")) return 0;
|
if (!strcmp(p->directory, "/")) return 0;
|
||||||
|
|
||||||
snprintf(dir, 4096, "%s", s->directory);
|
snprintf(dir, 4096, "%s", p->directory);
|
||||||
end = strrchr(dir, '/');
|
end = strrchr(dir, '/');
|
||||||
|
|
||||||
while (end != dir)
|
while (end != dir)
|
||||||
{
|
{
|
||||||
tmp = strdup(dir);
|
tmp = strdup(dir);
|
||||||
snprintf(dir, (end - dir) + 1, "%s", tmp);
|
snprintf(dir, (end - dir) + 1, "%s", tmp);
|
||||||
it = evry_item_new(p, dir, NULL);
|
it = evry_item_new(&p->base, dir, NULL);
|
||||||
if (!it) break;
|
if (!it) break;
|
||||||
it->uri = eina_stringshare_add(dir);
|
it->uri = eina_stringshare_add(dir);
|
||||||
it->priority = prio;
|
it->priority = prio;
|
||||||
p->items = eina_list_append(p->items, it);
|
p->base.items = eina_list_append(p->base.items, it);
|
||||||
end = strrchr(dir, '/');
|
end = strrchr(dir, '/');
|
||||||
free(tmp);
|
free(tmp);
|
||||||
prio--;
|
prio--;
|
||||||
}
|
}
|
||||||
|
|
||||||
it = evry_item_new(p, "/", NULL);
|
it = evry_item_new(&p->base, "/", NULL);
|
||||||
if (!it) return 0;
|
if (!it) return 0;
|
||||||
it->uri = eina_stringshare_add("/");
|
it->uri = eina_stringshare_add("/");
|
||||||
it->priority = prio;
|
it->priority = prio;
|
||||||
p->items = eina_list_append(p->items, it);
|
p->base.items = eina_list_append(p->base.items, it);
|
||||||
s->cur = p->items;
|
p->command = EINA_TRUE;
|
||||||
s->command = EINA_TRUE;
|
return 1;
|
||||||
return 1;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->command)
|
if (p->command)
|
||||||
{
|
{
|
||||||
EINA_LIST_FREE(p->items, it)
|
p->command = EINA_FALSE;
|
||||||
evry_item_free(it);
|
EINA_LIST_FREE(p->base.items, it)
|
||||||
|
evry_item_free(it);
|
||||||
s->command = EINA_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FOREACH(s->items, l, it)
|
EINA_LIST_FOREACH(p->items, l, it)
|
||||||
{
|
{
|
||||||
if (input)
|
if (input)
|
||||||
{
|
{
|
||||||
|
@ -325,17 +292,16 @@ _fetch(Evry_Plugin *p, const char *input)
|
||||||
|
|
||||||
if (it)
|
if (it)
|
||||||
{
|
{
|
||||||
p->items = eina_list_prepend(p->items, it);
|
p->base.items = eina_list_append(p->base.items, it);
|
||||||
cnt++;
|
if (cnt++ >= MAX_ITEMS) break;
|
||||||
if (cnt >= MAX_ITEMS) break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s->cur = p->items;
|
if (p->base.items)
|
||||||
if (p->items)
|
|
||||||
{
|
{
|
||||||
p->items = eina_list_sort(p->items, eina_list_count(p->items), _cb_sort);
|
p->base.items = eina_list_sort
|
||||||
s->cur = p->items;
|
(p->base.items, eina_list_count(p->base.items), _cb_sort);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +321,7 @@ _icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
|
||||||
if (it->browseable)
|
if (it->browseable)
|
||||||
o = evry_icon_theme_get("folder", e);
|
o = evry_icon_theme_get("folder", e);
|
||||||
else
|
else
|
||||||
o = evry_icon_mime_get(it->mime, e);
|
o = evry_icon_mime_get(it->mime, e);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
@ -368,7 +334,8 @@ _open_folder_check(Evry_Action *act __UNUSED__, const Evry_Item *it)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_open_folder_action(Evry_Action *act __UNUSED__, const Evry_Item *it, const Evry_Item *it2 __UNUSED__, const char *input __UNUSED__)
|
_open_folder_action(Evry_Action *act __UNUSED__, const Evry_Item *it,
|
||||||
|
const Evry_Item *it2 __UNUSED__, const char *input __UNUSED__)
|
||||||
{
|
{
|
||||||
E_Action *action = e_action_find("fileman");
|
E_Action *action = e_action_find("fileman");
|
||||||
char *path;
|
char *path;
|
||||||
|
@ -393,21 +360,22 @@ _open_folder_action(Evry_Action *act __UNUSED__, const Evry_Item *it, const Evry
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_init(void)
|
_init(void)
|
||||||
{
|
{
|
||||||
p1 = evry_plugin_new("Files", type_subject, "FILE", "FILE", 0, NULL, NULL,
|
p1 = evry_plugin_new(NULL, "Files", type_subject, "FILE", "FILE", 0, NULL, NULL,
|
||||||
_begin, _cleanup, _fetch, NULL, _browse, _icon_get,
|
_begin, _cleanup, _fetch, NULL, _icon_get,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
p2 = evry_plugin_new("Files", type_object, "FILE", "FILE", 0, NULL, NULL,
|
p2 = evry_plugin_new(NULL, "Files", type_object, "FILE", "FILE", 0, NULL, NULL,
|
||||||
_begin, _cleanup, _fetch, NULL, _browse, _icon_get,
|
_begin, _cleanup, _fetch, NULL, _icon_get,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
evry_plugin_register(p1, 3);
|
evry_plugin_register(p1, 3);
|
||||||
evry_plugin_register(p2, 1);
|
evry_plugin_register(p2, 1);
|
||||||
|
|
||||||
act = evry_action_new("Open Folder (EFM)", "FILE", NULL, "folder-open",
|
act = evry_action_new("Open Folder (EFM)", "FILE", NULL, NULL, "folder-open",
|
||||||
_open_folder_action, _open_folder_check, NULL);
|
_open_folder_action, _open_folder_check, NULL);
|
||||||
|
|
||||||
evry_action_register(act);
|
evry_action_register(act);
|
||||||
|
@ -418,8 +386,9 @@ _init(void)
|
||||||
static void
|
static void
|
||||||
_shutdown(void)
|
_shutdown(void)
|
||||||
{
|
{
|
||||||
evry_plugin_free(p1);
|
evry_plugin_free(p1, 1);
|
||||||
evry_plugin_free(p2);
|
evry_plugin_free(p2, 1);
|
||||||
|
|
||||||
evry_action_free(act);
|
evry_action_free(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,9 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
|
||||||
Image_View *v;
|
Image_View *v;
|
||||||
int w, h, x, y;
|
int w, h, x, y;
|
||||||
|
|
||||||
|
if (!s->plugin)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (!_get_list(s))
|
if (!_get_list(s))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
|
|
||||||
/* TODO check if trackerd is running and version */
|
/* TODO check if trackerd is running and version */
|
||||||
|
|
||||||
typedef struct _Inst Inst;
|
typedef struct _Plugin Plugin;
|
||||||
|
|
||||||
struct _Inst
|
struct _Plugin
|
||||||
{
|
{
|
||||||
|
Evry_Plugin base;
|
||||||
|
|
||||||
int active;
|
int active;
|
||||||
char *condition;
|
char *condition;
|
||||||
char *service;
|
char *service;
|
||||||
|
@ -20,14 +22,15 @@ 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
|
static Evry_Plugin *
|
||||||
_begin(Evry_Plugin *p, const Evry_Item *it)
|
_begin(Evry_Plugin *plugin, const Evry_Item *it)
|
||||||
{
|
{
|
||||||
Inst *inst = p->private;
|
Plugin *p = (Plugin*) plugin;
|
||||||
|
|
||||||
inst->active = 0;
|
p->active = 0;
|
||||||
|
|
||||||
if (!strcmp(it->plugin->type_out, "APPLICATION"))
|
/* is application */
|
||||||
|
if (it->plugin->type_out == plugin->type_in)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
const char *mime;
|
const char *mime;
|
||||||
|
@ -36,11 +39,11 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
|
||||||
char rdf_query[32768];
|
char rdf_query[32768];
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (inst->condition[0]) free (inst->condition);
|
if (p->condition[0]) free (p->condition);
|
||||||
inst->condition = "";
|
p->condition = "";
|
||||||
|
|
||||||
if (!app->desktop || !app->desktop->mime_types)
|
if (!app->desktop || !app->desktop->mime_types)
|
||||||
return 1;
|
return NULL;
|
||||||
|
|
||||||
rdf_query[0] = '\0';
|
rdf_query[0] = '\0';
|
||||||
strcat(rdf_query, "<rdfq:Condition><rdfq:or>");
|
strcat(rdf_query, "<rdfq:Condition><rdfq:or>");
|
||||||
|
@ -48,7 +51,7 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
|
||||||
EINA_LIST_FOREACH(app->desktop->mime_types, l, mime)
|
EINA_LIST_FOREACH(app->desktop->mime_types, l, mime)
|
||||||
{
|
{
|
||||||
if (!strcmp(mime, "x-directory/normal"))
|
if (!strcmp(mime, "x-directory/normal"))
|
||||||
return 0;
|
return NULL;
|
||||||
|
|
||||||
snprintf(mime_entry, 256,
|
snprintf(mime_entry, 256,
|
||||||
"<rdfq:contains>"
|
"<rdfq:contains>"
|
||||||
|
@ -63,21 +66,21 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
|
||||||
}
|
}
|
||||||
strcat(rdf_query, "</rdfq:or></rdfq:Condition>");
|
strcat(rdf_query, "</rdfq:or></rdfq:Condition>");
|
||||||
|
|
||||||
inst->condition = strdup(rdf_query);
|
p->condition = strdup(rdf_query);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evry_Item *
|
static Evry_Item *
|
||||||
_item_add(Evry_Plugin *p, char *file, char *mime, int prio)
|
_item_add(Plugin *p, char *file, char *mime, int prio)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
int folder = (!strcmp(mime, "Folder"));
|
int folder = (!strcmp(mime, "Folder"));
|
||||||
|
|
||||||
/* folders are specifically searched */
|
/* folders are specifically searched */
|
||||||
if (folder && p->begin)
|
if (folder && p->base.begin)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
filename = ecore_file_file_get(file);
|
filename = ecore_file_file_get(file);
|
||||||
|
@ -85,7 +88,7 @@ _item_add(Evry_Plugin *p, char *file, char *mime, int prio)
|
||||||
if (!filename)
|
if (!filename)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
it = evry_item_new(p, filename, NULL);
|
it = evry_item_new(&p->base, filename, NULL);
|
||||||
if (!it)
|
if (!it)
|
||||||
return NULL;
|
return NULL;
|
||||||
it->priority = prio;
|
it->priority = prio;
|
||||||
|
@ -104,27 +107,27 @@ _item_add(Evry_Plugin *p, char *file, char *mime, int prio)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cleanup(Evry_Plugin *p)
|
_cleanup(Evry_Plugin *plugin)
|
||||||
{
|
{
|
||||||
|
Plugin *p = (Plugin*) plugin;
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
Inst *inst = p->private;
|
|
||||||
|
|
||||||
inst->active = 0;
|
p->active = 0;
|
||||||
|
|
||||||
if (inst->input)
|
if (p->input)
|
||||||
eina_stringshare_del(inst->input);
|
eina_stringshare_del(p->input);
|
||||||
inst->input = NULL;
|
p->input = NULL;
|
||||||
|
|
||||||
if (inst->matched)
|
if (p->matched)
|
||||||
eina_stringshare_del(inst->matched);
|
eina_stringshare_del(p->matched);
|
||||||
inst->matched = NULL;
|
p->matched = NULL;
|
||||||
|
|
||||||
EINA_LIST_FREE(inst->items, it)
|
EINA_LIST_FREE(p->items, it)
|
||||||
evry_item_free(it);
|
evry_item_free(it);
|
||||||
|
|
||||||
if (p->items)
|
if (p->base.items)
|
||||||
eina_list_free(p->items);
|
eina_list_free(p->base.items);
|
||||||
p->items = NULL;
|
p->base.items = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -145,19 +148,18 @@ _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error)
|
||||||
char *uri, *mime, *date;
|
char *uri, *mime, *date;
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
Eina_List *items = NULL;
|
Eina_List *items = NULL;
|
||||||
Evry_Plugin *p = data;
|
Plugin *p = data;
|
||||||
Inst *inst = p->private;
|
|
||||||
|
|
||||||
if (inst->active) inst->active--;
|
if (p->active) p->active--;
|
||||||
|
|
||||||
if (dbus_error_is_set(error))
|
if (dbus_error_is_set(error))
|
||||||
{
|
{
|
||||||
_cleanup(p);
|
_cleanup(&p->base);
|
||||||
printf("Error: %s - %s\n", error->name, error->message);
|
printf("Error: %s - %s\n", error->name, error->message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inst->active) return;
|
if (p->active) return;
|
||||||
|
|
||||||
dbus_message_iter_init(msg, &array);
|
dbus_message_iter_init(msg, &array);
|
||||||
if(dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_ARRAY)
|
if(dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_ARRAY)
|
||||||
|
@ -189,63 +191,63 @@ _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->items)
|
if (p->base.items)
|
||||||
eina_list_free(p->items);
|
eina_list_free(p->base.items);
|
||||||
p->items = NULL;
|
p->base.items = NULL;
|
||||||
|
|
||||||
if (items)
|
if (items)
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
EINA_LIST_FREE(inst->items, it)
|
EINA_LIST_FREE(p->items, it)
|
||||||
evry_item_free(it);
|
evry_item_free(it);
|
||||||
|
|
||||||
items = eina_list_sort(items, eina_list_count(items), _cb_sort);
|
items = eina_list_sort(items, eina_list_count(items), _cb_sort);
|
||||||
inst->items = items;
|
p->items = items;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(inst->items, l, it)
|
EINA_LIST_FOREACH(p->items, l, it)
|
||||||
p->items = eina_list_append(p->items, it);
|
p->base.items = eina_list_append(p->base.items, it);
|
||||||
|
|
||||||
if (inst->matched)
|
if (p->matched)
|
||||||
eina_stringshare_del(inst->matched);
|
eina_stringshare_del(p->matched);
|
||||||
if (inst->input)
|
if (p->input)
|
||||||
inst->matched = eina_stringshare_add(inst->input);
|
p->matched = eina_stringshare_add(p->input);
|
||||||
else
|
else
|
||||||
inst->matched = NULL;
|
p->matched = NULL;
|
||||||
}
|
}
|
||||||
else if (inst->items && inst->input && inst->matched &&
|
else if (p->items && p->input && p->matched &&
|
||||||
(strlen(inst->input) > strlen(inst->matched)))
|
(strlen(p->input) > strlen(p->matched)))
|
||||||
{
|
{
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(inst->items, l, it)
|
EINA_LIST_FOREACH(p->items, l, it)
|
||||||
if (evry_fuzzy_match(it->label, (inst->input + strlen(inst->matched))))
|
if (evry_fuzzy_match(it->label, (p->input + strlen(p->matched))))
|
||||||
p->items = eina_list_append(p->items, it);
|
p->base.items = eina_list_append(p->base.items, it);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EINA_LIST_FREE(inst->items, it)
|
EINA_LIST_FREE(p->items, it)
|
||||||
evry_item_free(it);
|
evry_item_free(it);
|
||||||
|
|
||||||
if (inst->input)
|
if (p->input)
|
||||||
eina_stringshare_del(inst->input);
|
eina_stringshare_del(p->input);
|
||||||
inst->input = NULL;
|
p->input = NULL;
|
||||||
|
|
||||||
if (inst->matched)
|
if (p->matched)
|
||||||
eina_stringshare_del(inst->matched);
|
eina_stringshare_del(p->matched);
|
||||||
inst->matched = NULL;
|
p->matched = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
evry_plugin_async_update(p, EVRY_ASYNC_UPDATE_ADD);
|
evry_plugin_async_update(&p->base, EVRY_ASYNC_UPDATE_ADD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_fetch(Evry_Plugin *p, const char *input)
|
_fetch(Evry_Plugin *plugin, const char *input)
|
||||||
{
|
{
|
||||||
Inst *inst = p->private;
|
Plugin *p = (Plugin*) plugin;
|
||||||
DBusMessage *msg;
|
DBusMessage *msg;
|
||||||
int live_query_id = 0;
|
int live_query_id = 0;
|
||||||
int max_hits = inst->max_hits;
|
int max_hits = p->max_hits;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int sort_descending = 1;
|
int sort_descending = 1;
|
||||||
int sort_by_service = 0;
|
int sort_by_service = 0;
|
||||||
|
@ -262,35 +264,35 @@ _fetch(Evry_Plugin *p, const char *input)
|
||||||
char **_keywords = keywords;
|
char **_keywords = keywords;
|
||||||
char **_sort_fields = sort_fields;
|
char **_sort_fields = sort_fields;
|
||||||
|
|
||||||
if (inst->input)
|
if (p->input)
|
||||||
eina_stringshare_del(inst->input);
|
eina_stringshare_del(p->input);
|
||||||
inst->input = NULL;
|
p->input = NULL;
|
||||||
|
|
||||||
if (!conn)
|
if (!conn)
|
||||||
{
|
{
|
||||||
_cleanup(p);
|
_cleanup(plugin);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input && (strlen(input) > 2))
|
if (input && (strlen(input) > 2))
|
||||||
{
|
{
|
||||||
inst->input = eina_stringshare_add(input);
|
p->input = eina_stringshare_add(input);
|
||||||
search_text = malloc(sizeof(char) * strlen(input) + 1);
|
search_text = malloc(sizeof(char) * strlen(input) + 1);
|
||||||
sprintf(search_text, "%s", input);
|
sprintf(search_text, "%s", input);
|
||||||
max_hits = 100;
|
max_hits = 100;
|
||||||
}
|
}
|
||||||
else if (!input && !p->begin && p->type == type_object)
|
else if (!input && !plugin->begin && plugin->type == type_object)
|
||||||
{
|
{
|
||||||
sort_by_access = 1;
|
sort_by_access = 1;
|
||||||
search_text = "";
|
search_text = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_cleanup(p);
|
_cleanup(plugin);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inst->active++;
|
p->active++;
|
||||||
|
|
||||||
msg = dbus_message_new_method_call("org.freedesktop.Tracker",
|
msg = dbus_message_new_method_call("org.freedesktop.Tracker",
|
||||||
"/org/freedesktop/Tracker/Search",
|
"/org/freedesktop/Tracker/Search",
|
||||||
|
@ -298,13 +300,13 @@ _fetch(Evry_Plugin *p, const char *input)
|
||||||
"Query");
|
"Query");
|
||||||
dbus_message_append_args(msg,
|
dbus_message_append_args(msg,
|
||||||
DBUS_TYPE_INT32, &live_query_id,
|
DBUS_TYPE_INT32, &live_query_id,
|
||||||
DBUS_TYPE_STRING, &inst->service,
|
DBUS_TYPE_STRING, &p->service,
|
||||||
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
|
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
|
||||||
&_fields, 2,
|
&_fields, 2,
|
||||||
DBUS_TYPE_STRING, &search_text,
|
DBUS_TYPE_STRING, &search_text,
|
||||||
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
|
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
|
||||||
&_keywords, 0,
|
&_keywords, 0,
|
||||||
DBUS_TYPE_STRING, &inst->condition,
|
DBUS_TYPE_STRING, &p->condition,
|
||||||
DBUS_TYPE_BOOLEAN, &sort_by_service,
|
DBUS_TYPE_BOOLEAN, &sort_by_service,
|
||||||
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
|
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
|
||||||
&_sort_fields, sort_by_access,
|
&_sort_fields, sort_by_access,
|
||||||
|
@ -338,21 +340,26 @@ _icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
|
||||||
static void
|
static void
|
||||||
_plugin_new(const char *name, int type, char *service, int max_hits, int begin)
|
_plugin_new(const char *name, int type, char *service, int max_hits, int begin)
|
||||||
{
|
{
|
||||||
Evry_Plugin *p;
|
Plugin *p;
|
||||||
Inst *inst;
|
|
||||||
|
|
||||||
p = evry_plugin_new(name, type, "", "FILE", 0, NULL, NULL,
|
p = E_NEW(Plugin, 1);
|
||||||
(begin ? _begin : NULL), _cleanup, _fetch,
|
p->condition = "";
|
||||||
NULL, NULL, _icon_get, NULL, NULL);
|
p->service = service;
|
||||||
|
p->max_hits = max_hits;
|
||||||
|
p->active = 0;
|
||||||
|
|
||||||
|
if (!begin)
|
||||||
|
evry_plugin_new(&p->base, name, type, "", "FILE", 0, NULL, NULL,
|
||||||
|
NULL, _cleanup, _fetch,
|
||||||
|
NULL, _icon_get, NULL, NULL);
|
||||||
|
else
|
||||||
|
evry_plugin_new(&p->base, name, type, "APPLICATION", "FILE", 0, NULL, NULL,
|
||||||
|
_begin, _cleanup, _fetch,
|
||||||
|
NULL, _icon_get, NULL, NULL);
|
||||||
|
|
||||||
inst = E_NEW(Inst, 1);
|
|
||||||
inst->condition = "";
|
|
||||||
inst->service = service;
|
|
||||||
inst->max_hits = max_hits;
|
|
||||||
inst->active = 0;
|
|
||||||
p->private = inst;
|
|
||||||
evry_plugin_register(p, _prio++);
|
|
||||||
plugins = eina_list_append(plugins, p);
|
plugins = eina_list_append(plugins, p);
|
||||||
|
|
||||||
|
evry_plugin_register(&p->base, _prio++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -378,19 +385,17 @@ _init(void)
|
||||||
static void
|
static void
|
||||||
_shutdown(void)
|
_shutdown(void)
|
||||||
{
|
{
|
||||||
Inst *inst;
|
Plugin *p;
|
||||||
Evry_Plugin *p;
|
|
||||||
|
|
||||||
if (conn) e_dbus_connection_close(conn);
|
if (conn) e_dbus_connection_close(conn);
|
||||||
|
|
||||||
EINA_LIST_FREE(plugins, p)
|
EINA_LIST_FREE(plugins, p)
|
||||||
{
|
{
|
||||||
|
evry_plugin_free(&p->base, 0);
|
||||||
|
|
||||||
inst = p->private;
|
if (p->condition[0]) free(p->condition);
|
||||||
if (inst->condition[0]) free(inst->condition);
|
|
||||||
E_FREE(inst);
|
E_FREE(p);
|
||||||
|
|
||||||
evry_plugin_free(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue