ATTN: JEFFDAMETH!

YOUR CODE FORMATTING IS BROKEN! PLEASE FIX THIS IN YOUR EDITOR ASAP!


SVN revision: 65704
This commit is contained in:
Mike Blumenkrantz 2011-11-30 03:32:54 +00:00
parent 03411559de
commit 0cc0f8c658
21 changed files with 4939 additions and 4885 deletions

View File

@ -1,14 +1,14 @@
#include "e_mod_main.h" #include "e_mod_main.h"
static void _e_mod_action_cb(E_Object *obj, const char *params); static void _e_mod_action_cb(E_Object *obj, const char *params);
static void _e_mod_action_cb_edge(E_Object *obj, const char *params, E_Event_Zone_Edge *ev); static void _e_mod_action_cb_edge(E_Object *obj, const char *params, E_Event_Zone_Edge *ev);
static Eina_Bool _e_mod_run_defer_cb(void *data); static Eina_Bool _e_mod_run_defer_cb(void *data);
static void _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_mod_menu_add(void *data, E_Menu *m); static void _e_mod_menu_add(void *data, E_Menu *m);
static void _config_init(void); static void _config_init(void);
static void _config_free(void); static void _config_free(void);
static Eina_Bool _cleanup_history(void *data); static Eina_Bool _cleanup_history(void *data);
static void _evry_type_init(const char *type); static void _evry_type_init(const char *type);
static Eina_List *_evry_types = NULL; static Eina_List *_evry_types = NULL;
static E_Int_Menu_Augmentation *maug = NULL; static E_Int_Menu_Augmentation *maug = NULL;
static E_Action *act = NULL; static E_Action *act = NULL;
@ -26,10 +26,10 @@ E_Module *_mod_evry = NULL;
/* module setup */ /* module setup */
EAPI E_Module_Api e_modapi = EAPI E_Module_Api e_modapi =
{ {
E_MODULE_API_VERSION, E_MODULE_API_VERSION,
"Everything" "Everything"
}; };
EAPI void * EAPI void *
e_modapi_init(E_Module *m) e_modapi_init(E_Module *m)
@ -39,13 +39,13 @@ e_modapi_init(E_Module *m)
char buf[4096]; char buf[4096];
_e_module_evry_log_dom = eina_log_domain_register _e_module_evry_log_dom = eina_log_domain_register
("e_module_everything", EINA_LOG_DEFAULT_COLOR); ("e_module_everything", EINA_LOG_DEFAULT_COLOR);
if(_e_module_evry_log_dom < 0) if (_e_module_evry_log_dom < 0)
{ {
EINA_LOG_ERR EINA_LOG_ERR
("impossible to create a log domain for everything module"); ("impossible to create a log domain for everything module");
return NULL; return NULL;
} }
_mod_evry = m; _mod_evry = m;
@ -54,26 +54,26 @@ e_modapi_init(E_Module *m)
act = e_action_add("everything"); act = e_action_add("everything");
if (act) if (act)
{ {
act->func.go = _e_mod_action_cb; act->func.go = _e_mod_action_cb;
act->func.go_edge = _e_mod_action_cb_edge; act->func.go_edge = _e_mod_action_cb_edge;
e_action_predef_name_set e_action_predef_name_set
(_("Everything Launcher"), (_("Everything Launcher"),
_("Show Everything Launcher"), _("Show Everything Launcher"),
"everything", "", NULL, 0); "everything", "", NULL, 0);
} }
maug = e_int_menus_menu_augmentation_add maug = e_int_menus_menu_augmentation_add
("main/1", _e_mod_menu_add, NULL, NULL, NULL); ("main/1", _e_mod_menu_add, NULL, NULL, NULL);
e_configure_registry_category_add e_configure_registry_category_add
("launcher", 80, _("Launcher"), NULL, "modules-launcher"); ("launcher", 80, _("Launcher"), NULL, "modules-launcher");
snprintf(buf, sizeof(buf), "%s/e-module-everything.edj", e_module_dir_get(m)); snprintf(buf, sizeof(buf), "%s/e-module-everything.edj", e_module_dir_get(m));
module_icon = eina_stringshare_add(buf); module_icon = eina_stringshare_add(buf);
e_configure_registry_item_add e_configure_registry_item_add
("launcher/run_everything", 40, _("Everything Configuration"), ("launcher/run_everything", 40, _("Everything Configuration"),
NULL, module_icon, evry_config_dialog); NULL, module_icon, evry_config_dialog);
evry_init(); evry_init();
_evry_type_init("NONE"); _evry_type_init("NONE");
@ -86,13 +86,13 @@ e_modapi_init(E_Module *m)
_evry_type_init("TEXT"); _evry_type_init("TEXT");
_config_init(); _config_init();
_evry_events[EVRY_EVENT_ITEMS_UPDATE] = ecore_event_type_new(); _evry_events[EVRY_EVENT_ITEMS_UPDATE] = ecore_event_type_new();
_evry_events[EVRY_EVENT_ITEM_SELECTED] = ecore_event_type_new(); _evry_events[EVRY_EVENT_ITEM_SELECTED] = ecore_event_type_new();
_evry_events[EVRY_EVENT_ITEM_CHANGED] = ecore_event_type_new(); _evry_events[EVRY_EVENT_ITEM_CHANGED] = ecore_event_type_new();
_evry_events[EVRY_EVENT_ACTION_PERFORMED] = ecore_event_type_new(); _evry_events[EVRY_EVENT_ACTION_PERFORMED] = ecore_event_type_new();
_evry_events[EVRY_EVENT_PLUGIN_SELECTED] = ecore_event_type_new(); _evry_events[EVRY_EVENT_PLUGIN_SELECTED] = ecore_event_type_new();
evry = E_NEW(Evry_API, 1); evry = E_NEW(Evry_API, 1);
evry->log_dom = _e_module_evry_log_dom; evry->log_dom = _e_module_evry_log_dom;
#define SET(func) (evry->func = &evry_##func); #define SET(func) (evry->func = &evry_##func);
@ -140,7 +140,7 @@ e_modapi_init(E_Module *m)
evry_plug_calc_init(m); evry_plug_calc_init(m);
e_datastore_set("evry_api", evry); e_datastore_set("evry_api", evry);
EINA_LIST_FOREACH(e_datastore_get("evry_modules"), l, em) EINA_LIST_FOREACH (e_datastore_get("evry_modules"), l, em)
em->active = em->init(evry); em->active = em->init(evry);
evry_plug_collection_init(); evry_plug_collection_init();
@ -167,14 +167,14 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
Eina_List *l; Eina_List *l;
Evry_Module *em; Evry_Module *em;
EINA_LIST_FOREACH(e_datastore_get("evry_modules"), l, em) EINA_LIST_FOREACH (e_datastore_get("evry_modules"), l, em)
{ {
if (em->active) if (em->active)
em->shutdown(); em->shutdown();
em->active = EINA_FALSE; em->active = EINA_FALSE;
} }
evry_plug_apps_shutdown(); evry_plug_apps_shutdown();
evry_plug_files_shutdown(); evry_plug_files_shutdown();
evry_plug_settings_shutdown(); evry_plug_settings_shutdown();
@ -196,7 +196,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
_config_free(); _config_free();
evry_history_free(); evry_history_free();
EINA_LIST_FREE(_evry_types, t) EINA_LIST_FREE (_evry_types, t)
eina_stringshare_del(t); eina_stringshare_del(t);
e_configure_registry_item_del("launcher/run_everything"); e_configure_registry_item_del("launcher/run_everything");
@ -207,20 +207,20 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
if (act) if (act)
{ {
e_action_predef_name_del(_("Everything Launcher"), e_action_predef_name_del(_("Everything Launcher"),
_("Show Everything Dialog")); _("Show Everything Dialog"));
e_action_del("everything"); e_action_del("everything");
} }
if (maug) if (maug)
{ {
e_int_menus_menu_augmentation_del("main/1", maug); e_int_menus_menu_augmentation_del("main/1", maug);
maug = NULL; maug = NULL;
} }
if (module_icon) if (module_icon)
eina_stringshare_del(module_icon); eina_stringshare_del(module_icon);
/* Clean EET */ /* Clean EET */
E_CONFIG_DD_FREE(conf_edd); E_CONFIG_DD_FREE(conf_edd);
E_CONFIG_DD_FREE(plugin_conf_edd); E_CONFIG_DD_FREE(plugin_conf_edd);
@ -231,7 +231,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
#ifdef CHECK_REFS #ifdef CHECK_REFS
Evry_Item *it; Evry_Item *it;
EINA_LIST_FREE(_refd, it) EINA_LIST_FREE (_refd, it)
printf("%d %s\n", it->ref, it->label); printf("%d %s\n", it->ref, it->label);
#endif #endif
@ -250,19 +250,18 @@ e_modapi_save(E_Module *m __UNUSED__)
evry_plug_settings_save(); evry_plug_settings_save();
evry_plug_windows_save(); evry_plug_windows_save();
evry_plug_calc_save(); evry_plug_calc_save();
return 1; return 1;
} }
/***************************************************************************/ /***************************************************************************/
Ecore_Event_Handler * Ecore_Event_Handler *
evry_event_handler_add(int type, Eina_Bool (*func) (void *data, int type, void *event), const void *data) evry_event_handler_add(int type, Eina_Bool (*func)(void *data, int type, void *event), const void *data)
{ {
return ecore_event_handler_add(_evry_events[type], func, data); return ecore_event_handler_add(_evry_events[type], func, data);
} }
Evry_Type Evry_Type
evry_type_register(const char *type) evry_type_register(const char *type)
{ {
@ -271,16 +270,16 @@ evry_type_register(const char *type)
const char *i; const char *i;
Eina_List *l; Eina_List *l;
EINA_LIST_FOREACH(_evry_types, l, i) EINA_LIST_FOREACH (_evry_types, l, i)
{ {
if (i == t) break; if (i == t) break;
ret++; ret++;
} }
if(!l) if (!l)
{ {
_evry_types = eina_list_append(_evry_types, t); _evry_types = eina_list_append(_evry_types, t);
return ret; return ret;
} }
eina_stringshare_del(t); eina_stringshare_del(t);
@ -304,7 +303,8 @@ evry_type_get(Evry_Type type)
return ret; return ret;
} }
int evry_api_version_check(int version) int
evry_api_version_check(int version)
{ {
if (EVRY_API_VERSION == version) if (EVRY_API_VERSION == version)
return 1; return 1;
@ -314,7 +314,6 @@ int evry_api_version_check(int version)
return 0; return 0;
} }
static int static int
_evry_cb_view_sort(const void *data1, const void *data2) _evry_cb_view_sort(const void *data1, const void *data2)
{ {
@ -323,7 +322,6 @@ _evry_cb_view_sort(const void *data1, const void *data2)
return v1->priority - v2->priority; return v1->priority - v2->priority;
} }
void void
evry_view_register(Evry_View *view, int priority) evry_view_register(Evry_View *view, int priority)
{ {
@ -332,8 +330,8 @@ evry_view_register(Evry_View *view, int priority)
evry_conf->views = eina_list_append(evry_conf->views, view); evry_conf->views = eina_list_append(evry_conf->views, view);
evry_conf->views = eina_list_sort(evry_conf->views, evry_conf->views = eina_list_sort(evry_conf->views,
eina_list_count(evry_conf->views), eina_list_count(evry_conf->views),
_evry_cb_view_sort); _evry_cb_view_sort);
} }
void void
@ -411,86 +409,86 @@ _config_init()
E_CONFIG_LIST(D, T, conf_subjects, plugin_conf_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_actions, plugin_conf_edd);
E_CONFIG_LIST(D, T, conf_objects, plugin_conf_edd); E_CONFIG_LIST(D, T, conf_objects, plugin_conf_edd);
E_CONFIG_LIST(D, T, conf_views, plugin_conf_edd); E_CONFIG_LIST(D, T, conf_views, plugin_conf_edd);
E_CONFIG_LIST(D, T, collections, plugin_conf_edd); E_CONFIG_LIST(D, T, collections, plugin_conf_edd);
E_CONFIG_LIST(D, T, gadgets, gadget_conf_edd); E_CONFIG_LIST(D, T, gadgets, gadget_conf_edd);
E_CONFIG_VAL(D, T, first_run, UCHAR); E_CONFIG_VAL(D, T, first_run, UCHAR);
#undef T #undef T
#undef D #undef D
evry_conf = e_config_domain_load("module.everything", conf_edd); evry_conf = e_config_domain_load("module.everything", conf_edd);
if (evry_conf && !e_util_module_config_check(_("Everything Module"), if (evry_conf && !e_util_module_config_check(_("Everything Module"),
evry_conf->version, evry_conf->version,
MOD_CONFIG_FILE_VERSION)) MOD_CONFIG_FILE_VERSION))
_config_free(); _config_free();
if (!evry_conf) if (!evry_conf)
{ {
evry_conf = E_NEW(Evry_Config, 1); evry_conf = E_NEW(Evry_Config, 1);
evry_conf->version = (MOD_CONFIG_FILE_EPOCH << 16); evry_conf->version = (MOD_CONFIG_FILE_EPOCH << 16);
} }
#define IFMODCFG(v) if ((evry_conf->version & 0xffff) < v) { #define IFMODCFG(v) if ((evry_conf->version & 0xffff) < v) {
#define IFMODCFGEND } #define IFMODCFGEND }
/* setup defaults */ /* setup defaults */
IFMODCFG(0x0001); IFMODCFG(0x0001);
evry_conf->rel_x = 0.5; evry_conf->rel_x = 0.5;
evry_conf->rel_y = 0.43; evry_conf->rel_y = 0.43;
evry_conf->width = 455; evry_conf->width = 455;
evry_conf->height = 430; evry_conf->height = 430;
evry_conf->scroll_animate = 1; evry_conf->scroll_animate = 1;
evry_conf->scroll_speed = 10.0; evry_conf->scroll_speed = 10.0;
evry_conf->hide_input = 0; evry_conf->hide_input = 0;
evry_conf->hide_list = 0; evry_conf->hide_list = 0;
evry_conf->quick_nav = 1; evry_conf->quick_nav = 1;
evry_conf->view_mode = VIEW_MODE_DETAIL; evry_conf->view_mode = VIEW_MODE_DETAIL;
evry_conf->view_zoom = 0; evry_conf->view_zoom = 0;
evry_conf->cycle_mode = 0; evry_conf->cycle_mode = 0;
evry_conf->history_sort_mode = 0; evry_conf->history_sort_mode = 0;
evry_conf->edge_width = 340; evry_conf->edge_width = 340;
evry_conf->edge_height = 385; evry_conf->edge_height = 385;
evry_conf->first_run = EINA_TRUE; evry_conf->first_run = EINA_TRUE;
pcc = E_NEW(Plugin_Config, 1); pcc = E_NEW(Plugin_Config, 1);
pcc->name = eina_stringshare_add("Start"); pcc->name = eina_stringshare_add("Start");
pcc->enabled = EINA_FALSE; pcc->enabled = EINA_FALSE;
pcc->aggregate = EINA_FALSE; pcc->aggregate = EINA_FALSE;
pcc->top_level = EINA_TRUE; pcc->top_level = EINA_TRUE;
pcc->view_mode = VIEW_MODE_THUMB; pcc->view_mode = VIEW_MODE_THUMB;
evry_conf->collections = eina_list_append(evry_conf->collections, pcc); evry_conf->collections = eina_list_append(evry_conf->collections, pcc);
pc = E_NEW(Plugin_Config, 1); pc = E_NEW(Plugin_Config, 1);
pc->name = eina_stringshare_add("Windows"); pc->name = eina_stringshare_add("Windows");
pc->enabled = EINA_TRUE; pc->enabled = EINA_TRUE;
pc->view_mode = VIEW_MODE_NONE; pc->view_mode = VIEW_MODE_NONE;
pcc->plugins = eina_list_append(pcc->plugins, pc); pcc->plugins = eina_list_append(pcc->plugins, pc);
pc = E_NEW(Plugin_Config, 1); pc = E_NEW(Plugin_Config, 1);
pc->name = eina_stringshare_add("Settings"); pc->name = eina_stringshare_add("Settings");
pc->enabled = EINA_TRUE; pc->enabled = EINA_TRUE;
pc->view_mode = VIEW_MODE_NONE; pc->view_mode = VIEW_MODE_NONE;
pcc->plugins = eina_list_append(pcc->plugins, pc); pcc->plugins = eina_list_append(pcc->plugins, pc);
pc = E_NEW(Plugin_Config, 1); pc = E_NEW(Plugin_Config, 1);
pc->name = eina_stringshare_add("Files"); pc->name = eina_stringshare_add("Files");
pc->enabled = EINA_TRUE; pc->enabled = EINA_TRUE;
pc->view_mode = VIEW_MODE_NONE; pc->view_mode = VIEW_MODE_NONE;
pcc->plugins = eina_list_append(pcc->plugins, pc); pcc->plugins = eina_list_append(pcc->plugins, pc);
pc = E_NEW(Plugin_Config, 1); pc = E_NEW(Plugin_Config, 1);
pc->name = eina_stringshare_add("Applications"); pc->name = eina_stringshare_add("Applications");
pc->enabled = EINA_TRUE; pc->enabled = EINA_TRUE;
pc->view_mode = VIEW_MODE_NONE; pc->view_mode = VIEW_MODE_NONE;
pcc->plugins = eina_list_append(pcc->plugins, pc); pcc->plugins = eina_list_append(pcc->plugins, pc);
IFMODCFGEND; IFMODCFGEND;
IFMODCFG(0x0003); IFMODCFG(0x0003);
evry_conf->width = 464; evry_conf->width = 464;
evry_conf->height = 366; evry_conf->height = 366;
IFMODCFGEND; IFMODCFGEND;
evry_conf->version = MOD_CONFIG_FILE_VERSION; evry_conf->version = MOD_CONFIG_FILE_VERSION;
} }
static void static void
@ -498,37 +496,37 @@ _config_free(void)
{ {
Plugin_Config *pc, *pc2; Plugin_Config *pc, *pc2;
Gadget_Config *gc; Gadget_Config *gc;
EINA_LIST_FREE(evry_conf->collections, pc) EINA_LIST_FREE (evry_conf->collections, pc)
EINA_LIST_FREE(pc->plugins, pc2) EINA_LIST_FREE (pc->plugins, pc2)
{
IF_RELEASE(pc2->name);
IF_RELEASE(pc2->trigger);
E_FREE(pc2);
}
EINA_LIST_FREE (evry_conf->conf_subjects, pc)
{ {
IF_RELEASE(pc2->name); IF_RELEASE(pc->name);
IF_RELEASE(pc2->trigger); IF_RELEASE(pc->trigger);
E_FREE(pc2); E_FREE(pc);
} }
EINA_LIST_FREE(evry_conf->conf_subjects, pc) EINA_LIST_FREE (evry_conf->conf_actions, pc)
{ {
IF_RELEASE(pc->name); IF_RELEASE(pc->name);
IF_RELEASE(pc->trigger); IF_RELEASE(pc->trigger);
E_FREE(pc); E_FREE(pc);
} }
EINA_LIST_FREE(evry_conf->conf_actions, pc) EINA_LIST_FREE (evry_conf->conf_objects, pc)
{ {
IF_RELEASE(pc->name); IF_RELEASE(pc->name);
IF_RELEASE(pc->trigger); IF_RELEASE(pc->trigger);
E_FREE(pc); E_FREE(pc);
} }
EINA_LIST_FREE(evry_conf->conf_objects, pc) EINA_LIST_FREE (evry_conf->gadgets, gc)
{ {
IF_RELEASE(pc->name); IF_RELEASE(gc->id);
IF_RELEASE(pc->trigger); IF_RELEASE(gc->plugin);
E_FREE(pc); E_FREE(gc);
}
EINA_LIST_FREE(evry_conf->gadgets, gc)
{
IF_RELEASE(gc->id);
IF_RELEASE(gc->plugin);
E_FREE(gc);
} }
E_FREE(evry_conf); E_FREE(evry_conf);
@ -559,14 +557,14 @@ _e_mod_action_cb(E_Object *obj, const char *params)
if (obj) if (obj)
{ {
if (obj->type == E_MANAGER_TYPE) if (obj->type == E_MANAGER_TYPE)
zone = e_util_zone_current_get((E_Manager *)obj); zone = e_util_zone_current_get((E_Manager *)obj);
else if (obj->type == E_CONTAINER_TYPE) else if (obj->type == E_CONTAINER_TYPE)
zone = e_util_zone_current_get(((E_Container *)obj)->manager); zone = e_util_zone_current_get(((E_Container *)obj)->manager);
else if (obj->type == E_ZONE_TYPE) else if (obj->type == E_ZONE_TYPE)
zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager); zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager);
else else
zone = e_util_zone_current_get(e_manager_current_get()); zone = e_util_zone_current_get(e_manager_current_get());
} }
if (!zone) zone = e_util_zone_current_get(e_manager_current_get()); if (!zone) zone = e_util_zone_current_get(e_manager_current_get());
@ -578,7 +576,7 @@ _e_mod_action_cb(E_Object *obj, const char *params)
/* if (zone) evry_show(zone, _params); */ /* if (zone) evry_show(zone, _params); */
if (_idler) ecore_idle_enterer_del(_idler); if (_idler) ecore_idle_enterer_del(_idler);
_idler = ecore_idle_enterer_add(_e_mod_run_defer_cb, zone); _idler = ecore_idle_enterer_add(_e_mod_run_defer_cb, zone);
} }
static void static void
@ -612,3 +610,4 @@ _e_mod_menu_add(void *data __UNUSED__, E_Menu *m)
e_util_menu_item_theme_icon_set(mi, "system-run"); e_util_menu_item_theme_icon_set(mi, "system-run");
e_menu_item_callback_set(mi, _e_mod_run_cb, NULL); e_menu_item_callback_set(mi, _e_mod_run_cb, NULL);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,65 +1,64 @@
#include "e_mod_main.h" #include "e_mod_main.h"
static void *_create_data (E_Config_Dialog *cfd); static void *_create_data(E_Config_Dialog *cfd);
static void _free_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static int _basic_apply_data (E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
typedef struct _Plugin_Page Plugin_Page; typedef struct _Plugin_Page Plugin_Page;
struct _Plugin_Page struct _Plugin_Page
{ {
Evas_Object *list; Evas_Object *list;
Evas_Object *o_trigger; Evas_Object *o_trigger;
Evas_Object *o_trigger_only; Evas_Object *o_trigger_only;
E_Radio_Group *view_rg; E_Radio_Group *view_rg;
Evas_Object *o_view_default; Evas_Object *o_view_default;
Evas_Object *o_view_list; Evas_Object *o_view_list;
Evas_Object *o_view_detail; Evas_Object *o_view_detail;
Evas_Object *o_view_thumb; Evas_Object *o_view_thumb;
Evas_Object *o_enabled; Evas_Object *o_enabled;
Evas_Object *o_aggregate; Evas_Object *o_aggregate;
Evas_Object *o_top_level; Evas_Object *o_top_level;
Evas_Object *o_cfg_btn; Evas_Object *o_cfg_btn;
Evas_Object *o_min_query; Evas_Object *o_min_query;
Eina_List *configs; Eina_List *configs;
char *trigger; char *trigger;
int trigger_only; int trigger_only;
int view_mode; int view_mode;
int aggregate; int aggregate;
int top_level; int top_level;
int enabled; int enabled;
int min_query; int min_query;
Plugin_Config *cur; Plugin_Config *cur;
Eina_Bool collection; Eina_Bool collection;
}; };
struct _E_Config_Dialog_Data struct _E_Config_Dialog_Data
{ {
int hide_input; int hide_input;
int hide_list; int hide_list;
int quick_nav; int quick_nav;
int width, height; int width, height;
int edge_width, edge_height; int edge_width, edge_height;
double rel_x, rel_y; double rel_x, rel_y;
int scroll_animate; int scroll_animate;
double scroll_speed; double scroll_speed;
int view_mode; int view_mode;
int view_zoom; int view_zoom;
int cycle_mode; int cycle_mode;
int history_sort_mode; int history_sort_mode;
Plugin_Page page[3]; Plugin_Page page[3];
}; };
EAPI E_Config_Dialog * EAPI E_Config_Dialog *
evry_config_dialog(E_Container *con, const char *params __UNUSED__) evry_config_dialog(E_Container *con, const char *params __UNUSED__)
{ {
@ -76,9 +75,9 @@ evry_config_dialog(E_Container *con, const char *params __UNUSED__)
v->advanced.apply_cfdata = NULL; v->advanced.apply_cfdata = NULL;
v->advanced.create_widgets = NULL; v->advanced.create_widgets = NULL;
cfd = e_config_dialog_new(con, cfd = e_config_dialog_new(con,
_("Everything Settings"), _("Everything Settings"),
"E", "extensions/run_everything", "E", "extensions/run_everything",
"system-run", 0, v, NULL); "system-run", 0, v, NULL);
return cfd; return cfd;
} }
@ -153,31 +152,31 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
#undef C #undef C
if (evry_conf->conf_subjects) eina_list_free(evry_conf->conf_subjects); if (evry_conf->conf_subjects) eina_list_free(evry_conf->conf_subjects);
if (evry_conf->conf_actions) eina_list_free(evry_conf->conf_actions); if (evry_conf->conf_actions) eina_list_free(evry_conf->conf_actions);
if (evry_conf->conf_objects) eina_list_free(evry_conf->conf_objects); if (evry_conf->conf_objects) eina_list_free(evry_conf->conf_objects);
evry_conf->conf_subjects = eina_list_clone(cfdata->page[0].configs); evry_conf->conf_subjects = eina_list_clone(cfdata->page[0].configs);
evry_conf->conf_actions = eina_list_clone(cfdata->page[1].configs); evry_conf->conf_actions = eina_list_clone(cfdata->page[1].configs);
evry_conf->conf_objects = eina_list_clone(cfdata->page[2].configs); evry_conf->conf_objects = eina_list_clone(cfdata->page[2].configs);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
pc = cfdata->page[i].cur; pc = cfdata->page[i].cur;
if (pc) if (pc)
{ {
if (cfdata->page[i].trigger[0]) if (cfdata->page[i].trigger[0])
eina_stringshare_replace(&pc->trigger, cfdata->page[i].trigger); eina_stringshare_replace(&pc->trigger, cfdata->page[i].trigger);
else else
eina_stringshare_replace(&pc->trigger, NULL); eina_stringshare_replace(&pc->trigger, NULL);
pc->trigger_only = cfdata->page[i].trigger_only; pc->trigger_only = cfdata->page[i].trigger_only;
pc->view_mode = cfdata->page[i].view_mode; pc->view_mode = cfdata->page[i].view_mode;
pc->enabled = cfdata->page[i].enabled; pc->enabled = cfdata->page[i].enabled;
pc->aggregate = cfdata->page[i].aggregate; pc->aggregate = cfdata->page[i].aggregate;
pc->top_level = cfdata->page[i].top_level; pc->top_level = cfdata->page[i].top_level;
pc->min_query = cfdata->page[i].min_query; pc->min_query = cfdata->page[i].min_query;
} }
} }
e_config_save_queue(); e_config_save_queue();
@ -200,25 +199,25 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, int enabled __UNUSED__)
e_widget_ilist_freeze(obj); e_widget_ilist_freeze(obj);
e_widget_ilist_clear(obj); e_widget_ilist_clear(obj);
EINA_LIST_FOREACH(plugins, l, pc) EINA_LIST_FOREACH (plugins, l, pc)
{ {
/* if (!(end = edje_object_add(evas))) break; */ /* if (!(end = edje_object_add(evas))) break; */
if (!pc->plugin && strcmp(pc->name, "All")) if (!pc->plugin && strcmp(pc->name, "All"))
continue; continue;
/* if (e_theme_edje_object_set(end, "base/theme/widgets", /* if (e_theme_edje_object_set(end, "base/theme/widgets",
* "e/widgets/ilist/toggle_end")) * "e/widgets/ilist/toggle_end"))
* { * {
* char *sig = pc->plugin ? "e,state,checked" : "e,state,unchecked"; * char *sig = pc->plugin ? "e,state,checked" : "e,state,unchecked";
* edje_object_signal_emit(end, sig, "e"); * edje_object_signal_emit(end, sig, "e");
* } * }
* else * else
* { * {
* evas_object_del(end); * evas_object_del(end);
* end = NULL; * end = NULL;
* } */ * } */
e_widget_ilist_append(obj, NULL, pc->name, NULL, pc, NULL); e_widget_ilist_append(obj, NULL, pc->name, NULL, pc, NULL);
} }
e_widget_ilist_go(obj); e_widget_ilist_go(obj);
@ -241,23 +240,23 @@ _plugin_move(Plugin_Page *page, int dir)
/* keep 'All' alway at top */ /* keep 'All' alway at top */
((sel >= 1 && dir > 0) || (sel >= 2 && dir < 0))) ((sel >= 1 && dir > 0) || (sel >= 2 && dir < 0)))
{ {
Plugin_Config *pc, *pc2; Plugin_Config *pc, *pc2;
int prio = 0; int prio = 0;
pc = e_widget_ilist_nth_data_get(page->list, sel); pc = e_widget_ilist_nth_data_get(page->list, sel);
pc2 = e_widget_ilist_nth_data_get(page->list, sel + dir); pc2 = e_widget_ilist_nth_data_get(page->list, sel + dir);
l1 = eina_list_data_find_list(page->configs, pc); l1 = eina_list_data_find_list(page->configs, pc);
l2 = eina_list_data_find_list(page->configs, pc2); l2 = eina_list_data_find_list(page->configs, pc2);
if (!l1 || !l2) return; if (!l1 || !l2) return;
l1->data = pc2; l1->data = pc2;
l2->data = pc; l2->data = pc;
_fill_list(page->configs, page->list, 0); _fill_list(page->configs, page->list, 0);
e_widget_ilist_selected_set(page->list, sel + dir); e_widget_ilist_selected_set(page->list, sel + dir);
EINA_LIST_FOREACH(page->configs, l1, pc) EINA_LIST_FOREACH (page->configs, l1, pc)
pc->priority = prio++; pc->priority = prio++;
} }
} }
@ -274,7 +273,7 @@ _plugin_move_down_cb(void *data, void *data2 __UNUSED__)
} }
static void static void
_list_select_cb (void *data, Evas_Object *obj) _list_select_cb(void *data, Evas_Object *obj)
{ {
int sel = e_widget_ilist_selected_get(obj); int sel = e_widget_ilist_selected_get(obj);
Plugin_Config *pc = NULL; Plugin_Config *pc = NULL;
@ -282,62 +281,62 @@ _list_select_cb (void *data, Evas_Object *obj)
if (sel >= 0 && (pc = e_widget_ilist_nth_data_get(page->list, sel))) if (sel >= 0 && (pc = e_widget_ilist_nth_data_get(page->list, sel)))
{ {
e_widget_entry_text_set(page->o_trigger, pc->trigger); e_widget_entry_text_set(page->o_trigger, pc->trigger);
e_widget_disabled_set(page->o_trigger, 0); e_widget_disabled_set(page->o_trigger, 0);
e_widget_check_checked_set(page->o_trigger_only, pc->trigger_only); e_widget_check_checked_set(page->o_trigger_only, pc->trigger_only);
e_widget_disabled_set(page->o_trigger_only, 0); e_widget_disabled_set(page->o_trigger_only, 0);
e_widget_disabled_set(page->o_view_default, 0); e_widget_disabled_set(page->o_view_default, 0);
e_widget_disabled_set(page->o_view_detail, 0); e_widget_disabled_set(page->o_view_detail, 0);
e_widget_disabled_set(page->o_view_list, 0); e_widget_disabled_set(page->o_view_list, 0);
e_widget_disabled_set(page->o_view_thumb, 0); e_widget_disabled_set(page->o_view_thumb, 0);
if (pc->view_mode == -1) if (pc->view_mode == -1)
e_widget_radio_toggle_set(page->o_view_default, 1); e_widget_radio_toggle_set(page->o_view_default, 1);
else if (pc->view_mode == 0) else if (pc->view_mode == 0)
e_widget_radio_toggle_set(page->o_view_list, 1); e_widget_radio_toggle_set(page->o_view_list, 1);
else if (pc->view_mode == 1) else if (pc->view_mode == 1)
e_widget_radio_toggle_set(page->o_view_detail, 1); e_widget_radio_toggle_set(page->o_view_detail, 1);
else if (pc->view_mode == 2) else if (pc->view_mode == 2)
e_widget_radio_toggle_set(page->o_view_thumb, 1); e_widget_radio_toggle_set(page->o_view_thumb, 1);
e_widget_check_checked_set(page->o_enabled, pc->enabled); e_widget_check_checked_set(page->o_enabled, pc->enabled);
e_widget_disabled_set(page->o_enabled, 0); e_widget_disabled_set(page->o_enabled, 0);
e_widget_check_checked_set(page->o_aggregate, pc->aggregate); e_widget_check_checked_set(page->o_aggregate, pc->aggregate);
e_widget_disabled_set(page->o_aggregate, 0); e_widget_disabled_set(page->o_aggregate, 0);
e_widget_check_checked_set(page->o_top_level, pc->top_level); e_widget_check_checked_set(page->o_top_level, pc->top_level);
e_widget_disabled_set(page->o_top_level, 0); e_widget_disabled_set(page->o_top_level, 0);
e_widget_slider_value_int_set(page->o_min_query, pc->min_query); e_widget_slider_value_int_set(page->o_min_query, pc->min_query);
e_widget_disabled_set(page->o_min_query, 0); e_widget_disabled_set(page->o_min_query, 0);
if (pc->plugin && pc->plugin->config_path) if (pc->plugin && pc->plugin->config_path)
{ {
e_widget_disabled_set(page->o_cfg_btn, 0); e_widget_disabled_set(page->o_cfg_btn, 0);
} }
else else
{ {
e_widget_disabled_set(page->o_cfg_btn, 1); e_widget_disabled_set(page->o_cfg_btn, 1);
} }
page->cur = pc; page->cur = pc;
} }
else else
{ {
e_widget_entry_text_set(page->o_trigger, ""); e_widget_entry_text_set(page->o_trigger, "");
e_widget_disabled_set(page->o_trigger, 1); e_widget_disabled_set(page->o_trigger, 1);
e_widget_disabled_set(page->o_trigger_only, 1); e_widget_disabled_set(page->o_trigger_only, 1);
e_widget_disabled_set(page->o_view_default, 1); e_widget_disabled_set(page->o_view_default, 1);
e_widget_disabled_set(page->o_view_detail, 1); e_widget_disabled_set(page->o_view_detail, 1);
e_widget_disabled_set(page->o_view_list, 1); e_widget_disabled_set(page->o_view_list, 1);
e_widget_disabled_set(page->o_view_thumb, 1); e_widget_disabled_set(page->o_view_thumb, 1);
e_widget_disabled_set(page->o_enabled, 1); e_widget_disabled_set(page->o_enabled, 1);
e_widget_disabled_set(page->o_aggregate, 1); e_widget_disabled_set(page->o_aggregate, 1);
e_widget_disabled_set(page->o_top_level, 1); e_widget_disabled_set(page->o_top_level, 1);
e_widget_disabled_set(page->o_cfg_btn, 1); e_widget_disabled_set(page->o_cfg_btn, 1);
e_widget_disabled_set(page->o_min_query, 1); e_widget_disabled_set(page->o_min_query, 1);
page->cur = NULL; page->cur = NULL;
} }
} }
@ -351,8 +350,8 @@ _plugin_config_cb(void *data, void *data2 __UNUSED__)
printf(" %s\n", p->name); printf(" %s\n", p->name);
e_configure_registry_call(p->config_path, e_configure_registry_call(p->config_path,
e_container_current_get(e_manager_current_get()), e_container_current_get(e_manager_current_get()),
p->name); p->name);
} }
static Evas_Object * static Evas_Object *
@ -366,14 +365,14 @@ _create_plugin_page(E_Config_Dialog_Data *cfdata __UNUSED__, Evas *e, Plugin_Pag
page->list = e_widget_ilist_add(e, 24, 24, NULL); page->list = e_widget_ilist_add(e, 24, 24, NULL);
e_widget_on_change_hook_set(page->list, _list_select_cb, page); e_widget_on_change_hook_set(page->list, _list_select_cb, page);
_fill_list(page->configs, page->list, 0); _fill_list(page->configs, page->list, 0);
e_widget_frametable_object_append(of, page->list, 0, 0, 1, 1, 1, 1, 1, 1); e_widget_frametable_object_append(of, page->list, 0, 0, 1, 1, 1, 1, 1, 1);
o = e_widget_button_add(e, _("Move Up"), NULL, o = e_widget_button_add(e, _("Move Up"), NULL,
_plugin_move_up_cb, page, NULL); _plugin_move_up_cb, page, NULL);
e_widget_frametable_object_append(of, o, 0, 1, 1, 1, 1, 0, 1, 0); e_widget_frametable_object_append(of, o, 0, 1, 1, 1, 1, 0, 1, 0);
o = e_widget_button_add(e, _("Move Down"), NULL, o = e_widget_button_add(e, _("Move Down"), NULL,
_plugin_move_down_cb, page, NULL); _plugin_move_down_cb, page, NULL);
e_widget_frametable_object_append(of, o, 0, 2, 1, 1, 1, 0, 1, 0); e_widget_frametable_object_append(of, o, 0, 2, 1, 1, 1, 0, 1, 0);
e_widget_table_object_append(ob, of, 0, 0, 1, 3, 1, 1, 1, 0); e_widget_table_object_append(ob, of, 0, 0, 1, 3, 1, 1, 1, 0);
of = e_widget_framelist_add(e, _("General"), 0); of = e_widget_framelist_add(e, _("General"), 0);
@ -384,19 +383,19 @@ _create_plugin_page(E_Config_Dialog_Data *cfdata __UNUSED__, Evas *e, Plugin_Pag
e_widget_framelist_object_append(of, o); e_widget_framelist_object_append(of, o);
o = e_widget_check_add(e, _("Enabled"), o = e_widget_check_add(e, _("Enabled"),
&(page->enabled)); &(page->enabled));
e_widget_disabled_set(o, 1); e_widget_disabled_set(o, 1);
page->o_enabled = o; page->o_enabled = o;
e_widget_framelist_object_append(of, o); e_widget_framelist_object_append(of, o);
o = e_widget_check_add(e, _("Show in \"All\""), o = e_widget_check_add(e, _("Show in \"All\""),
&(page->aggregate)); &(page->aggregate));
e_widget_disabled_set(o, 1); e_widget_disabled_set(o, 1);
page->o_aggregate = o; page->o_aggregate = o;
e_widget_framelist_object_append(of, o); e_widget_framelist_object_append(of, o);
o = e_widget_check_add(e, _("Show in top-level"), o = e_widget_check_add(e, _("Show in top-level"),
&(page->top_level)); &(page->top_level));
e_widget_disabled_set(o, 1); e_widget_disabled_set(o, 1);
page->o_top_level = o; page->o_top_level = o;
e_widget_framelist_object_append(of, o); e_widget_framelist_object_append(of, o);
@ -404,7 +403,7 @@ _create_plugin_page(E_Config_Dialog_Data *cfdata __UNUSED__, Evas *e, Plugin_Pag
o = e_widget_label_add(e, _("Minimum characters for search")); o = e_widget_label_add(e, _("Minimum characters for search"));
e_widget_framelist_object_append(of, o); e_widget_framelist_object_append(of, o);
o = e_widget_slider_add(e, 1, 0, _("%1.0f"), 0, 5, 1.0, 0, NULL, o = e_widget_slider_add(e, 1, 0, _("%1.0f"), 0, 5, 1.0, 0, NULL,
&(page->min_query), 10); &(page->min_query), 10);
page->o_min_query = o; page->o_min_query = o;
e_widget_framelist_object_append(of, o); e_widget_framelist_object_append(of, o);
@ -416,7 +415,7 @@ _create_plugin_page(E_Config_Dialog_Data *cfdata __UNUSED__, Evas *e, Plugin_Pag
page->o_trigger = o; page->o_trigger = o;
e_widget_framelist_object_append(of, o); e_widget_framelist_object_append(of, o);
o = e_widget_check_add(e, _("Search only when triggered"), o = e_widget_check_add(e, _("Search only when triggered"),
&(page->trigger_only)); &(page->trigger_only));
e_widget_disabled_set(o, 1); e_widget_disabled_set(o, 1);
page->o_trigger_only = o; page->o_trigger_only = o;
e_widget_framelist_object_append(of, o); e_widget_framelist_object_append(of, o);
@ -427,19 +426,19 @@ _create_plugin_page(E_Config_Dialog_Data *cfdata __UNUSED__, Evas *e, Plugin_Pag
o = e_widget_radio_add(e, _("Default"), -1, rg); o = e_widget_radio_add(e, _("Default"), -1, rg);
e_widget_disabled_set(o, 1); e_widget_disabled_set(o, 1);
page->o_view_default = o; page->o_view_default = o;
e_widget_frametable_object_append(of, o, 0, 0, 1, 1, 1, 1, 0, 0); e_widget_frametable_object_append(of, o, 0, 0, 1, 1, 1, 1, 0, 0);
o = e_widget_radio_add(e, _("List"), 0, rg); o = e_widget_radio_add(e, _("List"), 0, rg);
e_widget_frametable_object_append(of, o, 0, 1, 1, 1, 1, 1, 0, 0); e_widget_frametable_object_append(of, o, 0, 1, 1, 1, 1, 1, 0, 0);
e_widget_disabled_set(o, 1); e_widget_disabled_set(o, 1);
page->o_view_list = o; page->o_view_list = o;
o = e_widget_radio_add(e, _("Detailed"), 1, rg); o = e_widget_radio_add(e, _("Detailed"), 1, rg);
e_widget_disabled_set(o, 1); e_widget_disabled_set(o, 1);
page->o_view_detail = o; page->o_view_detail = o;
e_widget_frametable_object_append(of, o, 1, 1, 1, 1, 1, 1, 0, 0); e_widget_frametable_object_append(of, o, 1, 1, 1, 1, 1, 1, 0, 0);
o = e_widget_radio_add(e, _("Icons"), 2, rg); o = e_widget_radio_add(e, _("Icons"), 2, rg);
e_widget_disabled_set(o, 1); e_widget_disabled_set(o, 1);
page->o_view_thumb = o; page->o_view_thumb = o;
e_widget_frametable_object_append(of, o, 1, 0, 1, 1, 1, 1, 0, 0); e_widget_frametable_object_append(of, o, 1, 0, 1, 1, 1, 1, 0, 0);
e_widget_table_object_append(ob, of, 1, 2, 1, 1, 1, 1, 1, 0); e_widget_table_object_append(ob, of, 1, 2, 1, 1, 1, 1, 1, 0);
return ob; return ob;
@ -466,29 +465,29 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdat
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_check_add(e, _("Animate scrolling"), ob = e_widget_check_add(e, _("Animate scrolling"),
&(cfdata->scroll_animate)); &(cfdata->scroll_animate));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
/* ob = e_widget_slider_add(e, 1, 0, _("%1.1f"), /* ob = e_widget_slider_add(e, 1, 0, _("%1.1f"),
* 5, 20, 0.1, 0, &(cfdata->scroll_speed), NULL, 10); * 5, 20, 0.1, 0, &(cfdata->scroll_speed), NULL, 10);
* e_widget_framelist_object_append(of, ob); */ * e_widget_framelist_object_append(of, ob); */
ob = e_widget_check_add(e, _("Up/Down select next item in icon view"), ob = e_widget_check_add(e, _("Up/Down select next item in icon view"),
&(cfdata->cycle_mode)); &(cfdata->cycle_mode));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 0, 1, 0); e_widget_table_object_append(o, of, 0, 0, 1, 1, 1, 0, 1, 0);
#if 0 #if 0
/* FIXME no theme supports this currently, need to add info to themes /* FIXME no theme supports this currently, need to add info to themes
data section to know whether this option should be enabled */ data section to know whether this option should be enabled */
cfdata->hide_input = 0; cfdata->hide_input = 0;
ob = e_widget_check_add(e, _("Hide input when inactive"), ob = e_widget_check_add(e, _("Hide input when inactive"),
&(cfdata->hide_input)); &(cfdata->hide_input));
e_widget_disabled_set(ob, 1); e_widget_disabled_set(ob, 1);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
cfdata->hide_list = 0; cfdata->hide_list = 0;
ob = e_widget_check_add(e, _("Hide list"), ob = e_widget_check_add(e, _("Hide list"),
&(cfdata->hide_list)); &(cfdata->hide_list));
e_widget_disabled_set(ob, 1); e_widget_disabled_set(ob, 1);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
#endif #endif
of = e_widget_framelist_add(e, _("Quick Navigation"), 0); of = e_widget_framelist_add(e, _("Quick Navigation"), 0);
@ -518,25 +517,25 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdat
e_widget_table_object_append(o, of, 0, 2, 1, 1, 1, 0, 1, 0); e_widget_table_object_append(o, of, 0, 2, 1, 1, 1, 0, 1, 0);
e_widget_toolbook_page_append(otb, NULL, _("General Settings"), e_widget_toolbook_page_append(otb, NULL, _("General Settings"),
o, 1, 0, 1, 0, 0.5, 0.0); o, 1, 0, 1, 0, 0.5, 0.0);
/// PLUGINS /// /// PLUGINS ///
otb2 = e_widget_toolbook_add(e, 48 * e_scale, 48 * e_scale); otb2 = e_widget_toolbook_add(e, 48 * e_scale, 48 * e_scale);
ob = _create_plugin_page(cfdata, e, &cfdata->page[0]); ob = _create_plugin_page(cfdata, e, &cfdata->page[0]);
e_widget_toolbook_page_append(otb2, NULL, _("Subject Plugins"), e_widget_toolbook_page_append(otb2, NULL, _("Subject Plugins"),
ob, 1, 0, 1, 0, 0.5, 0.0); ob, 1, 0, 1, 0, 0.5, 0.0);
ob = _create_plugin_page(cfdata, e, &cfdata->page[1]); ob = _create_plugin_page(cfdata, e, &cfdata->page[1]);
e_widget_toolbook_page_append(otb2, NULL, _("Action Plugins"), e_widget_toolbook_page_append(otb2, NULL, _("Action Plugins"),
ob, 1, 0, 1, 0, 0.5, 0.0); ob, 1, 0, 1, 0, 0.5, 0.0);
ob = _create_plugin_page(cfdata, e, &cfdata->page[2]); ob = _create_plugin_page(cfdata, e, &cfdata->page[2]);
e_widget_toolbook_page_append(otb2, NULL, _("Object Plugins"), e_widget_toolbook_page_append(otb2, NULL, _("Object Plugins"),
ob, 1, 0, 1, 0, 0.5, 0.0); ob, 1, 0, 1, 0, 0.5, 0.0);
e_widget_toolbook_page_append(otb, NULL, _("Plugins"), e_widget_toolbook_page_append(otb, NULL, _("Plugins"),
otb2, 1, 0, 1, 0, 0.5, 0.0); otb2, 1, 0, 1, 0, 0.5, 0.0);
e_widget_toolbook_page_show(otb2, 0); e_widget_toolbook_page_show(otb2, 0);
@ -546,15 +545,15 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdat
ob = e_widget_label_add(e, _("Popup Width")); ob = e_widget_label_add(e, _("Popup Width"));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(e, 1, 0, _("%1.0f"), ob = e_widget_slider_add(e, 1, 0, _("%1.0f"),
evry_conf->min_w, 800, 1, 0, NULL, evry_conf->min_w, 800, 1, 0, NULL,
&(cfdata->width), 200); &(cfdata->width), 200);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(e, _("Popup Height")); ob = e_widget_label_add(e, _("Popup Height"));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(e, 1, 0, _("%1.0f"), ob = e_widget_slider_add(e, 1, 0, _("%1.0f"),
evry_conf->min_h, 800, 1, 0, NULL, evry_conf->min_h, 800, 1, 0, NULL,
&(cfdata->height), 200); &(cfdata->height), 200);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5); e_widget_list_object_append(o, of, 1, 1, 0.5);
@ -562,15 +561,15 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdat
ob = e_widget_label_add(e, _("Vertical")); ob = e_widget_label_add(e, _("Vertical"));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(e, 1, 0, _("%1.2f"), ob = e_widget_slider_add(e, 1, 0, _("%1.2f"),
0.0, 1.0, 0.01, 0, 0.0, 1.0, 0.01, 0,
&(cfdata->rel_y), NULL, 200); &(cfdata->rel_y), NULL, 200);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(e, _("Horizontal")); ob = e_widget_label_add(e, _("Horizontal"));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(e, 1, 0, _("%1.2f"), ob = e_widget_slider_add(e, 1, 0, _("%1.2f"),
0.0, 1.0, 0.01, 0, 0.0, 1.0, 0.01, 0,
&(cfdata->rel_x), NULL, 200); &(cfdata->rel_x), NULL, 200);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5); e_widget_list_object_append(o, of, 1, 1, 0.5);
@ -579,35 +578,34 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdat
ob = e_widget_label_add(e, _("Popup Width")); ob = e_widget_label_add(e, _("Popup Width"));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(e, 1, 0, _("%1.0f"), ob = e_widget_slider_add(e, 1, 0, _("%1.0f"),
evry_conf->min_w, 800, 1, 0, NULL, evry_conf->min_w, 800, 1, 0, NULL,
&(cfdata->edge_width), 200); &(cfdata->edge_width), 200);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_label_add(e, _("Popup Height")); ob = e_widget_label_add(e, _("Popup Height"));
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
ob = e_widget_slider_add(e, 1, 0, _("%1.0f"), ob = e_widget_slider_add(e, 1, 0, _("%1.0f"),
evry_conf->min_h, 800, 1, 0, NULL, evry_conf->min_h, 800, 1, 0, NULL,
&(cfdata->edge_height), 200); &(cfdata->edge_height), 200);
e_widget_framelist_object_append(of, ob); e_widget_framelist_object_append(of, ob);
e_widget_list_object_append(o, of, 1, 1, 0.5); e_widget_list_object_append(o, of, 1, 1, 0.5);
#endif #endif
e_widget_toolbook_page_append(otb, NULL, _("Geometry"), e_widget_toolbook_page_append(otb, NULL, _("Geometry"),
o, 1, 0, 1, 0, 0.5, 0.0); o, 1, 0, 1, 0, 0.5, 0.0);
e_widget_toolbook_page_show(otb, 0); e_widget_toolbook_page_show(otb, 0);
e_dialog_resizable_set(cfd->dia, 0); e_dialog_resizable_set(cfd->dia, 0);
return otb; return otb;
} }
/***************************************************************************/ /***************************************************************************/
static void *_cat_create_data(E_Config_Dialog *cfd); static void *_cat_create_data(E_Config_Dialog *cfd);
static void _cat_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static void _cat_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_cat_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, static Evas_Object *_cat_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas,
E_Config_Dialog_Data *cfdata); E_Config_Dialog_Data *cfdata);
static int _cat_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _cat_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
EAPI E_Config_Dialog * EAPI E_Config_Dialog *
evry_collection_conf_dialog(E_Container *con, const char *params) evry_collection_conf_dialog(E_Container *con, const char *params)
@ -634,7 +632,7 @@ evry_collection_conf_dialog(E_Container *con, const char *params)
snprintf(title, sizeof(title), "%s: %s", _("Everything Collection"), p->name); snprintf(title, sizeof(title), "%s: %s", _("Everything Collection"), p->name);
cfd = e_config_dialog_new(con, title, p->config_path, p->config_path, cfd = e_config_dialog_new(con, title, p->config_path, p->config_path,
EVRY_ITEM(p)->icon, 0, v, p); EVRY_ITEM(p)->icon, 0, v, p);
/* FIXME free dialogs on shutdown /* FIXME free dialogs on shutdown
_conf->cfd = cfd; */ _conf->cfd = cfd; */
@ -652,30 +650,30 @@ _cat_create_data(E_Config_Dialog *cfd)
cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata = E_NEW(E_Config_Dialog_Data, 1);
cfdata->page[0].collection = EINA_TRUE; cfdata->page[0].collection = EINA_TRUE;
EINA_LIST_FOREACH(evry_conf->conf_subjects, l, pc) EINA_LIST_FOREACH (evry_conf->conf_subjects, l, pc)
{ {
if (pc->name == p->name) if (pc->name == p->name)
continue; continue;
if (!strcmp(pc->name, "All") || if (!strcmp(pc->name, "All") ||
!strcmp(pc->name, "Actions") || !strcmp(pc->name, "Actions") ||
!strcmp(pc->name, "Text") || !strcmp(pc->name, "Text") ||
!strcmp(pc->name, "Calculator") || !strcmp(pc->name, "Calculator") ||
!strcmp(pc->name, "Spell Checker") || !strcmp(pc->name, "Spell Checker") ||
!strcmp(pc->name, "Plugins")) !strcmp(pc->name, "Plugins"))
continue; continue;
EINA_LIST_FOREACH(p->config->plugins, ll, pc2) EINA_LIST_FOREACH (p->config->plugins, ll, pc2)
if (pc->name == pc2->name) if (pc->name == pc2->name)
break; break;
if (pc2) if (pc2)
continue; continue;
pc2 = E_NEW(Plugin_Config, 1); pc2 = E_NEW(Plugin_Config, 1);
pc2->name = eina_stringshare_ref(pc->name); pc2->name = eina_stringshare_ref(pc->name);
pc2->view_mode = VIEW_MODE_NONE; pc2->view_mode = VIEW_MODE_NONE;
p->config->plugins = eina_list_append(p->config->plugins, pc2); p->config->plugins = eina_list_append(p->config->plugins, pc2);
} }
cfdata->page[0].configs = eina_list_clone(p->config->plugins); cfdata->page[0].configs = eina_list_clone(p->config->plugins);
@ -708,20 +706,20 @@ _cat_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
if (pc) if (pc)
{ {
if (pc->trigger) if (pc->trigger)
eina_stringshare_del(pc->trigger); eina_stringshare_del(pc->trigger);
if (cfdata->page[i].trigger[0]) if (cfdata->page[i].trigger[0])
pc->trigger = eina_stringshare_add(cfdata->page[i].trigger); pc->trigger = eina_stringshare_add(cfdata->page[i].trigger);
else else
pc->trigger = NULL; pc->trigger = NULL;
pc->trigger_only = cfdata->page[i].trigger_only; pc->trigger_only = cfdata->page[i].trigger_only;
pc->view_mode = cfdata->page[i].view_mode; pc->view_mode = cfdata->page[i].view_mode;
pc->enabled = cfdata->page[i].enabled; pc->enabled = cfdata->page[i].enabled;
pc->aggregate = cfdata->page[i].aggregate; pc->aggregate = cfdata->page[i].aggregate;
pc->top_level = cfdata->page[i].top_level; pc->top_level = cfdata->page[i].top_level;
pc->min_query = cfdata->page[i].min_query; pc->min_query = cfdata->page[i].min_query;
} }
e_config_save_queue(); e_config_save_queue();
@ -737,9 +735,10 @@ _cat_basic_create_widgets(E_Config_Dialog *cfd __UNUSED__, Evas *e, E_Config_Dia
ob = _create_plugin_page(cfdata, e, &cfdata->page[0]); ob = _create_plugin_page(cfdata, e, &cfdata->page[0]);
e_widget_toolbook_page_append(otb, NULL, _("Plugins"), e_widget_toolbook_page_append(otb, NULL, _("Plugins"),
ob, 1, 0, 1, 0, 0.5, 0.0); ob, 1, 0, 1, 0, 0.5, 0.0);
e_widget_toolbook_page_show(otb, 0); e_widget_toolbook_page_show(otb, 0);
return otb; return otb;
} }

View File

@ -5,54 +5,54 @@ typedef struct _Instance Instance;
struct _Instance struct _Instance
{ {
EINA_INLIST; EINA_INLIST;
E_Gadcon_Client *gcc; E_Gadcon_Client *gcc;
Evas_Object *o_button; Evas_Object *o_button;
E_Object_Delfn *del_fn; E_Object_Delfn *del_fn;
Evry_Window *win; Evry_Window *win;
Gadget_Config *cfg; Gadget_Config *cfg;
E_Config_Dialog *cfd; E_Config_Dialog *cfd;
E_Menu *menu; E_Menu *menu;
int mouse_down; int mouse_down;
Ecore_Animator *hide_animator; Ecore_Animator *hide_animator;
double hide_start; double hide_start;
int hide_x, hide_y; int hide_x, hide_y;
Eina_List *handlers; Eina_List *handlers;
Eina_Bool hidden; Eina_Bool hidden;
Eina_Bool illume_mode; Eina_Bool illume_mode;
}; };
/* static void _button_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); */ /* static void _button_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info); */
static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static Eina_Bool _cb_focus_out(void *data, int type __UNUSED__, void *event); static Eina_Bool _cb_focus_out(void *data, int type __UNUSED__, void *event);
/* gadcon requirements */ /* gadcon requirements */
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style); static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
static void _gc_shutdown(E_Gadcon_Client *gcc); static void _gc_shutdown(E_Gadcon_Client *gcc);
static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient); static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
static const char *_gc_label(E_Gadcon_Client_Class *client_class); static const char *_gc_label(E_Gadcon_Client_Class *client_class);
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas); static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class); static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);
static Gadget_Config *_conf_item_get(const char *id); static Gadget_Config *_conf_item_get(const char *id);
static void _conf_dialog(Instance *inst); static void _conf_dialog(Instance *inst);
static Eina_Inlist *instances = NULL; static Eina_Inlist *instances = NULL;
static const E_Gadcon_Client_Class _gadcon_class = static const E_Gadcon_Client_Class _gadcon_class =
{ {
GADCON_CLIENT_CLASS_VERSION, GADCON_CLIENT_CLASS_VERSION,
"evry-starter", "evry-starter",
{ {
_gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL,
e_gadcon_site_is_not_toolbar e_gadcon_site_is_not_toolbar
}, },
E_GADCON_CLIENT_STYLE_PLAIN E_GADCON_CLIENT_STYLE_PLAIN
}; };
static Eina_Bool static Eina_Bool
@ -64,7 +64,7 @@ _illume_running(void)
Eina_List *l; Eina_List *l;
E_Module *m; E_Module *m;
EINA_LIST_FOREACH(e_module_list(), l, m) EINA_LIST_FOREACH (e_module_list(), l, m)
if (!strcmp(m->name, "illume2") && m->enabled) if (!strcmp(m->name, "illume2") && m->enabled)
return EINA_TRUE; return EINA_TRUE;
@ -88,11 +88,11 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
if (((inst->cfg->plugin) && (strcmp(inst->cfg->plugin, "Start") != 0)) && if (((inst->cfg->plugin) && (strcmp(inst->cfg->plugin, "Start") != 0)) &&
(p = evry_plugin_find(inst->cfg->plugin))) (p = evry_plugin_find(inst->cfg->plugin)))
{ {
Evas_Object *oo = evry_util_icon_get(EVRY_ITEM(p), gc->evas); Evas_Object *oo = evry_util_icon_get(EVRY_ITEM(p), gc->evas);
if (oo) if (oo)
{ {
edje_object_part_swallow(o, "e.swallow.icon", oo); edje_object_part_swallow(o, "e.swallow.icon", oo);
edje_object_signal_emit(o, "e,state,icon,plugin", "e"); edje_object_signal_emit(o, "e,state,icon,plugin", "e");
} }
} }
@ -105,21 +105,20 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
inst->o_button = o; inst->o_button = o;
/* evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, /* evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
* _button_cb_mouse_up, inst); */ * _button_cb_mouse_up, inst); */
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_button_cb_mouse_down, inst); _button_cb_mouse_down, inst);
if (_illume_running()) if (_illume_running())
{ {
inst->illume_mode = EINA_TRUE; inst->illume_mode = EINA_TRUE;
inst->handlers = eina_list_append(inst->handlers, inst->handlers = eina_list_append(inst->handlers,
ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT, ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT,
_cb_focus_out, inst)); _cb_focus_out, inst));
} }
instances = eina_inlist_append(instances, EINA_INLIST_GET(inst)); instances = eina_inlist_append(instances, EINA_INLIST_GET(inst));
return gcc; return gcc;
@ -130,20 +129,20 @@ _gc_shutdown(E_Gadcon_Client *gcc)
{ {
Instance *inst; Instance *inst;
Ecore_Event_Handler *h; Ecore_Event_Handler *h;
inst = gcc->data; inst = gcc->data;
instances = eina_inlist_remove(instances, EINA_INLIST_GET(inst)); instances = eina_inlist_remove(instances, EINA_INLIST_GET(inst));
EINA_LIST_FREE(inst->handlers, h) EINA_LIST_FREE (inst->handlers, h)
ecore_event_handler_del(h); ecore_event_handler_del(h);
if (inst->del_fn && inst->win) if (inst->del_fn && inst->win)
{ {
e_object_delfn_del(E_OBJECT(inst->win->ewin), inst->del_fn); e_object_delfn_del(E_OBJECT(inst->win->ewin), inst->del_fn);
evry_hide(inst->win, 0); evry_hide(inst->win, 0);
} }
evas_object_del(inst->o_button); evas_object_del(inst->o_button);
free(inst); free(inst);
} }
@ -179,7 +178,7 @@ _gc_icon(E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas __UNUSED__)
o = edje_object_add(evas); o = edje_object_add(evas);
snprintf(buf, sizeof(buf), "%s/e-module-everything-start.edj", snprintf(buf, sizeof(buf), "%s/e-module-everything-start.edj",
e_module_dir_get(_mod_evry)); e_module_dir_get(_mod_evry));
edje_object_file_set(o, buf, "icon"); edje_object_file_set(o, buf, "icon");
return o; return o;
} }
@ -210,8 +209,8 @@ _gc_id_new(E_Gadcon_Client_Class *client_class __UNUSED__)
/***************************************************************************/ /***************************************************************************/
static void
static void _del_func(void *data, void *obj __UNUSED__) _del_func(void *data, void *obj __UNUSED__)
{ {
Instance *inst = data; Instance *inst = data;
@ -257,19 +256,19 @@ _hide_animator(void *data)
val = ecore_animator_pos_map(val, ECORE_POS_MAP_DECELERATE, 0.0, 0.0); val = ecore_animator_pos_map(val, ECORE_POS_MAP_DECELERATE, 0.0, 0.0);
e_border_fx_offset(ewin->border, e_border_fx_offset(ewin->border,
(val * (inst->hide_x * ewin->w)), (val * (inst->hide_x * ewin->w)),
(val * (inst->hide_y * ewin->h))); (val * (inst->hide_y * ewin->h)));
if (finished) if (finished)
{ {
/* go bac to subject selector */ /* go bac to subject selector */
evry_selectors_switch(inst->win, -1, 0); evry_selectors_switch(inst->win, -1, 0);
evry_selectors_switch(inst->win, -1, 0); evry_selectors_switch(inst->win, -1, 0);
inst->hide_animator = NULL; inst->hide_animator = NULL;
e_border_iconify(ewin->border); e_border_iconify(ewin->border);
e_border_fx_offset(ewin->border, 0, 0); e_border_fx_offset(ewin->border, 0, 0);
return EINA_FALSE; return EINA_FALSE;
} }
return EINA_TRUE; return EINA_TRUE;
@ -293,7 +292,7 @@ _cb_focus_out(void *data, int type __UNUSED__, void *event)
ev = event; ev = event;
EINA_INLIST_FOREACH(instances, inst) EINA_INLIST_FOREACH (instances, inst)
if (inst == data) break; if (inst == data) break;
if ((!inst) || (!inst->win)) if ((!inst) || (!inst->win))
@ -309,6 +308,7 @@ _cb_focus_out(void *data, int type __UNUSED__, void *event)
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
static void static void
_gadget_popup_show(Instance *inst) _gadget_popup_show(Instance *inst)
{ {
@ -329,32 +329,36 @@ _gadget_popup_show(Instance *inst)
case E_GADCON_ORIENT_TOP: case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL: case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR: case E_GADCON_ORIENT_CORNER_TR:
e_win_move(ewin, x, y + h); e_win_move(ewin, x, y + h);
inst->hide_y = -1; inst->hide_y = -1;
break; break;
case E_GADCON_ORIENT_BOTTOM: case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BR: case E_GADCON_ORIENT_CORNER_BR:
case E_GADCON_ORIENT_CORNER_BL: case E_GADCON_ORIENT_CORNER_BL:
e_win_move(ewin, x, y - ph); e_win_move(ewin, x, y - ph);
inst->hide_y = 1; inst->hide_y = 1;
break; break;
case E_GADCON_ORIENT_LEFT: case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LT: case E_GADCON_ORIENT_CORNER_LT:
case E_GADCON_ORIENT_CORNER_LB: case E_GADCON_ORIENT_CORNER_LB:
e_win_move(ewin, x + w, y); e_win_move(ewin, x + w, y);
inst->hide_x = -1; inst->hide_x = -1;
break; break;
case E_GADCON_ORIENT_RIGHT: case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RT: case E_GADCON_ORIENT_CORNER_RT:
case E_GADCON_ORIENT_CORNER_RB: case E_GADCON_ORIENT_CORNER_RB:
e_win_move(ewin, x - pw, y); e_win_move(ewin, x - pw, y);
inst->hide_x = 1; inst->hide_x = 1;
break; break;
case E_GADCON_ORIENT_FLOAT: case E_GADCON_ORIENT_FLOAT:
case E_GADCON_ORIENT_HORIZ: case E_GADCON_ORIENT_HORIZ:
case E_GADCON_ORIENT_VERT: case E_GADCON_ORIENT_VERT:
default: default:
break; break;
} }
if (ewin->x + pw > inst->win->zone->w) if (ewin->x + pw > inst->win->zone->w)
@ -362,7 +366,6 @@ _gadget_popup_show(Instance *inst)
if (ewin->y + ph > inst->win->zone->h) if (ewin->y + ph > inst->win->zone->h)
e_win_move(ewin, ewin->x, inst->win->zone->h - ph); e_win_move(ewin, ewin->x, inst->win->zone->h - ph);
} }
static void static void
@ -376,7 +379,7 @@ _gadget_window_show(Instance *inst)
E_Win *ewin = inst->win->ewin; E_Win *ewin = inst->win->ewin;
inst->win->func.hide = &_evry_hide_func; inst->win->func.hide = &_evry_hide_func;
e_zone_useful_geometry_get(inst->win->zone, &zx, &zy, &zw, &zh); e_zone_useful_geometry_get(inst->win->zone, &zx, &zy, &zw, &zh);
evas_object_geometry_get(inst->o_button, &gx, &gy, &gw, &gh); evas_object_geometry_get(inst->o_button, &gx, &gy, &gw, &gh);
@ -389,41 +392,45 @@ _gadget_window_show(Instance *inst)
case E_GADCON_ORIENT_TOP: case E_GADCON_ORIENT_TOP:
case E_GADCON_ORIENT_CORNER_TL: case E_GADCON_ORIENT_CORNER_TL:
case E_GADCON_ORIENT_CORNER_TR: case E_GADCON_ORIENT_CORNER_TR:
pw = zw/2; pw = zw / 2;
ph = zh/2; ph = zh / 2;
inst->hide_y = -1; inst->hide_y = -1;
e_win_move(ewin, zx, gy + gh); e_win_move(ewin, zx, gy + gh);
break; break;
case E_GADCON_ORIENT_BOTTOM: case E_GADCON_ORIENT_BOTTOM:
case E_GADCON_ORIENT_CORNER_BR: case E_GADCON_ORIENT_CORNER_BR:
case E_GADCON_ORIENT_CORNER_BL: case E_GADCON_ORIENT_CORNER_BL:
pw = zw/2; pw = zw / 2;
ph = zh/2; ph = zh / 2;
inst->hide_y = 1; inst->hide_y = 1;
e_win_move(ewin, zx, gy - ph); e_win_move(ewin, zx, gy - ph);
break; break;
case E_GADCON_ORIENT_LEFT: case E_GADCON_ORIENT_LEFT:
case E_GADCON_ORIENT_CORNER_LT: case E_GADCON_ORIENT_CORNER_LT:
case E_GADCON_ORIENT_CORNER_LB: case E_GADCON_ORIENT_CORNER_LB:
pw = zw/2.5; pw = zw / 2.5;
ph = zh; ph = zh;
inst->hide_x = -1; inst->hide_x = -1;
e_win_move(ewin, gx + gw, zy); e_win_move(ewin, gx + gw, zy);
break; break;
case E_GADCON_ORIENT_RIGHT: case E_GADCON_ORIENT_RIGHT:
case E_GADCON_ORIENT_CORNER_RT: case E_GADCON_ORIENT_CORNER_RT:
case E_GADCON_ORIENT_CORNER_RB: case E_GADCON_ORIENT_CORNER_RB:
pw = zw/2.5; pw = zw / 2.5;
ph = zh; ph = zh;
inst->hide_x = 1; inst->hide_x = 1;
e_win_move(ewin, gx - pw, zy); e_win_move(ewin, gx - pw, zy);
break; break;
case E_GADCON_ORIENT_FLOAT: case E_GADCON_ORIENT_FLOAT:
case E_GADCON_ORIENT_HORIZ: case E_GADCON_ORIENT_HORIZ:
case E_GADCON_ORIENT_VERT: case E_GADCON_ORIENT_VERT:
default: default:
pw = ph = 1; pw = ph = 1;
break; break;
} }
e_win_resize(ewin, pw, ph); e_win_resize(ewin, pw, ph);
@ -452,78 +459,78 @@ _button_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_
ev = event_info; ev = event_info;
if (ev->button == 1) if (ev->button == 1)
{ {
Evry_Window *win; Evry_Window *win;
E_Border *bd; E_Border *bd;
if (inst->win) if (inst->win)
{ {
win = inst->win; win = inst->win;
bd = win->ewin->border; bd = win->ewin->border;
if (inst->hide_animator) if (inst->hide_animator)
{ {
ecore_animator_del(inst->hide_animator); ecore_animator_del(inst->hide_animator);
inst->hide_animator = NULL; inst->hide_animator = NULL;
} }
if (inst->hidden || !bd->focused) if (inst->hidden || !bd->focused)
{ {
e_border_fx_offset(bd, 0, 0); e_border_fx_offset(bd, 0, 0);
e_border_uniconify(bd); e_border_uniconify(bd);
e_border_raise(bd); e_border_raise(bd);
e_border_focus_set(bd, 1, 1); e_border_focus_set(bd, 1, 1);
inst->hidden = EINA_FALSE; inst->hidden = EINA_FALSE;
return; return;
} }
else else
{ {
evry_hide(win, 1); evry_hide(win, 1);
return; return;
} }
} }
win = evry_show(e_util_zone_current_get(e_manager_current_get()), win = evry_show(e_util_zone_current_get(e_manager_current_get()),
0, inst->cfg->plugin, !inst->illume_mode); 0, inst->cfg->plugin, !inst->illume_mode);
if (!win) return; if (!win) return;
inst->win = win; inst->win = win;
win->data = inst; win->data = inst;
ecore_evas_name_class_set(win->ewin->ecore_evas, "E", "everything-window"); ecore_evas_name_class_set(win->ewin->ecore_evas, "E", "everything-window");
if (inst->illume_mode) if (inst->illume_mode)
_gadget_window_show(inst); _gadget_window_show(inst);
else else
_gadget_popup_show(inst); _gadget_popup_show(inst);
e_gadcon_locked_set(inst->gcc->gadcon, 1); e_gadcon_locked_set(inst->gcc->gadcon, 1);
inst->del_fn = e_object_delfn_add(E_OBJECT(win->ewin), _del_func, inst); inst->del_fn = e_object_delfn_add(E_OBJECT(win->ewin), _del_func, inst);
edje_object_signal_emit(inst->o_button, "e,state,focused", "e"); edje_object_signal_emit(inst->o_button, "e,state,focused", "e");
} }
else if ((ev->button == 3) && (!inst->menu)) else if ((ev->button == 3) && (!inst->menu))
{ {
E_Menu *m; E_Menu *m;
E_Menu_Item *mi; E_Menu_Item *mi;
int cx, cy; int cx, cy;
m = e_menu_new(); m = e_menu_new();
mi = e_menu_item_new(m); mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Settings")); e_menu_item_label_set(mi, _("Settings"));
e_util_menu_item_theme_icon_set(mi, "configure"); e_util_menu_item_theme_icon_set(mi, "configure");
e_menu_item_callback_set(mi, _cb_menu_configure, inst); e_menu_item_callback_set(mi, _cb_menu_configure, inst);
m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0); m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
e_menu_post_deactivate_callback_set(m, _cb_menu_post, inst); e_menu_post_deactivate_callback_set(m, _cb_menu_post, inst);
inst->menu = m; inst->menu = m;
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy, e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy,
NULL, NULL); NULL, NULL);
e_menu_activate_mouse(m, e_menu_activate_mouse(m,
e_util_zone_current_get(e_manager_current_get()), e_util_zone_current_get(e_manager_current_get()),
cx + ev->output.x, cy + ev->output.y, 1, 1, cx + ev->output.x, cy + ev->output.y, 1, 1,
E_MENU_POP_DIRECTION_DOWN, ev->timestamp); E_MENU_POP_DIRECTION_DOWN, ev->timestamp);
} }
} }
@ -532,12 +539,11 @@ _button_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_
* { * {
* Instance *inst; * Instance *inst;
* Evas_Event_Mouse_Down *ev; * Evas_Event_Mouse_Down *ev;
* *
* inst = data; * inst = data;
* inst->mouse_down = 1; * inst->mouse_down = 1;
* } */ * } */
int int
evry_gadget_init(void) evry_gadget_init(void)
{ {
@ -555,16 +561,16 @@ evry_gadget_shutdown(void)
struct _E_Config_Dialog_Data struct _E_Config_Dialog_Data
{ {
const char *plugin; const char *plugin;
int hide_after_action; int hide_after_action;
int popup; int popup;
Evas_Object *list; Evas_Object *list;
}; };
static void *_create_data(E_Config_Dialog *cfd); static void *_create_data(E_Config_Dialog *cfd);
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
static void static void
_conf_dialog(Instance *inst) _conf_dialog(Instance *inst)
@ -588,7 +594,7 @@ _conf_dialog(Instance *inst)
con = e_container_current_get(e_manager_current_get()); con = e_container_current_get(e_manager_current_get());
inst->cfd = e_config_dialog_new(con, _("Everything Gadgets"), "everything-gadgets", inst->cfd = e_config_dialog_new(con, _("Everything Gadgets"), "everything-gadgets",
"launcher/everything-gadgets", NULL, 0, v, inst); "launcher/everything-gadgets", NULL, 0, v, inst);
e_dialog_resizable_set(inst->cfd->dia, 0); e_dialog_resizable_set(inst->cfd->dia, 0);
/* _conf->cfd = cfd; */ /* _conf->cfd = cfd; */
@ -604,7 +610,7 @@ _create_data(E_Config_Dialog *cfd)
cfdata = E_NEW(E_Config_Dialog_Data, 1); cfdata = E_NEW(E_Config_Dialog_Data, 1);
#define CP(_name) cfdata->_name = (gc->_name ? strdup(gc->_name) : NULL); #define CP(_name) cfdata->_name = (gc->_name ? strdup(gc->_name) : NULL);
#define C(_name) cfdata->_name = gc->_name; #define C(_name) cfdata->_name = gc->_name;
/* CP(plugin); */ /* CP(plugin); */
C(hide_after_action); C(hide_after_action);
C(popup); C(popup);
@ -638,7 +644,7 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, E_Config_Dialog_Data *cfdata)
Eina_List *l; Eina_List *l;
Plugin_Config *pc; Plugin_Config *pc;
int sel = 0, cnt = 1; int sel = 0, cnt = 1;
evas = evas_object_evas_get(obj); evas = evas_object_evas_get(obj);
evas_event_freeze(evas); evas_event_freeze(evas);
edje_freeze(); edje_freeze();
@ -647,9 +653,9 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, E_Config_Dialog_Data *cfdata)
e_widget_ilist_append(obj, NULL, _("All"), NULL, NULL, NULL); e_widget_ilist_append(obj, NULL, _("All"), NULL, NULL, NULL);
EINA_LIST_FOREACH(plugins, l, pc) EINA_LIST_FOREACH (plugins, l, pc)
{ {
if (!pc->plugin) continue; if (!pc->plugin) continue;
e_widget_ilist_append(obj, NULL, pc->plugin->base.label, NULL, NULL, pc->name); e_widget_ilist_append(obj, NULL, pc->plugin->base.label, NULL, NULL, pc->name);
if (cfdata->plugin && !strcmp(pc->name, cfdata->plugin)) if (cfdata->plugin && !strcmp(pc->name, cfdata->plugin))
sel = cnt; sel = cnt;
@ -657,8 +663,8 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, E_Config_Dialog_Data *cfdata)
cnt++; cnt++;
} }
e_widget_ilist_selected_set(obj, sel); e_widget_ilist_selected_set(obj, sel);
e_widget_ilist_go(obj); e_widget_ilist_go(obj);
e_widget_size_min_get(obj, &w, NULL); e_widget_size_min_get(obj, &w, NULL);
e_widget_size_min_set(obj, w > 180 ? w : 180, 140); e_widget_size_min_set(obj, w > 180 ? w : 180, 140);
@ -674,8 +680,8 @@ _list_select_cb(void *data __UNUSED__, Evas_Object *obj)
int sel = e_widget_ilist_selected_get(obj); int sel = e_widget_ilist_selected_get(obj);
e_widget_ilist_nth_data_get(obj, sel); e_widget_ilist_nth_data_get(obj, sel);
} }
#endif #endif
static Evas_Object * static Evas_Object *
@ -695,7 +701,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdata)
_fill_list(evry_conf->conf_subjects, ow, cfdata); _fill_list(evry_conf->conf_subjects, ow, cfdata);
e_widget_framelist_object_append(of, ow); e_widget_framelist_object_append(of, ow);
cfdata->list = ow; cfdata->list = ow;
ow = e_widget_button_add(e, _("Settings"), NULL, _cb_button_settings, inst, NULL); ow = e_widget_button_add(e, _("Settings"), NULL, _cb_button_settings, inst, NULL);
e_widget_framelist_object_append(of, ow); e_widget_framelist_object_append(of, ow);
@ -712,13 +718,13 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
Evry_Plugin *p; Evry_Plugin *p;
Evas_Object *oo; Evas_Object *oo;
const char *plugin; const char *plugin;
#define CP(_name) \ #define CP(_name) \
if (gc->_name) \ if (gc->_name) \
eina_stringshare_del(gc->_name); \ eina_stringshare_del(gc->_name); \
gc->_name = eina_stringshare_add(cfdata->_name); gc->_name = eina_stringshare_add(cfdata->_name);
#define C(_name) gc->_name = cfdata->_name; #define C(_name) gc->_name = cfdata->_name;
eina_stringshare_del(gc->plugin); \ eina_stringshare_del(gc->plugin); \
plugin = e_widget_ilist_selected_label_get(cfdata->list); plugin = e_widget_ilist_selected_label_get(cfdata->list);
if (plugin && plugin[0]) if (plugin && plugin[0])
gc->plugin = eina_stringshare_add(cfdata->plugin); gc->plugin = eina_stringshare_add(cfdata->plugin);
@ -735,16 +741,17 @@ _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
if (oo) evas_object_del(oo); if (oo) evas_object_del(oo);
edje_object_signal_emit(inst->o_button, "e,state,icon,default", "e"); edje_object_signal_emit(inst->o_button, "e,state,icon,default", "e");
if ((p = evry_plugin_find(inst->cfg->plugin))) if ((p = evry_plugin_find(inst->cfg->plugin)))
{ {
oo = evry_util_icon_get(EVRY_ITEM(p), evas_object_evas_get(inst->o_button)); oo = evry_util_icon_get(EVRY_ITEM(p), evas_object_evas_get(inst->o_button));
if (oo) if (oo)
{ {
edje_object_part_swallow(inst->o_button, "e.swallow.icon", oo); edje_object_part_swallow(inst->o_button, "e.swallow.icon", oo);
edje_object_signal_emit(inst->o_button, "e,state,icon,plugin", "e"); edje_object_signal_emit(inst->o_button, "e,state,icon,plugin", "e");
} }
} }
return 1; return 1;
} }

