forked from enlightenment/enlightenment
gadgets can now be configured from the Desktop menu to bypass selecting layer in the overall gadget config
SVN revision: 77517
This commit is contained in:
parent
9114d0d02a
commit
6933d4b8ac
|
@ -15,7 +15,6 @@ struct _E_Config_Dialog_Data
|
||||||
int anim_bg; //Anim the background
|
int anim_bg; //Anim the background
|
||||||
int anim_gad; //Anim the gadgets
|
int anim_gad; //Anim the gadgets
|
||||||
int fmdir; //Filemanager dir (personal or system)
|
int fmdir; //Filemanager dir (personal or system)
|
||||||
Ecore_Event_Handler *add;
|
|
||||||
Eina_List *waiting;
|
Eina_List *waiting;
|
||||||
E_Config_Dialog *cfd;
|
E_Config_Dialog *cfd;
|
||||||
};
|
};
|
||||||
|
@ -39,8 +38,6 @@ static void _cb_fm_change(void *data, Evas_Object *obj, void *event_info
|
||||||
static void _cb_fm_sel_change(void *data, Evas_Object *obj, void *event_info);
|
static void _cb_fm_sel_change(void *data, Evas_Object *obj, void *event_info);
|
||||||
static void _cb_button_up(void *data1, void *data2);
|
static void _cb_button_up(void *data1, void *data2);
|
||||||
|
|
||||||
static E_Config_Dialog_Data *_cfdata = NULL;
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
_basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
|
@ -90,29 +87,6 @@ _config_gadman_module(E_Container *con, const char *params __UNUSED__)
|
||||||
return Man->config_dialog;
|
return Man->config_dialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
_gcc_add(E_Config_Dialog_Data *cfdata, int type __UNUSED__, E_Event_Gadcon_Client_Add *ev)
|
|
||||||
{
|
|
||||||
Eina_List *l;
|
|
||||||
if (!cfdata->waiting) return ECORE_CALLBACK_RENEW;
|
|
||||||
l = eina_list_data_find_list(cfdata->waiting, ev->gcc->gadcon);
|
|
||||||
if (!l) return ECORE_CALLBACK_RENEW;
|
|
||||||
if (ev->gcc->cf != eina_list_data_get(eina_list_last(ev->gcc->gadcon->cf->clients))) return ECORE_CALLBACK_RENEW;
|
|
||||||
Man->drag_gcc[ev->gcc->gadcon->id - ID_GADMAN_LAYER_BASE] = ev->gcc;
|
|
||||||
ev->gcc->cf->style = eina_stringshare_add(ev->gcc->client_class->default_style ?: E_GADCON_CLIENT_STYLE_INSET);
|
|
||||||
ev->gcc->style = eina_stringshare_ref(ev->gcc->cf->style);
|
|
||||||
ev->gcc->cf->geom.pos_x = DEFAULT_POS_X;
|
|
||||||
ev->gcc->cf->geom.pos_y = DEFAULT_POS_Y;
|
|
||||||
ev->gcc->cf->geom.size_w = DEFAULT_SIZE_W;
|
|
||||||
ev->gcc->cf->geom.size_h = DEFAULT_SIZE_H;
|
|
||||||
if (!strcmp(ev->gcc->style, E_GADCON_CLIENT_STYLE_INSET))
|
|
||||||
edje_object_signal_emit(ev->gcc->o_frame, "e,state,visibility,inset", "e");
|
|
||||||
else
|
|
||||||
edje_object_signal_emit(ev->gcc->o_frame, "e,state,visibility,plain", "e");
|
|
||||||
|
|
||||||
return ECORE_CALLBACK_RENEW;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
_create_data(E_Config_Dialog *cfd)
|
_create_data(E_Config_Dialog *cfd)
|
||||||
{
|
{
|
||||||
|
@ -127,7 +101,6 @@ _create_data(E_Config_Dialog *cfd)
|
||||||
cfdata->fmdir = 1;
|
cfdata->fmdir = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfdata->add = ecore_event_handler_add(E_EVENT_GADCON_CLIENT_ADD, (Ecore_Event_Handler_Cb)_gcc_add, cfdata);
|
|
||||||
cfdata->color = E_NEW(E_Color, 1);
|
cfdata->color = E_NEW(E_Color, 1);
|
||||||
cfdata->color->r = Man->conf->color_r;
|
cfdata->color->r = Man->conf->color_r;
|
||||||
cfdata->color->g = Man->conf->color_g;
|
cfdata->color->g = Man->conf->color_g;
|
||||||
|
@ -137,7 +110,6 @@ _create_data(E_Config_Dialog *cfd)
|
||||||
cfdata->anim_gad = Man->conf->anim_gad;
|
cfdata->anim_gad = Man->conf->anim_gad;
|
||||||
|
|
||||||
e_color_update_rgb(cfdata->color);
|
e_color_update_rgb(cfdata->color);
|
||||||
_cfdata = cfdata;
|
|
||||||
|
|
||||||
return cfdata;
|
return cfdata;
|
||||||
}
|
}
|
||||||
|
@ -145,26 +117,28 @@ _create_data(E_Config_Dialog *cfd)
|
||||||
static void
|
static void
|
||||||
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
int layer;
|
|
||||||
Eina_List *l;
|
|
||||||
E_Gadcon *gc;
|
|
||||||
|
|
||||||
Man->config_dialog = NULL;
|
Man->config_dialog = NULL;
|
||||||
ecore_event_handler_del(cfdata->add);
|
|
||||||
E_FREE(cfdata->color);
|
E_FREE(cfdata->color);
|
||||||
_cfdata = NULL;
|
|
||||||
for (layer = 0; layer < GADMAN_LAYER_COUNT; layer++)
|
|
||||||
EINA_LIST_FOREACH(Man->gadcons[layer], l, gc)
|
|
||||||
gc->config_dialog = NULL;
|
|
||||||
eina_list_free(cfdata->waiting);
|
|
||||||
E_FREE(cfdata);
|
E_FREE(cfdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cb_config_del(void *data)
|
_cb_config_del(void *data)
|
||||||
{
|
{
|
||||||
E_Config_Dialog_Data *cfdata = e_object_data_get(data);
|
int layer;
|
||||||
cfdata->waiting = eina_list_remove(cfdata->waiting, data);
|
Eina_List *l;
|
||||||
|
E_Gadcon *gc;
|
||||||
|
Eina_Bool del = EINA_TRUE;
|
||||||
|
|
||||||
|
for (layer = 0; layer < GADMAN_LAYER_COUNT; layer++)
|
||||||
|
EINA_LIST_FOREACH(Man->gadcons[layer], l, gc)
|
||||||
|
if (gc->config_dialog)
|
||||||
|
{
|
||||||
|
del = EINA_FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Man->waiting = eina_list_remove(Man->waiting, data);
|
||||||
|
if (del && Man->add) ecore_event_handler_del(Man->add);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -181,7 +155,9 @@ _cb_config(void *data, void *data2 __UNUSED__)
|
||||||
if (gc->zone != cfdata->cfd->dia->win->border->zone) continue;
|
if (gc->zone != cfdata->cfd->dia->win->border->zone) continue;
|
||||||
if (gc->config_dialog) return;
|
if (gc->config_dialog) return;
|
||||||
e_int_gadcon_config_hook(gc, _("Desktop Gadgets"), E_GADCON_SITE_DESKTOP);
|
e_int_gadcon_config_hook(gc, _("Desktop Gadgets"), E_GADCON_SITE_DESKTOP);
|
||||||
cfdata->waiting = eina_list_append(cfdata->waiting, gc);
|
if (!Man->add)
|
||||||
|
Man->add = ecore_event_handler_add(E_EVENT_GADCON_CLIENT_ADD, (Ecore_Event_Handler_Cb)gadman_gadget_add_handler, NULL);
|
||||||
|
Man->waiting = eina_list_append(Man->waiting, gc);
|
||||||
e_object_data_set(E_OBJECT(gc->config_dialog), cfdata);
|
e_object_data_set(E_OBJECT(gc->config_dialog), cfdata);
|
||||||
e_object_del_attach_func_set(E_OBJECT(gc->config_dialog), _cb_config_del);
|
e_object_del_attach_func_set(E_OBJECT(gc->config_dialog), _cb_config_del);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -965,6 +965,7 @@ _apply_widget_position(E_Gadcon_Client *gcc)
|
||||||
{
|
{
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
E_Zone *zone;
|
E_Zone *zone;
|
||||||
|
Evas_Object *mover;
|
||||||
|
|
||||||
/* Obtain zone from parent gadcon */
|
/* Obtain zone from parent gadcon */
|
||||||
zone = gcc->gadcon->zone;
|
zone = gcc->gadcon->zone;
|
||||||
|
@ -1019,6 +1020,13 @@ _apply_widget_position(E_Gadcon_Client *gcc)
|
||||||
|
|
||||||
evas_object_move(gcc->o_frame, x, y);
|
evas_object_move(gcc->o_frame, x, y);
|
||||||
evas_object_resize(gcc->o_frame, w, h);
|
evas_object_resize(gcc->o_frame, w, h);
|
||||||
|
|
||||||
|
if (Man->drag_gcc[gcc->gadcon->id - ID_GADMAN_LAYER_BASE] != gcc) return;
|
||||||
|
/* Move/resize the correct mover */
|
||||||
|
mover = _get_mover(gcc);
|
||||||
|
if (!mover) return;
|
||||||
|
evas_object_move(mover, x, y);
|
||||||
|
evas_object_resize(mover, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -66,6 +66,9 @@ struct _Manager
|
||||||
|
|
||||||
Eina_Inlist *gadman_popups;
|
Eina_Inlist *gadman_popups;
|
||||||
|
|
||||||
|
Eina_List *waiting;
|
||||||
|
Ecore_Event_Handler *add;
|
||||||
|
|
||||||
int visible;
|
int visible;
|
||||||
int use_composite;
|
int use_composite;
|
||||||
Ecore_X_Window top_win;
|
Ecore_X_Window top_win;
|
||||||
|
@ -77,6 +80,7 @@ struct _Manager
|
||||||
E_Module *module;
|
E_Module *module;
|
||||||
E_Config_Dialog *config_dialog;
|
E_Config_Dialog *config_dialog;
|
||||||
E_Int_Menu_Augmentation *maug;
|
E_Int_Menu_Augmentation *maug;
|
||||||
|
E_Menu_Category_Callback *mcat;
|
||||||
E_Action *action;
|
E_Action *action;
|
||||||
|
|
||||||
E_Config_DD *conf_edd;
|
E_Config_DD *conf_edd;
|
||||||
|
@ -92,5 +96,5 @@ void gadman_gadget_edit_start(E_Gadcon_Client *gcc);
|
||||||
void gadman_gadget_edit_end(void *data, Evas_Object *obj, const char *emission, const char *source);
|
void gadman_gadget_edit_end(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||||
void gadman_gadgets_toggle(void);
|
void gadman_gadgets_toggle(void);
|
||||||
void gadman_update_bg(void);
|
void gadman_update_bg(void);
|
||||||
|
Eina_Bool gadman_gadget_add_handler(void *d, int type, E_Event_Gadcon_Client_Add *ev);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
static void _gadman_maug_cb(void *data, E_Menu *m, E_Menu_Item *mi);
|
static void _gadman_maug_cb(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||||
static void _gadman_maug_add(void *data, E_Menu *m);
|
static void _gadman_maug_add(void *data, E_Menu *m);
|
||||||
static void _gadman_action_cb(E_Object *obj, const char *params);
|
static void _gadman_action_cb(E_Object *obj, const char *params);
|
||||||
|
static void _gadman_desktop_menu(E_Menu *m, void *d __UNUSED__, void *icon);
|
||||||
|
|
||||||
/* public module routines. all modules must have these */
|
/* public module routines. all modules must have these */
|
||||||
EAPI E_Module_Api e_modapi =
|
EAPI E_Module_Api e_modapi =
|
||||||
|
@ -72,6 +73,7 @@ e_modapi_init(E_Module *m)
|
||||||
/* Menu augmentation */
|
/* Menu augmentation */
|
||||||
Man->icon_name = eina_stringshare_add(buf);
|
Man->icon_name = eina_stringshare_add(buf);
|
||||||
Man->maug = NULL;
|
Man->maug = NULL;
|
||||||
|
Man->mcat = e_menu_category_callback_add("desktop", _gadman_desktop_menu, NULL, (void*)Man->icon_name);
|
||||||
Man->maug =
|
Man->maug =
|
||||||
e_int_menus_menu_augmentation_add_sorted
|
e_int_menus_menu_augmentation_add_sorted
|
||||||
("config/1", _("Gadgets"), _gadman_maug_add, (void *)Man->icon_name,
|
("config/1", _("Gadgets"), _gadman_maug_add, (void *)Man->icon_name,
|
||||||
|
@ -98,6 +100,7 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
||||||
|
|
||||||
e_configure_registry_item_del("extensions/gadman");
|
e_configure_registry_item_del("extensions/gadman");
|
||||||
e_configure_registry_category_del("extensions");
|
e_configure_registry_category_del("extensions");
|
||||||
|
if (Man->mcat) e_menu_category_callback_del(Man->mcat);
|
||||||
|
|
||||||
if (Man->config_dialog)
|
if (Man->config_dialog)
|
||||||
{
|
{
|
||||||
|
@ -110,6 +113,9 @@ e_modapi_shutdown(E_Module *m __UNUSED__)
|
||||||
e_action_del("gadman_toggle");
|
e_action_del("gadman_toggle");
|
||||||
Man->action = NULL;
|
Man->action = NULL;
|
||||||
}
|
}
|
||||||
|
if (Man->add)
|
||||||
|
ecore_event_handler_del(Man->add);
|
||||||
|
Man->waiting = eina_list_free(Man->waiting);
|
||||||
E_CONFIG_DD_FREE(Man->conf_edd);
|
E_CONFIG_DD_FREE(Man->conf_edd);
|
||||||
if (Man->conf)
|
if (Man->conf)
|
||||||
{
|
{
|
||||||
|
@ -128,6 +134,59 @@ e_modapi_save(E_Module *m __UNUSED__)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_cb_config_del(void *data)
|
||||||
|
{
|
||||||
|
int layer;
|
||||||
|
Eina_List *l;
|
||||||
|
E_Gadcon *gc;
|
||||||
|
Eina_Bool del = EINA_TRUE;
|
||||||
|
|
||||||
|
for (layer = 0; layer < GADMAN_LAYER_COUNT; layer++)
|
||||||
|
EINA_LIST_FOREACH(Man->gadcons[layer], l, gc)
|
||||||
|
if (gc->config_dialog)
|
||||||
|
{
|
||||||
|
del = EINA_FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Man->waiting = eina_list_remove(Man->waiting, data);
|
||||||
|
if (del && Man->add) ecore_event_handler_del(Man->add);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_gadman_desktop_menu_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
|
||||||
|
{
|
||||||
|
Eina_List *l;
|
||||||
|
E_Gadcon *gc;
|
||||||
|
|
||||||
|
EINA_LIST_FOREACH(Man->gadcons[0], l, gc)
|
||||||
|
{
|
||||||
|
if (gc->zone == m->zone)
|
||||||
|
{
|
||||||
|
e_int_gadcon_config_hook(gc, _("Desktop Gadgets"), E_GADCON_SITE_DESKTOP);
|
||||||
|
if (!Man->add)
|
||||||
|
Man->add = ecore_event_handler_add(E_EVENT_GADCON_CLIENT_ADD, (Ecore_Event_Handler_Cb)gadman_gadget_add_handler, NULL);
|
||||||
|
Man->waiting = eina_list_append(Man->waiting, gc);
|
||||||
|
e_object_del_attach_func_set(E_OBJECT(gc->config_dialog), _cb_config_del);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_gadman_desktop_menu(E_Menu *m, void *d __UNUSED__, void *icon)
|
||||||
|
{
|
||||||
|
E_Menu_Item *mi;
|
||||||
|
|
||||||
|
mi = e_menu_item_new_relative(m, NULL);
|
||||||
|
e_menu_item_label_set(mi, _("Change Gadgets"));
|
||||||
|
e_menu_item_icon_edje_set(mi, icon, "icon");
|
||||||
|
e_menu_item_callback_set(mi, _gadman_desktop_menu_cb, NULL);
|
||||||
|
|
||||||
|
mi = e_menu_item_new_relative(m, mi);
|
||||||
|
e_menu_item_separator_set(mi, 1);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gadman_maug_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
|
_gadman_maug_cb(void *data __UNUSED__, E_Menu *m, E_Menu_Item *mi __UNUSED__)
|
||||||
{
|
{
|
||||||
|
@ -151,3 +210,26 @@ _gadman_action_cb(E_Object *obj __UNUSED__, const char *params __UNUSED__)
|
||||||
gadman_gadgets_toggle();
|
gadman_gadgets_toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
gadman_gadget_add_handler(void *d __UNUSED__, int type __UNUSED__, E_Event_Gadcon_Client_Add *ev)
|
||||||
|
{
|
||||||
|
Eina_List *l;
|
||||||
|
if (!Man->waiting) return ECORE_CALLBACK_RENEW;
|
||||||
|
l = eina_list_data_find_list(Man->waiting, ev->gcc->gadcon);
|
||||||
|
if (!l) return ECORE_CALLBACK_RENEW;
|
||||||
|
if (ev->gcc->cf != eina_list_data_get(eina_list_last(ev->gcc->gadcon->cf->clients))) return ECORE_CALLBACK_RENEW;
|
||||||
|
Man->drag_gcc[ev->gcc->gadcon->id - ID_GADMAN_LAYER_BASE] = ev->gcc;
|
||||||
|
ev->gcc->cf->style = eina_stringshare_add(ev->gcc->client_class->default_style ?: E_GADCON_CLIENT_STYLE_INSET);
|
||||||
|
ev->gcc->style = eina_stringshare_ref(ev->gcc->cf->style);
|
||||||
|
ev->gcc->cf->geom.pos_x = DEFAULT_POS_X;
|
||||||
|
ev->gcc->cf->geom.pos_y = DEFAULT_POS_Y;
|
||||||
|
ev->gcc->cf->geom.size_w = DEFAULT_SIZE_W;
|
||||||
|
ev->gcc->cf->geom.size_h = DEFAULT_SIZE_H;
|
||||||
|
if (!strcmp(ev->gcc->style, E_GADCON_CLIENT_STYLE_INSET))
|
||||||
|
edje_object_signal_emit(ev->gcc->o_frame, "e,state,visibility,inset", "e");
|
||||||
|
else
|
||||||
|
edje_object_signal_emit(ev->gcc->o_frame, "e,state,visibility,plain", "e");
|
||||||
|
gadman_gadget_edit_start(ev->gcc);
|
||||||
|
|
||||||
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue