forked from enlightenment/enlightenment
e17/evry: add per instance config for gadget to show other plugins that 'Start'
-add EVRY_PLUGIN_HAS_ITEMS macro SVN revision: 62662
This commit is contained in:
parent
7ab4814e02
commit
edf0e07a3b
|
@ -16,6 +16,7 @@ static Ecore_Timer *cleanup_timer;
|
||||||
static const char *module_icon = NULL;
|
static const char *module_icon = NULL;
|
||||||
static E_Config_DD *conf_edd = NULL;
|
static E_Config_DD *conf_edd = NULL;
|
||||||
static E_Config_DD *plugin_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;
|
static int _e_module_evry_log_dom = -1;
|
||||||
|
|
||||||
Evry_API *evry = NULL;
|
Evry_API *evry = NULL;
|
||||||
|
@ -222,6 +223,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
||||||
/* Clean EET */
|
/* Clean EET */
|
||||||
E_CONFIG_DD_FREE(conf_edd);
|
E_CONFIG_DD_FREE(conf_edd);
|
||||||
E_CONFIG_DD_FREE(plugin_conf_edd);
|
E_CONFIG_DD_FREE(plugin_conf_edd);
|
||||||
|
E_CONFIG_DD_FREE(gadget_conf_edd);
|
||||||
|
|
||||||
if (cleanup_timer)
|
if (cleanup_timer)
|
||||||
ecore_timer_del(cleanup_timer);
|
ecore_timer_del(cleanup_timer);
|
||||||
|
@ -375,6 +377,15 @@ _config_init()
|
||||||
E_CONFIG_LIST(D, T, plugins, plugin_conf_edd);
|
E_CONFIG_LIST(D, T, plugins, plugin_conf_edd);
|
||||||
#undef T
|
#undef T
|
||||||
#undef D
|
#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 T Evry_Config
|
||||||
#define D conf_edd
|
#define D conf_edd
|
||||||
conf_edd = E_CONFIG_DD_NEW("Config", Evry_Config);
|
conf_edd = E_CONFIG_DD_NEW("Config", Evry_Config);
|
||||||
|
@ -399,6 +410,7 @@ _config_init()
|
||||||
E_CONFIG_LIST(D, T, conf_objects, plugin_conf_edd);
|
E_CONFIG_LIST(D, T, conf_objects, plugin_conf_edd);
|
||||||
E_CONFIG_LIST(D, T, conf_views, plugin_conf_edd);
|
E_CONFIG_LIST(D, T, conf_views, plugin_conf_edd);
|
||||||
E_CONFIG_LIST(D, T, collections, plugin_conf_edd);
|
E_CONFIG_LIST(D, T, collections, plugin_conf_edd);
|
||||||
|
E_CONFIG_LIST(D, T, gadgets, gadget_conf_edd);
|
||||||
E_CONFIG_VAL(D, T, first_run, UCHAR);
|
E_CONFIG_VAL(D, T, first_run, UCHAR);
|
||||||
#undef T
|
#undef T
|
||||||
#undef D
|
#undef D
|
||||||
|
@ -482,7 +494,8 @@ static void
|
||||||
_config_free(void)
|
_config_free(void)
|
||||||
{
|
{
|
||||||
Plugin_Config *pc, *pc2;
|
Plugin_Config *pc, *pc2;
|
||||||
|
Gadget_Config *gc;
|
||||||
|
|
||||||
EINA_LIST_FREE(evry_conf->collections, pc)
|
EINA_LIST_FREE(evry_conf->collections, pc)
|
||||||
EINA_LIST_FREE(pc->plugins, pc2)
|
EINA_LIST_FREE(pc->plugins, pc2)
|
||||||
{
|
{
|
||||||
|
@ -490,7 +503,6 @@ _config_free(void)
|
||||||
IF_RELEASE(pc2->trigger);
|
IF_RELEASE(pc2->trigger);
|
||||||
E_FREE(pc2);
|
E_FREE(pc2);
|
||||||
}
|
}
|
||||||
|
|
||||||
EINA_LIST_FREE(evry_conf->conf_subjects, pc)
|
EINA_LIST_FREE(evry_conf->conf_subjects, pc)
|
||||||
{
|
{
|
||||||
IF_RELEASE(pc->name);
|
IF_RELEASE(pc->name);
|
||||||
|
@ -509,6 +521,12 @@ _config_free(void)
|
||||||
IF_RELEASE(pc->trigger);
|
IF_RELEASE(pc->trigger);
|
||||||
E_FREE(pc);
|
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);
|
E_FREE(evry_conf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ typedef struct _Config Evry_Config;
|
||||||
typedef struct _Evry_Selector Evry_Selector;
|
typedef struct _Evry_Selector Evry_Selector;
|
||||||
typedef struct _Tab_View Tab_View;
|
typedef struct _Tab_View Tab_View;
|
||||||
typedef struct _Evry_Window Evry_Window;
|
typedef struct _Evry_Window Evry_Window;
|
||||||
|
typedef struct _Gadget_Config Gadget_Config;
|
||||||
|
|
||||||
struct _Evry_Window
|
struct _Evry_Window
|
||||||
{
|
{
|
||||||
|
@ -175,8 +176,9 @@ struct _Config
|
||||||
/* use up/down keys for prev/next in thumb view */
|
/* use up/down keys for prev/next in thumb view */
|
||||||
int cycle_mode;
|
int cycle_mode;
|
||||||
|
|
||||||
|
Eina_List *gadgets;
|
||||||
|
|
||||||
unsigned char first_run;
|
unsigned char first_run;
|
||||||
|
|
||||||
/* not saved data */
|
/* not saved data */
|
||||||
Eina_List *actions;
|
Eina_List *actions;
|
||||||
Eina_List *views;
|
Eina_List *views;
|
||||||
|
@ -184,6 +186,14 @@ struct _Config
|
||||||
int min_w, min_h;
|
int min_w, min_h;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _Gadget_Config
|
||||||
|
{
|
||||||
|
const char *id;
|
||||||
|
const char *plugin;
|
||||||
|
int hide_after_action;
|
||||||
|
int popup;
|
||||||
|
};
|
||||||
|
|
||||||
struct _History
|
struct _History
|
||||||
{
|
{
|
||||||
int version;
|
int version;
|
||||||
|
@ -284,10 +294,10 @@ int evry_shutdown(void);
|
||||||
Evry_Window *evry_show(E_Zone *zone, E_Zone_Edge edge, const char *params, Eina_Bool popup);
|
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);
|
void evry_hide(Evry_Window *win, int clear);
|
||||||
|
|
||||||
int evry_plug_actions_init();
|
int evry_plug_actions_init(void);
|
||||||
void evry_plug_actions_shutdown();
|
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_init(void);
|
||||||
void evry_history_free(void);
|
void evry_history_free(void);
|
||||||
|
|
|
@ -108,21 +108,21 @@ _evry_aggregator_fetch(Evry_State *s)
|
||||||
ERR("no state");
|
ERR("no state");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->aggregator->fetch(s->aggregator, s->input))
|
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 && l->prev)
|
if (!l)
|
||||||
s->cur_plugins = eina_list_promote_list(s->cur_plugins, l);
|
|
||||||
else if (!l)
|
|
||||||
s->cur_plugins = eina_list_prepend(s->cur_plugins, s->aggregator);
|
s->cur_plugins = eina_list_prepend(s->cur_plugins, s->aggregator);
|
||||||
}
|
else
|
||||||
else
|
s->cur_plugins = eina_list_promote_list(s->cur_plugins, l);
|
||||||
{
|
|
||||||
s->cur_plugins = eina_list_remove(s->cur_plugins, s->aggregator);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s->cur_plugins = eina_list_remove(s->cur_plugins, s->aggregator);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,7 +1067,7 @@ _evry_selector_new(Evry_Window *win, int type)
|
||||||
Evry_Selector *sel = E_NEW(Evry_Selector, 1);
|
Evry_Selector *sel = E_NEW(Evry_Selector, 1);
|
||||||
Evas_Object *o = NULL;
|
Evas_Object *o = NULL;
|
||||||
|
|
||||||
sel->aggregator = evry_aggregator_new(win, type);
|
sel->aggregator = evry_aggregator_new(type);
|
||||||
|
|
||||||
if (type == EVRY_PLUGIN_SUBJECT)
|
if (type == EVRY_PLUGIN_SUBJECT)
|
||||||
{
|
{
|
||||||
|
|
|
@ -257,6 +257,8 @@ typedef void (*Evry_Item_Free_Cb) (Evry_Item *it);
|
||||||
EINA_LIST_FREE(EVRY_PLUGIN(_p)->items, it) \
|
EINA_LIST_FREE(EVRY_PLUGIN(_p)->items, it) \
|
||||||
if (it) it->fuzzy_match = 0; }
|
if (it) it->fuzzy_match = 0; }
|
||||||
|
|
||||||
|
#define EVRY_PLUGIN_HAS_ITEMS(_p) !!(EVRY_PLUGIN(_p)->items)
|
||||||
|
|
||||||
/*** Evry_Action macros ***/
|
/*** Evry_Action macros ***/
|
||||||
#define EVRY_ACTION_NEW(_name, _in1, _in2, _icon, _action, _check) \
|
#define EVRY_ACTION_NEW(_name, _in1, _in2, _icon, _action, _check) \
|
||||||
evry->action_new(N_(_name), _(_name), _in1, _in2, _icon, _action, _check)
|
evry->action_new(N_(_name), _(_name), _in1, _in2, _icon, _action, _check)
|
||||||
|
|
|
@ -184,6 +184,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,9 @@ struct _Instance
|
||||||
|
|
||||||
E_Object_Delfn *del_fn;
|
E_Object_Delfn *del_fn;
|
||||||
Evry_Window *win;
|
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 void _button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
@ -21,6 +24,9 @@ static void _gc_orient(E_Gadcon_Client *gcc, E_Gadcon_Orient orient);
|
||||||
static char *_gc_label(E_Gadcon_Client_Class *client_class);
|
static char *_gc_label(E_Gadcon_Client_Class *client_class);
|
||||||
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
|
static Evas_Object *_gc_icon(E_Gadcon_Client_Class *client_class, Evas *evas);
|
||||||
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);
|
static const char *_gc_id_new(E_Gadcon_Client_Class *client_class);
|
||||||
|
static Gadget_Config *_conf_item_get(const char *id);
|
||||||
|
|
||||||
|
static void _conf_dialog(Instance *inst);
|
||||||
|
|
||||||
static const E_Gadcon_Client_Class _gadcon_class =
|
static const E_Gadcon_Client_Class _gadcon_class =
|
||||||
{
|
{
|
||||||
|
@ -33,7 +39,7 @@ static const E_Gadcon_Client_Class _gadcon_class =
|
||||||
E_GADCON_CLIENT_STYLE_PLAIN
|
E_GADCON_CLIENT_STYLE_PLAIN
|
||||||
};
|
};
|
||||||
|
|
||||||
static E_Menu *_menu = NULL;
|
static int uuid = 0;
|
||||||
|
|
||||||
|
|
||||||
static E_Gadcon_Client *
|
static E_Gadcon_Client *
|
||||||
|
@ -42,10 +48,15 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
E_Gadcon_Client *gcc;
|
E_Gadcon_Client *gcc;
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
|
/* Evry_Plugin *p; */
|
||||||
|
|
||||||
inst = E_NEW(Instance, 1);
|
inst = E_NEW(Instance, 1);
|
||||||
|
inst->cfg = _conf_item_get(id);
|
||||||
|
|
||||||
o = edje_object_add(gc->evas);
|
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");
|
e_theme_edje_object_set(o, "base/theme/modules/start", "e/modules/start/main");
|
||||||
edje_object_signal_emit(o, "e,state,unfocused", "e");
|
edje_object_signal_emit(o, "e,state,unfocused", "e");
|
||||||
|
|
||||||
|
@ -109,10 +120,43 @@ _gc_icon(E_Gadcon_Client_Class *client_class __UNUSED__, Evas *evas __UNUSED__)
|
||||||
return NULL;
|
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 *
|
static const char *
|
||||||
_gc_id_new(E_Gadcon_Client_Class *client_class __UNUSED__)
|
_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -130,17 +174,19 @@ static void _del_func(void *data, void *obj __UNUSED__)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_menu_post(void *data __UNUSED__, E_Menu *m __UNUSED__)
|
_cb_menu_post(void *data, E_Menu *m __UNUSED__)
|
||||||
{
|
{
|
||||||
if (!_menu) return;
|
Instance *inst = data;
|
||||||
e_object_del(E_OBJECT(_menu));
|
|
||||||
_menu = NULL;
|
if (!inst->menu) return;
|
||||||
|
e_object_del(E_OBJECT(inst->menu));
|
||||||
|
inst->menu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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
|
static void
|
||||||
|
@ -160,21 +206,23 @@ _button_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_
|
||||||
if (inst->win)
|
if (inst->win)
|
||||||
{
|
{
|
||||||
win = inst->win;
|
win = inst->win;
|
||||||
|
evry_hide(win, 0);
|
||||||
|
|
||||||
if (ev->flags == EVAS_BUTTON_DOUBLE_CLICK)
|
/* if (ev->flags == EVAS_BUTTON_DOUBLE_CLICK)
|
||||||
{
|
* {
|
||||||
evry_hide(win, 0);
|
* evry_hide(win, 0);
|
||||||
}
|
* }
|
||||||
else
|
* else
|
||||||
{
|
* {
|
||||||
e_win_show(win->ewin);
|
* e_border_show(win->ewin->border);
|
||||||
e_border_focus_set(win->ewin->border, 1, 1);
|
* e_border_focus_set(win->ewin->border, 1, 1);
|
||||||
}
|
* } */
|
||||||
|
|
||||||
return;
|
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;
|
if (!win) return;
|
||||||
|
|
||||||
e_win_show(win->ewin);
|
e_win_show(win->ewin);
|
||||||
|
@ -241,7 +289,7 @@ _button_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_
|
||||||
|
|
||||||
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) && (!_menu))
|
else if ((ev->button == 3) && (!inst->menu))
|
||||||
{
|
{
|
||||||
E_Menu *m;
|
E_Menu *m;
|
||||||
E_Menu_Item *mi;
|
E_Menu_Item *mi;
|
||||||
|
@ -251,11 +299,11 @@ _button_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED_
|
||||||
mi = e_menu_item_new(m);
|
mi = e_menu_item_new(m);
|
||||||
e_menu_item_label_set(mi, _("Settings"));
|
e_menu_item_label_set(mi, _("Settings"));
|
||||||
e_util_menu_item_theme_icon_set(mi, "configure");
|
e_util_menu_item_theme_icon_set(mi, "configure");
|
||||||
e_menu_item_callback_set(mi, _cb_menu_configure, NULL);
|
e_menu_item_callback_set(mi, _cb_menu_configure, inst);
|
||||||
|
|
||||||
m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
|
m = e_gadcon_client_util_menu_items_append(inst->gcc, m, 0);
|
||||||
e_menu_post_deactivate_callback_set(m, _cb_menu_post, inst);
|
e_menu_post_deactivate_callback_set(m, _cb_menu_post, inst);
|
||||||
_menu = m;
|
inst->menu = m;
|
||||||
|
|
||||||
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy,
|
e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &cx, &cy,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
@ -279,3 +327,127 @@ evry_gadget_shutdown(void)
|
||||||
{
|
{
|
||||||
e_gadcon_provider_unregister(&_gadcon_class);
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -9,8 +9,6 @@ typedef struct _Plugin Plugin;
|
||||||
struct _Plugin
|
struct _Plugin
|
||||||
{
|
{
|
||||||
Evry_Plugin base;
|
Evry_Plugin base;
|
||||||
int type;
|
|
||||||
Evry_Window *win;
|
|
||||||
|
|
||||||
Evry_Item *warning;
|
Evry_Item *warning;
|
||||||
};
|
};
|
||||||
|
@ -20,41 +18,42 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
{
|
{
|
||||||
Plugin *p = (Plugin *) plugin;
|
Plugin *p = (Plugin *) plugin;
|
||||||
Evry_Plugin *pp;
|
Evry_Plugin *pp;
|
||||||
Evry_State *s;
|
|
||||||
Eina_List *l, *ll, *lp = NULL;
|
Eina_List *l, *ll, *lp = NULL;
|
||||||
Evry_Item *it, *it2;
|
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;
|
Eina_List *items = NULL;
|
||||||
const char *context = NULL;
|
const char *context = NULL;
|
||||||
char buf[128];
|
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])
|
if (input && input[0])
|
||||||
inp_len = strlen(input);
|
inp_len = strlen(input);
|
||||||
else
|
else
|
||||||
input = NULL;
|
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)
|
if (!sel->states->next)
|
||||||
top_level = 1;
|
top_level = 1;
|
||||||
|
|
||||||
/* get current items' context ... */
|
/* get current items' context */
|
||||||
for (i = 1; i < 3; i++)
|
if (sel == sels[0])
|
||||||
|
{
|
||||||
|
subj_sel = 1;
|
||||||
|
}
|
||||||
|
else if (sel == sels[1])
|
||||||
{
|
{
|
||||||
if (sel == p->win->selectors[i])
|
it = sels[0]->state->cur_item;
|
||||||
{
|
if (it) context = it->context;
|
||||||
it = p->win->selectors[i-1]->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 */
|
/* collect plugins to be shown in aggregator */
|
||||||
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
EINA_LIST_FOREACH(s->cur_plugins, l, pp)
|
||||||
{
|
{
|
||||||
|
@ -287,7 +286,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
EVRY_PLUGIN_ITEM_APPEND(p, p->warning);
|
EVRY_PLUGIN_ITEM_APPEND(p, p->warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!(p->base.items);
|
return EVRY_PLUGIN_HAS_ITEMS(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -308,8 +307,6 @@ _begin(Evry_Plugin *plugin, const Evry_Item *it __UNUSED__)
|
||||||
GET_PLUGIN(base, plugin);
|
GET_PLUGIN(base, plugin);
|
||||||
EVRY_PLUGIN_INSTANCE(p, plugin);
|
EVRY_PLUGIN_INSTANCE(p, plugin);
|
||||||
|
|
||||||
p->type = base->type;
|
|
||||||
p->win = base->win;
|
|
||||||
p->warning = base->warning;
|
p->warning = base->warning;
|
||||||
|
|
||||||
return EVRY_PLUGIN(p);
|
return EVRY_PLUGIN(p);
|
||||||
|
@ -326,7 +323,7 @@ _free(Evry_Plugin *plugin)
|
||||||
}
|
}
|
||||||
|
|
||||||
Evry_Plugin *
|
Evry_Plugin *
|
||||||
evry_aggregator_new(Evry_Window *win, int type)
|
evry_aggregator_new(int type)
|
||||||
{
|
{
|
||||||
Evry_Plugin *p;
|
Evry_Plugin *p;
|
||||||
|
|
||||||
|
@ -334,13 +331,10 @@ evry_aggregator_new(Evry_Window *win, int type)
|
||||||
|
|
||||||
if (evry_plugin_register(p, type, -1))
|
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);
|
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 = evry_item_new(NULL, p, N_("No plugins loaded"), NULL, NULL);
|
||||||
pa->warning->type = EVRY_TYPE_NONE;
|
pa->warning->type = EVRY_TYPE_NONE;
|
||||||
|
|
|
@ -314,7 +314,7 @@ _fetch_exe(Evry_Plugin *plugin, const char *input)
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
EVRY_PLUGIN_ITEMS_SORT(p, _cb_sort);
|
||||||
|
|
||||||
return !!(plugin->items);
|
return EVRY_PLUGIN_HAS_ITEMS(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evry_Plugin *
|
static Evry_Plugin *
|
||||||
|
@ -464,6 +464,8 @@ _desktop_list_get(void)
|
||||||
efreet_desktop_free(d);
|
efreet_desktop_free(d);
|
||||||
apps = eina_list_remove_list(apps, ll);
|
apps = eina_list_remove_list(apps, ll);
|
||||||
}
|
}
|
||||||
|
printf("%d %s\n", d->ref, d->name);
|
||||||
|
|
||||||
efreet_desktop_free(d);
|
efreet_desktop_free(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,10 +659,20 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EINA_LIST_FOREACH(p->menu_items, l, it)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -1243,7 +1255,6 @@ _conf_dialog(E_Container *con, const char *params __UNUSED__)
|
||||||
return cfd;
|
return cfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Local Functions */
|
|
||||||
static void *
|
static void *
|
||||||
_create_data(E_Config_Dialog *cfd __UNUSED__)
|
_create_data(E_Config_Dialog *cfd __UNUSED__)
|
||||||
{
|
{
|
||||||
|
|
|
@ -180,7 +180,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
error = 0;
|
error = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!(p->base.items);
|
return EVRY_PLUGIN_HAS_ITEMS(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
|
|
@ -129,7 +129,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_ADD(p, p->plugins, input, 1, 0);
|
EVRY_PLUGIN_ITEMS_ADD(p, p->plugins, input, 1, 0);
|
||||||
|
|
||||||
return !!(plugin->items);
|
return EVRY_PLUGIN_HAS_ITEMS(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evry_Plugin *
|
static Evry_Plugin *
|
||||||
|
|
|
@ -762,7 +762,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
if ((p->command) || (!p->min_query) || (len >= p->min_query))
|
if ((p->command) || (!p->min_query) || (len >= p->min_query))
|
||||||
_files_filter(p);
|
_files_filter(p);
|
||||||
|
|
||||||
return !!(EVRY_PLUGIN(p)->items);
|
return EVRY_PLUGIN_HAS_ITEMS(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -1086,7 +1086,7 @@ _recentf_fetch(Evry_Plugin *plugin, const char *input)
|
||||||
* p->thread = NULL; */
|
* p->thread = NULL; */
|
||||||
|
|
||||||
if (input && isspace(input[len - 1]))
|
if (input && isspace(input[len - 1]))
|
||||||
return !!(plugin->items);
|
return EVRY_PLUGIN_HAS_ITEMS(p);
|
||||||
|
|
||||||
if (len >= plugin->config->min_query)
|
if (len >= plugin->config->min_query)
|
||||||
{
|
{
|
||||||
|
@ -1109,7 +1109,7 @@ _recentf_fetch(Evry_Plugin *plugin, const char *input)
|
||||||
/* p->thread = ecore_thread_run(_recentf_func, _recentf_end_func,
|
/* p->thread = ecore_thread_run(_recentf_func, _recentf_end_func,
|
||||||
* _recentf_cancel_func, d); */
|
* _recentf_cancel_func, d); */
|
||||||
}
|
}
|
||||||
return !!(plugin->items);
|
return EVRY_PLUGIN_HAS_ITEMS(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
EVRY_PLUGIN_ITEMS_CLEAR(p);
|
||||||
|
|
|
@ -146,7 +146,7 @@ _fetch(Evry_Plugin *plugin, const char *input)
|
||||||
if (input || p->parent)
|
if (input || p->parent)
|
||||||
EVRY_PLUGIN_ITEMS_ADD(p, p->items, input, 1, 1);
|
EVRY_PLUGIN_ITEMS_ADD(p, p->items, input, 1, 1);
|
||||||
|
|
||||||
return !!(plugin->items);
|
return EVRY_PLUGIN_HAS_ITEMS(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue