forked from enlightenment/enlightenment
add mechanism for deleting gadcon configs, shelf deletion now triggers gadcon deletion, fix crash when renaming shelves, prevent shelves from being renamed to the same name as another shelf, fix bug where gadcon client ordering would increase infinitely when adding/removing/redrawing gadgets
SVN revision: 76297
This commit is contained in:
parent
a1e5098e8a
commit
4c89c8ccb1
|
@ -415,6 +415,14 @@ e_gadcon_dummy_new(int id)
|
|||
return gc;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
e_gadcon_config_del(E_Gadcon *gc)
|
||||
{
|
||||
E_OBJECT_CHECK(gc);
|
||||
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
|
||||
gc->cfg_delete = 1;
|
||||
}
|
||||
|
||||
EAPI E_Gadcon *
|
||||
e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, const char *swallow_name)
|
||||
{
|
||||
|
@ -878,6 +886,25 @@ e_gadcon_client_config_new(E_Gadcon *gc, const char *name)
|
|||
cf_gcc->name = eina_stringshare_add(name);
|
||||
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;
|
||||
|
@ -1914,6 +1941,13 @@ _e_gadcon_free(E_Gadcon *gc)
|
|||
eina_stringshare_del(gc->edje.swallow_name);
|
||||
if (gc->config_dialog) e_object_del(E_OBJECT(gc->config_dialog));
|
||||
if (gc->drop_handler) e_drop_handler_del(gc->drop_handler);
|
||||
if (gc->cfg_delete)
|
||||
{
|
||||
eina_stringshare_del(gc->cf->name);
|
||||
e_config->gadcons = eina_list_remove(e_config->gadcons, gc->cf);
|
||||
free(gc->cf);
|
||||
e_config_save_queue();
|
||||
}
|
||||
free(gc);
|
||||
}
|
||||
|
||||
|
@ -3480,6 +3514,7 @@ e_gadcon_layout_pack_options_set(Evas_Object *obj, E_Gadcon_Client *gcc)
|
|||
{
|
||||
bi2 = evas_object_data_get(item, "e_gadcon_layout_data");
|
||||
if (bi == bi2) continue;
|
||||
if (bi->gcc->id == bi2->gcc->id) continue;
|
||||
if (bi->gcc->state_info.seq == bi2->gcc->state_info.seq)
|
||||
ok = 1;
|
||||
|
||||
|
@ -3738,6 +3773,11 @@ _e_gadcon_layout_smart_reconfigure(E_Smart_Data *sd)
|
|||
evas_object_move(obj, yy, xx);
|
||||
evas_object_resize(obj, bi->h, bi->w);
|
||||
}
|
||||
if ((recurse == 1) && bi->gcc->state_info.want_save)
|
||||
{
|
||||
_e_gadcon_client_save(bi->gcc);
|
||||
bi->gcc->state_info.want_save = 0;
|
||||
}
|
||||
}
|
||||
sd->doing_config = 0;
|
||||
if (sd->redo_config)
|
||||
|
|
|
@ -134,6 +134,7 @@ struct _E_Gadcon
|
|||
unsigned char instant_edit : 1;
|
||||
unsigned char dummy : 1;
|
||||
Eina_Bool custom : 1;
|
||||
Eina_Bool cfg_delete : 1;
|
||||
};
|
||||
|
||||
#define GADCON_CLIENT_CLASS_VERSION 3
|
||||
|
@ -265,6 +266,7 @@ EAPI void e_gadcon_provider_register(const E_Gadcon_Client_Cl
|
|||
EAPI void e_gadcon_provider_unregister(const E_Gadcon_Client_Class *cc);
|
||||
EAPI Eina_List *e_gadcon_provider_list(void);
|
||||
EAPI E_Gadcon *e_gadcon_dummy_new(int id);
|
||||
EAPI void e_gadcon_config_del(E_Gadcon *gc);
|
||||
EAPI E_Gadcon *e_gadcon_swallowed_new(const char *name, int id, Evas_Object *obj, const char *swallow_name);
|
||||
EAPI void e_gadcon_custom_new(E_Gadcon *gc);
|
||||
EAPI void e_gadcon_custom_del(E_Gadcon *gc);
|
||||
|
|
|
@ -574,13 +574,7 @@ e_shelf_unsave(E_Shelf *es)
|
|||
{
|
||||
E_OBJECT_CHECK(es);
|
||||
E_OBJECT_TYPE_CHECK(es, E_SHELF_TYPE);
|
||||
if (es->cfg)
|
||||
{
|
||||
e_config->shelves = eina_list_remove(e_config->shelves, es->cfg);
|
||||
eina_stringshare_del(es->cfg->name);
|
||||
if (es->cfg->style) eina_stringshare_del(es->cfg->style);
|
||||
free(es->cfg);
|
||||
}
|
||||
es->cfg_delete = 1;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -1010,11 +1004,13 @@ _e_shelf_free_cb(void *data __UNUSED__, void *event)
|
|||
|
||||
if (es->cfg_delete)
|
||||
{
|
||||
e_config->shelves = eina_list_remove(e_config->shelves, es->cfg);
|
||||
eina_stringshare_del(es->cfg->name);
|
||||
eina_stringshare_del(es->cfg->style);
|
||||
free(es->cfg);
|
||||
|
||||
if (es->cfg)
|
||||
{
|
||||
e_config->shelves = eina_list_remove(e_config->shelves, es->cfg);
|
||||
eina_stringshare_del(es->cfg->name);
|
||||
eina_stringshare_del(es->cfg->style);
|
||||
free(es->cfg);
|
||||
}
|
||||
e_config_save_queue();
|
||||
}
|
||||
free(es);
|
||||
|
@ -1067,6 +1063,7 @@ _e_shelf_free(E_Shelf *es)
|
|||
{
|
||||
e_gadcon_location_unregister(es->gadcon->location);
|
||||
e_gadcon_location_free(es->gadcon->location);
|
||||
if (es->cfg_delete) e_gadcon_config_del(es->gadcon);
|
||||
e_object_del(E_OBJECT(es->gadcon));
|
||||
es->gadcon = NULL;
|
||||
}
|
||||
|
@ -1533,18 +1530,13 @@ static void
|
|||
_e_shelf_cb_menu_delete(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUSED__)
|
||||
{
|
||||
E_Shelf *es;
|
||||
E_Config_Shelf *cfg;
|
||||
|
||||
es = data;
|
||||
if (e_config->cnfmdlg_disabled)
|
||||
{
|
||||
cfg = es->cfg;
|
||||
if (e_object_is_del(E_OBJECT(es))) return;
|
||||
es->cfg_delete = 1;
|
||||
e_object_del(E_OBJECT(es));
|
||||
e_config->shelves = eina_list_remove(e_config->shelves, cfg);
|
||||
if (cfg->name) eina_stringshare_del(cfg->name);
|
||||
if (cfg->style) eina_stringshare_del(cfg->style);
|
||||
E_FREE(cfg);
|
||||
|
||||
e_config_save_queue();
|
||||
return;
|
||||
|
@ -2000,12 +1992,14 @@ _e_shelf_cb_instant_hide_timer(void *data)
|
|||
static void
|
||||
_e_shelf_cb_menu_rename_yes_cb(void *data, char *text)
|
||||
{
|
||||
E_Shelf *es = e_object_data_get(data);
|
||||
E_Shelf *es = data;
|
||||
Eina_List *l;
|
||||
E_Config_Shelf *cf_es;
|
||||
|
||||
if ((!text) || (!text[0])) return;
|
||||
if (!strcmp(text, es->cfg->name)) return;
|
||||
EINA_LIST_FOREACH(e_config->shelves, l, cf_es)
|
||||
if ((!strcmp(cf_es->name, text)) && (cf_es->id == es->id))
|
||||
if (!strcmp(cf_es->name, text))
|
||||
{
|
||||
e_util_dialog_internal(_("Error"), _("A shelf with that name and id already exists!"));
|
||||
return;
|
||||
|
@ -2030,7 +2024,7 @@ _e_shelf_cb_menu_rename(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi __UNUS
|
|||
_("Name:"), es->name, NULL, NULL,
|
||||
_e_shelf_cb_menu_rename_yes_cb,
|
||||
NULL, es);
|
||||
E_OBJECT(es->rename_dialog)->data = es;
|
||||
e_object_data_set(E_OBJECT(es->rename_dialog), es);
|
||||
e_object_del_attach_func_set(E_OBJECT(es->rename_dialog),
|
||||
_e_shelf_cb_menu_rename_cb);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue