From 1f05439257a4e9e88fe17e819b8ffa6eead9fb4e Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 30 Oct 2006 10:42:23 +0000 Subject: [PATCH] 1 metric tonne of pooch. SVN revision: 26867 --- TODO | 1 + src/bin/e_confirm_dialog.c | 11 +++++++- src/bin/e_confirm_dialog.h | 2 +- src/bin/e_int_config_shelf.c | 52 +++++++++++++++++++++++++----------- src/bin/e_shelf.c | 17 +++++++++++- 5 files changed, 65 insertions(+), 18 deletions(-) diff --git a/TODO b/TODO index a91d600d1..dbc0212d4 100644 --- a/TODO +++ b/TODO @@ -95,6 +95,7 @@ Some of the things (in very short form) that need to be done to E17... "NICE TO HAVE" FEATURES ------------------------------------------------------------------------------- +* enlightenment_remote cmd's for logout, hibernate, reboot, suspend. * nice to have a menu item for a window for "add keyboard shortcut to run this app" would be nice usability * full fm2 support as an icon fm needs work - beyond fsel needs and for icons diff --git a/src/bin/e_confirm_dialog.c b/src/bin/e_confirm_dialog.c index 520db781c..ab3f9dea9 100644 --- a/src/bin/e_confirm_dialog.c +++ b/src/bin/e_confirm_dialog.c @@ -18,6 +18,12 @@ struct _E_Confirm_Dialog void *data; void (*func)(void *data); } no; + + struct + { + void *data; + void (*func)(void *data); + } del; E_Dialog *dia; }; @@ -32,7 +38,7 @@ static void _e_confirm_dialog_no(void *data, E_Dialog *dia); EAPI void e_confirm_dialog_show(const char *title, const char *icon, const char *text, const char *button_text, const char *button2_text, void (*func)(void *data), - void (*func2)(void *data), void *data, void *data2) + void (*func2)(void *data), void *data, void *data2, void (*del_func)(void *data), void *del_data) { E_Confirm_Dialog *cd; E_Dialog *dia; @@ -42,6 +48,8 @@ e_confirm_dialog_show(const char *title, const char *icon, const char *text, cd->yes.data = data; cd->no.func = func2; cd->no.data = data2; + cd->del.func = del_func; + cd->del.data = del_data; dia = e_dialog_new(e_container_current_get(e_manager_current_get()), "E", "_confirm_dialog"); if (!dia) @@ -94,6 +102,7 @@ _e_confirm_dialog_delete(E_Win *win) dia = win->data; cd = dia->data; + if (cd->del.func) cd->del.func(cd->del.data); e_object_del(E_OBJECT(dia)); free(cd); } diff --git a/src/bin/e_confirm_dialog.h b/src/bin/e_confirm_dialog.h index 251d7654b..48a6b6c89 100644 --- a/src/bin/e_confirm_dialog.h +++ b/src/bin/e_confirm_dialog.h @@ -18,7 +18,7 @@ * data - the pointer passed to func * data2 - the pointer passed to func2 */ -EAPI void e_confirm_dialog_show(const char *title, const char *icon, const char *text, const char *button_text, const char *button2_text, void (*func)(void *data), void (*func2)(void *data), void *data, void *data2); +EAPI void e_confirm_dialog_show(const char *title, const char *icon, const char *text, const char *button_text, const char *button2_text, void (*func)(void *data), void (*func2)(void *data), void *data, void *data2, void (*del_func)(void *data), void * del_data); #endif #endif diff --git a/src/bin/e_int_config_shelf.c b/src/bin/e_int_config_shelf.c index 8c62e0d87..a252c842f 100644 --- a/src/bin/e_int_config_shelf.c +++ b/src/bin/e_int_config_shelf.c @@ -8,6 +8,7 @@ static void _ilist_cb_selected(void *data); static void _cb_add(void *data, void *data2); static void _cb_delete(void *data, void *data2); static void _cb_dialog_yes(void *data); +static void _cb_dialog_destroy(void *data); static void _cb_config(void *data, void *data2); struct _E_Config_Dialog_Data @@ -19,6 +20,14 @@ struct _E_Config_Dialog_Data char *cur_shelf; }; +typedef struct _Shelf_Del_Confirm_Data Shelf_Del_Confirm_Data; +struct _Shelf_Del_Confirm_Data +{ + E_Config_Dialog_Data *cfdata; + E_Shelf *es; +}; + + EAPI E_Config_Dialog * e_int_config_shelf(E_Container *con) { @@ -229,38 +238,51 @@ _cb_add(void *data, void *data2) static void _cb_delete(void *data, void *data2) { - E_Config_Dialog_Data *cfdata; + Shelf_Del_Confirm_Data *d; char buf[4096]; - cfdata = data; - if (!cfdata) return; - if (!cfdata->cur_shelf) return; + d = E_NEW(Shelf_Del_Confirm_Data, 1); + if (!d) return; + d->cfdata = data; + if (!d->cfdata) return; + if (!d->cfdata->cur_shelf) return; + d->es = evas_list_nth(e_shelf_list(), e_widget_ilist_selected_get(d->cfdata->o_list)); + if (!d->es) return; + e_object_ref(E_OBJECT(d->es)); snprintf(buf, sizeof(buf), _("You requested to delete \"%s\".

