static const char *module_icon = NULL;
static E_Config_DD *conf_edd = NULL;
static E_Config_DD *plugin_conf_edd = NULL;
+static E_Config_DD *gadget_conf_edd = NULL;
static int _e_module_evry_log_dom = -1;
Evry_API *evry = NULL;
/* Clean EET */
E_CONFIG_DD_FREE(conf_edd);
E_CONFIG_DD_FREE(plugin_conf_edd);
+ E_CONFIG_DD_FREE(gadget_conf_edd);
if (cleanup_timer)
ecore_timer_del(cleanup_timer);
E_CONFIG_LIST(D, T, plugins, plugin_conf_edd);
#undef T
#undef D
+#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
#define T Evry_Config
#define D conf_edd
conf_edd = E_CONFIG_DD_NEW("Config", Evry_Config);
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_VAL(D, T, first_run, UCHAR);
#undef T
#undef D
_config_free(void)
{
Plugin_Config *pc, *pc2;
-
+ Gadget_Config *gc;
+
EINA_LIST_FREE(evry_conf->collections, pc)
EINA_LIST_FREE(pc->plugins, pc2)
{
IF_RELEASE(pc2->trigger);
E_FREE(pc2);
}
-
EINA_LIST_FREE(evry_conf->conf_subjects, pc)
{
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);
+ }
E_FREE(evry_conf);
}
typedef struct _Evry_Selector Evry_Selector;
typedef struct _Tab_View Tab_View;
typedef struct _Evry_Window Evry_Window;
+typedef struct _Gadget_Config Gadget_Config;
struct _Evry_Window
{
/* use up/down keys for prev/next in thumb view */
int cycle_mode;
+ Eina_List *gadgets;
+
unsigned char first_run;
-
/* not saved data */
Eina_List *actions;
Eina_List *views;
int min_w, min_h;
};
+struct _Gadget_Config
+{
+ const char *id;
+ const char *plugin;
+ int hide_after_action;
+ int popup;
+};
+
struct _History
{
int version;
Evry_Window *evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup);
void evry_hide(Evry_Window *win, int clear);
-int evry_plug_actions_init();
-void evry_plug_actions_shutdown();
+int evry_plug_actions_init(void);
+void evry_plug_actions_shutdown(void);
-Evry_Plugin *evry_aggregator_new(Evry_Window *win, int type);
+Evry_Plugin *evry_aggregator_new(int type);
void evry_history_init(void);
void evry_history_free(void);
ERR("no state");
return 0;
}
-
+
if (s->aggregator->fetch(s->aggregator, s->input))
{
l = eina_list_data_find_list(s->cur_plugins, s->aggregator);
- if (l && l->prev)
- s->cur_plugins = eina_list_promote_list(s->cur_plugins, l);
- else if (!l)
+ if (!l)
s->cur_plugins = eina_list_prepend(s->cur_plugins, s->aggregator);
- }
- else
- {
- s->cur_plugins = eina_list_remove(s->cur_plugins, s->aggregator);
+ else
+ s->cur_plugins = eina_list_promote_list(s->cur_plugins, l);
+
+ return 1;
}
+ s->cur_plugins = eina_list_remove(s->cur_plugins, s->aggregator);
+
return 1;
}
Evry_Selector *sel = E_NEW(Evry_Selector, 1);
Evas_Object *o = NULL;
- sel->aggregator = evry_aggregator_new(win, type);
+ sel->aggregator = evry_aggregator_new(type);
if (type == EVRY_PLUGIN_SUBJECT)
{
EINA_LIST_FREE(EVRY_PLUGIN(_p)->items, it) \
if (it) it->fuzzy_match = 0; }
+#define EVRY_PLUGIN_HAS_ITEMS(_p) !!(EVRY_PLUGIN(_p)->items)
+
/*** Evry_Action macros ***/
#define EVRY_ACTION_NEW(_name, _in1, _in2, _icon, _action, _check) \
evry->action_new(N_(_name), _(_name), _in1, _in2, _icon, _action, _check)
}
e_config_save_queue();
+
return 1;
}
E_Object_Delfn *del_fn;
Evry_Window *win;
+ Gadget_Config *cfg;
+ E_Config_Dialog *cfd;
+ E_Menu *menu;
};
static void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static 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 const E_Gadcon_Client_Class _gadcon_class =
{
E_GADCON_CLIENT_STYLE_PLAIN
};
-static E_Menu *_menu = NULL;
+static int uuid = 0;
static E_Gadcon_Client *
Evas_Object *o;
E_Gadcon_Client *gcc;
Instance *inst;
-
+ /* Evry_Plugin *p; */
+
inst = E_NEW(Instance, 1);
-
+ inst->cfg = _conf_item_get(id);
+
o = edje_object_add(gc->evas);
+
+ /* if ((p = evry_plugin_find(id->name)))
+ * o = evry_util_icon_get(EVRY_ITEM(p), gc->evas) */
e_theme_edje_object_set(o, "base/theme/modules/start", "e/modules/start/main");
edje_object_signal_emit(o, "e,state,unfocused", "e");
return NULL;
}
+static Gadget_Config *
+_conf_item_get(const char *id)
+{
+ Eina_List *l = NULL;
+ Gadget_Config *ci = NULL;
+ char buf[128];
+
+ if (!id)
+ {
+ snprintf(buf, sizeof(buf), "%s.%d", _gadcon_class.name, ++uuid);
+ id = buf;
+ }
+ else
+ {
+ uuid++;
+ EINA_LIST_FOREACH(evry_conf->gadgets, l, ci)
+ if ((ci->id) && (!strcmp(ci->id, id))) return ci;
+ }
+ ci = E_NEW(Gadget_Config, 1);
+ ci->id = eina_stringshare_add(id);
+ ci->plugin = eina_stringshare_add("Start");
+
+ evry_conf->gadgets = eina_list_append(evry_conf->gadgets, ci);
+
+ e_config_save_queue();
+
+ return ci;
+}
+
static const char *
_gc_id_new(E_Gadcon_Client_Class *client_class __UNUSED__)
{
- return _gadcon_class.name;
+ Gadget_Config *gc = NULL;
+
+ gc = _conf_item_get(NULL);
+
+ return gc->id;
}
/***************************************************************************/
}
static void
-_cb_menu_post(void *data __UNUSED__, E_Menu *m __UNUSED__)
+_cb_menu_post(void *data, E_Menu *m __UNUSED__)
{
- if (!_menu) return;
- e_object_del(E_OBJECT(_menu));
- _menu = NULL;
+ Instance *inst = data;
+
+ if (!inst->menu) return;
+ e_object_del(E_OBJECT(inst->menu));
+ inst->menu = NULL;
}
static void
-_cb_menu_configure(void *data __UNUSED__, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
+_cb_menu_configure(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
{
- evry_collection_conf_dialog(e_container_current_get(e_manager_current_get()), "Start");
+ _conf_dialog(data);
}
static void
if (inst->win)
{
win = inst->win;
+ evry_hide(win, 0);
- if (ev->flags == EVAS_BUTTON_DOUBLE_CLICK)
- {
- evry_hide(win, 0);
- }
- else
- {
- e_win_show(win->ewin);
- e_border_focus_set(win->ewin->border, 1, 1);
- }
+ /* if (ev->flags == EVAS_BUTTON_DOUBLE_CLICK)
+ * {
+ * evry_hide(win, 0);
+ * }
+ * else
+ * {
+ * e_border_show(win->ewin->border);
+ * e_border_focus_set(win->ewin->border, 1, 1);
+ * } */
return;
}
- win = evry_show(e_util_zone_current_get(e_manager_current_get()), 0, "Start", EINA_FALSE);
+ win = evry_show(e_util_zone_current_get(e_manager_current_get()),
+ 0, inst->cfg->plugin, EINA_FALSE);
if (!win) return;
e_win_show(win->ewin);
edje_object_signal_emit(inst->o_button, "e,state,focused", "e");
}
- else if ((ev->button == 3) && (!_menu))
+ else if ((ev->button == 3) && (!inst->menu))
{
E_Menu *m;
E_Menu_Item *mi;
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, NULL);
+ 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);
- _menu = m;
+ inst->menu = m;
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy,
NULL, NULL);
{
e_gadcon_provider_unregister(&_gadcon_class);
}
+
+/***************************************************************************/
+
+struct _E_Config_Dialog_Data
+{
+ char *plugin;
+ int hide_after_action;
+ int popup;
+};
+
+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 void
+_conf_dialog(Instance *inst)
+{
+ E_Config_Dialog_View *v = NULL;
+ E_Container *con;
+
+ if (inst->cfd)
+ return;
+
+ /* if (e_config_dialog_find("everything-gadgets", "launcher/everything-gadgets"))
+ * return; */
+
+ v = E_NEW(E_Config_Dialog_View, 1);
+ if (!v) return;
+
+ v->create_cfdata = _create_data;
+ v->free_cfdata = _free_data;
+ v->basic.create_widgets = _basic_create;
+ v->basic.apply_cfdata = _basic_apply;
+
+ 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);
+
+ e_dialog_resizable_set(inst->cfd->dia, 0);
+ /* _conf->cfd = cfd; */
+}
+
+static void *
+_create_data(E_Config_Dialog *cfd)
+{
+ E_Config_Dialog_Data *cfdata = NULL;
+ Instance *inst = cfd->data;
+ Gadget_Config *gc = inst->cfg;
+
+ cfdata = E_NEW(E_Config_Dialog_Data, 1);
+
+#define CP(_name) cfdata->_name = strdup(gc->_name);
+#define C(_name) cfdata->_name = gc->_name;
+ CP(plugin);
+ C(hide_after_action);
+ C(popup);
+#undef CP
+#undef C
+
+ return cfdata;
+}
+
+static void
+_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+{
+ Instance *inst = cfd->data;
+
+ inst->cfd = NULL;
+ if (cfdata->plugin) free(cfdata->plugin);
+ E_FREE(cfdata);
+}
+
+static void
+_cb_button_settings(void *data, void *data2 __UNUSED__)
+{
+ /* evry_collection_conf_dialog(e_container_current_get(e_manager_current_get()), "Start"); */
+}
+
+static Evas_Object *
+_basic_create(E_Config_Dialog *cfd, Evas *e, E_Config_Dialog_Data *cfdata)
+{
+ Evas_Object *o = NULL, *of = NULL, *ow = NULL;
+ Instance *inst = cfd->data;
+
+ o = e_widget_list_add(e, 0, 0);
+
+ of = e_widget_framelist_add(e, _("Plugin"), 0);
+ ow = e_widget_entry_add(e, &(cfdata->plugin), NULL, NULL, NULL);
+ e_widget_framelist_object_append(of, ow);
+
+ ow = e_widget_button_add(e, _("Settings"), NULL, _cb_button_settings, inst, NULL);
+ e_widget_framelist_object_append(of, ow);
+
+ e_widget_list_object_append(o, of, 1, 1, 0.5);
+
+ return o;
+}
+
+static int
+_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
+{
+ Instance *inst = cfd->data;
+ Gadget_Config *gc = inst->cfg;
+
+#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); \
+ if (cfdata->plugin[0])
+ gc->plugin = eina_stringshare_add(cfdata->plugin);
+ else
+ gc->plugin = NULL;
+ C(hide_after_action);
+ C(popup);
+#undef CP
+#undef C
+
+ e_config_save_queue();
+
+ return 1;
+}
struct _Plugin
{
Evry_Plugin base;
- int type;
- Evry_Window *win;
Evry_Item *warning;
};
{
Plugin *p = (Plugin *) plugin;
Evry_Plugin *pp;
- Evry_State *s;
Eina_List *l, *ll, *lp = NULL;
Evry_Item *it, *it2;
- int i, top_level = 0, subj_sel = 0, inp_len = 0, cnt = 0;
+ int top_level = 0, subj_sel = 0, inp_len = 0, cnt = 0;
Eina_List *items = NULL;
const char *context = NULL;
char buf[128];
- Evry_Selector *sel = p->win->selectors[p->type];
-
+ 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
input = NULL;
- EVRY_PLUGIN_ITEMS_FREE(p);
-
- s = sel->state;
- if (!s) return 0;
-
- if (sel == p->win->selectors[0])
- subj_sel = 1;
-
if (!sel->states->next)
top_level = 1;
- /* get current items' context ... */
- for (i = 1; i < 3; i++)
+ /* get current items' context */
+ if (sel == sels[0])
+ {
+ subj_sel = 1;
+ }
+ else if (sel == sels[1])
{
- if (sel == p->win->selectors[i])
- {
- it = p->win->selectors[i-1]->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;
}
+ EVRY_PLUGIN_ITEMS_FREE(p);
+
/* collect plugins to be shown in aggregator */
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
{
EVRY_PLUGIN_ITEM_APPEND(p, p->warning);
}
- return !!(p->base.items);
+ return EVRY_PLUGIN_HAS_ITEMS(p);
}
static void
GET_PLUGIN(base, plugin);
EVRY_PLUGIN_INSTANCE(p, plugin);
- p->type = base->type;
- p->win = base->win;
p->warning = base->warning;
return EVRY_PLUGIN(p);
}
Evry_Plugin *
-evry_aggregator_new(Evry_Window *win, int type)
+evry_aggregator_new(int type)
{
Evry_Plugin *p;
if (evry_plugin_register(p, type, -1))
{
- if (type == EVRY_PLUGIN_SUBJECT)
- p->config->view_mode = VIEW_MODE_THUMB;
+ p->config->view_mode = VIEW_MODE_THUMB;
}
GET_PLUGIN(pa, p);
- pa->win = win;
- pa->type = type;
pa->warning = evry_item_new(NULL, p, N_("No plugins loaded"), NULL, NULL);
pa->warning->type = EVRY_TYPE_NONE;
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
- return !!(plugin->items);
+ return EVRY_PLUGIN_HAS_ITEMS(p);
}
static Evry_Plugin *
efreet_desktop_free(d);
apps = eina_list_remove_list(apps, ll);
}
+ printf("%d %s\n", d->ref, d->name);
+
efreet_desktop_free(d);
}
}
}
+
EINA_LIST_FOREACH(p->menu_items, l, it)
- EVRY_PLUGIN_ITEM_APPEND(p, it);
+ {
+ 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);
+ }
- return !!(plugin->items);
+ return EVRY_PLUGIN_HAS_ITEMS(p);
}
/***************************************************************************/
return cfd;
}
-/* Local Functions */
static void *
_create_data(E_Config_Dialog *cfd __UNUSED__)
{
error = 0;
}
- return !!(p->base.items);
+ return EVRY_PLUGIN_HAS_ITEMS(p);
}
static Eina_Bool
EVRY_PLUGIN_ITEMS_ADD(p, p->plugins, input, 1, 0);
- return !!(plugin->items);
+ return EVRY_PLUGIN_HAS_ITEMS(p);
}
static Evry_Plugin *
if ((p->command) || (!p->min_query) || (len >= p->min_query))
_files_filter(p);
- return !!(EVRY_PLUGIN(p)->items);
+ return EVRY_PLUGIN_HAS_ITEMS(p);
}
/***************************************************************************/
* p->thread = NULL; */
if (input && isspace(input[len - 1]))
- return !!(plugin->items);
+ return EVRY_PLUGIN_HAS_ITEMS(p);
if (len >= plugin->config->min_query)
{
/* p->thread = ecore_thread_run(_recentf_func, _recentf_end_func,
* _recentf_cancel_func, d); */
}
- return !!(plugin->items);
+ return EVRY_PLUGIN_HAS_ITEMS(p);
}
EVRY_PLUGIN_ITEMS_CLEAR(p);
if (input || p->parent)
EVRY_PLUGIN_ITEMS_ADD(p, p->items, input, 1, 1);
- return !!(plugin->items);
+ return EVRY_PLUGIN_HAS_ITEMS(p);
}
static int