View File

@ -1,8 +1,8 @@
#include "e_mod_main.h" #include "e_mod_main.h"
#define HISTORY_VERSION 2 #define HISTORY_VERSION 2
#define SEVEN_DAYS 604800.0 #define SEVEN_DAYS 604800.0
/* old history entries will be removed when threshold is reached */ /* old history entries will be removed when threshold is reached */
#define CLEANUP_THRESHOLD 500 #define CLEANUP_THRESHOLD 500
@ -13,10 +13,10 @@ typedef struct _Cleanup_Data Cleanup_Data;
struct _Cleanup_Data struct _Cleanup_Data
{ {
double time; double time;
Eina_List *keys; Eina_List *keys;
Eina_Bool normalize; Eina_Bool normalize;
const char *plugin; const char *plugin;
}; };
static E_Config_DD *hist_entry_edd = NULL; static E_Config_DD *hist_entry_edd = NULL;
@ -34,14 +34,14 @@ evry_history_init(void)
hist_item_edd = E_CONFIG_DD_NEW("History_Item", History_Item); hist_item_edd = E_CONFIG_DD_NEW("History_Item", History_Item);
#define T History_Item #define T History_Item
#define D hist_item_edd #define D hist_item_edd
E_CONFIG_VAL(D, T, plugin, STR); E_CONFIG_VAL(D, T, plugin, STR);
E_CONFIG_VAL(D, T, context, STR); E_CONFIG_VAL(D, T, context, STR);
E_CONFIG_VAL(D, T, input, STR); E_CONFIG_VAL(D, T, input, STR);
E_CONFIG_VAL(D, T, last_used, DOUBLE); E_CONFIG_VAL(D, T, last_used, DOUBLE);
E_CONFIG_VAL(D, T, usage, DOUBLE); E_CONFIG_VAL(D, T, usage, DOUBLE);
E_CONFIG_VAL(D, T, count, INT); E_CONFIG_VAL(D, T, count, INT);
E_CONFIG_VAL(D, T, transient, INT); E_CONFIG_VAL(D, T, transient, INT);
E_CONFIG_VAL(D, T, data, STR); E_CONFIG_VAL(D, T, data, STR);
#undef T #undef T
#undef D #undef D
hist_entry_edd = E_CONFIG_DD_NEW("History_Entry", History_Entry); hist_entry_edd = E_CONFIG_DD_NEW("History_Entry", History_Entry);
@ -59,9 +59,9 @@ evry_history_init(void)
hist_edd = E_CONFIG_DD_NEW("History", Evry_History); hist_edd = E_CONFIG_DD_NEW("History", Evry_History);
#define T Evry_History #define T Evry_History
#define D hist_edd #define D hist_edd
E_CONFIG_VAL(D, T, version, INT); E_CONFIG_VAL(D, T, version, INT);
E_CONFIG_VAL(D, T, begin, DOUBLE); E_CONFIG_VAL(D, T, begin, DOUBLE);
E_CONFIG_HASH(D, T, subjects, hist_types_edd); E_CONFIG_HASH(D, T, subjects, hist_types_edd);
#undef T #undef T
#undef D #undef D
} }
@ -72,17 +72,17 @@ _hist_entry_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__
History_Entry *he = data; History_Entry *he = data;
History_Item *hi; History_Item *hi;
EINA_LIST_FREE(he->items, hi) EINA_LIST_FREE (he->items, hi)
{ {
if (hi->input) if (hi->input)
eina_stringshare_del(hi->input); eina_stringshare_del(hi->input);
if (hi->plugin) if (hi->plugin)
eina_stringshare_del(hi->plugin); eina_stringshare_del(hi->plugin);
if (hi->context) if (hi->context)
eina_stringshare_del(hi->context); eina_stringshare_del(hi->context);
if (hi->data) if (hi->data)
eina_stringshare_del(hi->data); eina_stringshare_del(hi->data);
E_FREE(hi); E_FREE(hi);
} }
E_FREE(he); E_FREE(he);
@ -97,8 +97,8 @@ _hist_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void
if (ht->types) if (ht->types)
{ {
eina_hash_foreach(ht->types, _hist_entry_free_cb, NULL); eina_hash_foreach(ht->types, _hist_entry_free_cb, NULL);
eina_hash_free(ht->types); eina_hash_free(ht->types);
} }
E_FREE(ht); E_FREE(ht);
@ -114,35 +114,35 @@ _hist_entry_cleanup_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *
History_Item *hi; History_Item *hi;
Eina_List *l, *ll; Eina_List *l, *ll;
EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi) EINA_LIST_FOREACH_SAFE (he->items, l, ll, hi)
{ {
if (hi->last_used < d->time - SEVEN_DAYS) if (hi->last_used < d->time - SEVEN_DAYS)
{ {
hi->count--; hi->count--;
hi->last_used = d->time - SEVEN_DAYS/2.0; hi->last_used = d->time - SEVEN_DAYS / 2.0;
} }
/* item is transient or too old */ /* item is transient or too old */
if ((hi->count < 1) || hi->transient) if ((hi->count < 1) || hi->transient)
{ {
if (hi->input) if (hi->input)
eina_stringshare_del(hi->input); eina_stringshare_del(hi->input);
if (hi->plugin) if (hi->plugin)
eina_stringshare_del(hi->plugin); eina_stringshare_del(hi->plugin);
if (hi->context) if (hi->context)
eina_stringshare_del(hi->context); eina_stringshare_del(hi->context);
if (hi->data) if (hi->data)
eina_stringshare_del(hi->data); eina_stringshare_del(hi->data);
E_FREE(hi); E_FREE(hi);
he->items = eina_list_remove_list(he->items, l); he->items = eina_list_remove_list(he->items, l);
} }
} }
if (!he->items) if (!he->items)
{ {
E_FREE(he); E_FREE(he);
d->keys = eina_list_append(d->keys, key); d->keys = eina_list_append(d->keys, key);
} }
return EINA_TRUE; return EINA_TRUE;
@ -156,14 +156,15 @@ _hist_cleanup_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data,
if (ht->types) if (ht->types)
{ {
eina_hash_foreach(ht->types, _hist_entry_cleanup_cb, fdata); eina_hash_foreach(ht->types, _hist_entry_cleanup_cb, fdata);
EINA_LIST_FREE(d->keys, key) EINA_LIST_FREE (d->keys, key)
eina_hash_del_by_key(ht->types, key); eina_hash_del_by_key(ht->types, key);
} }
return EINA_TRUE; return EINA_TRUE;
} }
void void
evry_history_free(void) evry_history_free(void)
{ {
@ -172,12 +173,12 @@ evry_history_free(void)
if ((evry_hist) && (evry_hist->subjects) && if ((evry_hist) && (evry_hist->subjects) &&
(eina_hash_population(evry_hist->subjects) > CLEANUP_THRESHOLD)) (eina_hash_population(evry_hist->subjects) > CLEANUP_THRESHOLD))
{ {
Cleanup_Data *d; Cleanup_Data *d;
d = E_NEW(Cleanup_Data, 1); d = E_NEW(Cleanup_Data, 1);
d->time = ecore_time_unix_get(); d->time = ecore_time_unix_get();
eina_hash_foreach(evry_hist->subjects, _hist_cleanup_cb, d); eina_hash_foreach(evry_hist->subjects, _hist_cleanup_cb, d);
E_FREE(d); E_FREE(d);
} }
evry_history_unload(); evry_history_unload();
@ -197,24 +198,23 @@ evry_history_load(void)
if (evry_hist && evry_hist->version != HISTORY_VERSION) if (evry_hist && evry_hist->version != HISTORY_VERSION)
{ {
eina_hash_foreach(evry_hist->subjects, _hist_free_cb, NULL); eina_hash_foreach(evry_hist->subjects, _hist_free_cb, NULL);
eina_hash_free(evry_hist->subjects); eina_hash_free(evry_hist->subjects);
E_FREE(evry_hist); E_FREE(evry_hist);
evry_hist = NULL; evry_hist = NULL;
} }
if (!evry_hist) if (!evry_hist)
{ {
evry_hist = E_NEW(Evry_History, 1); evry_hist = E_NEW(Evry_History, 1);
evry_hist->version = HISTORY_VERSION; evry_hist->version = HISTORY_VERSION;
evry_hist->begin = ecore_time_unix_get() - SEVEN_DAYS; evry_hist->begin = ecore_time_unix_get() - SEVEN_DAYS;
} }
if (!evry_hist->subjects) if (!evry_hist->subjects)
evry_hist->subjects = eina_hash_string_superfast_new(NULL); evry_hist->subjects = eina_hash_string_superfast_new(NULL);
} }
void void
evry_history_unload(void) evry_history_unload(void)
{ {
@ -234,10 +234,10 @@ evry_history_types_get(Evry_Type _type)
{ {
History_Types *ht; History_Types *ht;
const char *type = evry_type_get(_type); const char *type = evry_type_get(_type);
if (!evry_hist) if (!evry_hist)
return NULL; return NULL;
if (!type) if (!type)
return NULL; return NULL;
@ -245,8 +245,8 @@ evry_history_types_get(Evry_Type _type)
if (!ht) if (!ht)
{ {
ht = E_NEW(History_Types, 1); ht = E_NEW(History_Types, 1);
eina_hash_add(evry_hist->subjects, type, ht); eina_hash_add(evry_hist->subjects, type, ht);
} }
if (!ht->types) if (!ht->types)
@ -260,7 +260,7 @@ evry_history_item_add(Evry_Item *it, const char *ctxt, const char *input)
{ {
History_Entry *he; History_Entry *he;
History_Types *ht; History_Types *ht;
History_Item *hi = NULL; History_Item *hi = NULL;
Eina_List *l; Eina_List *l;
int rem_ctxt = 1; int rem_ctxt = 1;
const char *id; const char *id;
@ -272,80 +272,80 @@ evry_history_item_add(Evry_Item *it, const char *ctxt, const char *input)
return NULL; return NULL;
if ((!it->plugin->history) && (!CHECK_TYPE(it, EVRY_TYPE_PLUGIN))) if ((!it->plugin->history) && (!CHECK_TYPE(it, EVRY_TYPE_PLUGIN)))
return NULL; return NULL;
if (it->type == EVRY_TYPE_ACTION) if (it->type == EVRY_TYPE_ACTION)
{ {
GET_ACTION(act, it); GET_ACTION(act, it);
if (!act->remember_context) if (!act->remember_context)
rem_ctxt = 0; rem_ctxt = 0;
} }
if (it->hi) if (it->hi)
{ {
/* keep hi when context didn't change */ /* keep hi when context didn't change */
if ((!rem_ctxt) || (!it->hi->context && !ctxt) || if ((!rem_ctxt) || (!it->hi->context && !ctxt) ||
(it->hi->context && ctxt && !strcmp(it->hi->context, ctxt))) (it->hi->context && ctxt && !strcmp(it->hi->context, ctxt)))
hi = it->hi; hi = it->hi;
} }
if (!hi) if (!hi)
{ {
id = (it->id ? it->id : it->label); id = (it->id ? it->id : it->label);
ht = evry_history_types_get(it->type); ht = evry_history_types_get(it->type);
if (!ht) if (!ht)
return NULL; return NULL;
he = eina_hash_find(ht->types, id);
if (!he) he = eina_hash_find(ht->types, id);
{
he = E_NEW(History_Entry, 1); if (!he)
eina_hash_add(ht->types, id, he); {
} he = E_NEW(History_Entry, 1);
else eina_hash_add(ht->types, id, he);
{ }
EINA_LIST_FOREACH(he->items, l, hi) else
if ((hi->plugin == it->plugin->name) && {
(!rem_ctxt || (ctxt == hi->context))) EINA_LIST_FOREACH (he->items, l, hi)
break; if ((hi->plugin == it->plugin->name) &&
} (!rem_ctxt || (ctxt == hi->context)))
break;
}
} }
if (!hi) if (!hi)
{ {
hi = E_NEW(History_Item, 1); hi = E_NEW(History_Item, 1);
hi->plugin = eina_stringshare_ref(it->plugin->name); hi->plugin = eina_stringshare_ref(it->plugin->name);
he->items = eina_list_append(he->items, hi); he->items = eina_list_append(he->items, hi);
} }
if (hi) if (hi)
{ {
it->hi = hi; it->hi = hi;
hi->last_used = ecore_time_unix_get(); hi->last_used = ecore_time_unix_get();
hi->usage /= 4.0; hi->usage /= 4.0;
hi->usage += TIME_FACTOR(hi->last_used); hi->usage += TIME_FACTOR(hi->last_used);
hi->transient = it->plugin->transient; hi->transient = it->plugin->transient;
hi->count += 1; hi->count += 1;
if (ctxt && !hi->context && rem_ctxt) if (ctxt && !hi->context && rem_ctxt)
{ {
hi->context = eina_stringshare_ref(ctxt); hi->context = eina_stringshare_ref(ctxt);
} }
if (input && hi->input) if (input && hi->input)
{ {
if (strncmp(hi->input, input, strlen(input))) if (strncmp(hi->input, input, strlen(input)))
{ {
eina_stringshare_del(hi->input); eina_stringshare_del(hi->input);
hi->input = eina_stringshare_add(input); hi->input = eina_stringshare_add(input);
} }
} }
else if (input) else if (input)
{ {
hi->input = eina_stringshare_add(input); hi->input = eina_stringshare_add(input);
} }
} }
/* reset usage */ /* reset usage */
@ -364,9 +364,9 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt)
int rem_ctxt = 1; int rem_ctxt = 1;
if (evry_conf->history_sort_mode == 3) if (evry_conf->history_sort_mode == 3)
{ {
it->usage = -1; it->usage = -1;
return 1; return 1;
} }
else else
it->usage = 0.0; it->usage = 0.0;
@ -376,90 +376,90 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt)
if (it->hi) if (it->hi)
{ {
/* keep hi when context didn't change */ /* keep hi when context didn't change */
if ((!rem_ctxt) || (!it->hi->context && !ctxt) || if ((!rem_ctxt) || (!it->hi->context && !ctxt) ||
(it->hi->context && ctxt && !strcmp(it->hi->context, ctxt))) (it->hi->context && ctxt && !strcmp(it->hi->context, ctxt)))
hi = it->hi; hi = it->hi;
} }
if (!hi) if (!hi)
{ {
ht = evry_history_types_get(it->type); ht = evry_history_types_get(it->type);
if (!ht) if (!ht)
return 0; return 0;
if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label))))
return 0;
if (it->type == EVRY_TYPE_ACTION) if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label))))
{ return 0;
GET_ACTION(act, it);
if (!act->remember_context)
rem_ctxt = 0;
}
EINA_LIST_FOREACH(he->items, l, hi) if (it->type == EVRY_TYPE_ACTION)
{ {
if (hi->plugin != it->plugin->name) GET_ACTION(act, it);
continue; if (!act->remember_context)
rem_ctxt = 0;
}
if (rem_ctxt && ctxt && (hi->context != ctxt)) EINA_LIST_FOREACH (he->items, l, hi)
{ {
it->hi = hi; if (hi->plugin != it->plugin->name)
continue; continue;
}
it->hi = hi; if (rem_ctxt && ctxt && (hi->context != ctxt))
break; {
} it->hi = hi;
continue;
}
it->hi = hi;
break;
}
} }
if (!hi) return 0; if (!hi) return 0;
if (evry_conf->history_sort_mode == 0) if (evry_conf->history_sort_mode == 0)
{ {
if (!input || !hi->input) if (!input || !hi->input)
{ {
it->usage += hi->usage * hi->count; it->usage += hi->usage * hi->count;
} }
else else
{ {
/* higher priority for exact matches */ /* higher priority for exact matches */
if (!strncmp(input, hi->input, strlen(input))) if (!strncmp(input, hi->input, strlen(input)))
{ {
it->usage += hi->usage * hi->count; it->usage += hi->usage * hi->count;
} }
if (!strncmp(input, hi->input, strlen(hi->input))) if (!strncmp(input, hi->input, strlen(hi->input)))
{ {
it->usage += hi->usage * hi->count; it->usage += hi->usage * hi->count;
} }
} }
if (ctxt && hi->context && (hi->context == ctxt)) if (ctxt && hi->context && (hi->context == ctxt))
{ {
it->usage += hi->usage * hi->count * 10.0; it->usage += hi->usage * hi->count * 10.0;
} }
} }
else if (evry_conf->history_sort_mode == 1) else if (evry_conf->history_sort_mode == 1)
{ {
it->usage = hi->count * (hi->last_used / 10000000000.0); it->usage = hi->count * (hi->last_used / 10000000000.0);
if (ctxt && hi->context && (hi->context == ctxt)) if (ctxt && hi->context && (hi->context == ctxt))
{ {
it->usage += hi->usage * hi->count * 10.0; it->usage += hi->usage * hi->count * 10.0;
} }
} }
else if (evry_conf->history_sort_mode == 2) else if (evry_conf->history_sort_mode == 2)
{ {
if (hi->last_used > it->usage) if (hi->last_used > it->usage)
it->usage = hi->last_used; it->usage = hi->last_used;
} }
if (it->fuzzy_match > 0) if (it->fuzzy_match > 0)
it->usage /= (double) it->fuzzy_match; it->usage /= (double)it->fuzzy_match;
else else
it->usage /= 100.0; it->usage /= 100.0;
if (it->usage > 0.0) if (it->usage > 0.0)
return 1; return 1;
@ -467,3 +467,4 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt)
return 0; return 0;
} }

View File

@ -7,10 +7,10 @@ typedef struct _Plugin Plugin;
struct _Plugin struct _Plugin
{ {
Evry_Plugin base; Evry_Plugin base;
Eina_List *actions; Eina_List *actions;
Eina_Bool parent; Eina_Bool parent;
Evry_Action *action; Evry_Action *action;
}; };
static Evry_Plugin *_plug = NULL; static Evry_Plugin *_plug = NULL;
@ -23,7 +23,7 @@ _finish(Evry_Plugin *plugin)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FREE(p->actions, act); EINA_LIST_FREE (p->actions, act) ;
E_FREE(p); E_FREE(p);
} }
@ -57,34 +57,34 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it)
if (!(CHECK_TYPE(it, EVRY_TYPE_PLUGIN))) if (!(CHECK_TYPE(it, EVRY_TYPE_PLUGIN)))
{ {
EINA_LIST_FOREACH(evry_conf->actions, l, act) EINA_LIST_FOREACH (evry_conf->actions, l, act)
{ {
if (!((!act->it1.type) || if (!((!act->it1.type) ||
(CHECK_TYPE(it, act->it1.type)) || (CHECK_TYPE(it, act->it1.type)) ||
(CHECK_SUBTYPE(it, act->it1.type)))) (CHECK_SUBTYPE(it, act->it1.type))))
continue; continue;
if (act->check_item && !(act->check_item(act, it))) if (act->check_item && !(act->check_item(act, it)))
continue; continue;
act->base.plugin = EVRY_PLUGIN(p); act->base.plugin = EVRY_PLUGIN(p);
act->it1.item = it; act->it1.item = it;
EVRY_ITEM(act)->hi = NULL; EVRY_ITEM(act)->hi = NULL;
p->actions = eina_list_append(p->actions, act); p->actions = eina_list_append(p->actions, act);
} }
} }
if (it->plugin) if (it->plugin)
{ {
EINA_LIST_FOREACH(it->plugin->actions, l, act) EINA_LIST_FOREACH (it->plugin->actions, l, act)
{ {
act->base.plugin = EVRY_PLUGIN(p); act->base.plugin = EVRY_PLUGIN(p);
act->it1.item = EVRY_ITEM(it->plugin); act->it1.item = EVRY_ITEM(it->plugin);
EVRY_ITEM(act)->hi = NULL; EVRY_ITEM(act)->hi = NULL;
p->actions = eina_list_append(p->actions, act); p->actions = eina_list_append(p->actions, act);
} }
} }
return EVRY_PLUGIN(p); return EVRY_PLUGIN(p);
@ -100,40 +100,39 @@ _cb_sort(const void *data1, const void *data2)
if (act1->remember_context || act2->remember_context) if (act1->remember_context || act2->remember_context)
{ {
if (act1->remember_context && !act2->remember_context) if (act1->remember_context && !act2->remember_context)
return -1; return -1;
if (!act1->remember_context && act2->remember_context) if (!act1->remember_context && act2->remember_context)
return 1; return 1;
} }
/* sort type match before subtype match */ /* sort type match before subtype match */
if (act1->it1.item && act2->it1.item) if (act1->it1.item && act2->it1.item)
{ {
if ((act1->it1.type == act1->it1.item->type) && if ((act1->it1.type == act1->it1.item->type) &&
(act2->it1.type != act2->it1.item->type)) (act2->it1.type != act2->it1.item->type))
return -1; return -1;
if ((act1->it1.type != act1->it1.item->type) && if ((act1->it1.type != act1->it1.item->type) &&
(act2->it1.type == act2->it1.item->type)) (act2->it1.type == act2->it1.item->type))
return 1; return 1;
} }
if (it1->fuzzy_match || it2->fuzzy_match) if (it1->fuzzy_match || it2->fuzzy_match)
if (it1->fuzzy_match || it2->fuzzy_match)
{
if (it1->fuzzy_match && !it2->fuzzy_match)
return -1;
if (it1->fuzzy_match || it2->fuzzy_match) if (!it1->fuzzy_match && it2->fuzzy_match)
{ return 1;
if (it1->fuzzy_match && !it2->fuzzy_match)
return -1;
if (!it1->fuzzy_match && it2->fuzzy_match) if (it1->fuzzy_match - it2->fuzzy_match)
return 1; return it1->fuzzy_match - it2->fuzzy_match;
}
if (it1->fuzzy_match - it2->fuzzy_match)
return (it1->fuzzy_match - it2->fuzzy_match);
}
if (it1->priority - it2->priority) if (it1->priority - it2->priority)
return (it1->priority - it2->priority); return it1->priority - it2->priority;
return 0; return 0;
} }
@ -148,15 +147,15 @@ _fetch(Evry_Plugin *plugin, const char *input)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FOREACH(p->actions, l, it) EINA_LIST_FOREACH (p->actions, l, it)
{ {
match = evry_fuzzy_match(it->label, input); match = evry_fuzzy_match(it->label, input);
if (!input || match) if (!input || match)
{ {
it->fuzzy_match = match; it->fuzzy_match = match;
EVRY_PLUGIN_ITEM_APPEND(p, it); EVRY_PLUGIN_ITEM_APPEND(p, it);
} }
} }
if (!plugin->items) return 0; if (!plugin->items) return 0;
@ -172,7 +171,7 @@ int
evry_plug_actions_init() evry_plug_actions_init()
{ {
_plug = EVRY_PLUGIN_BASE("Actions", NULL, EVRY_TYPE_ACTION, _plug = EVRY_PLUGIN_BASE("Actions", NULL, EVRY_TYPE_ACTION,
_begin, _finish, _fetch); _begin, _finish, _fetch);
_plug->browse = &_browse; _plug->browse = &_browse;
@ -189,11 +188,10 @@ evry_plug_actions_shutdown()
evry_plugin_free(_plug); evry_plugin_free(_plug);
/* bypass unregister, because it modifies the list */ /* bypass unregister, because it modifies the list */
EINA_LIST_FREE(evry_conf->actions, it) EINA_LIST_FREE (evry_conf->actions, it)
evry_item_free(it); evry_item_free(it);
} }
void void
evry_action_register(Evry_Action *act, int priority) evry_action_register(Evry_Action *act, int priority)
{ {
@ -222,13 +220,13 @@ _action_free_cb(Evry_Item *it)
Evry_Action * Evry_Action *
evry_action_new(const char *name, const char *label, evry_action_new(const char *name, const char *label,
Evry_Type type_in1, Evry_Type type_in2, Evry_Type type_in1, Evry_Type 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))
{ {
Evry_Action *act = EVRY_ITEM_NEW(Evry_Action, _plug, label, Evry_Action *act = EVRY_ITEM_NEW(Evry_Action, _plug, label,
NULL, _action_free_cb); NULL, _action_free_cb);
if (icon) if (icon)
act->base.icon = eina_stringshare_add(icon); act->base.icon = eina_stringshare_add(icon);
@ -251,7 +249,6 @@ evry_action_free(Evry_Action *act)
evry_item_free(EVRY_ITEM(act)); evry_item_free(EVRY_ITEM(act));
} }
/* TODO assign actions to plugins othersie there will be too liitle /* TODO assign actions to plugins othersie there will be too liitle
names soon */ names soon */
Evry_Action * Evry_Action *
@ -262,7 +259,7 @@ evry_action_find(const char *name)
const char *n = eina_stringshare_add(name); const char *n = eina_stringshare_add(name);
EINA_LIST_FOREACH(evry_conf->actions, l, act) EINA_LIST_FOREACH (evry_conf->actions, l, act)
if (act->name == n) if (act->name == n)
break; break;
@ -270,3 +267,4 @@ evry_action_find(const char *name)
return act; return act;
} }

