forked from enlightenment/enlightenment
'everything' module: merge file-open with apps plugin
- changed api to pass input to action: e.g. open-with accepts now commands, if no item is selected SVN revision: 41146
This commit is contained in:
parent
c00f5c9b06
commit
248ba9cebc
|
@ -24,7 +24,6 @@ module_la_SOURCES = e_mod_main.c \
|
||||||
evry.h \
|
evry.h \
|
||||||
evry_plug_config.c \
|
evry_plug_config.c \
|
||||||
evry_plug_apps.c \
|
evry_plug_apps.c \
|
||||||
evry_plug_file_open.c \
|
|
||||||
evry_plug_tracker.c \
|
evry_plug_tracker.c \
|
||||||
evry_plug_border.c \
|
evry_plug_border.c \
|
||||||
evry_plug_dir_browse.c
|
evry_plug_dir_browse.c
|
||||||
|
|
|
@ -74,7 +74,6 @@ e_modapi_init(E_Module *m)
|
||||||
evry_plug_apps_init();
|
evry_plug_apps_init();
|
||||||
evry_plug_config_init();
|
evry_plug_config_init();
|
||||||
evry_plug_dir_browse_init();
|
evry_plug_dir_browse_init();
|
||||||
evry_plug_file_open_init();
|
|
||||||
evry_plug_tracker_init();
|
evry_plug_tracker_init();
|
||||||
|
|
||||||
/* add module supplied action */
|
/* add module supplied action */
|
||||||
|
@ -114,7 +113,6 @@ e_modapi_shutdown(E_Module *m)
|
||||||
evry_plug_apps_shutdown();
|
evry_plug_apps_shutdown();
|
||||||
evry_plug_config_shutdown();
|
evry_plug_config_shutdown();
|
||||||
evry_plug_dir_browse_shutdown();
|
evry_plug_dir_browse_shutdown();
|
||||||
evry_plug_file_open_shutdown();
|
|
||||||
evry_plug_tracker_shutdown();
|
evry_plug_tracker_shutdown();
|
||||||
|
|
||||||
evry_shutdown();
|
evry_shutdown();
|
||||||
|
|
|
@ -60,9 +60,6 @@ EAPI int evry_plug_tracker_shutdown(void);
|
||||||
EAPI int evry_plug_dir_browse_init(void);
|
EAPI int evry_plug_dir_browse_init(void);
|
||||||
EAPI int evry_plug_dir_browse_shutdown(void);
|
EAPI int evry_plug_dir_browse_shutdown(void);
|
||||||
|
|
||||||
EAPI int evry_plug_file_open_init(void);
|
|
||||||
EAPI int evry_plug_file_open_shutdown(void);
|
|
||||||
|
|
||||||
extern Config *evry_conf;
|
extern Config *evry_conf;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,9 @@ struct _Evry_State
|
||||||
Evry_Item *sel_item;
|
Evry_Item *sel_item;
|
||||||
/* Eina_List *sel_items; */
|
/* Eina_List *sel_items; */
|
||||||
char *input;
|
char *input;
|
||||||
|
|
||||||
|
Eina_Bool initial;
|
||||||
|
Eina_Bool get_parameter; /* TODO better name !*/
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _evry_cb_key_down(void *data, int type, void *event);
|
static int _evry_cb_key_down(void *data, int type, void *event);
|
||||||
|
@ -48,6 +51,8 @@ static int _evry_scroll_timer(void *data);
|
||||||
static int _evry_push_state(void);
|
static int _evry_push_state(void);
|
||||||
static int _evry_pop_state(void);
|
static int _evry_pop_state(void);
|
||||||
static void _evry_plugin_selector_append(Evry_Plugin *p);
|
static void _evry_plugin_selector_append(Evry_Plugin *p);
|
||||||
|
static int _evry_cb_plugin_sort(const void *data1, const void *data2);
|
||||||
|
|
||||||
|
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
static E_Popup *popup = NULL;
|
static E_Popup *popup = NULL;
|
||||||
|
@ -273,6 +278,15 @@ evry_plugin_async_update(Evry_Plugin *plugin, int state)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* local subsystem functions */
|
/* local subsystem functions */
|
||||||
|
static int
|
||||||
|
_evry_cb_plugin_sort(const void *data1, const void *data2)
|
||||||
|
{
|
||||||
|
const Evry_Plugin *p1 = data1;
|
||||||
|
const Evry_Plugin *p2 = data2;
|
||||||
|
return p1->class->prio - p2->class->prio;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_evry_push_state(void)
|
_evry_push_state(void)
|
||||||
{
|
{
|
||||||
|
@ -281,7 +295,7 @@ _evry_push_state(void)
|
||||||
Evry_Plugin_Class *pc;
|
Evry_Plugin_Class *pc;
|
||||||
const char *expect_type = "NONE";
|
const char *expect_type = "NONE";
|
||||||
Evry_Plugin *p;
|
Evry_Plugin *p;
|
||||||
|
|
||||||
s = cur_state;
|
s = cur_state;
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
|
@ -310,9 +324,11 @@ _evry_push_state(void)
|
||||||
list = eina_list_append(list, p);
|
list = eina_list_append(list, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!list) return 0;
|
if (!list) return 0;
|
||||||
|
|
||||||
|
list = eina_list_sort(list, eina_list_count(list), _evry_cb_plugin_sort);
|
||||||
|
|
||||||
_evry_list_clear();
|
_evry_list_clear();
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
|
@ -330,6 +346,7 @@ _evry_push_state(void)
|
||||||
s->plugins = list;
|
s->plugins = list;
|
||||||
s->cur_plugins = NULL;
|
s->cur_plugins = NULL;
|
||||||
s->sel_item = NULL;
|
s->sel_item = NULL;
|
||||||
|
s->initial = (cur_state ? 0 : 1);
|
||||||
cur_state = s;
|
cur_state = s;
|
||||||
stack = eina_list_prepend(stack, s);
|
stack = eina_list_prepend(stack, s);
|
||||||
|
|
||||||
|
@ -627,19 +644,18 @@ static void
|
||||||
_evry_action(int finished)
|
_evry_action(int finished)
|
||||||
{
|
{
|
||||||
Evry_State *s = cur_state;
|
Evry_State *s = cur_state;
|
||||||
|
|
||||||
if (s->cur_plugin && s->sel_item)
|
if (s->cur_plugin && (s->sel_item || s->input))
|
||||||
{
|
{
|
||||||
if (!s->cur_plugin->action ||
|
if (!s->cur_plugin->action ||
|
||||||
!s->cur_plugin->action(s->cur_plugin, s->sel_item))
|
!s->cur_plugin->action(s->cur_plugin, s->sel_item, s->input))
|
||||||
{
|
{
|
||||||
/* _evry_action_select(); */
|
|
||||||
_evry_push_state();
|
_evry_push_state();
|
||||||
finished = 0;
|
finished = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (s->initial)
|
||||||
e_exec(popup->zone, NULL, s->input, NULL, "everything");
|
e_exec(popup->zone, NULL, s->input, NULL, NULL /* "everything" */);
|
||||||
|
|
||||||
if (finished)
|
if (finished)
|
||||||
evry_hide();
|
evry_hide();
|
||||||
|
@ -756,7 +772,7 @@ _evry_matches_update(void)
|
||||||
else
|
else
|
||||||
items = p->fetch(p, s->input);
|
items = p->fetch(p, s->input);
|
||||||
|
|
||||||
if (items && eina_list_count(p->items) > 0)
|
if (!s->initial || (items && eina_list_count(p->items) > 0))
|
||||||
{
|
{
|
||||||
s->cur_plugins = eina_list_append(s->cur_plugins, p);
|
s->cur_plugins = eina_list_append(s->cur_plugins, p);
|
||||||
_evry_plugin_selector_append(p);
|
_evry_plugin_selector_append(p);
|
||||||
|
@ -1000,12 +1016,16 @@ _evry_plugin_selector_append(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
Evas_Coord mw = 0, mh = 0;
|
Evas_Coord mw = 0, mh = 0;
|
||||||
|
char buf[64];
|
||||||
|
|
||||||
o = edje_object_add(popup->evas);
|
o = edje_object_add(popup->evas);
|
||||||
|
/* TODO move this to everything theme group !*/
|
||||||
e_theme_edje_object_set(o, "base/theme/widgets",
|
e_theme_edje_object_set(o, "base/theme/widgets",
|
||||||
"e/widgets/toolbar/item");
|
"e/widgets/toolbar/item");
|
||||||
|
|
||||||
edje_object_part_text_set(o, "e.text.label", p->class->name);
|
snprintf(buf, 64, "%s (%d)", p->class->name, eina_list_count(p->items));
|
||||||
|
|
||||||
|
edje_object_part_text_set(o, "e.text.label", buf);
|
||||||
|
|
||||||
edje_object_size_min_calc(o, &mw, &mh);
|
edje_object_size_min_calc(o, &mw, &mh);
|
||||||
e_box_pack_end(o_selector, o);
|
e_box_pack_end(o_selector, o);
|
||||||
|
@ -1021,3 +1041,5 @@ _evry_plugin_selector_append(Evry_Plugin *p)
|
||||||
|
|
||||||
p->tab = o;
|
p->tab = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,9 @@ struct _Evry_Plugin_Class
|
||||||
const char *type_in;
|
const char *type_in;
|
||||||
const char *type_out;
|
const char *type_out;
|
||||||
|
|
||||||
|
/* TODO option */
|
||||||
|
int prio;
|
||||||
|
|
||||||
/* sync/async ?*/
|
/* sync/async ?*/
|
||||||
unsigned char async_query : 1;
|
unsigned char async_query : 1;
|
||||||
|
|
||||||
|
@ -80,11 +83,11 @@ struct _Evry_Plugin
|
||||||
int (*begin) (Evry_Plugin *p, Evry_Item *item);
|
int (*begin) (Evry_Plugin *p, Evry_Item *item);
|
||||||
|
|
||||||
/* get candidates matching string, fills 'candidates' list */
|
/* get candidates matching string, fills 'candidates' list */
|
||||||
int (*fetch) (Evry_Plugin *p, char *string);
|
int (*fetch) (Evry_Plugin *p, const char *input);
|
||||||
|
|
||||||
/* run action with a given candidate - TODO register actions per
|
/* run action with a given candidate - TODO register actions per
|
||||||
candidate type */
|
candidate type */
|
||||||
int (*action) (Evry_Plugin *p, Evry_Item *item);
|
int (*action) (Evry_Plugin *p, Evry_Item *item, const char *input);
|
||||||
|
|
||||||
/* run before new query and when hiding 'everything' */
|
/* run before new query and when hiding 'everything' */
|
||||||
void (*cleanup) (Evry_Plugin *p);
|
void (*cleanup) (Evry_Plugin *p);
|
||||||
|
|
|
@ -6,18 +6,24 @@ typedef struct _Inst Inst;
|
||||||
struct _Inst
|
struct _Inst
|
||||||
{
|
{
|
||||||
Eina_Hash *added;
|
Eina_Hash *added;
|
||||||
|
|
||||||
|
Eina_List *apps;
|
||||||
|
Evry_Item *candidate;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Evry_Plugin *_plug_apps_new();
|
static Evry_Plugin *_plug_new();
|
||||||
static void _plug_apps_free(Evry_Plugin *p);
|
static Evry_Plugin *_plug_new2();
|
||||||
static int _plug_apps_fetch(Evry_Plugin *p, char *string);
|
static void _plug_free(Evry_Plugin *p);
|
||||||
static int _plug_apps_action(Evry_Plugin *p, Evry_Item *item);
|
static int _begin(Evry_Plugin *p, Evry_Item *item);
|
||||||
static void _plug_apps_cleanup(Evry_Plugin *p);
|
static int _fetch(Evry_Plugin *p, const char *input);
|
||||||
static void _plug_apps_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio);
|
static int _action(Evry_Plugin *p, Evry_Item *item, const char *input);
|
||||||
static int _plug_apps_cb_sort(const void *data1, const void *data2);
|
static void _cleanup(Evry_Plugin *p);
|
||||||
static void _plug_apps_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
static void _item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio);
|
||||||
|
static int _cb_sort(const void *data1, const void *data2);
|
||||||
|
static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
||||||
|
|
||||||
static Evry_Plugin_Class class;
|
static Evry_Plugin_Class class;
|
||||||
|
static Evry_Plugin_Class class2;
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
evry_plug_apps_init(void)
|
evry_plug_apps_init(void)
|
||||||
|
@ -26,10 +32,20 @@ evry_plug_apps_init(void)
|
||||||
class.type_in = "NONE";
|
class.type_in = "NONE";
|
||||||
class.type_out = "APPLICATION";
|
class.type_out = "APPLICATION";
|
||||||
class.need_query = 0;
|
class.need_query = 0;
|
||||||
class.new = &_plug_apps_new;
|
class.new = &_plug_new;
|
||||||
class.free = &_plug_apps_free;
|
class.free = &_plug_free;
|
||||||
|
class.prio = 1;
|
||||||
evry_plugin_register(&class);
|
evry_plugin_register(&class);
|
||||||
|
|
||||||
|
class2.name = "Open With..";
|
||||||
|
class2.type_in = "FILE";
|
||||||
|
class2.type_out = "APPLICATION";
|
||||||
|
class2.need_query = 0;
|
||||||
|
class2.new = &_plug_new2;
|
||||||
|
class2.free = &_plug_free;
|
||||||
|
class2.prio = 3;
|
||||||
|
evry_plugin_register(&class2);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,19 +53,39 @@ EAPI int
|
||||||
evry_plug_apps_shutdown(void)
|
evry_plug_apps_shutdown(void)
|
||||||
{
|
{
|
||||||
evry_plugin_unregister(&class);
|
evry_plugin_unregister(&class);
|
||||||
|
evry_plugin_unregister(&class2);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evry_Plugin *
|
static Evry_Plugin *
|
||||||
_plug_apps_new()
|
_plug_new()
|
||||||
{
|
{
|
||||||
Evry_Plugin *p = E_NEW(Evry_Plugin, 1);
|
Evry_Plugin *p = E_NEW(Evry_Plugin, 1);
|
||||||
p->class = &class;
|
p->class = &class;
|
||||||
p->fetch = &_plug_apps_fetch;
|
p->fetch = &_fetch;
|
||||||
p->action = &_plug_apps_action;
|
p->action = &_action;
|
||||||
p->cleanup = &_plug_apps_cleanup;
|
p->cleanup = &_cleanup;
|
||||||
p->icon_get = &_plug_apps_item_icon_get;
|
p->icon_get = &_item_icon_get;
|
||||||
|
p->items = NULL;
|
||||||
|
|
||||||
|
Inst *inst = E_NEW(Inst, 1);
|
||||||
|
inst->added = NULL;
|
||||||
|
p->priv = inst;
|
||||||
|
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evry_Plugin *
|
||||||
|
_plug_new2()
|
||||||
|
{
|
||||||
|
Evry_Plugin *p = E_NEW(Evry_Plugin, 1);
|
||||||
|
p->class = &class2;
|
||||||
|
p->begin = &_begin;
|
||||||
|
p->fetch = &_fetch;
|
||||||
|
p->action = &_action;
|
||||||
|
p->cleanup = &_cleanup;
|
||||||
|
p->icon_get = &_item_icon_get;
|
||||||
p->items = NULL;
|
p->items = NULL;
|
||||||
|
|
||||||
Inst *inst = E_NEW(Inst, 1);
|
Inst *inst = E_NEW(Inst, 1);
|
||||||
|
@ -60,35 +96,110 @@ _plug_apps_new()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_apps_free(Evry_Plugin *p)
|
_plug_free(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
Inst *inst = p->priv;
|
Inst *inst = p->priv;
|
||||||
|
|
||||||
_plug_apps_cleanup(p);
|
_cleanup(p);
|
||||||
|
if (inst->apps) eina_list_free(inst->apps);
|
||||||
|
|
||||||
E_FREE(inst);
|
E_FREE(inst);
|
||||||
E_FREE(p);
|
E_FREE(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_plug_apps_action(Evry_Plugin *p, Evry_Item *item)
|
_begin(Evry_Plugin *p, Evry_Item *it)
|
||||||
{
|
{
|
||||||
E_Zone *zone;
|
Inst *inst;
|
||||||
Evry_App *app;
|
const char *mime;
|
||||||
|
|
||||||
|
_cleanup(p);
|
||||||
|
|
||||||
app = item->data[0];
|
if (!it || !it->uri) return 0;
|
||||||
zone = e_util_zone_current_get(e_manager_current_get());
|
inst = p->priv;
|
||||||
|
inst->candidate = it;
|
||||||
if (app->desktop)
|
|
||||||
e_exec(zone, app->desktop, NULL, NULL, "everything");
|
if (!it->mime)
|
||||||
|
mime = efreet_mime_type_get(it->uri);
|
||||||
else
|
else
|
||||||
e_exec(zone, NULL, app->file, NULL, "everything");
|
mime = it->mime;
|
||||||
|
|
||||||
|
if (!mime) return 0;
|
||||||
|
|
||||||
|
/* if (!strcmp(mime, "Folder"))
|
||||||
|
* {
|
||||||
|
* apps =
|
||||||
|
* }
|
||||||
|
* else */
|
||||||
|
|
||||||
|
inst->apps = efreet_util_desktop_mime_list(mime);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
_action(Evry_Plugin *p, Evry_Item *it, const char *input)
|
||||||
|
{
|
||||||
|
E_Zone *zone;
|
||||||
|
Evry_App *app;
|
||||||
|
Efreet_Desktop *desktop = NULL;
|
||||||
|
Eina_List *files = NULL;
|
||||||
|
Inst *inst = p->priv;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
app = it->data[0];
|
||||||
|
zone = e_util_zone_current_get(e_manager_current_get());
|
||||||
|
|
||||||
|
if (inst->candidate)
|
||||||
|
files = eina_list_append(files, inst->candidate->uri);
|
||||||
|
|
||||||
|
if (app->desktop)
|
||||||
|
{
|
||||||
|
desktop = app->desktop;
|
||||||
|
}
|
||||||
|
else if (input || app->file)
|
||||||
|
{
|
||||||
|
if (app->file)
|
||||||
|
input = app->file;
|
||||||
|
|
||||||
|
desktop = efreet_desktop_empty_new("");
|
||||||
|
if (strchr(input, '%'))
|
||||||
|
{
|
||||||
|
desktop->exec = strdup(input);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int len = strlen(input) + 4;
|
||||||
|
desktop->exec = malloc(len);
|
||||||
|
if (desktop->exec)
|
||||||
|
snprintf(desktop->exec, len, "%s %%U", input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desktop)
|
||||||
|
{
|
||||||
|
e_exec(zone, desktop, NULL, files, NULL /*"everything"*/);
|
||||||
|
|
||||||
|
if (!it)
|
||||||
|
efreet_desktop_free(desktop);
|
||||||
|
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
eina_list_free(files);
|
||||||
|
|
||||||
|
|
||||||
|
/* if (app->desktop)
|
||||||
|
* e_exec(zone, app->desktop, NULL, NULL, "everything");
|
||||||
|
* else
|
||||||
|
* e_exec(zone, NULL, app->file, NULL, "everything"); */
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_apps_cleanup(Evry_Plugin *p)
|
_cleanup(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
Evry_App *app;
|
Evry_App *app;
|
||||||
|
@ -104,56 +215,92 @@ _plug_apps_cleanup(Evry_Plugin *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_plug_apps_fetch(Evry_Plugin *p, char *string)
|
_fetch(Evry_Plugin *p, const char *input)
|
||||||
{
|
{
|
||||||
char buf[4096];
|
Eina_List *l;
|
||||||
Eina_List *list;
|
|
||||||
Efreet_Desktop *desktop;
|
Efreet_Desktop *desktop;
|
||||||
char *file;
|
char *file;
|
||||||
|
char match1[4096];
|
||||||
|
char match2[4096];
|
||||||
|
|
||||||
Inst *inst = p->priv;
|
Inst *inst = p->priv;
|
||||||
|
|
||||||
_plug_apps_cleanup(p);
|
_cleanup(p);
|
||||||
|
|
||||||
if (string)
|
if (inst->apps)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%s*", string);
|
if (!input)
|
||||||
list = efreet_util_desktop_exec_glob_list(buf);
|
{
|
||||||
EINA_LIST_FREE(list, desktop)
|
EINA_LIST_FOREACH(inst->apps, l, desktop)
|
||||||
_plug_apps_item_add(p, desktop, NULL, 1);
|
_item_add(p, desktop, NULL, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
snprintf(match1, sizeof(match1), "%s*", input);
|
||||||
|
snprintf(match2, sizeof(match2), "*%s*", input);
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(inst->apps, l, desktop)
|
||||||
|
{
|
||||||
|
if (desktop->name)
|
||||||
|
{
|
||||||
|
if (e_util_glob_case_match(desktop->name, match1))
|
||||||
|
_item_add(p, desktop, NULL, 1);
|
||||||
|
else if (e_util_glob_case_match(desktop->name, match2))
|
||||||
|
_item_add(p, desktop, NULL, 2);
|
||||||
|
else if (desktop->comment)
|
||||||
|
{
|
||||||
|
if (e_util_glob_case_match(desktop->comment, match1))
|
||||||
|
_item_add(p, desktop, NULL, 3);
|
||||||
|
else if (e_util_glob_case_match(desktop->comment, match2))
|
||||||
|
_item_add(p, desktop, NULL, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "*%s*", string);
|
|
||||||
list = efreet_util_desktop_name_glob_list(buf);
|
if (!p->items && input)
|
||||||
EINA_LIST_FREE(list, desktop)
|
{
|
||||||
_plug_apps_item_add(p, desktop, NULL, 2);
|
snprintf(match1, sizeof(match1), "%s*", input);
|
||||||
|
l = efreet_util_desktop_exec_glob_list(match1);
|
||||||
|
EINA_LIST_FREE(l, desktop)
|
||||||
|
_item_add(p, desktop, NULL, 1);
|
||||||
|
|
||||||
|
snprintf(match1, sizeof(match1), "*%s*", input);
|
||||||
|
l = efreet_util_desktop_name_glob_list(match1);
|
||||||
|
EINA_LIST_FREE(l, desktop)
|
||||||
|
_item_add(p, desktop, NULL, 2);
|
||||||
|
|
||||||
// TODO make these optional/configurable
|
// TODO make these optional/configurable
|
||||||
snprintf(buf, sizeof(buf), "*%s*", string);
|
l = efreet_util_desktop_generic_name_glob_list(match1);
|
||||||
list = efreet_util_desktop_generic_name_glob_list(buf);
|
EINA_LIST_FREE(l, desktop)
|
||||||
EINA_LIST_FREE(list, desktop)
|
_item_add(p, desktop, NULL, 3);
|
||||||
_plug_apps_item_add(p, desktop, NULL, 3);
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "*%s*", string);
|
l = efreet_util_desktop_comment_glob_list(match1);
|
||||||
list = efreet_util_desktop_comment_glob_list(buf);
|
EINA_LIST_FREE(l, desktop)
|
||||||
EINA_LIST_FREE(list, desktop)
|
_item_add(p, desktop, NULL, 3);
|
||||||
_plug_apps_item_add(p, desktop, NULL, 3);
|
|
||||||
}
|
}
|
||||||
else
|
else if (!p->items)
|
||||||
{
|
{
|
||||||
// TODO option for popular/recent
|
// TODO option for popular/recent
|
||||||
list = e_exehist_list_get();
|
l = e_exehist_list_get();
|
||||||
EINA_LIST_FREE(list, file)
|
EINA_LIST_FREE(l, file)
|
||||||
_plug_apps_item_add(p, NULL, file, 1);
|
_item_add(p, NULL, file, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inst->added)
|
if (inst->added)
|
||||||
{
|
{
|
||||||
eina_hash_free(inst->added);
|
eina_hash_free(inst->added);
|
||||||
inst->added = NULL;
|
inst->added = NULL;
|
||||||
|
}
|
||||||
if (string)
|
|
||||||
|
if (p->items)
|
||||||
|
{
|
||||||
|
if (input)
|
||||||
p->items = eina_list_sort(p->items,
|
p->items = eina_list_sort(p->items,
|
||||||
eina_list_count(p->items),
|
eina_list_count(p->items),
|
||||||
_plug_apps_cb_sort);
|
_cb_sort);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,27 +308,34 @@ _plug_apps_fetch(Evry_Plugin *p, char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_apps_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio)
|
_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int prio)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
Evry_App *app;
|
Evry_App *app;
|
||||||
Inst *inst = p->priv;
|
Inst *inst = p->priv;
|
||||||
|
Efreet_Desktop *desktop2;
|
||||||
|
|
||||||
if (desktop)
|
if (desktop)
|
||||||
file = ecore_file_app_exe_get(desktop->exec);
|
file = ecore_file_app_exe_get(desktop->exec);
|
||||||
|
|
||||||
if (!file) return;
|
if (!file) return;
|
||||||
|
|
||||||
if (eina_hash_find(inst->added, file))
|
if (desktop)
|
||||||
{
|
{
|
||||||
if (desktop) free(file);
|
if ((desktop2 = eina_hash_find(inst->added, file)))
|
||||||
return;
|
{
|
||||||
|
if (desktop == desktop2)
|
||||||
|
{
|
||||||
|
free(file);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inst->added)
|
if (!inst->added)
|
||||||
inst->added = eina_hash_string_superfast_new(NULL);
|
inst->added = eina_hash_string_superfast_new(NULL);
|
||||||
|
|
||||||
eina_hash_add(inst->added, file, file);
|
eina_hash_add(inst->added, file, desktop);
|
||||||
|
|
||||||
if (desktop)
|
if (desktop)
|
||||||
{
|
{
|
||||||
|
@ -210,7 +364,7 @@ _plug_apps_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, char *file, int pri
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_apps_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
||||||
{
|
{
|
||||||
Evry_App *app = it->data[0];
|
Evry_App *app = it->data[0];
|
||||||
|
|
||||||
|
@ -219,7 +373,7 @@ _plug_apps_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_plug_apps_cb_sort(const void *data1, const void *data2)
|
_cb_sort(const void *data1, const void *data2)
|
||||||
{
|
{
|
||||||
const Evry_Item *it1, *it2;
|
const Evry_Item *it1, *it2;
|
||||||
Evry_App *app1, *app2;
|
Evry_App *app1, *app2;
|
||||||
|
|
|
@ -10,8 +10,8 @@ struct _Inst
|
||||||
|
|
||||||
static Evry_Plugin * _src_border_new(void);
|
static Evry_Plugin * _src_border_new(void);
|
||||||
static void _src_border_free(Evry_Plugin *p);
|
static void _src_border_free(Evry_Plugin *p);
|
||||||
static int _src_border_fetch(Evry_Plugin *p, char *string);
|
static int _src_border_fetch(Evry_Plugin *p, const char *input);
|
||||||
static int _src_border_action(Evry_Plugin *p, Evry_Item *item);
|
static int _src_border_action(Evry_Plugin *p, Evry_Item *item, const char *input);
|
||||||
static void _src_border_cleanup(Evry_Plugin *p);
|
static void _src_border_cleanup(Evry_Plugin *p);
|
||||||
static void _src_border_item_add(Evry_Plugin *p, E_Border *bd, int prio);
|
static void _src_border_item_add(Evry_Plugin *p, E_Border *bd, int prio);
|
||||||
static int _src_border_cb_sort(const void *data1, const void *data2);
|
static int _src_border_cb_sort(const void *data1, const void *data2);
|
||||||
|
@ -20,8 +20,8 @@ static void _src_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
||||||
static Evry_Plugin * _act_border_new(void);
|
static Evry_Plugin * _act_border_new(void);
|
||||||
static void _act_border_free(Evry_Plugin *p);
|
static void _act_border_free(Evry_Plugin *p);
|
||||||
static int _act_border_begin(Evry_Plugin *p, Evry_Item *item);
|
static int _act_border_begin(Evry_Plugin *p, Evry_Item *item);
|
||||||
static int _act_border_fetch(Evry_Plugin *p, char *string);
|
static int _act_border_fetch(Evry_Plugin *p, const char *input);
|
||||||
static int _act_border_action(Evry_Plugin *p, Evry_Item *item);
|
static int _act_border_action(Evry_Plugin *p, Evry_Item *item, const char *input);
|
||||||
static void _act_border_cleanup(Evry_Plugin *p);
|
static void _act_border_cleanup(Evry_Plugin *p);
|
||||||
static void _act_border_item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon);
|
static void _act_border_item_add(Evry_Plugin *p, const char *label, void (*action_cb) (E_Border *bd), const char *icon);
|
||||||
static void _act_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
static void _act_border_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
||||||
|
@ -37,6 +37,7 @@ evry_plug_border_init(void)
|
||||||
source.type_in = "NONE";
|
source.type_in = "NONE";
|
||||||
source.type_out = "BORDER";
|
source.type_out = "BORDER";
|
||||||
source.need_query = 0;
|
source.need_query = 0;
|
||||||
|
source.prio = 0;
|
||||||
source.new = &_src_border_new;
|
source.new = &_src_border_new;
|
||||||
source.free = &_src_border_free;
|
source.free = &_src_border_free;
|
||||||
evry_plugin_register(&source);
|
evry_plugin_register(&source);
|
||||||
|
@ -45,6 +46,7 @@ evry_plug_border_init(void)
|
||||||
action.type_in = "BORDER";
|
action.type_in = "BORDER";
|
||||||
action.type_out = "NONE";
|
action.type_out = "NONE";
|
||||||
action.need_query = 0;
|
action.need_query = 0;
|
||||||
|
action.prio = 0;
|
||||||
action.new = &_act_border_new;
|
action.new = &_act_border_new;
|
||||||
action.free = &_act_border_free;
|
action.free = &_act_border_free;
|
||||||
evry_plugin_register(&action);
|
evry_plugin_register(&action);
|
||||||
|
@ -86,12 +88,14 @@ _src_border_free(Evry_Plugin *p)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_src_border_action(Evry_Plugin *p, Evry_Item *item)
|
_src_border_action(Evry_Plugin *p, Evry_Item *it, const char *input)
|
||||||
{
|
{
|
||||||
E_Border *bd;
|
E_Border *bd;
|
||||||
E_Zone *zone;
|
E_Zone *zone;
|
||||||
|
|
||||||
|
if (!it) return 0;
|
||||||
|
|
||||||
bd = (E_Border *)item->data[0];
|
bd = (E_Border *)it->data[0];
|
||||||
zone = e_util_zone_current_get(e_manager_current_get());
|
zone = e_util_zone_current_get(e_manager_current_get());
|
||||||
|
|
||||||
if (bd->desk != (e_desk_current_get(zone)))
|
if (bd->desk != (e_desk_current_get(zone)))
|
||||||
|
@ -126,7 +130,7 @@ _src_border_cleanup(Evry_Plugin *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_src_border_fetch(Evry_Plugin *p, char *string)
|
_src_border_fetch(Evry_Plugin *p, const char *input)
|
||||||
{
|
{
|
||||||
E_Manager *man;
|
E_Manager *man;
|
||||||
E_Zone *zone;
|
E_Zone *zone;
|
||||||
|
@ -142,10 +146,10 @@ _src_border_fetch(Evry_Plugin *p, char *string)
|
||||||
man = e_manager_current_get();
|
man = e_manager_current_get();
|
||||||
zone = e_util_zone_current_get(man);
|
zone = e_util_zone_current_get(man);
|
||||||
|
|
||||||
if (string)
|
if (input)
|
||||||
{
|
{
|
||||||
snprintf(match1, sizeof(match1), "%s*", string);
|
snprintf(match1, sizeof(match1), "%s*", input);
|
||||||
snprintf(match2, sizeof(match2), "*%s*", string);
|
snprintf(match2, sizeof(match2), "*%s*", input);
|
||||||
}
|
}
|
||||||
|
|
||||||
bl = e_container_border_list_first(e_container_current_get(man));
|
bl = e_container_border_list_first(e_container_current_get(man));
|
||||||
|
@ -153,7 +157,7 @@ _src_border_fetch(Evry_Plugin *p, char *string)
|
||||||
{
|
{
|
||||||
if (zone == bd->zone)
|
if (zone == bd->zone)
|
||||||
{
|
{
|
||||||
if (!string)
|
if (!input)
|
||||||
_src_border_item_add(p, bd, 1);
|
_src_border_item_add(p, bd, 1);
|
||||||
else if (bd->client.icccm.name &&
|
else if (bd->client.icccm.name &&
|
||||||
e_util_glob_case_match(bd->client.icccm.name, match1))
|
e_util_glob_case_match(bd->client.icccm.name, match1))
|
||||||
|
@ -273,7 +277,7 @@ _act_border_begin(Evry_Plugin *p, Evry_Item *item)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_act_border_fetch(Evry_Plugin *p, char *string)
|
_act_border_fetch(Evry_Plugin *p, const char *input)
|
||||||
{
|
{
|
||||||
_act_border_cleanup(p);
|
_act_border_cleanup(p);
|
||||||
|
|
||||||
|
@ -286,7 +290,7 @@ _act_border_fetch(Evry_Plugin *p, char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_act_border_action(Evry_Plugin *p, Evry_Item *item)
|
_act_border_action(Evry_Plugin *p, Evry_Item *item, const char *input)
|
||||||
{
|
{
|
||||||
Inst *inst = p->priv;
|
Inst *inst = p->priv;
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
#include "e_mod_main.h"
|
#include "e_mod_main.h"
|
||||||
|
|
||||||
static Evry_Plugin_Class class;
|
static Evry_Plugin_Class class;
|
||||||
static Evry_Plugin *_plug_config_new();
|
static Evry_Plugin *_plug_new();
|
||||||
static void _plug_config_free(Evry_Plugin *p);
|
static void _plug_free(Evry_Plugin *p);
|
||||||
static int _plug_config_fetch(Evry_Plugin *p, char *string);
|
static int _fetch(Evry_Plugin *p, const char *input);
|
||||||
static int _plug_config_action(Evry_Plugin *p, Evry_Item *item);
|
static int _action(Evry_Plugin *p, Evry_Item *item, const char *input);
|
||||||
static void _plug_config_cleanup(Evry_Plugin *p);
|
static void _cleanup(Evry_Plugin *p);
|
||||||
static void _plug_config_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio);
|
static void _item_add(Evry_Plugin *p, E_Configure_It *eci, int prio);
|
||||||
static void _plug_config_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
||||||
static int _plug_config_cb_sort(const void *data1, const void *data2);
|
static int _cb_sort(const void *data1, const void *data2);
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
evry_plug_config_init(void)
|
evry_plug_config_init(void)
|
||||||
|
@ -18,8 +18,8 @@ evry_plug_config_init(void)
|
||||||
class.type_in = "NONE";
|
class.type_in = "NONE";
|
||||||
class.type_out = "NONE";
|
class.type_out = "NONE";
|
||||||
class.instances = NULL;
|
class.instances = NULL;
|
||||||
class.new = &_plug_config_new;
|
class.new = &_plug_new;
|
||||||
class.free = &_plug_config_free;
|
class.free = &_plug_free;
|
||||||
evry_plugin_register(&class);
|
evry_plugin_register(&class);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -33,27 +33,27 @@ evry_plug_config_shutdown(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evry_Plugin *
|
static Evry_Plugin *
|
||||||
_plug_config_new()
|
_plug_new()
|
||||||
{
|
{
|
||||||
Evry_Plugin *p = E_NEW(Evry_Plugin, 1);
|
Evry_Plugin *p = E_NEW(Evry_Plugin, 1);
|
||||||
p->class = &class;
|
p->class = &class;
|
||||||
p->fetch = &_plug_config_fetch;
|
p->fetch = &_fetch;
|
||||||
p->action = &_plug_config_action;
|
p->action = &_action;
|
||||||
p->cleanup = &_plug_config_cleanup;
|
p->cleanup = &_cleanup;
|
||||||
p->icon_get = &_plug_config_item_icon_get;
|
p->icon_get = &_item_icon_get;
|
||||||
p->items = NULL;
|
p->items = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_config_free(Evry_Plugin *p)
|
_plug_free(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
_plug_config_cleanup(p);
|
_cleanup(p);
|
||||||
E_FREE(p);
|
E_FREE(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_plug_config_action(Evry_Plugin *p, Evry_Item *item)
|
_action(Evry_Plugin *p, Evry_Item *it, const char *input)
|
||||||
{
|
{
|
||||||
E_Configure_It *eci, *eci2;
|
E_Configure_It *eci, *eci2;
|
||||||
E_Container *con;
|
E_Container *con;
|
||||||
|
@ -61,8 +61,10 @@ _plug_config_action(Evry_Plugin *p, Evry_Item *item)
|
||||||
Eina_List *l, *ll;
|
Eina_List *l, *ll;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
|
if (!it) return 0;
|
||||||
|
|
||||||
eci = item->data[0];
|
eci = it->data[0];
|
||||||
con = e_container_current_get(e_manager_current_get());
|
con = e_container_current_get(e_manager_current_get());
|
||||||
|
|
||||||
for (l = e_configure_registry; l && !found; l = l->next)
|
for (l = e_configure_registry; l && !found; l = l->next)
|
||||||
|
@ -88,7 +90,7 @@ _plug_config_action(Evry_Plugin *p, Evry_Item *item)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_config_cleanup(Evry_Plugin *p)
|
_cleanup(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
|
|
||||||
|
@ -101,7 +103,7 @@ _plug_config_cleanup(Evry_Plugin *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_plug_config_fetch(Evry_Plugin *p, char *string)
|
_fetch(Evry_Plugin *p, const char *input)
|
||||||
{
|
{
|
||||||
E_Manager *man;
|
E_Manager *man;
|
||||||
E_Zone *zone;
|
E_Zone *zone;
|
||||||
|
@ -112,10 +114,10 @@ _plug_config_fetch(Evry_Plugin *p, char *string)
|
||||||
E_Configure_Cat *ecat;
|
E_Configure_Cat *ecat;
|
||||||
E_Configure_It *eci;
|
E_Configure_It *eci;
|
||||||
|
|
||||||
_plug_config_cleanup(p);
|
_cleanup(p);
|
||||||
|
|
||||||
snprintf(match1, sizeof(match1), "%s*", string);
|
snprintf(match1, sizeof(match1), "%s*", input);
|
||||||
snprintf(match2, sizeof(match2), "*%s*", string);
|
snprintf(match2, sizeof(match2), "*%s*", input);
|
||||||
|
|
||||||
for (l = e_configure_registry; l; l = l->next)
|
for (l = e_configure_registry; l; l = l->next)
|
||||||
{
|
{
|
||||||
|
@ -128,13 +130,13 @@ _plug_config_fetch(Evry_Plugin *p, char *string)
|
||||||
if (eci->pri >= 0)
|
if (eci->pri >= 0)
|
||||||
{
|
{
|
||||||
if (e_util_glob_case_match(eci->label, match1))
|
if (e_util_glob_case_match(eci->label, match1))
|
||||||
_plug_config_item_add(p, eci, 1);
|
_item_add(p, eci, 1);
|
||||||
else if (e_util_glob_case_match(eci->label, match2))
|
else if (e_util_glob_case_match(eci->label, match2))
|
||||||
_plug_config_item_add(p, eci, 2);
|
_item_add(p, eci, 2);
|
||||||
else if (e_util_glob_case_match(ecat->label, match1))
|
else if (e_util_glob_case_match(ecat->label, match1))
|
||||||
_plug_config_item_add(p, eci, 3);
|
_item_add(p, eci, 3);
|
||||||
else if (e_util_glob_case_match(ecat->label, match2))
|
else if (e_util_glob_case_match(ecat->label, match2))
|
||||||
_plug_config_item_add(p, eci, 4);
|
_item_add(p, eci, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,7 +146,7 @@ _plug_config_fetch(Evry_Plugin *p, char *string)
|
||||||
{
|
{
|
||||||
p->items = eina_list_sort(p->items,
|
p->items = eina_list_sort(p->items,
|
||||||
eina_list_count(p->items),
|
eina_list_count(p->items),
|
||||||
_plug_config_cb_sort);
|
_cb_sort);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +154,7 @@ _plug_config_fetch(Evry_Plugin *p, char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_config_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
||||||
{
|
{
|
||||||
E_Configure_It *eci = it->data[0];
|
E_Configure_It *eci = it->data[0];
|
||||||
Evas_Object *o = NULL;
|
Evas_Object *o = NULL;
|
||||||
|
@ -171,7 +173,7 @@ _plug_config_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_config_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio)
|
_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
|
|
||||||
|
@ -187,7 +189,7 @@ _plug_config_item_add(Evry_Plugin *p, E_Configure_It *eci, int prio)
|
||||||
|
|
||||||
// TODO sort name?
|
// TODO sort name?
|
||||||
static int
|
static int
|
||||||
_plug_config_cb_sort(const void *data1, const void *data2)
|
_cb_sort(const void *data1, const void *data2)
|
||||||
{
|
{
|
||||||
const Evry_Item *it1, *it2;
|
const Evry_Item *it1, *it2;
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,16 @@ struct _Inst
|
||||||
const char *directory;
|
const char *directory;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Evry_Plugin *_plug_dir_browse_new();
|
static Evry_Plugin *_plug_new();
|
||||||
static void _plug_dir_browse_free(Evry_Plugin *p);
|
static void _plug_free(Evry_Plugin *p);
|
||||||
static int _plug_dir_browse_begin(Evry_Plugin *p, Evry_Item *item);
|
static int _begin(Evry_Plugin *p, Evry_Item *item);
|
||||||
static int _plug_dir_browse_fetch(Evry_Plugin *p, char *string);
|
static int _fetch(Evry_Plugin *p, const char *input);
|
||||||
static int _plug_dir_browse_action(Evry_Plugin *p, Evry_Item *item);
|
static int _action(Evry_Plugin *p, Evry_Item *item, const char *input);
|
||||||
static void _plug_dir_browse_cleanup(Evry_Plugin *p);
|
static void _cleanup(Evry_Plugin *p);
|
||||||
static int _plug_dir_browse_cb_sort(const void *data1, const void *data2);
|
static int _cb_sort(const void *data1, const void *data2);
|
||||||
static void _plug_dir_browse_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
||||||
static void _plug_dir_browse_list_free(Evry_Plugin *p);
|
static void _list_free(Evry_Plugin *p);
|
||||||
static Evry_Item *_plug_dir_browse_item_fill(const char *directory, const char *file);
|
static Evry_Item *_item_fill(const char *directory, const char *file);
|
||||||
|
|
||||||
static Evry_Plugin_Class class;
|
static Evry_Plugin_Class class;
|
||||||
|
|
||||||
|
@ -27,8 +27,9 @@ evry_plug_dir_browse_init(void)
|
||||||
class.name = "Browse Files";
|
class.name = "Browse Files";
|
||||||
class.type_in = "NONE|FILE";
|
class.type_in = "NONE|FILE";
|
||||||
class.type_out = "FILE";
|
class.type_out = "FILE";
|
||||||
class.new = &_plug_dir_browse_new;
|
class.prio = 2;
|
||||||
class.free = &_plug_dir_browse_free;
|
class.new = &_plug_new;
|
||||||
|
class.free = &_plug_free;
|
||||||
evry_plugin_register(&class);
|
evry_plugin_register(&class);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -43,15 +44,15 @@ evry_plug_dir_browse_shutdown(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evry_Plugin *
|
static Evry_Plugin *
|
||||||
_plug_dir_browse_new()
|
_plug_new()
|
||||||
{
|
{
|
||||||
Evry_Plugin *p = E_NEW(Evry_Plugin, 1);
|
Evry_Plugin *p = E_NEW(Evry_Plugin, 1);
|
||||||
p->class = &class;
|
p->class = &class;
|
||||||
p->begin = &_plug_dir_browse_begin;
|
p->begin = &_begin;
|
||||||
p->fetch = &_plug_dir_browse_fetch;
|
p->fetch = &_fetch;
|
||||||
p->action = &_plug_dir_browse_action;
|
p->action = &_action;
|
||||||
p->cleanup = &_plug_dir_browse_cleanup;
|
p->cleanup = &_cleanup;
|
||||||
p->icon_get = &_plug_dir_browse_item_icon_get;
|
p->icon_get = &_item_icon_get;
|
||||||
p->items = NULL;
|
p->items = NULL;
|
||||||
|
|
||||||
Inst *inst = E_NEW(Inst, 1);
|
Inst *inst = E_NEW(Inst, 1);
|
||||||
|
@ -62,9 +63,9 @@ _plug_dir_browse_new()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_dir_browse_free(Evry_Plugin *p)
|
_plug_free(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
_plug_dir_browse_cleanup(p);
|
_cleanup(p);
|
||||||
|
|
||||||
Inst *inst = p->priv;
|
Inst *inst = p->priv;
|
||||||
eina_stringshare_del(inst->directory);
|
eina_stringshare_del(inst->directory);
|
||||||
|
@ -74,13 +75,13 @@ _plug_dir_browse_free(Evry_Plugin *p)
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_plug_dir_browse_action(Evry_Plugin *p, Evry_Item *item)
|
_action(Evry_Plugin *p, Evry_Item *item, const char *input)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_dir_browse_list_free(Evry_Plugin *p)
|
_list_free(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
|
|
||||||
|
@ -97,13 +98,13 @@ _plug_dir_browse_list_free(Evry_Plugin *p)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_dir_browse_cleanup(Evry_Plugin *p)
|
_cleanup(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
_plug_dir_browse_list_free(p);
|
_list_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_plug_dir_browse_begin(Evry_Plugin *p, Evry_Item *item)
|
_begin(Evry_Plugin *p, Evry_Item *item)
|
||||||
{
|
{
|
||||||
Inst *inst = p->priv;
|
Inst *inst = p->priv;
|
||||||
|
|
||||||
|
@ -111,7 +112,6 @@ _plug_dir_browse_begin(Evry_Plugin *p, Evry_Item *item)
|
||||||
{
|
{
|
||||||
eina_stringshare_del(inst->directory);
|
eina_stringshare_del(inst->directory);
|
||||||
inst->directory = eina_stringshare_add(item->uri);
|
inst->directory = eina_stringshare_add(item->uri);
|
||||||
printf("dir: %s\n", inst->directory);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ _plug_dir_browse_begin(Evry_Plugin *p, Evry_Item *item)
|
||||||
|
|
||||||
/* based on directory-watcher from drawer module */
|
/* based on directory-watcher from drawer module */
|
||||||
static int
|
static int
|
||||||
_plug_dir_browse_fetch(Evry_Plugin *p, char *string)
|
_fetch(Evry_Plugin *p, const char *input)
|
||||||
{
|
{
|
||||||
Eina_List *files;
|
Eina_List *files;
|
||||||
char *file;
|
char *file;
|
||||||
|
@ -130,24 +130,24 @@ _plug_dir_browse_fetch(Evry_Plugin *p, char *string)
|
||||||
char match2[4096];
|
char match2[4096];
|
||||||
Inst *inst = p->priv;
|
Inst *inst = p->priv;
|
||||||
|
|
||||||
_plug_dir_browse_list_free(p);
|
_list_free(p);
|
||||||
|
|
||||||
files = ecore_file_ls(inst->directory);
|
files = ecore_file_ls(inst->directory);
|
||||||
|
|
||||||
if (string)
|
if (input)
|
||||||
{
|
{
|
||||||
snprintf(match1, sizeof(match1), "%s*", string);
|
snprintf(match1, sizeof(match1), "%s*", input);
|
||||||
snprintf(match2, sizeof(match2), "*%s*", string);
|
snprintf(match2, sizeof(match2), "*%s*", input);
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FREE(files, file)
|
EINA_LIST_FREE(files, file)
|
||||||
{
|
{
|
||||||
if ((file[0] == '.') ||
|
if ((file[0] == '.') ||
|
||||||
(string &&
|
(input &&
|
||||||
(!e_util_glob_case_match(file, match1)) &&
|
(!e_util_glob_case_match(file, match1)) &&
|
||||||
(!e_util_glob_case_match(file, match2))))
|
(!e_util_glob_case_match(file, match2))))
|
||||||
goto end;
|
goto end;
|
||||||
it = _plug_dir_browse_item_fill(inst->directory, file);
|
it = _item_fill(inst->directory, file);
|
||||||
if (it)
|
if (it)
|
||||||
p->items = eina_list_append(p->items, it);
|
p->items = eina_list_append(p->items, it);
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ _plug_dir_browse_fetch(Evry_Plugin *p, char *string)
|
||||||
|
|
||||||
/* based on directory-watcher from drawer module */
|
/* based on directory-watcher from drawer module */
|
||||||
static Evry_Item *
|
static Evry_Item *
|
||||||
_plug_dir_browse_item_fill(const char *directory, const char *file)
|
_item_fill(const char *directory, const char *file)
|
||||||
{
|
{
|
||||||
Evry_Item *it = NULL;
|
Evry_Item *it = NULL;
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
@ -209,7 +209,7 @@ _plug_dir_browse_item_fill(const char *directory, const char *file)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_dir_browse_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
||||||
{
|
{
|
||||||
char *item_path;
|
char *item_path;
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ _plug_dir_browse_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_plug_dir_browse_cb_sort(const void *data1, const void *data2)
|
_cb_sort(const void *data1, const void *data2)
|
||||||
{
|
{
|
||||||
const Evry_Item *it1, *it2;
|
const Evry_Item *it1, *it2;
|
||||||
|
|
||||||
|
|
|
@ -1,219 +0,0 @@
|
||||||
#include "e.h"
|
|
||||||
#include "e_mod_main.h"
|
|
||||||
|
|
||||||
typedef struct _Inst Inst;
|
|
||||||
|
|
||||||
struct _Inst
|
|
||||||
{
|
|
||||||
const char *mime;
|
|
||||||
Eina_List *apps;
|
|
||||||
Evry_Item *candidate;
|
|
||||||
};
|
|
||||||
|
|
||||||
static Evry_Plugin *_plug_file_open_new();
|
|
||||||
static void _plug_file_open_free(Evry_Plugin *p);
|
|
||||||
static int _plug_file_open_fetch(Evry_Plugin *p, char *string);
|
|
||||||
static int _plug_file_open_begin(Evry_Plugin *p, Evry_Item *item);
|
|
||||||
static int _plug_file_open_action(Evry_Plugin *p, Evry_Item *item);
|
|
||||||
static void _plug_file_open_cleanup(Evry_Plugin *p);
|
|
||||||
static void _plug_file_open_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, int prio);
|
|
||||||
static int _plug_file_open_cb_sort(const void *data1, const void *data2);
|
|
||||||
static void _plug_file_open_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
|
||||||
|
|
||||||
static Evry_Plugin_Class class;
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
evry_plug_file_open_init(void)
|
|
||||||
{
|
|
||||||
class.name = "Open With...";
|
|
||||||
class.type_in = "FILE";
|
|
||||||
class.type_out = "NONE";
|
|
||||||
class.need_query = 0;
|
|
||||||
class.new = &_plug_file_open_new;
|
|
||||||
class.free = &_plug_file_open_free;
|
|
||||||
evry_plugin_register(&class);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
evry_plug_file_open_shutdown(void)
|
|
||||||
{
|
|
||||||
evry_plugin_unregister(&class);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evry_Plugin *
|
|
||||||
_plug_file_open_new()
|
|
||||||
{
|
|
||||||
Evry_Plugin *p = E_NEW(Evry_Plugin, 1);
|
|
||||||
p->class = &class;
|
|
||||||
p->begin = &_plug_file_open_begin;
|
|
||||||
p->fetch = &_plug_file_open_fetch;
|
|
||||||
p->action = &_plug_file_open_action;
|
|
||||||
p->cleanup = &_plug_file_open_cleanup;
|
|
||||||
p->icon_get = &_plug_file_open_item_icon_get;
|
|
||||||
p->items = NULL;
|
|
||||||
|
|
||||||
Inst *inst = E_NEW(Inst, 1);
|
|
||||||
p->priv = inst;
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_plug_file_open_free(Evry_Plugin *p)
|
|
||||||
{
|
|
||||||
Inst *inst = p->priv;
|
|
||||||
|
|
||||||
_plug_file_open_cleanup(p);
|
|
||||||
if (inst->apps) eina_list_free(inst->apps);
|
|
||||||
|
|
||||||
E_FREE(inst);
|
|
||||||
E_FREE(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
_plug_file_open_begin(Evry_Plugin *p, Evry_Item *it)
|
|
||||||
{
|
|
||||||
Inst *inst;
|
|
||||||
|
|
||||||
_plug_file_open_cleanup(p);
|
|
||||||
|
|
||||||
if (!it || !it->uri) return 0;
|
|
||||||
inst = p->priv;
|
|
||||||
inst->candidate = it;
|
|
||||||
|
|
||||||
if (!it->mime)
|
|
||||||
inst->mime = efreet_mime_type_get(it->uri);
|
|
||||||
else
|
|
||||||
inst->mime = it->mime;
|
|
||||||
|
|
||||||
if (!inst->mime) return 0;
|
|
||||||
|
|
||||||
/* if (!strcmp(mime, "Folder"))
|
|
||||||
* {
|
|
||||||
* apps =
|
|
||||||
* }
|
|
||||||
* else */
|
|
||||||
{
|
|
||||||
inst->apps = efreet_util_desktop_mime_list(inst->mime);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_plug_file_open_action(Evry_Plugin *p, Evry_Item *it)
|
|
||||||
{
|
|
||||||
E_Zone *zone;
|
|
||||||
Efreet_Desktop *desktop;
|
|
||||||
Eina_List *files = NULL;
|
|
||||||
Inst *inst = p->priv;
|
|
||||||
|
|
||||||
desktop = it->data[0];
|
|
||||||
files = eina_list_append(files, inst->candidate->uri);
|
|
||||||
zone = e_util_zone_current_get(e_manager_current_get());
|
|
||||||
e_exec(zone, desktop, NULL, files, NULL /*"everything"*/);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_plug_file_open_cleanup(Evry_Plugin *p)
|
|
||||||
{
|
|
||||||
Evry_Item *it;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(p->items, it)
|
|
||||||
{
|
|
||||||
if (it->label) eina_stringshare_del(it->label);
|
|
||||||
if (it->o_icon) evas_object_del(it->o_icon);
|
|
||||||
free(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_plug_file_open_fetch(Evry_Plugin *p, char *string)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
Efreet_Desktop *desktop;
|
|
||||||
char match1[4096];
|
|
||||||
char match2[4096];
|
|
||||||
Inst *inst = p->priv;
|
|
||||||
|
|
||||||
_plug_file_open_cleanup(p);
|
|
||||||
|
|
||||||
if (!string)
|
|
||||||
{
|
|
||||||
EINA_LIST_FOREACH(inst->apps, l, desktop)
|
|
||||||
_plug_file_open_item_add(p, desktop, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
snprintf(match1, sizeof(match1), "%s*", string);
|
|
||||||
snprintf(match2, sizeof(match2), "*%s*", string);
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(inst->apps, l, desktop)
|
|
||||||
{
|
|
||||||
if (desktop->name)
|
|
||||||
{
|
|
||||||
if (e_util_glob_case_match(desktop->name, match1))
|
|
||||||
_plug_file_open_item_add(p, desktop, 1);
|
|
||||||
else if (e_util_glob_case_match(desktop->name, match2))
|
|
||||||
_plug_file_open_item_add(p, desktop, 2);
|
|
||||||
else if (desktop->comment)
|
|
||||||
{
|
|
||||||
if (e_util_glob_case_match(desktop->comment, match1))
|
|
||||||
_plug_file_open_item_add(p, desktop, 3);
|
|
||||||
else if (e_util_glob_case_match(desktop->comment, match2))
|
|
||||||
_plug_file_open_item_add(p, desktop, 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (eina_list_count(p->items) > 0)
|
|
||||||
{
|
|
||||||
p->items = eina_list_sort(p->items,
|
|
||||||
eina_list_count(p->items),
|
|
||||||
_plug_file_open_cb_sort);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_plug_file_open_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
|
||||||
{
|
|
||||||
it->o_icon = e_util_desktop_icon_add((Efreet_Desktop *)it->data[0], 24, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_plug_file_open_item_add(Evry_Plugin *p, Efreet_Desktop *desktop, int prio)
|
|
||||||
{
|
|
||||||
Evry_Item *it;
|
|
||||||
Evry_App *app;
|
|
||||||
|
|
||||||
it = calloc(1, sizeof(Evry_Item));
|
|
||||||
it->data[0] = desktop;
|
|
||||||
it->priority = prio;
|
|
||||||
it->label = eina_stringshare_add(desktop->name);
|
|
||||||
|
|
||||||
p->items = eina_list_append(p->items, it);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO sort by focus history and name?
|
|
||||||
static int
|
|
||||||
_plug_file_open_cb_sort(const void *data1, const void *data2)
|
|
||||||
{
|
|
||||||
const Evry_Item *it1, *it2;
|
|
||||||
|
|
||||||
it1 = data1;
|
|
||||||
it2 = data2;
|
|
||||||
|
|
||||||
return (it1->priority - it2->priority);
|
|
||||||
}
|
|
|
@ -10,14 +10,14 @@ struct _Inst
|
||||||
E_DBus_Connection *conn;
|
E_DBus_Connection *conn;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Evry_Plugin *_plug_tracker_new();
|
static Evry_Plugin *_plug_new();
|
||||||
static void _plug_tracker_free(Evry_Plugin *p);
|
static void _plug_free(Evry_Plugin *p);
|
||||||
static int _plug_tracker_fetch(Evry_Plugin *p, char *string);
|
static int _fetch(Evry_Plugin *p, const char *input);
|
||||||
static int _plug_tracker_action(Evry_Plugin *p, Evry_Item *item);
|
static int _action(Evry_Plugin *p, Evry_Item *item, const char *input);
|
||||||
static void _plug_tracker_cleanup(Evry_Plugin *p);
|
static void _cleanup(Evry_Plugin *p);
|
||||||
static void _plug_tracker_item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio);
|
static void _item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio);
|
||||||
static void _plug_tracker_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
static void _item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e);
|
||||||
static void _plug_tracker_dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error);
|
static void _dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error);
|
||||||
|
|
||||||
static Evry_Plugin_Class class;
|
static Evry_Plugin_Class class;
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ evry_plug_tracker_init(void)
|
||||||
class.type_in = "NONE";
|
class.type_in = "NONE";
|
||||||
class.type_out = "FILE";
|
class.type_out = "FILE";
|
||||||
class.need_query = 1;
|
class.need_query = 1;
|
||||||
class.new = &_plug_tracker_new;
|
class.new = &_plug_new;
|
||||||
class.free = &_plug_tracker_free;
|
class.free = &_plug_free;
|
||||||
evry_plugin_register(&class);
|
evry_plugin_register(&class);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -44,7 +44,7 @@ evry_plug_tracker_shutdown(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evry_Plugin *
|
static Evry_Plugin *
|
||||||
_plug_tracker_new()
|
_plug_new()
|
||||||
{
|
{
|
||||||
Evry_Plugin *p;
|
Evry_Plugin *p;
|
||||||
Inst *inst;
|
Inst *inst;
|
||||||
|
@ -54,10 +54,10 @@ _plug_tracker_new()
|
||||||
|
|
||||||
p = E_NEW(Evry_Plugin, 1);
|
p = E_NEW(Evry_Plugin, 1);
|
||||||
p->class = &class;
|
p->class = &class;
|
||||||
p->fetch = &_plug_tracker_fetch;
|
p->fetch = &_fetch;
|
||||||
p->action = &_plug_tracker_action;
|
p->action = &_action;
|
||||||
p->cleanup = &_plug_tracker_cleanup;
|
p->cleanup = &_cleanup;
|
||||||
p->icon_get = &_plug_tracker_item_icon_get;
|
p->icon_get = &_item_icon_get;
|
||||||
p->items = NULL;
|
p->items = NULL;
|
||||||
|
|
||||||
inst = E_NEW(Inst, 1);
|
inst = E_NEW(Inst, 1);
|
||||||
|
@ -68,11 +68,11 @@ _plug_tracker_new()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_tracker_free(Evry_Plugin *p)
|
_plug_free(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
Inst *inst = p->priv;
|
Inst *inst = p->priv;
|
||||||
|
|
||||||
_plug_tracker_cleanup(p);
|
_cleanup(p);
|
||||||
e_dbus_connection_close(inst->conn);
|
e_dbus_connection_close(inst->conn);
|
||||||
|
|
||||||
E_FREE(inst);
|
E_FREE(inst);
|
||||||
|
@ -80,13 +80,13 @@ _plug_tracker_free(Evry_Plugin *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_plug_tracker_action(Evry_Plugin *p, Evry_Item *it)
|
_action(Evry_Plugin *p, Evry_Item *it, const char *input)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_tracker_cleanup(Evry_Plugin *p)
|
_cleanup(Evry_Plugin *p)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ _plug_tracker_cleanup(Evry_Plugin *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_plug_tracker_fetch(Evry_Plugin *p, char *string)
|
_fetch(Evry_Plugin *p, const char *input)
|
||||||
{
|
{
|
||||||
Eina_List *list;
|
Eina_List *list;
|
||||||
DBusMessage *msg;
|
DBusMessage *msg;
|
||||||
|
@ -113,10 +113,10 @@ _plug_tracker_fetch(Evry_Plugin *p, char *string)
|
||||||
char *match;
|
char *match;
|
||||||
Inst *inst = p->priv;
|
Inst *inst = p->priv;
|
||||||
|
|
||||||
_plug_tracker_cleanup(p);
|
_cleanup(p);
|
||||||
|
|
||||||
match = malloc(sizeof(char) * strlen(string) + 2);
|
match = malloc(sizeof(char) * strlen(input) + 2);
|
||||||
sprintf(match, "%s*", string);
|
sprintf(match, "%s*", input);
|
||||||
|
|
||||||
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",
|
||||||
|
@ -129,7 +129,7 @@ _plug_tracker_fetch(Evry_Plugin *p, char *string)
|
||||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &match);
|
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &match);
|
||||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &offset);
|
dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &offset);
|
||||||
dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &max_hits);
|
dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &max_hits);
|
||||||
e_dbus_message_send(inst->conn, msg, _plug_tracker_dbus_cb_reply, -1, p);
|
e_dbus_message_send(inst->conn, msg, _dbus_cb_reply, -1, p);
|
||||||
dbus_message_unref(msg);
|
dbus_message_unref(msg);
|
||||||
|
|
||||||
free(match);
|
free(match);
|
||||||
|
@ -138,7 +138,7 @@ _plug_tracker_fetch(Evry_Plugin *p, char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_tracker_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
||||||
{
|
{
|
||||||
char *item_path;
|
char *item_path;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ _plug_tracker_item_icon_get(Evry_Plugin *p, Evry_Item *it, Evas *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_tracker_item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio)
|
_item_add(Evry_Plugin *p, char *file, char *service, char *mime, int prio)
|
||||||
{
|
{
|
||||||
Evry_Item *it;
|
Evry_Item *it;
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ _plug_tracker_item_add(Evry_Plugin *p, char *file, char *service, char *mime, in
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_plug_tracker_dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error)
|
_dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error)
|
||||||
{
|
{
|
||||||
DBusMessageIter array, iter, item;
|
DBusMessageIter array, iter, item;
|
||||||
char *val;
|
char *val;
|
||||||
|
@ -207,7 +207,7 @@ _plug_tracker_dbus_cb_reply(void *data, DBusMessage *msg, DBusError *error)
|
||||||
|
|
||||||
if (uri && service && mime)
|
if (uri && service && mime)
|
||||||
{
|
{
|
||||||
_plug_tracker_item_add(p, uri, service, mime, 1);
|
_item_add(p, uri, service, mime, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue