2010-05-10 15:35:13 -07:00
|
|
|
#ifndef EVRY_TYPES_H
|
|
|
|
#define EVRY_TYPES_H
|
|
|
|
|
|
|
|
typedef struct _Evry_Plugin Evry_Plugin;
|
|
|
|
typedef struct _Plugin_Config Plugin_Config;
|
|
|
|
typedef struct _Evry_Item Evry_Item;
|
|
|
|
typedef struct _Evry_Item_App Evry_Item_App;
|
|
|
|
typedef struct _Evry_Item_File Evry_Item_File;
|
|
|
|
typedef struct _Evry_Action Evry_Action;
|
|
|
|
typedef struct _History_Item History_Item;
|
2010-05-11 10:24:38 -07:00
|
|
|
typedef struct _History_Entry History_Entry;
|
|
|
|
typedef struct _History_Types History_Types;
|
2010-05-19 07:44:36 -07:00
|
|
|
typedef struct _Evry_State Evry_State;
|
2010-05-10 15:35:13 -07:00
|
|
|
|
|
|
|
typedef unsigned int Evry_Type;
|
|
|
|
|
|
|
|
struct _Evry_Item
|
|
|
|
{
|
2011-02-20 23:49:21 -08:00
|
|
|
/* label to show for this item (stringshared) */
|
2010-05-10 15:35:13 -07:00
|
|
|
const char *label;
|
|
|
|
|
2011-02-20 23:49:21 -08:00
|
|
|
/* optional: (stringshared) more information to be shown */
|
2010-05-10 15:35:13 -07:00
|
|
|
const char *detail;
|
|
|
|
|
2011-02-20 23:49:21 -08:00
|
|
|
/* optional: (stringshared) fdo icon name, otherwise use _icon_get */
|
2010-05-10 15:35:13 -07:00
|
|
|
const char *icon;
|
|
|
|
|
|
|
|
/* item can be browsed, e.g. folders */
|
|
|
|
Eina_Bool browseable;
|
|
|
|
|
|
|
|
/* optional: for internally use by plugins */
|
|
|
|
void *data;
|
|
|
|
|
|
|
|
/* optional: priority hints for sorting */
|
|
|
|
int priority;
|
|
|
|
|
|
|
|
/* optional: store value of fuzzy match with input */
|
|
|
|
int fuzzy_match;
|
|
|
|
|
|
|
|
/* optional: plugin can set id to identify
|
|
|
|
* it in history otherwise label is used */
|
|
|
|
const char *id;
|
|
|
|
|
|
|
|
/* optional: context provided by item. e.g. to remember which action
|
|
|
|
* was performed on a file with a specific mimetype */
|
|
|
|
const char *context;
|
|
|
|
|
|
|
|
/* is set to type of Evry_Plugin by default */
|
|
|
|
Evry_Type type;
|
|
|
|
|
|
|
|
/* optional */
|
|
|
|
Evry_Type subtype;
|
2010-05-20 08:41:27 -07:00
|
|
|
|
2010-05-10 15:35:13 -07:00
|
|
|
Evas_Object *(*icon_get) (Evry_Item *it, Evas *e);
|
2010-05-13 15:27:57 -07:00
|
|
|
void (*free) (Evry_Item *it);
|
2010-05-10 15:35:13 -07:00
|
|
|
|
2011-02-20 23:49:21 -08:00
|
|
|
/* do not set! */
|
2010-05-20 08:41:27 -07:00
|
|
|
int ref;
|
|
|
|
Eina_List *items;
|
2010-05-10 15:35:13 -07:00
|
|
|
Eina_Bool selected;
|
|
|
|
Eina_Bool marked;
|
|
|
|
Evry_Plugin *plugin;
|
|
|
|
double usage;
|
|
|
|
History_Item *hi;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evry_Action
|
|
|
|
{
|
|
|
|
Evry_Item base;
|
|
|
|
|
|
|
|
/* identifier */
|
|
|
|
const char *name;
|
2011-02-20 23:49:21 -08:00
|
|
|
|
2010-05-10 15:35:13 -07:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
/* requested type for action */
|
|
|
|
Evry_Type type;
|
|
|
|
Evry_Type subtype;
|
|
|
|
/* handle multiple items */
|
|
|
|
Eina_Bool accept_list;
|
|
|
|
|
|
|
|
/* do not set ! */
|
|
|
|
const Evry_Item *item;
|
|
|
|
Eina_List *items;
|
|
|
|
} it1;
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
Evry_Type type;
|
|
|
|
Evry_Type subtype;
|
|
|
|
Eina_Bool accept_list;
|
|
|
|
|
|
|
|
/* do not set ! */
|
|
|
|
const Evry_Item *item;
|
|
|
|
Eina_List *items;
|
|
|
|
} it2;
|
|
|
|
|
|
|
|
|
|
|
|
/* optional: this action is specific for a item 'context'.
|
|
|
|
e.g. 'copy' for file mime-type is not, 'image viewer' is.
|
|
|
|
default is FALSE */
|
|
|
|
Eina_Bool remember_context;
|
|
|
|
|
2011-02-20 23:49:21 -08:00
|
|
|
/* required: do something */
|
2010-05-10 15:35:13 -07:00
|
|
|
int (*action) (Evry_Action *act);
|
|
|
|
|
|
|
|
/* optional: check whether action fits to chosen item */
|
|
|
|
int (*check_item) (Evry_Action *act, const Evry_Item *it);
|
|
|
|
/* optional */
|
|
|
|
void (*free) (Evry_Action *act);
|
2011-02-20 23:49:21 -08:00
|
|
|
/* optional: must be defined when action is browseable, return
|
|
|
|
list of Evry_Action items */
|
2010-05-10 15:35:13 -07:00
|
|
|
Eina_List *(*fetch) (Evry_Action *act);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evry_Item_App
|
|
|
|
{
|
|
|
|
Evry_Action base;
|
|
|
|
const char *file;
|
|
|
|
Efreet_Desktop *desktop;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evry_Item_File
|
|
|
|
{
|
|
|
|
Evry_Item base;
|
|
|
|
/* path and url must always be checked with
|
|
|
|
evry_file_path/uri_get before use !!! */
|
|
|
|
const char *url;
|
|
|
|
const char *path;
|
|
|
|
const char *mime;
|
2010-05-23 06:54:44 -07:00
|
|
|
|
|
|
|
unsigned int modified;
|
2010-05-10 15:35:13 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Evry_Plugin
|
|
|
|
{
|
|
|
|
Evry_Item base;
|
|
|
|
|
|
|
|
/* identifier */
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
/* list of items visible for everything after fetch */
|
|
|
|
Eina_List *items;
|
|
|
|
|
|
|
|
/* required: get candidates matching string, fill 'items' list */
|
|
|
|
int (*fetch) (Evry_Plugin *p, const char *input);
|
|
|
|
|
|
|
|
/* required: run when state is removed in which this plugin is
|
|
|
|
active. free 'items' here */
|
|
|
|
void (*finish) (Evry_Plugin *p);
|
|
|
|
|
2010-06-04 12:32:59 -07:00
|
|
|
/* plugin is added to the list of current plugins and
|
|
|
|
queried for results when not returning NULL. The previous
|
2010-05-10 15:35:13 -07:00
|
|
|
selectors item is passed, i.e. a plugin registered as action
|
|
|
|
receives the subject, a plugin registered as object receives the
|
|
|
|
action item. here you can check wheter the plugin can be queried,
|
|
|
|
for given context (provided by item) */
|
|
|
|
Evry_Plugin *(*begin) (Evry_Plugin *p, const Evry_Item *item);
|
|
|
|
|
|
|
|
/* optional: provide a list of subitems of 'item'. this function
|
|
|
|
must return a new instance which must be freed in 'finish' */
|
|
|
|
Evry_Plugin *(*browse) (Evry_Plugin *p, const Evry_Item *item);
|
|
|
|
|
|
|
|
/* optional: try to complete current item:
|
|
|
|
return: EVRY_COMPLETE_INPUT when input was changed
|
|
|
|
return: EVRY_COMPLETE_BROWSE to browse item */
|
|
|
|
int (*complete) (Evry_Plugin *p, const Evry_Item *item, char **input);
|
|
|
|
|
|
|
|
/* optional: handle key events: return positive when key was
|
|
|
|
handled */
|
|
|
|
int (*cb_key_down) (Evry_Plugin *p, const Ecore_Event_Key *ev);
|
|
|
|
|
|
|
|
/* optional: use this when begin returned a new instance or you
|
|
|
|
have extended plugin struct */
|
|
|
|
void (*free) (Evry_Plugin *p);
|
|
|
|
|
2010-05-23 00:35:48 -07:00
|
|
|
/* optiona: actions only used with this plugin, dont require */
|
|
|
|
Eina_List *actions;
|
|
|
|
|
2010-05-20 08:41:27 -07:00
|
|
|
/* optional: set type which the plugin can handle in begin */
|
|
|
|
Evry_Type input_type;
|
|
|
|
|
2010-05-10 15:35:13 -07:00
|
|
|
/* optional: whether the plugin uses evry_async_update to add new items */
|
|
|
|
/* default FALSE */
|
|
|
|
Eina_Bool async_fetch;
|
|
|
|
|
|
|
|
/* optional: request items to be remembered for usage statistic */
|
|
|
|
/* default TRUE */
|
|
|
|
Eina_Bool history;
|
|
|
|
|
|
|
|
/* optional: if transient, item is removed from history on cleanup */
|
|
|
|
/* default FALSE */
|
|
|
|
Eina_Bool transient;
|
|
|
|
|
|
|
|
/* optional: config path registered for the module, to show
|
|
|
|
'configure' button in everything config */
|
|
|
|
const char *config_path;
|
|
|
|
|
2010-05-11 19:01:09 -07:00
|
|
|
/* set theme file to fetch icons from */
|
|
|
|
const char *theme_path;
|
2010-05-13 15:27:57 -07:00
|
|
|
|
2010-05-10 15:35:13 -07:00
|
|
|
/* not to be set by plugin! */
|
|
|
|
Plugin_Config *config;
|
|
|
|
unsigned int request;
|
2010-05-19 07:44:36 -07:00
|
|
|
Evry_State *state;
|
2010-05-10 15:35:13 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _Plugin_Config
|
|
|
|
{
|
|
|
|
/* do not set! */
|
|
|
|
const char *name;
|
|
|
|
int enabled;
|
|
|
|
|
|
|
|
/* request initial sort order of this plugin */
|
|
|
|
int priority;
|
|
|
|
|
|
|
|
/* trigger to show plugin exclusively */
|
|
|
|
const char *trigger;
|
|
|
|
|
|
|
|
/* only show plugin when triggered */
|
|
|
|
int trigger_only;
|
|
|
|
|
|
|
|
/* preffered view mode */
|
|
|
|
int view_mode;
|
|
|
|
|
|
|
|
/* minimum input char to start query items,
|
|
|
|
this must be handled by plugin */
|
|
|
|
int min_query;
|
|
|
|
|
|
|
|
/* show items of plugin in aggregator */
|
|
|
|
int aggregate;
|
|
|
|
|
|
|
|
/* if not top-level the plugin is shown in aggregator
|
|
|
|
instead of the items */
|
|
|
|
int top_level;
|
|
|
|
|
|
|
|
/* Eina_Hash *settings; */
|
|
|
|
|
|
|
|
/* do not set! */
|
|
|
|
Evry_Plugin *plugin;
|
2010-05-28 13:32:07 -07:00
|
|
|
|
|
|
|
Eina_List *plugins;
|
2010-05-10 15:35:13 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _History_Item
|
|
|
|
{
|
|
|
|
const char *plugin;
|
|
|
|
const char *context;
|
|
|
|
const char *input;
|
|
|
|
double last_used;
|
|
|
|
double usage;
|
|
|
|
int count;
|
|
|
|
int transient;
|
|
|
|
const char *data;
|
|
|
|
};
|
|
|
|
|
2010-05-11 10:24:38 -07:00
|
|
|
struct _History_Entry
|
|
|
|
{
|
|
|
|
Eina_List *items;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _History_Types
|
|
|
|
{
|
|
|
|
Eina_Hash *types;
|
|
|
|
};
|
|
|
|
|
2010-05-10 15:35:13 -07:00
|
|
|
#endif
|