diff --git a/src/modules/everything/e_mod_main.c b/src/modules/everything/e_mod_main.c index 00f067e50..a3daf715b 100644 --- a/src/modules/everything/e_mod_main.c +++ b/src/modules/everything/e_mod_main.c @@ -1,14 +1,14 @@ #include "e_mod_main.h" -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 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_menu_add(void *data, E_Menu *m); -static void _config_init(void); -static void _config_free(void); -static Eina_Bool _cleanup_history(void *data); -static void _evry_type_init(const char *type); +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 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_menu_add(void *data, E_Menu *m); +static void _config_init(void); +static void _config_free(void); +static Eina_Bool _cleanup_history(void *data); +static void _evry_type_init(const char *type); static Eina_List *_evry_types = NULL; static E_Int_Menu_Augmentation *maug = NULL; static E_Action *act = NULL; @@ -26,10 +26,10 @@ E_Module *_mod_evry = NULL; /* module setup */ EAPI E_Module_Api e_modapi = - { - E_MODULE_API_VERSION, - "Everything" - }; +{ + E_MODULE_API_VERSION, + "Everything" +}; EAPI void * e_modapi_init(E_Module *m) @@ -39,13 +39,13 @@ e_modapi_init(E_Module *m) char buf[4096]; _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 - ("impossible to create a log domain for everything module"); - return NULL; + EINA_LOG_ERR + ("impossible to create a log domain for everything module"); + return NULL; } _mod_evry = m; @@ -54,26 +54,26 @@ e_modapi_init(E_Module *m) act = e_action_add("everything"); if (act) { - act->func.go = _e_mod_action_cb; - act->func.go_edge = _e_mod_action_cb_edge; - e_action_predef_name_set - (_("Everything Launcher"), - _("Show Everything Launcher"), - "everything", "", NULL, 0); + act->func.go = _e_mod_action_cb; + act->func.go_edge = _e_mod_action_cb_edge; + e_action_predef_name_set + (_("Everything Launcher"), + _("Show Everything Launcher"), + "everything", "", NULL, 0); } 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 ("launcher", 80, _("Launcher"), NULL, "modules-launcher"); snprintf(buf, sizeof(buf), "%s/e-module-everything.edj", e_module_dir_get(m)); module_icon = eina_stringshare_add(buf); - + e_configure_registry_item_add ("launcher/run_everything", 40, _("Everything Configuration"), - NULL, module_icon, evry_config_dialog); + NULL, module_icon, evry_config_dialog); evry_init(); _evry_type_init("NONE"); @@ -86,13 +86,13 @@ e_modapi_init(E_Module *m) _evry_type_init("TEXT"); _config_init(); - - _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_CHANGED] = 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_CHANGED] = 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->log_dom = _e_module_evry_log_dom; #define SET(func) (evry->func = &evry_##func); @@ -140,7 +140,7 @@ e_modapi_init(E_Module *m) evry_plug_calc_init(m); 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); evry_plug_collection_init(); @@ -167,14 +167,14 @@ e_modapi_shutdown(E_Module *m __UNUSED__) Eina_List *l; 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) - em->shutdown(); + if (em->active) + em->shutdown(); - em->active = EINA_FALSE; + em->active = EINA_FALSE; } - + evry_plug_apps_shutdown(); evry_plug_files_shutdown(); evry_plug_settings_shutdown(); @@ -196,7 +196,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__) _config_free(); evry_history_free(); - EINA_LIST_FREE(_evry_types, t) + EINA_LIST_FREE (_evry_types, t) eina_stringshare_del(t); e_configure_registry_item_del("launcher/run_everything"); @@ -207,20 +207,20 @@ e_modapi_shutdown(E_Module *m __UNUSED__) if (act) { - e_action_predef_name_del(_("Everything Launcher"), - _("Show Everything Dialog")); - e_action_del("everything"); + e_action_predef_name_del(_("Everything Launcher"), + _("Show Everything Dialog")); + e_action_del("everything"); } if (maug) { - e_int_menus_menu_augmentation_del("main/1", maug); - maug = NULL; + e_int_menus_menu_augmentation_del("main/1", maug); + maug = NULL; } if (module_icon) eina_stringshare_del(module_icon); - + /* Clean EET */ E_CONFIG_DD_FREE(conf_edd); E_CONFIG_DD_FREE(plugin_conf_edd); @@ -231,7 +231,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__) #ifdef CHECK_REFS Evry_Item *it; - EINA_LIST_FREE(_refd, it) + EINA_LIST_FREE (_refd, it) printf("%d %s\n", it->ref, it->label); #endif @@ -250,19 +250,18 @@ e_modapi_save(E_Module *m __UNUSED__) evry_plug_settings_save(); evry_plug_windows_save(); evry_plug_calc_save(); - + return 1; } /***************************************************************************/ 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); } - Evry_Type evry_type_register(const char *type) { @@ -271,16 +270,16 @@ evry_type_register(const char *type) const char *i; Eina_List *l; - EINA_LIST_FOREACH(_evry_types, l, i) + EINA_LIST_FOREACH (_evry_types, l, i) { - if (i == t) break; - ret++; + if (i == t) break; + ret++; } - if(!l) + if (!l) { - _evry_types = eina_list_append(_evry_types, t); - return ret; + _evry_types = eina_list_append(_evry_types, t); + return ret; } eina_stringshare_del(t); @@ -304,7 +303,8 @@ evry_type_get(Evry_Type type) return ret; } -int evry_api_version_check(int version) +int +evry_api_version_check(int version) { if (EVRY_API_VERSION == version) return 1; @@ -314,7 +314,6 @@ int evry_api_version_check(int version) return 0; } - static int _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; } - void 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_sort(evry_conf->views, - eina_list_count(evry_conf->views), - _evry_cb_view_sort); + eina_list_count(evry_conf->views), + _evry_cb_view_sort); } void @@ -411,86 +409,86 @@ _config_init() E_CONFIG_LIST(D, T, conf_subjects, plugin_conf_edd); E_CONFIG_LIST(D, T, conf_actions, plugin_conf_edd); E_CONFIG_LIST(D, T, conf_objects, plugin_conf_edd); - E_CONFIG_LIST(D, T, conf_views, plugin_conf_edd); - E_CONFIG_LIST(D, T, collections, plugin_conf_edd); - E_CONFIG_LIST(D, T, gadgets, gadget_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, gadgets, gadget_conf_edd); E_CONFIG_VAL(D, T, first_run, UCHAR); #undef T #undef D evry_conf = e_config_domain_load("module.everything", conf_edd); if (evry_conf && !e_util_module_config_check(_("Everything Module"), - evry_conf->version, - MOD_CONFIG_FILE_VERSION)) + evry_conf->version, + MOD_CONFIG_FILE_VERSION)) _config_free(); if (!evry_conf) { - evry_conf = E_NEW(Evry_Config, 1); - evry_conf->version = (MOD_CONFIG_FILE_EPOCH << 16); + evry_conf = E_NEW(Evry_Config, 1); + evry_conf->version = (MOD_CONFIG_FILE_EPOCH << 16); } #define IFMODCFG(v) if ((evry_conf->version & 0xffff) < v) { #define IFMODCFGEND } - /* setup defaults */ - IFMODCFG(0x0001); - evry_conf->rel_x = 0.5; - evry_conf->rel_y = 0.43; - evry_conf->width = 455; - evry_conf->height = 430; - evry_conf->scroll_animate = 1; - evry_conf->scroll_speed = 10.0; - evry_conf->hide_input = 0; - evry_conf->hide_list = 0; - evry_conf->quick_nav = 1; - evry_conf->view_mode = VIEW_MODE_DETAIL; - evry_conf->view_zoom = 0; - evry_conf->cycle_mode = 0; - evry_conf->history_sort_mode = 0; - evry_conf->edge_width = 340; - evry_conf->edge_height = 385; - evry_conf->first_run = EINA_TRUE; + /* setup defaults */ + IFMODCFG(0x0001); + evry_conf->rel_x = 0.5; + evry_conf->rel_y = 0.43; + evry_conf->width = 455; + evry_conf->height = 430; + evry_conf->scroll_animate = 1; + evry_conf->scroll_speed = 10.0; + evry_conf->hide_input = 0; + evry_conf->hide_list = 0; + evry_conf->quick_nav = 1; + evry_conf->view_mode = VIEW_MODE_DETAIL; + evry_conf->view_zoom = 0; + evry_conf->cycle_mode = 0; + evry_conf->history_sort_mode = 0; + evry_conf->edge_width = 340; + evry_conf->edge_height = 385; + evry_conf->first_run = EINA_TRUE; - pcc = E_NEW(Plugin_Config, 1); - pcc->name = eina_stringshare_add("Start"); - pcc->enabled = EINA_FALSE; - pcc->aggregate = EINA_FALSE; - pcc->top_level = EINA_TRUE; - pcc->view_mode = VIEW_MODE_THUMB; - evry_conf->collections = eina_list_append(evry_conf->collections, pcc); + pcc = E_NEW(Plugin_Config, 1); + pcc->name = eina_stringshare_add("Start"); + pcc->enabled = EINA_FALSE; + pcc->aggregate = EINA_FALSE; + pcc->top_level = EINA_TRUE; + pcc->view_mode = VIEW_MODE_THUMB; + evry_conf->collections = eina_list_append(evry_conf->collections, pcc); - pc = E_NEW(Plugin_Config, 1); - pc->name = eina_stringshare_add("Windows"); - pc->enabled = EINA_TRUE; - pc->view_mode = VIEW_MODE_NONE; - pcc->plugins = eina_list_append(pcc->plugins, pc); + pc = E_NEW(Plugin_Config, 1); + pc->name = eina_stringshare_add("Windows"); + pc->enabled = EINA_TRUE; + pc->view_mode = VIEW_MODE_NONE; + pcc->plugins = eina_list_append(pcc->plugins, pc); - pc = E_NEW(Plugin_Config, 1); - pc->name = eina_stringshare_add("Settings"); - pc->enabled = EINA_TRUE; - pc->view_mode = VIEW_MODE_NONE; - pcc->plugins = eina_list_append(pcc->plugins, pc); + pc = E_NEW(Plugin_Config, 1); + pc->name = eina_stringshare_add("Settings"); + pc->enabled = EINA_TRUE; + pc->view_mode = VIEW_MODE_NONE; + pcc->plugins = eina_list_append(pcc->plugins, pc); - pc = E_NEW(Plugin_Config, 1); - pc->name = eina_stringshare_add("Files"); - pc->enabled = EINA_TRUE; - pc->view_mode = VIEW_MODE_NONE; - pcc->plugins = eina_list_append(pcc->plugins, pc); + pc = E_NEW(Plugin_Config, 1); + pc->name = eina_stringshare_add("Files"); + pc->enabled = EINA_TRUE; + pc->view_mode = VIEW_MODE_NONE; + pcc->plugins = eina_list_append(pcc->plugins, pc); - pc = E_NEW(Plugin_Config, 1); - pc->name = eina_stringshare_add("Applications"); - pc->enabled = EINA_TRUE; - pc->view_mode = VIEW_MODE_NONE; - pcc->plugins = eina_list_append(pcc->plugins, pc); - IFMODCFGEND; + pc = E_NEW(Plugin_Config, 1); + pc->name = eina_stringshare_add("Applications"); + pc->enabled = EINA_TRUE; + pc->view_mode = VIEW_MODE_NONE; + pcc->plugins = eina_list_append(pcc->plugins, pc); + IFMODCFGEND; - IFMODCFG(0x0003); - evry_conf->width = 464; - evry_conf->height = 366; - IFMODCFGEND; - - evry_conf->version = MOD_CONFIG_FILE_VERSION; + IFMODCFG(0x0003); + evry_conf->width = 464; + evry_conf->height = 366; + IFMODCFGEND; + + evry_conf->version = MOD_CONFIG_FILE_VERSION; } static void @@ -498,37 +496,37 @@ _config_free(void) { Plugin_Config *pc, *pc2; Gadget_Config *gc; - - EINA_LIST_FREE(evry_conf->collections, pc) - EINA_LIST_FREE(pc->plugins, pc2) + + EINA_LIST_FREE (evry_conf->collections, pc) + 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(pc2->trigger); - E_FREE(pc2); + IF_RELEASE(pc->name); + IF_RELEASE(pc->trigger); + 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->trigger); - E_FREE(pc); + IF_RELEASE(pc->name); + IF_RELEASE(pc->trigger); + 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->trigger); - E_FREE(pc); + IF_RELEASE(pc->name); + IF_RELEASE(pc->trigger); + E_FREE(pc); } - EINA_LIST_FREE(evry_conf->conf_objects, pc) + EINA_LIST_FREE (evry_conf->gadgets, gc) { - IF_RELEASE(pc->name); - IF_RELEASE(pc->trigger); - E_FREE(pc); - } - EINA_LIST_FREE(evry_conf->gadgets, gc) - { - IF_RELEASE(gc->id); - IF_RELEASE(gc->plugin); - E_FREE(gc); + IF_RELEASE(gc->id); + IF_RELEASE(gc->plugin); + E_FREE(gc); } E_FREE(evry_conf); @@ -559,14 +557,14 @@ _e_mod_action_cb(E_Object *obj, const char *params) if (obj) { - if (obj->type == E_MANAGER_TYPE) - zone = e_util_zone_current_get((E_Manager *)obj); - else if (obj->type == E_CONTAINER_TYPE) - zone = e_util_zone_current_get(((E_Container *)obj)->manager); - else if (obj->type == E_ZONE_TYPE) - zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager); - else - zone = e_util_zone_current_get(e_manager_current_get()); + if (obj->type == E_MANAGER_TYPE) + zone = e_util_zone_current_get((E_Manager *)obj); + else if (obj->type == E_CONTAINER_TYPE) + zone = e_util_zone_current_get(((E_Container *)obj)->manager); + else if (obj->type == E_ZONE_TYPE) + zone = e_util_zone_current_get(((E_Zone *)obj)->container->manager); + else + 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 (_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 @@ -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_menu_item_callback_set(mi, _e_mod_run_cb, NULL); } + diff --git a/src/modules/everything/evry.c b/src/modules/everything/evry.c index 1814c421d..3a4aa48d7 100644 --- a/src/modules/everything/evry.c +++ b/src/modules/everything/evry.c @@ -7,8 +7,8 @@ #define DRAG_OFF_WINDOW -#define INPUTLEN 256 -#define MATCH_LAG 0.15 +#define INPUTLEN 256 +#define MATCH_LAG 0.15 #define INITIAL_MATCH_LAG 0.3 #if defined (CHECK_TIME) || defined (CHECK_REFS) @@ -19,54 +19,53 @@ #define DBG(...) #endif -static void _evry_matches_update(Evry_Selector *sel, int async); -static void _evry_plugin_action(Evry_Selector *sel, int finished); -static void _evry_plugin_select(Evry_State *s, Evry_Plugin *p); -static void _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p); -static int _evry_backspace(Evry_Selector *sel); -static void _evry_update(Evry_Selector *sel, int fetch); -static void _evry_update_text_label(Evry_State *s); -static int _evry_clear(Evry_Selector *sel); -static Eina_Bool _evry_cb_update_timer(void *data); +static void _evry_matches_update(Evry_Selector *sel, int async); +static void _evry_plugin_action(Evry_Selector *sel, int finished); +static void _evry_plugin_select(Evry_State *s, Evry_Plugin *p); +static void _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p); +static int _evry_backspace(Evry_Selector *sel); +static void _evry_update(Evry_Selector *sel, int fetch); +static void _evry_update_text_label(Evry_State *s); +static int _evry_clear(Evry_Selector *sel); +static Eina_Bool _evry_cb_update_timer(void *data); -static Evry_State *_evry_state_new(Evry_Selector *sel, Eina_List *plugins); -static void _evry_state_pop(Evry_Selector *sel, int immediate); -static void _evry_state_clear(Evry_Window *win); -static void _evry_hide_func(Evry_Window *win, int finished); +static Evry_State *_evry_state_new(Evry_Selector *sel, Eina_List *plugins); +static void _evry_state_pop(Evry_Selector *sel, int immediate); +static void _evry_state_clear(Evry_Window *win); +static void _evry_hide_func(Evry_Window *win, int finished); static Evry_Selector *_evry_selector_new(Evry_Window *win, int type); -static void _evry_selector_free(Evry_Selector *sel); -static void _evry_selector_activate(Evry_Selector *sel, int slide); -static void _evry_selector_update(Evry_Selector *sel); -static int _evry_selector_plugins_get(Evry_Selector *sel, Evry_Item *it, const char *plugin_name); -static void _evry_selector_update_actions(Evry_Selector *sel); -static void _evry_selector_item_update(Evry_Selector *sel); -static void _evry_selector_item_clear(Evry_Selector *sel); -static void _evry_selector_label_set(Evry_Selector *sel, const char *part, const char *label); -static void _evry_selector_signal_emit(Evry_Selector *sel, const char *msg); -static int _evry_selectors_shift(Evry_Window *win, int dir); -static int _evry_selectors_switch(Evry_Window *win, int dir); +static void _evry_selector_free(Evry_Selector *sel); +static void _evry_selector_activate(Evry_Selector *sel, int slide); +static void _evry_selector_update(Evry_Selector *sel); +static int _evry_selector_plugins_get(Evry_Selector *sel, Evry_Item *it, const char *plugin_name); +static void _evry_selector_update_actions(Evry_Selector *sel); +static void _evry_selector_item_update(Evry_Selector *sel); +static void _evry_selector_item_clear(Evry_Selector *sel); +static void _evry_selector_label_set(Evry_Selector *sel, const char *part, const char *label); +static void _evry_selector_signal_emit(Evry_Selector *sel, const char *msg); +static int _evry_selectors_shift(Evry_Window *win, int dir); +static int _evry_selectors_switch(Evry_Window *win, int dir); -static Evry_Window *_evry_window_new(E_Zone *zone, E_Zone_Edge edge); -static void _evry_window_free(Evry_Window *win); -static void _evry_list_win_show(Evry_Window *win); -static void _evry_list_win_hide(Evry_Window *win); -static void _evry_list_win_update(Evry_State *s); +static Evry_Window *_evry_window_new(E_Zone *zone, E_Zone_Edge edge); +static void _evry_window_free(Evry_Window *win); +static void _evry_list_win_show(Evry_Window *win); +static void _evry_list_win_hide(Evry_Window *win); +static void _evry_list_win_update(Evry_State *s); -static int _evry_view_create(Evry_State *s); -static void _evry_view_clear(Evry_State *s); -static int _evry_view_update(Evry_Window *win, Evry_State *s); -static int _evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev); -static void _evry_view_show(Evry_Window *win, Evry_View *v, int slide); -static void _evry_view_hide(Evry_Window *win, Evry_View *v, int slide); +static int _evry_view_create(Evry_State *s); +static void _evry_view_clear(Evry_State *s); +static int _evry_view_update(Evry_Window *win, Evry_State *s); +static int _evry_view_key_press(Evry_State *s, Ecore_Event_Key *ev); +static void _evry_view_show(Evry_Window *win, Evry_View *v, int slide); +static void _evry_view_hide(Evry_Window *win, Evry_View *v, int slide); +static void _evry_item_desel(Evry_State *s); +static void _evry_item_sel(Evry_State *s, Evry_Item *it); -static void _evry_item_desel(Evry_State *s); -static void _evry_item_sel(Evry_State *s, Evry_Item *it); - -static Eina_Bool _evry_cb_key_down(void *data, int type, void *event); -static Eina_Bool _evry_cb_selection_notify(void *data, int type, void *event); -static Eina_Bool _evry_cb_mouse(void *data, int type, void *event); +static Eina_Bool _evry_cb_key_down(void *data, int type, void *event); +static Eina_Bool _evry_cb_selection_notify(void *data, int type, void *event); +static Eina_Bool _evry_cb_mouse(void *data, int type, void *event); static Eina_List *windows = NULL; @@ -93,7 +92,7 @@ evry_init(void) int evry_shutdown(void) { - while(windows) + while (windows) evry_hide(windows->data, 0); return 1; @@ -106,24 +105,24 @@ _evry_aggregator_fetch(Evry_State *s) if (!s) { - ERR("no state"); - return 0; + ERR("no state"); + return 0; } - + if (s->aggregator->fetch(s->aggregator, s->input)) { - l = eina_list_data_find_list(s->cur_plugins, s->aggregator); + l = eina_list_data_find_list(s->cur_plugins, s->aggregator); - if (!l) - s->cur_plugins = eina_list_prepend(s->cur_plugins, s->aggregator); - else - s->cur_plugins = eina_list_promote_list(s->cur_plugins, l); + if (!l) + s->cur_plugins = eina_list_prepend(s->cur_plugins, s->aggregator); + else + s->cur_plugins = eina_list_promote_list(s->cur_plugins, l); - return 1; + return 1; } s->cur_plugins = eina_list_remove(s->cur_plugins, s->aggregator); - + return 1; } @@ -141,7 +140,7 @@ _evry_cb_item_changed(__UNUSED__ void *data, __UNUSED__ int type, void *event) if (sel->state && sel->state->cur_item == it) { - _evry_selector_update(sel); + _evry_selector_update(sel); } return ECORE_CALLBACK_PASS_ON; @@ -166,18 +165,18 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup) if (popup) { - e_win_layer_set(win->ewin, 255); - ecore_x_netwm_window_type_set(win->ewin->evas_win, - ECORE_X_WINDOW_TYPE_UTILITY); + e_win_layer_set(win->ewin, 255); + ecore_x_netwm_window_type_set(win->ewin->evas_win, + ECORE_X_WINDOW_TYPE_UTILITY); - ecore_evas_name_class_set(win->ewin->ecore_evas, "E", "everything"); + ecore_evas_name_class_set(win->ewin->ecore_evas, "E", "everything"); - ecore_evas_show(win->ewin->ecore_evas); + ecore_evas_show(win->ewin->ecore_evas); - if (e_grabinput_get(win->ewin->evas_win, 0, win->ewin->evas_win)) - win->grab = 1; - else - ERR("could not acquire grab"); + if (e_grabinput_get(win->ewin->evas_win, 0, win->ewin->evas_win)) + win->grab = 1; + else + ERR("could not acquire grab"); } evry_history_load(); @@ -185,7 +184,7 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup) if (params) win->plugin_dedicated = EINA_TRUE; - win->sel_list = E_NEW(Evry_Selector*, 4); + win->sel_list = E_NEW(Evry_Selector *, 4); win->sel_list[3] = NULL; win->selectors = win->sel_list; _evry_selector_new(win, EVRY_PLUGIN_SUBJECT); @@ -193,49 +192,49 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup) _evry_selector_new(win, EVRY_PLUGIN_OBJECT); win->handlers = eina_list_append - (win->handlers, ecore_event_handler_add - (ECORE_EVENT_KEY_DOWN, - _evry_cb_key_down, win)); + (win->handlers, ecore_event_handler_add + (ECORE_EVENT_KEY_DOWN, + _evry_cb_key_down, win)); win->handlers = eina_list_append - (win->handlers, ecore_event_handler_add - (ECORE_X_EVENT_SELECTION_NOTIFY, - _evry_cb_selection_notify, win)); + (win->handlers, ecore_event_handler_add + (ECORE_X_EVENT_SELECTION_NOTIFY, + _evry_cb_selection_notify, win)); win->handlers = eina_list_append - (win->handlers, evry_event_handler_add - (EVRY_EVENT_ITEM_CHANGED, - _evry_cb_item_changed, win)); + (win->handlers, evry_event_handler_add + (EVRY_EVENT_ITEM_CHANGED, + _evry_cb_item_changed, win)); win->handlers = eina_list_append - (win->handlers, ecore_event_handler_add - (ECORE_EVENT_MOUSE_BUTTON_DOWN, - _evry_cb_mouse, win)); + (win->handlers, ecore_event_handler_add + (ECORE_EVENT_MOUSE_BUTTON_DOWN, + _evry_cb_mouse, win)); win->handlers = eina_list_append - (win->handlers, ecore_event_handler_add - (ECORE_EVENT_MOUSE_BUTTON_UP, - _evry_cb_mouse, win)); + (win->handlers, ecore_event_handler_add + (ECORE_EVENT_MOUSE_BUTTON_UP, + _evry_cb_mouse, win)); #if 0 win->handlers = eina_list_append - (win->handlers, ecore_event_handler_add - (ECORE_EVENT_MOUSE_MOVE, - _evry_cb_mouse, win)); + (win->handlers, ecore_event_handler_add + (ECORE_EVENT_MOUSE_MOVE, + _evry_cb_mouse, win)); win->handlers = eina_list_append - (win->handlers, ecore_event_handler_add - (ECORE_EVENT_MOUSE_WHEEL, - _evry_cb_mouse, win)); + (win->handlers, ecore_event_handler_add + (ECORE_EVENT_MOUSE_WHEEL, + _evry_cb_mouse, win)); win->handlers = eina_list_append - (win->handlers, ecore_event_handler_add - (ECORE_X_EVENT_MOUSE_IN, - _evry_cb_mouse_in, win)); + (win->handlers, ecore_event_handler_add + (ECORE_X_EVENT_MOUSE_IN, + _evry_cb_mouse_in, win)); win->handlers = eina_list_append - (win->handlers, ecore_event_handler_add - (ECORE_X_EVENT_MOUSE_OUT, - _evry_cb_mouse_out, win)); + (win->handlers, ecore_event_handler_add + (ECORE_X_EVENT_MOUSE_OUT, + _evry_cb_mouse_out, win)); #endif _evry_selector_plugins_get(SUBJ_SEL, NULL, params); _evry_selector_update(SUBJ_SEL); @@ -243,23 +242,23 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup) windows = eina_list_append(windows, win); _evry_selector_activate(SUBJ_SEL, 0); - + if ((!evry_conf->hide_list) || (edge)) { - sel = CUR_SEL; + sel = CUR_SEL; - if (sel && sel->state && evry_conf->views) - { - /* if (evry_conf->first_run) - * { - * evry_view_toggle(sel->state, "?"); - * evry_conf->first_run = EINA_FALSE; - * } */ + if (sel && sel->state && evry_conf->views) + { + /* if (evry_conf->first_run) + * { + * evry_view_toggle(sel->state, "?"); + * evry_conf->first_run = EINA_FALSE; + * } */ - edje_object_signal_emit(win->o_main, "list:e,state,list_show", "e"); - edje_object_signal_emit(win->o_main, "list:e,state,entry_show", "e"); - win->visible = EINA_TRUE; - } + edje_object_signal_emit(win->o_main, "list:e,state,list_show", "e"); + edje_object_signal_emit(win->o_main, "list:e,state,entry_show", "e"); + win->visible = EINA_TRUE; + } } win->func.hide = &_evry_hide_func; @@ -270,7 +269,7 @@ evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup) static void _evry_hide_func(Evry_Window *win, int finished) { - if ((finished) && (win->grab)) + if ((finished) && (win->grab)) evry_hide(win, 0); } @@ -287,46 +286,46 @@ evry_hide(Evry_Window *win, int clear) if ((clear && CUR_SEL) && /* pop states */ ((eina_list_count((SUBJ_SEL)->states) > 1) || - /* move to subject selector */ - (CUR_SEL != SUBJ_SEL) || - /* clear input */ - (((CUR_SEL)->state) && ((CUR_SEL)->state->input[0])))) + /* move to subject selector */ + (CUR_SEL != SUBJ_SEL) || + /* clear input */ + (((CUR_SEL)->state) && ((CUR_SEL)->state->input[0])))) { - int slide = 0; - Evry_Selector *sel; - Evry_State *s; + int slide = 0; + Evry_Selector *sel; + Evry_State *s; - if (CUR_SEL != SUBJ_SEL) - { - if (CUR_SEL == ACTN_SEL) - _evry_selectors_switch(win, -1); - else if (CUR_SEL == OBJ_SEL) - _evry_selectors_switch(win, 1); - } + if (CUR_SEL != SUBJ_SEL) + { + if (CUR_SEL == ACTN_SEL) + _evry_selectors_switch(win, -1); + else if (CUR_SEL == OBJ_SEL) + _evry_selectors_switch(win, 1); + } - /* just to be sure */ - CUR_SEL = SUBJ_SEL; + /* just to be sure */ + CUR_SEL = SUBJ_SEL; - while ((CUR_SEL)->states->next) - { - slide = SLIDE_RIGHT; - _evry_state_pop(CUR_SEL, 1); - } + while ((CUR_SEL)->states->next) + { + slide = SLIDE_RIGHT; + _evry_state_pop(CUR_SEL, 1); + } - sel = CUR_SEL; - s = sel->state; - _evry_clear(sel); - _evry_clear(sel); + sel = CUR_SEL; + s = sel->state; + _evry_clear(sel); + _evry_clear(sel); - _evry_aggregator_fetch(s); - _evry_selector_update(sel); - _evry_update_text_label(s); - if (s->view) - { - _evry_view_show(win, s->view, slide); - s->view->update(s->view); - } - return; + _evry_aggregator_fetch(s); + _evry_selector_update(sel); + _evry_update_text_label(s); + if (s->view) + { + _evry_view_show(win, s->view, slide); + s->view->update(s->view); + } + return; } if (_evry_selectors_shift(win, -1)) @@ -339,12 +338,12 @@ evry_hide(Evry_Window *win, int clear) E_FREE(win->sel_list); - EINA_LIST_FREE(win->handlers, ev) + EINA_LIST_FREE (win->handlers, ev) ecore_event_handler_del(ev); if (win->grab) e_grabinput_release(win->ewin->evas_win, - win->ewin->evas_win); + win->ewin->evas_win); windows = eina_list_remove(windows, win); @@ -357,7 +356,7 @@ evry_hide(Evry_Window *win, int clear) int _cnt = eina_list_count(_refd); Eina_List *_l; printf("__________________________"); - EINA_LIST_FOREACH(_refd, _l, _it) + EINA_LIST_FOREACH (_refd, _l, _it) printf("%d %s\n", _it->ref, _it->label); printf("sum: %d", _cnt); #endif @@ -368,64 +367,64 @@ _evry_selectors_shift(Evry_Window *win, int dir) { if ((dir > 0) && (win->level == 0)) { - void *new_sel; - Evry_Selector *sel; - Evry_State *s; - int i; + void *new_sel; + Evry_Selector *sel; + Evry_State *s; + int i; - for (i = 1; i < 3; i++) - _evry_selector_item_clear(win->selectors[i]); + for (i = 1; i < 3; i++) + _evry_selector_item_clear(win->selectors[i]); - if (!(new_sel = realloc(win->sel_list, sizeof(Evry_Selector*) * 6))) - return 0; + if (!(new_sel = realloc(win->sel_list, sizeof(Evry_Selector *) * 6))) + return 0; - win->sel_list = new_sel; + win->sel_list = new_sel; - edje_object_signal_emit(win->o_main, - "e,state,object_selector_hide", "e"); + edje_object_signal_emit(win->o_main, + "e,state,object_selector_hide", "e"); - win->sel_list[5] = NULL; - win->selectors = win->sel_list + 2; - _evry_selector_new(win, EVRY_PLUGIN_ACTION); - _evry_selector_new(win, EVRY_PLUGIN_OBJECT); + win->sel_list[5] = NULL; + win->selectors = win->sel_list + 2; + _evry_selector_new(win, EVRY_PLUGIN_ACTION); + _evry_selector_new(win, EVRY_PLUGIN_OBJECT); - CUR_SEL = SUBJ_SEL; - sel = CUR_SEL; + CUR_SEL = SUBJ_SEL; + sel = CUR_SEL; - _evry_selector_signal_emit(sel, "e,state,selected"); + _evry_selector_signal_emit(sel, "e,state,selected"); - _evry_selector_item_update(SUBJ_SEL); - _evry_selector_item_update(ACTN_SEL); - _evry_selector_item_update(OBJ_SEL); + _evry_selector_item_update(SUBJ_SEL); + _evry_selector_item_update(ACTN_SEL); + _evry_selector_item_update(OBJ_SEL); - /* was checked before. anyway */ - if ((s = sel->state) && (s->cur_item)) - _evry_selector_update_actions(sel); + /* was checked before. anyway */ + if ((s = sel->state) && (s->cur_item)) + _evry_selector_update_actions(sel); - win->level++; + win->level++; - return 1; + return 1; } else if ((dir < 0) && (win->level > 0)) { - _evry_selector_item_clear(SUBJ_SEL); - _evry_selector_free(ACTN_SEL); - _evry_selector_free(OBJ_SEL); + _evry_selector_item_clear(SUBJ_SEL); + _evry_selector_free(ACTN_SEL); + _evry_selector_free(OBJ_SEL); - win->selectors = win->sel_list; - win->sel_list[3] = NULL; - CUR_SEL = NULL; + win->selectors = win->sel_list; + win->sel_list[3] = NULL; + CUR_SEL = NULL; - edje_object_signal_emit(win->o_main, - "e,state,object_selector_show", "e"); - _evry_selector_item_update(SUBJ_SEL); - _evry_selector_item_update(ACTN_SEL); - _evry_selector_item_update(OBJ_SEL); - _evry_selector_activate(OBJ_SEL, 0); + edje_object_signal_emit(win->o_main, + "e,state,object_selector_show", "e"); + _evry_selector_item_update(SUBJ_SEL); + _evry_selector_item_update(ACTN_SEL); + _evry_selector_item_update(OBJ_SEL); + _evry_selector_activate(OBJ_SEL, 0); - win->level = 0; + win->level = 0; - return 1; + return 1; } return 0; @@ -433,13 +432,13 @@ _evry_selectors_shift(Evry_Window *win, int dir) Evry_Item * evry_item_new(Evry_Item *it, Evry_Plugin *p, const char *label, - Evas_Object *(*icon_get) (Evry_Item *it, Evas *e), - void (*cb_free) (Evry_Item *item)) + Evas_Object *(*icon_get)(Evry_Item * it, Evas * e), + void (*cb_free)(Evry_Item *item)) { if (!it) { - it = E_NEW(Evry_Item, 1); - if (!it) return NULL; + it = E_NEW(Evry_Item, 1); + if (!it) return NULL; } if (p && EVRY_ITEM(p)->subtype) @@ -471,7 +470,7 @@ evry_item_free(Evry_Item *it) it->ref--; #ifdef PRINT_REFS - printf("%d, %d\t unref: %s\n", it->ref, _item_cnt, it->label); + printf("%d, %d\t unref: %s\n", it->ref, _item_cnt, it->label); #endif if (it->ref > 0) return; @@ -500,7 +499,6 @@ evry_item_ref(Evry_Item *it) #ifdef PRINT_REFS printf("%d, %d\t ref : %s\n", it->ref, _item_cnt, it->label); #endif - } static int @@ -511,8 +509,8 @@ _evry_selector_update_actions_do(Evry_Selector *sel) if (sel->action_timer) { - ecore_timer_del(sel->action_timer); - sel->action_timer = NULL; + ecore_timer_del(sel->action_timer); + sel->action_timer = NULL; } if ((s = (SUBJ_SEL)->state)) @@ -534,8 +532,8 @@ _evry_timer_cb_actions_get(void *data) if ((CUR_SEL == sel) && (s = sel->state)) { - if (_evry_view_update(win, s)) - _evry_view_show(win, s->view, 0); + if (_evry_view_update(win, s)) + _evry_view_show(win, s->view, 0); } return ECORE_CALLBACK_CANCEL; @@ -571,16 +569,16 @@ evry_item_select(const Evry_State *state, Evry_Item *it) if (s == sel->state) { - _evry_selector_update(sel); + _evry_selector_update(sel); - if (CUR_SEL == SUBJ_SEL) - _evry_selector_update_actions(ACTN_SEL); + if (CUR_SEL == SUBJ_SEL) + _evry_selector_update_actions(ACTN_SEL); - if (CUR_SEL == ACTN_SEL) - { - while (OBJ_SEL->state) - _evry_state_pop(OBJ_SEL, 1); - } + if (CUR_SEL == ACTN_SEL) + { + while (OBJ_SEL->state) + _evry_state_pop(OBJ_SEL, 1); + } } } @@ -594,13 +592,13 @@ evry_item_mark(const Evry_State *state, Evry_Item *it, Eina_Bool mark) if (mark && !it->marked) { - it->marked = EINA_TRUE; - s->sel_items = eina_list_append(s->sel_items, it); + it->marked = EINA_TRUE; + s->sel_items = eina_list_append(s->sel_items, it); } else if (it->marked) { - it->marked = EINA_FALSE; - s->sel_items = eina_list_remove(s->sel_items, it); + it->marked = EINA_FALSE; + s->sel_items = eina_list_remove(s->sel_items, it); } } @@ -627,70 +625,69 @@ evry_plugin_update(Evry_Plugin *p, int action) if (action == EVRY_UPDATE_ADD) { - /* clear marked items */ - if (s->sel_items) - { - eina_list_free(s->sel_items); - s->sel_items = NULL; - } + /* clear marked items */ + if (s->sel_items) + { + eina_list_free(s->sel_items); + s->sel_items = NULL; + } - if ((!p->items) && (!s->trigger_active)) - { - /* remove plugin */ - if (!(eina_list_data_find(s->cur_plugins, p))) - return; + if ((!p->items) && (!s->trigger_active)) + { + /* remove plugin */ + if (!(eina_list_data_find(s->cur_plugins, p))) + return; - s->cur_plugins = eina_list_remove(s->cur_plugins, p); + s->cur_plugins = eina_list_remove(s->cur_plugins, p); - if (p == s->plugin) - _evry_plugin_select(s, NULL); - } - else - { - /* add plugin to current plugins*/ - _evry_plugin_list_insert(s, p); - } + if (p == s->plugin) + _evry_plugin_select(s, NULL); + } + else + { + /* add plugin to current plugins*/ + _evry_plugin_list_insert(s, p); + } - if (sel->state == s) - { - _evry_aggregator_fetch(s); + if (sel->state == s) + { + _evry_aggregator_fetch(s); - /* select first plugin */ - if ((!s->plugin) || (s->plugin_auto_selected) || - !(eina_list_data_find(s->cur_plugins, s->plugin))) - { - _evry_plugin_select(s, NULL); - } + /* select first plugin */ + if ((!s->plugin) || (s->plugin_auto_selected) || + !(eina_list_data_find(s->cur_plugins, s->plugin))) + { + _evry_plugin_select(s, NULL); + } - if ((s->plugin && (sel->state == s)) && - /* plugin is current */ - ((s->plugin == p) || - /* plugin items are shown in aggregator */ - ((s->plugin == s->aggregator) && p->config->aggregate))) - { - _evry_selector_update(sel); + if ((s->plugin && (sel->state == s)) && + /* plugin is current */ + ((s->plugin == p) || + /* plugin items are shown in aggregator */ + ((s->plugin == s->aggregator) && p->config->aggregate))) + { + _evry_selector_update(sel); - if (_evry_view_update(win, s)) - /* XXX when there is a case where view disappears - check this one! is swallow always visible ? */ - _evry_view_show(win, s->view, 0); - } + if (_evry_view_update(win, s)) + /* XXX when there is a case where view disappears + check this one! is swallow always visible ? */ + _evry_view_show(win, s->view, 0); + } - /* switch back to subject selector when no current items */ - if ((sel == SUBJ_SEL) && - (!(s->plugin) || !(s->plugin->items)) && - (CUR_SEL == ACTN_SEL)) - { - _evry_selectors_switch(win, -1); - _evry_clear(SUBJ_SEL); - } - } - + /* switch back to subject selector when no current items */ + if ((sel == SUBJ_SEL) && + (!(s->plugin) || !(s->plugin->items)) && + (CUR_SEL == ACTN_SEL)) + { + _evry_selectors_switch(win, -1); + _evry_clear(SUBJ_SEL); + } + } } else if (action == EVRY_UPDATE_REFRESH) { - _evry_view_clear(s); - _evry_view_update(win, s); + _evry_view_clear(s); + _evry_view_update(win, s); } } @@ -773,40 +770,40 @@ _evry_window_new(E_Zone *zone, E_Zone_Edge edge) o = edje_object_add(win->evas); win->o_main = o; e_theme_edje_object_set(o, "base/theme/modules/everything", - "e/modules/everything/main"); + "e/modules/everything/main"); if ((shape_option = edje_object_data_get(o, "shaped")) && (!strcmp(shape_option, "1"))) { - win->shaped = EINA_TRUE; + win->shaped = EINA_TRUE; - if (e_config->use_composite) - { - ecore_evas_alpha_set(win->ewin->ecore_evas, 1); - win->ewin->evas_win = ecore_evas_software_x11_window_get(win->ewin->ecore_evas); - edje_object_signal_emit(o, "e,state,composited", "e"); - edje_object_signal_emit(o, "list:e,state,composited", "e"); - edje_object_message_signal_process(o); - edje_object_calc_force(o); + if (e_config->use_composite) + { + ecore_evas_alpha_set(win->ewin->ecore_evas, 1); + win->ewin->evas_win = ecore_evas_software_x11_window_get(win->ewin->ecore_evas); + edje_object_signal_emit(o, "e,state,composited", "e"); + edje_object_signal_emit(o, "list:e,state,composited", "e"); + edje_object_message_signal_process(o); + edje_object_calc_force(o); - tmp = edje_object_data_get(o, "shadow_offset"); - offset_s = tmp ? atoi(tmp) : 0; - } - else - ecore_evas_shaped_set(win->ewin->ecore_evas, 1); + tmp = edje_object_data_get(o, "shadow_offset"); + offset_s = tmp ? atoi(tmp) : 0; + } + else + ecore_evas_shaped_set(win->ewin->ecore_evas, 1); } edje_object_size_min_calc(o, &mw, &mh); if (edge == E_ZONE_EDGE_NONE) { - w = evry_conf->width; - h = evry_conf->height; + w = evry_conf->width; + h = evry_conf->height; } else { - w = evry_conf->edge_width; - h = evry_conf->edge_height; + w = evry_conf->edge_width; + h = evry_conf->edge_height; } e_win_size_min_set(win->ewin, mw, mh); @@ -818,48 +815,51 @@ _evry_window_new(E_Zone *zone, E_Zone_Edge edge) if (edge == E_ZONE_EDGE_NONE) { - mw += offset_s*2; - mh += offset_s*2; + mw += offset_s * 2; + mh += offset_s * 2; - x = (zone->x + (zone->w * evry_conf->rel_x)) - (mw / 2); - y = (zone->y + (zone->h * evry_conf->rel_y)) - (mh / 2); + x = (zone->x + (zone->w * evry_conf->rel_x)) - (mw / 2); + y = (zone->y + (zone->h * evry_conf->rel_y)) - (mh / 2); } else { - int to_side = 0; + int to_side = 0; - switch (edge) - { - case E_ZONE_EDGE_TOP_LEFT: - x = to_side - offset_s; - y = to_side - offset_s; - break; - case E_ZONE_EDGE_TOP_RIGHT: - x = zone->w - (mw + offset_s + to_side); - y = to_side - offset_s; - break; - case E_ZONE_EDGE_BOTTOM_RIGHT: - x = zone->w - (mw + offset_s + to_side); - y = zone->h - (mh + offset_s + to_side); - break; - case E_ZONE_EDGE_BOTTOM_LEFT: - x = to_side - offset_s; - y = zone->h - (mh + offset_s + to_side); - break; + switch (edge) + { + case E_ZONE_EDGE_TOP_LEFT: + x = to_side - offset_s; + y = to_side - offset_s; + break; - default: - mw += offset_s*2; - mh += offset_s*2; - x = (zone->w * evry_conf->rel_x) - (mw / 2); - y = (zone->h * evry_conf->rel_y) - (mh / 2); - break; - } + case E_ZONE_EDGE_TOP_RIGHT: + x = zone->w - (mw + offset_s + to_side); + y = to_side - offset_s; + break; - x += zone->x; - y += zone->y; + case E_ZONE_EDGE_BOTTOM_RIGHT: + x = zone->w - (mw + offset_s + to_side); + y = zone->h - (mh + offset_s + to_side); + break; - mw += offset_s*2; - mh += offset_s*2; + case E_ZONE_EDGE_BOTTOM_LEFT: + x = to_side - offset_s; + y = zone->h - (mh + offset_s + to_side); + break; + + default: + mw += offset_s * 2; + mh += offset_s * 2; + x = (zone->w * evry_conf->rel_x) - (mw / 2); + y = (zone->h * evry_conf->rel_y) - (mh / 2); + break; + } + + x += zone->x; + y += zone->y; + + mw += offset_s * 2; + mh += offset_s * 2; } e_win_move_resize(win->ewin, x, y, mw, mh); @@ -873,7 +873,7 @@ _evry_window_new(E_Zone *zone, E_Zone_Edge edge) evas_event_feed_mouse_in(win->evas, ecore_x_current_time_get(), NULL); evas_event_feed_mouse_move(win->evas, -1000000, -1000000, - ecore_x_current_time_get(), NULL); + ecore_x_current_time_get(), NULL); e_win_delete_callback_set(win->ewin, _evry_cb_win_delete); e_win_resize_callback_set(win->ewin, _evry_cb_win_resize); @@ -888,6 +888,7 @@ _evry_cb_drag_finished(E_Drag *drag, int dropped) { E_FREE(drag->data); } + #endif static Eina_Bool @@ -910,78 +911,78 @@ _evry_cb_mouse(void *data, int type, void *event) #if 0 if (type == ECORE_EVENT_MOUSE_MOVE) { - Ecore_Event_Mouse_Move *ev = event; - Evry_State *s; + Ecore_Event_Mouse_Move *ev = event; + Evry_State *s; - if ((win->mouse_button == 3) && - (s = (CUR_SEL)->state) && (s->cur_item) && - (CHECK_TYPE(s->cur_item, EVRY_TYPE_FILE)) && - (!E_INSIDE(ev->x, ev->y, - win->zone->x, - win->zone->y, - w->w, w->h))) - { - const char *drag_types[] = { "text/uri-list" }; - E_Drag *d; - Evas_Object *o; - const char *uri; - int s_len, sel_length = 0; - char *tmp, *sel = NULL; + if ((win->mouse_button == 3) && + (s = (CUR_SEL)->state) && (s->cur_item) && + (CHECK_TYPE(s->cur_item, EVRY_TYPE_FILE)) && + (!E_INSIDE(ev->x, ev->y, + win->zone->x, + win->zone->y, + w->w, w->h))) + { + const char *drag_types[] = { "text/uri-list" }; + E_Drag *d; + Evas_Object *o; + const char *uri; + int s_len, sel_length = 0; + char *tmp, *sel = NULL; - GET_FILE(file, s->cur_item); + GET_FILE(file, s->cur_item); - if (!(uri = evry_file_url_get(file))) - return ECORE_CALLBACK_PASS_ON; + if (!(uri = evry_file_url_get(file))) + return ECORE_CALLBACK_PASS_ON; - s_len = strlen(uri); - if (!(tmp = realloc(sel, sel_length + s_len + 2 + 1))) - return ECORE_CALLBACK_PASS_ON; - sel = tmp; - memcpy(sel + sel_length, uri, s_len); - memcpy(sel + sel_length + s_len, "\r\n", 2); - sel_length += s_len + 2; + s_len = strlen(uri); + if (!(tmp = realloc(sel, sel_length + s_len + 2 + 1))) + return ECORE_CALLBACK_PASS_ON; + sel = tmp; + memcpy(sel + sel_length, uri, s_len); + memcpy(sel + sel_length + s_len, "\r\n", 2); + sel_length += s_len + 2; - d = e_drag_new(e_container_current_get(e_manager_current_get()), - ev->x, ev->y, - drag_types, 1, sel, sel_length, NULL, - _evry_cb_drag_finished); - e_drag_resize(d, 128, 128); - o = evry_util_icon_get(s->cur_item, e_drag_evas_get(d)); - e_drag_object_set(d, o); - e_drag_xdnd_start(d, ev->x, ev->y); + d = e_drag_new(e_container_current_get(e_manager_current_get()), + ev->x, ev->y, + drag_types, 1, sel, sel_length, NULL, + _evry_cb_drag_finished); + e_drag_resize(d, 128, 128); + o = evry_util_icon_get(s->cur_item, e_drag_evas_get(d)); + e_drag_object_set(d, o); + e_drag_xdnd_start(d, ev->x, ev->y); - evry_hide(win, 0); - return ECORE_CALLBACK_PASS_ON; - } + evry_hide(win, 0); + return ECORE_CALLBACK_PASS_ON; + } } else if (type == ECORE_EVENT_MOUSE_WHEEL) { - Ecore_Event_Mouse_Wheel *ev = event; + Ecore_Event_Mouse_Wheel *ev = event; } else #endif if (type == ECORE_EVENT_MOUSE_BUTTON_DOWN) { - win->mouse_out = 0; + win->mouse_out = 0; - if (!E_INSIDE(ev->x, ev->y, 0, 0, w->w, w->h)) - { - win->mouse_out = 1; - return ECORE_CALLBACK_PASS_ON; - } + if (!E_INSIDE(ev->x, ev->y, 0, 0, w->w, w->h)) + { + win->mouse_out = 1; + return ECORE_CALLBACK_PASS_ON; + } - win->mouse_button = ev->buttons; + win->mouse_button = ev->buttons; } else if (type == ECORE_EVENT_MOUSE_BUTTON_UP) { - win->mouse_button = 0; + win->mouse_button = 0; - if (win->mouse_out && - !E_INSIDE(ev->x, ev->y, 0, 0, w->w, w->h)) - { - evry_hide(win, 0); - return ECORE_CALLBACK_PASS_ON; - } + if (win->mouse_out && + !E_INSIDE(ev->x, ev->y, 0, 0, w->w, w->h)) + { + evry_hide(win, 0); + return ECORE_CALLBACK_PASS_ON; + } } return ECORE_CALLBACK_PASS_ON; @@ -1009,8 +1010,8 @@ _evry_selector_cb_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED if (ev->button == 1) { - if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) - evry_plugin_action(sel->win, 1); + if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK) + evry_plugin_action(sel->win, 1); } } @@ -1023,13 +1024,13 @@ _evry_selector_cb_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSE if (ev->z > 0) { - /* FIXME dont loose selector 2 state until state 0 changed: */ - if (CUR_SEL != OBJ_SEL) - _evry_selectors_switch(sel->win, 1); + /* FIXME dont loose selector 2 state until state 0 changed: */ + if (CUR_SEL != OBJ_SEL) + _evry_selectors_switch(sel->win, 1); } else if (ev->z < 0) { - _evry_selectors_switch(sel->win, -1); + _evry_selectors_switch(sel->win, -1); } } @@ -1045,30 +1046,29 @@ _evry_selector_cb_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__ if (ev->button == 3) { - evry_plugin_action(win, 0); + evry_plugin_action(win, 0); } else if (ev->button == 1) { - if (sel == SUBJ_SEL) - { - if (CUR_SEL == ACTN_SEL) - _evry_selectors_switch(win, -1); - else - _evry_selectors_switch(win, 1); - } - - else if (sel == ACTN_SEL) - { - if (CUR_SEL == SUBJ_SEL) - _evry_selectors_switch(win, 1); - else - _evry_selectors_switch(win, -1); - } - else if (sel == OBJ_SEL) - { - if (CUR_SEL == ACTN_SEL) - _evry_selectors_switch(win, 1); - } + if (sel == SUBJ_SEL) + { + if (CUR_SEL == ACTN_SEL) + _evry_selectors_switch(win, -1); + else + _evry_selectors_switch(win, 1); + } + else if (sel == ACTN_SEL) + { + if (CUR_SEL == SUBJ_SEL) + _evry_selectors_switch(win, 1); + else + _evry_selectors_switch(win, -1); + } + else if (sel == OBJ_SEL) + { + if (CUR_SEL == ACTN_SEL) + _evry_selectors_switch(win, 1); + } } } @@ -1084,35 +1084,35 @@ _evry_selector_new(Evry_Window *win, int type) if (type == EVRY_PLUGIN_SUBJECT) { - pcs = evry_conf->conf_subjects; - sel->edje_part = "subject_selector"; + pcs = evry_conf->conf_subjects; + sel->edje_part = "subject_selector"; } else if (type == EVRY_PLUGIN_ACTION) { - pcs = evry_conf->conf_actions; - sel->edje_part = "action_selector"; + pcs = evry_conf->conf_actions; + sel->edje_part = "action_selector"; } else if (type == EVRY_PLUGIN_OBJECT) { - pcs = evry_conf->conf_objects; - sel->edje_part = "object_selector"; + pcs = evry_conf->conf_objects; + sel->edje_part = "object_selector"; } if ((o = edje_object_part_swallow_get(win->o_main, sel->edje_part))) { - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, - _evry_selector_cb_down, sel); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, - _evry_selector_cb_up, sel); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, - _evry_selector_cb_wheel, sel); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, + _evry_selector_cb_down, sel); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, + _evry_selector_cb_up, sel); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, + _evry_selector_cb_wheel, sel); } - EINA_LIST_FOREACH(pcs, l, pc) + EINA_LIST_FOREACH (pcs, l, pc) { - if (!pc->plugin) continue; - if (pc->plugin == sel->aggregator) continue; - sel->plugins = eina_list_append(sel->plugins, pc->plugin); + if (!pc->plugin) continue; + if (pc->plugin == sel->aggregator) continue; + sel->plugins = eina_list_append(sel->plugins, pc->plugin); } win->selectors[type] = sel; @@ -1173,20 +1173,20 @@ _evry_selector_activate(Evry_Selector *sel, int slide) if (CUR_SEL) { - Evry_Selector *cur = CUR_SEL; - _evry_selector_signal_emit(cur, "e,state,unselected"); + Evry_Selector *cur = CUR_SEL; + _evry_selector_signal_emit(cur, "e,state,unselected"); - if (cur->state && cur->state->view) - _evry_view_hide(win, cur->state->view, slide); + if (cur->state && cur->state->view) + _evry_view_hide(win, cur->state->view, slide); - if (!slide && evry_conf->hide_list) - _evry_list_win_hide(win); + if (!slide && evry_conf->hide_list) + _evry_list_win_hide(win); } if (!sel) { - ERR("selector == NULL"); - return; + ERR("selector == NULL"); + return; } CUR_SEL = sel; @@ -1199,17 +1199,17 @@ _evry_selector_activate(Evry_Selector *sel, int slide) if ((s = sel->state)) { - _evry_update_text_label(s); + _evry_update_text_label(s); - if (s->cur_item) - _evry_selector_label_set(sel, "e.text.plugin", - EVRY_ITEM(s->cur_item->plugin)->label); + if (s->cur_item) + _evry_selector_label_set(sel, "e.text.plugin", + EVRY_ITEM(s->cur_item->plugin)->label); - if (_evry_view_create(s)) - { - _evry_view_show(win, s->view, slide); - s->view->update(s->view); - } + if (_evry_view_create(s)) + { + _evry_view_show(win, s->view, slide); + s->view->update(s->view); + } } } @@ -1223,8 +1223,8 @@ _evry_selector_thumb_gen(void *data, Evas_Object *obj __UNUSED__, void *event_in if (sel->o_icon) { - evas_object_del(sel->o_icon); - sel->o_icon = NULL; + evas_object_del(sel->o_icon); + sel->o_icon = NULL; } e_icon_size_get(sel->o_thumb, &w, &h); @@ -1266,21 +1266,21 @@ _evry_selector_thumb(Evry_Selector *sel, const Evry_Item *it) if ((!strncmp(file->mime, "image/", 6)) || ((suffix = strrchr(file->path, '.')) && (!strncmp(suffix, ".edj", 4)))) { - sel->o_thumb = e_thumb_icon_add(win->evas); - e_thumb_icon_size_set(sel->o_thumb, 128, 128); - evas_object_smart_callback_add(sel->o_thumb, "e_thumb_gen", - _evry_selector_thumb_gen, sel); - if (suffix) - { - e_thumb_icon_file_set(sel->o_thumb, file->path, "e/desktop/background"); - e_thumb_icon_size_set(sel->o_thumb, 128, 80); - } - else - e_thumb_icon_file_set(sel->o_thumb, file->path, NULL); + sel->o_thumb = e_thumb_icon_add(win->evas); + e_thumb_icon_size_set(sel->o_thumb, 128, 128); + evas_object_smart_callback_add(sel->o_thumb, "e_thumb_gen", + _evry_selector_thumb_gen, sel); + if (suffix) + { + e_thumb_icon_file_set(sel->o_thumb, file->path, "e/desktop/background"); + e_thumb_icon_size_set(sel->o_thumb, 128, 80); + } + else + e_thumb_icon_file_set(sel->o_thumb, file->path, NULL); - e_thumb_icon_begin(sel->o_thumb); - sel->do_thumb = EINA_TRUE; - return 1; + e_thumb_icon_begin(sel->o_thumb); + sel->do_thumb = EINA_TRUE; + return 1; } return 0; @@ -1291,17 +1291,17 @@ _evry_selector_item_clear(Evry_Selector *sel) { if (sel->o_icon) { - evas_object_del(sel->o_icon); - sel->o_icon = NULL; + evas_object_del(sel->o_icon); + sel->o_icon = NULL; } if (sel->o_thumb) { - if (sel->do_thumb) - e_thumb_icon_end(sel->o_thumb); + if (sel->do_thumb) + e_thumb_icon_end(sel->o_thumb); - evas_object_del(sel->o_thumb); - sel->o_thumb = NULL; + evas_object_del(sel->o_thumb); + sel->o_thumb = NULL; } } @@ -1317,45 +1317,45 @@ _evry_selector_item_update(Evry_Selector *sel) if ((!s) || !(s->cur_item)) { - /* no items for this state - clear selector */ - _evry_selector_label_set(sel, "e.text.label",""); + /* no items for this state - clear selector */ + _evry_selector_label_set(sel, "e.text.label", ""); - if (sel == CUR_SEL && s && s->plugin) - _evry_selector_label_set(sel, "e.text.plugin", - EVRY_ITEM(s->plugin)->label); - else - _evry_selector_label_set(sel, "e.text.plugin", ""); + if (sel == CUR_SEL && s && s->plugin) + _evry_selector_label_set(sel, "e.text.plugin", + EVRY_ITEM(s->plugin)->label); + else + _evry_selector_label_set(sel, "e.text.plugin", ""); - if (!s) return; + if (!s) return; } if ((it = s->cur_item)) { - _evry_selector_label_set(sel, "e.text.label", it->label); - _evry_selector_label_set(sel, "e.text.plugin", - EVRY_ITEM(it->plugin)->label); + _evry_selector_label_set(sel, "e.text.label", it->label); + _evry_selector_label_set(sel, "e.text.plugin", + EVRY_ITEM(it->plugin)->label); - if (!_evry_selector_thumb(sel, it)) - { - o = evry_util_icon_get(it, win->evas); + if (!_evry_selector_thumb(sel, it)) + { + o = evry_util_icon_get(it, win->evas); - if ((!o) && it->plugin) - o = evry_util_icon_get(EVRY_ITEM(it->plugin), win->evas); - } + if ((!o) && it->plugin) + o = evry_util_icon_get(EVRY_ITEM(it->plugin), win->evas); + } } if ((!o) && (s->plugin && (EVRY_ITEM(s->plugin)->icon))) { - o = evry_icon_theme_get(EVRY_ITEM(s->plugin)->icon, win->evas); + o = evry_icon_theme_get(EVRY_ITEM(s->plugin)->icon, win->evas); } if (o) { - char buf[64]; - snprintf(buf, sizeof(buf), "%s:e.swallow.icons", sel->edje_part); - edje_object_part_swallow(win->o_main, buf, o); - evas_object_show(o); - sel->o_icon = o; + char buf[64]; + snprintf(buf, sizeof(buf), "%s:e.swallow.icons", sel->edje_part); + edje_object_part_swallow(win->o_main, buf, o); + evas_object_show(o); + sel->o_icon = o; } } @@ -1371,28 +1371,28 @@ _evry_selector_update(Evry_Selector *sel) if (!s) { - _evry_selector_item_update(sel); - return; + _evry_selector_item_update(sel); + return; } if ((it = s->cur_item)) { - if (!s->plugin || !eina_list_data_find_list(s->plugin->items, it)) - { - _evry_item_desel(s); - item_changed = EINA_TRUE; - } + if (!s->plugin || !eina_list_data_find_list(s->plugin->items, it)) + { + _evry_item_desel(s); + item_changed = EINA_TRUE; + } } /* get first item */ if (s->plugin && ((!s->cur_item) || s->item_auto_selected)) { - it = eina_list_data_get(s->plugin->items); - s->item_auto_selected = EINA_TRUE; - if (!s->cur_plugins || (it != s->cur_item)) - item_changed = EINA_TRUE; + it = eina_list_data_get(s->plugin->items); + s->item_auto_selected = EINA_TRUE; + if (!s->cur_plugins || (it != s->cur_item)) + item_changed = EINA_TRUE; - _evry_item_sel(s, it); + _evry_item_sel(s, it); } _evry_selector_item_update(sel); @@ -1430,19 +1430,19 @@ _evry_selector_plugins_get(Evry_Selector *sel, Evry_Item *it, const char *plugin if (it && CHECK_TYPE(it, EVRY_TYPE_ACTION)) act = (Evry_Action *)it; - EINA_LIST_FOREACH(sel->plugins, l, p) + EINA_LIST_FOREACH (sel->plugins, l, p) { - if (!p->config->enabled && !win->plugin_dedicated) - continue; + if (!p->config->enabled && !win->plugin_dedicated) + continue; - if (plugin_name && strcmp(plugin_name, p->name)) - continue; + if (plugin_name && strcmp(plugin_name, p->name)) + continue; - if (act && (!CHECK_SUBTYPE(p, act->it2.type))) - continue; + if (act && (!CHECK_SUBTYPE(p, act->it2.type))) + continue; - if (p->begin && (pp = p->begin(p, it))) - plugins = eina_list_append(plugins, pp); + if (p->begin && (pp = p->begin(p, it))) + plugins = eina_list_append(plugins, pp); } _evry_state_new(sel, plugins); @@ -1475,7 +1475,7 @@ _evry_state_new(Evry_Selector *sel, Eina_List *plugins) s->plugins = eina_list_append(s->plugins, p); s->aggregator = p; - EINA_LIST_FOREACH(s->plugins, l, p) + EINA_LIST_FOREACH (s->plugins, l, p) p->state = s; return s; @@ -1493,55 +1493,55 @@ _evry_state_pop(Evry_Selector *sel, int immediate) if (sel->update_timer) { - ecore_timer_del(sel->update_timer); - sel->update_timer = NULL; + ecore_timer_del(sel->update_timer); + sel->update_timer = NULL; } if (sel->action_timer) { - ecore_timer_del(sel->action_timer); - sel->action_timer = NULL; + ecore_timer_del(sel->action_timer); + sel->action_timer = NULL; } if (s->view) { - if (immediate) - { - s->view->destroy(s->view); - } - else - { - _evry_view_hide(win, s->view, SLIDE_RIGHT); - /* XXX delay free state? is it possible that - view can receive events here? */ - s->delete_me = EINA_TRUE; - } + if (immediate) + { + s->view->destroy(s->view); + } + else + { + _evry_view_hide(win, s->view, SLIDE_RIGHT); + /* XXX delay free state? is it possible that + view can receive events here? */ + s->delete_me = EINA_TRUE; + } } if (s->sel_items) eina_list_free(s->sel_items); if (s->cur_plugins) - eina_list_free(s->cur_plugins); + eina_list_free(s->cur_plugins); sel->states = eina_list_remove_list(sel->states, sel->states); prev = eina_list_data_get(sel->states); - EINA_LIST_FREE(s->plugins, p) + EINA_LIST_FREE (s->plugins, p) { - /* skip non top-level plugins */ - if (prev && eina_list_data_find(prev->plugins, p)) - { - p->state = prev; - continue; - } - EVRY_ITEM_FREE(p); + /* skip non top-level plugins */ + if (prev && eina_list_data_find(prev->plugins, p)) + { + p->state = prev; + continue; + } + EVRY_ITEM_FREE(p); } if (!s->delete_me) { - E_FREE(s->inp); - E_FREE(s); + E_FREE(s->inp); + E_FREE(s); } sel->state = prev; @@ -1560,17 +1560,17 @@ evry_state_push(Evry_Selector *sel, Eina_List *plugins) if (!(new_state = _evry_state_new(sel, plugins))) { - DBG("no new state"); - return 0; + DBG("no new state"); + return 0; } - EINA_LIST_FOREACH(plugins, l, p) + EINA_LIST_FOREACH (plugins, l, p) p->state = new_state; if (s && s->view) { - _evry_view_hide(win, s->view, SLIDE_LEFT); - view = s->view; + _evry_view_hide(win, s->view, SLIDE_LEFT); + view = s->view; } _evry_matches_update(sel, 1); @@ -1580,13 +1580,13 @@ evry_state_push(Evry_Selector *sel, Eina_List *plugins) if (view && win->visible) { - s->view = view->create(view, s, win->o_main); - if (s->view) - { - s->view->state = s; - _evry_view_show(win, s->view, SLIDE_LEFT); - s->view->update(s->view); - } + s->view = view->create(view, s, win->o_main); + if (s->view) + { + s->view->state = s; + _evry_view_show(win, s->view, SLIDE_LEFT); + s->view->update(s->view); + } } _evry_update_text_label(sel->state); @@ -1607,14 +1607,14 @@ evry_browse_item(Evry_Item *it) if (!(it) || !(it->plugin) || !(it->browseable)) { - DBG("no item"); - return 0; + DBG("no item"); + return 0; } if (!(s = it->plugin->state)) { - DBG("no state"); - return 0; + DBG("no state"); + return 0; } sel = s->selector; @@ -1623,95 +1623,95 @@ evry_browse_item(Evry_Item *it) /* aggregator */ if (CHECK_TYPE(it, EVRY_TYPE_PLUGIN)) { - browse_aggregator = 1; - plugins = eina_list_append(plugins, it); + browse_aggregator = 1; + plugins = eina_list_append(plugins, it); } else { - if ((it->plugin->browse) && (pp = it->plugin->browse(it->plugin, it))) - { - plugins = eina_list_append(plugins, pp); - pref = pp; - } + if ((it->plugin->browse) && (pp = it->plugin->browse(it->plugin, it))) + { + plugins = eina_list_append(plugins, pp); + pref = pp; + } - /* items of type NONE can only be browsed by their own plugin */ - if (!CHECK_TYPE(it, EVRY_TYPE_NONE)) - { - EINA_LIST_FOREACH(sel->plugins, l, p) - { - if (!p->browse) - continue; + /* items of type NONE can only be browsed by their own plugin */ + if (!CHECK_TYPE(it, EVRY_TYPE_NONE)) + { + EINA_LIST_FOREACH (sel->plugins, l, p) + { + if (!p->browse) + continue; - if ((pref) && (!strcmp(p->name, pref->name))) - continue; + if ((pref) && (!strcmp(p->name, pref->name))) + continue; - if ((pp = p->browse(p, it))) - plugins = eina_list_append(plugins, pp); - } - } + if ((pp = p->browse(p, it))) + plugins = eina_list_append(plugins, pp); + } + } } if (!(plugins)) { - DBG("no plugins"); - return 0; + DBG("no plugins"); + return 0; } if (!(new_state = _evry_state_new(sel, plugins))) { - DBG("no new state"); - return 0; + DBG("no new state"); + return 0; } if (s->view) { - _evry_view_hide(win, s->view, SLIDE_LEFT); - view = s->view; + _evry_view_hide(win, s->view, SLIDE_LEFT); + view = s->view; } if (browse_aggregator) { - it->hi = NULL; + it->hi = NULL; - if (!EVRY_PLUGIN(it)->items) - { - evry_history_item_add(it, NULL, s->input); - s = new_state; - EVRY_PLUGIN(it)->state = s; - _evry_matches_update(sel, 1); - } - else - { - evry_history_item_add(it, NULL, NULL); - strncpy(new_state->input, s->input, INPUTLEN); - s = new_state; - EVRY_PLUGIN(it)->state = s; - s->cur_plugins = eina_list_append(s->cur_plugins, it); - } + if (!EVRY_PLUGIN(it)->items) + { + evry_history_item_add(it, NULL, s->input); + s = new_state; + EVRY_PLUGIN(it)->state = s; + _evry_matches_update(sel, 1); + } + else + { + evry_history_item_add(it, NULL, NULL); + strncpy(new_state->input, s->input, INPUTLEN); + s = new_state; + EVRY_PLUGIN(it)->state = s; + s->cur_plugins = eina_list_append(s->cur_plugins, it); + } - _evry_plugin_select(s, EVRY_PLUGIN(it)); + _evry_plugin_select(s, EVRY_PLUGIN(it)); } else { - if (it->plugin->history) - evry_history_item_add(it, NULL, s->input); + if (it->plugin->history) + evry_history_item_add(it, NULL, s->input); - _evry_matches_update(sel, 1); - s = new_state; - _evry_plugin_select(s, pref); + _evry_matches_update(sel, 1); + s = new_state; + _evry_plugin_select(s, pref); } _evry_selector_update(sel); if (view && win->visible) { - s->view = view->create(view, s, win->o_main); - if (s->view) - { - s->view->state = s; - s->view->update(s->view); - _evry_view_show(win, s->view, SLIDE_LEFT); - } + s->view = view->create(view, s, win->o_main); + if (s->view) + { + s->view->state = s; + s->view->update(s->view); + _evry_view_show(win, s->view, SLIDE_LEFT); + } } _evry_update_text_label(sel->state); @@ -1736,16 +1736,16 @@ evry_browse_back(Evry_Selector *sel) _evry_selector_update(sel); _evry_update_text_label(sel->state); - + if (sel == SUBJ_SEL) _evry_selector_update_actions(ACTN_SEL); if (sel->state->view) { - _evry_view_show(win, sel->state->view, SLIDE_RIGHT); - sel->state->view->update(sel->state->view); + _evry_view_show(win, sel->state->view, SLIDE_RIGHT); + sel->state->view->update(sel->state->view); } - + return 1; } @@ -1756,55 +1756,55 @@ evry_selectors_switch(Evry_Window *win, int dir, int slide) if ((CUR_SEL)->update_timer) { - if ((CUR_SEL == SUBJ_SEL) || (CUR_SEL == ACTN_SEL)) - { - _evry_matches_update(CUR_SEL, 0); - _evry_selector_update(CUR_SEL); - } + if ((CUR_SEL == SUBJ_SEL) || (CUR_SEL == ACTN_SEL)) + { + _evry_matches_update(CUR_SEL, 0); + _evry_selector_update(CUR_SEL); + } } if (CUR_SEL != SUBJ_SEL && dir == 0) { - edje_object_signal_emit(win->o_main, "e,state,object_selector_hide", "e"); - _evry_selector_activate(SUBJ_SEL, (slide * SLIDE_RIGHT)); - return 1; + edje_object_signal_emit(win->o_main, "e,state,object_selector_hide", "e"); + _evry_selector_activate(SUBJ_SEL, (slide * SLIDE_RIGHT)); + return 1; } if (CUR_SEL == SUBJ_SEL && dir > 0) { - if (s->cur_item) - { - _evry_selector_activate(ACTN_SEL, slide * SLIDE_LEFT); - return 1; - } + if (s->cur_item) + { + _evry_selector_activate(ACTN_SEL, slide * SLIDE_LEFT); + return 1; + } } else if (CUR_SEL == ACTN_SEL && dir > 0) { - Evry_Item *it; + Evry_Item *it; - if (!s || !(it = s->cur_item) || !(CHECK_TYPE(it, EVRY_TYPE_ACTION))) - return 0; + if (!s || !(it = s->cur_item) || !(CHECK_TYPE(it, EVRY_TYPE_ACTION))) + return 0; - GET_ACTION(act,it); - if (!act->it2.type) - return 0; + GET_ACTION(act, it); + if (!act->it2.type) + return 0; - _evry_selector_plugins_get(OBJ_SEL, it, NULL); - _evry_selector_update(OBJ_SEL); - edje_object_signal_emit(win->o_main, "e,state,object_selector_show", "e"); + _evry_selector_plugins_get(OBJ_SEL, it, NULL); + _evry_selector_update(OBJ_SEL); + edje_object_signal_emit(win->o_main, "e,state,object_selector_show", "e"); - _evry_selector_activate(OBJ_SEL, (slide * SLIDE_LEFT)); - return 1; + _evry_selector_activate(OBJ_SEL, (slide * SLIDE_LEFT)); + return 1; } else if (CUR_SEL == ACTN_SEL && dir < 0) { - _evry_selector_activate(SUBJ_SEL, (slide * SLIDE_RIGHT)); - edje_object_signal_emit(win->o_main, "e,state,object_selector_hide", "e"); - return 1; + _evry_selector_activate(SUBJ_SEL, (slide * SLIDE_RIGHT)); + edje_object_signal_emit(win->o_main, "e,state,object_selector_hide", "e"); + return 1; } else if (CUR_SEL == OBJ_SEL && dir < 0) { - _evry_selector_activate(ACTN_SEL, (slide * SLIDE_RIGHT)); - return 1; + _evry_selector_activate(ACTN_SEL, (slide * SLIDE_RIGHT)); + return 1; } return 0; } @@ -1836,10 +1836,10 @@ _evry_input_complete(Evry_State *s) if (input && action == EVRY_COMPLETE_INPUT) { - strncpy(s->input, input, INPUTLEN - 1); - _evry_update_text_label(s); - _evry_cb_update_timer(CUR_SEL); - evry_item_select(s, it); + strncpy(s->input, input, INPUTLEN - 1); + _evry_update_text_label(s); + _evry_cb_update_timer(CUR_SEL); + evry_item_select(s, it); } evry_item_free(it); @@ -1851,7 +1851,6 @@ _evry_input_complete(Evry_State *s) static int _evry_cheat_history(Evry_State *s, int promote, int delete) { - History_Entry *he; History_Item *hi; History_Types *ht; @@ -1866,33 +1865,33 @@ _evry_cheat_history(Evry_State *s, int promote, int delete) if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label)))) return 1; - EINA_LIST_FOREACH_SAFE(he->items, l, ll, hi) + EINA_LIST_FOREACH_SAFE (he->items, l, ll, hi) { - if (hi->plugin != it->plugin->name) - continue; + if (hi->plugin != it->plugin->name) + continue; - if (delete) - { - if (hi->input) - eina_stringshare_del(hi->input); - if (hi->plugin) - eina_stringshare_del(hi->plugin); - if (hi->context) - eina_stringshare_del(hi->context); - E_FREE(hi); + if (delete) + { + if (hi->input) + eina_stringshare_del(hi->input); + if (hi->plugin) + eina_stringshare_del(hi->plugin); + if (hi->context) + eina_stringshare_del(hi->context); + E_FREE(hi); - he->items = eina_list_remove_list(he->items, l); - } - else if (promote) - { - hi->count += 5; - hi->last_used = ecore_time_unix_get(); - } - else /* demote */ - { - hi->count -= 5; - if (hi->count < 0) hi->count = 1; - } + he->items = eina_list_remove_list(he->items, l); + } + else if (promote) + { + hi->count += 5; + hi->last_used = ecore_time_unix_get(); + } + else /* demote */ + { + hi->count -= 5; + if (hi->count < 0) hi->count = 1; + } } if (s->plugin == s->aggregator) _evry_aggregator_fetch(s); @@ -1916,88 +1915,88 @@ _evry_cb_key_down(void *data, int type __UNUSED__, void *event) if (!strcmp(ev->key, "Escape")) { - evry_hide(win, 0); - return ECORE_CALLBACK_PASS_ON; + evry_hide(win, 0); + return ECORE_CALLBACK_PASS_ON; } #ifdef DRAG_OFF_WINDOW else if (win->grab && !strcmp(ev->key, "F1")) { - E_Win *ewin = win->ewin; + E_Win *ewin = win->ewin; - e_grabinput_release(ewin->evas_win, ewin->evas_win); - if (!win->shaped) - e_win_borderless_set(ewin, 0); - ecore_evas_lower(ewin->ecore_evas); - ewin->border = e_border_new(ewin->container, ewin->evas_win, 1, 1); - // dont need this - special stuff - here it is needed - ewin->border->ignore_first_unmap = 1; - ewin->border->internal = 1; - ewin->border->internal_ecore_evas = ewin->ecore_evas; - ewin->border->internal_no_remember = 1; - e_border_show(ewin->border); + e_grabinput_release(ewin->evas_win, ewin->evas_win); + if (!win->shaped) + e_win_borderless_set(ewin, 0); + ecore_evas_lower(ewin->ecore_evas); + ewin->border = e_border_new(ewin->container, ewin->evas_win, 1, 1); + // dont need this - special stuff - here it is needed + ewin->border->ignore_first_unmap = 1; + ewin->border->internal = 1; + ewin->border->internal_ecore_evas = ewin->ecore_evas; + ewin->border->internal_no_remember = 1; + e_border_show(ewin->border); - win->grab = 0; - return ECORE_CALLBACK_PASS_ON; + win->grab = 0; + return ECORE_CALLBACK_PASS_ON; } #endif else if (ev->modifiers) { - Eina_List *l; - E_Config_Binding_Key *bind; - E_Binding_Modifier mod; + Eina_List *l; + E_Config_Binding_Key *bind; + E_Binding_Modifier mod; - for (l = e_config->key_bindings; l; l = l->next) - { - bind = l->data; + for (l = e_config->key_bindings; l; l = l->next) + { + bind = l->data; - if (bind->action && strcmp(bind->action, "everything")) continue; + if (bind->action && strcmp(bind->action, "everything")) continue; - mod = 0; + mod = 0; - if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) - mod |= E_BINDING_MODIFIER_SHIFT; - if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) - mod |= E_BINDING_MODIFIER_CTRL; - if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) - mod |= E_BINDING_MODIFIER_ALT; - if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN) - mod |= E_BINDING_MODIFIER_WIN; + if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) + mod |= E_BINDING_MODIFIER_SHIFT; + if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) + mod |= E_BINDING_MODIFIER_CTRL; + if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) + mod |= E_BINDING_MODIFIER_ALT; + if (ev->modifiers & ECORE_EVENT_MODIFIER_WIN) + mod |= E_BINDING_MODIFIER_WIN; - if (!(bind->key && (!strcmp(bind->key, ev->keyname)) && - (((unsigned int)bind->modifiers == mod) || (bind->any_mod)))) - continue; + if (!(bind->key && (!strcmp(bind->key, ev->keyname)) && + (((unsigned int)bind->modifiers == mod) || (bind->any_mod)))) + continue; - if (win->level > 0) - return ECORE_CALLBACK_PASS_ON; + if (win->level > 0) + return ECORE_CALLBACK_PASS_ON; - if (!(bind->params) && (CUR_SEL == OBJ_SEL) && - ((CUR_SEL)->state && (CUR_SEL)->state->cur_item)) - { - _evry_selectors_shift(win, 1); - return ECORE_CALLBACK_PASS_ON; - } + if (!(bind->params) && (CUR_SEL == OBJ_SEL) && + ((CUR_SEL)->state && (CUR_SEL)->state->cur_item)) + { + _evry_selectors_shift(win, 1); + return ECORE_CALLBACK_PASS_ON; + } - evry_hide(win, 1); + evry_hide(win, 1); #if 0 /* FIXME this causes segv when triggering a plugin keybinding twice */ - if (win && CUR_SEL && bind->params) - { - Eina_List *ll; - Evry_Plugin *p; + if (win && CUR_SEL && bind->params) + { + Eina_List *ll; + Evry_Plugin *p; - EINA_LIST_FOREACH((SUBJ_SEL)->plugins, ll, p) - if (!strcmp(bind->params, p->name)) break; + EINA_LIST_FOREACH ((SUBJ_SEL)->plugins, ll, p) + if (!strcmp(bind->params, p->name)) break; - if (p) - { - _evry_plugin_select((CUR_SEL)->state, p); - _evry_selector_update(CUR_SEL); - _evry_view_update(win, (CUR_SEL)->state); - } - } + if (p) + { + _evry_plugin_select((CUR_SEL)->state, p); + _evry_selector_update(CUR_SEL); + _evry_view_update(win, (CUR_SEL)->state); + } + } #endif - return ECORE_CALLBACK_PASS_ON; - } + return ECORE_CALLBACK_PASS_ON; + } } old = ev->key; @@ -2005,64 +2004,64 @@ _evry_cb_key_down(void *data, int type __UNUSED__, void *event) if (!strcmp(ev->key, "KP_Enter")) { - ev->key = "Return"; + ev->key = "Return"; } else if (ev->modifiers & ECORE_EVENT_MODIFIER_ALT) { - if (!strcmp(ev->key, "Tab")) - { - ev->key = "Down"; - } - else if (!strcmp(ev->key, "ISO_Left_Tab") || (!strcmp(ev->key, "Tab") && - (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) - { - ev->key = "Up"; - ev->modifiers = 0; - } - else if (!strcmp(ev->key, "q")) - { - evry_hide(win, 0); - return 1; - } - else if (!strcmp(ev->key, "w")) - { - ev->key = "Return"; - ev->modifiers = 0; - } - else if (evry_conf->quick_nav == 1) - { - if (!strcmp(ev->key, "k") || (!strcmp(ev->key, "K"))) - ev->key = "Up"; - else if (!strcmp(ev->key, "j") || (!strcmp(ev->key, "J"))) - ev->key = "Down"; - else if (!strcmp(ev->key, "n") || (!strcmp(ev->key, "N"))) - ev->key = "Next"; - else if (!strcmp(ev->key, "p") || (!strcmp(ev->key, "P"))) - ev->key = "Prior"; - else if (!strcmp(ev->key, "l") || (!strcmp(ev->key, "L"))) - ev->key = "Right"; - else if (!strcmp(ev->key, "h") || (!strcmp(ev->key, "H"))) - ev->key = "Left"; - else if (!strcmp(ev->key, "i") || (!strcmp(ev->key, "I"))) - ev->key = "Tab"; - else if (!strcmp(ev->key, "m") || (!strcmp(ev->key, "M"))) - ev->key = "Return"; - } - else if (evry_conf->quick_nav == 3) - { - if (!strcmp(ev->key, "p") || (!strcmp(ev->key, "P"))) - ev->key = "Up"; - else if (!strcmp(ev->key, "n") || (!strcmp(ev->key, "N"))) - ev->key = "Down"; - else if (!strcmp(ev->key, "f") || (!strcmp(ev->key, "F"))) - ev->key = "Right"; - else if (!strcmp(ev->key, "b") || (!strcmp(ev->key, "B"))) - ev->key = "Left"; - else if (!strcmp(ev->key, "i") || (!strcmp(ev->key, "I"))) - ev->key = "Tab"; - else if (!strcmp(ev->key, "m") || (!strcmp(ev->key, "M"))) - ev->key = "Return"; - } + if (!strcmp(ev->key, "Tab")) + { + ev->key = "Down"; + } + else if (!strcmp(ev->key, "ISO_Left_Tab") || (!strcmp(ev->key, "Tab") && + (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) + { + ev->key = "Up"; + ev->modifiers = 0; + } + else if (!strcmp(ev->key, "q")) + { + evry_hide(win, 0); + return 1; + } + else if (!strcmp(ev->key, "w")) + { + ev->key = "Return"; + ev->modifiers = 0; + } + else if (evry_conf->quick_nav == 1) + { + if (!strcmp(ev->key, "k") || (!strcmp(ev->key, "K"))) + ev->key = "Up"; + else if (!strcmp(ev->key, "j") || (!strcmp(ev->key, "J"))) + ev->key = "Down"; + else if (!strcmp(ev->key, "n") || (!strcmp(ev->key, "N"))) + ev->key = "Next"; + else if (!strcmp(ev->key, "p") || (!strcmp(ev->key, "P"))) + ev->key = "Prior"; + else if (!strcmp(ev->key, "l") || (!strcmp(ev->key, "L"))) + ev->key = "Right"; + else if (!strcmp(ev->key, "h") || (!strcmp(ev->key, "H"))) + ev->key = "Left"; + else if (!strcmp(ev->key, "i") || (!strcmp(ev->key, "I"))) + ev->key = "Tab"; + else if (!strcmp(ev->key, "m") || (!strcmp(ev->key, "M"))) + ev->key = "Return"; + } + else if (evry_conf->quick_nav == 3) + { + if (!strcmp(ev->key, "p") || (!strcmp(ev->key, "P"))) + ev->key = "Up"; + else if (!strcmp(ev->key, "n") || (!strcmp(ev->key, "N"))) + ev->key = "Down"; + else if (!strcmp(ev->key, "f") || (!strcmp(ev->key, "F"))) + ev->key = "Right"; + else if (!strcmp(ev->key, "b") || (!strcmp(ev->key, "B"))) + ev->key = "Left"; + else if (!strcmp(ev->key, "i") || (!strcmp(ev->key, "I"))) + ev->key = "Tab"; + else if (!strcmp(ev->key, "m") || (!strcmp(ev->key, "M"))) + ev->key = "Return"; + } } if (!win || !(sel = CUR_SEL)) @@ -2070,11 +2069,11 @@ _evry_cb_key_down(void *data, int type __UNUSED__, void *event) if (!strcmp(ev->key, "Tab") && !((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) || - (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) + (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT))) { - if (!_evry_selectors_switch(win, 1)) - _evry_selectors_switch(win, 0); - goto end; + if (!_evry_selectors_switch(win, 1)) + _evry_selectors_switch(win, 0); + goto end; } if (!(s = sel->state)) @@ -2082,108 +2081,108 @@ _evry_cb_key_down(void *data, int type __UNUSED__, void *event) if (!win->visible && (!strcmp(ev->key, "Down"))) { - _evry_list_win_show(win); - goto end; + _evry_list_win_show(win); + goto end; } else if ((!strcmp(ev->key, "ISO_Left_Tab") || - (((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) || - (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) && - (!strcmp(ev->key, "Tab"))))) + (((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) || + (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)) && + (!strcmp(ev->key, "Tab"))))) { - _evry_input_complete(s); - goto end; + _evry_input_complete(s); + goto end; } else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && - (!strcmp(ev->key, "Delete") || !strcmp(ev->key, "Insert"))) + (!strcmp(ev->key, "Delete") || !strcmp(ev->key, "Insert"))) { - int delete = (!strcmp(ev->key, "Delete") && - (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)); - int promote = (!strcmp(ev->key, "Insert")); + int delete = (!strcmp(ev->key, "Delete") && + (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT)); + int promote = (!strcmp(ev->key, "Insert")); - _evry_cheat_history(s, promote, delete); - goto end; + _evry_cheat_history(s, promote, delete); + goto end; } else if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) { - if (!strcmp(ev->key, "u")) - { - if (!_evry_clear(sel)) - evry_browse_back(sel); - goto end; - } - else if (!strcmp(ev->key, "1")) - evry_view_toggle(s, NULL); - else if (!strcmp(ev->key, "Return")) - _evry_plugin_action(sel, 0); - else if (!strcmp(ev->key, "v")) - { - win->request_selection = EINA_TRUE; - ecore_x_selection_primary_request - (win->ewin->evas_win, ECORE_X_SELECTION_TARGET_UTF8_STRING); - } - else - { - _evry_view_key_press(s, ev); - } - goto end; + if (!strcmp(ev->key, "u")) + { + if (!_evry_clear(sel)) + evry_browse_back(sel); + goto end; + } + else if (!strcmp(ev->key, "1")) + evry_view_toggle(s, NULL); + else if (!strcmp(ev->key, "Return")) + _evry_plugin_action(sel, 0); + else if (!strcmp(ev->key, "v")) + { + win->request_selection = EINA_TRUE; + ecore_x_selection_primary_request + (win->ewin->evas_win, ECORE_X_SELECTION_TARGET_UTF8_STRING); + } + else + { + _evry_view_key_press(s, ev); + } + goto end; } if ((s->plugin && s->plugin->cb_key_down) && (s->plugin->cb_key_down(s->plugin, ev))) { - /* let plugin intercept keypress */ - goto end; + /* let plugin intercept keypress */ + goto end; } else if (_evry_view_key_press(s, ev)) { - /* let view intercept keypress */ - goto end; + /* let view intercept keypress */ + goto end; } else if (!strcmp(ev->key, "Right")) { - if (!evry_browse_item(sel->state->cur_item)) - evry_selectors_switch(win, 1, EINA_TRUE); + if (!evry_browse_item(sel->state->cur_item)) + evry_selectors_switch(win, 1, EINA_TRUE); } else if (!strcmp(ev->key, "Left")) { - if (!evry_browse_back(sel)) - evry_selectors_switch(win, -1, EINA_TRUE); + if (!evry_browse_back(sel)) + evry_selectors_switch(win, -1, EINA_TRUE); } else if (!strcmp(ev->key, "Return")) { - if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) - { - _evry_plugin_action(sel, 0); - } - else if (s->cur_item && s->cur_item->browseable) - { - evry_browse_item(sel->state->cur_item); - } - else - { - _evry_plugin_action(sel, 1); - } + if (ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) + { + _evry_plugin_action(sel, 0); + } + else if (s->cur_item && s->cur_item->browseable) + { + evry_browse_item(sel->state->cur_item); + } + else + { + _evry_plugin_action(sel, 1); + } } else if (!strcmp(ev->key, "BackSpace")) { - if (!_evry_backspace(sel)) - evry_browse_back(sel); + if (!_evry_backspace(sel)) + evry_browse_back(sel); } else if ((ev->compose && !(ev->modifiers & ECORE_EVENT_MODIFIER_ALT))) { - unsigned int len = strlen(s->inp); + unsigned int len = strlen(s->inp); - if (len == 0 && (evry_view_toggle(s, ev->compose))) - goto end; + if (len == 0 && (evry_view_toggle(s, ev->compose))) + goto end; - if (len < (INPUTLEN - strlen(ev->compose))) - { - strcat(s->inp, ev->compose); + if (len < (INPUTLEN - strlen(ev->compose))) + { + strcat(s->inp, ev->compose); - _evry_update(sel, 1); - } + _evry_update(sel, 1); + } } - end: +end: ev->key = old; return ECORE_CALLBACK_PASS_ON; } @@ -2200,22 +2199,22 @@ _evry_backspace(Evry_Selector *sel) pos = evas_string_char_prev_get(s->inp, len, &val); if ((pos < len) && (pos >= 0)) { - val = *(s->inp + pos); + val = *(s->inp + pos); - s->inp[pos] = 0; + s->inp[pos] = 0; - if (s->trigger_active && s->inp[0] != 0) - s->input = s->inp + 1; - else - s->input = s->inp; + if (s->trigger_active && s->inp[0] != 0) + s->input = s->inp + 1; + else + s->input = s->inp; - if (pos == 0) - s->trigger_active = EINA_FALSE; + if (pos == 0) + s->trigger_active = EINA_FALSE; - if ((pos == 0) || !isspace(val)) - _evry_update(sel, 1); + if ((pos == 0) || !isspace(val)) + _evry_update(sel, 1); - return 1; + return 1; } return 0; @@ -2228,10 +2227,10 @@ _evry_update_text_label(Evry_State *s) if (!win->visible && evry_conf->hide_input) { - if (strlen(s->inp) > 0) - edje_object_signal_emit(win->o_main, "list:e,state,entry_show", "e"); - else - edje_object_signal_emit(win->o_main, "list:e,state,entry_hide", "e"); + if (strlen(s->inp) > 0) + edje_object_signal_emit(win->o_main, "list:e,state,entry_show", "e"); + else + edje_object_signal_emit(win->o_main, "list:e,state,entry_hide", "e"); } edje_object_part_text_set(win->o_main, "list:e.text.label", s->inp); @@ -2247,13 +2246,13 @@ _evry_update(Evry_Selector *sel, int fetch) if (fetch) { - if (sel->update_timer) - ecore_timer_del(sel->update_timer); + if (sel->update_timer) + ecore_timer_del(sel->update_timer); - sel->update_timer = - ecore_timer_add(MATCH_LAG, _evry_cb_update_timer, sel); + sel->update_timer = + ecore_timer_add(MATCH_LAG, _evry_cb_update_timer, sel); - edje_object_signal_emit(win->o_main, "list:e,signal,update", "e"); + edje_object_signal_emit(win->o_main, "list:e,signal,update", "e"); } } @@ -2281,14 +2280,14 @@ _evry_clear(Evry_Selector *sel) if (s->trigger_active && s->inp[1] != 0) { - s->inp[1] = 0; - s->input = s->inp + 1; + s->inp[1] = 0; + s->input = s->inp + 1; } else { - s->inp[0] = 0; - s->input = s->inp; - s->trigger_active = EINA_FALSE; + s->inp[0] = 0; + s->input = s->inp; + s->trigger_active = EINA_FALSE; } _evry_update(sel, 1); @@ -2322,19 +2321,19 @@ _evry_action_do(Evry_Action *act) if ((ret = act->action(act))) { - ev = E_NEW(Evry_Event_Action_Performed, 1); - ev->action = eina_stringshare_ref(act->name); - ev->it1 = act->it1.item; - ev->it2 = act->it2.item; + ev = E_NEW(Evry_Event_Action_Performed, 1); + ev->action = eina_stringshare_ref(act->name); + ev->it1 = act->it1.item; + ev->it2 = act->it2.item; - if (ev->it1) - EVRY_ITEM_REF(ev->it1); - if (ev->it2) - EVRY_ITEM_REF(ev->it2); + if (ev->it1) + EVRY_ITEM_REF(ev->it1); + if (ev->it2) + EVRY_ITEM_REF(ev->it2); - ecore_event_add(_evry_events[EVRY_EVENT_ACTION_PERFORMED], ev, - _evry_cb_free_action_performed, NULL); - return ret; + ecore_event_add(_evry_events[EVRY_EVENT_ACTION_PERFORMED], ev, + _evry_cb_free_action_performed, NULL); + return ret; } return 0; } @@ -2356,8 +2355,8 @@ _evry_plugin_action(Evry_Selector *sel, int finished) if ((SUBJ_SEL)->update_timer) { - _evry_matches_update(SUBJ_SEL, 0); - _evry_selector_update(SUBJ_SEL); + _evry_matches_update(SUBJ_SEL, 0); + _evry_selector_update(SUBJ_SEL); } /* do delayed fetch actions now */ @@ -2372,13 +2371,13 @@ _evry_plugin_action(Evry_Selector *sel, int finished) if ((CUR_SEL == SUBJ_SEL) && (ACTN_SEL)->update_timer) { - /* _evry_selector_actions_get(it_subj); */ - _evry_selector_plugins_get(ACTN_SEL, it_subj, NULL); + /* _evry_selector_actions_get(it_subj); */ + _evry_selector_plugins_get(ACTN_SEL, it_subj, NULL); - if (!(ACTN_SEL)->state) - return; + if (!(ACTN_SEL)->state) + return; - _evry_selector_update(ACTN_SEL); + _evry_selector_update(ACTN_SEL); } if (!(s_act = (ACTN_SEL)->state)) @@ -2390,73 +2389,73 @@ _evry_plugin_action(Evry_Selector *sel, int finished) if (CHECK_TYPE(it_act, EVRY_TYPE_ACTION) || CHECK_SUBTYPE(it_act, EVRY_TYPE_ACTION)) { - GET_ACTION(act, it_act); + GET_ACTION(act, it_act); - if (!act->action) - return; + if (!act->action) + return; - /* get object item for action, when required */ - if (act->it2.type) - { - /* check if object is provided */ - if ((s_obj = (OBJ_SEL)->state) && (!s_obj->delete_me)) - { - it_obj = s_obj->cur_item; - } + /* get object item for action, when required */ + if (act->it2.type) + { + /* check if object is provided */ + if ((s_obj = (OBJ_SEL)->state) && (!s_obj->delete_me)) + { + it_obj = s_obj->cur_item; + } - if (!it_obj) - { - if (SUBJ_SEL == CUR_SEL) - _evry_selectors_switch(win, 1); - if (ACTN_SEL == CUR_SEL) - _evry_selectors_switch(win, 1); - return; - } + if (!it_obj) + { + if (SUBJ_SEL == CUR_SEL) + _evry_selectors_switch(win, 1); + if (ACTN_SEL == CUR_SEL) + _evry_selectors_switch(win, 1); + return; + } - act->it2.item = it_obj; - } + act->it2.item = it_obj; + } - if (s_obj && s_obj->sel_items && !(act->it2.accept_list)) - { - if (!(act->it1.item && CHECK_TYPE(act->it1.item, EVRY_TYPE_PLUGIN))) - act->it1.item = it_subj; + if (s_obj && s_obj->sel_items && !(act->it2.accept_list)) + { + if (!(act->it1.item && CHECK_TYPE(act->it1.item, EVRY_TYPE_PLUGIN))) + act->it1.item = it_subj; - EINA_LIST_FOREACH(s_obj->sel_items, l, it) - { - if (it->type != act->it2.type) - continue; - act->it2.item = it; + EINA_LIST_FOREACH (s_obj->sel_items, l, it) + { + if (it->type != act->it2.type) + continue; + act->it2.item = it; - _evry_action_do(act); - } - } - else if (s_subj->sel_items && !(act->it1.accept_list)) - { - EINA_LIST_FOREACH(s_subj->sel_items, l, it) - { - if (it->type != act->it1.type) - continue; - act->it1.item = it; + _evry_action_do(act); + } + } + else if (s_subj->sel_items && !(act->it1.accept_list)) + { + EINA_LIST_FOREACH (s_subj->sel_items, l, it) + { + if (it->type != act->it1.type) + continue; + act->it1.item = it; - _evry_action_do(act); - } - } - else - { - if (!(act->it1.item && CHECK_TYPE(act->it1.item, EVRY_TYPE_PLUGIN))) - { - act->it1.item = it_subj; - act->it1.items = s_subj->sel_items; - } + _evry_action_do(act); + } + } + else + { + if (!(act->it1.item && CHECK_TYPE(act->it1.item, EVRY_TYPE_PLUGIN))) + { + act->it1.item = it_subj; + act->it1.items = s_subj->sel_items; + } - if (s_obj) - act->it2.items = s_obj->sel_items; + if (s_obj) + act->it2.items = s_obj->sel_items; - ret = _evry_action_do(act); + ret = _evry_action_do(act); - if (ret == EVRY_ACTION_OTHER) - return; - } + if (ret == EVRY_ACTION_OTHER) + return; + } } else return; @@ -2474,11 +2473,11 @@ _evry_plugin_action(Evry_Selector *sel, int finished) if (ret == EVRY_ACTION_CLEAR) { - _evry_clear(CUR_SEL); + _evry_clear(CUR_SEL); } else - { - win->func.hide(win, finished); + { + win->func.hide(win, finished); } } @@ -2490,12 +2489,12 @@ _evry_view_list_swallow_set(Evas_Object *obj, const char *part, Evas_Object *swa o = edje_object_part_swallow_get(obj, part); if (o != swallow) { - evas_object_hide(o); - edje_object_part_unswallow(obj, o); + evas_object_hide(o); + edje_object_part_unswallow(obj, o); - edje_object_part_unswallow(obj, swallow); - edje_object_part_swallow(obj, part, swallow); - evas_object_show(swallow); + edje_object_part_unswallow(obj, swallow); + edje_object_part_swallow(obj, part, swallow); + evas_object_show(swallow); } } @@ -2506,8 +2505,8 @@ _evry_view_show(Evry_Window *win, Evry_View *v, int slide) if (v->o_bar) { - edje_object_part_swallow(win->o_main, "list:e.swallow.bar", v->o_bar); - evas_object_show(v->o_bar); + edje_object_part_swallow(win->o_main, "list:e.swallow.bar", v->o_bar); + evas_object_show(v->o_bar); } if (!v->o_list) @@ -2515,24 +2514,24 @@ _evry_view_show(Evry_Window *win, Evry_View *v, int slide) if (slide == SLIDE_LEFT) { - _evry_view_list_swallow_set(win->o_main, "list:e.swallow.list2", v->o_list); + _evry_view_list_swallow_set(win->o_main, "list:e.swallow.list2", v->o_list); - edje_object_signal_emit(win->o_main, "list:e,action,slide,left", "e"); - edje_object_signal_emit(v->o_list, "e,action,show,list", "e"); + edje_object_signal_emit(win->o_main, "list:e,action,slide,left", "e"); + edje_object_signal_emit(v->o_list, "e,action,show,list", "e"); } else if (slide == SLIDE_RIGHT) { - _evry_view_list_swallow_set(win->o_main, "list:e.swallow.list", v->o_list); + _evry_view_list_swallow_set(win->o_main, "list:e.swallow.list", v->o_list); - edje_object_signal_emit(win->o_main, "list:e,action,slide,right", "e"); - edje_object_signal_emit(v->o_list, "e,action,show,list", "e"); + edje_object_signal_emit(win->o_main, "list:e,action,slide,right", "e"); + edje_object_signal_emit(v->o_list, "e,action,show,list", "e"); } else { - _evry_view_list_swallow_set(win->o_main, "list:e.swallow.list", v->o_list); + _evry_view_list_swallow_set(win->o_main, "list:e.swallow.list", v->o_list); - edje_object_signal_emit(win->o_main, "list:e,action,slide,default", "e"); - edje_object_signal_emit(v->o_list, "e,action,show,list", "e"); + edje_object_signal_emit(win->o_main, "list:e,action,slide,default", "e"); + edje_object_signal_emit(v->o_list, "e,action,show,list", "e"); } } @@ -2561,20 +2560,20 @@ _evry_state_clear(Evry_Window *win) if (s->delete_me) { - if (s->view) s->view->destroy(s->view); - s->clear_timer = NULL; - E_FREE(s->inp); - E_FREE(s); + if (s->view) s->view->destroy(s->view); + s->clear_timer = NULL; + E_FREE(s->inp); + E_FREE(s); } else if ((v = s->view)) { - v->clear(v); + v->clear(v); - if (v->o_list) - { - evas_object_hide(v->o_list); - edje_object_part_unswallow(win->o_main, v->o_list); - } + if (v->o_list) + { + evas_object_hide(v->o_list); + edje_object_part_unswallow(win->o_main, v->o_list); + } } /* replay mouse down to allow direct sliding back */ @@ -2587,8 +2586,8 @@ _evry_view_hide(Evry_Window *win, Evry_View *v, int slide) { if (v->state->delete_me) { - _evry_state_clear(win); - return; + _evry_state_clear(win); + return; } _evry_state_clear(win); @@ -2597,43 +2596,43 @@ _evry_view_hide(Evry_Window *win, Evry_View *v, int slide) if (slide && v->o_list) { - win->state_clearing = v->state; + win->state_clearing = v->state; - if (slide == SLIDE_RIGHT) - { - _evry_view_list_swallow_set(win->o_main, "list:e.swallow.list2", v->o_list); - } - else /* if (slide == SLIDE_LEFT) */ - { - _evry_view_list_swallow_set(win->o_main, "list:e.swallow.list", v->o_list); - } + if (slide == SLIDE_RIGHT) + { + _evry_view_list_swallow_set(win->o_main, "list:e.swallow.list2", v->o_list); + } + else /* if (slide == SLIDE_LEFT) */ + { + _evry_view_list_swallow_set(win->o_main, "list:e.swallow.list", v->o_list); + } - edje_object_signal_emit(v->o_list, "e,action,hide,list", "e"); + edje_object_signal_emit(v->o_list, "e,action,hide,list", "e"); - /* FIXME get signal from theme when anim finished */ - v->state->clear_timer = ecore_timer_add(1.5, _clear_timer, win); + /* FIXME get signal from theme when anim finished */ + v->state->clear_timer = ecore_timer_add(1.5, _clear_timer, win); - if (v->o_bar) - { - evas_object_hide(v->o_bar); - edje_object_part_unswallow(win->o_main, v->o_bar); - } + if (v->o_bar) + { + evas_object_hide(v->o_bar); + edje_object_part_unswallow(win->o_main, v->o_bar); + } - return; + return; } v->clear(v); if (v->o_list) { - evas_object_hide(v->o_list); - edje_object_part_unswallow(win->o_main, v->o_list); + evas_object_hide(v->o_list); + edje_object_part_unswallow(win->o_main, v->o_list); } if (v->o_bar) { - evas_object_hide(v->o_bar); - edje_object_part_unswallow(win->o_main, v->o_bar); + evas_object_hide(v->o_bar); + edje_object_part_unswallow(win->o_main, v->o_bar); } } @@ -2654,14 +2653,13 @@ _evry_view_create(Evry_State *s) if (s->view) { - s->view->state = s; - return 1; + s->view->state = s; + return 1; } return 0; } - static int _evry_view_update(Evry_Window *win, Evry_State *s) { @@ -2669,14 +2667,14 @@ _evry_view_update(Evry_Window *win, Evry_State *s) /* TODO check this again !!!!*/ if (s->view) { - s->view->update(s->view); - return 0; + s->view->update(s->view); + return 0; } if (_evry_view_create(s)) { - s->view->update(s->view); - return 1; + s->view->update(s->view); + return 1; } return 0; @@ -2708,51 +2706,51 @@ evry_view_toggle(Evry_State *s, const char *trigger) if (trigger) { - EINA_LIST_FOREACH(evry_conf->views, ll, view) - { - if (view->trigger && !strncmp(trigger, view->trigger, 1) && - (!s->view || (view->id != s->view->id)) && - (v = view->create(view, s, win->o_main))) - { - triggered = EINA_TRUE; - goto found; - } - } + EINA_LIST_FOREACH (evry_conf->views, ll, view) + { + if (view->trigger && !strncmp(trigger, view->trigger, 1) && + (!s->view || (view->id != s->view->id)) && + (v = view->create(view, s, win->o_main))) + { + triggered = EINA_TRUE; + goto found; + } + } } else { - if (s->view) - l = eina_list_data_find_list(evry_conf->views, s->view->id); - else - { - view = evry_conf->views->data; - v = view->create(view, s, win->o_main); - goto found; - } + if (s->view) + l = eina_list_data_find_list(evry_conf->views, s->view->id); + else + { + view = evry_conf->views->data; + v = view->create(view, s, win->o_main); + goto found; + } - if (l && l->next) - l = l->next; - else - l = evry_conf->views; + if (l && l->next) + l = l->next; + else + l = evry_conf->views; - EINA_LIST_FOREACH(l, ll, view) - { - if ((!view->trigger) && - ((!s->view || (view->id != s->view->id)) && - (v = view->create(view, s, win->o_main)))) - goto found; - } + EINA_LIST_FOREACH (l, ll, view) + { + if ((!view->trigger) && + ((!s->view || (view->id != s->view->id)) && + (v = view->create(view, s, win->o_main)))) + goto found; + } } - found: +found: if (!v) return 0; _evry_list_win_show(win); if (s->view) { - _evry_view_hide(win, s->view, 0); - s->view->destroy(s->view); + _evry_view_hide(win, s->view, 0); + s->view->destroy(s->view); } s->view = v; @@ -2783,128 +2781,128 @@ _evry_matches_update(Evry_Selector *sel, int async) if (sel->update_timer) { - ecore_timer_del(sel->update_timer); - sel->update_timer = NULL; + ecore_timer_del(sel->update_timer); + sel->update_timer = NULL; } if (s->sel_items) { - eina_list_free(s->sel_items); - s->sel_items = NULL; + eina_list_free(s->sel_items); + s->sel_items = NULL; } if (s->inp[0]) { - len_inp = strlen(s->inp); - input = s->inp; + len_inp = strlen(s->inp); + input = s->inp; } /* use current plugins */ if (s->trigger_active) { - s->plugin_auto_selected = EINA_FALSE; + s->plugin_auto_selected = EINA_FALSE; - EINA_LIST_FOREACH(s->cur_plugins, l, p) - { - p->request = s->request; - p->fetch(p, s->input); - } - goto found; + EINA_LIST_FOREACH (s->cur_plugins, l, p) + { + p->request = s->request; + p->fetch(p, s->input); + } + goto found; } - EINA_LIST_FREE(s->cur_plugins, p); + EINA_LIST_FREE (s->cur_plugins, p) ; /* check if input matches plugin trigger */ if (input) { - int len_trigger = 0; + int len_trigger = 0; - EINA_LIST_FOREACH(s->plugins, l, p) - { - if (!p->config->trigger) continue; - int len = strlen(p->config->trigger); + EINA_LIST_FOREACH (s->plugins, l, p) + { + if (!p->config->trigger) continue; + int len = strlen(p->config->trigger); - if (len_trigger && len != len_trigger) - continue; + if (len_trigger && len != len_trigger) + continue; - if ((len_inp >= len) && - (!strncmp(s->inp, p->config->trigger, len))) - { - len_trigger = len; - s->cur_plugins = eina_list_append(s->cur_plugins, p); - p->request = s->request; - if(len_inp == len) - p->fetch(p, NULL); - else - p->fetch(p, s->input + len); - } - } - if (s->cur_plugins) - { - s->trigger_active = EINA_TRUE; - /* replace trigger with indicator */ - if (len_trigger > 1) - { - s->inp[0] = ':'; + if ((len_inp >= len) && + (!strncmp(s->inp, p->config->trigger, len))) + { + len_trigger = len; + s->cur_plugins = eina_list_append(s->cur_plugins, p); + p->request = s->request; + if (len_inp == len) + p->fetch(p, NULL); + else + p->fetch(p, s->input + len); + } + } + if (s->cur_plugins) + { + s->trigger_active = EINA_TRUE; + /* replace trigger with indicator */ + if (len_trigger > 1) + { + s->inp[0] = ':'; - if (s->inp + len_trigger) - strcpy(s->inp + 1, s->inp + len_trigger); - else - s->inp[1] = 0; - } - s->input = s->inp + 1; - _evry_update_text_label(s); + if (s->inp + len_trigger) + strcpy(s->inp + 1, s->inp + len_trigger); + else + s->inp[1] = 0; + } + s->input = s->inp + 1; + _evry_update_text_label(s); - goto found; - } + goto found; + } } /* query all other plugins for this state */ - EINA_LIST_FOREACH(s->plugins, l, p) + EINA_LIST_FOREACH (s->plugins, l, p) { - p->request = s->request; + p->request = s->request; - if (p == s->aggregator) - goto next; + if (p == s->aggregator) + goto next; - /* dont wait for async plugin. use their current items */ - if (!async && p->async_fetch && p->items) - { - s->cur_plugins = eina_list_append(s->cur_plugins, p); - goto next; - } + /* dont wait for async plugin. use their current items */ + if (!async && p->async_fetch && p->items) + { + s->cur_plugins = eina_list_append(s->cur_plugins, p); + goto next; + } - if (!((sel->states->next) || - ((CUR_SEL == SUBJ_SEL) && - (win->plugin_dedicated)))) - { - /* skip plugins in toplevel which trigger-only */ - if ((sel == SUBJ_SEL) && - (p->config->top_level) && - (p->config->trigger_only)) - goto next; + if (!((sel->states->next) || + ((CUR_SEL == SUBJ_SEL) && + (win->plugin_dedicated)))) + { + /* skip plugins in toplevel which trigger-only */ + if ((sel == SUBJ_SEL) && + (p->config->top_level) && + (p->config->trigger_only)) + goto next; - /* skip non-toplevel plugins when input < min_query */ - if ((!p->config->top_level) && - (p->config->min_query > len_inp)) - goto next; - } + /* skip non-toplevel plugins when input < min_query */ + if ((!p->config->top_level) && + (p->config->min_query > len_inp)) + goto next; + } - if (p->fetch(p, input)) - { + if (p->fetch(p, input)) + { #ifdef CHECK_TIME - DBG("fetch %s %f", p->name, ecore_time_get() - _evry_time); + DBG("fetch %s %f", p->name, ecore_time_get() - _evry_time); #endif - s->cur_plugins = eina_list_append(s->cur_plugins, p); - continue; - } + s->cur_plugins = eina_list_append(s->cur_plugins, p); + continue; + } - next: - if (s->plugin == p) - s->plugin = NULL; +next: + if (s->plugin == p) + s->plugin = NULL; } - found: +found: _evry_aggregator_fetch(s); if (s->plugin_auto_selected) @@ -2915,7 +2913,7 @@ _evry_matches_update(Evry_Selector *sel, int async) if (!s->plugin) return; - EINA_LIST_FOREACH(s->plugin->items, l, it) + EINA_LIST_FOREACH (s->plugin->items, l, it) if (it->marked) s->sel_items = eina_list_append(s->sel_items, it); } @@ -2927,8 +2925,8 @@ _evry_item_desel(Evry_State *s) if (it) { - it->selected = EINA_FALSE; - evry_item_free(it); + it->selected = EINA_FALSE; + evry_item_free(it); } s->cur_item = NULL; @@ -2954,12 +2952,12 @@ _evry_plugin_select(Evry_State *s, Evry_Plugin *p) if (p) { - s->plugin_auto_selected = EINA_FALSE; + s->plugin_auto_selected = EINA_FALSE; } else { - p = eina_list_data_get(s->cur_plugins); - s->plugin_auto_selected = EINA_TRUE; + p = eina_list_data_get(s->cur_plugins); + s->plugin_auto_selected = EINA_TRUE; } s->plugin = p; @@ -2967,14 +2965,13 @@ _evry_plugin_select(Evry_State *s, Evry_Plugin *p) if ((s->view && s->plugin && s->plugin->view) && (s->view->name != s->plugin->view->name)) { - s->view->destroy(s->view); - s->view = NULL; - if (_evry_view_create(s)) - { - _evry_view_show(s->selector->win, s->view, 0); - s->view->update(s->view); - } - + s->view->destroy(s->view); + s->view = NULL; + if (_evry_view_create(s)) + { + _evry_view_show(s->selector->win, s->view, 0); + s->view->update(s->view); + } } } @@ -2996,8 +2993,8 @@ evry_plugin_select(Evry_Plugin *p) if (!p->state) { - ERR("no state!"); - return; + ERR("no state!"); + return; } _evry_plugin_select(p->state, p); @@ -3007,7 +3004,7 @@ evry_plugin_select(Evry_Plugin *p) ev->item = EVRY_ITEM(p); EVRY_ITEM_REF(p); ecore_event_add(_evry_events[EVRY_EVENT_PLUGIN_SELECTED], ev, - _evry_cb_free_plugin_selected, NULL); + _evry_cb_free_plugin_selected, NULL); } static void @@ -3016,13 +3013,13 @@ _evry_plugin_list_insert(Evry_State *s, Evry_Plugin *p) Eina_List *l; Evry_Plugin *p2; - EINA_LIST_FOREACH(s->cur_plugins, l, p2) + EINA_LIST_FOREACH (s->cur_plugins, l, p2) { - if (p == p2) - return; + if (p == p2) + return; - if (p->config->priority < p2->config->priority) - break; + if (p->config->priority < p2->config->priority) + break; } if (l) @@ -3047,16 +3044,17 @@ _evry_cb_selection_notify(void *data, int type __UNUSED__, void *event) if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) || (ev->selection == ECORE_X_SELECTION_PRIMARY)) { - if (strcmp(ev->target, ECORE_X_SELECTION_TARGET_UTF8_STRING) == 0) - { - Ecore_X_Selection_Data_Text *text_data; + if (strcmp(ev->target, ECORE_X_SELECTION_TARGET_UTF8_STRING) == 0) + { + Ecore_X_Selection_Data_Text *text_data; - text_data = ev->data; + text_data = ev->data; - strncat(s->input, text_data->text, (INPUTLEN - strlen(s->input)) - 1); - _evry_update(CUR_SEL, 1); - } + strncat(s->input, text_data->text, (INPUTLEN - strlen(s->input)) - 1); + _evry_update(CUR_SEL, 1); + } } return ECORE_CALLBACK_PASS_ON; } + diff --git a/src/modules/everything/evry_config.c b/src/modules/everything/evry_config.c index b1414b900..f0861b0de 100644 --- a/src/modules/everything/evry_config.c +++ b/src/modules/everything/evry_config.c @@ -1,65 +1,64 @@ #include "e_mod_main.h" -static void *_create_data (E_Config_Dialog *cfd); -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 Evas_Object *_basic_create_widgets (E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); +static void *_create_data(E_Config_Dialog *cfd); +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 Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); typedef struct _Plugin_Page Plugin_Page; struct _Plugin_Page { - Evas_Object *list; - Evas_Object *o_trigger; - Evas_Object *o_trigger_only; - E_Radio_Group *view_rg; - Evas_Object *o_view_default; - Evas_Object *o_view_list; - Evas_Object *o_view_detail; - Evas_Object *o_view_thumb; - Evas_Object *o_enabled; - Evas_Object *o_aggregate; - Evas_Object *o_top_level; - Evas_Object *o_cfg_btn; - Evas_Object *o_min_query; + Evas_Object *list; + Evas_Object *o_trigger; + Evas_Object *o_trigger_only; + E_Radio_Group *view_rg; + Evas_Object *o_view_default; + Evas_Object *o_view_list; + Evas_Object *o_view_detail; + Evas_Object *o_view_thumb; + Evas_Object *o_enabled; + Evas_Object *o_aggregate; + Evas_Object *o_top_level; + Evas_Object *o_cfg_btn; + Evas_Object *o_min_query; - Eina_List *configs; + Eina_List *configs; - char *trigger; - int trigger_only; - int view_mode; - int aggregate; - int top_level; - int enabled; - int min_query; - Plugin_Config *cur; + char *trigger; + int trigger_only; + int view_mode; + int aggregate; + int top_level; + int enabled; + int min_query; + Plugin_Config *cur; - Eina_Bool collection; + Eina_Bool collection; }; struct _E_Config_Dialog_Data { - int hide_input; - int hide_list; + int hide_input; + int hide_list; - int quick_nav; + int quick_nav; - int width, height; - int edge_width, edge_height; - double rel_x, rel_y; - int scroll_animate; - double scroll_speed; + int width, height; + int edge_width, edge_height; + double rel_x, rel_y; + int scroll_animate; + double scroll_speed; - int view_mode; - int view_zoom; - int cycle_mode; + int view_mode; + int view_zoom; + int cycle_mode; - int history_sort_mode; + int history_sort_mode; - Plugin_Page page[3]; + Plugin_Page page[3]; }; - EAPI E_Config_Dialog * 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.create_widgets = NULL; cfd = e_config_dialog_new(con, - _("Everything Settings"), - "E", "extensions/run_everything", - "system-run", 0, v, NULL); + _("Everything Settings"), + "E", "extensions/run_everything", + "system-run", 0, v, NULL); return cfd; } @@ -153,31 +152,31 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) #undef C 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_objects) eina_list_free(evry_conf->conf_objects); + if (evry_conf->conf_actions) eina_list_free(evry_conf->conf_actions); + 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_actions = eina_list_clone(cfdata->page[1].configs); - evry_conf->conf_objects = eina_list_clone(cfdata->page[2].configs); + evry_conf->conf_actions = eina_list_clone(cfdata->page[1].configs); + evry_conf->conf_objects = eina_list_clone(cfdata->page[2].configs); 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]) eina_stringshare_replace(&pc->trigger, cfdata->page[i].trigger); else eina_stringshare_replace(&pc->trigger, NULL); - pc->trigger_only = cfdata->page[i].trigger_only; - pc->view_mode = cfdata->page[i].view_mode; - pc->enabled = cfdata->page[i].enabled; - pc->aggregate = cfdata->page[i].aggregate; - pc->top_level = cfdata->page[i].top_level; - pc->min_query = cfdata->page[i].min_query; - } + pc->trigger_only = cfdata->page[i].trigger_only; + pc->view_mode = cfdata->page[i].view_mode; + pc->enabled = cfdata->page[i].enabled; + pc->aggregate = cfdata->page[i].aggregate; + pc->top_level = cfdata->page[i].top_level; + pc->min_query = cfdata->page[i].min_query; + } } 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_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; - /* if (e_theme_edje_object_set(end, "base/theme/widgets", - * "e/widgets/ilist/toggle_end")) - * { - * char *sig = pc->plugin ? "e,state,checked" : "e,state,unchecked"; - * edje_object_signal_emit(end, sig, "e"); - * } - * else - * { - * evas_object_del(end); - * end = NULL; - * } */ - e_widget_ilist_append(obj, NULL, pc->name, NULL, pc, NULL); + /* if (e_theme_edje_object_set(end, "base/theme/widgets", + * "e/widgets/ilist/toggle_end")) + * { + * char *sig = pc->plugin ? "e,state,checked" : "e,state,unchecked"; + * edje_object_signal_emit(end, sig, "e"); + * } + * else + * { + * evas_object_del(end); + * end = NULL; + * } */ + e_widget_ilist_append(obj, NULL, pc->name, NULL, pc, NULL); } e_widget_ilist_go(obj); @@ -241,23 +240,23 @@ _plugin_move(Plugin_Page *page, int dir) /* keep 'All' alway at top */ ((sel >= 1 && dir > 0) || (sel >= 2 && dir < 0))) { - Plugin_Config *pc, *pc2; - int prio = 0; + Plugin_Config *pc, *pc2; + 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); - l1 = eina_list_data_find_list(page->configs, pc); - l2 = eina_list_data_find_list(page->configs, pc2); - if (!l1 || !l2) return; + l1 = eina_list_data_find_list(page->configs, pc); + l2 = eina_list_data_find_list(page->configs, pc2); + if (!l1 || !l2) return; - l1->data = pc2; - l2->data = pc; + l1->data = pc2; + l2->data = pc; - _fill_list(page->configs, page->list, 0); - e_widget_ilist_selected_set(page->list, sel + dir); + _fill_list(page->configs, page->list, 0); + e_widget_ilist_selected_set(page->list, sel + dir); - EINA_LIST_FOREACH(page->configs, l1, pc) - pc->priority = prio++; + EINA_LIST_FOREACH (page->configs, l1, pc) + pc->priority = prio++; } } @@ -274,7 +273,7 @@ _plugin_move_down_cb(void *data, void *data2 __UNUSED__) } 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); 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))) { - e_widget_entry_text_set(page->o_trigger, pc->trigger); - e_widget_disabled_set(page->o_trigger, 0); + e_widget_entry_text_set(page->o_trigger, pc->trigger); + e_widget_disabled_set(page->o_trigger, 0); - e_widget_check_checked_set(page->o_trigger_only, pc->trigger_only); - e_widget_disabled_set(page->o_trigger_only, 0); + 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_view_default, 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_thumb, 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_list, 0); + e_widget_disabled_set(page->o_view_thumb, 0); - if (pc->view_mode == -1) - e_widget_radio_toggle_set(page->o_view_default, 1); - else if (pc->view_mode == 0) - e_widget_radio_toggle_set(page->o_view_list, 1); - else if (pc->view_mode == 1) - e_widget_radio_toggle_set(page->o_view_detail, 1); - else if (pc->view_mode == 2) - e_widget_radio_toggle_set(page->o_view_thumb, 1); + if (pc->view_mode == -1) + e_widget_radio_toggle_set(page->o_view_default, 1); + else if (pc->view_mode == 0) + e_widget_radio_toggle_set(page->o_view_list, 1); + else if (pc->view_mode == 1) + e_widget_radio_toggle_set(page->o_view_detail, 1); + else if (pc->view_mode == 2) + e_widget_radio_toggle_set(page->o_view_thumb, 1); - e_widget_check_checked_set(page->o_enabled, pc->enabled); - e_widget_disabled_set(page->o_enabled, 0); - e_widget_check_checked_set(page->o_aggregate, pc->aggregate); - e_widget_disabled_set(page->o_aggregate, 0); - e_widget_check_checked_set(page->o_top_level, pc->top_level); - e_widget_disabled_set(page->o_top_level, 0); - e_widget_slider_value_int_set(page->o_min_query, pc->min_query); - e_widget_disabled_set(page->o_min_query, 0); + e_widget_check_checked_set(page->o_enabled, pc->enabled); + e_widget_disabled_set(page->o_enabled, 0); + e_widget_check_checked_set(page->o_aggregate, pc->aggregate); + e_widget_disabled_set(page->o_aggregate, 0); + e_widget_check_checked_set(page->o_top_level, pc->top_level); + e_widget_disabled_set(page->o_top_level, 0); + e_widget_slider_value_int_set(page->o_min_query, pc->min_query); + e_widget_disabled_set(page->o_min_query, 0); - if (pc->plugin && pc->plugin->config_path) - { - e_widget_disabled_set(page->o_cfg_btn, 0); - } - else - { - e_widget_disabled_set(page->o_cfg_btn, 1); - } + if (pc->plugin && pc->plugin->config_path) + { + e_widget_disabled_set(page->o_cfg_btn, 0); + } + else + { + e_widget_disabled_set(page->o_cfg_btn, 1); + } - page->cur = pc; + page->cur = pc; } else { - e_widget_entry_text_set(page->o_trigger, ""); - e_widget_disabled_set(page->o_trigger, 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_detail, 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_enabled, 1); - e_widget_disabled_set(page->o_aggregate, 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_min_query, 1); + e_widget_entry_text_set(page->o_trigger, ""); + e_widget_disabled_set(page->o_trigger, 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_detail, 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_enabled, 1); + e_widget_disabled_set(page->o_aggregate, 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_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); e_configure_registry_call(p->config_path, - e_container_current_get(e_manager_current_get()), - p->name); + e_container_current_get(e_manager_current_get()), + p->name); } 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); e_widget_on_change_hook_set(page->list, _list_select_cb, page); _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, _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, _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); 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); o = e_widget_check_add(e, _("Enabled"), - &(page->enabled)); + &(page->enabled)); e_widget_disabled_set(o, 1); page->o_enabled = o; e_widget_framelist_object_append(of, o); o = e_widget_check_add(e, _("Show in \"All\""), - &(page->aggregate)); + &(page->aggregate)); e_widget_disabled_set(o, 1); page->o_aggregate = o; e_widget_framelist_object_append(of, o); o = e_widget_check_add(e, _("Show in top-level"), - &(page->top_level)); + &(page->top_level)); e_widget_disabled_set(o, 1); page->o_top_level = 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")); e_widget_framelist_object_append(of, o); 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; 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; e_widget_framelist_object_append(of, o); o = e_widget_check_add(e, _("Search only when triggered"), - &(page->trigger_only)); + &(page->trigger_only)); e_widget_disabled_set(o, 1); page->o_trigger_only = 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); e_widget_disabled_set(o, 1); 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); - 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); page->o_view_list = o; o = e_widget_radio_add(e, _("Detailed"), 1, rg); e_widget_disabled_set(o, 1); 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); e_widget_disabled_set(o, 1); 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); 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); ob = e_widget_check_add(e, _("Animate scrolling"), - &(cfdata->scroll_animate)); + &(cfdata->scroll_animate)); e_widget_framelist_object_append(of, ob); /* 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); */ 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_table_object_append(o, of, 0, 0, 1, 1, 1, 0, 1, 0); - + #if 0 /* FIXME no theme supports this currently, need to add info to themes data section to know whether this option should be enabled */ cfdata->hide_input = 0; ob = e_widget_check_add(e, _("Hide input when inactive"), - &(cfdata->hide_input)); - e_widget_disabled_set(ob, 1); + &(cfdata->hide_input)); + e_widget_disabled_set(ob, 1); e_widget_framelist_object_append(of, ob); cfdata->hide_list = 0; ob = e_widget_check_add(e, _("Hide list"), - &(cfdata->hide_list)); - e_widget_disabled_set(ob, 1); + &(cfdata->hide_list)); + e_widget_disabled_set(ob, 1); e_widget_framelist_object_append(of, ob); #endif 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_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 /// otb2 = e_widget_toolbook_add(e, 48 * e_scale, 48 * e_scale); ob = _create_plugin_page(cfdata, e, &cfdata->page[0]); 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]); 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]); 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"), - 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); @@ -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")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(e, 1, 0, _("%1.0f"), - evry_conf->min_w, 800, 1, 0, NULL, - &(cfdata->width), 200); + evry_conf->min_w, 800, 1, 0, NULL, + &(cfdata->width), 200); e_widget_framelist_object_append(of, ob); ob = e_widget_label_add(e, _("Popup Height")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(e, 1, 0, _("%1.0f"), - evry_conf->min_h, 800, 1, 0, NULL, - &(cfdata->height), 200); + evry_conf->min_h, 800, 1, 0, NULL, + &(cfdata->height), 200); e_widget_framelist_object_append(of, ob); 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")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(e, 1, 0, _("%1.2f"), - 0.0, 1.0, 0.01, 0, - &(cfdata->rel_y), NULL, 200); + 0.0, 1.0, 0.01, 0, + &(cfdata->rel_y), NULL, 200); e_widget_framelist_object_append(of, ob); ob = e_widget_label_add(e, _("Horizontal")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(e, 1, 0, _("%1.2f"), - 0.0, 1.0, 0.01, 0, - &(cfdata->rel_x), NULL, 200); + 0.0, 1.0, 0.01, 0, + &(cfdata->rel_x), NULL, 200); e_widget_framelist_object_append(of, ob); 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")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(e, 1, 0, _("%1.0f"), - evry_conf->min_w, 800, 1, 0, NULL, - &(cfdata->edge_width), 200); + evry_conf->min_w, 800, 1, 0, NULL, + &(cfdata->edge_width), 200); e_widget_framelist_object_append(of, ob); ob = e_widget_label_add(e, _("Popup Height")); e_widget_framelist_object_append(of, ob); ob = e_widget_slider_add(e, 1, 0, _("%1.0f"), - evry_conf->min_h, 800, 1, 0, NULL, - &(cfdata->edge_height), 200); + evry_conf->min_h, 800, 1, 0, NULL, + &(cfdata->edge_height), 200); e_widget_framelist_object_append(of, ob); e_widget_list_object_append(o, of, 1, 1, 0.5); #endif 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_dialog_resizable_set(cfd->dia, 0); return otb; } - /***************************************************************************/ -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_create_data(E_Config_Dialog *cfd); +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, - E_Config_Dialog_Data *cfdata); -static int _cat_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); + E_Config_Dialog_Data *cfdata); +static int _cat_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); EAPI E_Config_Dialog * 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); 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 _conf->cfd = cfd; */ @@ -652,30 +650,30 @@ _cat_create_data(E_Config_Dialog *cfd) cfdata = E_NEW(E_Config_Dialog_Data, 1); 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) - continue; + if (pc->name == p->name) + continue; - if (!strcmp(pc->name, "All") || - !strcmp(pc->name, "Actions") || - !strcmp(pc->name, "Text") || - !strcmp(pc->name, "Calculator") || - !strcmp(pc->name, "Spell Checker") || - !strcmp(pc->name, "Plugins")) - continue; + if (!strcmp(pc->name, "All") || + !strcmp(pc->name, "Actions") || + !strcmp(pc->name, "Text") || + !strcmp(pc->name, "Calculator") || + !strcmp(pc->name, "Spell Checker") || + !strcmp(pc->name, "Plugins")) + continue; - EINA_LIST_FOREACH(p->config->plugins, ll, pc2) - if (pc->name == pc2->name) - break; + EINA_LIST_FOREACH (p->config->plugins, ll, pc2) + if (pc->name == pc2->name) + break; - if (pc2) - continue; + if (pc2) + continue; - pc2 = E_NEW(Plugin_Config, 1); - pc2->name = eina_stringshare_ref(pc->name); - pc2->view_mode = VIEW_MODE_NONE; - p->config->plugins = eina_list_append(p->config->plugins, pc2); + pc2 = E_NEW(Plugin_Config, 1); + pc2->name = eina_stringshare_ref(pc->name); + pc2->view_mode = VIEW_MODE_NONE; + p->config->plugins = eina_list_append(p->config->plugins, pc2); } 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->trigger) - eina_stringshare_del(pc->trigger); + if (pc->trigger) + eina_stringshare_del(pc->trigger); - if (cfdata->page[i].trigger[0]) - pc->trigger = eina_stringshare_add(cfdata->page[i].trigger); - else - pc->trigger = NULL; + if (cfdata->page[i].trigger[0]) + pc->trigger = eina_stringshare_add(cfdata->page[i].trigger); + else + pc->trigger = NULL; - pc->trigger_only = cfdata->page[i].trigger_only; - pc->view_mode = cfdata->page[i].view_mode; - pc->enabled = cfdata->page[i].enabled; - pc->aggregate = cfdata->page[i].aggregate; - pc->top_level = cfdata->page[i].top_level; - pc->min_query = cfdata->page[i].min_query; + pc->trigger_only = cfdata->page[i].trigger_only; + pc->view_mode = cfdata->page[i].view_mode; + pc->enabled = cfdata->page[i].enabled; + pc->aggregate = cfdata->page[i].aggregate; + pc->top_level = cfdata->page[i].top_level; + pc->min_query = cfdata->page[i].min_query; } 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]); 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); return otb; } + diff --git a/src/modules/everything/evry_gadget.c b/src/modules/everything/evry_gadget.c index 718a402b1..d642e038b 100644 --- a/src/modules/everything/evry_gadget.c +++ b/src/modules/everything/evry_gadget.c @@ -5,54 +5,54 @@ typedef struct _Instance Instance; struct _Instance { - EINA_INLIST; + EINA_INLIST; - E_Gadcon_Client *gcc; - Evas_Object *o_button; + E_Gadcon_Client *gcc; + Evas_Object *o_button; - E_Object_Delfn *del_fn; - Evry_Window *win; - Gadget_Config *cfg; - E_Config_Dialog *cfd; - E_Menu *menu; + E_Object_Delfn *del_fn; + Evry_Window *win; + Gadget_Config *cfg; + E_Config_Dialog *cfd; + E_Menu *menu; - int mouse_down; + int mouse_down; - Ecore_Animator *hide_animator; - double hide_start; - int hide_x, hide_y; + Ecore_Animator *hide_animator; + double hide_start; + int hide_x, hide_y; - Eina_List *handlers; + Eina_List *handlers; - Eina_Bool hidden; - Eina_Bool illume_mode; + Eina_Bool hidden; + 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_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 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); /* gadcon requirements */ 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_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient); -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 const char *_gc_id_new(E_Gadcon_Client_Class *client_class); -static Gadget_Config *_conf_item_get(const char *id); +static void _gc_shutdown(E_Gadcon_Client *gcc); +static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient); +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 const char *_gc_id_new(E_Gadcon_Client_Class *client_class); +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 const E_Gadcon_Client_Class _gadcon_class = { - GADCON_CLIENT_CLASS_VERSION, - "evry-starter", - { + GADCON_CLIENT_CLASS_VERSION, + "evry-starter", + { _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon, _gc_id_new, NULL, e_gadcon_site_is_not_toolbar - }, - E_GADCON_CLIENT_STYLE_PLAIN + }, + E_GADCON_CLIENT_STYLE_PLAIN }; static Eina_Bool @@ -64,7 +64,7 @@ _illume_running(void) Eina_List *l; 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) 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)) && (p = evry_plugin_find(inst->cfg->plugin))) { - Evas_Object *oo = evry_util_icon_get(EVRY_ITEM(p), gc->evas); - if (oo) + Evas_Object *oo = evry_util_icon_get(EVRY_ITEM(p), gc->evas); + if (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; /* 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, - _button_cb_mouse_down, inst); - + _button_cb_mouse_down, inst); if (_illume_running()) { - inst->illume_mode = EINA_TRUE; + inst->illume_mode = EINA_TRUE; - inst->handlers = eina_list_append(inst->handlers, - ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT, - _cb_focus_out, inst)); + inst->handlers = eina_list_append(inst->handlers, + ecore_event_handler_add(E_EVENT_BORDER_FOCUS_OUT, + _cb_focus_out, inst)); } - + instances = eina_inlist_append(instances, EINA_INLIST_GET(inst)); return gcc; @@ -130,20 +129,20 @@ _gc_shutdown(E_Gadcon_Client *gcc) { Instance *inst; Ecore_Event_Handler *h; - + inst = gcc->data; 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); if (inst->del_fn && inst->win) { - e_object_delfn_del(E_OBJECT(inst->win->ewin), inst->del_fn); - evry_hide(inst->win, 0); + e_object_delfn_del(E_OBJECT(inst->win->ewin), inst->del_fn); + evry_hide(inst->win, 0); } - + evas_object_del(inst->o_button); free(inst); } @@ -179,7 +178,7 @@ _gc_icon(E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas __UNUSED__) o = edje_object_add(evas); 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"); return o; } @@ -210,8 +209,8 @@ _gc_id_new(E_Gadcon_Client_Class *client_class __UNUSED__) /***************************************************************************/ - -static void _del_func(void *data, void *obj __UNUSED__) +static void +_del_func(void *data, void *obj __UNUSED__) { 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); e_border_fx_offset(ewin->border, - (val * (inst->hide_x * ewin->w)), - (val * (inst->hide_y * ewin->h))); + (val * (inst->hide_x * ewin->w)), + (val * (inst->hide_y * ewin->h))); if (finished) { - /* go bac to subject selector */ - evry_selectors_switch(inst->win, -1, 0); - evry_selectors_switch(inst->win, -1, 0); + /* go bac to subject selector */ + evry_selectors_switch(inst->win, -1, 0); + evry_selectors_switch(inst->win, -1, 0); - inst->hide_animator = NULL; - e_border_iconify(ewin->border); - e_border_fx_offset(ewin->border, 0, 0); - return EINA_FALSE; + inst->hide_animator = NULL; + e_border_iconify(ewin->border); + e_border_fx_offset(ewin->border, 0, 0); + return EINA_FALSE; } return EINA_TRUE; @@ -293,7 +292,7 @@ _cb_focus_out(void *data, int type __UNUSED__, void *event) ev = event; - EINA_INLIST_FOREACH(instances, inst) + EINA_INLIST_FOREACH (instances, inst) if (inst == data) break; if ((!inst) || (!inst->win)) @@ -309,6 +308,7 @@ _cb_focus_out(void *data, int type __UNUSED__, void *event) return ECORE_CALLBACK_PASS_ON; } + static void _gadget_popup_show(Instance *inst) { @@ -329,32 +329,36 @@ _gadget_popup_show(Instance *inst) case E_GADCON_ORIENT_TOP: case E_GADCON_ORIENT_CORNER_TL: case E_GADCON_ORIENT_CORNER_TR: - e_win_move(ewin, x, y + h); - inst->hide_y = -1; - break; + e_win_move(ewin, x, y + h); + inst->hide_y = -1; + break; + case E_GADCON_ORIENT_BOTTOM: case E_GADCON_ORIENT_CORNER_BR: case E_GADCON_ORIENT_CORNER_BL: - e_win_move(ewin, x, y - ph); - inst->hide_y = 1; - break; + e_win_move(ewin, x, y - ph); + inst->hide_y = 1; + break; + case E_GADCON_ORIENT_LEFT: case E_GADCON_ORIENT_CORNER_LT: case E_GADCON_ORIENT_CORNER_LB: - e_win_move(ewin, x + w, y); - inst->hide_x = -1; - break; + e_win_move(ewin, x + w, y); + inst->hide_x = -1; + break; + case E_GADCON_ORIENT_RIGHT: case E_GADCON_ORIENT_CORNER_RT: case E_GADCON_ORIENT_CORNER_RB: - e_win_move(ewin, x - pw, y); - inst->hide_x = 1; - break; + e_win_move(ewin, x - pw, y); + inst->hide_x = 1; + break; + case E_GADCON_ORIENT_FLOAT: case E_GADCON_ORIENT_HORIZ: case E_GADCON_ORIENT_VERT: default: - break; + break; } 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) e_win_move(ewin, ewin->x, inst->win->zone->h - ph); - } static void @@ -376,7 +379,7 @@ _gadget_window_show(Instance *inst) E_Win *ewin = inst->win->ewin; inst->win->func.hide = &_evry_hide_func; - + e_zone_useful_geometry_get(inst->win->zone, &zx, &zy, &zw, &zh); 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_CORNER_TL: case E_GADCON_ORIENT_CORNER_TR: - pw = zw/2; - ph = zh/2; - inst->hide_y = -1; - e_win_move(ewin, zx, gy + gh); - break; + pw = zw / 2; + ph = zh / 2; + inst->hide_y = -1; + e_win_move(ewin, zx, gy + gh); + break; + case E_GADCON_ORIENT_BOTTOM: case E_GADCON_ORIENT_CORNER_BR: case E_GADCON_ORIENT_CORNER_BL: - pw = zw/2; - ph = zh/2; - inst->hide_y = 1; - e_win_move(ewin, zx, gy - ph); - break; + pw = zw / 2; + ph = zh / 2; + inst->hide_y = 1; + e_win_move(ewin, zx, gy - ph); + break; + case E_GADCON_ORIENT_LEFT: case E_GADCON_ORIENT_CORNER_LT: case E_GADCON_ORIENT_CORNER_LB: - pw = zw/2.5; - ph = zh; - inst->hide_x = -1; - e_win_move(ewin, gx + gw, zy); - break; + pw = zw / 2.5; + ph = zh; + inst->hide_x = -1; + e_win_move(ewin, gx + gw, zy); + break; + case E_GADCON_ORIENT_RIGHT: case E_GADCON_ORIENT_CORNER_RT: case E_GADCON_ORIENT_CORNER_RB: - pw = zw/2.5; - ph = zh; - inst->hide_x = 1; - e_win_move(ewin, gx - pw, zy); - break; + pw = zw / 2.5; + ph = zh; + inst->hide_x = 1; + e_win_move(ewin, gx - pw, zy); + break; + case E_GADCON_ORIENT_FLOAT: case E_GADCON_ORIENT_HORIZ: case E_GADCON_ORIENT_VERT: default: - pw = ph = 1; - break; + pw = ph = 1; + break; } 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; if (ev->button == 1) { - Evry_Window *win; - E_Border *bd; + Evry_Window *win; + E_Border *bd; - if (inst->win) - { - win = inst->win; - bd = win->ewin->border; + if (inst->win) + { + win = inst->win; + bd = win->ewin->border; - if (inst->hide_animator) - { - ecore_animator_del(inst->hide_animator); - inst->hide_animator = NULL; - } + if (inst->hide_animator) + { + ecore_animator_del(inst->hide_animator); + inst->hide_animator = NULL; + } - if (inst->hidden || !bd->focused) - { - e_border_fx_offset(bd, 0, 0); - e_border_uniconify(bd); - e_border_raise(bd); - e_border_focus_set(bd, 1, 1); - inst->hidden = EINA_FALSE; - return; - } - else - { - evry_hide(win, 1); - return; - } - } + if (inst->hidden || !bd->focused) + { + e_border_fx_offset(bd, 0, 0); + e_border_uniconify(bd); + e_border_raise(bd); + e_border_focus_set(bd, 1, 1); + inst->hidden = EINA_FALSE; + return; + } + else + { + evry_hide(win, 1); + return; + } + } - win = evry_show(e_util_zone_current_get(e_manager_current_get()), - 0, inst->cfg->plugin, !inst->illume_mode); - if (!win) return; + win = evry_show(e_util_zone_current_get(e_manager_current_get()), + 0, inst->cfg->plugin, !inst->illume_mode); + if (!win) return; - inst->win = win; - win->data = inst; + inst->win = win; + 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) - _gadget_window_show(inst); - else - _gadget_popup_show(inst); + if (inst->illume_mode) + _gadget_window_show(inst); + else + _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)) { - E_Menu *m; - E_Menu_Item *mi; - int cx, cy; + E_Menu *m; + E_Menu_Item *mi; + int cx, cy; - m = e_menu_new(); - mi = e_menu_item_new(m); - e_menu_item_label_set(mi, _("Settings")); - e_util_menu_item_theme_icon_set(mi, "configure"); - e_menu_item_callback_set(mi, _cb_menu_configure, inst); + m = e_menu_new(); + mi = e_menu_item_new(m); + e_menu_item_label_set(mi, _("Settings")); + e_util_menu_item_theme_icon_set(mi, "configure"); + e_menu_item_callback_set(mi, _cb_menu_configure, inst); - m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0); - e_menu_post_deactivate_callback_set(m, _cb_menu_post, inst); - inst->menu = m; + m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0); + e_menu_post_deactivate_callback_set(m, _cb_menu_post, inst); + 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); - e_menu_activate_mouse(m, - e_util_zone_current_get(e_manager_current_get()), - cx + ev->output.x, cy + ev->output.y, 1, 1, - E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + e_menu_activate_mouse(m, + e_util_zone_current_get(e_manager_current_get()), + cx + ev->output.x, cy + ev->output.y, 1, 1, + 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; * Evas_Event_Mouse_Down *ev; - * + * * inst = data; * inst->mouse_down = 1; * } */ - int evry_gadget_init(void) { @@ -555,16 +561,16 @@ evry_gadget_shutdown(void) struct _E_Config_Dialog_Data { - const char *plugin; - int hide_after_action; - int popup; - Evas_Object *list; + const char *plugin; + int hide_after_action; + int popup; + Evas_Object *list; }; -static void *_create_data(E_Config_Dialog *cfd); -static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static void *_create_data(E_Config_Dialog *cfd); +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 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 _conf_dialog(Instance *inst) @@ -588,7 +594,7 @@ _conf_dialog(Instance *inst) con = e_container_current_get(e_manager_current_get()); 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); /* _conf->cfd = cfd; */ @@ -604,7 +610,7 @@ _create_data(E_Config_Dialog *cfd) cfdata = E_NEW(E_Config_Dialog_Data, 1); #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); */ C(hide_after_action); C(popup); @@ -638,7 +644,7 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, E_Config_Dialog_Data *cfdata) Eina_List *l; Plugin_Config *pc; int sel = 0, cnt = 1; - + evas = evas_object_evas_get(obj); evas_event_freeze(evas); 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); - 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); if (cfdata->plugin && !strcmp(pc->name, cfdata->plugin)) sel = cnt; @@ -657,8 +663,8 @@ _fill_list(Eina_List *plugins, Evas_Object *obj, E_Config_Dialog_Data *cfdata) cnt++; } - e_widget_ilist_selected_set(obj, sel); - + e_widget_ilist_selected_set(obj, sel); + e_widget_ilist_go(obj); e_widget_size_min_get(obj, &w, NULL); 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); e_widget_ilist_nth_data_get(obj, sel); - } + #endif 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); e_widget_framelist_object_append(of, ow); cfdata->list = ow; - + ow = e_widget_button_add(e, _("Settings"), NULL, _cb_button_settings, inst, NULL); 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; Evas_Object *oo; const char *plugin; - -#define CP(_name) \ - if (gc->_name) \ - eina_stringshare_del(gc->_name); \ - gc->_name = eina_stringshare_add(cfdata->_name); + +#define CP(_name) \ + if (gc->_name) \ + eina_stringshare_del(gc->_name); \ + gc->_name = eina_stringshare_add(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); if (plugin && plugin[0]) 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); edje_object_signal_emit(inst->o_button, "e,state,icon,default", "e"); - + if ((p = evry_plugin_find(inst->cfg->plugin))) { 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_signal_emit(inst->o_button, "e,state,icon,plugin", "e"); + edje_object_signal_emit(inst->o_button, "e,state,icon,plugin", "e"); } } - + return 1; } + diff --git a/src/modules/everything/evry_history.c b/src/modules/everything/evry_history.c index 36e109821..9ae405221 100644 --- a/src/modules/everything/evry_history.c +++ b/src/modules/everything/evry_history.c @@ -1,8 +1,8 @@ #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 */ #define CLEANUP_THRESHOLD 500 @@ -13,10 +13,10 @@ typedef struct _Cleanup_Data Cleanup_Data; struct _Cleanup_Data { - double time; - Eina_List *keys; - Eina_Bool normalize; - const char *plugin; + double time; + Eina_List *keys; + Eina_Bool normalize; + const char *plugin; }; 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); #define T History_Item #define D hist_item_edd - E_CONFIG_VAL(D, T, plugin, STR); - E_CONFIG_VAL(D, T, context, STR); - E_CONFIG_VAL(D, T, input, STR); + E_CONFIG_VAL(D, T, plugin, STR); + E_CONFIG_VAL(D, T, context, STR); + E_CONFIG_VAL(D, T, input, STR); E_CONFIG_VAL(D, T, last_used, DOUBLE); - E_CONFIG_VAL(D, T, usage, DOUBLE); - E_CONFIG_VAL(D, T, count, INT); + E_CONFIG_VAL(D, T, usage, DOUBLE); + E_CONFIG_VAL(D, T, count, 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 D 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); #define T Evry_History #define D hist_edd - E_CONFIG_VAL(D, T, version, INT); - E_CONFIG_VAL(D, T, begin, DOUBLE); - E_CONFIG_HASH(D, T, subjects, hist_types_edd); + E_CONFIG_VAL(D, T, version, INT); + E_CONFIG_VAL(D, T, begin, DOUBLE); + E_CONFIG_HASH(D, T, subjects, hist_types_edd); #undef T #undef D } @@ -72,17 +72,17 @@ _hist_entry_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__ History_Entry *he = data; History_Item *hi; - EINA_LIST_FREE(he->items, hi) + EINA_LIST_FREE (he->items, hi) { - if (hi->input) - eina_stringshare_del(hi->input); - if (hi->plugin) - eina_stringshare_del(hi->plugin); - if (hi->context) - eina_stringshare_del(hi->context); - if (hi->data) - eina_stringshare_del(hi->data); - E_FREE(hi); + if (hi->input) + eina_stringshare_del(hi->input); + if (hi->plugin) + eina_stringshare_del(hi->plugin); + if (hi->context) + eina_stringshare_del(hi->context); + if (hi->data) + eina_stringshare_del(hi->data); + E_FREE(hi); } E_FREE(he); @@ -97,8 +97,8 @@ _hist_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void if (ht->types) { - eina_hash_foreach(ht->types, _hist_entry_free_cb, NULL); - eina_hash_free(ht->types); + eina_hash_foreach(ht->types, _hist_entry_free_cb, NULL); + eina_hash_free(ht->types); } E_FREE(ht); @@ -114,35 +114,35 @@ _hist_entry_cleanup_cb(const Eina_Hash *hash __UNUSED__, const void *key, void * History_Item *hi; 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) - { - hi->count--; - hi->last_used = d->time - SEVEN_DAYS/2.0; - } + if (hi->last_used < d->time - SEVEN_DAYS) + { + hi->count--; + hi->last_used = d->time - SEVEN_DAYS / 2.0; + } - /* item is transient or too old */ - if ((hi->count < 1) || hi->transient) - { - if (hi->input) - eina_stringshare_del(hi->input); - if (hi->plugin) - eina_stringshare_del(hi->plugin); - if (hi->context) - eina_stringshare_del(hi->context); - if (hi->data) - eina_stringshare_del(hi->data); - E_FREE(hi); + /* item is transient or too old */ + if ((hi->count < 1) || hi->transient) + { + if (hi->input) + eina_stringshare_del(hi->input); + if (hi->plugin) + eina_stringshare_del(hi->plugin); + if (hi->context) + eina_stringshare_del(hi->context); + if (hi->data) + eina_stringshare_del(hi->data); + E_FREE(hi); - he->items = eina_list_remove_list(he->items, l); - } + he->items = eina_list_remove_list(he->items, l); + } } if (!he->items) { - E_FREE(he); - d->keys = eina_list_append(d->keys, key); + E_FREE(he); + d->keys = eina_list_append(d->keys, key); } return EINA_TRUE; @@ -156,14 +156,15 @@ _hist_cleanup_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data, 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_hash_del_by_key(ht->types, key); + EINA_LIST_FREE (d->keys, key) + eina_hash_del_by_key(ht->types, key); } return EINA_TRUE; } + void evry_history_free(void) { @@ -172,12 +173,12 @@ evry_history_free(void) if ((evry_hist) && (evry_hist->subjects) && (eina_hash_population(evry_hist->subjects) > CLEANUP_THRESHOLD)) { - Cleanup_Data *d; + Cleanup_Data *d; - d = E_NEW(Cleanup_Data, 1); - d->time = ecore_time_unix_get(); - eina_hash_foreach(evry_hist->subjects, _hist_cleanup_cb, d); - E_FREE(d); + d = E_NEW(Cleanup_Data, 1); + d->time = ecore_time_unix_get(); + eina_hash_foreach(evry_hist->subjects, _hist_cleanup_cb, d); + E_FREE(d); } evry_history_unload(); @@ -197,24 +198,23 @@ evry_history_load(void) if (evry_hist && evry_hist->version != HISTORY_VERSION) { - eina_hash_foreach(evry_hist->subjects, _hist_free_cb, NULL); - eina_hash_free(evry_hist->subjects); + eina_hash_foreach(evry_hist->subjects, _hist_free_cb, NULL); + eina_hash_free(evry_hist->subjects); - E_FREE(evry_hist); - evry_hist = NULL; + E_FREE(evry_hist); + evry_hist = NULL; } if (!evry_hist) { - evry_hist = E_NEW(Evry_History, 1); - evry_hist->version = HISTORY_VERSION; - evry_hist->begin = ecore_time_unix_get() - SEVEN_DAYS; + evry_hist = E_NEW(Evry_History, 1); + evry_hist->version = HISTORY_VERSION; + evry_hist->begin = ecore_time_unix_get() - SEVEN_DAYS; } if (!evry_hist->subjects) evry_hist->subjects = eina_hash_string_superfast_new(NULL); } - void evry_history_unload(void) { @@ -234,10 +234,10 @@ evry_history_types_get(Evry_Type _type) { History_Types *ht; const char *type = evry_type_get(_type); - + if (!evry_hist) return NULL; - + if (!type) return NULL; @@ -245,8 +245,8 @@ evry_history_types_get(Evry_Type _type) if (!ht) { - ht = E_NEW(History_Types, 1); - eina_hash_add(evry_hist->subjects, type, ht); + ht = E_NEW(History_Types, 1); + eina_hash_add(evry_hist->subjects, type, ht); } if (!ht->types) @@ -260,7 +260,7 @@ evry_history_item_add(Evry_Item *it, const char *ctxt, const char *input) { History_Entry *he; History_Types *ht; - History_Item *hi = NULL; + History_Item *hi = NULL; Eina_List *l; int rem_ctxt = 1; const char *id; @@ -272,80 +272,80 @@ evry_history_item_add(Evry_Item *it, const char *ctxt, const char *input) return NULL; if ((!it->plugin->history) && (!CHECK_TYPE(it, EVRY_TYPE_PLUGIN))) - return NULL; + return NULL; if (it->type == EVRY_TYPE_ACTION) { - GET_ACTION(act, it); - if (!act->remember_context) - rem_ctxt = 0; + GET_ACTION(act, it); + if (!act->remember_context) + rem_ctxt = 0; } if (it->hi) { - /* keep hi when context didn't change */ - if ((!rem_ctxt) || (!it->hi->context && !ctxt) || - (it->hi->context && ctxt && !strcmp(it->hi->context, ctxt))) - hi = it->hi; + /* keep hi when context didn't change */ + if ((!rem_ctxt) || (!it->hi->context && !ctxt) || + (it->hi->context && ctxt && !strcmp(it->hi->context, ctxt))) + hi = it->hi; } if (!hi) { - id = (it->id ? it->id : it->label); - ht = evry_history_types_get(it->type); - if (!ht) - return NULL; - - he = eina_hash_find(ht->types, id); + id = (it->id ? it->id : it->label); + ht = evry_history_types_get(it->type); + if (!ht) + return NULL; - if (!he) - { - he = E_NEW(History_Entry, 1); - eina_hash_add(ht->types, id, he); - } - else - { - EINA_LIST_FOREACH(he->items, l, hi) - if ((hi->plugin == it->plugin->name) && - (!rem_ctxt || (ctxt == hi->context))) - break; - } + he = eina_hash_find(ht->types, id); + + if (!he) + { + he = E_NEW(History_Entry, 1); + eina_hash_add(ht->types, id, he); + } + else + { + EINA_LIST_FOREACH (he->items, l, hi) + if ((hi->plugin == it->plugin->name) && + (!rem_ctxt || (ctxt == hi->context))) + break; + } } if (!hi) { - hi = E_NEW(History_Item, 1); - hi->plugin = eina_stringshare_ref(it->plugin->name); - he->items = eina_list_append(he->items, hi); + hi = E_NEW(History_Item, 1); + hi->plugin = eina_stringshare_ref(it->plugin->name); + he->items = eina_list_append(he->items, hi); } if (hi) { - it->hi = hi; + it->hi = hi; - hi->last_used = ecore_time_unix_get(); - hi->usage /= 4.0; - hi->usage += TIME_FACTOR(hi->last_used); - hi->transient = it->plugin->transient; - hi->count += 1; + hi->last_used = ecore_time_unix_get(); + hi->usage /= 4.0; + hi->usage += TIME_FACTOR(hi->last_used); + hi->transient = it->plugin->transient; + hi->count += 1; - if (ctxt && !hi->context && rem_ctxt) - { - hi->context = eina_stringshare_ref(ctxt); - } + if (ctxt && !hi->context && rem_ctxt) + { + hi->context = eina_stringshare_ref(ctxt); + } - if (input && hi->input) - { - if (strncmp(hi->input, input, strlen(input))) - { - eina_stringshare_del(hi->input); - hi->input = eina_stringshare_add(input); - } - } - else if (input) - { - hi->input = eina_stringshare_add(input); - } + if (input && hi->input) + { + if (strncmp(hi->input, input, strlen(input))) + { + eina_stringshare_del(hi->input); + hi->input = eina_stringshare_add(input); + } + } + else if (input) + { + hi->input = eina_stringshare_add(input); + } } /* reset usage */ @@ -364,9 +364,9 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt) int rem_ctxt = 1; if (evry_conf->history_sort_mode == 3) - { - it->usage = -1; - return 1; + { + it->usage = -1; + return 1; } else 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) { - /* keep hi when context didn't change */ - if ((!rem_ctxt) || (!it->hi->context && !ctxt) || - (it->hi->context && ctxt && !strcmp(it->hi->context, ctxt))) - hi = it->hi; + /* keep hi when context didn't change */ + if ((!rem_ctxt) || (!it->hi->context && !ctxt) || + (it->hi->context && ctxt && !strcmp(it->hi->context, ctxt))) + hi = it->hi; } if (!hi) { - ht = evry_history_types_get(it->type); + ht = evry_history_types_get(it->type); - if (!ht) - return 0; - - if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label)))) - return 0; + if (!ht) + return 0; - if (it->type == EVRY_TYPE_ACTION) - { - GET_ACTION(act, it); - if (!act->remember_context) - rem_ctxt = 0; - } + if (!(he = eina_hash_find(ht->types, (it->id ? it->id : it->label)))) + return 0; - EINA_LIST_FOREACH(he->items, l, hi) - { - if (hi->plugin != it->plugin->name) - continue; + if (it->type == EVRY_TYPE_ACTION) + { + GET_ACTION(act, it); + if (!act->remember_context) + rem_ctxt = 0; + } - if (rem_ctxt && ctxt && (hi->context != ctxt)) - { - it->hi = hi; - continue; - } + EINA_LIST_FOREACH (he->items, l, hi) + { + if (hi->plugin != it->plugin->name) + continue; - it->hi = hi; - break; - } + if (rem_ctxt && ctxt && (hi->context != ctxt)) + { + it->hi = hi; + continue; + } + + it->hi = hi; + break; + } } if (!hi) return 0; if (evry_conf->history_sort_mode == 0) { - if (!input || !hi->input) - { - it->usage += hi->usage * hi->count; - } - else - { - /* higher priority for exact matches */ - if (!strncmp(input, hi->input, strlen(input))) - { - it->usage += hi->usage * hi->count; - } - if (!strncmp(input, hi->input, strlen(hi->input))) - { - it->usage += hi->usage * hi->count; - } - } + if (!input || !hi->input) + { + it->usage += hi->usage * hi->count; + } + else + { + /* higher priority for exact matches */ + if (!strncmp(input, hi->input, strlen(input))) + { + it->usage += hi->usage * hi->count; + } + if (!strncmp(input, hi->input, strlen(hi->input))) + { + it->usage += hi->usage * hi->count; + } + } - if (ctxt && hi->context && (hi->context == ctxt)) - { - it->usage += hi->usage * hi->count * 10.0; - } + if (ctxt && hi->context && (hi->context == ctxt)) + { + it->usage += hi->usage * hi->count * 10.0; + } } 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)) - { - it->usage += hi->usage * hi->count * 10.0; - } + if (ctxt && hi->context && (hi->context == ctxt)) + { + it->usage += hi->usage * hi->count * 10.0; + } } else if (evry_conf->history_sort_mode == 2) { - if (hi->last_used > it->usage) - it->usage = hi->last_used; + if (hi->last_used > it->usage) + it->usage = hi->last_used; } if (it->fuzzy_match > 0) - it->usage /= (double) it->fuzzy_match; + it->usage /= (double)it->fuzzy_match; else it->usage /= 100.0; - + if (it->usage > 0.0) return 1; @@ -467,3 +467,4 @@ evry_history_item_usage_set(Evry_Item *it, const char *input, const char *ctxt) return 0; } + diff --git a/src/modules/everything/evry_plug_actions.c b/src/modules/everything/evry_plug_actions.c index a02c740c9..3e6a2f9a3 100644 --- a/src/modules/everything/evry_plug_actions.c +++ b/src/modules/everything/evry_plug_actions.c @@ -7,10 +7,10 @@ typedef struct _Plugin Plugin; struct _Plugin { - Evry_Plugin base; - Eina_List *actions; - Eina_Bool parent; - Evry_Action *action; + Evry_Plugin base; + Eina_List *actions; + Eina_Bool parent; + Evry_Action *action; }; static Evry_Plugin *_plug = NULL; @@ -23,7 +23,7 @@ _finish(Evry_Plugin *plugin) EVRY_PLUGIN_ITEMS_CLEAR(p); - EINA_LIST_FREE(p->actions, act); + EINA_LIST_FREE (p->actions, act) ; E_FREE(p); } @@ -57,34 +57,34 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it) if (!(CHECK_TYPE(it, EVRY_TYPE_PLUGIN))) { - EINA_LIST_FOREACH(evry_conf->actions, l, act) - { - if (!((!act->it1.type) || - (CHECK_TYPE(it, act->it1.type)) || - (CHECK_SUBTYPE(it, act->it1.type)))) - continue; + EINA_LIST_FOREACH (evry_conf->actions, l, act) + { + if (!((!act->it1.type) || + (CHECK_TYPE(it, act->it1.type)) || + (CHECK_SUBTYPE(it, act->it1.type)))) + continue; - if (act->check_item && !(act->check_item(act, it))) - continue; + if (act->check_item && !(act->check_item(act, it))) + continue; - act->base.plugin = EVRY_PLUGIN(p); - act->it1.item = it; - EVRY_ITEM(act)->hi = NULL; + act->base.plugin = EVRY_PLUGIN(p); + act->it1.item = it; + EVRY_ITEM(act)->hi = NULL; - p->actions = eina_list_append(p->actions, act); - } + p->actions = eina_list_append(p->actions, act); + } } if (it->plugin) { - EINA_LIST_FOREACH(it->plugin->actions, l, act) - { - act->base.plugin = EVRY_PLUGIN(p); + EINA_LIST_FOREACH (it->plugin->actions, l, act) + { + act->base.plugin = EVRY_PLUGIN(p); - act->it1.item = EVRY_ITEM(it->plugin); - EVRY_ITEM(act)->hi = NULL; - p->actions = eina_list_append(p->actions, act); - } + act->it1.item = EVRY_ITEM(it->plugin); + EVRY_ITEM(act)->hi = NULL; + p->actions = eina_list_append(p->actions, act); + } } 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) - return -1; - if (!act1->remember_context && act2->remember_context) - return 1; + if (act1->remember_context && !act2->remember_context) + return -1; + if (!act1->remember_context && act2->remember_context) + return 1; } /* sort type match before subtype match */ if (act1->it1.item && act2->it1.item) { - if ((act1->it1.type == act1->it1.item->type) && - (act2->it1.type != act2->it1.item->type)) - return -1; + if ((act1->it1.type == act1->it1.item->type) && + (act2->it1.type != act2->it1.item->type)) + return -1; - if ((act1->it1.type != act1->it1.item->type) && - (act2->it1.type == act2->it1.item->type)) - return 1; + if ((act1->it1.type != act1->it1.item->type) && + (act2->it1.type == act2->it1.item->type)) + return 1; } 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) - return 1; - - if (it1->fuzzy_match - it2->fuzzy_match) - 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) - return (it1->priority - it2->priority); + return it1->priority - it2->priority; return 0; } @@ -148,15 +147,15 @@ _fetch(Evry_Plugin *plugin, const char *input) 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) - { - it->fuzzy_match = match; - EVRY_PLUGIN_ITEM_APPEND(p, it); - } + if (!input || match) + { + it->fuzzy_match = match; + EVRY_PLUGIN_ITEM_APPEND(p, it); + } } if (!plugin->items) return 0; @@ -172,7 +171,7 @@ int evry_plug_actions_init() { _plug = EVRY_PLUGIN_BASE("Actions", NULL, EVRY_TYPE_ACTION, - _begin, _finish, _fetch); + _begin, _finish, _fetch); _plug->browse = &_browse; @@ -189,11 +188,10 @@ evry_plug_actions_shutdown() evry_plugin_free(_plug); /* 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); } - void evry_action_register(Evry_Action *act, int priority) { @@ -222,13 +220,13 @@ _action_free_cb(Evry_Item *it) Evry_Action * evry_action_new(const char *name, const char *label, - Evry_Type type_in1, Evry_Type type_in2, - const char *icon, - int (*action) (Evry_Action *act), - int (*check_item) (Evry_Action *act, const Evry_Item *it)) + Evry_Type type_in1, Evry_Type type_in2, + const char *icon, + int (*action)(Evry_Action *act), + int (*check_item)(Evry_Action *act, const Evry_Item *it)) { Evry_Action *act = EVRY_ITEM_NEW(Evry_Action, _plug, label, - NULL, _action_free_cb); + NULL, _action_free_cb); if (icon) act->base.icon = eina_stringshare_add(icon); @@ -251,7 +249,6 @@ evry_action_free(Evry_Action *act) evry_item_free(EVRY_ITEM(act)); } - /* TODO assign actions to plugins othersie there will be too liitle names soon */ Evry_Action * @@ -262,7 +259,7 @@ evry_action_find(const char *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) break; @@ -270,3 +267,4 @@ evry_action_find(const char *name) return act; } + diff --git a/src/modules/everything/evry_plug_aggregator.c b/src/modules/everything/evry_plug_aggregator.c index 409539198..12f997063 100644 --- a/src/modules/everything/evry_plug_aggregator.c +++ b/src/modules/everything/evry_plug_aggregator.c @@ -2,26 +2,26 @@ //TODO min input for items not in history -#define MAX_ITEMS 50 +#define MAX_ITEMS 50 #define MAX_PLUGIN 15 typedef struct _Plugin Plugin; struct _Plugin { - Evry_Plugin base; + Evry_Plugin base; - Evry_Item *warning; + Evry_Item *warning; }; static int _fetch(Evry_Plugin *plugin, const char *input) { - Plugin *p = (Plugin *) plugin; + Plugin *p = (Plugin *)plugin; Evry_Plugin *pp; Eina_List *l, *ll, *lp = NULL; 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; Eina_List *items = NULL; const char *context = NULL; @@ -29,7 +29,7 @@ _fetch(Evry_Plugin *plugin, const char *input) Evry_State *s = plugin->state; Evry_Selector *sel = s->selector; Evry_Selector **sels = sel->win->selectors; - + if (input && input[0]) inp_len = strlen(input); else @@ -41,140 +41,140 @@ _fetch(Evry_Plugin *plugin, const char *input) /* get current items' context, which is * the previous selectors selected item */ if (sel == sels[0]) - { - subj_sel = 1; + { + subj_sel = 1; } else if (sel == sels[1]) { - it = sels[0]->state->cur_item; - if (it) context = it->context; + it = sels[0]->state->cur_item; + if (it) context = it->context; } else if (sel == sels[2]) { - it = sels[1]->state->cur_item; - if (it) context = it->context; + it = sels[1]->state->cur_item; + if (it) context = it->context; } EVRY_PLUGIN_ITEMS_FREE(p); - + /* 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 */ - if (!pp->config->aggregate) - continue; - /* do not recurse */ - if (pp == plugin) - continue; - /* dont show plugin in top-level */ - if (top_level && !pp->config->top_level) - continue; - lp = eina_list_append(lp, pp); + /* dont show in aggregator */ + if (!pp->config->aggregate) + continue; + /* do not recurse */ + if (pp == plugin) + continue; + /* dont show plugin in top-level */ + if (top_level && !pp->config->top_level) + continue; + lp = eina_list_append(lp, pp); } /* show non-top-level plugins as item */ if ((top_level) && (!s->trigger_active)) { - EINA_LIST_FOREACH(s->plugins, l, pp) - { - int min_fuzz = 0; - double max_usage = 0.0; + EINA_LIST_FOREACH (s->plugins, l, pp) + { + int min_fuzz = 0; + double max_usage = 0.0; - if (pp->config->top_level) - continue; + if (pp->config->top_level) + continue; - if (pp == plugin) - continue; + if (pp == plugin) + continue; - if (!pp->items) - continue; + if (!pp->items) + continue; - /* give plugin item the highest priority of its items */ - EINA_LIST_FOREACH(pp->items, ll, it) - { - if (it->usage >= 0) - evry_history_item_usage_set(it, input, context); + /* give plugin item the highest priority of its items */ + EINA_LIST_FOREACH (pp->items, ll, it) + { + if (it->usage >= 0) + evry_history_item_usage_set(it, input, context); - if (it->usage && (it->usage > max_usage)) - max_usage = it->usage; + if (it->usage && (it->usage > max_usage)) + max_usage = it->usage; - if (it->fuzzy_match == 0) - it->fuzzy_match = evry_fuzzy_match(it->label, input); + if (it->fuzzy_match == 0) + it->fuzzy_match = evry_fuzzy_match(it->label, input); - if ((!min_fuzz) || ((it->fuzzy_match > 0) && - (it->fuzzy_match < min_fuzz))) - min_fuzz = it->fuzzy_match; - } + if ((!min_fuzz) || ((it->fuzzy_match > 0) && + (it->fuzzy_match < min_fuzz))) + min_fuzz = it->fuzzy_match; + } - GET_ITEM(it, pp); + GET_ITEM(it, pp); - it->hi = NULL; - /* TODO get better usage estimate */ - evry_history_item_usage_set(it, NULL, NULL); - it->usage /= 100.0; + it->hi = NULL; + /* TODO get better usage estimate */ + evry_history_item_usage_set(it, NULL, NULL); + it->usage /= 100.0; - if ((it->usage && max_usage) && (it->usage < max_usage)) - it->usage = max_usage; - it->fuzzy_match = min_fuzz; + if ((it->usage && max_usage) && (it->usage < max_usage)) + it->usage = max_usage; + it->fuzzy_match = min_fuzz; - IF_RELEASE(it->detail); - snprintf(buf, sizeof(buf), "%d %s", eina_list_count(pp->items), _("Items")); - it->detail = eina_stringshare_add(buf); + IF_RELEASE(it->detail); + snprintf(buf, sizeof(buf), "%d %s", eina_list_count(pp->items), _("Items")); + it->detail = eina_stringshare_add(buf); - items = eina_list_append(items, it); - } + items = eina_list_append(items, it); + } - /* only one plugin: show items */ - if ((eina_list_count(s->cur_plugins)) == 1 && items && - (pp = eina_list_data_get(items)) && (pp->config->aggregate)) - { - eina_list_free(items); - items = NULL; - EINA_LIST_FOREACH(pp->items, l, it) - { - if (it->usage >= 0) - evry_history_item_usage_set(it, input, context); - if (it->fuzzy_match == 0) - it->fuzzy_match = evry_fuzzy_match(it->label, input); - - items = eina_list_append(items, it); - } - } + /* only one plugin: show items */ + if ((eina_list_count(s->cur_plugins)) == 1 && items && + (pp = eina_list_data_get(items)) && (pp->config->aggregate)) + { + eina_list_free(items); + items = NULL; + EINA_LIST_FOREACH (pp->items, l, it) + { + if (it->usage >= 0) + evry_history_item_usage_set(it, input, context); + if (it->fuzzy_match == 0) + it->fuzzy_match = evry_fuzzy_match(it->label, input); + + items = eina_list_append(items, it); + } + } #if 0 - /* append all plugins as items (which were not added above) */ - if (inp_len >= plugin->config->min_query) - { - EINA_LIST_FOREACH(s->plugins, l, pp) - { - if (!strcmp(pp->name, "Actions")) - continue; + /* append all plugins as items (which were not added above) */ + if (inp_len >= plugin->config->min_query) + { + EINA_LIST_FOREACH (s->plugins, l, pp) + { + if (!strcmp(pp->name, "Actions")) + continue; - /* items MUST only conatin plugins here ! */ - EINA_LIST_FOREACH(items, ll, pp2) - if (pp2->name == pp->name) break; - if (pp2) - continue; + /* items MUST only conatin plugins here ! */ + EINA_LIST_FOREACH (items, ll, pp2) + if (pp2->name == pp->name) break; + if (pp2) + continue; - GET_ITEM(it, pp); + GET_ITEM(it, pp); - if ((!input) || - (it->fuzzy_match = evry_fuzzy_match(it->label, input))) - { - evry_history_item_usage_set(it, input, NULL); - it->usage /= 100.0; + if ((!input) || + (it->fuzzy_match = evry_fuzzy_match(it->label, input))) + { + evry_history_item_usage_set(it, input, NULL); + it->usage /= 100.0; - EVRY_ITEM(pp)->plugin->state = s; - items = eina_list_append(items, pp); - } - } - } + EVRY_ITEM(pp)->plugin->state = s; + items = eina_list_append(items, pp); + } + } + } #endif - if (!lp && (eina_list_count(items) < 2)) - { - if (items) eina_list_free(items); - return 0; - } + if (!lp && (eina_list_count(items) < 2)) + { + if (items) eina_list_free(items); + return 0; + } } if (!lp && !items) @@ -183,98 +183,96 @@ _fetch(Evry_Plugin *plugin, const char *input) /* if there is input append all items that match */ if (input) { - EINA_LIST_FOREACH(lp, l, pp) - { - EINA_LIST_FOREACH(pp->items, ll, it) - { - if (it->fuzzy_match == 0) - it->fuzzy_match = evry_fuzzy_match(it->label, input); + EINA_LIST_FOREACH (lp, l, pp) + { + EINA_LIST_FOREACH (pp->items, ll, it) + { + if (it->fuzzy_match == 0) + it->fuzzy_match = evry_fuzzy_match(it->label, input); - if (it->usage >= 0) - evry_history_item_usage_set(it, input, context); + if (it->usage >= 0) + evry_history_item_usage_set(it, input, context); - if ((subj_sel) && (top_level) && - (!it->usage) && (inp_len < plugin->config->min_query)) - continue; + if ((subj_sel) && (top_level) && + (!it->usage) && (inp_len < plugin->config->min_query)) + continue; - items = eina_list_append(items, it); - } - } + items = eina_list_append(items, it); + } + } } /* no input: append all items that are in history */ else { - EINA_LIST_FOREACH(lp, l, pp) - { - int cnt = 1; - EINA_LIST_FOREACH(pp->items, ll, it) - { - if ((!subj_sel) || (it->usage < 0) || - (evry_history_item_usage_set(it, input, context))) - { - it->fuzzy_match = 0; - items = eina_list_append(items, it); - if (++cnt > MAX_PLUGIN) break; - } - } - } + EINA_LIST_FOREACH (lp, l, pp) + { + int cnt = 1; + EINA_LIST_FOREACH (pp->items, ll, it) + { + if ((!subj_sel) || (it->usage < 0) || + (evry_history_item_usage_set(it, input, context))) + { + it->fuzzy_match = 0; + items = eina_list_append(items, it); + 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(pp->items, ll, it) - { - if (eina_list_data_find_list(items, it)) - continue; + EINA_LIST_FOREACH (lp, l, pp) + { + EINA_LIST_FOREACH (pp->items, ll, it) + { + if (eina_list_data_find_list(items, it)) + continue; - items = eina_list_append(items, it); - } - } + items = eina_list_append(items, it); + } + } } 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. - files / places and tracker can find the same files */ - if (it->id) - { - EINA_LIST_FOREACH(p->base.items, ll, it2) - { - if ((it->plugin->name != it2->plugin->name) && - (it->type == it2->type) && - (it->id == it2->id)) - break; - } - } + /* remove duplicates provided by different plugins. e.g. + files / places and tracker can find the same files */ + if (it->id) + { + EINA_LIST_FOREACH (p->base.items, ll, it2) + { + if ((it->plugin->name != it2->plugin->name) && + (it->type == it2->type) && + (it->id == it2->id)) + break; + } + } - if (!it->id || !it2) - { - evry_item_ref(it); - EVRY_PLUGIN_ITEM_APPEND(p, it); - } - - if (cnt++ > MAX_ITEMS) - break; + if (!it->id || !it2) + { + evry_item_ref(it); + EVRY_PLUGIN_ITEM_APPEND(p, it); + } + if (cnt++ > MAX_ITEMS) + break; } if (lp) eina_list_free(lp); if (items) { - eina_list_free(items); + eina_list_free(items); return EVRY_PLUGIN_HAS_ITEMS(p); } - /* 'text' and 'actions' are always loaded */ else if ((subj_sel) && (eina_list_count(s->plugins) == 2)) { - evry_item_ref(p->warning); - EVRY_PLUGIN_ITEM_APPEND(p, p->warning); + evry_item_ref(p->warning); + EVRY_PLUGIN_ITEM_APPEND(p, p->warning); } return 0; @@ -322,7 +320,7 @@ evry_aggregator_new(int type) 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); @@ -332,3 +330,4 @@ evry_aggregator_new(int type) return p; } + diff --git a/src/modules/everything/evry_plug_apps.c b/src/modules/everything/evry_plug_apps.c index 03572ab33..247025383 100644 --- a/src/modules/everything/evry_plug_apps.c +++ b/src/modules/everything/evry_plug_apps.c @@ -1,10 +1,10 @@ #include "e.h" #include "evry_api.h" -#define MOD_CONFIG_FILE_EPOCH 0x0001 +#define MOD_CONFIG_FILE_EPOCH 0x0001 #define MOD_CONFIG_FILE_GENERATION 0x009d -#define MOD_CONFIG_FILE_VERSION \ - ((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION) +#define MOD_CONFIG_FILE_VERSION \ + ((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION) // FIXME clear cache on .desktop chage event @@ -13,80 +13,80 @@ #define MAX_ITEMS 200 -typedef struct _Plugin Plugin; +typedef struct _Plugin Plugin; typedef struct _Module_Config Module_Config; -typedef struct _E_Exe E_Exe; -typedef struct _E_Exe_List E_Exe_List; -typedef struct _Item_Menu Item_Menu; +typedef struct _E_Exe E_Exe; +typedef struct _E_Exe_List E_Exe_List; +typedef struct _Item_Menu Item_Menu; struct _Plugin { - Evry_Plugin base; - Eina_Bool browse; - const char *input; - Eina_List *apps_mime; - Eina_List *apps_all; - Eina_List *apps_hist; - Eina_List *menu_items; + Evry_Plugin base; + Eina_Bool browse; + const char *input; + Eina_List *apps_mime; + Eina_List *apps_all; + Eina_List *apps_hist; + Eina_List *menu_items; - Eina_Hash *added; - Efreet_Menu *menu;; - - Evry_Item_App *command; + Eina_Hash *added; + Efreet_Menu *menu; + + Evry_Item_App *command; }; struct _E_Exe { - const char *path; + const char *path; }; struct _E_Exe_List { - Eina_List *list; + Eina_List *list; }; struct _Module_Config { - int version; - const char *cmd_terminal; - const char *cmd_sudo; + int version; + const char *cmd_terminal; + const char *cmd_sudo; - E_Config_Dialog *cfd; - E_Module *module; + E_Config_Dialog *cfd; + E_Module *module; }; struct _Item_Menu { - Evry_Item base; + Evry_Item base; - Efreet_Menu *menu;; + Efreet_Menu *menu; }; -static const Evry_API *evry = NULL; -static Evry_Module *evry_module = NULL; -static Eina_List *handlers = NULL; +static const Evry_API *evry = NULL; +static Evry_Module *evry_module = NULL; +static Eina_List *handlers = NULL; -static Module_Config *_conf; +static Module_Config *_conf; static char _module_icon[] = "system-run"; -static Eina_List *_plugins = NULL; -static Eina_List *_actions = NULL; -static Evry_Item *_act_open_with = NULL; -static Eina_List *exe_path = NULL; -static Ecore_Idler *exe_scan_idler = NULL; -static E_Config_DD *exelist_exe_edd = NULL; -static E_Config_DD *exelist_edd = NULL; -static DIR *exe_dir = NULL; -static Eina_List *exe_list = NULL; -static Eina_List *exe_list2 = NULL; -static Eina_List *apps_cache = NULL; +static Eina_List *_plugins = NULL; +static Eina_List *_actions = NULL; +static Evry_Item *_act_open_with = NULL; +static Eina_List *exe_path = NULL; +static Ecore_Idler *exe_scan_idler = NULL; +static E_Config_DD *exelist_exe_edd = NULL; +static E_Config_DD *exelist_edd = NULL; +static DIR *exe_dir = NULL; +static Eina_List *exe_list = NULL; +static Eina_List *exe_list2 = NULL; +static Eina_List *apps_cache = NULL; static void _scan_executables(); +#define GET_MENU(_m, _it) Item_Menu * _m = (Item_Menu *)_it -#define GET_MENU(_m, _it) Item_Menu *_m = (Item_Menu *)_it - /***************************************************************************/ -static void _hash_free(void *data) +static void +_hash_free(void *data) { GET_APP(app, data); EVRY_ITEM_FREE(app); @@ -142,7 +142,7 @@ _item_menu_add(Plugin *p, Efreet_Menu *menu) EVRY_ITEM(m)->usage = -1; m->menu = menu; - p->menu_items = eina_list_append(p->menu_items, m); + p->menu_items = eina_list_append(p->menu_items, m); return m; } @@ -154,7 +154,7 @@ _cb_sort(const void *data1, const void *data2) const Evry_Item *it2 = data2; if (it1->usage && it2->usage) - return (it1->usage > it2->usage ? -1 : 1); + return it1->usage > it2->usage ? -1 : 1; if (it1->usage && !it2->usage) return -1; if (it2->usage && !it1->usage) @@ -162,14 +162,14 @@ _cb_sort(const void *data1, const void *data2) 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) - return 1; + if (!it1->fuzzy_match && it2->fuzzy_match) + return 1; - if (it1->fuzzy_match - it2->fuzzy_match) - return (it1->fuzzy_match - it2->fuzzy_match); + if (it1->fuzzy_match - it2->fuzzy_match) + return it1->fuzzy_match - it2->fuzzy_match; } return strcasecmp(it1->label, it2->label); @@ -184,14 +184,14 @@ _item_exe_add(Plugin *p, const char *exe, int match) if ((app = eina_hash_find(p->added, exe))) { - if (eina_list_data_find_list(p->base.items, app)) - return app; + if (eina_list_data_find_list(p->base.items, app)) + return app; } if (!app) { - app = _item_new(p, ecore_file_file_get(exe), exe); - app->file = eina_stringshare_ref(EVRY_ITEM(app)->id); + app = _item_new(p, ecore_file_file_get(exe), exe); + app->file = eina_stringshare_ref(EVRY_ITEM(app)->id); } EVRY_ITEM(app)->fuzzy_match = match; @@ -211,29 +211,29 @@ _hist_exe_get_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data, int match; const char *exe = key; - EINA_LIST_FOREACH(he->items, l, hi) + EINA_LIST_FOREACH (he->items, l, hi) { - app = NULL; + app = NULL; - if (strcmp(hi->plugin, EVRY_PLUGIN(p)->name)) - continue; + if (strcmp(hi->plugin, EVRY_PLUGIN(p)->name)) + continue; - if (!p->input) - { - app = _item_exe_add(p, exe, 0); - } - else if ((match = evry->fuzzy_match(exe, p->input))) - { - app = _item_exe_add(p, exe, match); - } + if (!p->input) + { + app = _item_exe_add(p, exe, 0); + } + else if ((match = evry->fuzzy_match(exe, p->input))) + { + app = _item_exe_add(p, exe, match); + } - if (app) - { - EVRY_ITEM(app)->hi = hi; - evry->history_item_usage_set(EVRY_ITEM(app), p->input, NULL); - } + if (app) + { + EVRY_ITEM(app)->hi = hi; + evry->history_item_usage_set(EVRY_ITEM(app), p->input, NULL); + } - break; + break; } return EINA_TRUE; @@ -260,55 +260,55 @@ _fetch_exe(Evry_Plugin *plugin, const char *input) if (input) { - if ((tmp = strchr(input, ' '))) - end = tmp - input; + if ((tmp = strchr(input, ' '))) + end = tmp - input; - if ((!exe_list) && (!exe_scan_idler)) - _scan_executables(); + if ((!exe_list) && (!exe_scan_idler)) + _scan_executables(); - EINA_LIST_FOREACH(exe_list, l, tmp) - { - tmp_len = strlen(tmp); + EINA_LIST_FOREACH (exe_list, l, tmp) + { + tmp_len = strlen(tmp); - if ((end < len) && (tmp_len > end)) - continue; + if ((end < len) && (tmp_len > end)) + continue; - if (!strncmp(input, tmp, end)) - { - if (query && (cnt++ < 50) && (len != tmp_len)) - _item_exe_add(p, tmp, 15); + if (!strncmp(input, tmp, end)) + { + if (query && (cnt++ < 50) && (len != tmp_len)) + _item_exe_add(p, tmp, 15); - if ((!min) || (tmp_len < min)) - { - min = tmp_len; - file = tmp; - } - if ((!query) && (tmp_len == len)) - break; - } - } + if ((!min) || (tmp_len < min)) + { + min = tmp_len; + file = tmp; + } + if ((!query) && (tmp_len == len)) + break; + } + } - if (file) - { - GET_ITEM(it, p->command); + if (file) + { + GET_ITEM(it, p->command); - if (strlen(file) < len) - file = input; + if (strlen(file) < len) + file = input; - EVRY_ITEM_LABEL_SET(it, file); - IF_RELEASE(p->command->file); - p->command->file = eina_stringshare_ref(it->label); - it->fuzzy_match = 11; // prefix match - EVRY_PLUGIN_ITEM_APPEND(p, it); - evry->item_changed(it, 0, 0); - } + EVRY_ITEM_LABEL_SET(it, file); + IF_RELEASE(p->command->file); + p->command->file = eina_stringshare_ref(it->label); + it->fuzzy_match = 11; // prefix match + EVRY_PLUGIN_ITEM_APPEND(p, it); + evry->item_changed(it, 0, 0); + } } - EINA_LIST_FOREACH(plugin->items, l, it) + EINA_LIST_FOREACH (plugin->items, l, it) { - evry->history_item_usage_set(it, input, NULL); - if (input && (it->usage > max) && !strncmp(input, it->label, len)) - max = it->usage; + evry->history_item_usage_set(it, input, NULL); + if (input && (it->usage > max) && !strncmp(input, it->label, len)) + max = it->usage; } EVRY_ITEM(p->command)->usage = (max * 2.0); @@ -353,20 +353,20 @@ _finish_exe(Evry_Plugin *plugin) if (exe_dir) { - closedir(exe_dir); - exe_dir = NULL; + closedir(exe_dir); + exe_dir = NULL; } - EINA_LIST_FREE(exe_path, str) + EINA_LIST_FREE (exe_path, str) free(str); if (exe_scan_idler) { - ecore_idler_del(exe_scan_idler); - exe_scan_idler = NULL; + ecore_idler_del(exe_scan_idler); + exe_scan_idler = NULL; } - EINA_LIST_FREE(exe_list, str) + EINA_LIST_FREE (exe_list, str) free(str); - EINA_LIST_FREE(exe_list2, str) + EINA_LIST_FREE (exe_list2, str) free(str); E_FREE(p); @@ -381,24 +381,24 @@ _item_desktop_add(Plugin *p, Efreet_Desktop *desktop, int match) if ((app = eina_hash_find(p->added, desktop->exec))) { - if (eina_list_data_find_list(p->base.items, app)) - return; + if (eina_list_data_find_list(p->base.items, app)) + return; } if (!app) { - app = _item_new(p, desktop->name, desktop->exec); - efreet_desktop_ref(desktop); - app->desktop = desktop; + app = _item_new(p, desktop->name, desktop->exec); + efreet_desktop_ref(desktop); + app->desktop = desktop; - if (desktop->comment) - { - EVRY_ITEM_DETAIL_SET(app, desktop->comment); - } - else if (desktop->generic_name) - { - EVRY_ITEM_DETAIL_SET(app, desktop->generic_name); - } + if (desktop->comment) + { + EVRY_ITEM_DETAIL_SET(app, desktop->comment); + } + else if (desktop->generic_name) + { + EVRY_ITEM_DETAIL_SET(app, desktop->generic_name); + } } EVRY_ITEM(app)->fuzzy_match = match; @@ -414,34 +414,34 @@ _desktop_list_add(Plugin *p, Eina_List *apps, const char *input) const char *exec, *end; char buf[PATH_MAX]; - EINA_LIST_FOREACH(apps, l, desktop) + EINA_LIST_FOREACH (apps, l, desktop) { - if (eina_list_count(p->base.items) >= MAX_ITEMS) break; + if (eina_list_count(p->base.items) >= MAX_ITEMS) break; - m1 = m2 = 0; + m1 = m2 = 0; - if (input) - { - /* strip path and parameter */ - exec = ecore_file_file_get(desktop->exec); - if ((exec) && (end = strchr(exec, '%')) && - ((end - exec) - 1 > 0)) - { - strncpy(buf, exec, (end - exec) - 1); - buf[(end - exec) - 1] = '\0'; - m1 = evry->fuzzy_match(buf, input); - } - else - { - m1 = evry->fuzzy_match(exec, input); - } + if (input) + { + /* strip path and parameter */ + exec = ecore_file_file_get(desktop->exec); + if ((exec) && (end = strchr(exec, '%')) && + ((end - exec) - 1 > 0)) + { + strncpy(buf, exec, (end - exec) - 1); + buf[(end - exec) - 1] = '\0'; + m1 = evry->fuzzy_match(buf, input); + } + else + { + m1 = evry->fuzzy_match(exec, input); + } - m2 = evry->fuzzy_match(desktop->name, input); + m2 = evry->fuzzy_match(desktop->name, input); - if (!m1 || (m2 && m2 < m1)) m1 = m2; - } + if (!m1 || (m2 && m2 < m1)) m1 = m2; + } - if (!input || m1) _item_desktop_add(p, desktop, m1); + if (!input || m1) _item_desktop_add(p, desktop, m1); } } @@ -457,16 +457,16 @@ _desktop_list_get(void) /* remove screensaver */ cat_ss = efreet_util_desktop_category_list("Screensaver"); - EINA_LIST_FOREACH(cat_ss, l, d) + EINA_LIST_FOREACH (cat_ss, l, d) { - if ((ll = eina_list_data_find_list(apps, d))) - { - efreet_desktop_free(d); - apps = eina_list_remove_list(apps, ll); - } - printf("%d %s\n", d->ref, d->name); + if ((ll = eina_list_data_find_list(apps, d))) + { + efreet_desktop_free(d); + apps = eina_list_remove_list(apps, ll); + } + printf("%d %s\n", d->ref, d->name); - efreet_desktop_free(d); + efreet_desktop_free(d); } return apps; @@ -482,48 +482,48 @@ _hist_items_get_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data Eina_List *l, *ll; const char *exec = key; - EINA_LIST_FOREACH(he->items, l, hi) + EINA_LIST_FOREACH (he->items, l, hi) { - d = NULL; + d = NULL; - if (hi->transient) - continue; + if (hi->transient) + continue; - if (strcmp(hi->plugin, EVRY_PLUGIN(p)->name)) - continue; + if (strcmp(hi->plugin, EVRY_PLUGIN(p)->name)) + continue; - EINA_LIST_FOREACH(apps_cache, ll, d) - if (d->exec && !strcmp(d->exec, exec)) break; + EINA_LIST_FOREACH (apps_cache, ll, d) + if (d->exec && !strcmp(d->exec, exec)) break; - if (!d) - { - if (!p->apps_all) - p->apps_all = _desktop_list_get(); + if (!d) + { + if (!p->apps_all) + p->apps_all = _desktop_list_get(); - EINA_LIST_FOREACH(p->apps_all, ll, d) - if (d->exec && !strcmp(d->exec, exec)) break; + EINA_LIST_FOREACH (p->apps_all, ll, d) + if (d->exec && !strcmp(d->exec, exec)) break; - if (d) - { - efreet_desktop_ref(d); - apps_cache = eina_list_append(apps_cache, d); - } - else - { - /* remove from history */ - /* DBG("no desktop: %s", exec); - * hi->transient = 1; */ - } - } + if (d) + { + efreet_desktop_ref(d); + apps_cache = eina_list_append(apps_cache, d); + } + else + { + /* remove from history */ + /* DBG("no desktop: %s", exec); + * hi->transient = 1; */ + } + } - if (!d) - { - DBG("app not found %s", exec); - break; - } + if (!d) + { + DBG("app not found %s", exec); + break; + } - p->apps_hist = eina_list_append(p->apps_hist, d); - break; + p->apps_hist = eina_list_append(p->apps_hist, d); + break; } return EINA_TRUE; @@ -533,14 +533,14 @@ static Evry_Plugin * _begin(Evry_Plugin *plugin, const Evry_Item *item) { Plugin *p; - + if (item && (item != _act_open_with)) return NULL; EVRY_PLUGIN_INSTANCE(p, plugin); p->added = eina_hash_string_small_new(_hash_free); p->menu = efreet_menu_get(); - + return EVRY_PLUGIN(p); } @@ -548,20 +548,20 @@ static Evry_Plugin * _browse(Evry_Plugin *plugin, const Evry_Item *item) { Plugin *p; - + if (!item) return NULL; if (!CHECK_TYPE(item, EVRY_TYPE_NONE)) return NULL; - + EVRY_PLUGIN_INSTANCE(p, plugin); GET_MENU(m, item); - + p->added = eina_hash_string_small_new(_hash_free); p->menu = m->menu; p->browse = EINA_TRUE; - + return EVRY_PLUGIN(p); } @@ -570,9 +570,9 @@ _finish(Evry_Plugin *plugin) { Efreet_Desktop *desktop; Evry_Item *it; - + GET_PLUGIN(p, plugin); - + EVRY_PLUGIN_ITEMS_CLEAR(p); /* TODO share with browse instances */ @@ -581,16 +581,16 @@ _finish(Evry_Plugin *plugin) if ((!p->browse) && (p->menu)) efreet_menu_free(p->menu); - - EINA_LIST_FREE(p->apps_all, desktop) + + EINA_LIST_FREE (p->apps_all, desktop) efreet_desktop_free(desktop); - EINA_LIST_FREE(p->apps_hist, desktop); + EINA_LIST_FREE (p->apps_hist, desktop) ; - EINA_LIST_FREE(p->apps_mime, desktop) + EINA_LIST_FREE (p->apps_mime, desktop) efreet_desktop_free(desktop); - EINA_LIST_FREE(p->menu_items, it) + EINA_LIST_FREE (p->menu_items, it) EVRY_ITEM_FREE(it); E_FREE(p); @@ -611,67 +611,66 @@ _fetch(Evry_Plugin *plugin, const char *input) if (!p->browse) { - if (input) - { - if (!p->apps_all) - p->apps_all = _desktop_list_get(); + if (input) + { + if (!p->apps_all) + p->apps_all = _desktop_list_get(); - _desktop_list_add(p, p->apps_all, input); - } - else - { - _desktop_list_add(p, p->apps_mime, input); - } + _desktop_list_add(p, p->apps_all, input); + } + else + { + _desktop_list_add(p, p->apps_mime, input); + } - if ((!input) && (!plugin->items)) - { - if (!p->apps_hist) - { - ht = evry->history_types_get(EVRY_TYPE_APP); - if (ht) eina_hash_foreach(ht->types, _hist_items_get_cb, p); - } + if ((!input) && (!plugin->items)) + { + if (!p->apps_hist) + { + ht = evry->history_types_get(EVRY_TYPE_APP); + if (ht) eina_hash_foreach(ht->types, _hist_items_get_cb, p); + } - _desktop_list_add(p, p->apps_hist, NULL); - } + _desktop_list_add(p, p->apps_hist, NULL); + } - EINA_LIST_FOREACH(plugin->items, l, it) - evry->history_item_usage_set(it, input, NULL); + EINA_LIST_FOREACH (plugin->items, l, it) + evry->history_item_usage_set(it, input, NULL); - EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort); + EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort); } - + if ((p->menu) && (!p->menu_items)) { - EINA_LIST_FOREACH(p->menu->entries, l, entry) - { - if (entry->type == EFREET_MENU_ENTRY_DESKTOP) - { - _item_desktop_add(p, entry->desktop, i++); - } - else if (entry->type == EFREET_MENU_ENTRY_MENU) - { - _item_menu_add(p, entry); - } - /* else if (entry->type == EFREET_MENU_ENTRY_SEPARATOR) - * continue; - * else if (entry->type == EFREET_MENU_ENTRY_HEADER) - * continue; */ - } + EINA_LIST_FOREACH (p->menu->entries, l, entry) + { + if (entry->type == EFREET_MENU_ENTRY_DESKTOP) + { + _item_desktop_add(p, entry->desktop, i++); + } + else if (entry->type == EFREET_MENU_ENTRY_MENU) + { + _item_menu_add(p, entry); + } + /* else if (entry->type == EFREET_MENU_ENTRY_SEPARATOR) + * continue; + * else if (entry->type == EFREET_MENU_ENTRY_HEADER) + * continue; */ + } } - - EINA_LIST_FOREACH(p->menu_items, l, it) + EINA_LIST_FOREACH (p->menu_items, l, it) { - if (!input) - { - EVRY_PLUGIN_ITEM_APPEND(p, it); - continue; - } + if (!input) + { + EVRY_PLUGIN_ITEM_APPEND(p, it); + continue; + } - if ((it->fuzzy_match = evry->fuzzy_match(it->label, input))) - EVRY_PLUGIN_ITEM_APPEND(p, it); + if ((it->fuzzy_match = evry->fuzzy_match(it->label, input))) + EVRY_PLUGIN_ITEM_APPEND(p, it); } - + return EVRY_PLUGIN_HAS_ITEMS(p); } @@ -688,28 +687,28 @@ _begin_mime(Evry_Plugin *plugin, const Evry_Item *item) if (CHECK_TYPE(item, EVRY_TYPE_ACTION)) { - GET_ACTION(act, item); - GET_FILE(file, act->it1.item); + GET_ACTION(act, item); + GET_FILE(file, act->it1.item); - if (!evry->file_path_get(file)) - return NULL; + if (!evry->file_path_get(file)) + return NULL; - path = file->path; - mime = file->mime; + path = file->path; + mime = file->mime; } else if (CHECK_TYPE(item, EVRY_TYPE_FILE)) { - GET_FILE(file, item); + GET_FILE(file, item); - if (!evry->file_path_get(file)) - return NULL; + if (!evry->file_path_get(file)) + return NULL; - path = file->path; - mime = file->mime; + path = file->path; + mime = file->mime; } else { - return NULL; + return NULL; } if (!path || !mime || !(mime = efreet_mime_type_get(path))) @@ -721,41 +720,41 @@ _begin_mime(Evry_Plugin *plugin, const Evry_Item *item) if (strcmp(mime, "text/plain") && (!strncmp(mime, "text/", 5))) { - l = efreet_util_desktop_mime_list("text/plain"); + l = efreet_util_desktop_mime_list("text/plain"); - EINA_LIST_FREE(l, d) - { - if (!eina_list_data_find_list(p->apps_mime, d)) - p->apps_mime = eina_list_append(p->apps_mime, d); - else - efreet_desktop_free(d); - } + EINA_LIST_FREE (l, d) + { + if (!eina_list_data_find_list(p->apps_mime, d)) + p->apps_mime = eina_list_append(p->apps_mime, d); + else + efreet_desktop_free(d); + } } if (item->browseable && strcmp(mime, "x-directory/normal")) { - l = efreet_util_desktop_mime_list("x-directory/normal"); + l = efreet_util_desktop_mime_list("x-directory/normal"); - EINA_LIST_FREE(l, d) - { - if (!eina_list_data_find_list(p->apps_mime, d)) - p->apps_mime = eina_list_append(p->apps_mime, d); - else - efreet_desktop_free(d); - } + EINA_LIST_FREE (l, d) + { + if (!eina_list_data_find_list(p->apps_mime, d)) + p->apps_mime = eina_list_append(p->apps_mime, d); + else + efreet_desktop_free(d); + } } if ((d = e_exehist_mime_desktop_get(mime))) { - if ((l = eina_list_data_find_list(p->apps_mime, d))) - { - p->apps_mime = eina_list_promote_list(p->apps_mime, l); - efreet_desktop_free(d); - } - else - { - p->apps_mime = eina_list_prepend(p->apps_mime, d); - } + if ((l = eina_list_data_find_list(p->apps_mime, d))) + { + p->apps_mime = eina_list_promote_list(p->apps_mime, l); + efreet_desktop_free(d); + } + else + { + p->apps_mime = eina_list_prepend(p->apps_mime, d); + } } p->added = eina_hash_string_small_new(_hash_free); @@ -774,7 +773,7 @@ _finish_mime(Evry_Plugin *plugin) if (p->added) eina_hash_free(p->added); - EINA_LIST_FREE(p->apps_mime, desktop) + EINA_LIST_FREE (p->apps_mime, desktop) efreet_desktop_free(desktop); E_FREE(p); @@ -792,7 +791,7 @@ _fetch_mime(Evry_Plugin *plugin, const char *input) /* add apps for a given mimetype */ _desktop_list_add(p, p->apps_mime, input); - EINA_LIST_FOREACH(plugin->items, l, it) + EINA_LIST_FOREACH (plugin->items, l, it) evry->history_item_usage_set(it, input, NULL); if (input) @@ -801,7 +800,6 @@ _fetch_mime(Evry_Plugin *plugin, const char *input) return 1; } - static int _complete(Evry_Plugin *plugin __UNUSED__, const Evry_Item *it, char **input) { @@ -811,11 +809,11 @@ _complete(Evry_Plugin *plugin __UNUSED__, const Evry_Item *it, char **input) if (app->desktop) { - char *space = strchr(app->desktop->exec, ' '); + char *space = strchr(app->desktop->exec, ' '); - snprintf(buf, sizeof(buf), "%s", app->desktop->exec); - if (space) - buf[1 + space - app->desktop->exec] = '\0'; + snprintf(buf, sizeof(buf), "%s", app->desktop->exec); + if (space) + buf[1 + space - app->desktop->exec] = '\0'; } else snprintf(buf, sizeof(buf), "%s", app->file); @@ -856,8 +854,8 @@ _exec_term_action(Evry_Action *act) tmp = E_NEW(Evry_Item_App, 1); snprintf(buf, sizeof(buf), "%s -hold -e %s", - _conf->cmd_terminal, - (escaped ? escaped : app->file)); + _conf->cmd_terminal, + (escaped ? escaped : app->file)); tmp->file = buf; ret = evry->util_exec_app(EVRY_ITEM(tmp), NULL); @@ -889,8 +887,8 @@ _exec_sudo_action(Evry_Action *act) tmp = E_NEW(Evry_Item_App, 1); snprintf(buf, sizeof(buf), "%s %s", - _conf->cmd_sudo, - (app->desktop ? app->desktop->exec : app->file)); + _conf->cmd_sudo, + (app->desktop ? app->desktop->exec : app->file)); tmp->file = buf; ret = evry->util_exec_app(EVRY_ITEM(tmp), NULL); @@ -921,12 +919,12 @@ _edit_app_action(Evry_Action *act) desktop = app->desktop; else { - char buf[128]; - snprintf(buf, 128, "%s/.local/share/applications/%s.desktop", - e_user_homedir_get(), app->file); - desktop = efreet_desktop_empty_new(eina_stringshare_add(buf)); - /* XXX check if this is freed by efreet*/ - desktop->exec = strdup(app->file); + char buf[128]; + snprintf(buf, 128, "%s/.local/share/applications/%s.desktop", + e_user_homedir_get(), app->file); + desktop = efreet_desktop_empty_new(eina_stringshare_add(buf)); + /* XXX check if this is freed by efreet*/ + desktop->exec = strdup(app->file); } e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop); @@ -970,14 +968,14 @@ _new_app_action(Evry_Action *act) for (i = 0; i < 10; i++) { - snprintf(buf, 4096, "%s/.local/share/applications/%s-%d.desktop", - e_user_homedir_get(), name, i); - if (ecore_file_exists(buf)) - { - buf[0] = '\0'; - continue; - } - else break; + snprintf(buf, 4096, "%s/.local/share/applications/%s-%d.desktop", + e_user_homedir_get(), name, i); + if (ecore_file_exists(buf)) + { + buf[0] = '\0'; + continue; + } + else break; } free(name); @@ -986,26 +984,26 @@ _new_app_action(Evry_Action *act) if (!app->desktop) { - desktop = efreet_desktop_empty_new(buf); - desktop->exec = (char *)eina_stringshare_add(app->file); + desktop = efreet_desktop_empty_new(buf); + desktop->exec = (char *)eina_stringshare_add(app->file); } else { - desktop = efreet_desktop_empty_new(buf); - if (app->desktop->name) - desktop->name = strdup(app->desktop->name); - if (app->desktop->comment) - desktop->comment = strdup(app->desktop->comment); - if (app->desktop->generic_name) - desktop->generic_name = strdup(app->desktop->generic_name); - if (app->desktop->generic_name) - desktop->generic_name = strdup(app->desktop->generic_name); - if (app->desktop->exec) - desktop->exec = strdup(app->desktop->exec); - if (app->desktop->icon) - desktop->icon = strdup(app->desktop->icon); - if (app->desktop->mime_types) - desktop->mime_types = eina_list_clone(app->desktop->mime_types); + desktop = efreet_desktop_empty_new(buf); + if (app->desktop->name) + desktop->name = strdup(app->desktop->name); + if (app->desktop->comment) + desktop->comment = strdup(app->desktop->comment); + if (app->desktop->generic_name) + desktop->generic_name = strdup(app->desktop->generic_name); + if (app->desktop->generic_name) + desktop->generic_name = strdup(app->desktop->generic_name); + if (app->desktop->exec) + desktop->exec = strdup(app->desktop->exec); + if (app->desktop->icon) + desktop->icon = strdup(app->desktop->icon); + if (app->desktop->mime_types) + desktop->mime_types = eina_list_clone(app->desktop->mime_types); } if (desktop) e_desktop_edit(e_container_current_get(e_manager_current_get()), desktop); @@ -1032,19 +1030,19 @@ _open_term_action(Evry_Action *act) if (dir) { - if (!getcwd(cwd, sizeof(cwd))) - return 0; - if (chdir(dir)) - return 0; + if (!getcwd(cwd, sizeof(cwd))) + return 0; + if (chdir(dir)) + return 0; - tmp = E_NEW(Evry_Item_App, 1); - tmp->file = _conf->cmd_terminal; + tmp = E_NEW(Evry_Item_App, 1); + tmp->file = _conf->cmd_terminal; - ret = evry->util_exec_app(EVRY_ITEM(tmp), NULL); - E_FREE(tmp); - E_FREE(dir); - if (chdir(cwd)) - return 0; + ret = evry->util_exec_app(EVRY_ITEM(tmp), NULL); + E_FREE(tmp); + E_FREE(dir); + if (chdir(cwd)) + return 0; } return ret; @@ -1074,7 +1072,7 @@ _desktop_cache_update(void *data __UNUSED__, int type __UNUSED__, void *event __ { Efreet_Desktop *d; - EINA_LIST_FREE(apps_cache, d) + EINA_LIST_FREE (apps_cache, d) efreet_desktop_unref(d); return EINA_TRUE; @@ -1094,16 +1092,15 @@ _plugins_init(const Evry_API *api) return EINA_FALSE; p = EVRY_PLUGIN_BASE("Applications", _module_icon, EVRY_TYPE_APP, - _begin, _finish, _fetch); + _begin, _finish, _fetch); p->complete = &_complete; p->browse = &_browse; p->config_path = "extensions/everything-apps"; evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 1); _plugins = eina_list_append(_plugins, p); - p = EVRY_PLUGIN_BASE("Exebuf", _module_icon, EVRY_TYPE_APP, - _begin_exe, _finish_exe, _fetch_exe); + _begin_exe, _finish_exe, _fetch_exe); p->complete = &_complete; p->config_path = "extensions/everything-apps"; _plugins = eina_list_append(_plugins, p); @@ -1111,85 +1108,85 @@ _plugins_init(const Evry_API *api) p->config->min_query = 3; p = EVRY_PLUGIN_BASE("Applications", _module_icon, EVRY_TYPE_APP, - _begin_mime, _finish, _fetch); + _begin_mime, _finish, _fetch); p->complete = &_complete; p->config_path = "extensions/everything-apps"; evry->plugin_register(p, EVRY_PLUGIN_OBJECT, 1); _plugins = eina_list_append(_plugins, p); p = EVRY_PLUGIN_BASE("Open With...", _module_icon, EVRY_TYPE_APP, - _begin_mime, _finish_mime, _fetch_mime); + _begin_mime, _finish_mime, _fetch_mime); p->config_path = "extensions/everything-apps"; evry->plugin_register(p, EVRY_PLUGIN_ACTION, 1); _plugins = eina_list_append(_plugins, p); act = EVRY_ACTION_NEW("Launch", - EVRY_TYPE_APP, 0, - "system-run", - _exec_app_action, - _exec_app_check_item); + EVRY_TYPE_APP, 0, + "system-run", + _exec_app_action, + _exec_app_check_item); _actions = eina_list_append(_actions, act); act = EVRY_ACTION_NEW("Open File...", - EVRY_TYPE_APP, EVRY_TYPE_FILE, - "document-open", - _exec_app_action, - _exec_app_check_item); + EVRY_TYPE_APP, EVRY_TYPE_FILE, + "document-open", + _exec_app_action, + _exec_app_check_item); _actions = eina_list_append(_actions, act); act = EVRY_ACTION_NEW("Run in Terminal", - EVRY_TYPE_APP, 0, - "system-run", - _exec_term_action, - _exec_term_check_item); + EVRY_TYPE_APP, 0, + "system-run", + _exec_term_action, + _exec_term_check_item); _actions = eina_list_append(_actions, act); act = EVRY_ACTION_NEW("Edit Application Entry", - EVRY_TYPE_APP, 0, - "everything-launch", - _edit_app_action, - _edit_app_check_item); + EVRY_TYPE_APP, 0, + "everything-launch", + _edit_app_action, + _edit_app_check_item); _actions = eina_list_append(_actions, act); act = EVRY_ACTION_NEW("New Application Entry", - EVRY_TYPE_APP, 0, - "everything-launch", - _new_app_action, - _new_app_check_item); + EVRY_TYPE_APP, 0, + "everything-launch", + _new_app_action, + _new_app_check_item); _actions = eina_list_append(_actions, act); act = EVRY_ACTION_NEW("Run with Sudo", - EVRY_TYPE_APP, 0, - "system-run", - _exec_sudo_action, NULL); + EVRY_TYPE_APP, 0, + "system-run", + _exec_sudo_action, NULL); _actions = eina_list_append(_actions, act); act = EVRY_ACTION_NEW("Open with...", - EVRY_TYPE_FILE, EVRY_TYPE_APP, - "everything-launch", - _exec_file_action, NULL); + EVRY_TYPE_FILE, EVRY_TYPE_APP, + "everything-launch", + _exec_file_action, NULL); _act_open_with = EVRY_ITEM(act); _actions = eina_list_append(_actions, act); act = EVRY_ACTION_NEW("Open Terminal here", - EVRY_TYPE_FILE, 0, - "system-run", - _open_term_action, NULL); + EVRY_TYPE_FILE, 0, + "system-run", + _open_term_action, NULL); _actions = eina_list_append(_actions, act); act = EVRY_ACTION_NEW("Run Executable", - EVRY_TYPE_FILE, 0, - "system-run", - _run_executable, - _check_executable); + EVRY_TYPE_FILE, 0, + "system-run", + _run_executable, + _check_executable); _actions = eina_list_append(_actions, act); - EINA_LIST_FOREACH(_actions, l, act) - evry->action_register(act, prio++); + EINA_LIST_FOREACH (_actions, l, act) + evry->action_register(act, prio++); handlers = eina_list_append - (handlers, ecore_event_handler_add - (EFREET_EVENT_DESKTOP_CACHE_UPDATE, _desktop_cache_update, NULL)); + (handlers, ecore_event_handler_add + (EFREET_EVENT_DESKTOP_CACHE_UPDATE, _desktop_cache_update, NULL)); return EINA_TRUE; } @@ -1202,16 +1199,16 @@ _plugins_shutdown(void) Efreet_Desktop *d; Ecore_Event_Handler *h; - EINA_LIST_FREE(apps_cache, d) + EINA_LIST_FREE (apps_cache, d) efreet_desktop_unref(d); - EINA_LIST_FREE(_plugins, p) + EINA_LIST_FREE (_plugins, p) EVRY_PLUGIN_FREE(p); - EINA_LIST_FREE(_actions, act) + EINA_LIST_FREE (_actions, act) EVRY_ACTION_FREE(act); - EINA_LIST_FREE(handlers, h) + EINA_LIST_FREE (handlers, h) ecore_event_handler_del(h); } @@ -1221,15 +1218,15 @@ static E_Config_DD *conf_edd = NULL; struct _E_Config_Dialog_Data { - char *cmd_terminal; - char *cmd_sudo; + char *cmd_terminal; + char *cmd_sudo; }; -static void *_create_data(E_Config_Dialog *cfd); -static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); -static void _fill_data(E_Config_Dialog_Data *cfdata); +static void *_create_data(E_Config_Dialog *cfd); +static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static void _fill_data(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 E_Config_Dialog * _conf_dialog(E_Container *con, const char *params __UNUSED__) @@ -1248,7 +1245,7 @@ _conf_dialog(E_Container *con, const char *params __UNUSED__) v->basic.apply_cfdata = _basic_apply; cfd = e_config_dialog_new(con, _("Everything Applications"), "everything-apps", - "launcher/everything-apps", _module_icon, 0, v, NULL); + "launcher/everything-apps", _module_icon, 0, v, NULL); /* e_dialog_resizable_set(cfd->dia, 1); */ _conf->cfd = cfd; @@ -1298,9 +1295,8 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *e, E_Config_Dialog_Data *cf static void _fill_data(E_Config_Dialog_Data *cfdata) { - #define CP(_name) cfdata->_name = strdup(_conf->_name); -#define C(_name) cfdata->_name = _conf->_name; +#define C(_name) cfdata->_name = _conf->_name; CP(cmd_terminal); CP(cmd_sudo); #undef CP @@ -1310,10 +1306,10 @@ _fill_data(E_Config_Dialog_Data *cfdata) static int _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) { -#define CP(_name) \ - if (_conf->_name) \ - eina_stringshare_del(_conf->_name); \ - _conf->_name = eina_stringshare_add(cfdata->_name); +#define CP(_name) \ + if (_conf->_name) \ + eina_stringshare_del(_conf->_name); \ + _conf->_name = eina_stringshare_add(cfdata->_name); #define C(_name) _conf->_name = cfdata->_name; CP(cmd_terminal); CP(cmd_sudo); @@ -1331,22 +1327,22 @@ _conf_new(void) { if (!_conf) { - _conf = E_NEW(Module_Config, 1); - _conf->version = (MOD_CONFIG_FILE_EPOCH << 16); + _conf = E_NEW(Module_Config, 1); + _conf->version = (MOD_CONFIG_FILE_EPOCH << 16); } #define IFMODCFG(v) if ((_conf->version & 0xffff) < v) { #define IFMODCFGEND } - /* setup defaults */ - IFMODCFG(0x009d); - _conf->cmd_terminal = eina_stringshare_add("/usr/bin/xterm"); - _conf->cmd_sudo = eina_stringshare_add("/usr/bin/gksudo --preserve-env"); - IFMODCFGEND; + /* setup defaults */ + IFMODCFG(0x009d); + _conf->cmd_terminal = eina_stringshare_add("/usr/bin/xterm"); + _conf->cmd_sudo = eina_stringshare_add("/usr/bin/gksudo --preserve-env"); + IFMODCFGEND; - _conf->version = MOD_CONFIG_FILE_VERSION; + _conf->version = MOD_CONFIG_FILE_VERSION; - /* e_config_save_queue(); */ + /* e_config_save_queue(); */ } static void @@ -1365,9 +1361,9 @@ _conf_init(E_Module *m) char title[4096]; snprintf(title, sizeof(title), "%s: %s", _("Everything Plugin"), _("Applications")); - + e_configure_registry_item_add("launcher/everything-apps", 110, title, - NULL, _module_icon, _conf_dialog); + NULL, _module_icon, _conf_dialog); conf_edd = E_CONFIG_DD_NEW("Module_Config", Module_Config); @@ -1383,10 +1379,9 @@ _conf_init(E_Module *m) _conf = e_config_domain_load("module.everything-apps", conf_edd); - if (_conf && !e_util_module_config_check(_("Everything Applications"), - _conf->version, - MOD_CONFIG_FILE_VERSION)) + _conf->version, + MOD_CONFIG_FILE_VERSION)) _conf_free(); _conf_new(); @@ -1397,7 +1392,7 @@ static void _conf_shutdown(void) { e_configure_registry_item_del("launcher/everything-apps"); - + _conf_free(); E_CONFIG_DD_FREE(conf_edd); @@ -1449,7 +1444,6 @@ evry_plug_apps_save(void) /***************************************************************************/ - /* taken from e_exebuf.c */ static Eina_Bool _scan_idler(void *data __UNUSED__) @@ -1462,105 +1456,105 @@ _scan_idler(void *data __UNUSED__) /* no more path items left - stop scanning */ if (!exe_path) { - Eina_List *l, *l2; - E_Exe_List *el; - E_Exe *ee; - int different = 0; + Eina_List *l, *l2; + E_Exe_List *el; + E_Exe *ee; + int different = 0; - /* FIXME: check wheter they match or not */ - for (l = exe_list, l2 = exe_list2; l && l2; l = l->next, l2 = l2->next) - { - if (strcmp(l->data, l2->data)) - { - different = 1; - break; - } - } - if ((l) || (l2)) different = 1; - if (exe_list2) - { - while (exe_list) - { - free(eina_list_data_get(exe_list)); - exe_list = eina_list_remove_list(exe_list, exe_list); - } - exe_list = exe_list2; - exe_list2 = NULL; - } - if (different) - { - el = calloc(1, sizeof(E_Exe_List)); - if (el) - { - el->list = NULL; - for (l = exe_list; l; l = l->next) - { - ee = malloc(sizeof(E_Exe)); - if (ee) - { - ee->path = eina_stringshare_add(l->data); - el->list = eina_list_append(el->list, ee); - } - } - e_config_domain_save("exebuf_exelist_cache", exelist_edd, el); - while (el->list) - { - ee = eina_list_data_get(el->list); - eina_stringshare_del(ee->path); - free(ee); - el->list = eina_list_remove_list(el->list, el->list); - } - free(el); - } - } - exe_scan_idler = NULL; - return ECORE_CALLBACK_CANCEL; + /* FIXME: check wheter they match or not */ + for (l = exe_list, l2 = exe_list2; l && l2; l = l->next, l2 = l2->next) + { + if (strcmp(l->data, l2->data)) + { + different = 1; + break; + } + } + if ((l) || (l2)) different = 1; + if (exe_list2) + { + while (exe_list) + { + free(eina_list_data_get(exe_list)); + exe_list = eina_list_remove_list(exe_list, exe_list); + } + exe_list = exe_list2; + exe_list2 = NULL; + } + if (different) + { + el = calloc(1, sizeof(E_Exe_List)); + if (el) + { + el->list = NULL; + for (l = exe_list; l; l = l->next) + { + ee = malloc(sizeof(E_Exe)); + if (ee) + { + ee->path = eina_stringshare_add(l->data); + el->list = eina_list_append(el->list, ee); + } + } + e_config_domain_save("exebuf_exelist_cache", exelist_edd, el); + while (el->list) + { + ee = eina_list_data_get(el->list); + eina_stringshare_del(ee->path); + free(ee); + el->list = eina_list_remove_list(el->list, el->list); + } + free(el); + } + } + exe_scan_idler = NULL; + return ECORE_CALLBACK_CANCEL; } /* no dir is open - open the first path item */ if (!exe_dir) { - dir = exe_path->data; - exe_dir = opendir(dir); + dir = exe_path->data; + exe_dir = opendir(dir); } /* if we have an opened dir - scan the next item */ if (exe_dir) { - dir = exe_path->data; + dir = exe_path->data; - dp = readdir(exe_dir); - if (dp) - { - if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) - { - snprintf(buf, sizeof(buf), "%s/%s", dir, dp->d_name); - if ((stat(buf, &st) == 0) && - ((!S_ISDIR(st.st_mode)) && - (!access(buf, X_OK)))) - { - if (!exe_list) - exe_list = eina_list_append(exe_list, strdup(dp->d_name)); - else - exe_list2 = eina_list_append(exe_list2, strdup(dp->d_name)); - } - } - } - else - { - /* we reached the end of a dir - remove the dir at the head - * of the path list so we advance and next loop we will pick up - * the next item, or if null- abort - */ - closedir(exe_dir); - exe_dir = NULL; - free(eina_list_data_get(exe_path)); - exe_path = eina_list_remove_list(exe_path, exe_path); - } + dp = readdir(exe_dir); + if (dp) + { + if ((strcmp(dp->d_name, ".")) && (strcmp(dp->d_name, ".."))) + { + snprintf(buf, sizeof(buf), "%s/%s", dir, dp->d_name); + if ((stat(buf, &st) == 0) && + ((!S_ISDIR(st.st_mode)) && + (!access(buf, X_OK)))) + { + if (!exe_list) + exe_list = eina_list_append(exe_list, strdup(dp->d_name)); + else + exe_list2 = eina_list_append(exe_list2, strdup(dp->d_name)); + } + } + } + else + { + /* we reached the end of a dir - remove the dir at the head + * of the path list so we advance and next loop we will pick up + * the next item, or if null- abort + */ + closedir(exe_dir); + exe_dir = NULL; + free(eina_list_data_get(exe_path)); + exe_path = eina_list_remove_list(exe_path, exe_path); + } } /* obviously the dir open failed - so remove the first path item */ else { - free(eina_list_data_get(exe_path)); - exe_path = eina_list_remove_list(exe_path, exe_path); + free(eina_list_data_get(exe_path)); + exe_path = eina_list_remove_list(exe_path, exe_path); } /* we have more scannign to do */ return ECORE_CALLBACK_RENEW; @@ -1576,34 +1570,35 @@ _scan_executables() el = e_config_domain_load("exebuf_exelist_cache", exelist_edd); if (el) { - E_Exe *ee; + E_Exe *ee; - EINA_LIST_FREE(el->list, ee) - { - exe_list = eina_list_append(exe_list, strdup(ee->path)); - eina_stringshare_del(ee->path); - free(ee); - } - free(el); + EINA_LIST_FREE (el->list, ee) + { + exe_list = eina_list_append(exe_list, strdup(ee->path)); + eina_stringshare_del(ee->path); + free(ee); + } + free(el); } path = getenv("PATH"); if (path) { - path = strdup(path); - last = path; - for (pp = path; pp[0]; pp++) - { - if (pp[0] == ':') pp[0] = '\0'; - if (pp[0] == 0) - { - exe_path = eina_list_append(exe_path, strdup(last)); - last = pp + 1; - } - } - if (pp > last) - exe_path = eina_list_append(exe_path, strdup(last)); - free(path); + path = strdup(path); + last = path; + for (pp = path; pp[0]; pp++) + { + if (pp[0] == ':') pp[0] = '\0'; + if (pp[0] == 0) + { + exe_path = eina_list_append(exe_path, strdup(last)); + last = pp + 1; + } + } + if (pp > last) + exe_path = eina_list_append(exe_path, strdup(last)); + free(path); } exe_scan_idler = ecore_idler_add(_scan_idler, NULL); } + diff --git a/src/modules/everything/evry_plug_calc.c b/src/modules/everything/evry_plug_calc.c index 40f2348dc..2ed562c9c 100644 --- a/src/modules/everything/evry_plug_calc.c +++ b/src/modules/everything/evry_plug_calc.c @@ -6,12 +6,12 @@ typedef struct _Plugin Plugin; struct _Plugin { - Evry_Plugin base; + Evry_Plugin base; }; -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_del(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_del(void *data, int type, void *event); static const Evry_API *evry = NULL; static Evry_Module *evry_module = NULL; @@ -39,15 +39,15 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__) if (history) { - const char *result; + const char *result; - EINA_LIST_FREE(history, result) - { - it = EVRY_ITEM_NEW(Evry_Item, p, result, NULL, NULL); - it->context = eina_stringshare_ref(p->base.name); - p->base.items = eina_list_prepend(p->base.items, it); - eina_stringshare_del(result); - } + EINA_LIST_FREE (history, result) + { + it = EVRY_ITEM_NEW(Evry_Item, p, result, NULL, NULL); + it->context = eina_stringshare_ref(p->base.name); + p->base.items = eina_list_prepend(p->base.items, it); + eina_stringshare_del(result); + } } it = EVRY_ITEM_NEW(Evry_Item, p, "0", NULL, NULL); @@ -62,22 +62,22 @@ static int _run_bc(Plugin *p) { handlers = eina_list_append - (handlers, ecore_event_handler_add - (ECORE_EXE_EVENT_DATA, _cb_data, p)); + (handlers, ecore_event_handler_add + (ECORE_EXE_EVENT_DATA, _cb_data, p)); handlers = eina_list_append - (handlers, ecore_event_handler_add - (ECORE_EXE_EVENT_ERROR, _cb_error, p)); + (handlers, ecore_event_handler_add + (ECORE_EXE_EVENT_ERROR, _cb_error, p)); handlers = eina_list_append - (handlers, ecore_event_handler_add - (ECORE_EXE_EVENT_DEL, _cb_del, p)); + (handlers, ecore_event_handler_add + (ECORE_EXE_EVENT_DEL, _cb_del, p)); exe = ecore_exe_pipe_run("bc -l", - ECORE_EXE_PIPE_READ | - ECORE_EXE_PIPE_READ_LINE_BUFFERED | - ECORE_EXE_PIPE_WRITE | - ECORE_EXE_PIPE_ERROR | - ECORE_EXE_PIPE_ERROR_LINE_BUFFERED, - NULL); + ECORE_EXE_PIPE_READ | + ECORE_EXE_PIPE_READ_LINE_BUFFERED | + ECORE_EXE_PIPE_WRITE | + ECORE_EXE_PIPE_ERROR | + ECORE_EXE_PIPE_ERROR_LINE_BUFFERED, + NULL); return !!exe; } @@ -89,22 +89,22 @@ _finish(Evry_Plugin *plugin) Evry_Item *it; int items = 0; - EINA_LIST_FREE(p->base.items, it) + EINA_LIST_FREE (p->base.items, it) { - if ((items++ > 1) && (items < 10)) - history = eina_list_prepend(history, eina_stringshare_add(it->label)); + if ((items++ > 1) && (items < 10)) + 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); if (exe) { - ecore_exe_quit(exe); - ecore_exe_free(exe); - exe = NULL; + ecore_exe_quit(exe); + ecore_exe_free(exe); + exe = NULL; } active = EINA_FALSE; @@ -128,18 +128,18 @@ _cb_action_performed(__UNUSED__ void *data, __UNUSED__ int type, void *event) /* remove duplicates */ if (p->items->next) { - it = p->items->data; + it = p->items->data; - EINA_LIST_FOREACH(p->items->next, l, it2) - { - if (!strcmp(it->label, it2->label)) - { - p->items = eina_list_promote_list(p->items, l); - evry->item_changed(it, 0, 1); - EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); - return ECORE_CALLBACK_PASS_ON; - } - } + EINA_LIST_FOREACH (p->items->next, l, it2) + { + if (!strcmp(it->label, it2->label)) + { + p->items = eina_list_promote_list(p->items, l); + evry->item_changed(it, 0, 1); + EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); + return ECORE_CALLBACK_PASS_ON; + } + } } it_old = p->items->data; @@ -176,8 +176,8 @@ _fetch(Evry_Plugin *plugin, const char *input) second time...*/ if (error) { - ecore_exe_send(exe, buf, strlen(buf)); - error = 0; + ecore_exe_send(exe, buf, strlen(buf)); + error = 0; } return EVRY_PLUGIN_HAS_ITEMS(p); @@ -194,16 +194,17 @@ _cb_data(void *data, int type __UNUSED__, void *event) if (ev->lines) { - it = cur_item; - eina_stringshare_del(it->label); - it->label = eina_stringshare_add(ev->lines->line); + it = cur_item; + eina_stringshare_del(it->label); + it->label = eina_stringshare_add(ev->lines->line); - if (!(it = eina_list_data_get(p->items)) || (it != cur_item)) - { - p->items = eina_list_prepend(p->items, cur_item); - EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); - } - else if (it) evry->item_changed(it, 0, 0); + if (!(it = eina_list_data_get(p->items)) || (it != cur_item)) + { + p->items = eina_list_prepend(p->items, cur_item); + EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); + } + else if (it) + evry->item_changed(it, 0, 0); } return ECORE_CALLBACK_PASS_ON; @@ -246,23 +247,23 @@ _plugins_init(const Evry_API *_api) return EINA_FALSE; 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, - _begin, _finish, _fetch); + _begin, _finish, _fetch); - _plug->history = EINA_FALSE; + _plug->history = EINA_FALSE; _plug->async_fetch = EINA_TRUE; if (evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 0)) { - Plugin_Config *pc = _plug->config; - pc->view_mode = VIEW_MODE_LIST; - pc->trigger = eina_stringshare_add("="); - pc->trigger_only = EINA_TRUE; - pc->aggregate = EINA_FALSE; - /* pc->top_level = EINA_FALSE; */ - /* pc->min_query = 3; */ + Plugin_Config *pc = _plug->config; + pc->view_mode = VIEW_MODE_LIST; + pc->trigger = eina_stringshare_add("="); + pc->trigger_only = EINA_TRUE; + pc->aggregate = EINA_FALSE; + /* pc->top_level = EINA_FALSE; */ + /* pc->min_query = 3; */ } return EINA_TRUE; @@ -295,3 +296,4 @@ evry_plug_calc_shutdown(void) void evry_plug_calc_save(void){} + diff --git a/src/modules/everything/evry_plug_clipboard.c b/src/modules/everything/evry_plug_clipboard.c index 6b91d8085..0945c4cfd 100644 --- a/src/modules/everything/evry_plug_clipboard.c +++ b/src/modules/everything/evry_plug_clipboard.c @@ -17,7 +17,7 @@ _action(Evry_Action *act) static int _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 @@ -31,9 +31,9 @@ evry_plug_clipboard_init(void) //FIXME: Icon name doesn't follow FDO Spec act = EVRY_ACTION_NEW("Copy to Clipboard", - EVRY_TYPE_TEXT, 0, - "everything-clipboard", - _action, _check_item); + EVRY_TYPE_TEXT, 0, + "everything-clipboard", + _action, _check_item); act->remember_context = EINA_TRUE; evry_action_register(act, 10); @@ -48,3 +48,4 @@ evry_plug_clipboard_shutdown(void) ecore_x_window_free(clipboard_win); evry_action_free(act); } + diff --git a/src/modules/everything/evry_plug_collection.c b/src/modules/everything/evry_plug_collection.c index 0c949dfcf..5d334d015 100644 --- a/src/modules/everything/evry_plug_collection.c +++ b/src/modules/everything/evry_plug_collection.c @@ -1,13 +1,12 @@ #include "e_mod_main.h" - typedef struct _Plugin Plugin; struct _Plugin { - Evry_Plugin base; + Evry_Plugin base; - Eina_List *plugins; + Eina_List *plugins; }; 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 (!strcmp(plugin->name, "Plugins")) - inst->config = &plugin_config; - else - inst->config = pc; + if (!strcmp(plugin->name, "Plugins")) + inst->config = &plugin_config; + else + inst->config = pc; - return inst; + return inst; } return NULL; @@ -52,16 +51,16 @@ _add_item(Plugin *p, Plugin_Config *pc) if (pc->enabled && (pp = evry_plugin_find(pc->name))) { - pc->plugin = pp; + pc->plugin = pp; - GET_ITEM(itp, pp); - it = EVRY_ITEM_NEW(Evry_Item, EVRY_PLUGIN(p), itp->label, NULL, NULL); - if (itp->icon) it->icon = eina_stringshare_ref(itp->icon); - it->icon_get = itp->icon_get; - it->data = pc; - it->browseable = EINA_TRUE; - it->detail = eina_stringshare_ref(EVRY_ITEM(p)->label); - p->plugins = eina_list_append(p->plugins, it); + GET_ITEM(itp, pp); + it = EVRY_ITEM_NEW(Evry_Item, EVRY_PLUGIN(p), itp->label, NULL, NULL); + if (itp->icon) it->icon = eina_stringshare_ref(itp->icon); + it->icon_get = itp->icon_get; + it->data = pc; + it->browseable = EINA_TRUE; + it->detail = eina_stringshare_ref(EVRY_ITEM(p)->label); + p->plugins = eina_list_append(p->plugins, it); } return it; } @@ -75,7 +74,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__) 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); return EVRY_PLUGIN(p); @@ -90,15 +89,15 @@ _begin_all(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__) 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") || - !strcmp(pc->name, "Actions") || - !strcmp(pc->name, "Calculator") || - !strcmp(pc->name, "Plugins")) - continue; + if (!strcmp(pc->name, "All") || + !strcmp(pc->name, "Actions") || + !strcmp(pc->name, "Calculator") || + !strcmp(pc->name, "Plugins")) + continue; - _add_item(p, pc); + _add_item(p, pc); } return EVRY_PLUGIN(p); @@ -113,9 +112,9 @@ _finish(Evry_Plugin *plugin) EVRY_PLUGIN_ITEMS_CLEAR(p); - EINA_LIST_FREE(p->plugins, it) + EINA_LIST_FREE (p->plugins, it) EVRY_ITEM_FREE(it); - + E_FREE(p); } @@ -139,7 +138,7 @@ _add_plugin(const char *name) char title[4096]; p = EVRY_PLUGIN_BASE(name, NULL, COLLECTION_PLUGIN, - _begin, _finish, _fetch); + _begin, _finish, _fetch); p->browse = &_browse; 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)) { - p->config->aggregate = EINA_TRUE; - p->config->top_level = EINA_TRUE; - p->config->view_mode = VIEW_MODE_THUMB; + p->config->aggregate = EINA_TRUE; + p->config->top_level = EINA_TRUE; + 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); - EVRY_ITEM_ICON_SET(p, "start-here"); - p->config = pc; - pc->plugin = p; + p = _add_plugin(pc->name); + EVRY_ITEM_ICON_SET(p, "start-here"); + p->config = pc; + pc->plugin = p; - if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 1)) - p->config->aggregate = EINA_FALSE; + if (evry_plugin_register(p, EVRY_PLUGIN_SUBJECT, 1)) + p->config->aggregate = EINA_FALSE; } return EINA_TRUE; @@ -200,14 +199,15 @@ evry_plug_collection_shutdown(void) { Evry_Plugin *p; - EINA_LIST_FREE(plugins, p) + EINA_LIST_FREE (plugins, p) { - if (p->config_path) - { - e_configure_registry_item_del(p->config_path); - eina_stringshare_del(p->config_path); - } + if (p->config_path) + { + e_configure_registry_item_del(p->config_path); + eina_stringshare_del(p->config_path); + } - EVRY_PLUGIN_FREE(p); + EVRY_PLUGIN_FREE(p); } } + diff --git a/src/modules/everything/evry_plug_files.c b/src/modules/everything/evry_plug_files.c index 44c8e80ac..8e08bf0ff 100644 --- a/src/modules/everything/evry_plug_files.c +++ b/src/modules/everything/evry_plug_files.c @@ -1,93 +1,93 @@ /*************************************************** - TODO option for maximum items to cache - TODO keep common list for recent file instances -FIXME -*/ + TODO option for maximum items to cache + TODO keep common list for recent file instances + FIXME + */ #include "e.h" #include "evry_api.h" #include -#define MOD_CONFIG_FILE_EPOCH 0x0001 +#define MOD_CONFIG_FILE_EPOCH 0x0001 #define MOD_CONFIG_FILE_GENERATION 0x008d -#define MOD_CONFIG_FILE_VERSION \ - ((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION) +#define MOD_CONFIG_FILE_VERSION \ + ((MOD_CONFIG_FILE_EPOCH << 16) | MOD_CONFIG_FILE_GENERATION) -#define MAX_ITEMS 10 -#define MAX_SHOWN 300 -#define TERM_ACTION_DIR "%s" +#define MAX_ITEMS 10 +#define MAX_SHOWN 300 +#define TERM_ACTION_DIR "%s" -#define CMD_NONE 0 -#define CMD_SHOW_ROOT 1 -#define CMD_SHOW_HIDDEN 2 -#define CMD_SHOW_PARENT 3 +#define CMD_NONE 0 +#define CMD_SHOW_ROOT 1 +#define CMD_SHOW_HIDDEN 2 +#define CMD_SHOW_PARENT 3 -#define ACT_TRASH 1 -#define ACT_DELETE 2 -#define ACT_COPY 3 -#define ACT_MOVE 4 -#define ACT_SORT_DATE 5 -#define ACT_SORT_NAME 6 +#define ACT_TRASH 1 +#define ACT_DELETE 2 +#define ACT_COPY 3 +#define ACT_MOVE 4 +#define ACT_SORT_DATE 5 +#define ACT_SORT_NAME 6 -#define ONE_DAY 86400.0 -#define SIX_DAYS_AGO (ecore_time_unix_get() - ONE_DAY * 6) -#define MIN_USAGE 0.0 +#define ONE_DAY 86400.0 +#define SIX_DAYS_AGO (ecore_time_unix_get() - ONE_DAY * 6) +#define MIN_USAGE 0.0 /* #undef DBG * #define DBG(...) ERR(__VA_ARGS__) */ -typedef struct _Plugin Plugin; -typedef struct _Data Data; +typedef struct _Plugin Plugin; +typedef struct _Data Data; typedef struct _Module_Config Module_Config; struct _Plugin { - Evry_Plugin base; + Evry_Plugin base; - Eina_List *files; - const char *directory; - const char *input; - unsigned int command; - unsigned int min_query; - Eina_Bool parent; - Eina_Bool show_hidden; - Eina_Bool dirs_only; - Eina_Bool show_recent; - Eina_Bool sort_by_date; + Eina_List *files; + const char *directory; + const char *input; + unsigned int command; + unsigned int min_query; + Eina_Bool parent; + Eina_Bool show_hidden; + Eina_Bool dirs_only; + Eina_Bool show_recent; + Eina_Bool sort_by_date; - Ecore_Thread *thread; - Ecore_File_Monitor *dir_mon; - int waiting_to_finish; + Ecore_Thread *thread; + Ecore_File_Monitor *dir_mon; + int waiting_to_finish; }; struct _Data { - Plugin *plugin; - char *directory; - long id; - int level; - int cnt; - Eina_List *files; - DIR *dirp; - int run_cnt; + Plugin *plugin; + char *directory; + long id; + int level; + int cnt; + Eina_List *files; + DIR *dirp; + int run_cnt; }; struct _Module_Config { - int version; + int version; - unsigned char show_homedir; - unsigned char show_recent; - unsigned char search_recent; - unsigned char cache_dirs; - unsigned char search_cache; + unsigned char show_homedir; + unsigned char show_recent; + unsigned char search_recent; + unsigned char cache_dirs; + unsigned char search_cache; - // TODO - int sort_by; - Eina_List *search_dirs; + // TODO + int sort_by; + Eina_List *search_dirs; - E_Config_Dialog *cfd; - E_Module *module; + E_Config_Dialog *cfd; + E_Module *module; }; static const Evry_API *evry = NULL; @@ -109,12 +109,12 @@ _item_fill(Evry_Item_File *file) { if (!file->mime) { - const char *mime = efreet_mime_type_get(file->path); + const char *mime = efreet_mime_type_get(file->path); - if (mime) - file->mime = eina_stringshare_ref(mime); - else - file->mime = eina_stringshare_add("unknown"); + if (mime) + file->mime = eina_stringshare_ref(mime); + else + file->mime = eina_stringshare_add("unknown"); } if ((file->mime == _mime_dir) || @@ -126,8 +126,7 @@ _item_fill(Evry_Item_File *file) if (!EVRY_ITEM(file)->detail) evry->util_file_detail_set(file); - - evry->util_file_detail_set(file); + evry->util_file_detail_set(file); } static int @@ -144,7 +143,7 @@ _cb_sort(const void *data1, const void *data2) if (it1->fuzzy_match && it2->fuzzy_match) if (it1->fuzzy_match - it2->fuzzy_match) - return (it1->fuzzy_match - it2->fuzzy_match); + return it1->fuzzy_match - it2->fuzzy_match; return strcasecmp(it1->label, it2->label); } @@ -181,22 +180,22 @@ _scan_func(void *data, Ecore_Thread *thread) if (!(ls = eina_file_stat_ls(d->directory))) return; - EINA_ITERATOR_FOREACH(ls, info) + EINA_ITERATOR_FOREACH (ls, info) { - if ((d->plugin->show_hidden) != (*(info->path + info->name_start) == '.')) - continue; + if ((d->plugin->show_hidden) != (*(info->path + info->name_start) == '.')) + continue; - file = EVRY_ITEM_NEW(Evry_Item_File, d->plugin, NULL, NULL, _item_free); - file->path = strdup(info->path); - EVRY_ITEM(file)->label = strdup(info->path + info->name_start); - EVRY_ITEM(file)->browseable = (info->type == EINA_FILE_DIR); + file = EVRY_ITEM_NEW(Evry_Item_File, d->plugin, NULL, NULL, _item_free); + file->path = strdup(info->path); + EVRY_ITEM(file)->label = strdup(info->path + info->name_start); + EVRY_ITEM(file)->browseable = (info->type == EINA_FILE_DIR); - d->files = eina_list_append(d->files, file); - /* TODO dont append files in thread, run mime scan - * simultaneously. ecore_thread_feedback(thread, file); */ + d->files = eina_list_append(d->files, file); + /* TODO dont append files in thread, run mime scan + * simultaneously. ecore_thread_feedback(thread, file); */ - if (ecore_thread_check(thread)) - break; + if (ecore_thread_check(thread)) + break; } eina_iterator_free(ls); @@ -210,21 +209,21 @@ _scan_mime_func(void *data, Ecore_Thread *thread) Eina_List *l; int cnt = 0; - EINA_LIST_FOREACH(d->files, l, file) + EINA_LIST_FOREACH (d->files, l, file) { - if (ecore_thread_check(thread)) - break; + if (ecore_thread_check(thread)) + break; - if ((file->mime = efreet_mime_type_get(file->path))) - { - if (!strncmp(file->mime, "inode/", 6) && - ecore_file_is_dir(file->path)) - EVRY_ITEM(file)->browseable = EINA_TRUE; - } - else - file->mime = _mime_unknown; + if ((file->mime = efreet_mime_type_get(file->path))) + { + if (!strncmp(file->mime, "inode/", 6) && + ecore_file_is_dir(file->path)) + EVRY_ITEM(file)->browseable = EINA_TRUE; + } + else + file->mime = _mime_unknown; - if (cnt++ > MAX_ITEMS * d->run_cnt) break; + if (cnt++ > MAX_ITEMS * d->run_cnt) break; } } @@ -241,34 +240,34 @@ _files_filter(Plugin *p) if (!p->command && p->min_query) { - if (!p->input) - return 0; - if (len < p->min_query) - return 0; + if (!p->input) + return 0; + if (len < p->min_query) + return 0; } - EINA_LIST_FOREACH(p->files, l, it) + EINA_LIST_FOREACH (p->files, l, it) { - if (cnt >= MAX_SHOWN) break; + if (cnt >= MAX_SHOWN) break; - if (p->dirs_only && !it->browseable) - continue; + if (p->dirs_only && !it->browseable) + continue; - if (len && (match = evry->fuzzy_match(it->label, p->input))) - { - it->fuzzy_match = match; - if (!it->browseable) - it->priority = 1; - EVRY_PLUGIN_ITEM_APPEND(p, it); - cnt++; - } - else if (len == 0) - { - if (!it->browseable) - it->priority = 1; - EVRY_PLUGIN_ITEM_APPEND(p, it); - cnt++; - } + if (len && (match = evry->fuzzy_match(it->label, p->input))) + { + it->fuzzy_match = match; + if (!it->browseable) + it->priority = 1; + EVRY_PLUGIN_ITEM_APPEND(p, it); + cnt++; + } + else if (len == 0) + { + if (!it->browseable) + it->priority = 1; + EVRY_PLUGIN_ITEM_APPEND(p, it); + cnt++; + } } return cnt; } @@ -283,11 +282,11 @@ _scan_cancel_func(void *data, Ecore_Thread *thread __UNUSED__) /* EINA_LIST_FREE(p->files, file) * EVRY_ITEM_FREE(file); */ - EINA_LIST_FREE(d->files, file) + EINA_LIST_FREE (d->files, file) { - if (file->base.label) free((char *)(file->base.label)); - if (file->path) free((char *)file->path); - E_FREE(file); + if (file->base.label) free((char *)(file->base.label)); + if (file->path) free((char *)file->path); + E_FREE(file); } p->thread = NULL; @@ -308,18 +307,18 @@ _cache_mime_get(History_Types *ht, Evry_Item_File *file) if ((he = eina_hash_find(ht->types, file->path))) { - EINA_LIST_FOREACH(he->items, l, hi) - { - if (!hi->data) - continue; + EINA_LIST_FOREACH (he->items, l, hi) + { + if (!hi->data) + continue; - if (!file->mime) - file->mime = hi->data; + if (!file->mime) + file->mime = hi->data; - hi->transient = 0; - EVRY_ITEM(file)->hi = hi; - break; - } + hi->transient = 0; + EVRY_ITEM(file)->hi = hi; + break; + } } } @@ -331,24 +330,24 @@ _cache_dir_add(Eina_List *files) History_Item *hi; int cnt = 0; - EINA_LIST_REVERSE_FOREACH(files, l, item) + EINA_LIST_REVERSE_FOREACH (files, l, item) { - GET_FILE(file, item); + GET_FILE(file, item); - if (!(item->hi) && - (hi = evry->history_item_add(item, NULL, NULL))) - { - hi->last_used = SIX_DAYS_AGO; - hi->usage = MIN_USAGE * (double) cnt++; - hi->data = eina_stringshare_ref(file->mime); - item->hi = hi; - } - else if (item->hi && (item->hi->count == 1) && - (item->hi->last_used < SIX_DAYS_AGO)) - { - item->hi->last_used = SIX_DAYS_AGO; - item->hi->usage = MIN_USAGE * (double) cnt++; - } + if (!(item->hi) && + (hi = evry->history_item_add(item, NULL, NULL))) + { + hi->last_used = SIX_DAYS_AGO; + hi->usage = MIN_USAGE * (double)cnt++; + hi->data = eina_stringshare_ref(file->mime); + item->hi = hi; + } + else if (item->hi && (item->hi->count == 1) && + (item->hi->last_used < SIX_DAYS_AGO)) + { + item->hi->last_used = SIX_DAYS_AGO; + item->hi->usage = MIN_USAGE * (double)cnt++; + } } } @@ -358,7 +357,7 @@ _file_add(Plugin *p, Evry_Item *item) GET_FILE(file, item); char *filename = (char *)item->label; - char *path = (char *) file->path; + char *path = (char *)file->path; file->path = eina_stringshare_add(path); file->mime = eina_stringshare_ref(file->mime); @@ -390,53 +389,53 @@ _scan_end_func(void *data, Ecore_Thread *thread __UNUSED__) if (!d->run_cnt) /* _scan_func finished */ { - EINA_LIST_FOREACH_SAFE(d->files, l, ll, item) - { - GET_FILE(file, item); + EINA_LIST_FOREACH_SAFE (d->files, l, ll, item) + { + GET_FILE(file, item); - if (item->browseable) - file->mime = _mime_dir; - else if (ht) - _cache_mime_get(ht, file); + if (item->browseable) + file->mime = _mime_dir; + else if (ht) + _cache_mime_get(ht, file); - if (file->mime) - { - d->files = eina_list_remove_list(d->files, l); - _file_add(p, item); - } - } + if (file->mime) + { + d->files = eina_list_remove_list(d->files, l); + _file_add(p, item); + } + } - /* sort files by name for mimetypes scan */ - if (d->files) - d->files = eina_list_sort(d->files, -1, _cb_sort); + /* sort files by name for mimetypes scan */ + if (d->files) + d->files = eina_list_sort(d->files, -1, _cb_sort); } - else /* _scan_mime_func finished */ + else /* _scan_mime_func finished */ { - EINA_LIST_FREE(d->files, file) - { - if (!file->mime) break; - _file_add(p, (Evry_Item*) file); - } + EINA_LIST_FREE (d->files, file) + { + if (!file->mime) break; + _file_add(p, (Evry_Item *)file); + } } if (d->files) /* scan mimetypes */ { - d->run_cnt++; - p->thread = ecore_thread_run(_scan_mime_func, - _scan_end_func, - _scan_cancel_func, d); + d->run_cnt++; + p->thread = ecore_thread_run(_scan_mime_func, + _scan_end_func, + _scan_cancel_func, d); - /* wait for first mime scan to finish */ - if (d->run_cnt == 1) return; + /* wait for first mime scan to finish */ + if (d->run_cnt == 1) return; } else /* finished all file/mime scan */ { - free(d->directory); - E_FREE(d); - p->thread = NULL; + free(d->directory); + E_FREE(d); + p->thread = NULL; - if (_conf->cache_dirs && !(p->command == CMD_SHOW_HIDDEN)) - _cache_dir_add(p->files); + if (_conf->cache_dirs && !(p->command == CMD_SHOW_HIDDEN)) + _cache_dir_add(p->files); } p->files = eina_list_sort(p->files, -1, _cb_sort); @@ -457,42 +456,42 @@ _dir_watcher(void *data, Ecore_File_Monitor *em __UNUSED__, Ecore_File_Event eve switch (event) { case ECORE_FILE_EVENT_DELETED_SELF: - EINA_LIST_FREE(p->files, file) - evry->item_free(EVRY_ITEM(file)); - break; + EINA_LIST_FREE (p->files, file) + evry->item_free(EVRY_ITEM(file)); + break; case ECORE_FILE_EVENT_CREATED_DIRECTORY: case ECORE_FILE_EVENT_CREATED_FILE: - label = ecore_file_file_get(path); + label = ecore_file_file_get(path); - file = EVRY_ITEM_NEW(Evry_Item_File, p, label, NULL, _item_free); - file->path = eina_stringshare_add(path); + file = EVRY_ITEM_NEW(Evry_Item_File, p, label, NULL, _item_free); + file->path = eina_stringshare_add(path); - if (event == ECORE_FILE_EVENT_CREATED_DIRECTORY) - file->mime = eina_stringshare_ref(_mime_dir); + if (event == ECORE_FILE_EVENT_CREATED_DIRECTORY) + file->mime = eina_stringshare_ref(_mime_dir); - _item_fill(file); - p->files = eina_list_append(p->files, file); - break; + _item_fill(file); + p->files = eina_list_append(p->files, file); + break; case ECORE_FILE_EVENT_DELETED_FILE: case ECORE_FILE_EVENT_DELETED_DIRECTORY: - label = eina_stringshare_add(path); + label = eina_stringshare_add(path); - EINA_LIST_FOREACH_SAFE(p->files, l, ll, file) - { - if (file->path != label) continue; + EINA_LIST_FOREACH_SAFE (p->files, l, ll, file) + { + if (file->path != label) continue; - p->files = eina_list_remove_list(p->files, l); + p->files = eina_list_remove_list(p->files, l); - EVRY_ITEM_FREE(file); - break; - } - eina_stringshare_del(label); - break; + EVRY_ITEM_FREE(file); + break; + } + eina_stringshare_del(label); + break; default: - return; + return; } _files_filter(p); @@ -547,55 +546,55 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it) if (it) { - const char *dir = NULL; + const char *dir = NULL; - if ((CHECK_TYPE(it, EVRY_TYPE_FILE)) || - (CHECK_SUBTYPE(it, EVRY_TYPE_FILE))) - { - /* browse */ - GET_FILE(file, it); - if (!evry->file_path_get(file)) - return NULL; + if ((CHECK_TYPE(it, EVRY_TYPE_FILE)) || + (CHECK_SUBTYPE(it, EVRY_TYPE_FILE))) + { + /* browse */ + GET_FILE(file, it); + if (!evry->file_path_get(file)) + return NULL; - if (!ecore_file_is_dir(file->path)) - { - char *tmp = ecore_file_dir_get(file->path); - dir = eina_stringshare_add(tmp); - E_FREE(tmp); - } - else - { - dir = eina_stringshare_add(file->path); - } - } - else - { - /* provide object */ - if (!CHECK_TYPE(it, EVRY_TYPE_ACTION)) - return NULL; - } + if (!ecore_file_is_dir(file->path)) + { + char *tmp = ecore_file_dir_get(file->path); + dir = eina_stringshare_add(tmp); + E_FREE(tmp); + } + else + { + dir = eina_stringshare_add(file->path); + } + } + else + { + /* provide object */ + if (!CHECK_TYPE(it, EVRY_TYPE_ACTION)) + return NULL; + } - if (!dir) - dir = eina_stringshare_add(e_user_homedir_get()); + if (!dir) + dir = eina_stringshare_add(e_user_homedir_get()); - EVRY_PLUGIN_INSTANCE(p, plugin); - p->directory = dir; - p->parent = EINA_FALSE; - p->min_query = 0; - _read_directory(p); + EVRY_PLUGIN_INSTANCE(p, plugin); + p->directory = dir; + p->parent = EINA_FALSE; + p->min_query = 0; + _read_directory(p); - return EVRY_PLUGIN(p); + return EVRY_PLUGIN(p); } else { - /* provide subject */ - EVRY_PLUGIN_INSTANCE(p, plugin); - p->parent = EINA_FALSE; - p->directory = eina_stringshare_add(e_user_homedir_get()); - p->min_query = plugin->config->min_query; - _read_directory(p); + /* provide subject */ + EVRY_PLUGIN_INSTANCE(p, plugin); + p->parent = EINA_FALSE; + p->directory = eina_stringshare_add(e_user_homedir_get()); + p->min_query = plugin->config->min_query; + _read_directory(p); - return EVRY_PLUGIN(p); + return EVRY_PLUGIN(p); } return NULL; @@ -627,7 +626,7 @@ _free_files(Plugin *p) ecore_thread_cancel(p->thread); p->thread = NULL; - EINA_LIST_FREE(p->files, file) + EINA_LIST_FREE (p->files, file) EVRY_ITEM_FREE(file); if (p->dir_mon) @@ -665,94 +664,94 @@ _fetch(Evry_Plugin *plugin, const char *input) if (!p->parent && input && !strncmp(input, "/", 1)) { - char *path = NULL; + char *path = NULL; - if (p->command != CMD_SHOW_ROOT) - { - _free_files(p); + if (p->command != CMD_SHOW_ROOT) + { + _free_files(p); - IF_RELEASE(p->directory); + IF_RELEASE(p->directory); - if (path) - { - p->directory = eina_stringshare_add(path); - free(path); - } - else - { - p->directory = eina_stringshare_add("/"); - } + if (path) + { + p->directory = eina_stringshare_add(path); + free(path); + } + else + { + p->directory = eina_stringshare_add("/"); + } - _read_directory(p); + _read_directory(p); - p->command = CMD_SHOW_ROOT; + p->command = CMD_SHOW_ROOT; - return 0; - } - int len = strlen(p->directory); - len = (len == 1) ? len : len+1; + return 0; + } + int len = strlen(p->directory); + len = (len == 1) ? len : len + 1; - p->input = eina_stringshare_add(input + len); + p->input = eina_stringshare_add(input + len); } else if (p->directory && input && !strncmp(input, "..", 2)) { - if (p->command != CMD_SHOW_PARENT) - { - char *dir; - char buf[PATH_MAX]; - int prio = 0; + if (p->command != CMD_SHOW_PARENT) + { + char *dir; + char buf[PATH_MAX]; + int prio = 0; - if (strncmp(p->directory, "/", 1)) - return 0; + if (strncmp(p->directory, "/", 1)) + return 0; - _free_files(p); + _free_files(p); - strncpy(buf, p->directory, PATH_MAX); + strncpy(buf, p->directory, PATH_MAX); - _folder_item_add(p, p->directory, prio++); + _folder_item_add(p, p->directory, prio++); - while (strlen(buf) > 1) - { - buf[PATH_MAX - 1] = 0; - dir = dirname(buf); - _folder_item_add(p, dir, prio++); - strncpy(buf, dir, PATH_MAX); - } + while (strlen(buf) > 1) + { + buf[PATH_MAX - 1] = 0; + dir = dirname(buf); + _folder_item_add(p, dir, prio++); + strncpy(buf, dir, PATH_MAX); + } - p->command = CMD_SHOW_PARENT; - } - return 1; + p->command = CMD_SHOW_PARENT; + } + return 1; } else if (p->directory && input && !strncmp(input, ".", 1)) { - if (p->command != CMD_SHOW_HIDDEN) - { - _free_files(p); + if (p->command != CMD_SHOW_HIDDEN) + { + _free_files(p); - p->show_hidden = EINA_TRUE; - _read_directory(p); + p->show_hidden = EINA_TRUE; + _read_directory(p); - p->command = CMD_SHOW_HIDDEN; + p->command = CMD_SHOW_HIDDEN; - return 0; - } - p->input = eina_stringshare_add(input); + return 0; + } + p->input = eina_stringshare_add(input); } else if (p->command) { - /* clear command items */ - _free_files(p); + /* clear command items */ + _free_files(p); - if (p->command == CMD_SHOW_ROOT) - { - IF_RELEASE(p->directory); - p->directory = eina_stringshare_add(e_user_homedir_get()); - } + if (p->command == CMD_SHOW_ROOT) + { + IF_RELEASE(p->directory); + p->directory = eina_stringshare_add(e_user_homedir_get()); + } - p->command = CMD_NONE; - p->show_hidden = EINA_FALSE; + p->command = CMD_NONE; + p->show_hidden = EINA_FALSE; - _read_directory(p); + _read_directory(p); } if (input && !p->command) @@ -780,11 +779,11 @@ _cb_sort_recent(const void *data1, const void *data2) return 1; if (it1->hi && it2->hi) - return (it1->hi->last_used > it2->hi->last_used ? -1 : 1); + return it1->hi->last_used > it2->hi->last_used ? -1 : 1; if (it1->fuzzy_match && it2->fuzzy_match) if (it1->fuzzy_match - it2->fuzzy_match) - return (it1->fuzzy_match - it2->fuzzy_match); + return it1->fuzzy_match - it2->fuzzy_match; return strcasecmp(it1->label, it2->label); } @@ -799,50 +798,49 @@ _recentf_files_filter(Plugin *p) EVRY_PLUGIN_ITEMS_CLEAR(p); - EINA_LIST_FOREACH(p->files, l, it) + EINA_LIST_FOREACH (p->files, l, it) { - if (p->dirs_only && !it->browseable) - continue; + if (p->dirs_only && !it->browseable) + continue; - if (!p->input) - { - if (!it->browseable) - it->priority = 1; - new = eina_list_append(new, it); - continue; - } + if (!p->input) + { + if (!it->browseable) + it->priority = 1; + new = eina_list_append(new, it); + continue; + } - if (it->fuzzy_match <= 0) - { - if ((match = evry->fuzzy_match(it->label, p->input)) || - (match = evry->fuzzy_match(EVRY_FILE(it)->path, p->input))) - it->fuzzy_match = match; - else - it->fuzzy_match = 0; + if (it->fuzzy_match <= 0) + { + if ((match = evry->fuzzy_match(it->label, p->input)) || + (match = evry->fuzzy_match(EVRY_FILE(it)->path, p->input))) + it->fuzzy_match = match; + else + it->fuzzy_match = 0; - DBG("check match %d %s", it->fuzzy_match, it->label); - } + DBG("check match %d %s", it->fuzzy_match, it->label); + } - if (it->fuzzy_match) - { - if (!it->browseable) - it->priority = 1; - new = eina_list_append(new, it); - } + if (it->fuzzy_match) + { + if (!it->browseable) + it->priority = 1; + new = eina_list_append(new, it); + } } new = eina_list_sort(new, -1, _cb_sort_recent); - EINA_LIST_FREE(new, it) + EINA_LIST_FREE (new, it) { - if (cnt++ < MAX_SHOWN) - EVRY_PLUGIN_ITEM_APPEND(p, it); + if (cnt++ < MAX_SHOWN) + EVRY_PLUGIN_ITEM_APPEND(p, it); } return cnt; } - #if 0 /* use thread only to not block ui for ecore_file_exists ... */ @@ -853,14 +851,14 @@ _recentf_func(void *data) Eina_List *l; Evry_Item_File *file; - EINA_LIST_FOREACH(d->files, l, file) + EINA_LIST_FOREACH (d->files, l, file) { - if ((!evry->file_path_get(file)) || - (!ecore_file_exists(file->path))) - { - EVRY_ITEM(file)->hi->last_used -= ONE_DAY; - EVRY_ITEM(file)->hi = NULL; - } + if ((!evry->file_path_get(file)) || + (!ecore_file_exists(file->path))) + { + EVRY_ITEM(file)->hi->last_used -= ONE_DAY; + EVRY_ITEM(file)->hi = NULL; + } } } @@ -871,7 +869,7 @@ _recentf_cancel_func(void *data) Plugin *p = d->plugin; Evry_Item_File *file; - EINA_LIST_FREE(d->files, file) + EINA_LIST_FREE (d->files, file) EVRY_ITEM_FREE(file); E_FREE(d); @@ -887,22 +885,22 @@ _recentf_end_func(void *data) Plugin *p = d->plugin; Evry_Item *it; - EINA_LIST_FREE(d->files, it) + EINA_LIST_FREE (d->files, it) { - GET_FILE(file, it); + GET_FILE(file, it); - if (!it->hi) - { - evry->item_free(it); - continue; - } + if (!it->hi) + { + evry->item_free(it); + continue; + } - _item_fill(file); + _item_fill(file); - if (!it->hi->data) - it->hi->data = eina_stringshare_ref(file->mime); + if (!it->hi->data) + it->hi->data = eina_stringshare_ref(file->mime); - p->files = eina_list_append(p->files, it); + p->files = eina_list_append(p->files, it); } _recentf_files_filter(p); @@ -912,6 +910,7 @@ _recentf_end_func(void *data) p->thread = NULL; E_FREE(d); } + #endif static Eina_Bool @@ -928,11 +927,11 @@ _recentf_items_add_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *d const char *path; int match = 0; - EINA_LIST_FOREACH(he->items, l, hi2) + EINA_LIST_FOREACH (he->items, l, hi2) if (hi2->last_used > last_used) { - last_used = hi2->last_used; - hi = hi2; + last_used = hi2->last_used; + hi = hi2; } if (!hi) @@ -940,17 +939,17 @@ _recentf_items_add_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *d if (clear_cache) { - DBG("clear %s", (char *)key); + DBG("clear %s", (char *)key); - /* transient marks them for deletion */ - if (hi->count == 1) - { - hi->usage = 0; - hi->count = 0; - hi->transient = 1; - } + /* transient marks them for deletion */ + if (hi->count == 1) + { + hi->usage = 0; + hi->count = 0; + hi->transient = 1; + } - return EINA_TRUE; + return EINA_TRUE; } if (hi->transient) @@ -958,47 +957,47 @@ _recentf_items_add_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *d if (!_conf->search_cache) { - if ((hi->count == 1) && (hi->last_used < SIX_DAYS_AGO)) - return EINA_TRUE; + if ((hi->count == 1) && (hi->last_used < SIX_DAYS_AGO)) + return EINA_TRUE; } - path = (const char *) key; + path = (const char *)key; if (!(label = ecore_file_file_get(path))) return EINA_TRUE; path = eina_stringshare_add(path); - EINA_LIST_FOREACH(p->files, ll, file) + EINA_LIST_FOREACH (p->files, ll, file) { - if (file->path == path) - { - eina_stringshare_del(path); - EVRY_ITEM(file)->fuzzy_match = -1; - return EINA_TRUE; - } + if (file->path == path) + { + eina_stringshare_del(path); + EVRY_ITEM(file)->fuzzy_match = -1; + return EINA_TRUE; + } } /* searching subdirs */ if (p->directory) { - /* dont show recent files from same dir */ - int len = strlen(p->directory); - char *end = strrchr(path, '/'); - if (strncmp(path, p->directory, len) || - (end - path) <= len) - { - /* DBG("not in dir %s", path); */ - eina_stringshare_del(path); - return EINA_TRUE; - } + /* dont show recent files from same dir */ + int len = strlen(p->directory); + char *end = strrchr(path, '/'); + if (strncmp(path, p->directory, len) || + (end - path) <= len) + { + /* DBG("not in dir %s", path); */ + eina_stringshare_del(path); + return EINA_TRUE; + } } if (!(match = evry->fuzzy_match(label, p->input)) && !(match = evry->fuzzy_match(path, p->input))) { - eina_stringshare_del(path); - return EINA_TRUE; + eina_stringshare_del(path); + return EINA_TRUE; } file = EVRY_ITEM_NEW(Evry_Item_File, p, label, NULL, _item_free); @@ -1058,21 +1057,21 @@ _recentf_begin(Evry_Plugin *plugin, const Evry_Item *it) if (it) { - /* provide object */ + /* provide object */ } else { - /* provide subject */ - p->min_query = plugin->config->min_query; + /* provide subject */ + p->min_query = plugin->config->min_query; - if (clear_cache) - { - History_Types *ht = evry->history_types_get(EVRY_TYPE_FILE); - if (ht) - eina_hash_foreach(ht->types, _recentf_items_add_cb, p); + if (clear_cache) + { + History_Types *ht = evry->history_types_get(EVRY_TYPE_FILE); + if (ht) + eina_hash_foreach(ht->types, _recentf_items_add_cb, p); - clear_cache = EINA_FALSE; - } + clear_cache = EINA_FALSE; + } } return EVRY_PLUGIN(p); @@ -1097,26 +1096,26 @@ _recentf_fetch(Evry_Plugin *plugin, const char *input) if (len >= plugin->config->min_query) { - if (input) - p->input = eina_stringshare_add(input); + if (input) + p->input = eina_stringshare_add(input); - if ((ht = evry->history_types_get(EVRY_TYPE_FILE))) - { - Data *d = E_NEW(Data, 1); - d->plugin = p; - eina_hash_foreach(ht->types, _recentf_items_add_cb, d); - EINA_LIST_FREE(d->files, file) - p->files = eina_list_append(p->files, file); - E_FREE(d); + if ((ht = evry->history_types_get(EVRY_TYPE_FILE))) + { + Data *d = E_NEW(Data, 1); + d->plugin = p; + eina_hash_foreach(ht->types, _recentf_items_add_cb, d); + EINA_LIST_FREE (d->files, file) + p->files = eina_list_append(p->files, file); + E_FREE(d); - _recentf_files_filter(p); + _recentf_files_filter(p); - /* _recentf_end_func(d); - * p->thread = NULL; */ - /* p->thread = ecore_thread_run(_recentf_func, _recentf_end_func, - * _recentf_cancel_func, d); */ - } - return EVRY_PLUGIN_HAS_ITEMS(p); + /* _recentf_end_func(d); + * p->thread = NULL; */ + /* p->thread = ecore_thread_run(_recentf_func, _recentf_end_func, + * _recentf_cancel_func, d); */ + } + return EVRY_PLUGIN_HAS_ITEMS(p); } EVRY_PLUGIN_ITEMS_CLEAR(p); @@ -1130,7 +1129,7 @@ _recentf_fetch(Evry_Plugin *plugin, const char *input) static int _open_folder_check(Evry_Action *act __UNUSED__, const Evry_Item *it) { - return (it->browseable && e_action_find("fileman")); + return it->browseable && e_action_find("fileman"); } static int @@ -1152,14 +1151,14 @@ _open_folder_action(Evry_Action *act) if (!IS_BROWSEABLE(file)) { - dir = ecore_file_dir_get(file->path); - if (!dir) return 0; - action->func.go(E_OBJECT(m->data), dir); - free(dir); + dir = ecore_file_dir_get(file->path); + if (!dir) return 0; + action->func.go(E_OBJECT(m->data), dir); + free(dir); } else { - action->func.go(E_OBJECT(m->data), file->path); + action->func.go(E_OBJECT(m->data), file->path); } return 1; @@ -1181,11 +1180,11 @@ _file_trash_action(Evry_Action *act) if (euri) { - ok = efreet_trash_delete_uri(euri, force); - efreet_uri_free(euri); + ok = efreet_trash_delete_uri(euri, force); + efreet_uri_free(euri); } - return (ok > 0); + return ok > 0; } static int @@ -1217,11 +1216,11 @@ _file_copy_action(Evry_Action *act) if (EVRY_ITEM_DATA_INT_GET(act) == ACT_COPY) { - return ecore_file_cp(src->path, buf); + return ecore_file_cp(src->path, buf); } else if (EVRY_ITEM_DATA_INT_GET(act) == ACT_MOVE) { - return ecore_file_mv(src->path, buf); + return ecore_file_mv(src->path, buf); } return 0; @@ -1234,37 +1233,36 @@ _sort_by_date(Plugin *p) Evry_Item_File *file; struct stat s; - EINA_LIST_FOREACH(p->files, l, file) + EINA_LIST_FOREACH (p->files, l, file) { - if (file->modified) - continue; + if (file->modified) + continue; - if (lstat(file->path, &s) == 0) - file->modified = s.st_mtime; + if (lstat(file->path, &s) == 0) + file->modified = s.st_mtime; - EVRY_ITEM(file)->usage = -1; + EVRY_ITEM(file)->usage = -1; } p->files = eina_list_sort(p->files, -1, _cb_sort_date); _files_filter(p); EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); - } + static void _sort_by_name(Plugin *p) { Eina_List *l; Evry_Item *it; - EINA_LIST_FOREACH(p->files, l, it) + EINA_LIST_FOREACH (p->files, l, it) it->usage = 0; p->files = eina_list_sort(p->files, -1, _cb_sort); _files_filter(p); EVRY_PLUGIN_UPDATE(p, EVRY_UPDATE_ADD); - } static int @@ -1275,11 +1273,11 @@ _file_sort_action(Evry_Action *act) if (EVRY_ITEM_DATA_INT_GET(act) == ACT_SORT_DATE) { - _sort_by_date(p); + _sort_by_date(p); } else { - _sort_by_name(p); + _sort_by_name(p); } return 0; @@ -1292,19 +1290,18 @@ _cb_key_down(Evry_Plugin *plugin, const Ecore_Event_Key *ev) if (!strcmp(ev->key, "F1")) { - _sort_by_name(p); - return 1; + _sort_by_name(p); + return 1; } if (!strcmp(ev->key, "F2")) { - _sort_by_date(p); - return 1; + _sort_by_date(p); + return 1; } return 0; } - static int _plugins_init(const Evry_API *api) { @@ -1317,48 +1314,47 @@ _plugins_init(const Evry_API *api) if (!evry->api_version_check(EVRY_API_VERSION)) return EINA_FALSE; - _mime_dir = eina_stringshare_add("inode/directory"); - _mime_mount = eina_stringshare_add("inode/mountpoint"); + _mime_dir = eina_stringshare_add("inode/directory"); + _mime_mount = eina_stringshare_add("inode/mountpoint"); _mime_unknown = eina_stringshare_add("unknown"); -#define ACTION_NEW(_name, _type2, _icon, _act, _check, _register) \ - act = EVRY_ACTION_NEW(_name, EVRY_TYPE_FILE, _type2, _icon, _act, _check); \ - if (_register) evry->action_register(act, prio++); \ - _actions = eina_list_append(_actions, act); \ +#define ACTION_NEW(_name, _type2, _icon, _act, _check, _register) \ + act = EVRY_ACTION_NEW(_name, EVRY_TYPE_FILE, _type2, _icon, _act, _check); \ + if (_register) evry->action_register(act, prio++); \ + _actions = eina_list_append(_actions, act); \ ACTION_NEW("Copy To ...", EVRY_TYPE_FILE, "go-next", - _file_copy_action, NULL, 1); + _file_copy_action, NULL, 1); act->it2.subtype = EVRY_TYPE_DIR; EVRY_ITEM_DATA_INT_SET(act, ACT_COPY); ACTION_NEW("Move To ...", EVRY_TYPE_FILE, "go-next", - _file_copy_action, NULL, 1); + _file_copy_action, NULL, 1); act->it2.subtype = EVRY_TYPE_DIR; EVRY_ITEM_DATA_INT_SET(act, ACT_MOVE); ACTION_NEW("Move to Trash", 0, "user-trash", - _file_trash_action, NULL, 1); + _file_trash_action, NULL, 1); EVRY_ITEM_DATA_INT_SET(act, ACT_TRASH); ACTION_NEW("Open Folder (EFM)", 0, "folder-open", - _open_folder_action, _open_folder_check, 1); + _open_folder_action, _open_folder_check, 1); act->remember_context = EINA_TRUE; ACTION_NEW("Sort by Date", 0, "go-up", - _file_sort_action, NULL, 0); + _file_sort_action, NULL, 0); EVRY_ITEM_DATA_INT_SET(act, ACT_SORT_DATE); act_sort_date = act; ACTION_NEW("Sort by Name", 0, "go-up", - _file_sort_action, NULL, 0); + _file_sort_action, NULL, 0); EVRY_ITEM_DATA_INT_SET(act, ACT_SORT_NAME); act_sort_name = act; #undef ACTION_NEW - p = EVRY_PLUGIN_BASE("Files", _module_icon, EVRY_TYPE_FILE, - _begin, _finish, _fetch); + _begin, _finish, _fetch); p->input_type = EVRY_TYPE_FILE; p->cb_key_down = &_cb_key_down; p->browse = &_browse; @@ -1370,9 +1366,8 @@ _plugins_init(const Evry_API *api) if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 2)) p->config->min_query = 1; - p = EVRY_PLUGIN_BASE("Files", _module_icon, EVRY_TYPE_FILE, - _begin, _finish, _fetch); + _begin, _finish, _fetch); p->cb_key_down = &_cb_key_down; p->browse = &_browse; p->config_path = "extensions/everything-files"; @@ -1385,29 +1380,29 @@ _plugins_init(const Evry_API *api) return EINA_TRUE; p = EVRY_PLUGIN_BASE("Recent Files", _module_icon, EVRY_TYPE_FILE, - _recentf_begin, _finish, _recentf_fetch); + _recentf_begin, _finish, _recentf_fetch); p->browse = &_recentf_browse; p->config_path = "extensions/everything-files"; if (evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 3)) { - p->config->top_level = EINA_FALSE; - p->config->min_query = 3; + p->config->top_level = EINA_FALSE; + p->config->min_query = 3; } _plugins = eina_list_append(_plugins, p); - + p = EVRY_PLUGIN_BASE("Recent Files", _module_icon, EVRY_TYPE_FILE, - _recentf_begin, _finish, _recentf_fetch); + _recentf_begin, _finish, _recentf_fetch); p->browse = &_recentf_browse; p->config_path = "extensions/everything-files"; if (evry->plugin_register(p, EVRY_PLUGIN_OBJECT, 3)) { - p->config->top_level = EINA_FALSE; - p->config->min_query = 3; + p->config->top_level = EINA_FALSE; + p->config->min_query = 3; } _plugins = eina_list_append(_plugins, p); - + return EINA_TRUE; } @@ -1421,36 +1416,35 @@ _plugins_shutdown(void) eina_stringshare_del(_mime_mount); eina_stringshare_del(_mime_unknown); - EINA_LIST_FREE(_plugins, p) + EINA_LIST_FREE (_plugins, p) { - if (p->actions) - eina_list_free(p->actions); - EVRY_PLUGIN_FREE(p); + if (p->actions) + eina_list_free(p->actions); + EVRY_PLUGIN_FREE(p); } - EINA_LIST_FREE(_actions, act) + EINA_LIST_FREE (_actions, act) evry->action_free(act); } - /***************************************************************************/ static E_Config_DD *conf_edd = NULL; struct _E_Config_Dialog_Data { - int show_homedir; - int show_recent; - int search_recent; - int search_cache; - int cache_dirs; + int show_homedir; + int show_recent; + int search_recent; + int search_cache; + int cache_dirs; }; -static void *_create_data(E_Config_Dialog *cfd); -static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); -static void _fill_data(E_Config_Dialog_Data *cfdata); +static void *_create_data(E_Config_Dialog *cfd); +static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); +static void _fill_data(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 E_Config_Dialog * _conf_dialog(E_Container *con, const char *params __UNUSED__) @@ -1469,7 +1463,7 @@ _conf_dialog(E_Container *con, const char *params __UNUSED__) v->basic.apply_cfdata = _basic_apply; cfd = e_config_dialog_new(con, _("Everything Files"), "everything-files", - "extensions/everything-files", _module_icon, 0, v, NULL); + "extensions/everything-files", _module_icon, 0, v, NULL); _conf->cfd = cfd; return cfd; @@ -1492,44 +1486,43 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data e_widget_framelist_content_align_set(of, 0.0, 0.0); /* ow = e_widget_check_add(evas, _("Show home directory"), - * &(cfdata->show_homedir)); + * &(cfdata->show_homedir)); * e_widget_framelist_object_append(of, ow); */ ow = e_widget_check_add(evas, _("Show recent files"), - &(cfdata->show_recent)); + &(cfdata->show_recent)); e_widget_framelist_object_append(of, ow); ow = e_widget_check_add(evas, _("Search recent files"), - &(cfdata->search_recent)); + &(cfdata->search_recent)); e_widget_framelist_object_append(of, ow); ow = e_widget_check_add(evas, _("Search cached files"), - &(cfdata->search_cache)); + &(cfdata->search_cache)); e_widget_framelist_object_append(of, ow); ow = e_widget_check_add(evas, _("Cache visited directories"), - &(cfdata->cache_dirs)); + &(cfdata->cache_dirs)); e_widget_framelist_object_append(of, ow); ow = e_widget_button_add(evas, _("Clear cache"), NULL, - _clear_cache_cb, - NULL, NULL); + _clear_cache_cb, + NULL, NULL); e_widget_framelist_object_append(of, ow); - e_widget_list_object_append(o, of, 1, 1, 0.5); return o; } static void * _create_data(E_Config_Dialog *cfd __UNUSED__) - { - E_Config_Dialog_Data *cfdata = NULL; +{ + E_Config_Dialog_Data *cfdata = NULL; - cfdata = E_NEW(E_Config_Dialog_Data, 1); - _fill_data(cfdata); - return cfdata; - } + cfdata = E_NEW(E_Config_Dialog_Data, 1); + _fill_data(cfdata); + return cfdata; +} static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata) @@ -1575,16 +1568,16 @@ _conf_new(void) #define IFMODCFG(v) if ((_conf->version & 0xffff) < v) { #define IFMODCFGEND } - /* setup defaults */ - IFMODCFG(0x008d); - _conf->show_recent = 0; - _conf->show_homedir = 1; - _conf->search_recent = 1; - _conf->cache_dirs = 0; - _conf->search_cache = 0; - IFMODCFGEND; + /* setup defaults */ + IFMODCFG(0x008d); + _conf->show_recent = 0; + _conf->show_homedir = 1; + _conf->search_recent = 1; + _conf->cache_dirs = 0; + _conf->search_cache = 0; + IFMODCFGEND; - _conf->version = MOD_CONFIG_FILE_VERSION; + _conf->version = MOD_CONFIG_FILE_VERSION; } static void @@ -1601,7 +1594,7 @@ _conf_init(E_Module *m) snprintf(title, sizeof(title), "%s: %s", _("Everything Plugin"), _("Files")); e_configure_registry_item_add("launcher/everything-files", 110, title, - NULL, _module_icon, _conf_dialog); + NULL, _module_icon, _conf_dialog); conf_edd = E_CONFIG_DD_NEW("Module_Config", Module_Config); @@ -1621,9 +1614,9 @@ _conf_init(E_Module *m) _conf = e_config_domain_load("module.everything-files", conf_edd); if (_conf && !e_util_module_config_check(_("Everything Files"), - _conf->version, - MOD_CONFIG_FILE_VERSION)) - _conf_free(); + _conf->version, + MOD_CONFIG_FILE_VERSION)) + _conf_free(); if (!_conf) _conf_new(); @@ -1664,3 +1657,4 @@ evry_plug_files_save(void) { e_config_domain_save("module.everything-files", conf_edd, _conf); } + diff --git a/src/modules/everything/evry_plug_settings.c b/src/modules/everything/evry_plug_settings.c index 812fc8ce1..81f7186eb 100644 --- a/src/modules/everything/evry_plug_settings.c +++ b/src/modules/everything/evry_plug_settings.c @@ -1,23 +1,23 @@ #include "e.h" #include "evry_api.h" -typedef struct _Plugin Plugin; +typedef struct _Plugin Plugin; typedef struct _Settings_Item Settings_Item; struct _Plugin { - Evry_Plugin base; - Eina_List *items; - Eina_List *categories; - Eina_Bool parent; + Evry_Plugin base; + Eina_List *items; + Eina_List *categories; + Eina_Bool parent; }; struct _Settings_Item { - Evry_Item base; - - E_Configure_Cat *ecat; - E_Configure_It *eci; + Evry_Item base; + + E_Configure_Cat *ecat; + E_Configure_It *eci; }; static const Evry_API *evry = NULL; @@ -31,13 +31,13 @@ _finish(Evry_Plugin *plugin) { Settings_Item *it; GET_PLUGIN(p, plugin); - + EVRY_PLUGIN_ITEMS_CLEAR(p); - - EINA_LIST_FREE(p->items, it) + + EINA_LIST_FREE (p->items, it) EVRY_ITEM_FREE(it); - EINA_LIST_FREE(p->categories, it) + EINA_LIST_FREE (p->categories, it) EVRY_ITEM_FREE(it); E_FREE(p); @@ -46,16 +46,16 @@ _finish(Evry_Plugin *plugin) static Evas_Object * _icon_get(Evry_Item *item, Evas *e __UNUSED__) { - Settings_Item *it = (Settings_Item *) item; + Settings_Item *it = (Settings_Item *)item; if (!item->icon) { - if (it->eci && it->eci->icon) - item->icon = eina_stringshare_add(it->eci->icon); - else if (it->ecat->icon) - item->icon = eina_stringshare_add(it->ecat->icon); + if (it->eci && it->eci->icon) + item->icon = eina_stringshare_add(it->eci->icon); + else if (it->ecat->icon) + item->icon = eina_stringshare_add(it->ecat->icon); } - + return NULL; } @@ -69,22 +69,22 @@ _browse(Evry_Plugin *plugin, const Evry_Item *item) if (!CHECK_TYPE(item, E_SETTINGS)) return NULL; - it = (Settings_Item *) item; - + it = (Settings_Item *)item; + EVRY_PLUGIN_INSTANCE(p, plugin); p->parent = EINA_TRUE; - + GET_PLUGIN(parent, item->plugin); - - EINA_LIST_FOREACH(parent->items, l, it2) + + EINA_LIST_FOREACH (parent->items, l, it2) { - if (it2->ecat == it->ecat) - { - EVRY_ITEM_REF(it2); - p->items = eina_list_append(p->items, it2); - } + if (it2->ecat == it->ecat) + { + EVRY_ITEM_REF(it2); + p->items = eina_list_append(p->items, it2); + } } - + return EVRY_PLUGIN(p); } @@ -94,7 +94,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *item __UNUSED__) Plugin *p; EVRY_PLUGIN_INSTANCE(p, plugin); - + return EVRY_PLUGIN(p); } @@ -102,43 +102,43 @@ static int _fetch(Evry_Plugin *plugin, const char *input) { size_t len = input ? strlen(input) : 0; - + GET_PLUGIN(p, plugin); EVRY_PLUGIN_ITEMS_CLEAR(p); - + if ((!p->parent) && (len < plugin->config->min_query)) return 0; - + if (!p->categories && !p->items) { - Settings_Item *it; - Eina_List *l, *ll; - E_Configure_Cat *ecat; - E_Configure_It *eci; + Settings_Item *it; + Eina_List *l, *ll; + E_Configure_Cat *ecat; + E_Configure_It *eci; - EINA_LIST_FOREACH(e_configure_registry, l, ecat) - { - if ((ecat->pri < 0) || (!ecat->items)) continue; - if (!strcmp(ecat->cat, "system")) continue; + EINA_LIST_FOREACH (e_configure_registry, l, ecat) + { + if ((ecat->pri < 0) || (!ecat->items)) continue; + if (!strcmp(ecat->cat, "system")) continue; - it = EVRY_ITEM_NEW(Settings_Item, p, ecat->label, _icon_get, NULL); - it->ecat = ecat; - EVRY_ITEM(it)->browseable = EINA_TRUE; - 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, ecat->label, _icon_get, NULL); + it->ecat = ecat; + EVRY_ITEM(it)->browseable = EINA_TRUE; + p->categories = eina_list_append(p->categories, it); - it = EVRY_ITEM_NEW(Settings_Item, p, eci->label, _icon_get, NULL); - it->eci = eci; - it->ecat = ecat; - EVRY_ITEM_DETAIL_SET(it, ecat->label); - - p->items = eina_list_append(p->items, 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); + 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); @@ -152,7 +152,7 @@ _fetch(Evry_Plugin *plugin, const char *input) static int _action_check(Evry_Action *act __UNUSED__, const Evry_Item *item) { - return !!(((Settings_Item*)item)->eci); + return !!(((Settings_Item *)item)->eci); } static int @@ -161,7 +161,7 @@ _action(Evry_Action *act) char buf[1024]; 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); @@ -172,20 +172,20 @@ _action(Evry_Action *act) static int _plugins_init(const Evry_API *_api) -{ +{ evry = _api; - + if (!evry->api_version_check(EVRY_API_VERSION)) return EINA_FALSE; E_SETTINGS = evry->type_register("E_SETTINGS"); - + p = EVRY_PLUGIN_BASE("Settings", "configure", E_SETTINGS, _begin, _finish, _fetch); p->browse = &_browse; evry->plugin_register(p, EVRY_PLUGIN_SUBJECT, 10); act = EVRY_ACTION_NEW("Show Dialog", E_SETTINGS, 0, - "preferences-advanced", _action, _action_check); + "preferences-advanced", _action, _action_check); evry->action_register(act, 0); @@ -200,7 +200,6 @@ _plugins_shutdown(void) EVRY_ACTION_FREE(act); } - /***************************************************************************/ Eina_Bool @@ -221,3 +220,4 @@ evry_plug_settings_shutdown(void) void evry_plug_settings_save(void){} + diff --git a/src/modules/everything/evry_plug_text.c b/src/modules/everything/evry_plug_text.c index 9f1c715e4..5dfc9eef1 100644 --- a/src/modules/everything/evry_plug_text.c +++ b/src/modules/everything/evry_plug_text.c @@ -4,7 +4,7 @@ typedef struct _Plugin Plugin; struct _Plugin { - Evry_Plugin base; + Evry_Plugin base; }; static Evry_Plugin *p1, *p2; @@ -15,7 +15,7 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it __UNUSED__) Plugin *p; EVRY_PLUGIN_INSTANCE(p, plugin); - + return EVRY_PLUGIN(p); } @@ -23,7 +23,7 @@ static void _finish(Evry_Plugin *plugin) { GET_PLUGIN(p, plugin); - + EVRY_PLUGIN_ITEMS_FREE(p); E_FREE(p); } @@ -32,28 +32,28 @@ static int _fetch(Evry_Plugin *plugin, const char *input) { Evry_Item *it; - + GET_PLUGIN(p, plugin); if (input) { - if (!p->base.items) - { - it = evry_item_new(NULL, EVRY_PLUGIN(p), input, NULL, NULL); - it->fuzzy_match = 999; - EVRY_PLUGIN_ITEM_APPEND(p, it); - } - else - { - it = p->base.items->data; - EVRY_ITEM_LABEL_SET(it, input); - evry_item_changed(it, 0, 0); - } - return 1; + if (!p->base.items) + { + it = evry_item_new(NULL, EVRY_PLUGIN(p), input, NULL, NULL); + it->fuzzy_match = 999; + EVRY_PLUGIN_ITEM_APPEND(p, it); + } + else + { + it = p->base.items->data; + EVRY_ITEM_LABEL_SET(it, input); + evry_item_changed(it, 0, 0); + } + return 1; } EVRY_PLUGIN_ITEMS_FREE(p); - + return 0; } @@ -61,25 +61,25 @@ Eina_Bool evry_plug_text_init(void) { 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", - EVRY_TYPE_TEXT, _begin, _finish, _fetch); + EVRY_TYPE_TEXT, _begin, _finish, _fetch); if (evry_plugin_register(p1, EVRY_PLUGIN_OBJECT, 999)) { - p1->config->trigger = eina_stringshare_add(" "); - p1->config->aggregate = EINA_FALSE; - p1->config->top_level = EINA_FALSE; - p1->config->view_mode = VIEW_MODE_LIST; + p1->config->trigger = eina_stringshare_add(" "); + p1->config->aggregate = EINA_FALSE; + p1->config->top_level = EINA_FALSE; + p1->config->view_mode = VIEW_MODE_LIST; } if (evry_plugin_register(p2, EVRY_PLUGIN_SUBJECT, 999)) { - p2->config->trigger = eina_stringshare_add(" "); - p2->config->aggregate = EINA_FALSE; - p2->config->top_level = EINA_FALSE; - p2->config->view_mode = VIEW_MODE_LIST; + p2->config->trigger = eina_stringshare_add(" "); + p2->config->aggregate = EINA_FALSE; + p2->config->top_level = EINA_FALSE; + p2->config->view_mode = VIEW_MODE_LIST; } return EINA_TRUE; @@ -91,3 +91,4 @@ evry_plug_text_shutdown(void) EVRY_PLUGIN_FREE(p1); EVRY_PLUGIN_FREE(p2); } + diff --git a/src/modules/everything/evry_plug_windows.c b/src/modules/everything/evry_plug_windows.c index c47494f41..be9309191 100644 --- a/src/modules/everything/evry_plug_windows.c +++ b/src/modules/everything/evry_plug_windows.c @@ -1,27 +1,27 @@ #include "e.h" #include "evry_api.h" -#define BORDER_SHOW 1 -#define BORDER_HIDE 2 -#define BORDER_FULLSCREEN 3 -#define BORDER_TODESK 4 -#define BORDER_CLOSE 5 +#define BORDER_SHOW 1 +#define BORDER_HIDE 2 +#define BORDER_FULLSCREEN 3 +#define BORDER_TODESK 4 +#define BORDER_CLOSE 5 -typedef struct _Plugin Plugin; +typedef struct _Plugin Plugin; typedef struct _Border_Item Border_Item; struct _Plugin { - Evry_Plugin base; - Eina_List *borders; - Eina_List *handlers; - const char *input; + Evry_Plugin base; + Eina_List *borders; + Eina_List *handlers; + const char *input; }; struct _Border_Item { - Evry_Item base; - E_Border *border; + Evry_Item base; + E_Border *border; }; 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 _border_item_free(Evry_Item *it) @@ -58,11 +57,11 @@ _border_item_add(Plugin *p, E_Border *bd) return 0; 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", - bd->desk->x, bd->desk->y, - (bd->desktop ? bd->desktop->name : "")); + bd->desk->x, bd->desk->y, + (bd->desktop ? bd->desktop->name : "")); EVRY_ITEM_DETAIL_SET(bi, buf); bi->border = bd; @@ -74,14 +73,14 @@ _border_item_add(Plugin *p, E_Border *bd) } 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; Border_Item *bi; Eina_List *l; Plugin *p = data; - EINA_LIST_FOREACH(p->borders, l, bi) + EINA_LIST_FOREACH (p->borders, l, bi) if (bi->border == ev->border) break; @@ -98,8 +97,9 @@ _cb_border_remove(void *data, __UNUSED__ int type, void *event) return ECORE_CALLBACK_PASS_ON; } + 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; Plugin *p = data; @@ -116,7 +116,6 @@ _cb_border_add(void *data, __UNUSED__ int type, void *event) return ECORE_CALLBACK_PASS_ON; } - static Evry_Plugin * _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); p->handlers = eina_list_append - (p->handlers, ecore_event_handler_add - (E_EVENT_BORDER_REMOVE, _cb_border_remove, p)); + (p->handlers, ecore_event_handler_add + (E_EVENT_BORDER_REMOVE, _cb_border_remove, p)); p->handlers = eina_list_append - (p->handlers, ecore_event_handler_add - (E_EVENT_BORDER_ADD, _cb_border_add, p)); + (p->handlers, ecore_event_handler_add + (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); return EVRY_PLUGIN(p); @@ -152,10 +151,10 @@ _finish(Evry_Plugin *plugin) EVRY_PLUGIN_ITEMS_CLEAR(p); - EINA_LIST_FREE(p->borders, bi) + EINA_LIST_FREE (p->borders, bi) EVRY_ITEM_FREE(bi); - EINA_LIST_FREE(p->handlers, h) + EINA_LIST_FREE (p->handlers, h) ecore_event_handler_del(h); E_FREE(p); @@ -169,14 +168,14 @@ _fetch(Evry_Plugin *plugin, const char *input) EVRY_PLUGIN_ITEMS_CLEAR(p); EVRY_PLUGIN_MIN_QUERY(p, input) - { - IF_RELEASE(p->input); + { + IF_RELEASE(p->input); - if (input) - p->input = eina_stringshare_add(input); + if (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; } @@ -192,58 +191,58 @@ _icon_get(Evry_Item *it, Evas *e) if (bd->internal) { if (!bd->internal_icon) - { - o = e_icon_add(e); - e_util_icon_theme_set(o, "enlightenment"); - } + { + o = e_icon_add(e); + e_util_icon_theme_set(o, "enlightenment"); + } else if (!bd->internal_icon_key) - { - char *ext; - ext = strrchr(bd->internal_icon, '.'); - if ((ext) && ((!strcmp(ext, ".edj")))) - { - o = edje_object_add(e); - if (!edje_object_file_set(o, bd->internal_icon, "icon")) - e_util_icon_theme_set(o, "enlightenment"); - } - else if (ext) - { - o = e_icon_add(e); - e_icon_file_set(o, bd->internal_icon); - } - else - { - o = e_icon_add(e); - e_icon_scale_size_set(o, 128); - if (!e_util_icon_theme_set(o, bd->internal_icon)) - e_util_icon_theme_set(o, "enlightenment"); - } - } - else - { - o = edje_object_add(e); - edje_object_file_set(o, bd->internal_icon, bd->internal_icon_key); - } + { + char *ext; + ext = strrchr(bd->internal_icon, '.'); + if ((ext) && ((!strcmp(ext, ".edj")))) + { + o = edje_object_add(e); + if (!edje_object_file_set(o, bd->internal_icon, "icon")) + e_util_icon_theme_set(o, "enlightenment"); + } + else if (ext) + { + o = e_icon_add(e); + e_icon_file_set(o, bd->internal_icon); + } + else + { + o = e_icon_add(e); + e_icon_scale_size_set(o, 128); + if (!e_util_icon_theme_set(o, bd->internal_icon)) + e_util_icon_theme_set(o, "enlightenment"); + } + } + else + { + o = edje_object_add(e); + edje_object_file_set(o, bd->internal_icon, bd->internal_icon_key); + } - return o; + return o; } if (bd->client.netwm.icons) { - if (e_config->use_app_icon) - goto _use_netwm_icon; + if (e_config->use_app_icon) + goto _use_netwm_icon; - if (bd->remember && (bd->remember->prop.icon_preference == E_ICON_PREF_NETWM)) - goto _use_netwm_icon; + if (bd->remember && (bd->remember->prop.icon_preference == E_ICON_PREF_NETWM)) + goto _use_netwm_icon; } if (bd->desktop) { 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) { int i, size, tmp, found = 0; @@ -276,7 +275,6 @@ _icon_get(Evry_Item *it, Evas *e) return o; } - /***************************************************************************/ static int @@ -290,36 +288,36 @@ _check_border(Evry_Action *act, const Evry_Item *it) if (!bd) { - ERR("no border"); - return 0; + ERR("no border"); + return 0; } switch (action) { case BORDER_CLOSE: - if (bd->lock_close) - return 0; - break; + if (bd->lock_close) + return 0; + break; case BORDER_SHOW: - if (bd->lock_focus_in) - return 0; - break; + if (bd->lock_focus_in) + return 0; + break; case BORDER_HIDE: - if (bd->lock_user_iconify) - return 0; - break; + if (bd->lock_user_iconify) + return 0; + break; case BORDER_FULLSCREEN: - if (!bd->lock_user_fullscreen) - return 0; - break; + if (!bd->lock_user_fullscreen) + return 0; + break; case BORDER_TODESK: - if (bd->desk == (e_desk_current_get(zone))) - return 0; - break; + if (bd->desk == (e_desk_current_get(zone))) + return 0; + break; } return 1; @@ -337,77 +335,78 @@ _act_border(Evry_Action *act) if (!bd) { - ERR("no border"); - return 0; + ERR("no border"); + return 0; } switch (action) { case BORDER_CLOSE: - e_border_act_close_begin(bd); - break; + e_border_act_close_begin(bd); + break; case BORDER_SHOW: - if (bd->desk != (e_desk_current_get(zone))) - e_desk_show(bd->desk); - focus = 1; - break; + if (bd->desk != (e_desk_current_get(zone))) + e_desk_show(bd->desk); + focus = 1; + break; case BORDER_HIDE: - e_border_iconify(bd); - break; + e_border_iconify(bd); + break; case BORDER_FULLSCREEN: - if (!bd->fullscreen) - e_border_fullscreen(bd, E_FULLSCREEN_RESIZE); - else - e_border_unfullscreen(bd); - break; + if (!bd->fullscreen) + e_border_fullscreen(bd, E_FULLSCREEN_RESIZE); + else + e_border_unfullscreen(bd); + break; case BORDER_TODESK: - if (bd->desk != (e_desk_current_get(zone))) - e_border_desk_set(bd, e_desk_current_get(zone)); - focus = 1; - break; + if (bd->desk != (e_desk_current_get(zone))) + e_border_desk_set(bd, e_desk_current_get(zone)); + focus = 1; + break; + default: - break; + break; } if (focus) { - if (bd->shaded) - e_border_unshade(bd, E_DIRECTION_UP); + if (bd->shaded) + e_border_unshade(bd, E_DIRECTION_UP); - if (bd->iconic) - e_border_uniconify(bd); - else - e_border_raise(bd); + if (bd->iconic) + e_border_uniconify(bd); + else + e_border_raise(bd); - if (!bd->lock_focus_out) - { - e_border_focus_set(bd, 1, 1); - e_border_focus_latest_set(bd); - } + if (!bd->lock_focus_out) + { + e_border_focus_set(bd, 1, 1); + e_border_focus_latest_set(bd); + } - if ((e_config->focus_policy != E_FOCUS_CLICK) || - (e_config->winlist_warp_at_end) || - (e_config->winlist_warp_while_selecting)) - { - int warp_to_x = bd->x + (bd->w / 2); - if (warp_to_x < (bd->zone->x + 1)) - 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)) - warp_to_x = (bd->zone->x + bd->zone->w + bd->x) / 2; + if ((e_config->focus_policy != E_FOCUS_CLICK) || + (e_config->winlist_warp_at_end) || + (e_config->winlist_warp_while_selecting)) + { + int warp_to_x = bd->x + (bd->w / 2); + if (warp_to_x < (bd->zone->x + 1)) + 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)) + warp_to_x = (bd->zone->x + bd->zone->w + bd->x) / 2; - int warp_to_y = bd->y + (bd->h / 2); - if (warp_to_y < (bd->zone->y + 1)) - 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)) - warp_to_y = (bd->zone->y + bd->zone->h + bd->y) / 2; + int warp_to_y = bd->y + (bd->h / 2); + if (warp_to_y < (bd->zone->y + 1)) + 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)) + 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); - } - /* e_border_focus_set_with_pointer(bd); */ + ecore_x_pointer_warp(bd->zone->container->win, warp_to_x, warp_to_y); + } + /* e_border_focus_set_with_pointer(bd); */ } return 1; @@ -424,42 +423,42 @@ _plugins_init(const Evry_API *_api) return EINA_FALSE; _plug = EVRY_PLUGIN_BASE("Windows", "preferences-system-windows", - EVRY_TYPE_BORDER, _begin, _finish, _fetch); + EVRY_TYPE_BORDER, _begin, _finish, _fetch); _plug->transient = EINA_TRUE; evry->plugin_register(_plug, EVRY_PLUGIN_SUBJECT, 2); act = EVRY_ACTION_NEW("Switch to Window", - EVRY_TYPE_BORDER, 0, "go-next", - _act_border, _check_border); + EVRY_TYPE_BORDER, 0, "go-next", + _act_border, _check_border); EVRY_ITEM_DATA_INT_SET(act, BORDER_SHOW); evry->action_register(act, 1); _actions = eina_list_append(_actions, act); act = EVRY_ACTION_NEW("Iconify", - EVRY_TYPE_BORDER, 0, "go-down", - _act_border, _check_border); + EVRY_TYPE_BORDER, 0, "go-down", + _act_border, _check_border); EVRY_ITEM_DATA_INT_SET(act, BORDER_HIDE); _actions = eina_list_append(_actions, act); evry->action_register(act, 2); act = EVRY_ACTION_NEW("Toggle Fullscreen", - EVRY_TYPE_BORDER, 0, "view-fullscreen", - _act_border, _check_border); + EVRY_TYPE_BORDER, 0, "view-fullscreen", + _act_border, _check_border); EVRY_ITEM_DATA_INT_SET(act, BORDER_FULLSCREEN); _actions = eina_list_append(_actions, act); evry->action_register(act, 4); act = EVRY_ACTION_NEW("Close", - EVRY_TYPE_BORDER, 0, "list-remove", - _act_border, _check_border); + EVRY_TYPE_BORDER, 0, "list-remove", + _act_border, _check_border); EVRY_ITEM_DATA_INT_SET(act, BORDER_CLOSE); _actions = eina_list_append(_actions, act); evry->action_register(act, 3); act = EVRY_ACTION_NEW("Send to Desktop", - EVRY_TYPE_BORDER, 0, "go-previous", - _act_border, _check_border); + EVRY_TYPE_BORDER, 0, "go-previous", + _act_border, _check_border); EVRY_ITEM_DATA_INT_SET(act, BORDER_TODESK); _actions = eina_list_append(_actions, act); evry->action_register(act, 3); @@ -474,7 +473,7 @@ _plugins_shutdown(void) EVRY_PLUGIN_FREE(_plug); - EINA_LIST_FREE(_actions, act) + EINA_LIST_FREE (_actions, act) EVRY_ACTION_FREE(act); } @@ -496,3 +495,4 @@ evry_plug_windows_shutdown(void) void evry_plug_windows_save(void){} + diff --git a/src/modules/everything/evry_plugin.c b/src/modules/everything/evry_plugin.c index 0e8a8e288..147a5d25f 100644 --- a/src/modules/everything/evry_plugin.c +++ b/src/modules/everything/evry_plugin.c @@ -13,11 +13,10 @@ evry_plugins_shutdown(void) { Evry_Action *act; - EINA_LIST_FREE(actions, act) + EINA_LIST_FREE (actions, act) evry_action_free(act); } - static int _evry_cb_plugin_sort(const void *data1, const void *data2) { @@ -46,11 +45,11 @@ _evry_plugin_free(Evry_Item *it) Evry_Plugin * evry_plugin_new(Evry_Plugin *base, const char *name, const char *label, - const char *icon, Evry_Type item_type, - Evry_Plugin *(*begin) (Evry_Plugin *p, const Evry_Item *item), - void (*finish) (Evry_Plugin *p), - int (*fetch) (Evry_Plugin *p, const char *input), - void (*cb_free) (Evry_Plugin *p)) + const char *icon, Evry_Type item_type, + Evry_Plugin *(*begin)(Evry_Plugin * p, const Evry_Item * item), + void (*finish)(Evry_Plugin *p), + int (*fetch)(Evry_Plugin *p, const char *input), + void (*cb_free)(Evry_Plugin *p)) { Evry_Plugin *p; 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->plugin = p; it->browseable = EINA_TRUE; - it->type = EVRY_TYPE_PLUGIN; + it->type = EVRY_TYPE_PLUGIN; if (item_type) it->subtype = item_type; if (icon) it->icon = eina_stringshare_add(icon); - p->name = eina_stringshare_add(name); - p->begin = begin; + p->name = eina_stringshare_add(name); + p->begin = begin; p->finish = finish; - p->fetch = fetch; + p->fetch = fetch; p->async_fetch = EINA_FALSE; - p->history = EINA_TRUE; + p->history = EINA_TRUE; p->free = cb_free; @@ -107,10 +106,10 @@ _evry_plugin_action_browse(Evry_Action *act) if ((p = pp->begin(pp, it))) { - plugins = eina_list_append(plugins, p); + plugins = eina_list_append(plugins, p); - if (!evry_state_push(sel, plugins)) - eina_list_free(plugins); + if (!evry_state_push(sel, plugins)) + eina_list_free(plugins); } return 0; @@ -134,37 +133,37 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority) else if (type == EVRY_PLUGIN_OBJECT) 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)) break; /* check if module of same name is already loaded */ /* if ((pc) && (pc->plugin)) * return 0; */ - + /* collection plugin sets its own config */ if (!pc && p->config) { - conf = eina_list_append(conf, p->config); - pc = p->config; + conf = eina_list_append(conf, p->config); + pc = p->config; } else if (!pc) { - new_conf = 1; - pc = E_NEW(Plugin_Config, 1); - pc->name = eina_stringshare_add(p->name); - pc->enabled = 1; - pc->priority = priority ? priority : 100; - pc->view_mode = VIEW_MODE_NONE; - pc->aggregate = EINA_TRUE; - pc->top_level = EINA_TRUE; + new_conf = 1; + pc = E_NEW(Plugin_Config, 1); + pc->name = eina_stringshare_add(p->name); + pc->enabled = 1; + pc->priority = priority ? priority : 100; + pc->view_mode = VIEW_MODE_NONE; + pc->aggregate = 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) { - eina_stringshare_del(pc->trigger); - pc->trigger = NULL; + eina_stringshare_del(pc->trigger); + pc->trigger = NULL; } p->config = pc; @@ -178,28 +177,28 @@ evry_plugin_register(Evry_Plugin *p, int type, int priority) evry_conf->conf_actions = conf; else if (type == EVRY_PLUGIN_OBJECT) evry_conf->conf_objects = conf; - + if ((type == EVRY_PLUGIN_SUBJECT) && (p->name && strcmp(p->name, "All"))) { - char buf[256]; - snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name); + char buf[256]; + snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name); - e_action_predef_name_set(_("Everything Launcher"), buf, - "everything", p->name, NULL, 1); + e_action_predef_name_set(_("Everything Launcher"), buf, + "everything", p->name, NULL, 1); } if (p->input_type) { - Evry_Action *act; - char buf[256]; - snprintf(buf, sizeof(buf), _("Browse %s"), EVRY_ITEM(p)->label); + Evry_Action *act; + char buf[256]; + snprintf(buf, sizeof(buf), _("Browse %s"), EVRY_ITEM(p)->label); - act = EVRY_ACTION_NEW(buf, p->input_type, 0, EVRY_ITEM(p)->icon, - _evry_plugin_action_browse, NULL); - EVRY_ITEM(act)->icon_get = EVRY_ITEM(p)->icon_get; - EVRY_ITEM(act)->data = p; - evry_action_register(act, 1); - actions = eina_list_append(actions, act); + act = EVRY_ACTION_NEW(buf, p->input_type, 0, EVRY_ITEM(p)->icon, + _evry_plugin_action_browse, NULL); + EVRY_ITEM(act)->icon_get = EVRY_ITEM(p)->icon_get; + EVRY_ITEM(act)->data = p; + evry_action_register(act, 1); + actions = eina_list_append(actions, act); } return new_conf; @@ -213,10 +212,10 @@ evry_plugin_unregister(Evry_Plugin *p) if (l && eina_list_data_find_list(l, p->config)) { - char buf[256]; - snprintf(buf, sizeof(buf), _("Show %s Plugin"), p->name); + char buf[256]; + 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; 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->name == n) - break; + if (!pc->plugin) continue; + if (pc->name == n) + break; } eina_stringshare_del(n); @@ -240,3 +239,4 @@ evry_plugin_find(const char *name) return pc->plugin; } + diff --git a/src/modules/everything/evry_util.c b/src/modules/everything/evry_util.c index 7b35c710f..310098a19 100644 --- a/src/modules/everything/evry_util.c +++ b/src/modules/everything/evry_util.c @@ -1,10 +1,10 @@ #include "e_mod_main.h" #include "md5.h" -#define MAX_FUZZ 100 +#define MAX_FUZZ 100 #define MAX_WORDS 5 -static const char *home_dir = NULL; +static const char *home_dir = NULL; static int home_dir_len; static char dir_buf[1024]; static char thumb_buf[4096]; @@ -20,8 +20,8 @@ evry_util_file_detail_set(Evry_Item_File *file) if (!home_dir) { - home_dir = e_user_homedir_get(); - home_dir_len = strlen(home_dir); + home_dir = e_user_homedir_get(); + home_dir_len = strlen(home_dir); } dir = ecore_file_dir_get(file->path); @@ -29,21 +29,21 @@ evry_util_file_detail_set(Evry_Item_File *file) if (!strncmp(dir, home_dir, home_dir_len)) { - tmp = dir + home_dir_len; + tmp = dir + home_dir_len; - if (*(tmp) == '\0') - snprintf(dir_buf, sizeof(dir_buf), "~%s", tmp); - else - snprintf(dir_buf, sizeof(dir_buf), "~%s/", tmp); + if (*(tmp) == '\0') + snprintf(dir_buf, sizeof(dir_buf), "~%s", tmp); + else + snprintf(dir_buf, sizeof(dir_buf), "~%s/", tmp); - EVRY_ITEM(file)->detail = eina_stringshare_add(dir_buf); + EVRY_ITEM(file)->detail = eina_stringshare_add(dir_buf); } else { - if (!strncmp(dir, "//", 2)) - EVRY_ITEM(file)->detail = eina_stringshare_add(dir + 1); - else - EVRY_ITEM(file)->detail = eina_stringshare_add(dir); + if (!strncmp(dir, "//", 2)) + EVRY_ITEM(file)->detail = eina_stringshare_add(dir + 1); + else + EVRY_ITEM(file)->detail = eina_stringshare_add(dir); } E_FREE(dir); @@ -73,15 +73,15 @@ evry_fuzzy_match(const char *str, const char *match) return 0; /* remove white spaces at the beginning */ - for (; (*match != 0) && isspace(*match); match++); - for (; (*str != 0) && isspace(*str); str++); + for (; (*match != 0) && isspace(*match); match++) ; + for (; (*str != 0) && isspace(*str); str++) ; /* count words in match */ - for (m = match; (*m != 0) && (m_num < MAX_WORDS);) + for (m = match; (*m != 0) && (m_num < MAX_WORDS); ) { - for (; (*m != 0) && !isspace(*m); m++); - for (; (*m != 0) && isspace(*m); m++); - m_min[m_num++] = MAX_FUZZ; + for (; (*m != 0) && !isspace(*m); m++) ; + for (; (*m != 0) && isspace(*m); m++) ; + m_min[m_num++] = MAX_FUZZ; } for (m = match; ip && (*m != 0); m++) if (ip && ispunct(*m)) ip = 0; @@ -94,128 +94,128 @@ evry_fuzzy_match(const char *str, const char *match) next = str; m = match; - while((m_cnt < m_num) && (*next != 0)) + while ((m_cnt < m_num) && (*next != 0)) { - /* reset match */ - if (m_cnt == 0) m = match; + /* reset match */ + if (m_cnt == 0) m = match; - /* end of matching */ - if (*m == 0) break; + /* end of matching */ + if (*m == 0) break; - offset = 0; - last = 0; - min = 1; - first = 0; - /* m_len = 0; */ + offset = 0; + last = 0; + min = 1; + first = 0; + /* m_len = 0; */ - /* match current word of string against current match */ - for (p = next; *next != 0; p++) - { - /* new word of string begins */ - if ((*p == 0) || isspace(*p) || (ip && ispunct(*p))) - { - if (m_cnt < m_num - 1) - { - /* test next match */ - for (; (*m != 0) && !isspace(*m); m++); - for (; (*m != 0) && isspace(*m); m++); - m_cnt++; - break; - } - else - { - /* go to next word */ - for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++); - cnt++; - next = p; - m_cnt = 0; - break; - } - } + /* match current word of string against current match */ + for (p = next; *next != 0; p++) + { + /* new word of string begins */ + if ((*p == 0) || isspace(*p) || (ip && ispunct(*p))) + { + if (m_cnt < m_num - 1) + { + /* test next match */ + for (; (*m != 0) && !isspace(*m); m++) ; + for (; (*m != 0) && isspace(*m); m++) ; + m_cnt++; + break; + } + else + { + /* go to next word */ + for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++) ; + cnt++; + next = p; + m_cnt = 0; + break; + } + } - /* current char matches? */ - if (tolower(*p) != tolower(*m)) - { - if (!first) - offset += 1; - else - offset += 3; + /* current char matches? */ + if (tolower(*p) != tolower(*m)) + { + if (!first) + offset += 1; + else + offset += 3; - /* m_len++; */ + /* m_len++; */ - if (offset <= m_len * 3) - continue; - } + if (offset <= m_len * 3) + continue; + } - if (min < MAX_FUZZ && offset <= m_len * 3) - { - /* first offset of match in word */ - if (!first) - { - first = 1; - last = offset; - } + if (min < MAX_FUZZ && offset <= m_len * 3) + { + /* first offset of match in word */ + if (!first) + { + first = 1; + last = offset; + } - min += offset + (offset - last) * 5; - last = offset; + min += offset + (offset - last) * 5; + last = offset; - /* try next char of match */ - if (*(++m) != 0 && !isspace(*m)) - continue; + /* try next char of match */ + if (*(++m) != 0 && !isspace(*m)) + continue; - /* end of match: store min weight of match */ - min += (cnt - m_cnt) > 0 ? (cnt - m_cnt) : 0; + /* end of match: store min weight of match */ + min += (cnt - m_cnt) > 0 ? (cnt - m_cnt) : 0; - if (min < m_min[m_cnt]) - m_min[m_cnt] = min; - } - else - { - /* go to next match */ - for (; (*m != 0) && !isspace(*m); m++); - } + if (min < m_min[m_cnt]) + m_min[m_cnt] = min; + } + else + { + /* go to next match */ + for (; (*m != 0) && !isspace(*m); m++) ; + } - if (m_cnt < m_num - 1) - { - /* test next match */ - for (; (*m != 0) && isspace(*m); m++); - m_cnt++; - break; - } - else if(*p != 0) - { - /* go to next word */ - for (; (*p != 0) && !((isspace(*p) || (ip && ispunct(*p)))); p++); - for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++); - cnt++; - next = p; - m_cnt = 0; - break; - } - else - { - next = p; - break; - } - } + if (m_cnt < m_num - 1) + { + /* test next match */ + for (; (*m != 0) && isspace(*m); m++) ; + m_cnt++; + break; + } + else if (*p != 0) + { + /* go to next word */ + for (; (*p != 0) && !((isspace(*p) || (ip && ispunct(*p)))); p++) ; + for (; (*p != 0) && ((isspace(*p) || (ip && ispunct(*p)))); p++) ; + cnt++; + next = p; + m_cnt = 0; + break; + } + else + { + next = p; + break; + } + } } for (m_cnt = 0; m_cnt < m_num; m_cnt++) { - sum += m_min[m_cnt]; + sum += m_min[m_cnt]; - if (sum >= MAX_FUZZ) - { - sum = 0; - break; - } + if (sum >= MAX_FUZZ) + { + sum = 0; + break; + } } if (sum > 0) { - /* exact match ? */ - if (strcmp(match, str)) - sum += 10; + /* exact match ? */ + if (strcmp(match, str)) + sum += 10; } return sum; @@ -228,18 +228,18 @@ _evry_fuzzy_match_sort_cb(const void *data1, const void *data2) const Evry_Item *it2 = data2; if (it1->priority - it2->priority) - return (it1->priority - it2->priority); + return it1->priority - it2->priority; 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) - return 1; + if (!it1->fuzzy_match && it2->fuzzy_match) + return 1; - if (it1->fuzzy_match - it2->fuzzy_match) - return (it1->fuzzy_match - it2->fuzzy_match); + if (it1->fuzzy_match - it2->fuzzy_match) + return it1->fuzzy_match - it2->fuzzy_match; } return 0; @@ -251,7 +251,6 @@ evry_fuzzy_match_sort(Eina_List *items) return eina_list_sort(items, -1, _evry_fuzzy_match_sort_cb); } - static int _sort_flags = 0; static int @@ -264,98 +263,98 @@ _evry_items_sort_func(const void *data1, const void *data2) * (it1->type == EVRY_TYPE_ACTION) && * (it2->type == EVRY_TYPE_ACTION))) * { */ - /* only sort actions when there is input otherwise show default order */ + /* only sort actions when there is input otherwise show default order */ - if (((it1->type == EVRY_TYPE_ACTION) || (it1->subtype == EVRY_TYPE_ACTION)) && - ((it2->type == EVRY_TYPE_ACTION) || (it2->subtype == EVRY_TYPE_ACTION))) - { - const Evry_Action *act1 = data1; - const Evry_Action *act2 = data2; + if (((it1->type == EVRY_TYPE_ACTION) || (it1->subtype == EVRY_TYPE_ACTION)) && + ((it2->type == EVRY_TYPE_ACTION) || (it2->subtype == EVRY_TYPE_ACTION))) + { + const Evry_Action *act1 = data1; + const Evry_Action *act2 = data2; - /* sort actions that match the specific type before - those matching general type */ - if (act1->it1.item && act2->it1.item) - { - if ((act1->it1.type == act1->it1.item->type) && - (act2->it1.type != act2->it1.item->type)) - return -1; + /* sort actions that match the specific type before + those matching general type */ + if (act1->it1.item && act2->it1.item) + { + if ((act1->it1.type == act1->it1.item->type) && + (act2->it1.type != act2->it1.item->type)) + return -1; - if ((act1->it1.type != act1->it1.item->type) && - (act2->it1.type == act2->it1.item->type)) - return 1; - } + if ((act1->it1.type != act1->it1.item->type) && + (act2->it1.type == act2->it1.item->type)) + return 1; + } + + /* sort context specific actions before + general actions */ + if (act1->remember_context) + { + if (!act2->remember_context) + return -1; + } + else + { + if (act2->remember_context) + return 1; + } + } + /* } */ - /* sort context specific actions before - general actions */ - if (act1->remember_context) - { - if (!act2->remember_context) - return -1; - } - else - { - if (act2->remember_context) - return 1; - } - } - /* } */ - if (_sort_flags) { - /* when there is no input sort items with higher - * plugin priority first */ - if (it1->type != EVRY_TYPE_ACTION && - it2->type != EVRY_TYPE_ACTION) - { - int prio1 = it1->plugin->config->priority; - int prio2 = it2->plugin->config->priority; + /* when there is no input sort items with higher + * plugin priority first */ + if (it1->type != EVRY_TYPE_ACTION && + it2->type != EVRY_TYPE_ACTION) + { + int prio1 = it1->plugin->config->priority; + int prio2 = it2->plugin->config->priority; - if (prio1 - prio2) - return (prio1 - prio2); - } + if (prio1 - prio2) + return prio1 - prio2; + } } - + /* sort items which match input or which match much better first */ if (it1->fuzzy_match > 0 || it2->fuzzy_match > 0) { - if (it2->fuzzy_match <= 0) - return -1; + if (it2->fuzzy_match <= 0) + return -1; - if (it1->fuzzy_match <= 0) - return 1; + if (it1->fuzzy_match <= 0) + return 1; - if (abs (it1->fuzzy_match - it2->fuzzy_match) > 5) - return (it1->fuzzy_match - it2->fuzzy_match); + if (abs (it1->fuzzy_match - it2->fuzzy_match) > 5) + return it1->fuzzy_match - it2->fuzzy_match; } /* sort recently/most frequently used items first */ if (it1->usage > 0.0 || it2->usage > 0.0) { - return (it1->usage > it2->usage ? -1 : 1); + return it1->usage > it2->usage ? -1 : 1; } /* sort items which match input better first */ if (it1->fuzzy_match > 0 || it2->fuzzy_match > 0) { - if (it1->fuzzy_match - it2->fuzzy_match) - return (it1->fuzzy_match - it2->fuzzy_match); + if (it1->fuzzy_match - it2->fuzzy_match) + return it1->fuzzy_match - it2->fuzzy_match; } /* sort itemswith higher priority first */ if ((it1->plugin == it2->plugin) && (it1->priority - it2->priority)) - return (it1->priority - it2->priority); + return it1->priority - it2->priority; /* sort items with higher plugin priority first */ if (it1->type != EVRY_TYPE_ACTION && it2->type != EVRY_TYPE_ACTION) { - int prio1 = it1->plugin->config->priority; - int prio2 = it2->plugin->config->priority; + int prio1 = it1->plugin->config->priority; + int prio2 = it2->plugin->config->priority; - if (prio1 - prio2) - return (prio1 - prio2); + if (prio1 - prio2) + return prio1 - prio2; } return strcasecmp(it1->label, it2->label); @@ -365,43 +364,43 @@ void evry_util_items_sort(Eina_List **items, int flags) { _sort_flags = flags; - *items = eina_list_sort(*items, -1, _evry_items_sort_func); + *items = eina_list_sort(*items, -1, _evry_items_sort_func); _sort_flags = 0; } int evry_util_plugin_items_add(Evry_Plugin *p, Eina_List *items, const char *input, - int match_detail, int set_usage) + int match_detail, int set_usage) { Eina_List *l; Evry_Item *it; int match = 0; - EINA_LIST_FOREACH(items, l, it) + EINA_LIST_FOREACH (items, l, it) { - it->fuzzy_match = 0; + it->fuzzy_match = 0; - if (set_usage) - evry_history_item_usage_set(it, input, NULL); + if (set_usage) + evry_history_item_usage_set(it, input, NULL); - if (!input) - { - p->items = eina_list_append(p->items, it); - continue; - } + if (!input) + { + p->items = eina_list_append(p->items, it); + continue; + } - it->fuzzy_match = evry_fuzzy_match(it->label, input); + it->fuzzy_match = evry_fuzzy_match(it->label, input); - if (match_detail) - { - match = evry_fuzzy_match(it->detail, input); + if (match_detail) + { + match = evry_fuzzy_match(it->detail, input); - if (!(it->fuzzy_match) || (match && (match < it->fuzzy_match))) - it->fuzzy_match = match; - } + if (!(it->fuzzy_match) || (match && (match < it->fuzzy_match))) + it->fuzzy_match = match; + } - if (it->fuzzy_match) - p->items = eina_list_append(p->items, it); + if (it->fuzzy_match) + p->items = eina_list_append(p->items, it); } p->items = eina_list_sort(p->items, -1, _evry_items_sort_func); @@ -416,29 +415,28 @@ evry_icon_theme_get(const char *icon, Evas *e) if (!icon) return NULL; - + o = e_icon_add(e); - e_icon_scale_size_set(o, 128); + e_icon_scale_size_set(o, 128); e_icon_preload_set(o, 1); if (icon[0] == '/') { - if (!e_icon_file_set(o, icon)) - { - evas_object_del(o); - o = NULL; - } + if (!e_icon_file_set(o, icon)) + { + evas_object_del(o); + o = NULL; + } } else if (!e_util_icon_theme_set(o, icon)) { - evas_object_del(o); - o = NULL; + evas_object_del(o); + o = NULL; } - + return o; } - Evas_Object * evry_util_icon_get(Evry_Item *it, Evas *e) { @@ -458,63 +456,63 @@ evry_util_icon_get(Evry_Item *it, Evas *e) if (CHECK_TYPE(it, EVRY_TYPE_FILE)) { - const char *icon; - char *sum; - - GET_FILE(file, it); + const char *icon; + char *sum; - if (it->browseable) + GET_FILE(file, it); + + if (it->browseable) { o = evry_icon_theme_get("folder", e); if (o) return o; } - - if ((!it->icon) && (file->mime) && - (/*(!strncmp(file->mime, "image/", 6)) || */ - (!strncmp(file->mime, "video/", 6)) || - (!strncmp(file->mime, "application/pdf", 15))) && - (evry_file_url_get(file))) - { - sum = evry_util_md5_sum(file->url); - snprintf(thumb_buf, sizeof(thumb_buf), - "%s/.thumbnails/normal/%s.png", - e_user_homedir_get(), sum); - free(sum); + if ((!it->icon) && (file->mime) && + ( /*(!strncmp(file->mime, "image/", 6)) || */ + (!strncmp(file->mime, "video/", 6)) || + (!strncmp(file->mime, "application/pdf", 15))) && + (evry_file_url_get(file))) + { + sum = evry_util_md5_sum(file->url); - if ((o = evry_icon_theme_get(thumb_buf, e))) - { - it->icon = eina_stringshare_add(thumb_buf); - return o; - } - } + snprintf(thumb_buf, sizeof(thumb_buf), + "%s/.thumbnails/normal/%s.png", + e_user_homedir_get(), sum); + free(sum); - if ((!it->icon) && (file->mime)) - { - icon = efreet_mime_type_icon_get(file->mime, e_config->icon_theme, 128); - /* XXX can do _ref ?*/ - if ((o = evry_icon_theme_get(icon, e))) - { - /* it->icon = eina_stringshare_add(icon); */ - return o; - } - } + if ((o = evry_icon_theme_get(thumb_buf, e))) + { + it->icon = eina_stringshare_add(thumb_buf); + return o; + } + } - if ((icon = efreet_mime_type_icon_get("unknown", e_config->icon_theme, 128))) - it->icon = eina_stringshare_add(icon); - else - it->icon = eina_stringshare_add(""); + if ((!it->icon) && (file->mime)) + { + icon = efreet_mime_type_icon_get(file->mime, e_config->icon_theme, 128); + /* XXX can do _ref ?*/ + if ((o = evry_icon_theme_get(icon, e))) + { + /* it->icon = eina_stringshare_add(icon); */ + return o; + } + } + + if ((icon = efreet_mime_type_icon_get("unknown", e_config->icon_theme, 128))) + it->icon = eina_stringshare_add(icon); + else + it->icon = eina_stringshare_add(""); } - + if (CHECK_TYPE(it, EVRY_TYPE_APP)) { - GET_APP(app, it); - - o = e_util_desktop_icon_add(app->desktop, 128, e); - if (o) return o; - - o = evry_icon_theme_get("system-run", e); - if (o) return o; + GET_APP(app, it); + + o = e_util_desktop_icon_add(app->desktop, 128, e); + if (o) return o; + + o = evry_icon_theme_get("system-run", e); + if (o) return o; } if (it->icon) @@ -549,79 +547,79 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file) if (app->desktop) { - if (file && evry_file_path_get(file)) - { - Eina_List *l; - char *mime; - int open_folder = 0; + if (file && evry_file_path_get(file)) + { + Eina_List *l; + char *mime; + int open_folder = 0; - /* when the file is no a directory and the app - opens folders, pass only the dir */ - if (!IS_BROWSEABLE(file)) - { - EINA_LIST_FOREACH(app->desktop->mime_types, l, mime) - { - if (!mime) - continue; + /* when the file is no a directory and the app + opens folders, pass only the dir */ + if (!IS_BROWSEABLE(file)) + { + EINA_LIST_FOREACH (app->desktop->mime_types, l, mime) + { + if (!mime) + continue; - if (!strcmp(mime, "x-directory/normal")) - open_folder = 1; + if (!strcmp(mime, "x-directory/normal")) + open_folder = 1; - if (file->mime && !strcmp(mime, file->mime)) - { - open_folder = 0; - break; - } - } - } + if (file->mime && !strcmp(mime, file->mime)) + { + open_folder = 0; + break; + } + } + } - if (open_folder) - { - tmp = ecore_file_dir_get(file->path); - files = eina_list_append(files, tmp); - } - else - { - files = eina_list_append(files, file->path); - } + if (open_folder) + { + tmp = ecore_file_dir_get(file->path); + files = eina_list_append(files, tmp); + } + else + { + files = eina_list_append(files, file->path); + } - e_exec(zone, app->desktop, NULL, files, NULL); + e_exec(zone, app->desktop, NULL, files, NULL); - if (file && file->mime && !open_folder) - e_exehist_mime_desktop_add(file->mime, app->desktop); + if (file && file->mime && !open_folder) + e_exehist_mime_desktop_add(file->mime, app->desktop); - if (files) - eina_list_free(files); + if (files) + eina_list_free(files); - E_FREE(tmp); - } - else if (app->file) - { - files = eina_list_append(files, app->file); - e_exec(zone, app->desktop, NULL, files, NULL); - eina_list_free(files); - } - else - { - e_exec(zone, app->desktop, NULL, NULL, NULL); - } + E_FREE(tmp); + } + else if (app->file) + { + files = eina_list_append(files, app->file); + e_exec(zone, app->desktop, NULL, files, NULL); + eina_list_free(files); + } + else + { + e_exec(zone, app->desktop, NULL, NULL, NULL); + } } else if (app->file) { - if (file && evry_file_path_get(file)) - { - int len; - len = strlen(app->file) + strlen(file->path) + 4; - exe = malloc(len); - snprintf(exe, len, "%s \'%s\'", app->file, file->path); - e_exec(zone, NULL, exe, NULL, NULL); - E_FREE(exe); - } - else - { - exe = (char *) app->file; - e_exec(zone, NULL, exe, NULL, NULL); - } + if (file && evry_file_path_get(file)) + { + int len; + len = strlen(app->file) + strlen(file->path) + 4; + exe = malloc(len); + snprintf(exe, len, "%s \'%s\'", app->file, file->path); + e_exec(zone, NULL, exe, NULL, NULL); + E_FREE(exe); + } + else + { + exe = (char *)app->file; + e_exec(zone, NULL, exe, NULL, NULL); + } } return 1; @@ -637,44 +635,44 @@ evry_util_exec_app(const Evry_Item *it_app, const Evry_Item *it_file) * If length == 0, the length is assumed to be strlen(string). * If olen == NULL, no output length is stored. */ -#define ISXDIGIT(x) (isxdigit((int) ((unsigned char)x))) +#define ISXDIGIT(x) (isxdigit((int)((unsigned char)x))) char * evry_util_url_unescape(const char *string, int length) { - int alloc = (length?length:(int)strlen(string))+1; + int alloc = (length ? length : (int)strlen(string)) + 1; char *ns = malloc(alloc); unsigned char in; - int strindex=0; + int strindex = 0; unsigned long hex; - if( !ns ) + if ( !ns ) return NULL; - while(--alloc > 0) + while (--alloc > 0) { - in = *string; - if(('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) - { - /* this is two hexadecimal digits following a '%' */ - char hexstr[3]; - char *ptr; - hexstr[0] = string[1]; - hexstr[1] = string[2]; - hexstr[2] = 0; + in = *string; + if (('%' == in) && ISXDIGIT(string[1]) && ISXDIGIT(string[2])) + { + /* this is two hexadecimal digits following a '%' */ + char hexstr[3]; + char *ptr; + hexstr[0] = string[1]; + hexstr[1] = string[2]; + hexstr[2] = 0; - hex = strtoul(hexstr, &ptr, 16); - in = (unsigned char)(hex & (unsigned long) 0xFF); - // in = ultouc(hex); /* this long is never bigger than 255 anyway */ + hex = strtoul(hexstr, &ptr, 16); + in = (unsigned char)(hex & (unsigned long)0xFF); + // in = ultouc(hex); /* this long is never bigger than 255 anyway */ - string+=2; - alloc-=2; - } + string += 2; + alloc -= 2; + } - ns[strindex++] = in; - string++; + ns[strindex++] = in; + string++; } - ns[strindex]=0; /* terminate it */ + ns[strindex] = 0; /* terminate it */ return ns; } @@ -686,21 +684,72 @@ _isalnum(unsigned char in) { switch (in) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': case 'g': case 'h': case 'i': case 'j': - case 'k': case 'l': case 'm': case 'n': case 'o': - case 'p': case 'q': case 'r': case 's': case 't': - case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': - case 'A': case 'B': case 'C': case 'D': case 'E': - case 'F': case 'G': case 'H': case 'I': case 'J': - case 'K': case 'L': case 'M': case 'N': case 'O': - case 'P': case 'Q': case 'R': case 'S': case 'T': - case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': - return EINA_TRUE; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + case 'g': + case 'h': + case 'i': + case 'j': + case 'k': + case 'l': + case 'm': + case 'n': + case 'o': + case 'p': + case 'q': + case 'r': + case 's': + case 't': + case 'u': + case 'v': + case 'w': + case 'x': + case 'y': + case 'z': + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + case 'G': + case 'H': + case 'I': + case 'J': + case 'K': + case 'L': + case 'M': + case 'N': + case 'O': + case 'P': + case 'Q': + case 'R': + case 'S': + case 'T': + case 'U': + case 'V': + case 'W': + case 'X': + case 'Y': + case 'Z': + return EINA_TRUE; + default: - break; + break; } return EINA_FALSE; } @@ -708,57 +757,57 @@ _isalnum(unsigned char in) char * evry_util_url_escape(const char *string, int inlength) { - size_t alloc = (inlength?(size_t)inlength:strlen(string))+1; + size_t alloc = (inlength ? (size_t)inlength : strlen(string)) + 1; char *ns; char *testing_ptr = NULL; unsigned char in; /* we need to treat the characters unsigned */ size_t newlen = alloc; - int strindex=0; + int strindex = 0; size_t length; ns = malloc(alloc); - if(!ns) + if (!ns) return NULL; - length = alloc-1; - while(length--) + length = alloc - 1; + while (length--) { - in = *string; + in = *string; - if (_isalnum(in)) - { - /* just copy this */ - ns[strindex++]=in; - } - else { - /* encode it */ - newlen += 2; /* the size grows with two, since this'll become a %XX */ - if(newlen > alloc) - { - alloc *= 2; - testing_ptr = realloc(ns, alloc); - if(!testing_ptr) - { - free( ns ); - return NULL; - } - else - { - ns = testing_ptr; - } - } + if (_isalnum(in)) + { + /* just copy this */ + ns[strindex++] = in; + } + else { + /* encode it */ + newlen += 2; /* the size grows with two, since this'll become a %XX */ + if (newlen > alloc) + { + alloc *= 2; + testing_ptr = realloc(ns, alloc); + if (!testing_ptr) + { + free(ns); + return NULL; + } + else + { + ns = testing_ptr; + } + } - snprintf(&ns[strindex], 4, "%%%02X", in); + snprintf(&ns[strindex], 4, "%%%02X", in); - strindex+=3; - } - string++; + strindex += 3; + } + string++; } - ns[strindex]=0; /* terminate it */ + ns[strindex] = 0; /* terminate it */ return ns; } -const char* +const char * evry_file_path_get(Evry_Item_File *file) { const char *tmp; @@ -784,7 +833,7 @@ evry_file_path_get(Evry_Item_File *file) return file->path; } -const char* +const char * evry_file_url_get(Evry_Item_File *file) { char dest[PATH_MAX * 3 + 7]; @@ -804,13 +853,13 @@ evry_file_url_get(Evry_Item_File *file) /* Most app doesn't handle the hostname in the uri so it's put to NULL */ for (i = 7, p = file->path; *p != '\0'; p++, i++) { - if (isalnum(*p) || strchr("/$-_.+!*'()", *p)) - dest[i] = *p; - else - { - snprintf(&(dest[i]), 4, "%%%02X", (unsigned char)*p); - i += 2; - } + if (isalnum(*p) || strchr("/$-_.+!*'()", *p)) + dest[i] = *p; + else + { + snprintf(&(dest[i]), 4, "%%%02X", (unsigned char)*p); + i += 2; + } } file->url = eina_stringshare_add(dest); @@ -850,16 +899,17 @@ evry_util_md5_sum(const char *str) int n; char md5out[(2 * MD5_HASHBYTES) + 1]; MD5Init (&ctx); - MD5Update (&ctx, (unsigned char const*)str, - (unsigned)strlen (str)); + MD5Update (&ctx, (unsigned char const *)str, + (unsigned)strlen (str)); MD5Final (hash, &ctx); for (n = 0; n < MD5_HASHBYTES; n++) { - md5out[2 * n] = hex[hash[n] >> 4]; - md5out[2 * n + 1] = hex[hash[n] & 0x0f]; + md5out[2 * n] = hex[hash[n] >> 4]; + md5out[2 * n + 1] = hex[hash[n] & 0x0f]; } md5out[2 * n] = '\0'; return strdup(md5out); } + diff --git a/src/modules/everything/evry_view.c b/src/modules/everything/evry_view.c index 5e84696cb..a50ec268c 100644 --- a/src/modules/everything/evry_view.c +++ b/src/modules/everything/evry_view.c @@ -1,85 +1,84 @@ #include "e_mod_main.h" -typedef struct _View View; +typedef struct _View View; typedef struct _Smart_Data Smart_Data; -typedef struct _Item Item; +typedef struct _Item Item; -#define SIZE_LIST 28 +#define SIZE_LIST 28 #define SIZE_DETAIL 36 - struct _View { - Evry_View view; - Tab_View *tabs; + Evry_View view; + Tab_View *tabs; - const Evry_State *state; - const Evry_Plugin *plugin; + const Evry_State *state; + const Evry_Plugin *plugin; - Evas *evas; - Evas_Object *bg, *sframe, *span; - int iw, ih; - int zoom; - int mode; - int mode_prev; + Evas *evas; + Evas_Object *bg, *sframe, *span; + int iw, ih; + int zoom; + int mode; + int mode_prev; - Eina_List *handlers; + Eina_List *handlers; - Eina_Bool hiding; + Eina_Bool hiding; }; /* smart object based on wallpaper module */ struct _Smart_Data { - View *view; - Eina_List *items; - Item *cur_item; - Ecore_Idle_Enterer *idle_enter; - Evas_Coord x, y, w, h; - Evas_Coord cx, cy, cw, ch; - Evas_Coord sx, sy; + View *view; + Eina_List *items; + Item *cur_item; + Ecore_Idle_Enterer *idle_enter; + Evas_Coord x, y, w, h; + Evas_Coord cx, cy, cw, ch; + Evas_Coord sx, sy; - double last_select; - double scroll_align; - double scroll_align_to; - Ecore_Animator *animator; + double last_select; + double scroll_align; + double scroll_align_to; + Ecore_Animator *animator; - int slide_offset; - double slide; - double slide_to; + int slide_offset; + double slide; + double slide_to; - int sliding; - int mouse_act; - int mouse_x; - int mouse_y; - int mouse_button; - Item *it_down; + int sliding; + int mouse_act; + int mouse_x; + int mouse_y; + int mouse_button; + Item *it_down; - Eina_Bool place; + Eina_Bool place; }; struct _Item { - Evry_Item *item; - Evas_Object *obj; - Evas_Coord x, y, w, h; - Evas_Object *frame, *image, *thumb; - Eina_Bool selected : 1; - Eina_Bool have_thumb : 1; - Eina_Bool do_thumb : 1; - Eina_Bool get_thumb : 1; - Eina_Bool showing : 1; - Eina_Bool visible : 1; - Eina_Bool changed : 1; - int pos; - int max_w, max_h; + Evry_Item *item; + Evas_Object *obj; + Evas_Coord x, y, w, h; + Evas_Object *frame, *image, *thumb; + Eina_Bool selected : 1; + Eina_Bool have_thumb : 1; + Eina_Bool do_thumb : 1; + Eina_Bool get_thumb : 1; + Eina_Bool showing : 1; + Eina_Bool visible : 1; + Eina_Bool changed : 1; + int pos; + int max_w, max_h; }; static View *view = NULL; -static void _view_clear(Evry_View *view); -static void _pan_item_select(Evas_Object *obj, Item *it, int scroll); -static void _animator_del(Evas_Object *obj); +static void _view_clear(Evry_View *view); +static void _pan_item_select(Evas_Object *obj, Item *it, int scroll); +static void _animator_del(Evas_Object *obj); static Eina_Bool _animator(void *data); static void @@ -153,21 +152,21 @@ _item_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *ev if ((ev->button == 1) && (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)) { - if (it != sd->cur_item) - { - evry_item_select(s, it->item); - _pan_item_select(it->obj, it, 0); - } + if (it != sd->cur_item) + { + evry_item_select(s, it->item); + _pan_item_select(it->obj, it, 0); + } - if (it->item->browseable) - evry_browse_item(it->item); - else - evry_plugin_action(s->selector->win, 1); + if (it->item->browseable) + evry_browse_item(it->item); + else + evry_plugin_action(s->selector->win, 1); } else { - sd->mouse_x = ev->canvas.x; - sd->mouse_y = ev->canvas.y; + sd->mouse_x = ev->canvas.x; + sd->mouse_y = ev->canvas.y; } } @@ -193,19 +192,19 @@ _item_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *even if (ev->button == 1) { - if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) && - (it != sd->cur_item)) - { - evry_item_select(s, it->item); - _pan_item_select(it->obj, it, 0); - } + if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) && + (it != sd->cur_item)) + { + evry_item_select(s, it->item); + _pan_item_select(it->obj, it, 0); + } } else if (ev->button == 3) { - evry_item_select(s, it->item); - _pan_item_select(it->obj, it, 0); + evry_item_select(s, it->item); + _pan_item_select(it->obj, it, 0); - evry_plugin_action(s->selector->win, 0); + evry_plugin_action(s->selector->win, 0); } } @@ -217,18 +216,18 @@ _item_select(Item *it) if (it->thumb) { - if (strcmp(evas_object_type_get(it->thumb), "e_icon")) - edje_object_signal_emit(it->thumb, "e,state,selected", "e"); - else - e_icon_selected_set(it->thumb, EINA_TRUE); + if (strcmp(evas_object_type_get(it->thumb), "e_icon")) + edje_object_signal_emit(it->thumb, "e,state,selected", "e"); + else + e_icon_selected_set(it->thumb, EINA_TRUE); } if (it->image) { - if (strcmp(evas_object_type_get(it->image), "e_icon")) - edje_object_signal_emit(it->image, "e,state,selected", "e"); - else - e_icon_selected_set(it->image, EINA_TRUE); + if (strcmp(evas_object_type_get(it->image), "e_icon")) + edje_object_signal_emit(it->image, "e,state,selected", "e"); + else + e_icon_selected_set(it->image, EINA_TRUE); } } @@ -240,18 +239,18 @@ _item_unselect(Item *it) if (it->thumb) { - if (strcmp(evas_object_type_get(it->thumb), "e_icon")) - edje_object_signal_emit(it->thumb, "e,state,unselected", "e"); - else - e_icon_selected_set(it->thumb, EINA_FALSE); + if (strcmp(evas_object_type_get(it->thumb), "e_icon")) + edje_object_signal_emit(it->thumb, "e,state,unselected", "e"); + else + e_icon_selected_set(it->thumb, EINA_FALSE); } if (it->image) { - if (strcmp(evas_object_type_get(it->image), "e_icon")) - edje_object_signal_emit(it->image, "e,state,unselected", "e"); - else - e_icon_selected_set(it->image, EINA_FALSE); + if (strcmp(evas_object_type_get(it->image), "e_icon")) + edje_object_signal_emit(it->image, "e,state,unselected", "e"); + else + e_icon_selected_set(it->image, EINA_FALSE); } } @@ -265,34 +264,34 @@ _item_show(View *v, Item *it, Evas_Object *list) if (!it->frame) { - it->frame = edje_object_add(v->evas); - if (v->mode == VIEW_MODE_THUMB) - { - e_theme_edje_object_set(it->frame, "base/theme/modules/everything", - "e/modules/everything/thumbview/item/thumb"); - } - else - { - e_theme_edje_object_set(it->frame, "base/theme/modules/everything", - "e/modules/everything/thumbview/item/list"); + it->frame = edje_object_add(v->evas); + if (v->mode == VIEW_MODE_THUMB) + { + e_theme_edje_object_set(it->frame, "base/theme/modules/everything", + "e/modules/everything/thumbview/item/thumb"); + } + else + { + e_theme_edje_object_set(it->frame, "base/theme/modules/everything", + "e/modules/everything/thumbview/item/list"); - if (v->mode == VIEW_MODE_DETAIL) - edje_object_signal_emit(it->frame, "e,state,detail,show", "e"); - } + if (v->mode == VIEW_MODE_DETAIL) + edje_object_signal_emit(it->frame, "e,state,detail,show", "e"); + } - evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_DOWN, - _item_down, it); - evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_UP, - _item_up, it); - evas_object_smart_member_add(it->frame, list); + evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_DOWN, + _item_down, it); + evas_object_event_callback_add(it->frame, EVAS_CALLBACK_MOUSE_UP, + _item_up, it); + evas_object_smart_member_add(it->frame, list); - evas_object_clip_set(it->frame, evas_object_clip_get(list)); + evas_object_clip_set(it->frame, evas_object_clip_get(list)); - if (it->item->selected) - _item_select(it); + if (it->item->selected) + _item_select(it); - if (it->item->marked) - edje_object_signal_emit(it->frame, "e,state,marked", "e"); + if (it->item->marked) + edje_object_signal_emit(it->frame, "e,state,marked", "e"); } edje_object_part_text_set(it->frame, "e.text.label", it->item->label); @@ -307,60 +306,59 @@ _item_show(View *v, Item *it, Evas_Object *list) if (!it->image && !it->have_thumb) { - //double t = ecore_time_get(); - it->image = evry_util_icon_get(it->item, v->evas); - //_icon_time += ecore_time_get() - t; + //double t = ecore_time_get(); + it->image = evry_util_icon_get(it->item, v->evas); + //_icon_time += ecore_time_get() - t; - if (it->image) - { - if (it->max_w == 0) - e_icon_size_get(it->image, &it->max_w, &it->max_h); + if (it->image) + { + if (it->max_w == 0) + e_icon_size_get(it->image, &it->max_w, &it->max_h); - if ((it->max_w > 0) && (it->max_h > 0)) - evas_object_size_hint_max_set(it->image, it->max_w*2, it->max_h*2); - else - it->max_w = -1; + if ((it->max_w > 0) && (it->max_h > 0)) + evas_object_size_hint_max_set(it->image, it->max_w * 2, it->max_h * 2); + else + it->max_w = -1; - if (0 && e_icon_preload_get(it->image) && !evas_object_visible_get(it->image)) - { - evas_object_smart_callback_add(it->image, "preloaded", _cb_preload, it); - } - else - { - edje_object_part_swallow(it->frame, "e.swallow.icon", it->image); - evas_object_show(it->image); - } - } - else it->have_thumb = EINA_TRUE; + if (0 && e_icon_preload_get(it->image) && !evas_object_visible_get(it->image)) + { + evas_object_smart_callback_add(it->image, "preloaded", _cb_preload, it); + } + else + { + edje_object_part_swallow(it->frame, "e.swallow.icon", it->image); + evas_object_show(it->image); + } + } + else it->have_thumb = EINA_TRUE; } - if ((it->get_thumb) || (CHECK_TYPE(it->item, EVRY_TYPE_FILE) && _check_item(it->item))) { - char *suffix; + char *suffix; - it->get_thumb = EINA_TRUE; + it->get_thumb = EINA_TRUE; - it->thumb = e_thumb_icon_add(v->evas); + it->thumb = e_thumb_icon_add(v->evas); - GET_FILE(file, it->item); + GET_FILE(file, it->item); - evas_object_smart_callback_add(it->thumb, "e_thumb_gen", _cb_thumb_gen, it); + evas_object_smart_callback_add(it->thumb, "e_thumb_gen", _cb_thumb_gen, it); - e_thumb_icon_size_set(it->thumb, it->w, it->h); + e_thumb_icon_size_set(it->thumb, it->w, it->h); - if (it->item->icon && it->item->icon[0]) - e_thumb_icon_file_set(it->thumb, it->item->icon, NULL); - else if ((suffix = strrchr(file->path, '.')) && (!strncmp(suffix, ".edj", 4))) - { - e_thumb_icon_file_set(it->thumb, file->path, "e/desktop/background"); - e_thumb_icon_size_set(it->thumb, 128, 80); - } - else - e_thumb_icon_file_set(it->thumb, file->path, NULL); + if (it->item->icon && it->item->icon[0]) + e_thumb_icon_file_set(it->thumb, it->item->icon, NULL); + else if ((suffix = strrchr(file->path, '.')) && (!strncmp(suffix, ".edj", 4))) + { + e_thumb_icon_file_set(it->thumb, file->path, "e/desktop/background"); + e_thumb_icon_size_set(it->thumb, 128, 80); + } + else + e_thumb_icon_file_set(it->thumb, file->path, NULL); - e_thumb_icon_begin(it->thumb); - it->do_thumb = EINA_TRUE; + e_thumb_icon_begin(it->thumb); + it->do_thumb = EINA_TRUE; } edje_object_signal_emit(it->frame, "e,action,thumb,show", "e"); @@ -386,7 +384,6 @@ _item_hide(Item *it) it->visible = EINA_FALSE; } - static int _place_items(Smart_Data *sd) { @@ -397,68 +394,68 @@ _place_items(Smart_Data *sd) if (sd->view->mode == VIEW_MODE_LIST) { - ww = sd->w; - hh = SIZE_LIST; + ww = sd->w; + hh = SIZE_LIST; } else if (sd->view->mode == VIEW_MODE_DETAIL) { - ww = sd->w; - hh = SIZE_DETAIL; + ww = sd->w; + hh = SIZE_DETAIL; } else { - int w, h; - Evas_Object *o = edje_object_add(sd->view->evas); - e_theme_edje_object_set(o, "base/theme/modules/everything", - "e/modules/everything/thumbview/item/thumb"); - edje_object_size_min_get(o, &w, &h); - evas_object_del(o); + int w, h; + Evas_Object *o = edje_object_add(sd->view->evas); + e_theme_edje_object_set(o, "base/theme/modules/everything", + "e/modules/everything/thumbview/item/thumb"); + edje_object_size_min_get(o, &w, &h); + evas_object_del(o); - if ((w > 0) && (h > 0)) - { - div = sd->w / w; - if (div < 1) div = 1; - ww = w + (sd->w - div * w) / div; - hh = ((double)h/(double)w * (double)ww); - } - else - { - if (sd->view->zoom == 0) - ww = 96; - else if (sd->view->zoom == 1) - ww = 128; - else - ww = 192; + if ((w > 0) && (h > 0)) + { + div = sd->w / w; + if (div < 1) div = 1; + ww = w + (sd->w - div * w) / div; + hh = ((double)h / (double)w * (double)ww); + } + else + { + if (sd->view->zoom == 0) + ww = 96; + else if (sd->view->zoom == 1) + ww = 128; + else + ww = 192; - div = sd->w / ww; - if (div < 1) div = 1; - ww += (sd->w - div * ww) / div; + div = sd->w / ww; + if (div < 1) div = 1; + ww += (sd->w - div * ww) / div; - div = sd->h / ww; - if (div < 1) div = 1; - hh = ww + (sd->h - div * ww) / div; + div = sd->h / ww; + if (div < 1) div = 1; + hh = ww + (sd->h - div * ww) / div; - if (hh > ww) - hh = ww + (sd->h - (div + 1) * ww) / (div + 1); - } + if (hh > ww) + hh = ww + (sd->h - (div + 1) * ww) / (div + 1); + } } - EINA_LIST_FOREACH(sd->items, l, it) + EINA_LIST_FOREACH (sd->items, l, it) { - it->x = x; - it->y = y; - it->w = ww; - it->h = hh; + it->x = x; + it->y = y; + it->w = ww; + it->h = hh; - if ((x + ww) > mw) mw = x + ww; - if ((y + hh) > mh) mh = y + hh; - x += ww; + if ((x + ww) > mw) mw = x + ww; + if ((y + hh) > mh) mh = y + hh; + x += ww; - if (x <= (sd->w - ww)) - continue; + if (x <= (sd->w - ww)) + continue; - x = 0; - y += hh; + x = 0; + y += hh; } if ((sd->view->mode == VIEW_MODE_LIST) || @@ -467,19 +464,19 @@ _place_items(Smart_Data *sd) if ((mw != sd->cw) || (mh != sd->ch)) { - sd->cw = mw; - sd->ch = mh; + sd->cw = mw; + sd->ch = mh; - if (sd->cx > (sd->cw - sd->w)) - sd->cx = sd->cw - sd->w; - if (sd->cy > (sd->ch - sd->h)) - sd->cy = sd->ch - sd->h; - if (sd->cx < 0) - sd->cx = 0; - if (sd->cy < 0) - sd->cy = 0; + if (sd->cx > (sd->cw - sd->w)) + sd->cx = sd->cw - sd->w; + if (sd->cy > (sd->ch - sd->h)) + sd->cy = sd->ch - sd->h; + if (sd->cx < 0) + sd->cx = 0; + if (sd->cy < 0) + sd->cy = 0; - return 1; + return 1; } return 0; @@ -494,7 +491,7 @@ _e_smart_reconfigure_do(void *data) Item *it; Evas_Coord xx, yy; double time; - + if (!sd) return ECORE_CALLBACK_CANCEL; @@ -512,35 +509,35 @@ _e_smart_reconfigure_do(void *data) if (sd->cy < 0) sd->cy = 0; if (sd->place && _place_items(sd)) - { - evas_object_smart_callback_call(obj, "changed", NULL); - return ECORE_CALLBACK_RENEW; + { + evas_object_smart_callback_call(obj, "changed", NULL); + return ECORE_CALLBACK_RENEW; } time = ecore_time_get(); - - EINA_LIST_FOREACH(sd->items, l, it) + + EINA_LIST_FOREACH (sd->items, l, it) { - xx = sd->x - sd->cx + it->x; - yy = sd->y - sd->cy + it->y; + xx = sd->x - sd->cx + it->x; + yy = sd->y - sd->cy + it->y; - if (E_INTERSECTS(xx, yy, it->w, it->h, 0, sd->y - it->h*3, - sd->x + sd->w, sd->y + sd->h + it->h*6)) - { - if (!it->visible) - _item_show(sd->view, it, obj); + if (E_INTERSECTS(xx, yy, it->w, it->h, 0, sd->y - it->h * 3, + sd->x + sd->w, sd->y + sd->h + it->h * 6)) + { + if (!it->visible) + _item_show(sd->view, it, obj); - evas_object_move(it->frame, xx, yy); - evas_object_resize(it->frame, it->w, it->h); - } - else if (it->visible) - { - _item_hide(it); - } - it->changed = EINA_FALSE; + evas_object_move(it->frame, xx, yy); + evas_object_resize(it->frame, it->w, it->h); + } + else if (it->visible) + { + _item_hide(it); + } + it->changed = EINA_FALSE; - if (ecore_time_get() - time > 0.03) - return ECORE_CALLBACK_RENEW; + if (ecore_time_get() - time > 0.03) + return ECORE_CALLBACK_RENEW; } sd->idle_enter = NULL; @@ -613,7 +610,7 @@ static void _e_smart_color_set(Evas_Object *obj __UNUSED__, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__){} static void -_e_smart_clip_set(Evas_Object *obj __UNUSED__, Evas_Object * clip __UNUSED__){} +_e_smart_clip_set(Evas_Object *obj __UNUSED__, Evas_Object *clip __UNUSED__){} static void _e_smart_clip_unset(Evas_Object *obj __UNUSED__){} @@ -623,26 +620,26 @@ _pan_add(Evas *evas) { static Evas_Smart *smart = NULL; static const Evas_Smart_Class sc = - { - "wp_pan", - EVAS_SMART_CLASS_VERSION, - _e_smart_add, - _e_smart_del, - _e_smart_move, - _e_smart_resize, - _e_smart_show, - _e_smart_hide, - _e_smart_color_set, - _e_smart_clip_set, - _e_smart_clip_unset, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL - }; + { + "wp_pan", + EVAS_SMART_CLASS_VERSION, + _e_smart_add, + _e_smart_del, + _e_smart_move, + _e_smart_resize, + _e_smart_show, + _e_smart_hide, + _e_smart_color_set, + _e_smart_clip_set, + _e_smart_clip_unset, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }; smart = evas_smart_class_new(&sc); return evas_object_smart_add(evas, smart); } @@ -675,13 +672,13 @@ _pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y) Smart_Data *sd = evas_object_smart_data_get(obj); if (x) { - if (sd->w < sd->cw) *x = sd->cw - sd->w; - else *x = 0; + if (sd->w < sd->cw) *x = sd->cw - sd->w; + else *x = 0; } if (y) { - if (sd->h < sd->ch) *y = sd->ch - sd->h; - else *y = 0; + if (sd->h < sd->ch) *y = sd->ch - sd->h; + else *y = 0; } } @@ -754,26 +751,26 @@ _animator(void *data) if (!sd) return ECORE_CALLBACK_CANCEL; double da; - double spd = ((25.0/ (double)e_config->framerate) / - (double) (1 + sd->view->zoom)); + double spd = ((25.0 / (double)e_config->framerate) / + (double)(1 + sd->view->zoom)); if (spd > 0.9) spd = 0.9; int wait = 0; if (sd->scroll_align != sd->scroll_align_to) { - sd->scroll_align = ((sd->scroll_align * (1.0 - spd)) + - (sd->scroll_align_to * spd)); + sd->scroll_align = ((sd->scroll_align * (1.0 - spd)) + + (sd->scroll_align_to * spd)); - da = sd->scroll_align - sd->scroll_align_to; - if (da < 0.0) da = -da; - if (da < 0.02) - sd->scroll_align = sd->scroll_align_to; - else - wait++; + da = sd->scroll_align - sd->scroll_align_to; + if (da < 0.0) da = -da; + if (da < 0.02) + sd->scroll_align = sd->scroll_align_to; + else + wait++; - e_scrollframe_child_pos_set(sd->view->sframe, - 0, sd->scroll_align); + e_scrollframe_child_pos_set(sd->view->sframe, + 0, sd->scroll_align); } if (wait) @@ -782,7 +779,6 @@ _animator(void *data) _animator_del(data); return ECORE_CALLBACK_CANCEL; - } static int @@ -803,8 +799,8 @@ _child_region_get(Evas_Object *obj, Evas_Coord y, Evas_Coord h) if (y < py) ny = y; else if ((y + h) > (py + (ch - my))) { - ny = y + h - (ch - my); - if (ny > y) ny = y; + ny = y + h - (ch - my); + if (ny > y) ny = y; } if (ny < 0) ny = 0; @@ -820,8 +816,8 @@ _pan_item_select(Evas_Object *obj, Item *it, int scroll) if (sd->cur_item) { - _item_unselect(sd->cur_item); - sd->cur_item = NULL; + _item_unselect(sd->cur_item); + sd->cur_item = NULL; } if (!it) return; @@ -831,15 +827,15 @@ _pan_item_select(Evas_Object *obj, Item *it, int scroll) if (evry_conf->scroll_animate) { - double now = ecore_time_get(); + double now = ecore_time_get(); - if (now - sd->last_select < 0.08) - { - sd->scroll_align = sd->scroll_align_to; - scroll = 0; - } + if (now - sd->last_select < 0.08) + { + sd->scroll_align = sd->scroll_align_to; + scroll = 0; + } - sd->last_select = now; + sd->last_select = now; } else scroll = 0; @@ -848,36 +844,36 @@ _pan_item_select(Evas_Object *obj, Item *it, int scroll) if (sd->view->mode == VIEW_MODE_THUMB) { - if (sd->view->zoom < 2) - align = _child_region_get(obj, it->y - it->h, it->h * 3); - else - align = _child_region_get(obj, it->y, it->h); + if (sd->view->zoom < 2) + align = _child_region_get(obj, it->y - it->h, it->h * 3); + else + align = _child_region_get(obj, it->y, it->h); } else { - align = _child_region_get(obj, it->y - it->h * 2, it->h * 5); + align = _child_region_get(obj, it->y - it->h * 2, it->h * 5); } if (scroll && evry_conf->scroll_animate) { - sd->scroll_align_to = align; + sd->scroll_align_to = align; - if (align != sd->cy && !sd->animator) - sd->animator = ecore_animator_add(_animator, obj); + if (align != sd->cy && !sd->animator) + sd->animator = ecore_animator_add(_animator, obj); } else { - sd->scroll_align = sd->scroll_align_to; + sd->scroll_align = sd->scroll_align_to; - if (align >= 0) - { - sd->scroll_align = align; - sd->scroll_align_to = align; - e_scrollframe_child_pos_set(sd->view->sframe, - 0, sd->scroll_align); - } + if (align >= 0) + { + sd->scroll_align = align; + sd->scroll_align_to = align; + e_scrollframe_child_pos_set(sd->view->sframe, + 0, sd->scroll_align); + } - _animator_del(obj); + _animator_del(obj); } _e_smart_reconfigure(obj); @@ -892,14 +888,14 @@ _clear_items(Evas_Object *obj) _animator_del(obj); - EINA_LIST_FOREACH(sd->items, l, it) + EINA_LIST_FOREACH (sd->items, l, it) _item_hide(it); } static void _view_clear(Evry_View *view) { - View *v = (View*) view; + View *v = (View *)view; Smart_Data *sd = evas_object_smart_data_get(v->span); Item *it; if (!sd) return; @@ -913,11 +909,11 @@ _view_clear(Evry_View *view) if (sd->items) { - EINA_LIST_FREE(sd->items, it) - { - evry_item_free(it->item); - E_FREE(it); - } + EINA_LIST_FREE (sd->items, it) + { + evry_item_free(it->item); + E_FREE(it); + } } sd->place = EINA_TRUE; @@ -979,104 +975,104 @@ _view_update(Evry_View *view) if (!p) { - _view_clear(view); - return 1; + _view_clear(view); + return 1; } if (p != v->plugin && (v->plugin || (v->mode == VIEW_MODE_NONE))) { - if (p->config->view_mode != v->mode) - { - _clear_items(v->span); + if (p->config->view_mode != v->mode) + { + _clear_items(v->span); - if (p->config->view_mode < 0) - v->mode = evry_conf->view_mode; - else - v->mode = p->config->view_mode; - } + if (p->config->view_mode < 0) + v->mode = evry_conf->view_mode; + else + v->mode = p->config->view_mode; + } } /* go through current view items */ - EINA_LIST_FOREACH(sd->items, l, v_it) + EINA_LIST_FOREACH (sd->items, l, v_it) { - last_pos = v_it->pos; - v_it->pos = 0; - pos = 1; + last_pos = v_it->pos; + v_it->pos = 0; + pos = 1; - /* go through plugins current items */ - EINA_LIST_FOREACH(p->items, ll, p_it) - { - if (v_it->item == p_it) - { - if (pos != last_pos) - v_it->changed = EINA_TRUE; + /* go through plugins current items */ + EINA_LIST_FOREACH (p->items, ll, p_it) + { + if (v_it->item == p_it) + { + if (pos != last_pos) + v_it->changed = EINA_TRUE; - v_it->pos = pos; + v_it->pos = pos; - if (p_it->selected) - { - sd->cur_item = v_it; - v_it->selected = EINA_TRUE; - } - else - { - if (v_it->selected && v_it->frame) - edje_object_signal_emit - (v_it->frame,"e,state,unselected", "e"); - v_it->selected = EINA_FALSE; - } - break; - } - pos++; - } + if (p_it->selected) + { + sd->cur_item = v_it; + v_it->selected = EINA_TRUE; + } + else + { + if (v_it->selected && v_it->frame) + edje_object_signal_emit + (v_it->frame, "e,state,unselected", "e"); + v_it->selected = EINA_FALSE; + } + break; + } + pos++; + } - if (v_it->visible) - { - if (!first_vis) first_vis = v_it->pos; - last_vis = v_it->pos; - } + if (v_it->visible) + { + if (!first_vis) first_vis = v_it->pos; + last_vis = v_it->pos; + } - /* view item is in list of current items */ - if (v_it->pos) - { - v_items = eina_list_append(v_items, v_it->item); + /* view item is in list of current items */ + if (v_it->pos) + { + v_items = eina_list_append(v_items, v_it->item); - if (v_it->visible && v_it->changed) - update = EINA_TRUE; - } - else - { - if (v_it->visible) update = EINA_TRUE; - v_remove = eina_list_append(v_remove, v_it); - } + if (v_it->visible && v_it->changed) + update = EINA_TRUE; + } + else + { + if (v_it->visible) update = EINA_TRUE; + v_remove = eina_list_append(v_remove, v_it); + } } - EINA_LIST_FREE(v_remove, v_it) + EINA_LIST_FREE (v_remove, v_it) _pan_item_remove(v->span, v_it); /* go through plugins current items */ pos = 1; - EINA_LIST_FOREACH(p->items, l, p_it) + EINA_LIST_FOREACH (p->items, l, p_it) { - /* item is not already in view */ - if (!eina_list_data_find_list(v_items, p_it)) - { - v_it = _pan_item_add(v->span, p_it); + /* item is not already in view */ + if (!eina_list_data_find_list(v_items, p_it)) + { + v_it = _pan_item_add(v->span, p_it); - if (!v_it) continue; + if (!v_it) continue; - v_it->pos = pos; + v_it->pos = pos; - if (p_it == v->state->cur_item) - { - sd->cur_item = v_it; - v_it->selected = EINA_TRUE; - } + if (p_it == v->state->cur_item) + { + sd->cur_item = v_it; + v_it->selected = EINA_TRUE; + } - if (pos > first_vis && pos < last_vis) - update = EINA_TRUE; - } - pos++; + if (pos > first_vis && pos < last_vis) + update = EINA_TRUE; + } + pos++; } if (v_items) eina_list_free(v_items); @@ -1084,8 +1080,8 @@ _view_update(Evry_View *view) if (update || !last_vis || v->plugin != p) { - v->plugin = p; - _update_frame(v->span); + v->plugin = p; + _update_frame(v->span); } v->tabs->update(v->tabs); @@ -1096,7 +1092,7 @@ _view_update(Evry_View *view) static int _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) { - View *v = (View *) view; + View *v = (View *)view; Smart_Data *sd = evas_object_smart_data_get(v->span); Eina_List *l = NULL, *ll; Item *it = NULL; @@ -1115,141 +1111,141 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && (!strcmp(key, "2"))) { - if (v->mode == VIEW_MODE_LIST) - v->mode = VIEW_MODE_DETAIL; - else - v->mode = VIEW_MODE_LIST; + if (v->mode == VIEW_MODE_LIST) + v->mode = VIEW_MODE_DETAIL; + else + v->mode = VIEW_MODE_LIST; - v->zoom = 0; - _clear_items(v->span); - _update_frame(v->span); - goto end; + v->zoom = 0; + _clear_items(v->span); + _update_frame(v->span); + goto end; } else if (((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && - (!strcmp(key, "3"))) || !strcmp(key, "XF86Forward")) + (!strcmp(key, "3"))) || !strcmp(key, "XF86Forward")) { - if (v->mode != VIEW_MODE_THUMB) - { - v->zoom = 0; - v->mode = VIEW_MODE_THUMB; - _clear_items(v->span); - } - else - { - v->zoom++; - if (v->zoom > 2) v->zoom = 0; - if (v->zoom == 2) - _clear_items(v->span); - } - _update_frame(v->span); - goto end; + if (v->mode != VIEW_MODE_THUMB) + { + v->zoom = 0; + v->mode = VIEW_MODE_THUMB; + _clear_items(v->span); + } + else + { + v->zoom++; + if (v->zoom > 2) v->zoom = 0; + if (v->zoom == 2) + _clear_items(v->span); + } + _update_frame(v->span); + goto end; } else if (!strcmp(key, "XF86Back")) { - if (v->mode == VIEW_MODE_LIST || - v->mode == VIEW_MODE_DETAIL) - { - v->zoom = 0; - v->mode = VIEW_MODE_THUMB; - } - else - { - v->mode = VIEW_MODE_DETAIL; - } + if (v->mode == VIEW_MODE_LIST || + v->mode == VIEW_MODE_DETAIL) + { + v->zoom = 0; + v->mode = VIEW_MODE_THUMB; + } + else + { + v->mode = VIEW_MODE_DETAIL; + } - _clear_items(v->span); - _update_frame(v->span); - goto end; + _clear_items(v->span); + _update_frame(v->span); + goto end; } if (((ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) || - (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) && + (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) && (!strcmp(key, "Up"))) { - if (!sd->items) goto end; - it = sd->items->data; + if (!sd->items) goto end; + it = sd->items->data; - _pan_item_select(v->span, it, 1); - evry_item_select(s, it->item); - goto end; + _pan_item_select(v->span, it, 1); + evry_item_select(s, it->item); + goto end; } else if (((ev->modifiers & ECORE_EVENT_MODIFIER_SHIFT) || - (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) && - (!strcmp(key, "Down"))) + (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) && + (!strcmp(key, "Down"))) { - if (!sd->items) goto end; + if (!sd->items) goto end; - it = eina_list_last(sd->items)->data; - _pan_item_select(v->span, it, 1); - evry_item_select(s, it->item); - goto end; + it = eina_list_last(sd->items)->data; + _pan_item_select(v->span, it, 1); + evry_item_select(s, it->item); + goto end; } if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && (!strcmp(key, "plus"))) { - EINA_LIST_FOREACH(sd->items, ll, it) - { - if (!it->item->marked) - { - if (it->frame) - edje_object_signal_emit(it->frame, "e,state,marked", "e"); - evry_item_mark(s, it->item, 1); - } - } - goto end; + EINA_LIST_FOREACH (sd->items, ll, it) + { + if (!it->item->marked) + { + if (it->frame) + edje_object_signal_emit(it->frame, "e,state,marked", "e"); + evry_item_mark(s, it->item, 1); + } + } + goto end; } else if ((ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) && - (!strcmp(key, "minus"))) + (!strcmp(key, "minus"))) { - EINA_LIST_FOREACH(sd->items, ll, it) - { - if (it->item->marked) - { - if (it->frame) - edje_object_signal_emit(it->frame, "e,state,unmarked", "e"); - evry_item_mark(s, it->item, 0); - } - } - goto end; + EINA_LIST_FOREACH (sd->items, ll, it) + { + if (it->item->marked) + { + if (it->frame) + edje_object_signal_emit(it->frame, "e,state,unmarked", "e"); + evry_item_mark(s, it->item, 0); + } + } + goto end; } else if (!strcmp(key, "comma") || !strcmp(key, "semicolon")) { - if (!sd->cur_item) - goto end; + if (!sd->cur_item) + goto end; - if (!sd->cur_item->item->marked) - { - edje_object_signal_emit(sd->cur_item->frame, "e,state,marked", "e"); - evry_item_mark(s, sd->cur_item->item, 1); - } - else - { - edje_object_signal_emit(sd->cur_item->frame, "e,state,unmarked", "e"); - evry_item_mark(s, sd->cur_item->item, 0); - } + if (!sd->cur_item->item->marked) + { + edje_object_signal_emit(sd->cur_item->frame, "e,state,marked", "e"); + evry_item_mark(s, sd->cur_item->item, 1); + } + else + { + edje_object_signal_emit(sd->cur_item->frame, "e,state,unmarked", "e"); + evry_item_mark(s, sd->cur_item->item, 0); + } - if (v->mode == VIEW_MODE_THUMB) - { - if (!strcmp(key, "comma")) - key = "Right"; - else - key = "Left"; - } - else - { - if (!strcmp(key, "comma")) - key = "Down"; - else - key = "Up"; - } + if (v->mode == VIEW_MODE_THUMB) + { + if (!strcmp(key, "comma")) + key = "Right"; + else + key = "Left"; + } + else + { + if (!strcmp(key, "comma")) + key = "Down"; + else + key = "Up"; + } } if ((slide = v->tabs->key_down(v->tabs, ev))) { - /* _view_update(view, -slide); */ - _view_update(view); - return 1; + /* _view_update(view, -slide); */ + _view_update(view); + return 1; } if (sd->items) @@ -1259,125 +1255,125 @@ _cb_key_down(Evry_View *view, const Ecore_Event_Key *ev) if (v->mode == VIEW_MODE_THUMB && !evry_conf->cycle_mode) { - if (!strcmp(key, "Right")) - { - if (l && l->next) - it = l->next->data; + if (!strcmp(key, "Right")) + { + if (l && l->next) + it = l->next->data; - if (it) - { - _pan_item_select(v->span, it, 1); - evry_item_select(s, it->item); - } - goto end; - } - else if (!strcmp(key, "Left")) - { - if (l && l->prev) - it = l->prev->data; + if (it) + { + _pan_item_select(v->span, it, 1); + evry_item_select(s, it->item); + } + goto end; + } + else if (!strcmp(key, "Left")) + { + if (l && l->prev) + it = l->prev->data; - if (it) - { - _pan_item_select(v->span, it, 1); - evry_item_select(s, it->item); - } - goto end; - } + if (it) + { + _pan_item_select(v->span, it, 1); + evry_item_select(s, it->item); + } + goto end; + } } if (!strcmp(key, "Down")) { - if (v->mode == VIEW_MODE_THUMB && - (!evry_conf->cycle_mode) && - (sd->cur_item)) - { - EINA_LIST_FOREACH(l, ll, it) - { - if (it->y > sd->cur_item->y && - it->x >= sd->cur_item->x) - break; - } - } + if (v->mode == VIEW_MODE_THUMB && + (!evry_conf->cycle_mode) && + (sd->cur_item)) + { + EINA_LIST_FOREACH (l, ll, it) + { + if (it->y > sd->cur_item->y && + it->x >= sd->cur_item->x) + break; + } + } - if (!it && l && l->next) - it = l->next->data; + if (!it && l && l->next) + it = l->next->data; - if (it) - { - _pan_item_select(v->span, it, 1); - evry_item_select(s, it->item); - } - goto end; + if (it) + { + _pan_item_select(v->span, it, 1); + evry_item_select(s, it->item); + } + goto end; } else if (!strcmp(key, "Up")) { - if (v->mode == VIEW_MODE_THUMB && - (!evry_conf->cycle_mode) && - (sd->cur_item)) - { - for(ll = l; ll; ll = ll->prev) - { - it = ll->data; + if (v->mode == VIEW_MODE_THUMB && + (!evry_conf->cycle_mode) && + (sd->cur_item)) + { + for (ll = l; ll; ll = ll->prev) + { + it = ll->data; - if (it->y < sd->cur_item->y && - it->x <= sd->cur_item->x) - break; - } - } + if (it->y < sd->cur_item->y && + it->x <= sd->cur_item->x) + break; + } + } - if (!it && l && l->prev) - it = l->prev->data; + if (!it && l && l->prev) + it = l->prev->data; - if (it) - { - _pan_item_select(v->span, it, 1); - evry_item_select(s, it->item); - } - goto end; + if (it) + { + _pan_item_select(v->span, it, 1); + evry_item_select(s, it->item); + } + goto end; } else if ((!strcmp(key, "Prior") || (!strcmp(key, "Next")))) { - int cur = 0; - int next = (!strcmp(key, "Next")); - if (sd->cur_item) - cur = sd->cur_item->y; + int cur = 0; + int next = (!strcmp(key, "Next")); + if (sd->cur_item) + cur = sd->cur_item->y; - EINA_LIST_FOREACH(sd->items, l, it) - { - if (next) - { - if (it->y >= cur + sd->h) break; - } - else - { - if (it->y + it->h >= cur - sd->h) break; - } + EINA_LIST_FOREACH (sd->items, l, it) + { + if (next) + { + if (it->y >= cur + sd->h) break; + } + else + { + if (it->y + it->h >= cur - sd->h) break; + } - if (!l->next) - break; - } + if (!l->next) + break; + } - if (it) - { - _pan_item_select(v->span, it, 0); - evry_item_select(s, it->item); - } - goto end; + if (it) + { + _pan_item_select(v->span, it, 0); + evry_item_select(s, it->item); + } + goto end; } else if (!ev->modifiers && !strcmp(key, "Return")) { - if (v->mode == VIEW_MODE_THUMB) - { - if (!sd->cur_item) - goto end; + if (v->mode == VIEW_MODE_THUMB) + { + if (!sd->cur_item) + goto end; - if (evry_browse_item(sd->cur_item->item)) - goto end; - } + if (evry_browse_item(sd->cur_item->item)) + goto end; + } } return 0; - end: +end: return 1; } @@ -1391,7 +1387,7 @@ _cb_item_changed(void *data, int type __UNUSED__, void *event) Smart_Data *sd = evas_object_smart_data_get(v->span); if (!sd) return ECORE_CALLBACK_PASS_ON; - EINA_LIST_FOREACH(sd->items, l, it) + EINA_LIST_FOREACH (sd->items, l, it) if (it->item == ev->item) break; @@ -1400,8 +1396,8 @@ _cb_item_changed(void *data, int type __UNUSED__, void *event) if (ev->changed_selection) { - _pan_item_select(v->span, it, 1); - evry_item_select(v->state, ev->item); + _pan_item_select(v->span, it, 1); + evry_item_select(v->state, ev->item); } if (!it->visible) @@ -1411,15 +1407,15 @@ _cb_item_changed(void *data, int type __UNUSED__, void *event) if (ev->changed_icon) { - if (it->do_thumb) e_thumb_icon_end(it->thumb); - if (it->thumb) evas_object_del(it->thumb); - if (it->image) evas_object_del(it->image); + if (it->do_thumb) e_thumb_icon_end(it->thumb); + if (it->thumb) evas_object_del(it->thumb); + if (it->image) evas_object_del(it->image); - it->thumb = NULL; - it->image = NULL; + it->thumb = NULL; + it->image = NULL; - it->have_thumb = EINA_FALSE; - it->do_thumb = EINA_FALSE; + it->have_thumb = EINA_FALSE; + it->do_thumb = EINA_FALSE; } return ECORE_CALLBACK_PASS_ON; @@ -1437,18 +1433,17 @@ _cb_action_performed(void *data, int type __UNUSED__, void *event) sd = evas_object_smart_data_get(v->span); if (!sd) return ECORE_CALLBACK_PASS_ON; - EINA_LIST_FOREACH(sd->items, l, it) + EINA_LIST_FOREACH (sd->items, l, it) { - - if ((it->item == ev->it1) || - (it->item == ev->it2)) - break; + if ((it->item == ev->it1) || + (it->item == ev->it2)) + break; } if (it && it->visible) { - evas_object_raise(it->frame); - edje_object_signal_emit(it->frame, "e,action,go", "e"); + evas_object_raise(it->frame); + edje_object_signal_emit(it->frame, "e,action,go", "e"); } return ECORE_CALLBACK_PASS_ON; @@ -1462,9 +1457,9 @@ _view_cb_mouse_wheel(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj if (!sd) return; if (ev->z) { - if (sd->cur_item) - _item_select(sd->cur_item); - sd->mouse_act = 1; + if (sd->cur_item) + _item_select(sd->cur_item); + sd->mouse_act = 1; } } @@ -1515,11 +1510,11 @@ _view_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, diff_x = abs(ev->cur.canvas.x - sd->mouse_x); diff_y = abs(ev->cur.canvas.y - sd->mouse_y); - if (diff_y > 15 + (diff_x/2)) + if (diff_y > 15 + (diff_x / 2)) { - edje_object_signal_emit(sd->view->bg, "e,action,hide,into", "e"); - edje_object_signal_emit(sd->view->bg, "e,action,hide,back", "e"); - goto end; + edje_object_signal_emit(sd->view->bg, "e,action,hide,into", "e"); + edje_object_signal_emit(sd->view->bg, "e,action,hide,back", "e"); + goto end; } if ((sel->states->next) || (sel != sel->win->selectors[0])) @@ -1527,64 +1522,67 @@ _view_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, if (sd->it_down) { - if ((sd->it_down->item->browseable) || - (sel != sel->win->selectors[2])) - edje_object_signal_emit(sd->view->bg, "e,action,show,into", "e"); + if ((sd->it_down->item->browseable) || + (sel != sel->win->selectors[2])) + edje_object_signal_emit(sd->view->bg, "e,action,show,into", "e"); - if ((sd->cur_item != sd->it_down) && (diff_x > 10)) - { - evry_item_select(sd->view->state, sd->it_down->item); - _pan_item_select(data, sd->it_down, 0); - } + if ((sd->cur_item != sd->it_down) && (diff_x > 10)) + { + evry_item_select(sd->view->state, sd->it_down->item); + _pan_item_select(data, sd->it_down, 0); + } } if (sd->mouse_button == 1) { - if (ev->cur.canvas.x - sd->mouse_x > SLIDE_RESISTANCE) - { - sd->it_down = NULL; - sd->mouse_x = 0; - sd->mouse_y = 0; - if (sel->states->next) - evry_browse_back(sel); - else - evry_selectors_switch(sel->win, -1, EINA_TRUE); - } - else if ((sd->it_down && (sd->cur_item == sd->it_down)) && - (sd->mouse_x - ev->cur.canvas.x > SLIDE_RESISTANCE)) - { - edje_object_signal_emit(sd->view->bg, "e,action,hide,into", "e"); - edje_object_signal_emit(sd->view->bg, "e,action,hide,back", "e"); + if (ev->cur.canvas.x - sd->mouse_x > SLIDE_RESISTANCE) + { + sd->it_down = NULL; + sd->mouse_x = 0; + sd->mouse_y = 0; + if (sel->states->next) + evry_browse_back(sel); + else + evry_selectors_switch(sel->win, -1, EINA_TRUE); + } + else if ((sd->it_down && (sd->cur_item == sd->it_down)) && + (sd->mouse_x - ev->cur.canvas.x > SLIDE_RESISTANCE)) + { + edje_object_signal_emit(sd->view->bg, "e,action,hide,into", "e"); + edje_object_signal_emit(sd->view->bg, "e,action,hide,back", "e"); - if (sd->it_down->item->browseable) - { - evry_browse_item(sd->it_down->item); - } - else - { - evry_selectors_switch(sel->win, 1, EINA_TRUE); - } + if (sd->it_down->item->browseable) + { + evry_browse_item(sd->it_down->item); + } + else + { + evry_selectors_switch(sel->win, 1, EINA_TRUE); + } - sd->it_down = NULL; - sd->mouse_x = 0; - sd->mouse_y = 0; - } + sd->it_down = NULL; + sd->mouse_x = 0; + sd->mouse_y = 0; + } } return; - end: +end: sd->it_down = NULL; sd->mouse_x = 0; sd->mouse_y = 0; } -static void _cb_list_hide(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) + +static void +_cb_list_hide(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) { View *v = data; v->hiding = EINA_TRUE; } -static void _cb_list_show(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) +static void +_cb_list_show(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) { View *v = data; @@ -1606,21 +1604,21 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow) if (s->plugin) { - if ((s->selector->states->next) && - ((s->plugin->config->view_mode < 0) || - (!strcmp(s->plugin->name, N_("All"))))) - v->mode = parent->mode; - else if (s->plugin->config->view_mode >= 0) - v->mode = s->plugin->config->view_mode; - else - v->mode = evry_conf->view_mode; + if ((s->selector->states->next) && + ((s->plugin->config->view_mode < 0) || + (!strcmp(s->plugin->name, N_("All"))))) + v->mode = parent->mode; + else if (s->plugin->config->view_mode >= 0) + v->mode = s->plugin->config->view_mode; + else + v->mode = evry_conf->view_mode; } else { - if (s->selector->states->next) - v->mode = parent->mode; - else - v->mode = evry_conf->view_mode; + if (s->selector->states->next) + v->mode = parent->mode; + else + v->mode = evry_conf->view_mode; } v->plugin = s->plugin; @@ -1629,29 +1627,29 @@ _view_create(Evry_View *view, const Evry_State *s, const Evas_Object *swallow) v->bg = edje_object_add(v->evas); e_theme_edje_object_set(v->bg, "base/theme/modules/everything", - "e/modules/everything/thumbview/main/window"); + "e/modules/everything/thumbview/main/window"); // scrolled thumbs v->span = _pan_add(v->evas); _pan_view_set(v->span, v); evas_object_event_callback_add(v->span, EVAS_CALLBACK_MOUSE_WHEEL, - _view_cb_mouse_wheel, NULL); + _view_cb_mouse_wheel, NULL); evas_object_event_callback_add(v->bg, EVAS_CALLBACK_MOUSE_MOVE, - _view_cb_mouse_move, v->span); + _view_cb_mouse_move, v->span); evas_object_event_callback_add(v->bg, EVAS_CALLBACK_MOUSE_DOWN, - _view_cb_mouse_down, v->span); + _view_cb_mouse_down, v->span); evas_object_event_callback_add(v->bg, EVAS_CALLBACK_MOUSE_UP, - _view_cb_mouse_up, v->span); + _view_cb_mouse_up, v->span); // the scrollframe holding the scrolled thumbs v->sframe = e_scrollframe_add(v->evas); e_scrollframe_custom_theme_set(v->sframe, "base/theme/modules/everything", - "e/modules/everything/thumbview/main/scrollframe"); + "e/modules/everything/thumbview/main/scrollframe"); e_scrollframe_thumbscroll_force(v->sframe, 1); e_scrollframe_extern_pan_set(v->sframe, v->span, - _pan_set, _pan_get, _pan_max_get, - _pan_child_size_get); + _pan_set, _pan_get, _pan_max_get, + _pan_child_size_get); edje_object_part_swallow(v->bg, "e.swallow.list", v->sframe); evas_object_show(v->sframe); @@ -1687,7 +1685,7 @@ _view_destroy(Evry_View *view) evry_tab_view_free(v->tabs); - EINA_LIST_FREE(v->handlers, h) + EINA_LIST_FREE (v->handlers, h) ecore_event_handler_del(h); E_FREE(v); @@ -1723,3 +1721,4 @@ evry_view_shutdown(void) evry_view_unregister(EVRY_VIEW(view)); E_FREE(view); } + diff --git a/src/modules/everything/evry_view_help.c b/src/modules/everything/evry_view_help.c index d87891e7a..de7e6c2a2 100644 --- a/src/modules/everything/evry_view_help.c +++ b/src/modules/everything/evry_view_help.c @@ -27,30 +27,30 @@ _cb_key_down(Evry_View *v, const Ecore_Event_Key *ev) if (!strcmp(ev->key, "Down")) { - o = v->o_list; - evas_object_geometry_get(o, NULL, NULL, NULL, &h); - if (!h) h = 1; - e_box_align_get(o, NULL, &align); + o = v->o_list; + evas_object_geometry_get(o, NULL, NULL, NULL, &h); + if (!h) h = 1; + e_box_align_get(o, NULL, &align); - align = align - 10.0/(double)h; - if (align < 0.0) align = 0.0; + align = align - 10.0 / (double)h; + 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")) { - o = v->o_list; - evas_object_geometry_get(o, NULL, NULL, NULL, &h); - if (!h) h = 1; - e_box_align_get(o, NULL, &align); + o = v->o_list; + evas_object_geometry_get(o, NULL, NULL, NULL, &h); + if (!h) h = 1; + e_box_align_get(o, NULL, &align); - align = align + 10.0/(double)h; - if (align > 1.0) align = 1.0; + align = align + 10.0 / (double)h; + if (align > 1.0) align = 1.0; - e_box_align_set(v->o_list, 0.5, align); - return 1; + e_box_align_set(v->o_list, 0.5, align); + return 1; } 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; int mw, mh; - + char *text = _(" Ok, here comes the explanation of everything...
" " Just type a few letters of the thing you are looking for.
" @@ -93,7 +93,7 @@ _view_create(Evry_View *v, const Evry_State *s __UNUSED__, const Evas_Object *sw e_box_freeze(v->o_list); o = edje_object_add(evas_object_evas_get(swallow)); 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); e_box_pack_start(v->o_list, o); @@ -141,3 +141,4 @@ evry_view_help_shutdown(void) evry_view_unregister(view); E_FREE(view); } + diff --git a/src/modules/everything/evry_view_tabs.c b/src/modules/everything/evry_view_tabs.c index 82ac2d743..99a668d55 100644 --- a/src/modules/everything/evry_view_tabs.c +++ b/src/modules/everything/evry_view_tabs.c @@ -1,15 +1,14 @@ #include "e_mod_main.h" - typedef struct _Tab Tab; struct _Tab { - Tab_View *tab_view; - Evry_Plugin *plugin; - Evas_Object *o_tab; + Tab_View *tab_view; + Evry_Plugin *plugin; + Evas_Object *o_tab; - int cw, mw; + int cw, mw; }; 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) { - _plugin_select(v, tab->plugin); - v->view->update(v->view); + _plugin_select(v, tab->plugin); + v->view->update(v->view); } else { - evry_browse_back(v->state->selector); + evry_browse_back(v->state->selector); } } + static void _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) { - _plugin_next(v); - v->view->update(v->view); + _plugin_next(v); + v->view->update(v->view); } else if (ev->z < 0) { - _plugin_prev(v); - v->view->update(v->view); + _plugin_prev(v); + v->view->update(v->view); } } + static Tab * _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); if (p) { - e_theme_edje_object_set(o, "base/theme/modules/everything", - "e/modules/everything/tab_item"); - edje_object_part_text_set(o, "e.text.label", EVRY_ITEM(p)->label); + e_theme_edje_object_set(o, "base/theme/modules/everything", + "e/modules/everything/tab_item"); + edje_object_part_text_set(o, "e.text.label", EVRY_ITEM(p)->label); } else { - e_theme_edje_object_set(o, "base/theme/modules/everything", - "e/modules/everything/tab_item/back"); - edje_object_part_text_set(o, "e.text.label", _("Back")); + e_theme_edje_object_set(o, "base/theme/modules/everything", + "e/modules/everything/tab_item/back"); + edje_object_part_text_set(o, "e.text.label", _("Back")); } 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, - _tab_cb_up, tab); + _tab_cb_up, tab); tab->o_tab = o; 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); @@ -119,86 +120,85 @@ _tabs_update(Tab_View *v) if (s->delete_me) return; - + edje_object_calc_force(v->o_tabs); evas_object_geometry_get(v->o_tabs, &x, NULL, &w, NULL); if (!w && !v->timer) { - v->timer = ecore_timer_add(0.001, _timer_cb, v); - return; + v->timer = ecore_timer_add(0.001, _timer_cb, v); + return; } /* remove tabs for not active plugins */ e_box_freeze(v->o_tabs); - EINA_LIST_FOREACH(v->tabs, l, tab) + EINA_LIST_FOREACH (v->tabs, l, tab) { - if (!tab->plugin) - continue; + if (!tab->plugin) + continue; - e_box_unpack(tab->o_tab); - evas_object_hide(tab->o_tab); + e_box_unpack(tab->o_tab); + evas_object_hide(tab->o_tab); } if (s->selector->states->next) { - cur++; - i++; + cur++; + i++; - if (!(tab = eina_list_data_get(v->tabs))) - { - tab = _add_tab(v, NULL); + if (!(tab = eina_list_data_get(v->tabs))) + { + tab = _add_tab(v, NULL); - o = tab->o_tab; - evas_object_show(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); - } + o = tab->o_tab; + evas_object_show(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); + } } - 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 (cur > 2) { - if ((cur + 1) == eina_list_count(s->cur_plugins)) - plugins = eina_list_nth_list(s->cur_plugins, cur - 3); - else - plugins = eina_list_nth_list(s->cur_plugins, cur - 2); + if ((cur + 1) == eina_list_count(s->cur_plugins)) + plugins = eina_list_nth_list(s->cur_plugins, cur - 3); + else + plugins = eina_list_nth_list(s->cur_plugins, cur - 2); } else { - plugins = s->cur_plugins; + plugins = s->cur_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) - if (tab->plugin == p) break; + EINA_LIST_FOREACH (v->tabs, ll, tab) + if (tab->plugin == p) break; - if (!tab && !(tab = _add_tab(v, p))) - continue; + if (!tab && !(tab = _add_tab(v, p))) + continue; - o = tab->o_tab; - evas_object_show(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); + o = tab->o_tab; + evas_object_show(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); - if (s->plugin == p) - edje_object_signal_emit(o, "e,state,selected", "e"); - else - edje_object_signal_emit(o, "e,state,unselected", "e"); + if (s->plugin == p) + edje_object_signal_emit(o, "e,state,selected", "e"); + else + 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_thaw(v->o_tabs); } - static void _tabs_clear(Tab_View *v) { @@ -206,13 +206,13 @@ _tabs_clear(Tab_View *v) Tab *tab; e_box_freeze(v->o_tabs); - EINA_LIST_FOREACH(v->tabs, l, tab) + EINA_LIST_FOREACH (v->tabs, l, tab) { - if (!tab->plugin) - continue; + if (!tab->plugin) + continue; - e_box_unpack(tab->o_tab); - evas_object_hide(tab->o_tab); + e_box_unpack(tab->o_tab); + evas_object_hide(tab->o_tab); } e_box_thaw(v->o_tabs); } @@ -254,23 +254,23 @@ _plugin_next_by_name(Tab_View *v, const char *key) if (!s->plugin) return; - EINA_LIST_FOREACH(s->cur_plugins, l, p) + EINA_LIST_FOREACH (s->cur_plugins, l, p) { - /* if (!p) - * { - * // FIXME how can this happen? - * ERR("plugin == NULL"); - * continue; - * } */ + /* if (!p) + * { + * // FIXME how can this happen? + * ERR("plugin == NULL"); + * continue; + * } */ - if (EVRY_ITEM(p)->label && (!strncasecmp(EVRY_ITEM(p)->label, key, 1))) - { - if (!first) first = p; + if (EVRY_ITEM(p)->label && (!strncasecmp(EVRY_ITEM(p)->label, key, 1))) + { + if (!first) first = p; - if (found && !next) - next = p; - } - if (p == s->plugin) found = 1; + if (found && !next) + next = p; + } + if (p == s->plugin) found = 1; } if (next) @@ -298,15 +298,14 @@ _plugin_prev(Tab_View *v) p = l->prev->data; else { - l = eina_list_last(s->cur_plugins); - if (s->plugin != l->data) - p = l->data; + l = eina_list_last(s->cur_plugins); + if (s->plugin != l->data) + p = l->data; } if (p) _plugin_select(v, p); } - static int _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 (!strcmp(key, "Next")) - { - _plugin_next(v); - return 1; - } - else if (!strcmp(key, "Prior")) - { - _plugin_prev(v); - return 1; - } + if (!strcmp(key, "Next")) + { + _plugin_next(v); + return 1; + } + else if (!strcmp(key, "Prior")) + { + _plugin_prev(v); + return 1; + } } else if (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL) { - if (!strcmp(key, "Left")) - { - _plugin_prev(v); - return 1; - } - else if (!strcmp(key, "Right")) - { - _plugin_next(v); - return 1; - } - else if (ev->compose) - { - _plugin_next_by_name(v, key); - return 1; - } + if (!strcmp(key, "Left")) + { + _plugin_prev(v); + return 1; + } + else if (!strcmp(key, "Right")) + { + _plugin_next(v); + return 1; + } + else if (ev->compose) + { + _plugin_next_by_name(v, key); + return 1; + } } return 0; } - Tab_View * 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; v = E_NEW(Tab_View, 1); - v->update = &_tabs_update; - v->clear = &_tabs_clear; + v->update = &_tabs_update; + v->clear = &_tabs_clear; v->key_down = &_tabs_key_down; v->view = view; 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_homogenous_set(o, 1); evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, - _tabs_cb_wheel, v); + _tabs_cb_wheel, v); v->o_tabs = o; return v; @@ -379,11 +377,11 @@ evry_tab_view_free(Tab_View *v) { Tab *tab; - EINA_LIST_FREE(v->tabs, tab) + EINA_LIST_FREE (v->tabs, tab) { - e_box_unpack(tab->o_tab); - evas_object_del(tab->o_tab); - E_FREE(tab); + e_box_unpack(tab->o_tab); + evas_object_del(tab->o_tab); + E_FREE(tab); } evas_object_del(v->o_tabs); @@ -396,3 +394,4 @@ evry_tab_view_free(Tab_View *v) E_FREE(v); } + diff --git a/src/modules/everything/md5.c b/src/modules/everything/md5.c index b62a9ffe7..89f04050d 100644 --- a/src/modules/everything/md5.c +++ b/src/modules/everything/md5.c @@ -19,135 +19,144 @@ #include "config.h" #endif -#include /* for memcpy() */ +#include /* for memcpy() */ #include "md5.h" #if (__BYTE_ORDER == 1234) -#define byteReverse(buf, len) /* Nothing */ +#define byteReverse(buf, len) /* Nothing */ #else void byteReverse(unsigned char *buf, unsigned longs); /* * 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; - do { - t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | - ((unsigned) buf[1] << 8 | buf[0]); - *(uint32_t *) buf = t; - buf += 4; - } while (--longs); + uint32_t t; + do { + t = (uint32_t)((unsigned)buf[3] << 8 | buf[2]) << 16 | + ((unsigned)buf[1] << 8 | buf[0]); + *(uint32_t *)buf = t; + buf += 4; + } while (--longs); } + #endif /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ -void MD5Init(MD5_CTX *ctx) +void +MD5Init(MD5_CTX *ctx) { - ctx->buf[0] = 0x67452301; - ctx->buf[1] = 0xefcdab89; - ctx->buf[2] = 0x98badcfe; - ctx->buf[3] = 0x10325476; + ctx->buf[0] = 0x67452301; + ctx->buf[1] = 0xefcdab89; + ctx->buf[2] = 0x98badcfe; + ctx->buf[3] = 0x10325476; - ctx->bits[0] = 0; - ctx->bits[1] = 0; + ctx->bits[0] = 0; + ctx->bits[1] = 0; } /* * Update context to reflect the concatenation of another buffer full * 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]; - if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) - ctx->bits[1]++; /* Carry from low to high */ - ctx->bits[1] += len >> 29; + t = ctx->bits[0]; + if ((ctx->bits[0] = t + ((uint32_t)len << 3)) < t) + ctx->bits[1]++; /* Carry from low to high */ + 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) { - unsigned char *p = (unsigned char *) ctx->in + t; + if (t) + { + unsigned char *p = (unsigned char *)ctx->in + t; - t = 64 - t; - if (len < t) { - memcpy(p, buf, len); - return; - } - memcpy(p, buf, t); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - buf += t; - len -= t; - } - /* Process data in 64-byte chunks */ + t = 64 - t; + if (len < t) + { + memcpy(p, buf, len); + return; + } + memcpy(p, buf, t); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *)ctx->in); + buf += t; + len -= t; + } + /* Process data in 64-byte chunks */ - while (len >= 64) { - memcpy(ctx->in, buf, 64); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - buf += 64; - len -= 64; - } + while (len >= 64) { + memcpy(ctx->in, buf, 64); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *)ctx->in); + buf += 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) */ -void MD5Final(unsigned char digest[16], MD5_CTX *ctx) +void +MD5Final(unsigned char digest[16], MD5_CTX *ctx) { - unsigned count; - unsigned char *p; + unsigned count; + unsigned char *p; - /* Compute number of bytes mod 64 */ - count = (ctx->bits[0] >> 3) & 0x3F; + /* Compute number of bytes mod 64 */ + count = (ctx->bits[0] >> 3) & 0x3F; - /* Set the first char of padding to 0x80. This is safe since there is - always at least one byte free */ - p = ctx->in + count; - *p++ = 0x80; + /* Set the first char of padding to 0x80. This is safe since there is + always at least one byte free */ + p = ctx->in + count; + *p++ = 0x80; - /* Bytes of padding needed to make 64 bytes */ - count = 64 - 1 - count; + /* Bytes of padding needed to make 64 bytes */ + count = 64 - 1 - count; - /* Pad out to 56 mod 64 */ - if (count < 8) { - /* Two lots of padding: Pad the first block to 64 bytes */ - memset(p, 0, count); - byteReverse(ctx->in, 16); - MD5Transform(ctx->buf, (uint32_t *) ctx->in); + /* Pad out to 56 mod 64 */ + if (count < 8) + { + /* Two lots of padding: Pad the first block to 64 bytes */ + memset(p, 0, count); + byteReverse(ctx->in, 16); + MD5Transform(ctx->buf, (uint32_t *)ctx->in); - /* Now fill the next block with 56 bytes */ - memset(ctx->in, 0, 56); - } else { - /* Pad block to 56 bytes */ - memset(p, 0, count - 8); - } - byteReverse(ctx->in, 14); + /* Now fill the next block with 56 bytes */ + memset(ctx->in, 0, 56); + } + else { + /* Pad block to 56 bytes */ + memset(p, 0, count - 8); + } + byteReverse(ctx->in, 14); - /* Append length in bits and transform */ - ((uint32_t *) ctx->in)[14] = ctx->bits[0]; - ((uint32_t *) ctx->in)[15] = ctx->bits[1]; + /* Append length in bits and transform */ + ((uint32_t *)ctx->in)[14] = ctx->bits[0]; + ((uint32_t *)ctx->in)[15] = ctx->bits[1]; - MD5Transform(ctx->buf, (uint32_t *) ctx->in); - byteReverse((unsigned char *) ctx->buf, 4); - memcpy(digest, ctx->buf, 16); - memset((char *) ctx, 0, sizeof(ctx)); /* In case it's sensitive */ + MD5Transform(ctx->buf, (uint32_t *)ctx->in); + byteReverse((unsigned char *)ctx->buf, 4); + memcpy(digest, ctx->buf, 16); + memset((char *)ctx, 0, sizeof(ctx)); /* In case it's sensitive */ } /* 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. */ #define MD5STEP(f, w, x, y, z, data, s) \ - ( w += f(x, y, z) + data, w = 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 * reflect the addition of 16 longwords of new data. MD5Update blocks * 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]; - b = buf[1]; - c = buf[2]; - d = buf[3]; + a = buf[0]; + b = buf[1]; + c = buf[2]; + d = buf[3]; - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - buf[0] += a; - buf[1] += b; - buf[2] += c; - buf[3] += d; + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; } +