" "Are you sure you want to delete this shelf?"), - cfdata->cur_shelf); + d->cfdata->cur_shelf); e_confirm_dialog_show(_("Are you sure you want to delete this shelf?"), - "enlightenment/exit", buf, NULL, NULL, _cb_dialog_yes, NULL, cfdata, NULL); + "enlightenment/exit", buf, NULL, NULL, _cb_dialog_yes, NULL, d, NULL, + _cb_dialog_destroy, d); } static void _cb_dialog_yes(void *data) { - E_Config_Dialog_Data *cfdata; + Shelf_Del_Confirm_Data *d; E_Shelf *es; - cfdata = data; - if (!cfdata) return; + d = data; + if (!data) return; - es = evas_list_nth(e_shelf_list(), e_widget_ilist_selected_get(cfdata->o_list)); - if (!es) return; - - e_shelf_unsave(es); - e_object_del(E_OBJECT(es)); + if (e_object_is_del(E_OBJECT(d->es))) return; + e_shelf_unsave(d->es); + e_object_del(E_OBJECT(d->es)); e_config_save_queue(); +} - _ilist_fill(cfdata); +static void +_cb_dialog_destroy(void *data) +{ + Shelf_Del_Confirm_Data *d; + + d = data; + e_object_unref(E_OBJECT(d->es)); + _ilist_fill(d->cfdata); + E_FREE(d); } static void diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index 2e34499ea..d43189817 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -12,6 +12,7 @@ static void _e_shelf_cb_menu_config(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_shelf_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_shelf_cb_menu_contents(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_shelf_cb_confirm_dialog_yes(void *data); +static void _e_shelf_cb_confirm_dialog_no(void *data); static void _e_shelf_cb_menu_delete(void *data, E_Menu *m, E_Menu_Item *mi); static void _e_shelf_menu_append(E_Shelf *es, E_Menu *mn); static void _e_shelf_cb_menu_items_append(void *data, E_Menu *mn); @@ -22,6 +23,7 @@ static void _e_shelf_cb_mouse_out(void *data, Evas *evas, Evas_Object *obj, void static int _e_shelf_cb_id_sort(void *data1, void *data2); static Evas_List *shelves = NULL; +static Evas_Bool _del_confirm_active = 0; /* externally accessible functions */ EAPI int @@ -865,6 +867,15 @@ _e_shelf_cb_menu_contents(void *data, E_Menu *m, E_Menu_Item *mi) e_int_gadcon_config(es->gadcon); } +static void +_e_shelf_cb_confirm_dialog_destroy(void *data) +{ + E_Shelf *es; + + es = data; + e_object_unref(E_OBJECT(es)); +} + static void _e_shelf_cb_confirm_dialog_yes(void *data) { @@ -873,6 +884,7 @@ _e_shelf_cb_confirm_dialog_yes(void *data) es = data; cfg = es->cfg; + if (e_object_is_del(E_OBJECT(es))) return; e_object_del(E_OBJECT(es)); e_config->shelves = evas_list_remove(e_config->shelves, cfg); if (cfg->name) evas_stringshare_del(cfg->name); @@ -886,11 +898,14 @@ _e_shelf_cb_confirm_dialog_yes(void *data) static void _e_shelf_cb_menu_delete(void *data, E_Menu *m, E_Menu_Item *mi) { + E_Shelf * es = data; + e_object_ref(E_OBJECT(es)); e_confirm_dialog_show(_("Are you sure you want to delete this shelf?"), "enlightenment/e", _("You requested to delete this shelf.
" "
" "Are you sure you want to delete it?"), NULL, NULL, - _e_shelf_cb_confirm_dialog_yes, NULL, data, NULL); + _e_shelf_cb_confirm_dialog_yes, NULL, data, NULL, + _e_shelf_cb_confirm_dialog_destroy, data); } static void