forked from enlightenment/enlightenment
gadcon location gadget_add callbacks now have a gadcon client param so the config can be retrieved since these callbacks are (currently) only used for changing locations of gadgets
also the related gcc param in gadget_del can now have a NULL config to signify that the gadget has been moved to a new gadcon this means that moving a gadget to a new location will no longer cause it to lose its gadget config ticket #1594 SVN revision: 77521
This commit is contained in:
parent
c008654175
commit
71f57bb52d
|
@ -5664,7 +5664,7 @@ _e_gadcon_provider_populate_unrequest(const E_Gadcon_Client_Class *cc)
|
|||
EAPI E_Gadcon_Location *
|
||||
e_gadcon_location_new(const char *name,
|
||||
E_Gadcon_Site site,
|
||||
int (*add_func)(void *data, const E_Gadcon_Client_Class *cc),
|
||||
int (*add_func)(void *data, E_Gadcon_Client *gcc, const E_Gadcon_Client_Class *cc),
|
||||
void *add_data,
|
||||
void (*remove_func)(void *data, E_Gadcon_Client *cc),
|
||||
void *remove_data)
|
||||
|
@ -5719,7 +5719,8 @@ _e_gadcon_location_change(E_Gadcon_Client *gcc, E_Gadcon_Location *src, E_Gadcon
|
|||
|
||||
cc = eina_hash_find(providers, gcc->cf->name);
|
||||
if (!cc) return 0;
|
||||
if (!dst->gadget_add.func(dst->gadget_add.data, cc)) return 0;
|
||||
if (!dst->gadget_add.func(dst->gadget_add.data, gcc, cc)) return 0;
|
||||
gcc->cf = NULL;
|
||||
src->gadget_remove.func(src->gadget_remove.data, gcc);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -261,7 +261,7 @@ struct _E_Gadcon_Location
|
|||
/* adds gadcon client to location. Returns nonzero on success */
|
||||
struct
|
||||
{
|
||||
int (*func)(void *data, const E_Gadcon_Client_Class *cc);
|
||||
int (*func)(void *data, E_Gadcon_Client *gcc, const E_Gadcon_Client_Class *cc);
|
||||
void *data;
|
||||
} gadget_add;
|
||||
/* removes existing gadcon client from location */
|
||||
|
@ -353,7 +353,7 @@ EAPI Eina_Bool e_gadcon_site_is_not_toolbar(E_Gadcon_Site site); /
|
|||
|
||||
EAPI E_Gadcon_Location *
|
||||
e_gadcon_location_new(const char *name, E_Gadcon_Site site,
|
||||
int (*add_func)(void *data, const E_Gadcon_Client_Class *cc),
|
||||
int (*add_func)(void *data, E_Gadcon_Client *, const E_Gadcon_Client_Class *cc),
|
||||
void *add_data,
|
||||
void (*remove_func)(void *data, E_Gadcon_Client *cc),
|
||||
void *remove_data);
|
||||
|
|
|
@ -28,7 +28,7 @@ static Eina_Bool _e_shelf_cb_hide_urgent_timer(void *data);
|
|||
static Eina_Bool _e_shelf_cb_instant_hide_timer(void *data);
|
||||
static void _e_shelf_menu_pre_cb(void *data, E_Menu *m);
|
||||
static void _e_shelf_gadcon_client_remove(void *data, E_Gadcon_Client *gcc);
|
||||
static int _e_shelf_gadcon_client_add(void *data, const E_Gadcon_Client_Class *cc);
|
||||
static int _e_shelf_gadcon_client_add(void *data, E_Gadcon_Client *gcc, const E_Gadcon_Client_Class *cc);
|
||||
static const char *_e_shelf_orient_icon_name_get(E_Shelf *s);
|
||||
static void _e_shelf_bindings_add(E_Shelf *es);
|
||||
static void _e_shelf_bindings_del(E_Shelf *es);
|
||||
|
@ -2405,21 +2405,52 @@ _e_shelf_gadcon_client_remove(void *data, E_Gadcon_Client *gcc)
|
|||
|
||||
s = data;
|
||||
gc = s->gadcon;
|
||||
e_gadcon_client_config_del(gc->cf, gcc->cf);
|
||||
if (gcc->cf) e_gadcon_client_config_del(gc->cf, gcc->cf);
|
||||
e_gadcon_unpopulate(gc);
|
||||
e_gadcon_populate(gc);
|
||||
e_config_save_queue();
|
||||
}
|
||||
|
||||
static int
|
||||
_e_shelf_gadcon_client_add(void *data, const E_Gadcon_Client_Class *cc)
|
||||
_e_shelf_gadcon_client_add(void *data, E_Gadcon_Client *gcc, const E_Gadcon_Client_Class *cc)
|
||||
{
|
||||
E_Shelf *s;
|
||||
E_Gadcon *gc;
|
||||
E_Config_Gadcon_Client *cf_gcc = gcc->cf;
|
||||
|
||||
s = data;
|
||||
gc = s->gadcon;
|
||||
if (!e_gadcon_client_config_new(gc, cc->name)) return 0;
|
||||
if (gcc)
|
||||
{
|
||||
gcc->gadcon->cf->clients = eina_list_remove(gcc->gadcon->cf->clients, cf_gcc);
|
||||
if (gc->zone)
|
||||
cf_gcc->geom.res = gc->zone->w;
|
||||
else if (gc->o_container)
|
||||
{
|
||||
int w, h;
|
||||
evas_object_geometry_get(gc->o_container, NULL, NULL, &w, &h);
|
||||
switch (gc->orient)
|
||||
{
|
||||
case E_GADCON_ORIENT_VERT:
|
||||
case E_GADCON_ORIENT_LEFT:
|
||||
case E_GADCON_ORIENT_RIGHT:
|
||||
case E_GADCON_ORIENT_CORNER_LT:
|
||||
case E_GADCON_ORIENT_CORNER_RT:
|
||||
case E_GADCON_ORIENT_CORNER_LB:
|
||||
case E_GADCON_ORIENT_CORNER_RB:
|
||||
cf_gcc->geom.res = h;
|
||||
break;
|
||||
default:
|
||||
cf_gcc->geom.res = w;
|
||||
}
|
||||
}
|
||||
else
|
||||
cf_gcc->geom.res = 800;
|
||||
cf_gcc->geom.size = 80;
|
||||
cf_gcc->geom.pos = cf_gcc->geom.res - cf_gcc->geom.size;
|
||||
gc->cf->clients = eina_list_append(gc->cf->clients, cf_gcc);
|
||||
}
|
||||
else if (!e_gadcon_client_config_new(gc, cc->name)) return 0;
|
||||
e_gadcon_unpopulate(gc);
|
||||
e_gadcon_populate(gc);
|
||||
e_config_save_queue();
|
||||
|
|
|
@ -40,7 +40,7 @@ static void on_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
|
|||
static void on_menu_add(void *data, E_Menu *m, E_Menu_Item *mi);
|
||||
|
||||
static Eina_Bool _gadman_module_cb(void *d __UNUSED__, int type __UNUSED__, E_Event_Module_Update *ev);
|
||||
static int _e_gadman_client_add(void *data __UNUSED__, const E_Gadcon_Client_Class *cc);
|
||||
static int _e_gadman_client_add(void *data __UNUSED__, E_Gadcon_Client *, const E_Gadcon_Client_Class *cc);
|
||||
static void _e_gadman_client_remove(void *data __UNUSED__, E_Gadcon_Client *gcc);
|
||||
|
||||
static void _e_gadman_handlers_add(void);
|
||||
|
@ -373,9 +373,9 @@ gadman_gadget_place(E_Gadcon_Client *gcc, const E_Gadcon_Client_Class *cc, E_Con
|
|||
}
|
||||
|
||||
E_Gadcon_Client *
|
||||
gadman_gadget_add(const E_Gadcon_Client_Class *cc, Gadman_Layer_Type layer)
|
||||
gadman_gadget_add(const E_Gadcon_Client_Class *cc, E_Gadcon_Client *gcc, Gadman_Layer_Type layer)
|
||||
{
|
||||
return _gadman_gadget_add(cc, layer, NULL);
|
||||
return _gadman_gadget_add(cc, layer, gcc->cf);
|
||||
}
|
||||
|
||||
static E_Gadcon_Client *
|
||||
|
@ -1666,15 +1666,16 @@ on_hide_stop(void *data __UNUSED__, Evas_Object *o __UNUSED__, const char *em __
|
|||
}
|
||||
|
||||
static int
|
||||
_e_gadman_client_add(void *data __UNUSED__, const E_Gadcon_Client_Class *cc)
|
||||
_e_gadman_client_add(void *data __UNUSED__, E_Gadcon_Client *gcc, const E_Gadcon_Client_Class *cc)
|
||||
{
|
||||
return !!gadman_gadget_add(cc, GADMAN_LAYER_BG);
|
||||
return !!gadman_gadget_add(cc, gcc, GADMAN_LAYER_BG);
|
||||
}
|
||||
|
||||
static void
|
||||
_e_gadman_client_remove(void *data __UNUSED__, E_Gadcon_Client *gcc)
|
||||
{
|
||||
gcc->gadcon->cf->clients = eina_list_remove(gcc->gadcon->cf->clients, gcc->cf);
|
||||
if (gcc->cf)
|
||||
gcc->gadcon->cf->clients = eina_list_remove(gcc->gadcon->cf->clients, gcc->cf);
|
||||
e_object_del(E_OBJECT(gcc));
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ extern Manager *Man;
|
|||
|
||||
void gadman_init(E_Module *m);
|
||||
void gadman_shutdown(void);
|
||||
E_Gadcon_Client *gadman_gadget_add(const E_Gadcon_Client_Class *cc, Gadman_Layer_Type layer);
|
||||
E_Gadcon_Client *gadman_gadget_add(const E_Gadcon_Client_Class *cc, E_Gadcon_Client *, Gadman_Layer_Type layer);
|
||||
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_gadgets_toggle(void);
|
||||
|
|
Loading…
Reference in New Issue