'everything' cleanup api

-  fix 'localization'? - translating plugin labels should work now


SVN revision: 48042
This commit is contained in:
Hannes Janetzek 2010-04-15 21:42:30 +00:00
parent 40f4ca161b
commit 3f29ece6db
16 changed files with 244 additions and 242 deletions

View File

@ -909,46 +909,37 @@ module_init(void)
return EINA_FALSE; return EINA_FALSE;
p1 = E_NEW(Plugin, 1); p1 = E_NEW(Plugin, 1);
evry_plugin_new(EVRY_PLUGIN(p1), "Applications", type_subject, "", "APPLICATION", 0, NULL, NULL, EVRY_PLUGIN_NEW(EVRY_PLUGIN(p1), "Applications", type_subject, "", "APPLICATION",
_begin, _cleanup, _fetch, NULL, _icon_get, _free_plugin); _begin, _cleanup, _fetch, _icon_get, _free_plugin);
EVRY_PLUGIN(p1)->complete = &_complete; EVRY_PLUGIN(p1)->complete = &_complete;
p2 = E_NEW(Plugin, 1); p2 = E_NEW(Plugin, 1);
evry_plugin_new(EVRY_PLUGIN(p2), "Open With...", type_action, "FILE", "", 0, NULL, NULL, EVRY_PLUGIN_NEW(EVRY_PLUGIN(p2), "Open With...", type_action, "FILE", "",
_begin_open_with, _cleanup, _fetch, _open_with_action, _begin_open_with, _cleanup, _fetch,
_icon_get, _free_plugin); _icon_get, _free_plugin);
EVRY_PLUGIN(p2)->action = &_open_with_action;
evry_plugin_register(EVRY_PLUGIN(p1), 1); evry_plugin_register(EVRY_PLUGIN(p1), 1);
evry_plugin_register(EVRY_PLUGIN(p2), 1); evry_plugin_register(EVRY_PLUGIN(p2), 1);
act = evry_action_new("Launch", "APPLICATION", NULL, NULL, act = EVRY_ACTION_NEW("Launch", "APPLICATION", NULL,
"everything-launch", "everything-launch", _exec_app_action, _exec_app_check_item);
_exec_app_action, _exec_app_check_item,
NULL, NULL, NULL, NULL);
act1 = evry_action_new("Open File...", "APPLICATION", "FILE", "APPLICATION", act1 = EVRY_ACTION_NEW("Open File...", "APPLICATION", "FILE", "document-open",
"document-open", _exec_app_action, _exec_app_check_item);
_exec_app_action, _exec_app_check_item,
NULL, NULL, NULL, NULL);
act2 = evry_action_new("Run in Terminal", "APPLICATION", NULL, NULL, act2 = EVRY_ACTION_NEW("Run in Terminal", "APPLICATION", NULL, "system-run",
"system-run", _exec_term_action, _exec_term_check_item);
_exec_term_action, _exec_term_check_item,
NULL, NULL, NULL, NULL);
act3 = evry_action_new("Edit Application Entry", "APPLICATION", NULL, NULL, act3 = EVRY_ACTION_NEW("Edit Application Entry", "APPLICATION", NULL, "everything-launch",
"everything-launch", _edit_app_action, _edit_app_check_item);
_edit_app_action, _edit_app_check_item,
NULL, NULL, NULL, NULL);
act4 = evry_action_new("New Application Entry", "APPLICATION", NULL, NULL, act4 = EVRY_ACTION_NEW("New Application Entry", "APPLICATION", NULL, "everything-launch",
"everything-launch", _new_app_action, _new_app_check_item);
_new_app_action, _new_app_check_item,
NULL, NULL, NULL, NULL);
act5 = evry_action_new("Run with Sudo", "APPLICATION", NULL, NULL, act5 = EVRY_ACTION_NEW("Run with Sudo", "APPLICATION", NULL, "system-run",
"system-run", _exec_sudo_action, NULL);
_exec_sudo_action, NULL, NULL, NULL, NULL, NULL);
evry_action_register(act, 0); evry_action_register(act, 0);
evry_action_register(act1, 1); evry_action_register(act1, 1);

View File

@ -338,12 +338,15 @@ module_init(void)
return EINA_FALSE; return EINA_FALSE;
p = E_NEW(Plugin, 1); p = E_NEW(Plugin, 1);
evry_plugin_new(EVRY_PLUGIN(p), "Spell Checker", type_subject, "", "TEXT", 1,
"accessories-dictionary", TRIGGER,
NULL, _cleanup, _fetch, NULL, NULL, _free_plugin);
EVRY_PLUGIN(p)->aggregate = EINA_FALSE; EVRY_PLUGIN_NEW(p, "Spell Checker", type_subject, "", "TEXT",
EVRY_PLUGIN(p)->history = EINA_FALSE; NULL, _cleanup, _fetch, NULL, _free_plugin);
EVRY_PLUGIN(p)->aggregate = EINA_FALSE;
EVRY_PLUGIN(p)->history = EINA_FALSE;
EVRY_PLUGIN(p)->async_fetch = EINA_TRUE;
EVRY_PLUGIN(p)->icon = "accessories-dictionary";
EVRY_PLUGIN(p)->trigger = TRIGGER;
evry_plugin_register(EVRY_PLUGIN(p), 100); evry_plugin_register(EVRY_PLUGIN(p), 100);

View File

@ -229,12 +229,16 @@ module_init(void)
if (!evry_api_version_check(EVRY_API_VERSION)) if (!evry_api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
p1 = evry_plugin_new(NULL, "Calculator", type_subject, NULL, "TEXT", 1, "accessories-calculator", "=", p1 = EVRY_PLUGIN_NEW(NULL, "Calculator", type_subject, NULL, "TEXT",
_begin, _cleanup, _fetch, _action, NULL, NULL); _begin, _cleanup, _fetch, NULL, NULL);
p1->view_mode = VIEW_MODE_LIST; p1->view_mode = VIEW_MODE_LIST;
p1->aggregate = EINA_FALSE; p1->aggregate = EINA_FALSE;
p1->history = EINA_FALSE; p1->history = EINA_FALSE;
p1->async_fetch = EINA_TRUE;
p1->icon = "accessories-calculator";
p1->trigger = "=";
p1->action = &_action;
evry_plugin_register(p1, 0); evry_plugin_register(p1, 0);

View File

@ -526,22 +526,21 @@ module_init(void)
if (!evry_api_version_check(EVRY_API_VERSION)) if (!evry_api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
p1 = evry_plugin_new(NULL, "Files", type_subject, "FILE", "FILE", 0, NULL, NULL, p1 = EVRY_PLUGIN_NEW(NULL, "Files", type_subject, "FILE", "FILE",
_begin, _cleanup, _fetch, NULL, _icon_get, NULL); _begin, _cleanup, _fetch, _icon_get, NULL);
p2 = evry_plugin_new(NULL, "Files", type_object, "FILE", "FILE", 0, NULL, NULL, p2 = EVRY_PLUGIN_NEW(NULL, "Files", type_object, "FILE", "FILE",
_begin, _cleanup, _fetch, NULL, _icon_get, NULL); _begin, _cleanup, _fetch, _icon_get, NULL);
evry_plugin_register(p1, 3); evry_plugin_register(p1, 3);
evry_plugin_register(p2, 1); evry_plugin_register(p2, 1);
act1 = evry_action_new("Open Folder (EFM)", "FILE", NULL, NULL, "folder-open", act1 = EVRY_ACTION_NEW("Open Folder (EFM)", "FILE", NULL, "folder-open",
_open_folder_action, _open_folder_check, NULL, NULL, NULL, NULL); _open_folder_action, _open_folder_check);
evry_action_register(act1, 0); evry_action_register(act1, 0);
act2 = evry_action_new("Open Terminal here", "FILE", NULL, NULL, act2 = EVRY_ACTION_NEW("Open Terminal here", "FILE", NULL, "system-run",
"system-run", _open_term_action, NULL);
_open_term_action, NULL, NULL, NULL, NULL, NULL);
evry_action_register(act2, 2); evry_action_register(act2, 2);
return EINA_TRUE; return EINA_TRUE;

View File

@ -123,13 +123,13 @@ module_init(void)
if (!evry_api_version_check(EVRY_API_VERSION)) if (!evry_api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
p = evry_plugin_new(NULL, "Settings", type_subject, NULL, "E_SETTINGS", 0, NULL, NULL, p = EVRY_PLUGIN_NEW(NULL, "Settings", type_subject, NULL, "E_SETTINGS",
NULL, _cleanup, _fetch, NULL, _item_icon_get, NULL); NULL, _cleanup, _fetch, _item_icon_get, NULL);
act = evry_action_new("Show Dialog", "E_SETTINGS", NULL, NULL, "preferences-advanced",
_action, NULL, NULL, NULL, NULL, NULL);
evry_plugin_register(p, 10); evry_plugin_register(p, 10);
act = EVRY_ACTION_NEW("Show Dialog", "E_SETTINGS", NULL,
"preferences-advanced", _action, NULL);
evry_action_register(act, 0); evry_action_register(act, 0);

View File

@ -48,7 +48,7 @@ static void _import_edj_gen(Import *import);
static int _import_cb_edje_cc_exit(void *data, int type, void *event); static int _import_cb_edje_cc_exit(void *data, int type, void *event);
static Import *import = NULL; static Import *import = NULL;
static Evry_Plugin *plugin; static Evry_Plugin *_plug;
static void static void
_item_free(Evry_Item *item) _item_free(Evry_Item *item)
@ -205,12 +205,13 @@ module_init(void)
if (!evry_api_version_check(EVRY_API_VERSION)) if (!evry_api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
plugin = evry_plugin_new(NULL, "Wallpaper", type_action, "FILE", "", _plug = EVRY_PLUGIN_NEW(NULL, "Wallpaper", type_action, "FILE", "",
0, "preferences-desktop-wallpaper", NULL, _begin, _cleanup, _fetch, _icon_get, NULL);
_begin, _cleanup, _fetch, _action, _icon_get,
NULL); EVRY_PLUGIN(_plug)->icon = "preferences-desktop-wallpaper";
EVRY_PLUGIN(_plug)->action = &_action;
evry_plugin_register(plugin, 10);
evry_plugin_register(_plug, 10);
return EINA_TRUE; return EINA_TRUE;
} }
@ -218,7 +219,7 @@ module_init(void)
static void static void
module_shutdown(void) module_shutdown(void)
{ {
EVRY_PLUGIN_FREE(plugin); EVRY_PLUGIN_FREE(_plug);
if (import) if (import)
{ {

View File

@ -5,7 +5,7 @@
#include "Evry.h" #include "Evry.h"
#include "e_mod_main.h" #include "e_mod_main.h"
static Evry_Plugin *plugin; static Evry_Plugin *p1;
static Eina_List *handlers = NULL; static Eina_List *handlers = NULL;
static Eina_Hash *border_hash = NULL; static Eina_Hash *border_hash = NULL;
@ -244,7 +244,7 @@ struct _Inst
E_Border *border; E_Border *border;
}; };
static Evry_Plugin *plugin2 = NULL; static Evry_Plugin *p2 = NULL;
static Inst *inst = NULL; static Inst *inst = NULL;
static Evry_Action *act = NULL; static Evry_Action *act = NULL;
@ -436,48 +436,48 @@ _act_item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
} }
static int /* static int
_exec_border_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it) * _exec_border_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it)
{ * {
E_Border *bd = it->data; * E_Border *bd = it->data;
E_OBJECT_CHECK_RETURN(bd, 0); * E_OBJECT_CHECK_RETURN(bd, 0);
E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, 0); * E_OBJECT_TYPE_CHECK_RETURN(bd, E_BORDER_TYPE, 0);
*
if ((bd->desktop && bd->desktop->exec) && * if ((bd->desktop && bd->desktop->exec) &&
((strstr(bd->desktop->exec, "%u")) || * ((strstr(bd->desktop->exec, "%u")) ||
(strstr(bd->desktop->exec, "%U")) || * (strstr(bd->desktop->exec, "%U")) ||
(strstr(bd->desktop->exec, "%f")) || * (strstr(bd->desktop->exec, "%f")) ||
(strstr(bd->desktop->exec, "%F")))) * (strstr(bd->desktop->exec, "%F"))))
return 1; * return 1;
*
return 0; * return 0;
} * }
*
static int * static int
_exec_border_action(Evry_Action *act) * _exec_border_action(Evry_Action *act)
{ * {
return evry_util_exec_app(act->item1, act->item2); * return evry_util_exec_app(act->item1, act->item2);
} * }
*
static int * static int
_exec_border_intercept(Evry_Action *act) * _exec_border_intercept(Evry_Action *act)
{ * {
Evry_Item_App *app = E_NEW(Evry_Item_App, 1); * Evry_Item_App *app = E_NEW(Evry_Item_App, 1);
E_Border *bd = act->item1->data; * E_Border *bd = act->item1->data;
*
app->desktop = bd->desktop; * app->desktop = bd->desktop;
act->item1 = EVRY_ITEM(app); * act->item1 = EVRY_ITEM(app);
*
return 1; * return 1;
} * }
*
*
static void * static void
_exec_border_cleanup(Evry_Action *act) * _exec_border_cleanup(Evry_Action *act)
{ * {
ITEM_APP(app, act->item1); * ITEM_APP(app, act->item1);
E_FREE(app); * E_FREE(app);
} * } */
@ -487,21 +487,24 @@ module_init(void)
if (!evry_api_version_check(EVRY_API_VERSION)) if (!evry_api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
plugin = evry_plugin_new(NULL, "Windows", type_subject, NULL, "BORDER", 0, NULL, NULL, p1 = EVRY_PLUGIN_NEW(NULL, "Windows", type_subject, NULL, "BORDER",
_begin, _cleanup, _fetch, NULL, _item_icon_get, NULL); _begin, _cleanup, _fetch, _item_icon_get, NULL);
plugin->transient = EINA_TRUE; p1->transient = EINA_TRUE;
evry_plugin_register(plugin, 2); evry_plugin_register(p1, 2);
plugin2 = evry_plugin_new(NULL, "Window Action", type_action, "BORDER", NULL, 0, NULL, NULL, p2 = EVRY_PLUGIN_NEW(NULL, "Window Action", type_action, "BORDER", NULL,
_act_begin, _act_cleanup, _act_fetch, _act_action, _act_item_icon_get, NULL); _act_begin, _act_cleanup, _act_fetch, _act_item_icon_get, NULL);
evry_plugin_register(plugin2, 1);
EVRY_PLUGIN(p2)->action = &_act_action;
evry_plugin_register(p2, 1);
act = evry_action_new("Open File...", "BORDER", "FILE", "APPLICATION", /* act = evry_action_new("Open File...", "BORDER", "FILE", "APPLICATION",
"everything-launch", * "everything-launch",
_exec_border_action, _exec_border_check_item, * _exec_border_action, _exec_border_check_item,
_exec_border_cleanup, _exec_border_intercept, NULL, NULL); * _exec_border_cleanup, _exec_border_intercept, NULL, NULL);
evry_action_register(act, 10); * evry_action_register(act, 10); */
return EINA_TRUE; return EINA_TRUE;
} }
@ -509,10 +512,10 @@ module_init(void)
static void static void
module_shutdown(void) module_shutdown(void)
{ {
EVRY_PLUGIN_FREE(plugin); EVRY_PLUGIN_FREE(p1);
EVRY_PLUGIN_FREE(plugin2); EVRY_PLUGIN_FREE(p2);
evry_action_free(act); /* evry_action_free(act); */
} }
/***************************************************************************/ /***************************************************************************/

View File

@ -3,8 +3,7 @@
#include "e.h" #include "e.h"
#define EVRY_API_VERSION 2 #define EVRY_API_VERSION 3
#define EVRY_ACTION_OTHER 0 #define EVRY_ACTION_OTHER 0
#define EVRY_ACTION_FINISHED 1 #define EVRY_ACTION_FINISHED 1
@ -18,6 +17,7 @@
#define EVRY_COMPLETE_INPUT 1 #define EVRY_COMPLETE_INPUT 1
#define EVRY_COMPLETE_BROWSE 2 #define EVRY_COMPLETE_BROWSE 2
#define VIEW_MODE_NONE -1
#define VIEW_MODE_LIST 0 #define VIEW_MODE_LIST 0
#define VIEW_MODE_DETAIL 1 #define VIEW_MODE_DETAIL 1
#define VIEW_MODE_THUMB 2 #define VIEW_MODE_THUMB 2
@ -51,6 +51,7 @@ typedef struct _History_Entry History_Entry;
typedef struct _History_Item History_Item; typedef struct _History_Item History_Item;
typedef struct _Config Evry_Config; typedef struct _Config Evry_Config;
#define EVRY_ITEM(_item) ((Evry_Item *)_item) #define EVRY_ITEM(_item) ((Evry_Item *)_item)
#define EVRY_PLUGIN(_plugin) ((Evry_Plugin *) _plugin) #define EVRY_PLUGIN(_plugin) ((Evry_Plugin *) _plugin)
#define EVRY_VIEW(_view) ((Evry_View *) _view) #define EVRY_VIEW(_view) ((Evry_View *) _view)
@ -159,14 +160,26 @@ struct _Evry_Item_File
struct _Evry_Plugin struct _Evry_Plugin
{ {
/* identifier */
const char *name; const char *name;
/* shown title */
const char *label;
/* provide default icon */
const char *icon; const char *icon;
/* use plugin for first second or third part of an action
if actions are no dynamical lists better use Evry_Action */
enum { type_subject, type_action, type_object } type; enum { type_subject, type_action, type_object } type;
const char *type_in; /* plugin provides items of this type */
const char *type_out; const char *type_out;
/* plugin accepts this type in begin function */
const char *type_in;
/* show this plugin only when triggered */
const char *trigger; const char *trigger;
/* list of items visible for everything */ /* list of items visible for everything */
@ -240,9 +253,6 @@ struct _Evry_State
Eina_List *sel_items; Eina_List *sel_items;
/* this is for the case when the current plugin was not selected
manually and a higher priority (async) plugin retrieves
candidates, the higher priority plugin is made current */
Eina_Bool plugin_auto_selected; Eina_Bool plugin_auto_selected;
Eina_Bool item_auto_selected; Eina_Bool item_auto_selected;
@ -269,11 +279,15 @@ struct _Evry_View
struct _Evry_Action struct _Evry_Action
{ {
/* identifier */
const char *name; const char *name;
/* shown title */
const char *label;
/* */
const char *type_in1; const char *type_in1;
const char *type_in2; const char *type_in2;
const char *type_out;
const Evry_Item *item1; const Evry_Item *item1;
const Evry_Item *item2; const Evry_Item *item2;
@ -296,6 +310,8 @@ struct _Evry_Action
int priority; int priority;
}; };
/* FIXME this should be exposed.
- add functions to retrieve this stuff */
struct _Config struct _Config
{ {
int version; int version;
@ -397,28 +413,28 @@ EAPI void evry_history_unload(void);
EAPI void evry_history_add(Eina_Hash *hist, Evry_State *s, const char *ctxt); EAPI void evry_history_add(Eina_Hash *hist, Evry_State *s, const char *ctxt);
EAPI int evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, const char *ctxt); EAPI int evry_history_item_usage_set(Eina_Hash *hist, Evry_Item *it, const char *input, const char *ctxt);
EAPI Evry_Plugin *evry_plugin_new(Evry_Plugin *base, const char *name, int type, #define EVRY_PLUGIN_NEW(_base, _name, _type, _in, _out, _begin, _cleanup, _fetch, _icon_get, _free) \
evry_plugin_new(EVRY_PLUGIN(_base), _name, _(_name), _type, _in, _out, _begin, _cleanup, _fetch, _icon_get, _free) \
EAPI Evry_Plugin *evry_plugin_new(Evry_Plugin *base, const char *name, const char *label, 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,
Evry_Plugin *(*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),
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),
void (*free) (Evry_Plugin *p)); void (*free) (Evry_Plugin *p));
EAPI void evry_plugin_free(Evry_Plugin *p, int free_pointer); EAPI void evry_plugin_free(Evry_Plugin *p, int free_pointer);
EAPI Evry_Action *evry_action_new(const char *name, const char *type_in1, #define EVRY_ACTION_NEW(_name, _in1, _in2, _icon, _action, _check) \
const char *type_in2, const char *type_out, evry_action_new(_name, _(_name), _in1, _in2, _icon, _action, _check)
EAPI Evry_Action *evry_action_new(const char *name, const char *label,
const char *type_in1, const char *type_in2,
const char *icon, const char *icon,
int (*action) (Evry_Action *act), int (*action) (Evry_Action *act),
int (*check_item) (Evry_Action *act, const Evry_Item *it), int (*check_item) (Evry_Action *act, const Evry_Item *it));
void (*cleanup) (Evry_Action *act),
int (*intercept) (Evry_Action *act),
Evas_Object *(*icon_get) (Evry_Action *act, Evas *e),
void (*free) (Evry_Action *p));
EAPI void evry_action_free(Evry_Action *act); EAPI void evry_action_free(Evry_Action *act);

View File

@ -378,13 +378,11 @@ _evry_cb_plugin_sort(const void *data1, const void *data2)
} }
Evry_Plugin * Evry_Plugin *
evry_plugin_new(Evry_Plugin *base, const char *name, int type, evry_plugin_new(Evry_Plugin *base, const char *name, const char *label, 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,
Evry_Plugin *(*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),
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),
void (*cb_free) (Evry_Plugin *p)) void (*cb_free) (Evry_Plugin *p))
{ {
@ -396,23 +394,23 @@ evry_plugin_new(Evry_Plugin *base, const char *name, int type,
p = E_NEW(Evry_Plugin, 1); p = E_NEW(Evry_Plugin, 1);
p->name = eina_stringshare_add(name); p->name = eina_stringshare_add(name);
p->label = eina_stringshare_add(label);
p->type = type; p->type = type;
p->type_in = (type_in ? eina_stringshare_add(type_in) : NULL); p->type_in = (type_in ? eina_stringshare_add(type_in) : NULL);
p->type_out = (type_out ? eina_stringshare_add(type_out) : NULL); p->type_out = (type_out ? eina_stringshare_add(type_out) : NULL);
p->trigger = (trigger ? eina_stringshare_add(trigger) : NULL); /* p->trigger = (trigger ? eina_stringshare_add(trigger) : NULL); */
p->icon = (icon ? eina_stringshare_add(icon) : NULL); /* p->icon = (icon ? eina_stringshare_add(icon) : NULL); */
p->async_fetch = async_fetch;
p->begin = begin; p->begin = begin;
p->cleanup = cleanup; p->cleanup = cleanup;
p->fetch = fetch; p->fetch = fetch;
p->icon_get = icon_get; p->icon_get = icon_get;
p->action = action; /* p->action = action; */
p->aggregate = EINA_TRUE; p->aggregate = EINA_TRUE;
p->async_fetch = EINA_FALSE; p->async_fetch = EINA_FALSE;
p->free = cb_free; p->free = cb_free;
p->history = EINA_TRUE; p->history = EINA_TRUE;
p->view_mode = -1; p->view_mode = VIEW_MODE_NONE;
DBG("%s", p->name); DBG("%s", p->name);
@ -427,10 +425,11 @@ evry_plugin_free(Evry_Plugin *p, int free_pointer)
DBG("%s", p->name); DBG("%s", p->name);
if (p->name) eina_stringshare_del(p->name); if (p->name) eina_stringshare_del(p->name);
if (p->label) eina_stringshare_del(p->label);
if (p->type_in) eina_stringshare_del(p->type_in); if (p->type_in) eina_stringshare_del(p->type_in);
if (p->type_out) eina_stringshare_del(p->type_out); if (p->type_out) eina_stringshare_del(p->type_out);
if (p->trigger) eina_stringshare_del(p->trigger); /* if (p->trigger) eina_stringshare_del(p->trigger); */
if (p->icon) eina_stringshare_del(p->icon); /* if (p->icon) eina_stringshare_del(p->icon); */
if (p->free) if (p->free)
p->free(p); p->free(p);
@ -441,25 +440,18 @@ evry_plugin_free(Evry_Plugin *p, int free_pointer)
} }
Evry_Action * Evry_Action *
evry_action_new(const char *name, const char *type_in1, const char *type_in2, evry_action_new(const char *name, const char *label, const char *type_in1, const char *type_in2,
const char *type_out, const char *icon, const char *icon,
int (*action) (Evry_Action *act), int (*action) (Evry_Action *act),
int (*check_item) (Evry_Action *act, const Evry_Item *it), int (*check_item) (Evry_Action *act, const Evry_Item *it))
void (*cleanup) (Evry_Action *act),
int (*intercept) (Evry_Action *act),
Evas_Object *(*icon_get) (Evry_Action *act, Evas *e),
void (*cb_free) (Evry_Action *p))
{ {
Evry_Action *act = E_NEW(Evry_Action, 1); Evry_Action *act = E_NEW(Evry_Action, 1);
act->name = eina_stringshare_add(name); act->name = eina_stringshare_add(name);
act->label = eina_stringshare_add(label);
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->intercept = intercept;
act->cleanup = cleanup;
act->free = cb_free;
act->icon = (icon ? eina_stringshare_add(icon) : NULL); act->icon = (icon ? eina_stringshare_add(icon) : NULL);
DBG("%s", name); DBG("%s", name);
@ -473,9 +465,9 @@ evry_action_free(Evry_Action *act)
evry_action_unregister(act); evry_action_unregister(act);
if (act->name) eina_stringshare_del(act->name); if (act->name) eina_stringshare_del(act->name);
if (act->label) eina_stringshare_del(act->label);
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);
if (act->free) if (act->free)
@ -588,10 +580,6 @@ _evry_cb_view_sort(const void *data1, const void *data2)
void void
evry_view_register(Evry_View *view, int priority) evry_view_register(Evry_View *view, int priority)
{ {
/* XXX remove: ignore old list view, some people might
forget to do make uninstall */
if (!strcmp(view->name, "List View")) return;
view->priority = priority; view->priority = priority;
evry_conf->views = eina_list_append(evry_conf->views, view); evry_conf->views = eina_list_append(evry_conf->views, view);

View File

@ -789,7 +789,7 @@ _evry_selector_activate(Evry_Selector *sel)
if (sel->state->cur_item) if (sel->state->cur_item)
edje_object_part_text_set(sel->o_main, "e.text.plugin", edje_object_part_text_set(sel->o_main, "e.text.plugin",
s->cur_item->plugin->name); s->cur_item->plugin->label);
_evry_view_show(s->view); _evry_view_show(s->view);
_evry_list_win_update(s); _evry_list_win_update(s);
@ -964,7 +964,7 @@ _evry_selector_update(Evry_Selector *sel)
edje_object_part_text_set(sel->o_main, "e.text.label", it->label); edje_object_part_text_set(sel->o_main, "e.text.label", it->label);
if (sel == selector) if (sel == selector)
edje_object_part_text_set(sel->o_main, "e.text.plugin", it->plugin->name); edje_object_part_text_set(sel->o_main, "e.text.plugin", it->plugin->label);
else else
edje_object_part_text_set(sel->o_main, "e.text.plugin", ""); edje_object_part_text_set(sel->o_main, "e.text.plugin", "");
} }
@ -973,7 +973,7 @@ _evry_selector_update(Evry_Selector *sel)
/* no items for this state - clear selector */ /* no items for this state - clear selector */
edje_object_part_text_set(sel->o_main, "e.text.label", ""); edje_object_part_text_set(sel->o_main, "e.text.label", "");
if (sel == selector && s && s->plugin) if (sel == selector && s && s->plugin)
edje_object_part_text_set(sel->o_main, "e.text.plugin", s->plugin->name); edje_object_part_text_set(sel->o_main, "e.text.plugin", s->plugin->label);
else else
edje_object_part_text_set(sel->o_main, "e.text.plugin", ""); edje_object_part_text_set(sel->o_main, "e.text.plugin", "");
} }
@ -1389,7 +1389,7 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
if (action == EVRY_COMPLETE_INPUT) if (action == EVRY_COMPLETE_INPUT)
{ {
snprintf(s->input, INPUTLEN, "%s", input); snprintf(s->input, INPUTLEN, "%s", input);
_evry_update_text_label(s); _evry_update_text_label(s);
_evry_cb_update_timer(selector); _evry_cb_update_timer(selector);
evry_item_select(s, it); evry_item_select(s, it);
} }
@ -1847,10 +1847,8 @@ _evry_matches_update(Evry_Selector *sel, int async)
Eina_List *l; Eina_List *l;
const char *input; const char *input;
/* TODO cleanup plugins */
EINA_LIST_FREE(s->cur_plugins, p); EINA_LIST_FREE(s->cur_plugins, p);
/* if (strlen(s->input) > 0) */
if (s->input[0]) if (s->input[0])
input = s->input; input = s->input;
else else

View File

@ -50,8 +50,9 @@ _begin(Evry_Plugin *p, const Evry_Item *it)
{ {
act->item1 = it; act->item1 = it;
if (act->type_out && act->intercept && !(act->intercept(act))) /* FIXME where is this used ?*/
continue;; /* if (act->type_out && act->intercept && !(act->intercept(act)))
* continue;; */
sel->cur_actions = eina_list_append(sel->cur_actions, act); sel->cur_actions = eina_list_append(sel->cur_actions, act);
} }
@ -109,7 +110,7 @@ _fetch(Evry_Plugin *p, const char *input)
if (!input || match) if (!input || match)
{ {
it = evry_item_new(NULL, p, act->name, NULL); it = evry_item_new(NULL, p, act->label, NULL);
it->fuzzy_match = match; it->fuzzy_match = match;
it->data = act; it->data = act;
it->priority = act->priority; it->priority = act->priority;
@ -146,8 +147,8 @@ evry_plug_actions_new(int type)
{ {
Evry_Plugin *p; Evry_Plugin *p;
p = evry_plugin_new(NULL, action_selector, type, "", "", 0, NULL, NULL, p = evry_plugin_new(NULL, action_selector, _("Actions"), type, "", "",
_begin, _cleanup, _fetch, NULL, _icon_get, NULL); _begin, _cleanup, _fetch, _icon_get, NULL);
evry_plugin_register(p, 2); evry_plugin_register(p, 2);

View File

@ -294,9 +294,11 @@ evry_plug_aggregator_new(Evry_Selector *selector)
Plugin_Config *pc; Plugin_Config *pc;
p = E_NEW(Plugin, 1); p = E_NEW(Plugin, 1);
evry_plugin_new(EVRY_PLUGIN(p), "All", 0, "", "", 0, NULL, NULL, EVRY_PLUGIN_NEW(EVRY_PLUGIN(p), "All", 0, "", "",
NULL, _cleanup, _fetch, _action, _icon_get, _plugin_free); NULL, _cleanup, _fetch, _icon_get, _plugin_free);
EVRY_PLUGIN(p)->action = &_action;
pc = E_NEW(Plugin_Config, 1); pc = E_NEW(Plugin_Config, 1);
pc->enabled = 1; pc->enabled = 1;
pc->priority = -1; pc->priority = -1;

View File

@ -31,8 +31,8 @@ evry_plug_clipboard_init(void)
if (!win) return EINA_FALSE; if (!win) return EINA_FALSE;
//FIXME: Icon name doesnt follow FDO Spec //FIXME: Icon name doesnt follow FDO Spec
act = evry_action_new("Copy to Clipboard", "TEXT", NULL, NULL, "everything-clipboard", act = EVRY_ACTION_NEW("Copy to Clipboard", "TEXT", NULL, "everything-clipboard",
_action, _check_item, NULL, NULL, NULL, NULL); _action, _check_item);
evry_action_register(act, 10); evry_action_register(act, 10);

View File

@ -74,7 +74,7 @@ _view_create(Evry_View *v, const Evry_State *s, const Evas_Object *swallow)
"<hilight>&lt;ctrl+left/right&gt;</hilight>" "<hilight>&lt;ctrl+left/right&gt;</hilight>"
"cycle through plugins<br>" "cycle through plugins<br>"
"<hilight>&lt;ctrl+1&gt;</hilight> " "<hilight>&lt;ctrl+1&gt;</hilight> "
"choose a different view (e.g. for images)<br>"; "choose a different view (e.g. for images)<br>";
if (v->active) return v; if (v->active) return v;

View File

@ -6,8 +6,8 @@ typedef struct _View View;
typedef struct _Smart_Data Smart_Data; typedef struct _Smart_Data Smart_Data;
typedef struct _Item Item; typedef struct _Item Item;
#define SIZE_LIST 30 #define SIZE_LIST 28
#define SIZE_DETAIL 38 #define SIZE_DETAIL 36
struct _View struct _View
@ -23,6 +23,7 @@ struct _View
int iw, ih; int iw, ih;
int zoom; int zoom;
int mode; int mode;
int mode_prev;
Eina_List *handlers; Eina_List *handlers;
}; };
@ -39,7 +40,6 @@ struct _Smart_Data
Evas_Coord cx, cy, cw, ch; Evas_Coord cx, cy, cw, ch;
Evas_Coord sx, sy; Evas_Coord sx, sy;
Eina_Bool update : 1; Eina_Bool update : 1;
Eina_Bool switch_mode : 1;
Eina_List *queue; Eina_List *queue;
Evas_Object *selector; Evas_Object *selector;
@ -284,19 +284,6 @@ _e_smart_reconfigure_do(void *data)
changed = 1; changed = 1;
} }
if (sd->switch_mode)
{
if (changed)
evas_object_smart_callback_call(obj, "changed", NULL);
sd->update = EINA_TRUE;
sd->switch_mode = EINA_FALSE;
if (recursion == 0)
sd->idle_enter = NULL;
return 0;
}
if (sd->view->mode == VIEW_MODE_THUMB) if (sd->view->mode == VIEW_MODE_THUMB)
{ {
if (sd->w > sd->cw) ox = (sd->w - sd->cw) / 2; if (sd->w > sd->cw) ox = (sd->w - sd->cw) / 2;
@ -897,20 +884,24 @@ _view_update(Evry_View *view)
Smart_Data *sd = evas_object_smart_data_get(v->span); Smart_Data *sd = evas_object_smart_data_get(v->span);
Item *v_it; Item *v_it;
Evry_Item *p_it; Evry_Item *p_it;
Eina_List *l, *ll, *p_items, *v_remove = NULL, *v_items = NULL; Eina_List *l, *ll, *v_remove = NULL, *v_items = NULL;
int pos, last_pos, last_vis = 0, first_vis = 0; int pos, last_pos, last_vis = 0, first_vis = 0;
Eina_Bool update = EINA_FALSE; Eina_Bool update = EINA_FALSE;
Evry_Plugin *p = v->state->plugin;
sd->cur_item = NULL; sd->cur_item = NULL;
if (!v->state->plugin) if (!p)
{ {
_view_clear(view); _view_clear(view);
return 1; return 1;
} }
p_items = v->state->plugin->items; v->mode = v->mode_prev;
if (p->view_mode >= 0)
v->mode = p->view_mode;
/* go through current view items */ /* go through current view items */
EINA_LIST_FOREACH(sd->items, l, v_it) EINA_LIST_FOREACH(sd->items, l, v_it)
{ {
@ -919,7 +910,7 @@ _view_update(Evry_View *view)
pos = 1; pos = 1;
/* go through plugins current items */ /* go through plugins current items */
EINA_LIST_FOREACH(p_items, ll, p_it) EINA_LIST_FOREACH(p->items, ll, p_it)
{ {
if (v_it->item == p_it) if (v_it->item == p_it)
{ {
@ -976,7 +967,7 @@ _view_update(Evry_View *view)
/* go through plugins current items */ /* go through plugins current items */
pos = 1; pos = 1;
EINA_LIST_FOREACH(p_items, l, p_it) EINA_LIST_FOREACH(p->items, l, p_it)
{ {
/* item is not already in view */ /* item is not already in view */
if (!eina_list_data_find_list(v_items, p_it)) if (!eina_list_data_find_list(v_items, p_it))
@ -1003,9 +994,9 @@ _view_update(Evry_View *view)
sd->items = eina_list_sort(sd->items, eina_list_count(sd->items), _sort_cb); sd->items = eina_list_sort(sd->items, eina_list_count(sd->items), _sort_cb);
if (update || !last_vis || v->plugin != v->state->plugin) if (update || !last_vis || v->plugin != p)
{ {
v->plugin = v->state->plugin; v->plugin = p;
sd->update = EINA_TRUE; sd->update = EINA_TRUE;
_update_frame(v->span); _update_frame(v->span);
@ -1025,44 +1016,48 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
Smart_Data *sd = evas_object_smart_data_get(v->span); Smart_Data *sd = evas_object_smart_data_get(v->span);
Eina_List *l = NULL, *ll; Eina_List *l = NULL, *ll;
Item *it = NULL; Item *it = NULL;
const Evry_State *s = v->state;
if (!v->state->plugin)
if (!s->plugin)
return 0; return 0;
if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && if (s->plugin->view_mode == VIEW_MODE_NONE)
(!strcmp(ev->key, "2")))
{ {
if (v->mode == VIEW_MODE_LIST) if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
v->mode = VIEW_MODE_DETAIL; (!strcmp(ev->key, "2")))
else
v->mode = VIEW_MODE_LIST;
v->zoom = 0;
_clear_items(v->span);
_update_frame(v->span);
goto end;
}
else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
((!strcmp(ev->key, "plus")) ||
(!strcmp(ev->key, "3"))))
{
if (v->mode != VIEW_MODE_THUMB)
{ {
if (v->mode == VIEW_MODE_LIST)
v->mode = VIEW_MODE_DETAIL;
else
v->mode = VIEW_MODE_LIST;
v->zoom = 0; v->zoom = 0;
v->mode = VIEW_MODE_THUMB;
_clear_items(v->span); _clear_items(v->span);
_update_frame(v->span);
goto end;
} }
else else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) &&
((!strcmp(ev->key, "plus")) ||
(!strcmp(ev->key, "3"))))
{ {
v->zoom++; if (v->mode != VIEW_MODE_THUMB)
if (v->zoom > 2) v->zoom = 0; {
if (v->zoom == 2) v->zoom = 0;
_clear_items(v->span); v->mode = VIEW_MODE_THUMB;
_clear_items(v->span);
}
else
{
v->zoom++;
if (v->zoom > 2) v->zoom = 0;
if (v->zoom == 2)
_clear_items(v->span);
}
_update_frame(v->span);
goto end;
} }
_update_frame(v->span);
goto end;
} }
if (v->tabs->key_down(v->tabs, ev)) if (v->tabs->key_down(v->tabs, ev))
{ {
_view_update(view); _view_update(view);
@ -1076,7 +1071,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
it = sd->items->data; it = sd->items->data;
_pan_item_select(v->span, it, 1); _pan_item_select(v->span, it, 1);
evry_item_select(v->state, it->item); evry_item_select(s, it->item);
goto end; goto end;
} }
else if ((ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) && else if ((ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) &&
@ -1086,7 +1081,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
it = eina_list_last(sd->items)->data; it = eina_list_last(sd->items)->data;
_pan_item_select(v->span, it, 1); _pan_item_select(v->span, it, 1);
evry_item_select(v->state, it->item); evry_item_select(s, it->item);
goto end; goto end;
} }
@ -1103,7 +1098,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
if (it) if (it)
{ {
_pan_item_select(v->span, it, 1); _pan_item_select(v->span, it, 1);
evry_item_select(v->state, it->item); evry_item_select(s, it->item);
} }
goto end; goto end;
} }
@ -1117,7 +1112,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
if (it) if (it)
{ {
_pan_item_select(v->span, it, 1); _pan_item_select(v->span, it, 1);
evry_item_select(v->state, it->item); evry_item_select(s, it->item);
} }
goto end; goto end;
} }
@ -1142,7 +1137,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
if (it) if (it)
{ {
_pan_item_select(v->span, it, 1); _pan_item_select(v->span, it, 1);
evry_item_select(v->state, it->item); evry_item_select(s, it->item);
} }
goto end; goto end;
} }
@ -1168,7 +1163,7 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev)
if (it) if (it)
{ {
_pan_item_select(v->span, it, 1); _pan_item_select(v->span, it, 1);
evry_item_select(v->state, it->item); evry_item_select(s, it->item);
} }
goto end; goto end;
} }
@ -1245,7 +1240,8 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow)
v->mode = evry_conf->view_mode; v->mode = evry_conf->view_mode;
else else
v->mode = parent->mode; v->mode = parent->mode;
v->mode_prev = v->mode;
v->zoom = parent->zoom; v->zoom = parent->zoom;
v->bg = edje_object_add(v->evas); v->bg = edje_object_add(v->evas);
@ -1311,7 +1307,7 @@ view_thumb_init(void)
v->view.update = &_view_update; v->view.update = &_view_update;
v->view.clear = &_view_clear; v->view.clear = &_view_clear;
v->view.cb_key_down = &_cb_key_down; v->view.cb_key_down = &_cb_key_down;
v->mode = -1; v->mode = VIEW_MODE_NONE;
evry_view_register(EVRY_VIEW(v), 1); evry_view_register(EVRY_VIEW(v), 1);

View File

@ -88,7 +88,7 @@ _tabs_update(Tab_View *v)
o = edje_object_add(v->evas); o = edje_object_add(v->evas);
e_theme_edje_object_set(o, "base/theme/everything", e_theme_edje_object_set(o, "base/theme/everything",
"e/modules/everything/tab_item"); "e/modules/everything/tab_item");
edje_object_part_text_set(o, "e.text.label", p->name); edje_object_part_text_set(o, "e.text.label", p->label);
tab->o_tab = o; tab->o_tab = o;
@ -184,7 +184,7 @@ _plugin_next_by_name(Tab_View *v, const char *key)
EINA_LIST_FOREACH(s->cur_plugins, l, p) EINA_LIST_FOREACH(s->cur_plugins, l, p)
{ {
if (p->name && (!strncasecmp(p->name, key, 1))) if (p->label && (!strncasecmp(p->label, key, 1)))
{ {
if (!first) first = p; if (!first) first = p;