From 4b5ce1b90a84f32d43b5a2706de3361c819afdf6 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Tue, 20 Apr 2010 15:22:01 +0000 Subject: [PATCH] 'everything' - let plugins store simple config data - fix apps 'open with' bug SVN revision: 48162 --- src/modules/everything-apps/e_mod_main.c | 11 ++++-- src/modules/everything/Evry.h | 49 ++++++++++++++---------- src/modules/everything/e_mod_main.c | 31 ++++++++++----- src/modules/everything/evry.c | 24 +++++++----- 4 files changed, 73 insertions(+), 42 deletions(-) diff --git a/src/modules/everything-apps/e_mod_main.c b/src/modules/everything-apps/e_mod_main.c index bbec42f79..afa359614 100644 --- a/src/modules/everything-apps/e_mod_main.c +++ b/src/modules/everything-apps/e_mod_main.c @@ -290,10 +290,15 @@ _item_add(Plugin *p, Efreet_Desktop *desktop, const char *file, int match) } if (desktop) - exe = desktop->exec; + { + file = NULL; + exe = desktop->exec; + } else - exe = file; - + { + exe = file; + } + if (!exe) return NULL; if ((app = eina_hash_find(p->added, exe))) diff --git a/src/modules/everything/Evry.h b/src/modules/everything/Evry.h index 59e4001a6..e610a6152 100644 --- a/src/modules/everything/Evry.h +++ b/src/modules/everything/Evry.h @@ -45,11 +45,12 @@ typedef struct _Evry_Item_File Evry_Item_File; typedef struct _Evry_Action Evry_Action; typedef struct _Evry_State Evry_State; typedef struct _Evry_View Evry_View; -typedef struct _Plugin_Config Plugin_Config; typedef struct _History Evry_History; typedef struct _History_Entry History_Entry; typedef struct _History_Item History_Item; typedef struct _Config Evry_Config; +typedef struct _Plugin_Config Plugin_Config; +typedef struct _Plugin_Setting Plugin_Setting; #define EVRY_ITEM(_item) ((Evry_Item *)_item) @@ -86,25 +87,6 @@ typedef struct _Config Evry_Config; evry_plugin_free(EVRY_PLUGIN(_p), 0); \ E_FREE(_p); - -struct _Plugin_Config -{ - const char *name; - - int loaded; - int enabled; - - /* minimum input chars to query this source */ - int min_query; - - int priority; - - const char *trigger; - - Evry_Plugin *plugin; -}; - - struct _Evry_Item { /* label to show for this item */ @@ -364,6 +346,33 @@ struct _Config int min_w, min_h; }; +struct _Plugin_Config +{ + const char *name; + + int loaded; + int enabled; + + /* minimum input chars to query this source */ + int min_query; + + int priority; + + const char *trigger; + + Evry_Plugin *plugin; + + Eina_Hash *settings; +}; + +struct _Plugin_Setting +{ + int type; + char *description; + + char *val; +}; + struct _History_Entry { Eina_List *items; diff --git a/src/modules/everything/e_mod_main.c b/src/modules/everything/e_mod_main.c index 61a22fb95..84a25c6ff 100644 --- a/src/modules/everything/e_mod_main.c +++ b/src/modules/everything/e_mod_main.c @@ -27,7 +27,8 @@ static E_Action *act = NULL; /* static Eina_Array *plugins = NULL; */ static E_Config_DD *conf_edd = NULL; -static E_Config_DD *conf_item_edd = NULL; +static E_Config_DD *plugin_conf_edd = NULL; +static E_Config_DD *plugin_setting_edd = NULL; EAPI int _e_module_evry_log_dom = -1; @@ -147,9 +148,9 @@ e_modapi_shutdown(E_Module *m __UNUSED__) evry_history_free(); /* Clean EET */ - E_CONFIG_DD_FREE(conf_item_edd); E_CONFIG_DD_FREE(conf_edd); - + E_CONFIG_DD_FREE(plugin_conf_edd); + E_CONFIG_DD_FREE(plugin_setting_edd); e_datastore_del("everything_loaded"); return 1; @@ -168,18 +169,28 @@ _config_init() { #undef T #undef D +#define T Plugin_Setting +#define D plugin_setting_edd + plugin_setting_edd = E_CONFIG_DD_NEW("Plugin_Setting", Plugin_Setting); + E_CONFIG_VAL(D, T, type, INT); + E_CONFIG_VAL(D, T, description, STR); + E_CONFIG_VAL(D, T, val, STR); +#undef T +#undef D + #define T Plugin_Config -#define D conf_item_edd - conf_item_edd = E_CONFIG_DD_NEW("Plugin_Config", Plugin_Config); +#define D plugin_conf_edd + plugin_conf_edd = E_CONFIG_DD_NEW("Plugin_Config", Plugin_Config); E_CONFIG_VAL(D, T, name, STR); E_CONFIG_VAL(D, T, trigger, STR); E_CONFIG_VAL(D, T, min_query, INT); E_CONFIG_VAL(D, T, loaded, INT); E_CONFIG_VAL(D, T, enabled, INT); E_CONFIG_VAL(D, T, priority, INT); + E_CONFIG_HASH(D, T, settings, plugin_setting_edd); #undef T #undef D - + #define T Evry_Config #define D conf_edd conf_edd = E_CONFIG_DD_NEW("Config", Evry_Config); @@ -199,10 +210,10 @@ _config_init() E_CONFIG_VAL(D, T, view_zoom, INT); E_CONFIG_VAL(D, T, cycle_mode, INT); E_CONFIG_VAL(D, T, history_sort_mode, INT); - E_CONFIG_LIST(D, T, conf_subjects, conf_item_edd); - E_CONFIG_LIST(D, T, conf_actions, conf_item_edd); - E_CONFIG_LIST(D, T, conf_objects, conf_item_edd); - E_CONFIG_LIST(D, T, conf_views, conf_item_edd); + E_CONFIG_LIST(D, T, conf_subjects, plugin_conf_edd); + E_CONFIG_LIST(D, T, conf_actions, plugin_conf_edd); + E_CONFIG_LIST(D, T, conf_objects, plugin_conf_edd); + E_CONFIG_LIST(D, T, conf_views, plugin_conf_edd); #undef T #undef D evry_conf = e_config_domain_load("module.everything", conf_edd); diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 71c3863aa..0fa768537 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -1309,16 +1309,24 @@ _evry_selectors_switch(void) static int _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) { - Ecore_Event_Key *ev; - Evry_State *s = selector->state; + Ecore_Event_Key *ev = event; + Evry_State *s; const char *key = NULL, *old; - if (!s) return 1; - - win->request_selection = EINA_FALSE; + if (ev->event_window != input_window) + return 1; - ev = event; - if (ev->event_window != input_window) return 1; + if (!strcmp(ev->key, "Escape")) + { + evry_hide(); + return 1; + } + + if (!selector || !selector->state) + return 1; + s = selector->state; + + win->request_selection = EINA_FALSE; old = ev->key; @@ -1497,8 +1505,6 @@ _evry_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) else /*if (!_evry_browse_item(selector))*/ _evry_plugin_action(selector, 1); } - else if (!strcmp(key, "Escape")) - evry_hide(); else if (!strcmp(key, "Tab")) _evry_selectors_switch(); else if (!strcmp(key, "BackSpace"))