2009-05-06 07:20:45 -07:00
|
|
|
#include "e_mod_main.h"
|
2010-04-10 13:05:57 -07:00
|
|
|
|
2011-11-29 19:32:54 -08:00
|
|
|
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);
|
2010-05-23 00:35:48 -07:00
|
|
|
static Eina_List *_evry_types = NULL;
|
2009-05-06 07:20:45 -07:00
|
|
|
static E_Int_Menu_Augmentation *maug = NULL;
|
2009-08-22 22:46:54 -07:00
|
|
|
static E_Action *act = NULL;
|
2010-05-23 00:35:48 -07:00
|
|
|
static Ecore_Timer *cleanup_timer;
|
2011-04-08 16:03:12 -07:00
|
|
|
static const char *module_icon = NULL;
|
2009-06-08 09:37:40 -07:00
|
|
|
static E_Config_DD *conf_edd = NULL;
|
2010-04-20 08:22:01 -07:00
|
|
|
static E_Config_DD *plugin_conf_edd = NULL;
|
2011-08-21 08:41:37 -07:00
|
|
|
static E_Config_DD *gadget_conf_edd = NULL;
|
2009-07-29 13:43:09 -07:00
|
|
|
|
2011-08-12 04:41:15 -07:00
|
|
|
Evry_API *evry = NULL;
|
2010-05-22 01:05:25 -07:00
|
|
|
Evry_Config *evry_conf = NULL;
|
2010-06-02 16:19:02 -07:00
|
|
|
int _evry_events[NUM_EVRY_EVENTS];
|
2011-11-12 16:07:35 -08:00
|
|
|
E_Module *_mod_evry = NULL;
|
2010-04-28 06:54:35 -07:00
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
/* module setup */
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API E_Module_Api e_modapi =
|
2011-11-29 19:32:54 -08:00
|
|
|
{
|
|
|
|
E_MODULE_API_VERSION,
|
|
|
|
"Everything"
|
|
|
|
};
|
2009-05-06 07:20:45 -07:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void *
|
2009-05-06 07:20:45 -07:00
|
|
|
e_modapi_init(E_Module *m)
|
|
|
|
{
|
2010-05-10 15:35:13 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Evry_Module *em;
|
2011-04-08 16:03:12 -07:00
|
|
|
char buf[4096];
|
2010-05-20 08:41:27 -07:00
|
|
|
|
2011-11-12 16:07:35 -08:00
|
|
|
_mod_evry = m;
|
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
/* add module supplied action */
|
|
|
|
act = e_action_add("everything");
|
|
|
|
if (act)
|
|
|
|
{
|
2011-11-29 19:32:54 -08:00
|
|
|
act->func.go = _e_mod_action_cb;
|
|
|
|
act->func.go_edge = _e_mod_action_cb_edge;
|
|
|
|
e_action_predef_name_set
|
2013-01-03 07:27:10 -08:00
|
|
|
(N_("Everything Launcher"),
|
|
|
|
N_("Show Everything Launcher"),
|
2011-11-29 19:32:54 -08:00
|
|
|
"everything", "", NULL, 0);
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
2009-08-17 16:54:16 -07:00
|
|
|
|
2010-05-01 12:27:26 -07:00
|
|
|
maug = e_int_menus_menu_augmentation_add
|
2011-11-29 19:32:54 -08:00
|
|
|
("main/1", _e_mod_menu_add, NULL, NULL, NULL);
|
2009-06-11 07:50:34 -07:00
|
|
|
|
2010-05-01 12:27:26 -07:00
|
|
|
e_configure_registry_category_add
|
2011-04-08 16:03:12 -07:00
|
|
|
("launcher", 80, _("Launcher"), NULL, "modules-launcher");
|
2009-08-18 17:27:41 -07:00
|
|
|
|
2011-04-08 16:03:12 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/e-module-everything.edj", e_module_dir_get(m));
|
|
|
|
module_icon = eina_stringshare_add(buf);
|
2011-11-29 19:32:54 -08:00
|
|
|
|
2010-05-01 12:27:26 -07:00
|
|
|
e_configure_registry_item_add
|
2011-04-08 16:03:12 -07:00
|
|
|
("launcher/run_everything", 40, _("Everything Configuration"),
|
2011-11-29 19:32:54 -08:00
|
|
|
NULL, module_icon, evry_config_dialog);
|
2009-08-16 20:30:04 -07:00
|
|
|
evry_init();
|
2009-08-17 16:54:16 -07:00
|
|
|
|
2011-02-23 21:08:26 -08:00
|
|
|
_evry_type_init("NONE");
|
|
|
|
_evry_type_init("FILE");
|
|
|
|
_evry_type_init("DIRECTORY");
|
|
|
|
_evry_type_init("APPLICATION");
|
|
|
|
_evry_type_init("ACTION");
|
|
|
|
_evry_type_init("PLUGIN");
|
|
|
|
_evry_type_init("BORDER");
|
|
|
|
_evry_type_init("TEXT");
|
2010-05-23 00:35:48 -07:00
|
|
|
|
2011-02-23 21:08:26 -08:00
|
|
|
_config_init();
|
2011-11-29 19:32:54 -08:00
|
|
|
|
|
|
|
_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();
|
2010-05-23 00:35:48 -07:00
|
|
|
_evry_events[EVRY_EVENT_ACTION_PERFORMED] = ecore_event_type_new();
|
2011-11-29 19:32:54 -08:00
|
|
|
_evry_events[EVRY_EVENT_PLUGIN_SELECTED] = ecore_event_type_new();
|
|
|
|
|
2011-08-12 03:58:44 -07:00
|
|
|
evry = E_NEW(Evry_API, 1);
|
|
|
|
#define SET(func) (evry->func = &evry_##func);
|
2010-05-10 15:35:13 -07:00
|
|
|
SET(api_version_check);
|
|
|
|
SET(item_new);
|
|
|
|
SET(item_free);
|
|
|
|
SET(item_ref);
|
|
|
|
SET(plugin_new);
|
|
|
|
SET(plugin_free);
|
|
|
|
SET(plugin_register);
|
|
|
|
SET(plugin_unregister);
|
|
|
|
SET(plugin_update);
|
2010-05-28 13:32:07 -07:00
|
|
|
SET(plugin_find);
|
2010-05-10 15:35:13 -07:00
|
|
|
SET(action_new);
|
|
|
|
SET(action_free);
|
|
|
|
SET(action_register);
|
|
|
|
SET(action_unregister);
|
2010-05-10 18:53:34 -07:00
|
|
|
SET(action_find);
|
2010-05-10 15:35:13 -07:00
|
|
|
SET(api_version_check);
|
|
|
|
SET(type_register);
|
|
|
|
SET(icon_theme_get);
|
|
|
|
SET(fuzzy_match);
|
|
|
|
SET(util_exec_app);
|
|
|
|
SET(util_url_escape);
|
|
|
|
SET(util_url_unescape);
|
|
|
|
SET(util_file_detail_set);
|
|
|
|
SET(util_plugin_items_add);
|
|
|
|
SET(util_md5_sum);
|
|
|
|
SET(util_icon_get);
|
2010-05-11 10:24:38 -07:00
|
|
|
SET(item_changed);
|
2010-05-10 15:35:13 -07:00
|
|
|
SET(file_path_get);
|
|
|
|
SET(file_url_get);
|
2010-05-11 10:24:38 -07:00
|
|
|
SET(history_item_add);
|
|
|
|
SET(history_types_get);
|
|
|
|
SET(history_item_usage_set);
|
2010-05-23 00:35:48 -07:00
|
|
|
SET(event_handler_add);
|
2010-05-10 15:35:13 -07:00
|
|
|
#undef SET
|
2010-05-20 08:41:27 -07:00
|
|
|
|
2011-02-23 21:08:26 -08:00
|
|
|
evry_history_init();
|
|
|
|
evry_plug_actions_init();
|
2011-04-08 15:16:59 -07:00
|
|
|
evry_plug_apps_init(m);
|
|
|
|
evry_plug_files_init(m);
|
|
|
|
evry_plug_windows_init(m);
|
|
|
|
evry_plug_settings_init(m);
|
|
|
|
evry_plug_calc_init(m);
|
2011-08-12 04:41:15 -07:00
|
|
|
e_datastore_set("evry_api", evry);
|
2010-05-10 15:35:13 -07:00
|
|
|
|
2011-11-29 19:32:54 -08:00
|
|
|
EINA_LIST_FOREACH (e_datastore_get("evry_modules"), l, em)
|
2011-08-12 04:41:15 -07:00
|
|
|
em->active = em->init(evry);
|
2010-05-20 08:41:27 -07:00
|
|
|
|
2011-02-23 21:08:26 -08:00
|
|
|
evry_plug_collection_init();
|
|
|
|
evry_plug_clipboard_init();
|
|
|
|
evry_plug_text_init();
|
|
|
|
evry_view_init();
|
|
|
|
evry_view_help_init();
|
|
|
|
evry_gadget_init();
|
2011-11-12 16:04:58 -08:00
|
|
|
|
2010-05-01 16:24:14 -07:00
|
|
|
/* cleanup every hour :) */
|
2017-02-03 13:52:28 -08:00
|
|
|
cleanup_timer = ecore_timer_loop_add(3600, _cleanup_history, NULL);
|
2010-05-01 16:24:14 -07:00
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
e_modapi_shutdown(E_Module *m EINA_UNUSED)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-07-06 05:08:57 -07:00
|
|
|
E_Config_Dialog *cfd;
|
2010-04-28 09:39:50 -07:00
|
|
|
const char *t;
|
2010-05-10 15:35:13 -07:00
|
|
|
Eina_List *l;
|
|
|
|
Evry_Module *em;
|
2010-05-20 08:41:27 -07:00
|
|
|
|
2011-11-29 19:32:54 -08:00
|
|
|
EINA_LIST_FOREACH (e_datastore_get("evry_modules"), l, em)
|
2011-08-12 11:27:41 -07:00
|
|
|
{
|
2011-11-29 19:32:54 -08:00
|
|
|
if (em->active)
|
|
|
|
em->shutdown();
|
2011-08-12 11:27:41 -07:00
|
|
|
|
2011-11-29 19:32:54 -08:00
|
|
|
em->active = EINA_FALSE;
|
2011-08-12 11:27:41 -07:00
|
|
|
}
|
2011-11-29 19:32:54 -08:00
|
|
|
|
2011-04-08 15:16:59 -07:00
|
|
|
evry_plug_apps_shutdown();
|
|
|
|
evry_plug_files_shutdown();
|
|
|
|
evry_plug_settings_shutdown();
|
|
|
|
evry_plug_windows_shutdown();
|
|
|
|
evry_plug_calc_shutdown();
|
2010-04-10 13:05:57 -07:00
|
|
|
evry_plug_clipboard_shutdown();
|
2010-04-22 12:17:51 -07:00
|
|
|
evry_plug_text_shutdown();
|
2010-05-28 13:32:07 -07:00
|
|
|
evry_plug_collection_shutdown();
|
2010-04-27 20:22:40 -07:00
|
|
|
evry_plug_actions_shutdown();
|
2011-08-12 04:41:15 -07:00
|
|
|
evry_view_shutdown();
|
|
|
|
evry_view_help_shutdown();
|
|
|
|
evry_gadget_shutdown();
|
|
|
|
evry_shutdown();
|
|
|
|
|
|
|
|
e_datastore_del("evry_api");
|
|
|
|
E_FREE(evry);
|
|
|
|
evry = NULL;
|
2010-04-10 14:38:36 -07:00
|
|
|
|
2010-04-28 04:28:45 -07:00
|
|
|
_config_free();
|
|
|
|
evry_history_free();
|
|
|
|
|
2011-11-29 19:32:54 -08:00
|
|
|
EINA_LIST_FREE (_evry_types, t)
|
2010-04-28 09:39:50 -07:00
|
|
|
eina_stringshare_del(t);
|
2010-05-06 06:09:14 -07:00
|
|
|
|
2011-04-08 16:03:12 -07:00
|
|
|
e_configure_registry_item_del("launcher/run_everything");
|
|
|
|
e_configure_registry_category_del("launcher");
|
2010-04-10 14:38:36 -07:00
|
|
|
|
2012-10-01 23:29:21 -07:00
|
|
|
while ((cfd = e_config_dialog_get("E", "launcher/run_everything")))
|
2009-08-18 17:27:41 -07:00
|
|
|
e_object_del(E_OBJECT(cfd));
|
|
|
|
|
2010-04-28 04:28:45 -07:00
|
|
|
if (act)
|
|
|
|
{
|
2013-01-03 07:27:10 -08:00
|
|
|
e_action_predef_name_del("Everything Launcher",
|
|
|
|
"Show Everything Launcher");
|
2011-11-29 19:32:54 -08:00
|
|
|
e_action_del("everything");
|
2010-04-28 04:28:45 -07:00
|
|
|
}
|
2009-06-08 09:37:40 -07:00
|
|
|
|
2010-04-28 04:28:45 -07:00
|
|
|
if (maug)
|
|
|
|
{
|
2011-11-29 19:32:54 -08:00
|
|
|
e_int_menus_menu_augmentation_del("main/1", maug);
|
|
|
|
maug = NULL;
|
2010-04-28 04:28:45 -07:00
|
|
|
}
|
2009-08-22 22:46:54 -07:00
|
|
|
|
2011-04-08 16:03:12 -07:00
|
|
|
if (module_icon)
|
|
|
|
eina_stringshare_del(module_icon);
|
2011-11-29 19:32:54 -08:00
|
|
|
|
2009-06-08 09:37:40 -07:00
|
|
|
/* Clean EET */
|
|
|
|
E_CONFIG_DD_FREE(conf_edd);
|
2010-04-20 08:22:01 -07:00
|
|
|
E_CONFIG_DD_FREE(plugin_conf_edd);
|
2011-08-21 08:41:37 -07:00
|
|
|
E_CONFIG_DD_FREE(gadget_conf_edd);
|
2010-05-01 16:24:14 -07:00
|
|
|
|
|
|
|
if (cleanup_timer)
|
|
|
|
ecore_timer_del(cleanup_timer);
|
2010-05-06 06:09:14 -07:00
|
|
|
|
2010-05-30 12:16:33 -07:00
|
|
|
#ifdef CHECK_REFS
|
|
|
|
Evry_Item *it;
|
2011-11-29 19:32:54 -08:00
|
|
|
EINA_LIST_FREE (_refd, it)
|
2010-05-30 12:16:33 -07:00
|
|
|
printf("%d %s\n", it->ref, it->label);
|
|
|
|
#endif
|
|
|
|
|
2011-11-12 16:07:35 -08:00
|
|
|
_mod_evry = NULL;
|
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
e_modapi_save(E_Module *m EINA_UNUSED)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2009-06-08 09:37:40 -07:00
|
|
|
e_config_domain_save("module.everything", conf_edd, evry_conf);
|
2011-04-08 15:16:59 -07:00
|
|
|
|
|
|
|
evry_plug_apps_save();
|
|
|
|
evry_plug_files_save();
|
|
|
|
evry_plug_settings_save();
|
|
|
|
evry_plug_windows_save();
|
|
|
|
evry_plug_calc_save();
|
2011-11-29 19:32:54 -08:00
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-05-22 01:05:25 -07:00
|
|
|
/***************************************************************************/
|
|
|
|
|
2010-05-23 00:35:48 -07:00
|
|
|
Ecore_Event_Handler *
|
2011-11-29 19:32:54 -08:00
|
|
|
evry_event_handler_add(int type, Eina_Bool (*func)(void *data, int type, void *event), const void *data)
|
2010-05-23 00:35:48 -07:00
|
|
|
{
|
|
|
|
return ecore_event_handler_add(_evry_events[type], func, data);
|
|
|
|
}
|
|
|
|
|
2010-05-22 01:05:25 -07:00
|
|
|
Evry_Type
|
|
|
|
evry_type_register(const char *type)
|
|
|
|
{
|
|
|
|
const char *t = eina_stringshare_add(type);
|
2010-05-23 00:35:48 -07:00
|
|
|
Evry_Type ret = NUM_EVRY_TYPES;
|
2010-05-22 01:05:25 -07:00
|
|
|
const char *i;
|
|
|
|
Eina_List *l;
|
|
|
|
|
2011-11-29 19:32:54 -08:00
|
|
|
EINA_LIST_FOREACH (_evry_types, l, i)
|
2010-05-22 01:05:25 -07:00
|
|
|
{
|
2011-11-29 19:32:54 -08:00
|
|
|
if (i == t) break;
|
|
|
|
ret++;
|
2010-05-22 01:05:25 -07:00
|
|
|
}
|
|
|
|
|
2011-11-29 19:32:54 -08:00
|
|
|
if (!l)
|
2010-05-22 01:05:25 -07:00
|
|
|
{
|
2011-11-29 19:32:54 -08:00
|
|
|
_evry_types = eina_list_append(_evry_types, t);
|
|
|
|
return ret;
|
2010-05-22 01:05:25 -07:00
|
|
|
}
|
|
|
|
eina_stringshare_del(t);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-05-23 00:35:48 -07:00
|
|
|
static void
|
|
|
|
_evry_type_init(const char *type)
|
|
|
|
{
|
|
|
|
const char *t = eina_stringshare_add(type);
|
|
|
|
_evry_types = eina_list_append(_evry_types, t);
|
|
|
|
}
|
|
|
|
|
2010-05-22 01:05:25 -07:00
|
|
|
const char *
|
|
|
|
evry_type_get(Evry_Type type)
|
|
|
|
{
|
|
|
|
const char *ret = eina_list_nth(_evry_types, type);
|
|
|
|
if (!ret)
|
|
|
|
return eina_stringshare_add("");
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-11-29 19:32:54 -08:00
|
|
|
int
|
|
|
|
evry_api_version_check(int version)
|
2010-05-22 01:05:25 -07:00
|
|
|
{
|
|
|
|
if (EVRY_API_VERSION == version)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
ERR("module API is %d, required is %d", version, EVRY_API_VERSION);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_evry_cb_view_sort(const void *data1, const void *data2)
|
|
|
|
{
|
|
|
|
const Evry_View *v1 = data1;
|
|
|
|
const Evry_View *v2 = data2;
|
|
|
|
return v1->priority - v2->priority;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evry_view_register(Evry_View *view, int priority)
|
|
|
|
{
|
|
|
|
view->priority = priority;
|
|
|
|
|
|
|
|
evry_conf->views = eina_list_append(evry_conf->views, view);
|
|
|
|
|
|
|
|
evry_conf->views = eina_list_sort(evry_conf->views,
|
2011-11-29 19:32:54 -08:00
|
|
|
eina_list_count(evry_conf->views),
|
|
|
|
_evry_cb_view_sort);
|
2010-05-22 01:05:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evry_view_unregister(Evry_View *view)
|
|
|
|
{
|
|
|
|
evry_conf->views = eina_list_remove(evry_conf->views, view);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_cleanup_history(void *data EINA_UNUSED)
|
2010-05-01 16:24:14 -07:00
|
|
|
{
|
2010-05-12 19:52:02 -07:00
|
|
|
/* evrything is active */
|
|
|
|
if (evry_hist)
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
2010-05-12 19:52:02 -07:00
|
|
|
|
2010-05-01 16:24:14 -07:00
|
|
|
/* cleanup old entries */
|
|
|
|
evry_history_free();
|
|
|
|
evry_history_init();
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
2010-05-01 16:24:14 -07:00
|
|
|
}
|
|
|
|
|
2009-08-30 01:51:15 -07:00
|
|
|
static void
|
|
|
|
_config_init()
|
|
|
|
{
|
2010-05-28 13:32:07 -07:00
|
|
|
Plugin_Config *pc, *pcc;
|
|
|
|
|
2009-08-30 01:51:15 -07:00
|
|
|
#undef T
|
|
|
|
#undef D
|
|
|
|
#define T Plugin_Config
|
2010-04-20 08:22:01 -07:00
|
|
|
#define D plugin_conf_edd
|
|
|
|
plugin_conf_edd = E_CONFIG_DD_NEW("Plugin_Config", Plugin_Config);
|
2009-08-30 01:51:15 -07:00
|
|
|
E_CONFIG_VAL(D, T, name, STR);
|
|
|
|
E_CONFIG_VAL(D, T, enabled, INT);
|
|
|
|
E_CONFIG_VAL(D, T, priority, INT);
|
2010-04-23 13:48:22 -07:00
|
|
|
E_CONFIG_VAL(D, T, trigger, STR);
|
|
|
|
E_CONFIG_VAL(D, T, trigger_only, INT);
|
|
|
|
E_CONFIG_VAL(D, T, view_mode, INT);
|
2010-05-06 06:09:14 -07:00
|
|
|
E_CONFIG_VAL(D, T, aggregate, INT);
|
|
|
|
E_CONFIG_VAL(D, T, top_level, INT);
|
|
|
|
E_CONFIG_VAL(D, T, min_query, INT);
|
2010-05-28 13:32:07 -07:00
|
|
|
E_CONFIG_LIST(D, T, plugins, plugin_conf_edd);
|
2009-08-30 01:51:15 -07:00
|
|
|
#undef T
|
|
|
|
#undef D
|
2011-08-21 08:41:37 -07:00
|
|
|
#define T Gadget_Config
|
|
|
|
#define D gadget_conf_edd
|
|
|
|
gadget_conf_edd = E_CONFIG_DD_NEW("Gadget_Config", Gadget_Config);
|
|
|
|
E_CONFIG_VAL(D, T, id, STR);
|
|
|
|
E_CONFIG_VAL(D, T, plugin, STR);
|
|
|
|
E_CONFIG_VAL(D, T, hide_after_action, INT);
|
|
|
|
E_CONFIG_VAL(D, T, popup, INT);
|
|
|
|
#undef T
|
|
|
|
#undef D
|
2010-04-10 13:05:57 -07:00
|
|
|
#define T Evry_Config
|
2009-08-30 01:51:15 -07:00
|
|
|
#define D conf_edd
|
2010-04-10 13:05:57 -07:00
|
|
|
conf_edd = E_CONFIG_DD_NEW("Config", Evry_Config);
|
2009-08-30 01:51:15 -07:00
|
|
|
E_CONFIG_VAL(D, T, version, INT);
|
|
|
|
E_CONFIG_VAL(D, T, width, INT);
|
|
|
|
E_CONFIG_VAL(D, T, height, INT);
|
2010-05-26 08:09:51 -07:00
|
|
|
E_CONFIG_VAL(D, T, edge_width, INT);
|
|
|
|
E_CONFIG_VAL(D, T, edge_height, INT);
|
2009-08-30 01:51:15 -07:00
|
|
|
E_CONFIG_VAL(D, T, rel_x, DOUBLE);
|
|
|
|
E_CONFIG_VAL(D, T, rel_y, DOUBLE);
|
|
|
|
E_CONFIG_VAL(D, T, scroll_animate, INT);
|
|
|
|
E_CONFIG_VAL(D, T, scroll_speed, DOUBLE);
|
|
|
|
E_CONFIG_VAL(D, T, hide_input, INT);
|
|
|
|
E_CONFIG_VAL(D, T, hide_list, INT);
|
|
|
|
E_CONFIG_VAL(D, T, quick_nav, INT);
|
2009-09-24 14:09:25 -07:00
|
|
|
E_CONFIG_VAL(D, T, view_mode, INT);
|
|
|
|
E_CONFIG_VAL(D, T, view_zoom, INT);
|
|
|
|
E_CONFIG_VAL(D, T, cycle_mode, INT);
|
2009-09-24 17:27:36 -07:00
|
|
|
E_CONFIG_VAL(D, T, history_sort_mode, INT);
|
2010-04-20 08:22:01 -07:00
|
|
|
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);
|
2011-11-29 19:32:54 -08:00
|
|
|
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);
|
2010-04-20 11:49:42 -07:00
|
|
|
E_CONFIG_VAL(D, T, first_run, UCHAR);
|
2009-08-30 01:51:15 -07:00
|
|
|
#undef T
|
|
|
|
#undef D
|
2010-05-26 08:34:31 -07:00
|
|
|
evry_conf = e_config_domain_load("module.everything", conf_edd);
|
2010-04-10 19:34:18 -07:00
|
|
|
|
2011-08-31 05:57:07 -07:00
|
|
|
if (evry_conf && !e_util_module_config_check(_("Everything Module"),
|
2011-11-29 19:32:54 -08:00
|
|
|
evry_conf->version,
|
|
|
|
MOD_CONFIG_FILE_VERSION))
|
2010-05-12 19:52:02 -07:00
|
|
|
_config_free();
|
|
|
|
|
2009-08-30 01:51:15 -07:00
|
|
|
if (!evry_conf)
|
|
|
|
{
|
2011-11-29 19:32:54 -08:00
|
|
|
evry_conf = E_NEW(Evry_Config, 1);
|
2010-05-20 08:41:27 -07:00
|
|
|
|
2012-12-21 15:57:05 -08:00
|
|
|
/* setup defaults */
|
|
|
|
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);
|
|
|
|
|
|
|
|
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("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);
|
|
|
|
evry_conf->width = 464;
|
|
|
|
evry_conf->height = 366;
|
|
|
|
}
|
2011-11-29 19:32:54 -08:00
|
|
|
|
|
|
|
evry_conf->version = MOD_CONFIG_FILE_VERSION;
|
2009-08-30 01:51:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-05-28 13:32:07 -07:00
|
|
|
_config_free(void)
|
2009-08-30 01:51:15 -07:00
|
|
|
{
|
2010-05-28 13:32:07 -07:00
|
|
|
Plugin_Config *pc, *pc2;
|
2011-08-21 08:41:37 -07:00
|
|
|
Gadget_Config *gc;
|
2011-11-29 19:32:54 -08:00
|
|
|
|
|
|
|
EINA_LIST_FREE (evry_conf->collections, pc)
|
2012-08-29 00:16:51 -07:00
|
|
|
{
|
|
|
|
EINA_LIST_FREE (pc->plugins, pc2)
|
|
|
|
{
|
|
|
|
IF_RELEASE(pc2->name);
|
|
|
|
IF_RELEASE(pc2->trigger);
|
|
|
|
E_FREE(pc2);
|
|
|
|
}
|
2012-09-19 08:17:02 -07:00
|
|
|
// collections become registered as SUBJECT
|
|
|
|
// plugin, therefore dont free pc here
|
|
|
|
}
|
|
|
|
|
|
|
|
EINA_LIST_FREE (evry_conf->conf_subjects, pc)
|
|
|
|
{
|
|
|
|
IF_RELEASE(pc->name);
|
|
|
|
IF_RELEASE(pc->trigger);
|
|
|
|
E_FREE(pc);
|
|
|
|
}
|
|
|
|
EINA_LIST_FREE (evry_conf->conf_actions, pc)
|
|
|
|
{
|
|
|
|
IF_RELEASE(pc->name);
|
|
|
|
IF_RELEASE(pc->trigger);
|
|
|
|
E_FREE(pc);
|
|
|
|
}
|
|
|
|
EINA_LIST_FREE (evry_conf->conf_objects, pc)
|
|
|
|
{
|
|
|
|
IF_RELEASE(pc->name);
|
|
|
|
IF_RELEASE(pc->trigger);
|
|
|
|
E_FREE(pc);
|
2012-08-29 00:16:51 -07:00
|
|
|
}
|
2012-08-28 05:29:34 -07:00
|
|
|
EINA_LIST_FREE (evry_conf->conf_views, pc)
|
|
|
|
{
|
|
|
|
IF_RELEASE(pc->name);
|
|
|
|
IF_RELEASE(pc->trigger);
|
|
|
|
E_FREE(pc);
|
|
|
|
}
|
2011-11-29 19:32:54 -08:00
|
|
|
EINA_LIST_FREE (evry_conf->gadgets, gc)
|
2011-08-21 08:41:37 -07:00
|
|
|
{
|
2011-11-29 19:32:54 -08:00
|
|
|
IF_RELEASE(gc->id);
|
|
|
|
IF_RELEASE(gc->plugin);
|
|
|
|
E_FREE(gc);
|
2011-08-21 08:41:37 -07:00
|
|
|
}
|
2010-05-06 06:09:14 -07:00
|
|
|
|
2009-08-30 01:51:15 -07:00
|
|
|
E_FREE(evry_conf);
|
|
|
|
}
|
|
|
|
|
2010-05-23 00:35:48 -07:00
|
|
|
/***************************************************************************/
|
2009-05-06 07:20:45 -07:00
|
|
|
/* action callback */
|
2010-05-23 00:35:48 -07:00
|
|
|
|
2010-05-21 23:35:46 -07:00
|
|
|
static Ecore_Idle_Enterer *_idler = NULL;
|
2010-05-21 04:28:13 -07:00
|
|
|
static const char *_params = NULL;
|
2010-04-08 21:14:09 -07:00
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2010-04-08 21:14:09 -07:00
|
|
|
_e_mod_run_defer_cb(void *data)
|
|
|
|
{
|
|
|
|
E_Zone *zone;
|
|
|
|
|
|
|
|
zone = data;
|
2011-08-16 16:26:07 -07:00
|
|
|
if (zone) evry_show(zone, E_ZONE_EDGE_NONE, _params, EINA_TRUE);
|
2010-05-21 23:35:46 -07:00
|
|
|
|
|
|
|
_idler = NULL;
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2010-04-08 21:14:09 -07:00
|
|
|
}
|
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
static void
|
2015-03-13 14:19:17 -07:00
|
|
|
_e_mod_action_cb(E_Object *obj EINA_UNUSED, const char *params)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
|
|
|
E_Zone *zone = NULL;
|
|
|
|
|
2015-03-13 14:19:17 -07:00
|
|
|
zone = e_zone_current_get();
|
2009-08-18 17:45:10 -07:00
|
|
|
if (!zone) return;
|
|
|
|
|
2010-05-21 04:28:13 -07:00
|
|
|
IF_RELEASE(_params);
|
2009-08-18 17:45:10 -07:00
|
|
|
if (params && params[0])
|
2010-05-21 04:28:13 -07:00
|
|
|
_params = eina_stringshare_add(params);
|
2010-05-21 23:35:46 -07:00
|
|
|
/* if (zone) evry_show(zone, _params); */
|
2010-05-21 04:28:13 -07:00
|
|
|
|
2010-05-21 23:35:46 -07:00
|
|
|
if (_idler) ecore_idle_enterer_del(_idler);
|
2011-11-29 19:32:54 -08:00
|
|
|
_idler = ecore_idle_enterer_add(_e_mod_run_defer_cb, zone);
|
2009-05-06 07:20:45 -07:00
|
|
|
}
|
|
|
|
|
2010-05-26 08:09:51 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_mod_action_cb_edge(E_Object *obj EINA_UNUSED, const char *params, E_Event_Zone_Edge *ev)
|
2010-05-26 08:09:51 -07:00
|
|
|
{
|
|
|
|
IF_RELEASE(_params);
|
|
|
|
if (params && params[0])
|
|
|
|
_params = eina_stringshare_add(params);
|
|
|
|
|
|
|
|
if (_idler) ecore_idle_enterer_del(_idler);
|
|
|
|
|
2011-08-16 16:26:07 -07:00
|
|
|
evry_show(ev->zone, ev->edge, _params, EINA_TRUE);
|
2010-05-26 08:09:51 -07:00
|
|
|
}
|
|
|
|
|
2009-05-06 07:20:45 -07:00
|
|
|
/* menu item callback(s) */
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_mod_run_cb(void *data EINA_UNUSED, E_Menu *m, E_Menu_Item *mi EINA_UNUSED)
|
2009-05-06 07:20:45 -07:00
|
|
|
{
|
2010-05-23 00:35:48 -07:00
|
|
|
IF_RELEASE(_params);
|
2009-05-06 07:20:45 -07:00
|
|
|
ecore_idle_enterer_add(_e_mod_run_defer_cb, m->zone);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* menu item add hook */
|
2009-06-11 07:50:34 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_mod_menu_add(void *data EINA_UNUSED, E_Menu *m)
|
2009-06-11 07:50:34 -07:00
|
|
|
{
|
|
|
|
E_Menu_Item *mi;
|
|
|
|
|
|
|
|
mi = e_menu_item_new(m);
|
|
|
|
e_menu_item_label_set(mi, _("Run Everything"));
|
|
|
|
e_util_menu_item_theme_icon_set(mi, "system-run");
|
|
|
|
e_menu_item_callback_set(mi, _e_mod_run_cb, NULL);
|
|
|
|
}
|
2011-11-29 19:32:54 -08:00
|
|
|
|