View File

@ -2,26 +2,26 @@
//TODO min input for items not in history //TODO min input for items not in history
#define MAX_ITEMS 50 #define MAX_ITEMS 50
#define MAX_PLUGIN 15 #define MAX_PLUGIN 15
typedef struct _Plugin Plugin; typedef struct _Plugin Plugin;
struct _Plugin struct _Plugin
{ {
Evry_Plugin base; Evry_Plugin base;
Evry_Item *warning; Evry_Item *warning;
}; };
static int static int
_fetch(Evry_Plugin *plugin, const char *input) _fetch(Evry_Plugin *plugin, const char *input)
{ {
Plugin *p = (Plugin *) plugin; Plugin *p = (Plugin *)plugin;
Evry_Plugin *pp; Evry_Plugin *pp;
Eina_List *l, *ll, *lp = NULL; Eina_List *l, *ll, *lp = NULL;
Evry_Item *it, *it2; Evry_Item *it, *it2;
int top_level = 0, subj_sel = 0, cnt = 0; int top_level = 0, subj_sel = 0, cnt = 0;
size_t inp_len; size_t inp_len;
Eina_List *items = NULL; Eina_List *items = NULL;
const char *context = NULL; const char *context = NULL;
@ -29,7 +29,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
Evry_State *s = plugin->state; Evry_State *s = plugin->state;
Evry_Selector *sel = s->selector; Evry_Selector *sel = s->selector;
Evry_Selector **sels = sel->win->selectors; Evry_Selector **sels = sel->win->selectors;
if (input && input[0]) if (input && input[0])
inp_len = strlen(input); inp_len = strlen(input);
else else
@ -41,140 +41,140 @@ _fetch(Evry_Plugin *plugin, const char *input)
/* get current items' context, which is /* get current items' context, which is
* the previous selectors selected item */ * the previous selectors selected item */
if (sel == sels[0]) if (sel == sels[0])
{ {
subj_sel = 1; subj_sel = 1;
} }
else if (sel == sels[1]) else if (sel == sels[1])
{ {
it = sels[0]->state->cur_item; it = sels[0]->state->cur_item;
if (it) context = it->context; if (it) context = it->context;
} }
else if (sel == sels[2]) else if (sel == sels[2])
{ {
it = sels[1]->state->cur_item; it = sels[1]->state->cur_item;
if (it) context = it->context; if (it) context = it->context;
} }
EVRY_PLUGIN_ITEMS_FREE(p); EVRY_PLUGIN_ITEMS_FREE(p);
/* collect plugins to be shown in aggregator */ /* collect plugins to be shown in aggregator */
EINA_LIST_FOREACH(s->cur_plugins, l, pp) EINA_LIST_FOREACH (s->cur_plugins, l, pp)
{ {
/* dont show in aggregator */ /* dont show in aggregator */
if (!pp->config->aggregate) if (!pp->config->aggregate)
continue; continue;
/* do not recurse */ /* do not recurse */
if (pp == plugin) if (pp == plugin)
continue; continue;
/* dont show plugin in top-level */ /* dont show plugin in top-level */
if (top_level && !pp->config->top_level) if (top_level && !pp->config->top_level)
continue; continue;
lp = eina_list_append(lp, pp); lp = eina_list_append(lp, pp);
} }
/* show non-top-level plugins as item */ /* show non-top-level plugins as item */
if ((top_level) && (!s->trigger_active)) if ((top_level) && (!s->trigger_active))
{ {
EINA_LIST_FOREACH(s->plugins, l, pp) EINA_LIST_FOREACH (s->plugins, l, pp)
{ {
int min_fuzz = 0; int min_fuzz = 0;
double max_usage = 0.0; double max_usage = 0.0;
if (pp->config->top_level) if (pp->config->top_level)
continue; continue;
if (pp == plugin) if (pp == plugin)
continue; continue;
if (!pp->items) if (!pp->items)
continue; continue;
/* give plugin item the highest priority of its items */ /* give plugin item the highest priority of its items */
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH (pp->items, ll, it)
{ {
if (it->usage >= 0) if (it->usage >= 0)
evry_history_item_usage_set(it, input, context); evry_history_item_usage_set(it, input, context);
if (it->usage && (it->usage > max_usage)) if (it->usage && (it->usage > max_usage))
max_usage = it->usage; max_usage = it->usage;
if (it->fuzzy_match == 0) if (it->fuzzy_match == 0)
it->fuzzy_match = evry_fuzzy_match(it->label, input); it->fuzzy_match = evry_fuzzy_match(it->label, input);
if ((!min_fuzz) || ((it->fuzzy_match > 0) && if ((!min_fuzz) || ((it->fuzzy_match > 0) &&
(it->fuzzy_match < min_fuzz))) (it->fuzzy_match < min_fuzz)))
min_fuzz = it->fuzzy_match; min_fuzz = it->fuzzy_match;
} }
GET_ITEM(it, pp); GET_ITEM(it, pp);
it->hi = NULL; it->hi = NULL;
/* TODO get better usage estimate */ /* TODO get better usage estimate */
evry_history_item_usage_set(it, NULL, NULL); evry_history_item_usage_set(it, NULL, NULL);
it->usage /= 100.0; it->usage /= 100.0;
if ((it->usage && max_usage) && (it->usage < max_usage)) if ((it->usage && max_usage) && (it->usage < max_usage))
it->usage = max_usage; it->usage = max_usage;
it->fuzzy_match = min_fuzz; it->fuzzy_match = min_fuzz;
IF_RELEASE(it->detail); IF_RELEASE(it->detail);
snprintf(buf, sizeof(buf), "%d %s", eina_list_count(pp->items), _("Items")); snprintf(buf, sizeof(buf), "%d %s", eina_list_count(pp->items), _("Items"));
it->detail = eina_stringshare_add(buf); it->detail = eina_stringshare_add(buf);
items = eina_list_append(items, it); items = eina_list_append(items, it);
} }
/* only one plugin: show items */ /* only one plugin: show items */
if ((eina_list_count(s->cur_plugins)) == 1 && items && if ((eina_list_count(s->cur_plugins)) == 1 && items &&
(pp = eina_list_data_get(items)) && (pp->config->aggregate)) (pp = eina_list_data_get(items)) && (pp->config->aggregate))
{ {
eina_list_free(items); eina_list_free(items);
items = NULL; items = NULL;
EINA_LIST_FOREACH(pp->items, l, it) EINA_LIST_FOREACH (pp->items, l, it)
{ {
if (it->usage >= 0) if (it->usage >= 0)
evry_history_item_usage_set(it, input, context); evry_history_item_usage_set(it, input, context);
if (it->fuzzy_match == 0) if (it->fuzzy_match == 0)
it->fuzzy_match = evry_fuzzy_match(it->label, input); it->fuzzy_match = evry_fuzzy_match(it->label, input);
items = eina_list_append(items, it); items = eina_list_append(items, it);
} }
} }
#if 0 #if 0
/* append all plugins as items (which were not added above) */ /* append all plugins as items (which were not added above) */
if (inp_len >= plugin->config->min_query) if (inp_len >= plugin->config->min_query)
{ {
EINA_LIST_FOREACH(s->plugins, l, pp) EINA_LIST_FOREACH (s->plugins, l, pp)
{ {
if (!strcmp(pp->name, "Actions")) if (!strcmp(pp->name, "Actions"))
continue; continue;
/* items MUST only conatin plugins here ! */ /* items MUST only conatin plugins here ! */
EINA_LIST_FOREACH(items, ll, pp2) EINA_LIST_FOREACH (items, ll, pp2)
if (pp2->name == pp->name) break; if (pp2->name == pp->name) break;
if (pp2) if (pp2)
continue; continue;
GET_ITEM(it, pp); GET_ITEM(it, pp);
if ((!input) || if ((!input) ||
(it->fuzzy_match = evry_fuzzy_match(it->label, input))) (it->fuzzy_match = evry_fuzzy_match(it->label, input)))
{ {
evry_history_item_usage_set(it, input, NULL); evry_history_item_usage_set(it, input, NULL);
it->usage /= 100.0; it->usage /= 100.0;
EVRY_ITEM(pp)->plugin->state = s; EVRY_ITEM(pp)->plugin->state = s;
items = eina_list_append(items, pp); items = eina_list_append(items, pp);
} }
} }
} }
#endif #endif
if (!lp && (eina_list_count(items) < 2)) if (!lp && (eina_list_count(items) < 2))
{ {
if (items) eina_list_free(items); if (items) eina_list_free(items);
return 0; return 0;
} }
} }
if (!lp && !items) if (!lp && !items)
@ -183,98 +183,96 @@ _fetch(Evry_Plugin *plugin, const char *input)
/* if there is input append all items that match */ /* if there is input append all items that match */
if (input) if (input)
{ {
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH (lp, l, pp)
{ {
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH (pp->items, ll, it)
{ {
if (it->fuzzy_match == 0) if (it->fuzzy_match == 0)
it->fuzzy_match = evry_fuzzy_match(it->label, input); it->fuzzy_match = evry_fuzzy_match(it->label, input);
if (it->usage >= 0) if (it->usage >= 0)
evry_history_item_usage_set(it, input, context); evry_history_item_usage_set(it, input, context);
if ((subj_sel) && (top_level) && if ((subj_sel) && (top_level) &&
(!it->usage) && (inp_len < plugin->config->min_query)) (!it->usage) && (inp_len < plugin->config->min_query))
continue; continue;
items = eina_list_append(items, it); items = eina_list_append(items, it);
} }
} }
} }
/* no input: append all items that are in history */ /* no input: append all items that are in history */
else else
{ {
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH (lp, l, pp)
{ {
int cnt = 1; int cnt = 1;
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH (pp->items, ll, it)
{ {
if ((!subj_sel) || (it->usage < 0) || if ((!subj_sel) || (it->usage < 0) ||
(evry_history_item_usage_set(it, input, context))) (evry_history_item_usage_set(it, input, context)))
{ {
it->fuzzy_match = 0; it->fuzzy_match = 0;
items = eina_list_append(items, it); items = eina_list_append(items, it);
if (++cnt > MAX_PLUGIN) break; if (++cnt > MAX_PLUGIN) break;
} }
} }
} }
} }
if ((!top_level) && (eina_list_count(items) < MAX_ITEMS)) if ((!top_level) && (eina_list_count(items) < MAX_ITEMS))
{ {
EINA_LIST_FOREACH(lp, l, pp) EINA_LIST_FOREACH (lp, l, pp)
{ {
EINA_LIST_FOREACH(pp->items, ll, it) EINA_LIST_FOREACH (pp->items, ll, it)
{ {
if (eina_list_data_find_list(items, it)) if (eina_list_data_find_list(items, it))
continue; continue;
items = eina_list_append(items, it); items = eina_list_append(items, it);
} }
} }
} }
evry_util_items_sort(&items, 0 /* !input */); evry_util_items_sort(&items, 0 /* !input */);
EINA_LIST_FOREACH(items, l, it) EINA_LIST_FOREACH (items, l, it)
{ {
/* remove duplicates provided by different plugins. e.g. /* remove duplicates provided by different plugins. e.g.
files / places and tracker can find the same files */ files / places and tracker can find the same files */
if (it->id) if (it->id)
{ {
EINA_LIST_FOREACH(p->base.items, ll, it2) EINA_LIST_FOREACH (p->base.items, ll, it2)
{ {
if ((it->plugin->name != it2->plugin->name) && if ((it->plugin->name != it2->plugin->name) &&
(it->type == it2->type) && (it->type == it2->type) &&
(it->id == it2->id)) (it->id == it2->id))
break; break;
} }
} }
if (!it->id || !it2) if (!it->id || !it2)
{ {
evry_item_ref(it); evry_item_ref(it);
EVRY_PLUGIN_ITEM_APPEND(p, it); EVRY_PLUGIN_ITEM_APPEND(p, it);
} }
if (cnt++ > MAX_ITEMS)
break;
if (cnt++ > MAX_ITEMS)
break;
} }
if (lp) eina_list_free(lp); if (lp) eina_list_free(lp);
if (items) if (items)
{ {
eina_list_free(items); eina_list_free(items);
return EVRY_PLUGIN_HAS_ITEMS(p); return EVRY_PLUGIN_HAS_ITEMS(p);
} }
/* 'text' and 'actions' are always loaded */ /* 'text' and 'actions' are always loaded */
else if ((subj_sel) && (eina_list_count(s->plugins) == 2)) else if ((subj_sel) && (eina_list_count(s->plugins) == 2))
{ {
evry_item_ref(p->warning); evry_item_ref(p->warning);
EVRY_PLUGIN_ITEM_APPEND(p, p->warning); EVRY_PLUGIN_ITEM_APPEND(p, p->warning);
} }
return 0; return 0;
@ -322,7 +320,7 @@ evry_aggregator_new(int type)
if (evry_plugin_register(p, type, -1)) if (evry_plugin_register(p, type, -1))
{ {
p->config->view_mode = VIEW_MODE_THUMB; p->config->view_mode = VIEW_MODE_THUMB;
} }
GET_PLUGIN(pa, p); GET_PLUGIN(pa, p);
@ -332,3 +330,4 @@ evry_aggregator_new(int type)
return p; return p;
} }

File diff suppressed because it is too large Load Diff

View File

@ -6,12 +6,12 @@ typedef struct _Plugin Plugin;
struct _Plugin struct _Plugin
{ {
Evry_Plugin base; Evry_Plugin base;
}; };
static Eina_Bool _cb_data(void *data, int type, void *event); static Eina_Bool _cb_data(void *data, int type, void *event);
static Eina_Bool _cb_error(void *data, int type, void *event); static Eina_Bool _cb_error(void *data, int type, void *event);
static Eina_Bool _cb_del(void *data, int type, void *event); static Eina_Bool _cb_del(void *data, int type, void *event);
static const Evry_API *evry = NULL; static const Evry_API *evry = NULL;
static Evry_Module *evry_module = NULL; static Evry_Module *evry_module = NULL;
@ -39,15 +39,15 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
if (history) if (history)
{ {
const char *result; const char *result;
EINA_LIST_FREE(history, result) EINA_LIST_FREE (history, result)
{ {
it = EVRY_ITEM_NEW(Evry_Item, p, result, NULL, NULL); it = EVRY_ITEM_NEW(Evry_Item, p, result, NULL, NULL);
it->context = eina_stringshare_ref(p->base.name); it->context = eina_stringshare_ref(p->base.name);
p->base.items = eina_list_prepend(p->base.items, it); p->base.items = eina_list_prepend(p->base.items, it);
eina_stringshare_del(result); eina_stringshare_del(result);
} }
} }
it = EVRY_ITEM_NEW(Evry_Item, p, "0", NULL, NULL); it = EVRY_ITEM_NEW(Evry_Item, p, "0", NULL, NULL);
@ -62,22 +62,22 @@ static int
_run_bc(Plugin *p) _run_bc(Plugin *p)
{ {
handlers = eina_list_append handlers = eina_list_append
(handlers, ecore_event_handler_add (handlers, ecore_event_handler_add
(ECORE_EXE_EVENT_DATA, _cb_data, p)); (ECORE_EXE_EVENT_DATA, _cb_data, p));
handlers = eina_list_append handlers = eina_list_append
(handlers, ecore_event_handler_add (handlers, ecore_event_handler_add
(ECORE_EXE_EVENT_ERROR, _cb_error, p)); (ECORE_EXE_EVENT_ERROR, _cb_error, p));
handlers = eina_list_append handlers = eina_list_append
(handlers, ecore_event_handler_add (handlers, ecore_event_handler_add
(ECORE_EXE_EVENT_DEL, _cb_del, p)); (ECORE_EXE_EVENT_DEL, _cb_del, p));
exe = ecore_exe_pipe_run("bc -l", exe = ecore_exe_pipe_run("bc -l",
ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_READ |
ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_READ_LINE_BUFFERED |
ECORE_EXE_PIPE_WRITE | ECORE_EXE_PIPE_WRITE |
ECORE_EXE_PIPE_ERROR | ECORE_EXE_PIPE_ERROR |
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED, ECORE_EXE_PIPE_ERROR_LINE_BUFFERED,
NULL); NULL);
return !!exe; return !!exe;
} }
@ -89,22 +89,22 @@ _finish(Evry_Plugin *plugin)
Evry_Item *it; Evry_Item *it;
int items = 0; int items = 0;
EINA_LIST_FREE(p->base.items, it) EINA_LIST_FREE (p->base.items, it)
{ {
if ((items++ > 1) && (items < 10)) if ((items++ > 1) && (items < 10))
history = eina_list_prepend(history, eina_stringshare_add(it->label)); history = eina_list_prepend(history, eina_stringshare_add(it->label));
EVRY_ITEM_FREE(it); EVRY_ITEM_FREE(it);
} }
EINA_LIST_FREE(handlers, h) EINA_LIST_FREE (handlers, h)
ecore_event_handler_del(h); ecore_event_handler_del(h);
if (exe) if (exe)
{ {
ecore_exe_quit(exe); ecore_exe_quit(exe);
ecore_exe_free(exe); ecore_exe_free(exe);
exe = NULL; exe = NULL;
} }
active = EINA_FALSE; active = EINA_FALSE;
@ -128,18 +128,18 @@ _cb_action_performed(__UNUSED__ void *data, __UNUSED__ int type, void *event)
/* remove duplicates */ /* remove duplicates */
if (p->items->next) if (p->items->next)
{ {
it = p->items->data; it = p->items->data;
EINA_LIST_FOREACH(p->items->next, l, it2) EINA_LIST_FOREACH (p->items->next, l, it2)
{ {
if (!strcmp(it->label, it2->label)) if (!strcmp(it->label, it2->label))
{ {
p->items = eina_list_promote_list(p->items, l); p->items = eina_list_promote_list(p->items, l);
evry->item_changed(it, 0, 1); evry->item_changed(it, 0, 1);
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
} }
} }
it_old = p->items->data; it_old = p->items->data;
@ -176,8 +176,8 @@ _fetch(Evry_Plugin *plugin, const char *input)
second time...*/ second time...*/
if (error) if (error)
{ {
ecore_exe_send(exe, buf, strlen(buf)); ecore_exe_send(exe, buf, strlen(buf));
error = 0; error = 0;
} }
return EVRY_PLUGIN_HAS_ITEMS(p); return EVRY_PLUGIN_HAS_ITEMS(p);
@ -194,16 +194,17 @@ _cb_data(void *data, int type __UNUSED__, void *event)
if (ev->lines) if (ev->lines)
{ {
it = cur_item; it = cur_item;
eina_stringshare_del(it->label); eina_stringshare_del(it->label);
it->label = eina_stringshare_add(ev->lines->line); it->label = eina_stringshare_add(ev->lines->line);
if (!(it = eina_list_data_get(p->items)) || (it != cur_item)) if (!(it = eina_list_data_get(p->items)) || (it != cur_item))
{ {
p->items = eina_list_prepend(p->items, cur_item); p->items = eina_list_prepend(p->items, cur_item);
EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD);
} }
else if (it) evry->item_changed(it, 0, 0); else if (it)
evry->item_changed(it, 0, 0);
} }
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
@ -246,23 +247,23 @@ _plugins_init(const Evry_API *_api)
return EINA_FALSE; return EINA_FALSE;
action_handler = evry->event_handler_add(EVRY_EVENT_ACTION_PERFORMED, action_handler = evry->event_handler_add(EVRY_EVENT_ACTION_PERFORMED,
_cb_action_performed, NULL); _cb_action_performed, NULL);
_plug = EVRY_PLUGIN_BASE("Calculator", _module_icon, EVRY_TYPE_TEXT, _plug = EVRY_PLUGIN_BASE("Calculator", _module_icon, EVRY_TYPE_TEXT,
_begin, _finish, _fetch); _begin, _finish, _fetch);
_plug->history = EINA_FALSE; _plug->history = EINA_FALSE;
_plug->async_fetch = EINA_TRUE; _plug->async_fetch = EINA_TRUE;
if (evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 0)) if (evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 0))
{ {
Plugin_Config *pc = _plug->config; Plugin_Config *pc = _plug->config;
pc->view_mode = VIEW_MODE_LIST; pc->view_mode = VIEW_MODE_LIST;
pc->trigger = eina_stringshare_add("="); pc->trigger = eina_stringshare_add("=");
pc->trigger_only = EINA_TRUE; pc->trigger_only = EINA_TRUE;
pc->aggregate = EINA_FALSE; pc->aggregate = EINA_FALSE;
/* pc->top_level = EINA_FALSE; */ /* pc->top_level = EINA_FALSE; */
/* pc->min_query = 3; */ /* pc->min_query = 3; */
} }
return EINA_TRUE; return EINA_TRUE;
@ -295,3 +296,4 @@ evry_plug_calc_shutdown(void)
void void
evry_plug_calc_save(void){} evry_plug_calc_save(void){}

View File

@ -17,7 +17,7 @@ _action(Evry_Action *act)
static int static int
_check_item(Evry_Action *act __UNUSED__, const Evry_Item *it) _check_item(Evry_Action *act __UNUSED__, const Evry_Item *it)
{ {
return (it && it->label && (strlen(it->label) > 0)); return it && it->label && (strlen(it->label) > 0);
} }
Eina_Bool Eina_Bool
@ -31,9 +31,9 @@ evry_plug_clipboard_init(void)
//FIXME: Icon name doesn't follow FDO Spec //FIXME: Icon name doesn't follow FDO Spec
act = EVRY_ACTION_NEW("Copy to Clipboard", act = EVRY_ACTION_NEW("Copy to Clipboard",
EVRY_TYPE_TEXT, 0, EVRY_TYPE_TEXT, 0,
"everything-clipboard", "everything-clipboard",
_action, _check_item); _action, _check_item);
act->remember_context = EINA_TRUE; act->remember_context = EINA_TRUE;
evry_action_register(act, 10); evry_action_register(act, 10);
@ -48,3 +48,4 @@ evry_plug_clipboard_shutdown(void)
ecore_x_window_free(clipboard_win); ecore_x_window_free(clipboard_win);
evry_action_free(act); evry_action_free(act);
} }

View File

@ -1,13 +1,12 @@
#include "e_mod_main.h" #include "e_mod_main.h"
typedef struct _Plugin Plugin; typedef struct _Plugin Plugin;
struct _Plugin struct _Plugin
{ {
Evry_Plugin base; Evry_Plugin base;
Eina_List *plugins; Eina_List *plugins;
}; };
static Eina_List *plugins = NULL; static Eina_List *plugins = NULL;
@ -33,12 +32,12 @@ _browse(Evry_Plugin *plugin, const Evry_Item *item)
if (pp->begin && (inst = pp->begin(pp, NULL))) if (pp->begin && (inst = pp->begin(pp, NULL)))
{ {
if (!strcmp(plugin->name, "Plugins")) if (!strcmp(plugin->name, "Plugins"))
inst->config = &plugin_config; inst->config = &plugin_config;
else else
inst->config = pc; inst->config = pc;
return inst; return inst;
} }
return NULL; return NULL;
@ -52,16 +51,16 @@ _add_item(Plugin *p, Plugin_Config *pc)
if (pc->enabled && (pp = evry_plugin_find(pc->name))) if (pc->enabled && (pp = evry_plugin_find(pc->name)))
{ {
pc->plugin = pp; pc->plugin = pp;
GET_ITEM(itp, pp); GET_ITEM(itp, pp);
it = EVRY_ITEM_NEW(Evry_Item, EVRY_PLUGIN(p), itp->label, NULL, NULL); it = EVRY_ITEM_NEW(Evry_Item, EVRY_PLUGIN(p), itp->label, NULL, NULL);
if (itp->icon) it->icon = eina_stringshare_ref(itp->icon); if (itp->icon) it->icon = eina_stringshare_ref(itp->icon);
it->icon_get = itp->icon_get; it->icon_get = itp->icon_get;
it->data = pc; it->data = pc;
it->browseable = EINA_TRUE; it->browseable = EINA_TRUE;
it->detail = eina_stringshare_ref(EVRY_ITEM(p)->label); it->detail = eina_stringshare_ref(EVRY_ITEM(p)->label);
p->plugins = eina_list_append(p->plugins, it); p->plugins = eina_list_append(p->plugins, it);
} }
return it; return it;
} }
@ -75,7 +74,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
EVRY_PLUGIN_INSTANCE(p, plugin); EVRY_PLUGIN_INSTANCE(p, plugin);
EINA_LIST_FOREACH(plugin->config->plugins, l, pc) EINA_LIST_FOREACH (plugin->config->plugins, l, pc)
_add_item(p, pc); _add_item(p, pc);
return EVRY_PLUGIN(p); return EVRY_PLUGIN(p);
@ -90,15 +89,15 @@ _begin_all(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
EVRY_PLUGIN_INSTANCE(p, plugin); EVRY_PLUGIN_INSTANCE(p, plugin);
EINA_LIST_FOREACH(evry_conf->conf_subjects, l, pc) EINA_LIST_FOREACH (evry_conf->conf_subjects, l, pc)
{ {
if (!strcmp(pc->name, "All") || if (!strcmp(pc->name, "All") ||
!strcmp(pc->name, "Actions") || !strcmp(pc->name, "Actions") ||
!strcmp(pc->name, "Calculator") || !strcmp(pc->name, "Calculator") ||
!strcmp(pc->name, "Plugins")) !strcmp(pc->name, "Plugins"))
continue; continue;
_add_item(p, pc); _add_item(p, pc);
} }
return EVRY_PLUGIN(p); return EVRY_PLUGIN(p);
@ -113,9 +112,9 @@ _finish(Evry_Plugin *plugin)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FREE(p->plugins, it) EINA_LIST_FREE (p->plugins, it)
EVRY_ITEM_FREE(it); EVRY_ITEM_FREE(it);
E_FREE(p); E_FREE(p);
} }
@ -139,7 +138,7 @@ _add_plugin(const char *name)
char title[4096]; char title[4096];
p = EVRY_PLUGIN_BASE(name, NULL, COLLECTION_PLUGIN, p = EVRY_PLUGIN_BASE(name, NULL, COLLECTION_PLUGIN,
_begin, _finish, _fetch); _begin, _finish, _fetch);
p->browse = &_browse; p->browse = &_browse;
snprintf(path, sizeof(path), "launcher/everything-%s", p->name); snprintf(path, sizeof(path), "launcher/everything-%s", p->name);
@ -176,20 +175,20 @@ evry_plug_collection_init(void)
if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 100)) if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 100))
{ {
p->config->aggregate = EINA_TRUE; p->config->aggregate = EINA_TRUE;
p->config->top_level = EINA_TRUE; p->config->top_level = EINA_TRUE;
p->config->view_mode = VIEW_MODE_THUMB; p->config->view_mode = VIEW_MODE_THUMB;
} }
EINA_LIST_FOREACH(evry_conf->collections, l, pc) EINA_LIST_FOREACH (evry_conf->collections, l, pc)
{ {
p = _add_plugin(pc->name); p = _add_plugin(pc->name);
EVRY_ITEM_ICON_SET(p, "start-here"); EVRY_ITEM_ICON_SET(p, "start-here");
p->config = pc; p->config = pc;
pc->plugin = p; pc->plugin = p;
if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 1)) if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 1))
p->config->aggregate = EINA_FALSE; p->config->aggregate = EINA_FALSE;
} }
return EINA_TRUE; return EINA_TRUE;
@ -200,14 +199,15 @@ evry_plug_collection_shutdown(void)
{ {
Evry_Plugin *p; Evry_Plugin *p;
EINA_LIST_FREE(plugins, p) EINA_LIST_FREE (plugins, p)
{ {
if (p->config_path) if (p->config_path)
{ {
e_configure_registry_item_del(p->config_path); e_configure_registry_item_del(p->config_path);
eina_stringshare_del(p->config_path); eina_stringshare_del(p->config_path);
} }
EVRY_PLUGIN_FREE(p); EVRY_PLUGIN_FREE(p);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,23 @@
#include "e.h" #include "e.h"
#include "evry_api.h" #include "evry_api.h"
typedef struct _Plugin Plugin; typedef struct _Plugin Plugin;
typedef struct _Settings_Item Settings_Item; typedef struct _Settings_Item Settings_Item;
struct _Plugin struct _Plugin
{ {
Evry_Plugin base; Evry_Plugin base;
Eina_List *items; Eina_List *items;
Eina_List *categories; Eina_List *categories;
Eina_Bool parent; Eina_Bool parent;
}; };
struct _Settings_Item struct _Settings_Item
{ {
Evry_Item base; Evry_Item base;
E_Configure_Cat *ecat; E_Configure_Cat *ecat;
E_Configure_It *eci; E_Configure_It *eci;
}; };
static const Evry_API *evry = NULL; static const Evry_API *evry = NULL;
@ -31,13 +31,13 @@ _finish(Evry_Plugin *plugin)
{ {
Settings_Item *it; Settings_Item *it;
GET_PLUGIN(p, plugin); GET_PLUGIN(p, plugin);
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FREE(p->items, it) EINA_LIST_FREE (p->items, it)
EVRY_ITEM_FREE(it); EVRY_ITEM_FREE(it);
EINA_LIST_FREE(p->categories, it) EINA_LIST_FREE (p->categories, it)
EVRY_ITEM_FREE(it); EVRY_ITEM_FREE(it);
E_FREE(p); E_FREE(p);
@ -46,16 +46,16 @@ _finish(Evry_Plugin *plugin)
static Evas_Object * static Evas_Object *
_icon_get(Evry_Item *item, Evas *e __UNUSED__) _icon_get(Evry_Item *item, Evas *e __UNUSED__)
{ {
Settings_Item *it = (Settings_Item *) item; Settings_Item *it = (Settings_Item *)item;
if (!item->icon) if (!item->icon)
{ {
if (it->eci && it->eci->icon) if (it->eci && it->eci->icon)
item->icon = eina_stringshare_add(it->eci->icon); item->icon = eina_stringshare_add(it->eci->icon);
else if (it->ecat->icon) else if (it->ecat->icon)
item->icon = eina_stringshare_add(it->ecat->icon); item->icon = eina_stringshare_add(it->ecat->icon);
} }
return NULL; return NULL;
} }
@ -69,22 +69,22 @@ _browse(Evry_Plugin *plugin, const Evry_Item *item)
if (!CHECK_TYPE(item, E_SETTINGS)) if (!CHECK_TYPE(item, E_SETTINGS))
return NULL; return NULL;
it = (Settings_Item *) item; it = (Settings_Item *)item;
EVRY_PLUGIN_INSTANCE(p, plugin); EVRY_PLUGIN_INSTANCE(p, plugin);
p->parent = EINA_TRUE; p->parent = EINA_TRUE;
GET_PLUGIN(parent, item->plugin); GET_PLUGIN(parent, item->plugin);
EINA_LIST_FOREACH(parent->items, l, it2) EINA_LIST_FOREACH (parent->items, l, it2)
{ {
if (it2->ecat == it->ecat) if (it2->ecat == it->ecat)
{ {
EVRY_ITEM_REF(it2); EVRY_ITEM_REF(it2);
p->items = eina_list_append(p->items, it2); p->items = eina_list_append(p->items, it2);
} }
} }
return EVRY_PLUGIN(p); return EVRY_PLUGIN(p);
} }
@ -94,7 +94,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
Plugin *p; Plugin *p;
EVRY_PLUGIN_INSTANCE(p, plugin); EVRY_PLUGIN_INSTANCE(p, plugin);
return EVRY_PLUGIN(p); return EVRY_PLUGIN(p);
} }
@ -102,43 +102,43 @@ static int
_fetch(Evry_Plugin *plugin, const char *input) _fetch(Evry_Plugin *plugin, const char *input)
{ {
size_t len = input ? strlen(input) : 0; size_t len = input ? strlen(input) : 0;
GET_PLUGIN(p, plugin); GET_PLUGIN(p, plugin);
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
if ((!p->parent) && (len < plugin->config->min_query)) if ((!p->parent) && (len < plugin->config->min_query))
return 0; return 0;
if (!p->categories && !p->items) if (!p->categories && !p->items)
{ {
Settings_Item *it; Settings_Item *it;
Eina_List *l, *ll; Eina_List *l, *ll;
E_Configure_Cat *ecat; E_Configure_Cat *ecat;
E_Configure_It *eci; E_Configure_It *eci;
EINA_LIST_FOREACH(e_configure_registry, l, ecat) EINA_LIST_FOREACH (e_configure_registry, l, ecat)
{ {
if ((ecat->pri < 0) || (!ecat->items)) continue; if ((ecat->pri < 0) || (!ecat->items)) continue;
if (!strcmp(ecat->cat, "system")) continue; if (!strcmp(ecat->cat, "system")) continue;
it = EVRY_ITEM_NEW(Settings_Item, p, ecat->label, _icon_get, NULL); it = EVRY_ITEM_NEW(Settings_Item, p, ecat->label, _icon_get, NULL);
it->ecat = ecat; it->ecat = ecat;
EVRY_ITEM(it)->browseable = EINA_TRUE; EVRY_ITEM(it)->browseable = EINA_TRUE;
p->categories = eina_list_append(p->categories, it); p->categories = eina_list_append(p->categories, it);
EINA_LIST_FOREACH(ecat->items, ll, eci)
{
if (eci->pri < 0) continue;
it = EVRY_ITEM_NEW(Settings_Item, p, eci->label, _icon_get, NULL); EINA_LIST_FOREACH (ecat->items, ll, eci)
it->eci = eci; {
it->ecat = ecat; if (eci->pri < 0) continue;
EVRY_ITEM_DETAIL_SET(it, ecat->label);
it = EVRY_ITEM_NEW(Settings_Item, p, eci->label, _icon_get, NULL);
p->items = eina_list_append(p->items, it); it->eci = eci;
} it->ecat = ecat;
} EVRY_ITEM_DETAIL_SET(it, ecat->label);
p->items = eina_list_append(p->items, it);
}
}
} }
EVRY_PLUGIN_ITEMS_ADD(p, p->categories, input, 1, 1); EVRY_PLUGIN_ITEMS_ADD(p, p->categories, input, 1, 1);
@ -152,7 +152,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
static int static int
_action_check(Evry_Action *act __UNUSED__, const Evry_Item *item) _action_check(Evry_Action *act __UNUSED__, const Evry_Item *item)
{ {
return !!(((Settings_Item*)item)->eci); return !!(((Settings_Item *)item)->eci);
} }
static int static int
@ -161,7 +161,7 @@ _action(Evry_Action *act)
char buf[1024]; char buf[1024];
Settings_Item *it; Settings_Item *it;
it = (Settings_Item *) act->it1.item; it = (Settings_Item *)act->it1.item;
snprintf(buf, sizeof(buf), "%s/%s", it->ecat->cat, it->eci->item); snprintf(buf, sizeof(buf), "%s/%s", it->ecat->cat, it->eci->item);
@ -172,20 +172,20 @@ _action(Evry_Action *act)
static int static int
_plugins_init(const Evry_API *_api) _plugins_init(const Evry_API *_api)
{ {
evry = _api; evry = _api;
if (!evry->api_version_check(EVRY_API_VERSION)) if (!evry->api_version_check(EVRY_API_VERSION))
return EINA_FALSE; return EINA_FALSE;
E_SETTINGS = evry->type_register("E_SETTINGS"); E_SETTINGS = evry->type_register("E_SETTINGS");
p = EVRY_PLUGIN_BASE("Settings", "configure", E_SETTINGS, _begin, _finish, _fetch); p = EVRY_PLUGIN_BASE("Settings", "configure", E_SETTINGS, _begin, _finish, _fetch);
p->browse = &_browse; p->browse = &_browse;
evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 10); evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 10);
act = EVRY_ACTION_NEW("Show Dialog", E_SETTINGS, 0, act = EVRY_ACTION_NEW("Show Dialog", E_SETTINGS, 0,
"preferences-advanced", _action, _action_check); "preferences-advanced", _action, _action_check);
evry->action_register(act, 0); evry->action_register(act, 0);
@ -200,7 +200,6 @@ _plugins_shutdown(void)
EVRY_ACTION_FREE(act); EVRY_ACTION_FREE(act);
} }
/***************************************************************************/ /***************************************************************************/
Eina_Bool Eina_Bool
@ -221,3 +220,4 @@ evry_plug_settings_shutdown(void)
void void
evry_plug_settings_save(void){} evry_plug_settings_save(void){}

View File

@ -4,7 +4,7 @@ typedef struct _Plugin Plugin;
struct _Plugin struct _Plugin
{ {
Evry_Plugin base; Evry_Plugin base;
}; };
static Evry_Plugin *p1, *p2; static Evry_Plugin *p1, *p2;
@ -15,7 +15,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it __UNUSED__)
Plugin *p; Plugin *p;
EVRY_PLUGIN_INSTANCE(p, plugin); EVRY_PLUGIN_INSTANCE(p, plugin);
return EVRY_PLUGIN(p); return EVRY_PLUGIN(p);
} }
@ -23,7 +23,7 @@ static void
_finish(Evry_Plugin *plugin) _finish(Evry_Plugin *plugin)
{ {
GET_PLUGIN(p, plugin); GET_PLUGIN(p, plugin);
EVRY_PLUGIN_ITEMS_FREE(p); EVRY_PLUGIN_ITEMS_FREE(p);
E_FREE(p); E_FREE(p);
} }
@ -32,28 +32,28 @@ static int
_fetch(Evry_Plugin *plugin, const char *input) _fetch(Evry_Plugin *plugin, const char *input)
{ {
Evry_Item *it; Evry_Item *it;
GET_PLUGIN(p, plugin); GET_PLUGIN(p, plugin);
if (input) if (input)
{ {
if (!p->base.items) if (!p->base.items)
{ {
it = evry_item_new(NULL, EVRY_PLUGIN(p), input, NULL, NULL); it = evry_item_new(NULL, EVRY_PLUGIN(p), input, NULL, NULL);
it->fuzzy_match = 999; it->fuzzy_match = 999;
EVRY_PLUGIN_ITEM_APPEND(p, it); EVRY_PLUGIN_ITEM_APPEND(p, it);
} }
else else
{ {
it = p->base.items->data; it = p->base.items->data;
EVRY_ITEM_LABEL_SET(it, input); EVRY_ITEM_LABEL_SET(it, input);
evry_item_changed(it, 0, 0); evry_item_changed(it, 0, 0);
} }
return 1; return 1;
} }
EVRY_PLUGIN_ITEMS_FREE(p); EVRY_PLUGIN_ITEMS_FREE(p);
return 0; return 0;
} }
@ -61,25 +61,25 @@ Eina_Bool
evry_plug_text_init(void) evry_plug_text_init(void)
{ {
p1 = EVRY_PLUGIN_BASE("Text", "accessories-text-editor", p1 = EVRY_PLUGIN_BASE("Text", "accessories-text-editor",
EVRY_TYPE_TEXT, _begin, _finish, _fetch); EVRY_TYPE_TEXT, _begin, _finish, _fetch);
p2 = EVRY_PLUGIN_BASE("Text", "accessories-text-editor", p2 = EVRY_PLUGIN_BASE("Text", "accessories-text-editor",
EVRY_TYPE_TEXT, _begin, _finish, _fetch); EVRY_TYPE_TEXT, _begin, _finish, _fetch);
if (evry_plugin_register(p1, EVRY_PLUGIN_OBJECT, 999)) if (evry_plugin_register(p1, EVRY_PLUGIN_OBJECT, 999))
{ {
p1->config->trigger = eina_stringshare_add(" "); p1->config->trigger = eina_stringshare_add(" ");
p1->config->aggregate = EINA_FALSE; p1->config->aggregate = EINA_FALSE;
p1->config->top_level = EINA_FALSE; p1->config->top_level = EINA_FALSE;
p1->config->view_mode = VIEW_MODE_LIST; p1->config->view_mode = VIEW_MODE_LIST;
} }
if (evry_plugin_register(p2, EVRY_PLUGIN_SUBJECT, 999)) if (evry_plugin_register(p2, EVRY_PLUGIN_SUBJECT, 999))
{ {
p2->config->trigger = eina_stringshare_add(" "); p2->config->trigger = eina_stringshare_add(" ");
p2->config->aggregate = EINA_FALSE; p2->config->aggregate = EINA_FALSE;
p2->config->top_level = EINA_FALSE; p2->config->top_level = EINA_FALSE;
p2->config->view_mode = VIEW_MODE_LIST; p2->config->view_mode = VIEW_MODE_LIST;
} }
return EINA_TRUE; return EINA_TRUE;
@ -91,3 +91,4 @@ evry_plug_text_shutdown(void)
EVRY_PLUGIN_FREE(p1); EVRY_PLUGIN_FREE(p1);
EVRY_PLUGIN_FREE(p2); EVRY_PLUGIN_FREE(p2);
} }

View File

@ -1,27 +1,27 @@
#include "e.h" #include "e.h"
#include "evry_api.h" #include "evry_api.h"
#define BORDER_SHOW 1 #define BORDER_SHOW 1
#define BORDER_HIDE 2 #define BORDER_HIDE 2
#define BORDER_FULLSCREEN 3 #define BORDER_FULLSCREEN 3
#define BORDER_TODESK 4 #define BORDER_TODESK 4
#define BORDER_CLOSE 5 #define BORDER_CLOSE 5
typedef struct _Plugin Plugin; typedef struct _Plugin Plugin;
typedef struct _Border_Item Border_Item; typedef struct _Border_Item Border_Item;
struct _Plugin struct _Plugin
{ {
Evry_Plugin base; Evry_Plugin base;
Eina_List *borders; Eina_List *borders;
Eina_List *handlers; Eina_List *handlers;
const char *input; const char *input;
}; };
struct _Border_Item struct _Border_Item
{ {
Evry_Item base; Evry_Item base;
E_Border *border; E_Border *border;
}; };
static const Evry_API *evry = NULL; static const Evry_API *evry = NULL;
@ -33,8 +33,7 @@ static Evas_Object *_icon_get(Evry_Item *it, Evas *e);
/***************************************************************************/ /***************************************************************************/
#define GET_BORDER(_bd, _it) Border_Item *_bd = (Border_Item *)_it; #define GET_BORDER(_bd, _it) Border_Item * _bd = (Border_Item *)_it;
static void static void
_border_item_free(Evry_Item *it) _border_item_free(Evry_Item *it)
@ -58,11 +57,11 @@ _border_item_add(Plugin *p, E_Border *bd)
return 0; return 0;
bi = EVRY_ITEM_NEW(Border_Item, p, e_border_name_get(bd), bi = EVRY_ITEM_NEW(Border_Item, p, e_border_name_get(bd),
_icon_get, _border_item_free); _icon_get, _border_item_free);
snprintf(buf, sizeof(buf), "%d:%d %s", snprintf(buf, sizeof(buf), "%d:%d %s",
bd->desk->x, bd->desk->y, bd->desk->x, bd->desk->y,
(bd->desktop ? bd->desktop->name : "")); (bd->desktop ? bd->desktop->name : ""));
EVRY_ITEM_DETAIL_SET(bi, buf); EVRY_ITEM_DETAIL_SET(bi, buf);
bi->border = bd; bi->border = bd;
@ -74,14 +73,14 @@ _border_item_add(Plugin *p, E_Border *bd)
} }
static Eina_Bool static Eina_Bool
_cb_border_remove(void *data, __UNUSED__ int type, void *event) _cb_border_remove(void *data, __UNUSED__ int type, void *event)
{ {
E_Event_Border_Remove *ev = event; E_Event_Border_Remove *ev = event;
Border_Item *bi; Border_Item *bi;
Eina_List *l; Eina_List *l;
Plugin *p = data; Plugin *p = data;
EINA_LIST_FOREACH(p->borders, l, bi) EINA_LIST_FOREACH (p->borders, l, bi)
if (bi->border == ev->border) if (bi->border == ev->border)
break; break;
@ -98,8 +97,9 @@ _cb_border_remove(void *data, __UNUSED__ int type, void *event)
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
static Eina_Bool static Eina_Bool
_cb_border_add(void *data, __UNUSED__ int type, void *event) _cb_border_add(void *data, __UNUSED__ int type, void *event)
{ {
E_Event_Border_Add *ev = event; E_Event_Border_Add *ev = event;
Plugin *p = data; Plugin *p = data;
@ -116,7 +116,6 @@ _cb_border_add(void *data, __UNUSED__ int type, void *event)
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }
static Evry_Plugin * static Evry_Plugin *
_begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__) _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
{ {
@ -127,14 +126,14 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__)
EVRY_PLUGIN_INSTANCE(p, plugin); EVRY_PLUGIN_INSTANCE(p, plugin);
p->handlers = eina_list_append p->handlers = eina_list_append
(p->handlers, ecore_event_handler_add (p->handlers, ecore_event_handler_add
(E_EVENT_BORDER_REMOVE, _cb_border_remove, p)); (E_EVENT_BORDER_REMOVE, _cb_border_remove, p));
p->handlers = eina_list_append p->handlers = eina_list_append
(p->handlers, ecore_event_handler_add (p->handlers, ecore_event_handler_add
(E_EVENT_BORDER_ADD, _cb_border_add, p)); (E_EVENT_BORDER_ADD, _cb_border_add, p));
EINA_LIST_FOREACH(e_border_focus_stack_get(), l, bd) EINA_LIST_FOREACH (e_border_focus_stack_get(), l, bd)
_border_item_add(p, bd); _border_item_add(p, bd);
return EVRY_PLUGIN(p); return EVRY_PLUGIN(p);
@ -152,10 +151,10 @@ _finish(Evry_Plugin *plugin)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EINA_LIST_FREE(p->borders, bi) EINA_LIST_FREE (p->borders, bi)
EVRY_ITEM_FREE(bi); EVRY_ITEM_FREE(bi);
EINA_LIST_FREE(p->handlers, h) EINA_LIST_FREE (p->handlers, h)
ecore_event_handler_del(h); ecore_event_handler_del(h);
E_FREE(p); E_FREE(p);
@ -169,14 +168,14 @@ _fetch(Evry_Plugin *plugin, const char *input)
EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_ITEMS_CLEAR(p);
EVRY_PLUGIN_MIN_QUERY(p, input) EVRY_PLUGIN_MIN_QUERY(p, input)
{ {
IF_RELEASE(p->input); IF_RELEASE(p->input);
if (input) if (input)
p->input = eina_stringshare_add(input); p->input = eina_stringshare_add(input);
return EVRY_PLUGIN_ITEMS_ADD(p, p->borders, input, 1, 0); return EVRY_PLUGIN_ITEMS_ADD(p, p->borders, input, 1, 0);
} }
return 0; return 0;
} }
@ -192,58 +191,58 @@ _icon_get(Evry_Item *it, Evas *e)
if (bd->internal) if (bd->internal)
{ {
if (!bd->internal_icon) if (!bd->internal_icon)
{ {
o = e_icon_add(e); o = e_icon_add(e);
e_util_icon_theme_set(o, "enlightenment"); e_util_icon_theme_set(o, "enlightenment");
} }
else if (!bd->internal_icon_key) else if (!bd->internal_icon_key)
{ {
char *ext; char *ext;
ext = strrchr(bd->internal_icon, '.'); ext = strrchr(bd->internal_icon, '.');
if ((ext) && ((!strcmp(ext, ".edj")))) if ((ext) && ((!strcmp(ext, ".edj"))))
{ {
o = edje_object_add(e); o = edje_object_add(e);
if (!edje_object_file_set(o, bd->internal_icon, "icon")) if (!edje_object_file_set(o, bd->internal_icon, "icon"))
e_util_icon_theme_set(o, "enlightenment"); e_util_icon_theme_set(o, "enlightenment");
} }
else if (ext) else if (ext)
{ {
o = e_icon_add(e); o = e_icon_add(e);
e_icon_file_set(o, bd->internal_icon); e_icon_file_set(o, bd->internal_icon);
} }
else else
{ {
o = e_icon_add(e); o = e_icon_add(e);
e_icon_scale_size_set(o, 128); e_icon_scale_size_set(o, 128);
if (!e_util_icon_theme_set(o, bd->internal_icon)) if (!e_util_icon_theme_set(o, bd->internal_icon))
e_util_icon_theme_set(o, "enlightenment"); e_util_icon_theme_set(o, "enlightenment");
} }
} }
else else
{ {
o = edje_object_add(e); o = edje_object_add(e);
edje_object_file_set(o, bd->internal_icon, bd->internal_icon_key); edje_object_file_set(o, bd->internal_icon, bd->internal_icon_key);
} }
return o; return o;
} }
if (bd->client.netwm.icons) if (bd->client.netwm.icons)
{ {
if (e_config->use_app_icon) if (e_config->use_app_icon)
goto _use_netwm_icon; goto _use_netwm_icon;
if (bd->remember && (bd->remember->prop.icon_preference == E_ICON_PREF_NETWM)) if (bd->remember && (bd->remember->prop.icon_preference == E_ICON_PREF_NETWM))
goto _use_netwm_icon; goto _use_netwm_icon;
} }
if (bd->desktop) if (bd->desktop)
{ {
o = e_util_desktop_icon_add(bd->desktop, 128, e); o = e_util_desktop_icon_add(bd->desktop, 128, e);
if (o) return o; if (o) return o;
} }
_use_netwm_icon: _use_netwm_icon:
if (bd->client.netwm.icons) if (bd->client.netwm.icons)
{ {
int i, size, tmp, found = 0; int i, size, tmp, found = 0;
@ -276,7 +275,6 @@ _icon_get(Evry_Item *it, Evas *e)
return o; return o;
} }
/***************************************************************************/ /***************************************************************************/
static int static int
@ -290,36 +288,36 @@ _check_border(Evry_Action *act, const Evry_Item *it)
if (!bd) if (!bd)
{ {
ERR("no border"); ERR("no border");
return 0; return 0;
} }
switch (action) switch (action)
{ {
case BORDER_CLOSE: case BORDER_CLOSE:
if (bd->lock_close) if (bd->lock_close)
return 0; return 0;
break; break;
case BORDER_SHOW: case BORDER_SHOW:
if (bd->lock_focus_in) if (bd->lock_focus_in)
return 0; return 0;
break; break;
case BORDER_HIDE: case BORDER_HIDE:
if (bd->lock_user_iconify) if (bd->lock_user_iconify)
return 0; return 0;
break; break;
case BORDER_FULLSCREEN: case BORDER_FULLSCREEN:
if (!bd->lock_user_fullscreen) if (!bd->lock_user_fullscreen)
return 0; return 0;
break; break;
case BORDER_TODESK: case BORDER_TODESK:
if (bd->desk == (e_desk_current_get(zone))) if (bd->desk == (e_desk_current_get(zone)))
return 0; return 0;
break; break;
} }
return 1; return 1;
@ -337,77 +335,78 @@ _act_border(Evry_Action *act)
if (!bd) if (!bd)
{ {
ERR("no border"); ERR("no border");
return 0; return 0;
} }
switch (action) switch (action)
{ {
case BORDER_CLOSE: case BORDER_CLOSE:
e_border_act_close_begin(bd); e_border_act_close_begin(bd);
break; break;
case BORDER_SHOW: case BORDER_SHOW:
if (bd->desk != (e_desk_current_get(zone))) if (bd->desk != (e_desk_current_get(zone)))
e_desk_show(bd->desk); e_desk_show(bd->desk);
focus = 1; focus = 1;
break; break;
case BORDER_HIDE: case BORDER_HIDE:
e_border_iconify(bd); e_border_iconify(bd);
break; break;
case BORDER_FULLSCREEN: case BORDER_FULLSCREEN:
if (!bd->fullscreen) if (!bd->fullscreen)
e_border_fullscreen(bd, E_FULLSCREEN_RESIZE); e_border_fullscreen(bd, E_FULLSCREEN_RESIZE);
else else
e_border_unfullscreen(bd); e_border_unfullscreen(bd);
break; break;
case BORDER_TODESK: case BORDER_TODESK:
if (bd->desk != (e_desk_current_get(zone))) if (bd->desk != (e_desk_current_get(zone)))
e_border_desk_set(bd, e_desk_current_get(zone)); e_border_desk_set(bd, e_desk_current_get(zone));
focus = 1; focus = 1;
break; break;
default: default:
break; break;
} }
if (focus) if (focus)
{ {
if (bd->shaded) if (bd->shaded)
e_border_unshade(bd, E_DIRECTION_UP); e_border_unshade(bd, E_DIRECTION_UP);
if (bd->iconic) if (bd->iconic)
e_border_uniconify(bd); e_border_uniconify(bd);
else else
e_border_raise(bd); e_border_raise(bd);
if (!bd->lock_focus_out) if (!bd->lock_focus_out)
{ {
e_border_focus_set(bd, 1, 1); e_border_focus_set(bd, 1, 1);
e_border_focus_latest_set(bd); e_border_focus_latest_set(bd);
} }
if ((e_config->focus_policy != E_FOCUS_CLICK) || if ((e_config->focus_policy != E_FOCUS_CLICK) ||
(e_config->winlist_warp_at_end) || (e_config->winlist_warp_at_end) ||
(e_config->winlist_warp_while_selecting)) (e_config->winlist_warp_while_selecting))
{ {
int warp_to_x = bd->x + (bd->w / 2); int warp_to_x = bd->x + (bd->w / 2);
if (warp_to_x < (bd->zone->x + 1)) if (warp_to_x < (bd->zone->x + 1))
warp_to_x = bd->zone->x + ((bd->x + bd->w - bd->zone->x) / 2); warp_to_x = bd->zone->x + ((bd->x + bd->w - bd->zone->x) / 2);
else if (warp_to_x >= (bd->zone->x + bd->zone->w - 1)) else if (warp_to_x >= (bd->zone->x + bd->zone->w - 1))
warp_to_x = (bd->zone->x + bd->zone->w + bd->x) / 2; warp_to_x = (bd->zone->x + bd->zone->w + bd->x) / 2;
int warp_to_y = bd->y + (bd->h / 2); int warp_to_y = bd->y + (bd->h / 2);
if (warp_to_y < (bd->zone->y + 1)) if (warp_to_y < (bd->zone->y + 1))
warp_to_y = bd->zone->y + ((bd->y + bd->h - bd->zone->y) / 2); warp_to_y = bd->zone->y + ((bd->y + bd->h - bd->zone->y) / 2);
else if (warp_to_y >= (bd->zone->y + bd->zone->h - 1)) else if (warp_to_y >= (bd->zone->y + bd->zone->h - 1))
warp_to_y = (bd->zone->y + bd->zone->h + bd->y) / 2; warp_to_y = (bd->zone->y + bd->zone->h + bd->y) / 2;
ecore_x_pointer_warp(bd->zone->container->win, warp_to_x, warp_to_y); ecore_x_pointer_warp(bd->zone->container->win, warp_to_x, warp_to_y);
} }
/* e_border_focus_set_with_pointer(bd); */ /* e_border_focus_set_with_pointer(bd); */
} }
return 1; return 1;
@ -424,42 +423,42 @@ _plugins_init(const Evry_API *_api)
return EINA_FALSE; return EINA_FALSE;
_plug = EVRY_PLUGIN_BASE("Windows", "preferences-system-windows", _plug = EVRY_PLUGIN_BASE("Windows", "preferences-system-windows",
EVRY_TYPE_BORDER, _begin, _finish, _fetch); EVRY_TYPE_BORDER, _begin, _finish, _fetch);
_plug->transient = EINA_TRUE; _plug->transient = EINA_TRUE;
evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 2); evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 2);
act = EVRY_ACTION_NEW("Switch to Window", act = EVRY_ACTION_NEW("Switch to Window",
EVRY_TYPE_BORDER, 0, "go-next", EVRY_TYPE_BORDER, 0, "go-next",
_act_border, _check_border); _act_border, _check_border);
EVRY_ITEM_DATA_INT_SET(act, BORDER_SHOW); EVRY_ITEM_DATA_INT_SET(act, BORDER_SHOW);
evry->action_register(act, 1); evry->action_register(act, 1);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
act = EVRY_ACTION_NEW("Iconify", act = EVRY_ACTION_NEW("Iconify",
EVRY_TYPE_BORDER, 0, "go-down", EVRY_TYPE_BORDER, 0, "go-down",
_act_border, _check_border); _act_border, _check_border);
EVRY_ITEM_DATA_INT_SET(act, BORDER_HIDE); EVRY_ITEM_DATA_INT_SET(act, BORDER_HIDE);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
evry->action_register(act, 2); evry->action_register(act, 2);
act = EVRY_ACTION_NEW("Toggle Fullscreen", act = EVRY_ACTION_NEW("Toggle Fullscreen",
EVRY_TYPE_BORDER, 0, "view-fullscreen", EVRY_TYPE_BORDER, 0, "view-fullscreen",
_act_border, _check_border); _act_border, _check_border);
EVRY_ITEM_DATA_INT_SET(act, BORDER_FULLSCREEN); EVRY_ITEM_DATA_INT_SET(act, BORDER_FULLSCREEN);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
evry->action_register(act, 4); evry->action_register(act, 4);
act = EVRY_ACTION_NEW("Close", act = EVRY_ACTION_NEW("Close",
EVRY_TYPE_BORDER, 0, "list-remove", EVRY_TYPE_BORDER, 0, "list-remove",
_act_border, _check_border); _act_border, _check_border);
EVRY_ITEM_DATA_INT_SET(act, BORDER_CLOSE); EVRY_ITEM_DATA_INT_SET(act, BORDER_CLOSE);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
evry->action_register(act, 3); evry->action_register(act, 3);
act = EVRY_ACTION_NEW("Send to Desktop", act = EVRY_ACTION_NEW("Send to Desktop",
EVRY_TYPE_BORDER, 0, "go-previous", EVRY_TYPE_BORDER, 0, "go-previous",
_act_border, _check_border); _act_border, _check_border);
EVRY_ITEM_DATA_INT_SET(act, BORDER_TODESK); EVRY_ITEM_DATA_INT_SET(act, BORDER_TODESK);
_actions = eina_list_append(_actions, act); _actions = eina_list_append(_actions, act);
evry->action_register(act, 3); evry->action_register(act, 3);
@ -474,7 +473,7 @@ _plugins_shutdown(void)
EVRY_PLUGIN_FREE(_plug); EVRY_PLUGIN_FREE(_plug);
EINA_LIST_FREE(_actions, act) EINA_LIST_FREE (_actions, act)
EVRY_ACTION_FREE(act); EVRY_ACTION_FREE(act);
} }
@ -496,3 +495,4 @@ evry_plug_windows_shutdown(void)
void void
evry_plug_windows_save(void){} evry_plug_windows_save(void){}

View File

@ -13,11 +13,10 @@ evry_plugins_shutdown(void)
{ {
Evry_Action *act; Evry_Action *act;
EINA_LIST_FREE(actions, act) EINA_LIST_FREE (actions, act)
evry_action_free(act); evry_action_free(act);
} }
static int static int
_evry_cb_plugin_sort(const void *data1, const void *data2) _evry_cb_plugin_sort(const void *data1, const void *data2)
{ {
@ -46,11 +45,11 @@ _evry_plugin_free(Evry_Item *it)
Evry_Plugin * Evry_Plugin *
evry_plugin_new(Evry_Plugin *base, const char *name, const char *label, evry_plugin_new(Evry_Plugin *base, const char *name, const char *label,
const char *icon, Evry_Type item_type, const char *icon, Evry_Type item_type,
Evry_Plugin *(*begin) (Evry_Plugin *p, const Evry_Item *item), Evry_Plugin *(*begin)(Evry_Plugin * p, const Evry_Item * item),
void (*finish) (Evry_Plugin *p), void (*finish)(Evry_Plugin *p),
int (*fetch) (Evry_Plugin *p, const char *input), int (*fetch)(Evry_Plugin *p, const char *input),
void (*cb_free) (Evry_Plugin *p)) void (*cb_free)(Evry_Plugin *p))
{ {
Evry_Plugin *p; Evry_Plugin *p;
Evry_Item *it; Evry_Item *it;
@ -63,19 +62,19 @@ evry_plugin_new(Evry_Plugin *base, const char *name, const char *label,
it = evry_item_new(EVRY_ITEM(p), NULL, label, NULL, _evry_plugin_free); it = evry_item_new(EVRY_ITEM(p), NULL, label, NULL, _evry_plugin_free);
it->plugin = p; it->plugin = p;
it->browseable = EINA_TRUE; it->browseable = EINA_TRUE;
it->type = EVRY_TYPE_PLUGIN; it->type = EVRY_TYPE_PLUGIN;
if (item_type) if (item_type)
it->subtype = item_type; it->subtype = item_type;
if (icon) if (icon)
it->icon = eina_stringshare_add(icon); it->icon = eina_stringshare_add(icon);
p->name = eina_stringshare_add(name); p->name = eina_stringshare_add(name);
p->begin = begin; p->begin = begin;
p->finish = finish; p->finish = finish;
p->fetch = fetch; p->fetch = fetch;
p->async_fetch = EINA_FALSE; p->async_fetch = EINA_FALSE;
p->history = EINA_TRUE; p->history = EINA_TRUE;
p->free = cb_free; p->free = cb_free;
@ -107,10 +106,10 @@ _evry_plugin_action_browse(Evry_Action *act)
if ((p = pp->begin(pp, it))) if ((p = pp->begin(pp, it)))
{ {
plugins = eina_list_append(plugins, p); plugins = eina_list_append(plugins, p);
if (!evry_state_push(sel, plugins)) if (!evry_state_push(sel, plugins))
eina_list_free(plugins); eina_list_free(plugins);
} }
return 0; return 0;
@ -134,37 +133,37 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority)
else if (type == EVRY_PLUGIN_OBJECT) else if (type == EVRY_PLUGIN_OBJECT)
conf = evry_conf->conf_objects; conf = evry_conf->conf_objects;
EINA_LIST_FOREACH(conf, l, pc) EINA_LIST_FOREACH (conf, l, pc)
if (pc->name && p->name && !strcmp(pc->name, p->name)) if (pc->name && p->name && !strcmp(pc->name, p->name))
break; break;
/* check if module of same name is already loaded */ /* check if module of same name is already loaded */
/* if ((pc) && (pc->plugin)) /* if ((pc) && (pc->plugin))
* return 0; */ * return 0; */
/* collection plugin sets its own config */ /* collection plugin sets its own config */
if (!pc && p->config) if (!pc && p->config)
{ {
conf = eina_list_append(conf, p->config); conf = eina_list_append(conf, p->config);
pc = p->config; pc = p->config;
} }
else if (!pc) else if (!pc)
{ {
new_conf = 1; new_conf = 1;
pc = E_NEW(Plugin_Config, 1); pc = E_NEW(Plugin_Config, 1);
pc->name = eina_stringshare_add(p->name); pc->name = eina_stringshare_add(p->name);
pc->enabled = 1; pc->enabled = 1;
pc->priority = priority ? priority : 100; pc->priority = priority ? priority : 100;
pc->view_mode = VIEW_MODE_NONE; pc->view_mode = VIEW_MODE_NONE;
pc->aggregate = EINA_TRUE; pc->aggregate = EINA_TRUE;
pc->top_level = EINA_TRUE; pc->top_level = EINA_TRUE;
conf = eina_list_append(conf, pc); conf = eina_list_append(conf, pc);
} }
if (pc->trigger && strlen(pc->trigger) == 0) if (pc->trigger && strlen(pc->trigger) == 0)
{ {
eina_stringshare_del(pc->trigger); eina_stringshare_del(pc->trigger);
pc->trigger = NULL; pc->trigger = NULL;
} }
p->config = pc; p->config = pc;
@ -178,28 +177,28 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority)
evry_conf->conf_actions = conf; evry_conf->conf_actions = conf;
else if (type == EVRY_PLUGIN_OBJECT) else if (type == EVRY_PLUGIN_OBJECT)
evry_conf->conf_objects = conf; evry_conf->conf_objects = conf;
if ((type == EVRY_PLUGIN_SUBJECT) && (p->name && strcmp(p->name, "All"))) if ((type == EVRY_PLUGIN_SUBJECT) && (p->name && strcmp(p->name, "All")))
{ {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name); snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name);
e_action_predef_name_set(_("Everything Launcher"), buf, e_action_predef_name_set(_("Everything Launcher"), buf,
"everything", p->name, NULL, 1); "everything", p->name, NULL, 1);
} }
if (p->input_type) if (p->input_type)
{ {
Evry_Action *act; Evry_Action *act;
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), _("Browse %s"), EVRY_ITEM(p)->label); snprintf(buf, sizeof(buf), _("Browse %s"), EVRY_ITEM(p)->label);
act = EVRY_ACTION_NEW(buf, p->input_type, 0, EVRY_ITEM(p)->icon, act = EVRY_ACTION_NEW(buf, p->input_type, 0, EVRY_ITEM(p)->icon,
_evry_plugin_action_browse, NULL); _evry_plugin_action_browse, NULL);
EVRY_ITEM(act)->icon_get = EVRY_ITEM(p)->icon_get; EVRY_ITEM(act)->icon_get = EVRY_ITEM(p)->icon_get;
EVRY_ITEM(act)->data = p; EVRY_ITEM(act)->data = p;
evry_action_register(act, 1); evry_action_register(act, 1);
actions = eina_list_append(actions, act); actions = eina_list_append(actions, act);
} }
return new_conf; return new_conf;
@ -213,10 +212,10 @@ evry_plugin_unregister(Evry_Plugin *p)
if (l && eina_list_data_find_list(l, p->config)) if (l && eina_list_data_find_list(l, p->config))
{ {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name); snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name);
e_action_predef_name_del(_("Everything"), buf); e_action_predef_name_del(_("Everything"), buf);
} }
} }
@ -227,11 +226,11 @@ evry_plugin_find(const char *name)
Eina_List *l; Eina_List *l;
const char *n = eina_stringshare_add(name); const char *n = eina_stringshare_add(name);
EINA_LIST_FOREACH(evry_conf->conf_subjects, l, pc) EINA_LIST_FOREACH (evry_conf->conf_subjects, l, pc)
{ {
if (!pc->plugin) continue; if (!pc->plugin) continue;
if (pc->name == n) if (pc->name == n)
break; break;
} }
eina_stringshare_del(n); eina_stringshare_del(n);
@ -240,3 +239,4 @@ evry_plugin_find(const char *name)
return pc->plugin; return pc->plugin;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -27,30 +27,30 @@ _cb_key_down(Evry_View *v, const Ecore_Event_Key *ev)
if (!strcmp(ev->key, "Down")) if (!strcmp(ev->key, "Down"))
{ {
o = v->o_list; o = v->o_list;
evas_object_geometry_get(o, NULL, NULL, NULL, &h); evas_object_geometry_get(o, NULL, NULL, NULL, &h);
if (!h) h = 1; if (!h) h = 1;
e_box_align_get(o, NULL, &align); e_box_align_get(o, NULL, &align);
align = align - 10.0/(double)h; align = align - 10.0 / (double)h;
if (align < 0.0) align = 0.0; if (align < 0.0) align = 0.0;
e_box_align_set(v->o_list, 0.5, align); e_box_align_set(v->o_list, 0.5, align);
return 1; return 1;
} }
else if (!strcmp(ev->key, "Up")) else if (!strcmp(ev->key, "Up"))
{ {
o = v->o_list; o = v->o_list;
evas_object_geometry_get(o, NULL, NULL, NULL, &h); evas_object_geometry_get(o, NULL, NULL, NULL, &h);
if (!h) h = 1; if (!h) h = 1;
e_box_align_get(o, NULL, &align); e_box_align_get(o, NULL, &align);
align = align + 10.0/(double)h; align = align + 10.0 / (double)h;
if (align > 1.0) align = 1.0; if (align > 1.0) align = 1.0;
e_box_align_set(v->o_list, 0.5, align); e_box_align_set(v->o_list, 0.5, align);
return 1; return 1;
} }
evry_view_toggle(v->state, NULL); evry_view_toggle(v->state, NULL);
@ -62,7 +62,7 @@ _view_create(Evry_View *v, const Evry_State *s __UNUSED__, const Evas_Object *sw
{ {
Evas_Object *o; Evas_Object *o;
int mw, mh; int mw, mh;
char *text = char *text =
_(" Ok, here comes the explanation of <hilight>everything</hilight>...<br>" _(" Ok, here comes the explanation of <hilight>everything</hilight>...<br>"
" Just type a few letters of the thing you are looking for. <br>" " Just type a few letters of the thing you are looking for. <br>"
@ -93,7 +93,7 @@ _view_create(Evry_View *v, const Evry_State *s __UNUSED__, const Evas_Object *sw
e_box_freeze(v->o_list); e_box_freeze(v->o_list);
o = edje_object_add(evas_object_evas_get(swallow)); o = edje_object_add(evas_object_evas_get(swallow));
e_theme_edje_object_set(o, "base/theme/widgets", e_theme_edje_object_set(o, "base/theme/widgets",
"e/modules/everything/textblock"); "e/modules/everything/textblock");
edje_object_part_text_set(o, "e.textblock.text", text); edje_object_part_text_set(o, "e.textblock.text", text);
e_box_pack_start(v->o_list, o); e_box_pack_start(v->o_list, o);
@ -141,3 +141,4 @@ evry_view_help_shutdown(void)
evry_view_unregister(view); evry_view_unregister(view);
E_FREE(view); E_FREE(view);
} }

View File

@ -1,15 +1,14 @@
#include "e_mod_main.h" #include "e_mod_main.h"
typedef struct _Tab Tab; typedef struct _Tab Tab;
struct _Tab struct _Tab
{ {
Tab_View *tab_view; Tab_View *tab_view;
Evry_Plugin *plugin; Evry_Plugin *plugin;
Evas_Object *o_tab; Evas_Object *o_tab;
int cw, mw; int cw, mw;
}; };
static void _tabs_update(Tab_View *v); static void _tabs_update(Tab_View *v);
@ -46,14 +45,15 @@ _tab_cb_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev
if (tab->plugin) if (tab->plugin)
{ {
_plugin_select(v, tab->plugin); _plugin_select(v, tab->plugin);
v->view->update(v->view); v->view->update(v->view);
} }
else else
{ {
evry_browse_back(v->state->selector); evry_browse_back(v->state->selector);
} }
} }
static void static void
_tabs_cb_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) _tabs_cb_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
{ {
@ -62,15 +62,16 @@ _tabs_cb_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void
if (ev->z > 0) if (ev->z > 0)
{ {
_plugin_next(v); _plugin_next(v);
v->view->update(v->view); v->view->update(v->view);
} }
else if (ev->z < 0) else if (ev->z < 0)
{ {
_plugin_prev(v); _plugin_prev(v);
v->view->update(v->view); v->view->update(v->view);
} }
} }
static Tab * static Tab *
_add_tab(Tab_View *v, Evry_Plugin *p) _add_tab(Tab_View *v, Evry_Plugin *p)
{ {
@ -81,25 +82,25 @@ _add_tab(Tab_View *v, Evry_Plugin *p)
o = edje_object_add(v->evas); o = edje_object_add(v->evas);
if (p) if (p)
{ {
e_theme_edje_object_set(o, "base/theme/modules/everything", e_theme_edje_object_set(o, "base/theme/modules/everything",
"e/modules/everything/tab_item"); "e/modules/everything/tab_item");
edje_object_part_text_set(o, "e.text.label", EVRY_ITEM(p)->label); edje_object_part_text_set(o, "e.text.label", EVRY_ITEM(p)->label);
} }
else else
{ {
e_theme_edje_object_set(o, "base/theme/modules/everything", e_theme_edje_object_set(o, "base/theme/modules/everything",
"e/modules/everything/tab_item/back"); "e/modules/everything/tab_item/back");
edje_object_part_text_set(o, "e.text.label", _("Back")); edje_object_part_text_set(o, "e.text.label", _("Back"));
} }
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
_tab_cb_down, tab); _tab_cb_down, tab);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP,
_tab_cb_up, tab); _tab_cb_up, tab);
tab->o_tab = o; tab->o_tab = o;
edje_object_size_min_calc(o, &tab->cw, NULL); edje_object_size_min_calc(o, &tab->cw, NULL);
edje_object_size_min_get(o, &tab->mw, NULL); edje_object_size_min_get(o, &tab->mw, NULL);
v->tabs = eina_list_append(v->tabs, tab); v->tabs = eina_list_append(v->tabs, tab);
@ -119,86 +120,85 @@ _tabs_update(Tab_View *v)
if (s->delete_me) if (s->delete_me)
return; return;
edje_object_calc_force(v->o_tabs); edje_object_calc_force(v->o_tabs);
evas_object_geometry_get(v->o_tabs, &x, NULL, &w, NULL); evas_object_geometry_get(v->o_tabs, &x, NULL, &w, NULL);
if (!w && !v->timer) if (!w && !v->timer)
{ {
v->timer = ecore_timer_add(0.001, _timer_cb, v); v->timer = ecore_timer_add(0.001, _timer_cb, v);
return; return;
} }
/* remove tabs for not active plugins */ /* remove tabs for not active plugins */
e_box_freeze(v->o_tabs); e_box_freeze(v->o_tabs);
EINA_LIST_FOREACH(v->tabs, l, tab) EINA_LIST_FOREACH (v->tabs, l, tab)
{ {
if (!tab->plugin) if (!tab->plugin)
continue; continue;
e_box_unpack(tab->o_tab); e_box_unpack(tab->o_tab);
evas_object_hide(tab->o_tab); evas_object_hide(tab->o_tab);
} }
if (s->selector->states->next) if (s->selector->states->next)
{ {
cur++; cur++;
i++; i++;
if (!(tab = eina_list_data_get(v->tabs))) if (!(tab = eina_list_data_get(v->tabs)))
{ {
tab = _add_tab(v, NULL); tab = _add_tab(v, NULL);
o = tab->o_tab; o = tab->o_tab;
evas_object_show(o); evas_object_show(o);
e_box_pack_end(v->o_tabs, o); e_box_pack_end(v->o_tabs, o);
e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5, w/4, 10, w/3, 9999); e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5, w / 4, 10, w / 3, 9999);
} }
} }
for(l = s->cur_plugins; l; l = l->next, cur++) for (l = s->cur_plugins; l; l = l->next, cur++)
if (l->data == s->plugin) break; if (l->data == s->plugin) break;
if (cur > 2) if (cur > 2)
{ {
if ((cur + 1) == eina_list_count(s->cur_plugins)) if ((cur + 1) == eina_list_count(s->cur_plugins))
plugins = eina_list_nth_list(s->cur_plugins, cur - 3); plugins = eina_list_nth_list(s->cur_plugins, cur - 3);
else else
plugins = eina_list_nth_list(s->cur_plugins, cur - 2); plugins = eina_list_nth_list(s->cur_plugins, cur - 2);
} }
else else
{ {
plugins = s->cur_plugins; plugins = s->cur_plugins;
} }
/* show/update tabs of active plugins */ /* show/update tabs of active plugins */
EINA_LIST_FOREACH(plugins, l, p) EINA_LIST_FOREACH (plugins, l, p)
{ {
EINA_LIST_FOREACH(v->tabs, ll, tab) EINA_LIST_FOREACH (v->tabs, ll, tab)
if (tab->plugin == p) break; if (tab->plugin == p) break;
if (!tab && !(tab = _add_tab(v, p))) if (!tab && !(tab = _add_tab(v, p)))
continue; continue;
o = tab->o_tab; o = tab->o_tab;
evas_object_show(o); evas_object_show(o);
e_box_pack_end(v->o_tabs, o); e_box_pack_end(v->o_tabs, o);
e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5, w/4, 10, w/3, 9999); e_box_pack_options_set(o, 1, 1, 0, 0, 0.0, 0.5, w / 4, 10, w / 3, 9999);
if (s->plugin == p) if (s->plugin == p)
edje_object_signal_emit(o, "e,state,selected", "e"); edje_object_signal_emit(o, "e,state,selected", "e");
else else
edje_object_signal_emit(o, "e,state,unselected", "e"); edje_object_signal_emit(o, "e,state,unselected", "e");
if (++i > 3) break; if (++i > 3) break;
} }
e_box_align_set(v->o_tabs, 0.0, 0.5); e_box_align_set(v->o_tabs, 0.0, 0.5);
e_box_thaw(v->o_tabs); e_box_thaw(v->o_tabs);
} }
static void static void
_tabs_clear(Tab_View *v) _tabs_clear(Tab_View *v)
{ {
@ -206,13 +206,13 @@ _tabs_clear(Tab_View *v)
Tab *tab; Tab *tab;
e_box_freeze(v->o_tabs); e_box_freeze(v->o_tabs);
EINA_LIST_FOREACH(v->tabs, l, tab) EINA_LIST_FOREACH (v->tabs, l, tab)
{ {
if (!tab->plugin) if (!tab->plugin)
continue; continue;
e_box_unpack(tab->o_tab); e_box_unpack(tab->o_tab);
evas_object_hide(tab->o_tab); evas_object_hide(tab->o_tab);
} }
e_box_thaw(v->o_tabs); e_box_thaw(v->o_tabs);
} }
@ -254,23 +254,23 @@ _plugin_next_by_name(Tab_View *v, const char *key)
if (!s->plugin) return; if (!s->plugin) return;
EINA_LIST_FOREACH(s->cur_plugins, l, p) EINA_LIST_FOREACH (s->cur_plugins, l, p)
{ {
/* if (!p) /* if (!p)
* { * {
* // FIXME how can this happen? * // FIXME how can this happen?
* ERR("plugin == NULL"); * ERR("plugin == NULL");
* continue; * continue;
* } */ * } */
if (EVRY_ITEM(p)->label && (!strncasecmp(EVRY_ITEM(p)->label, key, 1))) if (EVRY_ITEM(p)->label && (!strncasecmp(EVRY_ITEM(p)->label, key, 1)))
{ {
if (!first) first = p; if (!first) first = p;
if (found && !next) if (found && !next)
next = p; next = p;
} }
if (p == s->plugin) found = 1; if (p == s->plugin) found = 1;
} }
if (next) if (next)
@ -298,15 +298,14 @@ _plugin_prev(Tab_View *v)
p = l->prev->data; p = l->prev->data;
else else
{ {
l = eina_list_last(s->cur_plugins); l = eina_list_last(s->cur_plugins);
if (s->plugin != l->data) if (s->plugin != l->data)
p = l->data; p = l->data;
} }
if (p) _plugin_select(v, p); if (p) _plugin_select(v, p);
} }
static int static int
_tabs_key_down(Tab_View *v, const Ecore_Event_Key *ev) _tabs_key_down(Tab_View *v, const Ecore_Event_Key *ev)
{ {
@ -316,40 +315,39 @@ _tabs_key_down(Tab_View *v, const Ecore_Event_Key *ev)
if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)
{ {
if (!strcmp(key, "Next")) if (!strcmp(key, "Next"))
{ {
_plugin_next(v); _plugin_next(v);
return 1; return 1;
} }
else if (!strcmp(key, "Prior")) else if (!strcmp(key, "Prior"))
{ {
_plugin_prev(v); _plugin_prev(v);
return 1; return 1;
} }
} }
else if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) else if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)
{ {
if (!strcmp(key, "Left")) if (!strcmp(key, "Left"))
{ {
_plugin_prev(v); _plugin_prev(v);
return 1; return 1;
} }
else if (!strcmp(key, "Right")) else if (!strcmp(key, "Right"))
{ {
_plugin_next(v); _plugin_next(v);
return 1; return 1;
} }
else if (ev->compose) else if (ev->compose)
{ {
_plugin_next_by_name(v, key); _plugin_next_by_name(v, key);
return 1; return 1;
} }
} }
return 0; return 0;
} }
Tab_View * Tab_View *
evry_tab_view_new(Evry_View *view, const Evry_State *s, Evas *e) evry_tab_view_new(Evry_View *view, const Evry_State *s, Evas *e)
{ {
@ -357,8 +355,8 @@ evry_tab_view_new(Evry_View *view, const Evry_State *s, Evas *e)
Evas_Object *o; Evas_Object *o;
v = E_NEW(Tab_View, 1); v = E_NEW(Tab_View, 1);
v->update = &_tabs_update; v->update = &_tabs_update;
v->clear = &_tabs_clear; v->clear = &_tabs_clear;
v->key_down = &_tabs_key_down; v->key_down = &_tabs_key_down;
v->view = view; v->view = view;
v->state = s; v->state = s;
@ -368,7 +366,7 @@ evry_tab_view_new(Evry_View *view, const Evry_State *s, Evas *e)
e_box_orientation_set(o, 1); e_box_orientation_set(o, 1);
e_box_homogenous_set(o, 1); e_box_homogenous_set(o, 1);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL,
_tabs_cb_wheel, v); _tabs_cb_wheel, v);
v->o_tabs = o; v->o_tabs = o;
return v; return v;
@ -379,11 +377,11 @@ evry_tab_view_free(Tab_View *v)
{ {
Tab *tab; Tab *tab;
EINA_LIST_FREE(v->tabs, tab) EINA_LIST_FREE (v->tabs, tab)
{ {
e_box_unpack(tab->o_tab); e_box_unpack(tab->o_tab);
evas_object_del(tab->o_tab); evas_object_del(tab->o_tab);
E_FREE(tab); E_FREE(tab);
} }
evas_object_del(v->o_tabs); evas_object_del(v->o_tabs);
@ -396,3 +394,4 @@ evry_tab_view_free(Tab_View *v)
E_FREE(v); E_FREE(v);
} }

View File

@ -19,135 +19,144 @@
#include "config.h" #include "config.h"
#endif #endif
#include <string.h> /* for memcpy() */ #include <string.h> /* for memcpy() */
#include "md5.h" #include "md5.h"
#if (__BYTE_ORDER == 1234) #if (__BYTE_ORDER == 1234)
#define byteReverse(buf, len) /* Nothing */ #define byteReverse(buf, len) /* Nothing */
#else #else
void byteReverse(unsigned char *buf, unsigned longs); void byteReverse(unsigned char *buf, unsigned longs);
/* /*
* Note: this code is harmless on little-endian machines. * Note: this code is harmless on little-endian machines.
*/ */
void byteReverse(unsigned char *buf, unsigned longs) void
byteReverse(unsigned char *buf, unsigned longs)
{ {
uint32_t t; uint32_t t;
do { do {
t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | t = (uint32_t)((unsigned)buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]); ((unsigned)buf[1] << 8 | buf[0]);
*(uint32_t *) buf = t; *(uint32_t *)buf = t;
buf += 4; buf += 4;
} while (--longs); } while (--longs);
} }
#endif #endif
/* /*
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
* initialization constants. * initialization constants.
*/ */
void MD5Init(MD5_CTX *ctx) void
MD5Init(MD5_CTX *ctx)
{ {
ctx->buf[0] = 0x67452301; ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89; ctx->buf[1] = 0xefcdab89;
ctx->buf[2] = 0x98badcfe; ctx->buf[2] = 0x98badcfe;
ctx->buf[3] = 0x10325476; ctx->buf[3] = 0x10325476;
ctx->bits[0] = 0; ctx->bits[0] = 0;
ctx->bits[1] = 0; ctx->bits[1] = 0;
} }
/* /*
* Update context to reflect the concatenation of another buffer full * Update context to reflect the concatenation of another buffer full
* of bytes. * of bytes.
*/ */
void MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len) void
MD5Update(MD5_CTX *ctx, unsigned char const *buf, unsigned len)
{ {
uint32_t t; uint32_t t;
/* Update bitcount */ /* Update bitcount */
t = ctx->bits[0]; t = ctx->bits[0];
if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) if ((ctx->bits[0] = t + ((uint32_t)len << 3)) < t)
ctx->bits[1]++; /* Carry from low to high */ ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29; ctx->bits[1] += len >> 29;
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
/* Handle any leading odd-sized chunks */ /* Handle any leading odd-sized chunks */
if (t) { if (t)
unsigned char *p = (unsigned char *) ctx->in + t; {
unsigned char *p = (unsigned char *)ctx->in + t;
t = 64 - t; t = 64 - t;
if (len < t) { if (len < t)
memcpy(p, buf, len); {
return; memcpy(p, buf, len);
} return;
memcpy(p, buf, t); }
byteReverse(ctx->in, 16); memcpy(p, buf, t);
MD5Transform(ctx->buf, (uint32_t *) ctx->in); byteReverse(ctx->in, 16);
buf += t; MD5Transform(ctx->buf, (uint32_t *)ctx->in);
len -= t; buf += t;
} len -= t;
/* Process data in 64-byte chunks */ }
/* Process data in 64-byte chunks */
while (len >= 64) { while (len >= 64) {
memcpy(ctx->in, buf, 64); memcpy(ctx->in, buf, 64);
byteReverse(ctx->in, 16); byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32_t *) ctx->in); MD5Transform(ctx->buf, (uint32_t *)ctx->in);
buf += 64; buf += 64;
len -= 64; len -= 64;
} }
/* Handle any remaining bytes of data. */ /* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len); memcpy(ctx->in, buf, len);
} }
/* /*
* Final wrapup - pad to 64-byte boundary with the bit pattern * Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first) * 1 0* (64-bit count of bits processed, MSB-first)
*/ */
void MD5Final(unsigned char digest[16], MD5_CTX *ctx) void
MD5Final(unsigned char digest[16], MD5_CTX *ctx)
{ {
unsigned count; unsigned count;
unsigned char *p; unsigned char *p;
/* Compute number of bytes mod 64 */ /* Compute number of bytes mod 64 */
count = (ctx->bits[0] >> 3) & 0x3F; count = (ctx->bits[0] >> 3) & 0x3F;
/* Set the first char of padding to 0x80. This is safe since there is /* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */ always at least one byte free */
p = ctx->in + count; p = ctx->in + count;
*p++ = 0x80; *p++ = 0x80;
/* Bytes of padding needed to make 64 bytes */ /* Bytes of padding needed to make 64 bytes */
count = 64 - 1 - count; count = 64 - 1 - count;
/* Pad out to 56 mod 64 */ /* Pad out to 56 mod 64 */
if (count < 8) { if (count < 8)
/* Two lots of padding: Pad the first block to 64 bytes */ {
memset(p, 0, count); /* Two lots of padding: Pad the first block to 64 bytes */
byteReverse(ctx->in, 16); memset(p, 0, count);
MD5Transform(ctx->buf, (uint32_t *) ctx->in); byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, (uint32_t *)ctx->in);
/* Now fill the next block with 56 bytes */ /* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56); memset(ctx->in, 0, 56);
} else { }
/* Pad block to 56 bytes */ else {
memset(p, 0, count - 8); /* Pad block to 56 bytes */
} memset(p, 0, count - 8);
byteReverse(ctx->in, 14); }
byteReverse(ctx->in, 14);
/* Append length in bits and transform */ /* Append length in bits and transform */
((uint32_t *) ctx->in)[14] = ctx->bits[0]; ((uint32_t *)ctx->in)[14] = ctx->bits[0];
((uint32_t *) ctx->in)[15] = ctx->bits[1]; ((uint32_t *)ctx->in)[15] = ctx->bits[1];
MD5Transform(ctx->buf, (uint32_t *) ctx->in); MD5Transform(ctx->buf, (uint32_t *)ctx->in);
byteReverse((unsigned char *) ctx->buf, 4); byteReverse((unsigned char *)ctx->buf, 4);
memcpy(digest, ctx->buf, 16); memcpy(digest, ctx->buf, 16);
memset((char *) ctx, 0, sizeof(ctx)); /* In case it's sensitive */ memset((char *)ctx, 0, sizeof(ctx)); /* In case it's sensitive */
} }
/* The four core functions - F1 is optimized somewhat */ /* The four core functions - F1 is optimized somewhat */
@ -160,92 +169,94 @@ void MD5Final(unsigned char digest[16], MD5_CTX *ctx)
/* This is the central step in the MD5 algorithm. */ /* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \ #define MD5STEP(f, w, x, y, z, data, s) \
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) (w += f(x, y, z) + data, w = w << s | w >> (32 - s), w += x)
/* /*
* The core of the MD5 algorithm, this alters an existing MD5 hash to * The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks * reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine. * the data and converts bytes into longwords for this routine.
*/ */
void MD5Transform(uint32_t buf[4], uint32_t const in[16]) void
MD5Transform(uint32_t buf[4], uint32_t const in[16])
{ {
register uint32_t a, b, c, d; register uint32_t a, b, c, d;
a = buf[0]; a = buf[0];
b = buf[1]; b = buf[1];
c = buf[2]; c = buf[2];
d = buf[3]; d = buf[3];
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
buf[0] += a; buf[0] += a;
buf[1] += b; buf[1] += b;
buf[2] += c; buf[2] += c;
buf[3] += d; buf[3] += d;
} }