From 1e5628a2a3ef2667124ee13c7dc3d2ae681dd4ad Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 26 Jun 2012 11:32:02 +0000 Subject: [PATCH] redo shelf cfg list when shelf is deleted using its own menu SVN revision: 72874 --- src/bin/e_shelf.c | 12 ++++++- src/modules/conf_shelves/e_int_config_shelf.c | 49 ++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index 3c4bdc7..cb359c7 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -1,5 +1,6 @@ #include "e.h" +static void _e_shelf_del_cb(void *d); static void _e_shelf_free(E_Shelf *es); static void _e_shelf_gadcon_min_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); static void _e_shelf_gadcon_size_request(void *data, E_Gadcon *gc, Evas_Coord w, Evas_Coord h); @@ -106,6 +107,7 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i es->w = 32; es->h = 32; es->zone = zone; + e_object_del_attach_func_set(E_OBJECT(es), _e_shelf_del_cb); e_zone_useful_geometry_dirty(zone); if (popup) { @@ -851,6 +853,15 @@ e_shelf_config_new(E_Zone *zone, E_Config_Shelf *cf_es) /* local subsystem functions */ static void +_e_shelf_del_cb(void *d) +{ + E_Shelf *es; + + es = d; + shelves = eina_list_remove(shelves, es); +} + +static void _e_shelf_free(E_Shelf *es) { _e_shelf_bindings_del(es); @@ -884,7 +895,6 @@ _e_shelf_free(E_Shelf *es) es->menu = NULL; } if (es->config_dialog) e_object_del(E_OBJECT(es->config_dialog)); - shelves = eina_list_remove(shelves, es); eina_stringshare_del(es->name); eina_stringshare_del(es->style); evas_object_del(es->o_event); diff --git a/src/modules/conf_shelves/e_int_config_shelf.c b/src/modules/conf_shelves/e_int_config_shelf.c index e4951bf..90972e5 100644 --- a/src/modules/conf_shelves/e_int_config_shelf.c +++ b/src/modules/conf_shelves/e_int_config_shelf.c @@ -4,6 +4,7 @@ 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 void _ilist_fill(E_Config_Dialog_Data *cfdata); +static void _ilist_empty(E_Config_Dialog_Data *cfdata); static void _ilist_cb_selected(void *data); static void _cb_add(void *data, void *data2); static void _cb_delete(void *data, void *data2); @@ -108,12 +109,25 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata) /* private functions */ static void +_ilist_refresh(E_Shelf *es) +{ + E_Config_Dialog_Data *cfdata; + + cfdata = evas_object_data_get(es->o_base, "cfdata"); + if (!cfdata) return; + _ilist_empty(cfdata); + _ilist_fill(cfdata); +} + +static void _ilist_item_new(E_Config_Dialog_Data *cfdata, Eina_Bool append, E_Shelf *es) { char buf[256]; Evas_Object *ob; snprintf(buf, sizeof(buf), "Shelf %s", e_shelf_orient_string_get(es)); + e_object_del_func_set(E_OBJECT(es), (E_Object_Cleanup_Func)_ilist_refresh); + evas_object_data_set(es->o_base, "cfdata", cfdata); ob = e_icon_add(evas_object_evas_get(cfdata->o_list)); switch (es->cfg->orient) @@ -179,6 +193,39 @@ _ilist_item_new(E_Config_Dialog_Data *cfdata, Eina_Bool append, E_Shelf *es) } static void +_ilist_empty(E_Config_Dialog_Data *cfdata) +{ + Eina_List *l; + E_Shelf *es; + E_Desk *desk; + E_Zone *zone; + + zone = e_util_zone_current_get(cfdata->cfd->con->manager); + desk = e_desk_current_get(zone); + EINA_LIST_FOREACH(e_shelf_list(), l, es) + { + if (es->zone != zone) continue; + if (es->cfg->desk_show_mode) + { + Eina_List *ll; + E_Config_Shelf_Desk *sd; + + EINA_LIST_FOREACH(es->cfg->desk_list, ll, sd) + { + if ((desk->x == sd->x) && (desk->y == sd->y)) + { + e_object_del_func_set(E_OBJECT(es), NULL); + break; + } + } + } + else + e_object_del_func_set(E_OBJECT(es), NULL); + } + e_widget_ilist_clear(cfdata->o_list); +} + +static void _ilist_fill(E_Config_Dialog_Data *cfdata) { Evas *evas; @@ -366,7 +413,7 @@ _cb_dialog_destroy(void *data) d = data; e_object_unref(E_OBJECT(d->es)); - _ilist_fill(d->cfdata); + _ilist_empty(d->cfdata); E_FREE(d); } -- 2.7.4