2006-05-05 05:20:14 -07:00
|
|
|
#include "e.h"
|
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
typedef struct _CFGadget CFGadget;
|
2012-06-20 23:19:43 -07:00
|
|
|
struct _CFGadget
|
2010-04-10 17:20:38 -07:00
|
|
|
{
|
|
|
|
const char *name, *id;
|
|
|
|
};
|
2010-04-09 12:38:28 -07:00
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
struct _E_Config_Dialog_Data
|
2006-05-05 05:20:14 -07:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
E_Gadcon *gc;
|
List of changes:
1. Gadcon sities:
-- 'E_Gadcon_Site' enum to list all available sities,
-- added 'is_site' callback for distinguish gadcon sities,
-- 'e_gadcon_site_is_*' helpers written to use in gadget modules,
-- gadcon config dialogs modified to show only gadgets that appropriate
to selected gadcon site,
-- all gadget modules updated for using new callback.
When callback is not provided in module, then gadget can be used in
any gadcon site.
2. Filemanager:
-- added error icon to unexisting path dialog,
-- added callback 'func.abort' to 'E_Fm2_Op_Registry_Entry' to specify
abort operation sequence (if not provided, then operation is not
cancelable),
-- added parameter to 'e_fm2_op_registry_entry_add' to specify abort
method on construct 'E_Fm2_Op_Registry_Entry' or make non-cancelable
operation if this function is not provided,
-- added 'e_fm2_operation_abort' call to cancel efm2 operation,
-- added method '_e_fm2_operation_abort_internal' that represent efm2
default handler of operation cancelling,
-- 'done' and 'total' fields of 'E_Fm2_Op_Registry_Entry' changed to
off_t type, also all message handlers modified to work with it
(to show progress for large files correctly),
-- improved file operation progress processing,
-- added cancel button to operation progress gadget in filemanager window,
-- added delete file glyph to operation progress gadget,
-- improved status message for efm2 operation progress.
3. Filemanager slave:
-- fixed critical bug in message handling via stdin/stdout,
-- fixed critical bug in removing task from list,
-- improved 'E_FM_OP_ABORT' handling,
-- fix rollback counting on moving files.
4. Fileman_opinfo module:
-- a new theme writed: status string and gadget for view operation status
in summary and detail modes,
-- summary mode: operation glyph, state message, progressbar, abort button,
-- detail mode: all for summary + from filename, to filename,
-- summary/detailed button works as trigger,
-- added source of module theme and used images.
4. Pathbar module:
-- non-critical fix, just for safety.
Also patch contains several minor updates to serve main task.
SVN revision: 41224
2009-06-29 07:38:03 -07:00
|
|
|
E_Gadcon_Site site;
|
2010-04-09 12:38:28 -07:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
Evas_Object *o_list, *o_add, *o_del;
|
2010-04-10 17:31:13 -07:00
|
|
|
Ecore_Event_Handler *hdl;
|
2010-04-10 17:20:38 -07:00
|
|
|
Ecore_Timer *load_timer;
|
|
|
|
Eina_Hash *gadget_hash;
|
2006-05-05 05:20:14 -07:00
|
|
|
};
|
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
/* local function prototypes */
|
|
|
|
static void _create_dialog(E_Gadcon *gc, const char *title);
|
|
|
|
static void *_create_data(E_Config_Dialog *cfd);
|
|
|
|
static void _fill_data(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
|
|
|
static Eina_Bool _free_gadgets(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__);
|
|
|
|
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool _cb_load_timer(void *data);
|
2010-04-10 17:20:38 -07:00
|
|
|
static void _fill_list(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _cb_list_selected(void *data);
|
|
|
|
static void _cb_add(void *data, void *data2 __UNUSED__);
|
|
|
|
static void _cb_del(void *data, void *data2 __UNUSED__);
|
|
|
|
static CFGadget *_search_hash(E_Config_Dialog_Data *cfdata, const char *name);
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool _cb_mod_update(void *data, int type, void *event __UNUSED__);
|
2010-04-10 17:20:38 -07:00
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
EAPI void
|
|
|
|
e_int_gadcon_config_shelf(E_Gadcon *gc)
|
2007-11-09 15:53:38 -08:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
_create_dialog(gc, _("Shelf Contents"));
|
2007-11-09 15:53:38 -08:00
|
|
|
}
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
EAPI void
|
|
|
|
e_int_gadcon_config_toolbar(E_Gadcon *gc)
|
2007-11-09 15:53:38 -08:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
_create_dialog(gc, _("Toolbar Contents"));
|
2007-11-09 15:53:38 -08:00
|
|
|
}
|
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
/* local function prototypes */
|
2012-06-20 23:19:43 -07:00
|
|
|
static void
|
|
|
|
_create_dialog(E_Gadcon *gc, const char *title)
|
2006-05-05 05:20:14 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_View *v;
|
2008-01-04 01:18:42 -08:00
|
|
|
E_Container *con;
|
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
if (!(v = E_NEW(E_Config_Dialog_View, 1))) return;
|
2010-04-09 12:38:28 -07:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
v->create_cfdata = _create_data;
|
2008-01-04 01:18:42 -08:00
|
|
|
v->free_cfdata = _free_data;
|
|
|
|
v->basic.create_widgets = _basic_create;
|
2007-11-01 14:39:55 -07:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
con = e_container_current_get(e_manager_current_get());
|
2012-06-20 23:19:43 -07:00
|
|
|
gc->config_dialog =
|
|
|
|
e_config_dialog_new(con, title, "E", "_gadcon_config_dialog",
|
2010-04-10 17:20:38 -07:00
|
|
|
"preferences-desktop-shelf", 0, v, gc);
|
|
|
|
e_dialog_resizable_set(gc->config_dialog->dia, EINA_TRUE);
|
|
|
|
e_win_centered_set(gc->config_dialog->dia->win, EINA_TRUE);
|
2006-05-05 05:20:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
2012-06-20 23:19:43 -07:00
|
|
|
_create_data(E_Config_Dialog *cfd)
|
2006-05-05 05:20:14 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2008-01-04 01:18:42 -08:00
|
|
|
|
2006-05-05 05:20:14 -07:00
|
|
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
2010-04-10 17:20:38 -07:00
|
|
|
cfdata->gadget_hash = eina_hash_string_superfast_new(NULL);
|
2010-04-09 12:38:28 -07:00
|
|
|
cfdata->gc = cfd->data;
|
2010-04-10 17:20:38 -07:00
|
|
|
if (cfdata->gc->shelf)
|
|
|
|
cfdata->site = E_GADCON_SITE_SHELF;
|
|
|
|
else if (cfdata->gc->toolbar)
|
|
|
|
cfdata->site = E_GADCON_SITE_EFM_TOOLBAR;
|
|
|
|
else
|
|
|
|
cfdata->site = E_GADCON_SITE_UNKNOWN;
|
|
|
|
_fill_data(cfdata);
|
2010-04-09 12:38:28 -07:00
|
|
|
return cfdata;
|
|
|
|
}
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
static void
|
|
|
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
2010-04-09 12:38:28 -07:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
Eina_List *l;
|
|
|
|
E_Config_Gadcon_Client *cgc;
|
2010-04-09 12:38:28 -07:00
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
EINA_LIST_FOREACH(cfdata->gc->cf->clients, l, cgc)
|
2010-04-10 17:20:38 -07:00
|
|
|
{
|
|
|
|
CFGadget *gad;
|
2010-04-09 12:38:28 -07:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
if (!cgc->id) continue;
|
|
|
|
gad = E_NEW(CFGadget, 1);
|
|
|
|
gad->name = eina_stringshare_add(cgc->name);
|
|
|
|
gad->id = eina_stringshare_add(cgc->id);
|
|
|
|
eina_hash_direct_add(cfdata->gadget_hash, gad->id, gad);
|
|
|
|
}
|
2006-05-05 05:20:14 -07:00
|
|
|
}
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
static void
|
|
|
|
_free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
2006-05-19 17:03:20 -07:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
E_Gadcon *gc;
|
|
|
|
|
2010-04-10 17:31:13 -07:00
|
|
|
if (cfdata->hdl) ecore_event_handler_del(cfdata->hdl);
|
|
|
|
cfdata->hdl = NULL;
|
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
if (cfdata->load_timer) ecore_timer_del(cfdata->load_timer);
|
|
|
|
cfdata->load_timer = NULL;
|
2006-05-19 17:03:20 -07:00
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
if (cfdata->gadget_hash)
|
2010-04-10 17:20:38 -07:00
|
|
|
{
|
|
|
|
eina_hash_foreach(cfdata->gadget_hash, _free_gadgets, NULL);
|
|
|
|
eina_hash_free(cfdata->gadget_hash);
|
|
|
|
}
|
|
|
|
cfdata->gadget_hash = NULL;
|
2008-01-04 01:18:42 -08:00
|
|
|
|
|
|
|
if (!(gc = cfd->data)) return;
|
|
|
|
gc->config_dialog = NULL;
|
2006-05-19 17:03:20 -07:00
|
|
|
}
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_free_gadgets(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__)
|
2006-05-19 17:03:20 -07:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
CFGadget *gadget;
|
2006-05-19 17:03:20 -07:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
if (!(gadget = data)) return EINA_FALSE;
|
|
|
|
if (gadget->name) eina_stringshare_del(gadget->name);
|
|
|
|
if (gadget->id) eina_stringshare_del(gadget->id);
|
|
|
|
E_FREE(gadget);
|
2010-04-09 12:38:28 -07:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
return EINA_TRUE;
|
2010-04-09 12:38:28 -07:00
|
|
|
}
|
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
static Evas_Object *
|
2012-06-20 23:19:43 -07:00
|
|
|
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2010-04-09 12:38:28 -07:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
Evas_Object *ot;
|
|
|
|
int mw;
|
2010-04-09 12:38:28 -07:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
ot = e_widget_table_add(evas, 0);
|
|
|
|
|
|
|
|
cfdata->o_list = e_widget_ilist_add(evas, 24, 24, NULL);
|
|
|
|
e_widget_ilist_multi_select_set(cfdata->o_list, EINA_TRUE);
|
|
|
|
e_widget_size_min_get(cfdata->o_list, &mw, NULL);
|
|
|
|
if (mw < (200 * e_scale)) mw = (200 * e_scale);
|
|
|
|
e_widget_size_min_set(cfdata->o_list, mw, (160 * e_scale));
|
|
|
|
e_widget_table_object_append(ot, cfdata->o_list, 0, 0, 2, 1, 1, 1, 1, 1);
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
cfdata->o_add =
|
2010-04-10 17:20:38 -07:00
|
|
|
e_widget_button_add(evas, _("Add Gadget"), NULL, _cb_add, cfdata, NULL);
|
|
|
|
e_widget_disabled_set(cfdata->o_add, EINA_TRUE);
|
|
|
|
e_widget_table_object_append(ot, cfdata->o_add, 0, 1, 1, 1, 1, 1, 1, 0);
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
cfdata->o_del =
|
2010-04-10 17:20:38 -07:00
|
|
|
e_widget_button_add(evas, _("Remove Gadget"), NULL, _cb_del, cfdata, NULL);
|
|
|
|
e_widget_disabled_set(cfdata->o_del, EINA_TRUE);
|
|
|
|
e_widget_table_object_append(ot, cfdata->o_del, 1, 1, 1, 1, 1, 1, 1, 0);
|
|
|
|
|
2010-04-10 17:31:13 -07:00
|
|
|
if (cfdata->hdl) ecore_event_handler_del(cfdata->hdl);
|
2012-06-20 23:19:43 -07:00
|
|
|
cfdata->hdl = ecore_event_handler_add(E_EVENT_MODULE_UPDATE,
|
2010-04-10 17:31:13 -07:00
|
|
|
_cb_mod_update, cfdata);
|
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
if (cfdata->load_timer) ecore_timer_del(cfdata->load_timer);
|
|
|
|
cfdata->load_timer = ecore_timer_add(0.2, _cb_load_timer, cfdata);
|
|
|
|
|
|
|
|
e_dialog_resizable_set(cfd->dia, EINA_TRUE);
|
|
|
|
e_win_centered_set(cfd->dia->win, EINA_TRUE);
|
|
|
|
|
|
|
|
return ot;
|
2010-04-09 12:38:28 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_cb_load_timer(void *data)
|
2010-04-09 12:38:28 -07:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
2010-04-09 12:38:28 -07:00
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
if (!(cfdata = data)) return ECORE_CALLBACK_RENEW;
|
2010-04-10 17:20:38 -07:00
|
|
|
_fill_list(cfdata);
|
|
|
|
cfdata->load_timer = NULL;
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2006-06-22 11:47:19 -07:00
|
|
|
}
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
static void
|
|
|
|
_fill_list(E_Config_Dialog_Data *cfdata)
|
2006-06-22 11:47:19 -07:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
Eina_List *l;
|
|
|
|
E_Gadcon_Client_Class *gcc;
|
2006-06-22 11:47:19 -07:00
|
|
|
Evas *evas;
|
2010-04-10 17:20:38 -07:00
|
|
|
int mw;
|
2006-11-27 07:52:45 -08:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
evas = evas_object_evas_get(cfdata->o_list);
|
2006-11-27 07:52:45 -08:00
|
|
|
evas_event_freeze(evas);
|
|
|
|
edje_freeze();
|
2010-04-10 17:20:38 -07:00
|
|
|
e_widget_ilist_freeze(cfdata->o_list);
|
|
|
|
e_widget_ilist_clear(cfdata->o_list);
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
EINA_LIST_FOREACH(e_gadcon_provider_list(), l, gcc)
|
2010-04-08 18:07:40 -07:00
|
|
|
{
|
2010-08-18 13:31:35 -07:00
|
|
|
Evas_Object *icon = NULL, *end;
|
|
|
|
const char *lbl = NULL;
|
2010-04-08 18:07:40 -07:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
if ((gcc->func.is_site) && (!gcc->func.is_site(cfdata->site)))
|
2010-04-09 12:38:28 -07:00
|
|
|
continue;
|
2010-04-10 17:20:38 -07:00
|
|
|
if (gcc->func.label) lbl = gcc->func.label(gcc);
|
|
|
|
if (!lbl) lbl = gcc->name;
|
|
|
|
if (gcc->func.icon) icon = gcc->func.icon(gcc, evas);
|
|
|
|
|
|
|
|
end = edje_object_add(evas);
|
2012-06-20 23:19:43 -07:00
|
|
|
if (!e_theme_edje_object_set(end, "base/theme/widgets",
|
|
|
|
"e/widgets/ilist/toggle_end"))
|
2010-04-10 17:20:38 -07:00
|
|
|
{
|
|
|
|
evas_object_del(end);
|
|
|
|
end = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_search_hash(cfdata, gcc->name))
|
|
|
|
{
|
|
|
|
if (end) edje_object_signal_emit(end, "e,state,checked", "e");
|
|
|
|
}
|
2012-06-20 23:19:43 -07:00
|
|
|
else
|
2010-04-10 17:20:38 -07:00
|
|
|
{
|
|
|
|
if (end) edje_object_signal_emit(end, "e,state,unchecked", "e");
|
|
|
|
}
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
e_widget_ilist_append_full(cfdata->o_list, icon, end, lbl,
|
2010-04-10 17:20:38 -07:00
|
|
|
_cb_list_selected, cfdata, gcc->name);
|
2006-05-19 17:03:20 -07:00
|
|
|
}
|
2010-04-10 17:20:38 -07:00
|
|
|
|
|
|
|
e_widget_ilist_go(cfdata->o_list);
|
|
|
|
e_widget_size_min_get(cfdata->o_list, &mw, NULL);
|
|
|
|
if (mw < (200 * e_scale)) mw = (200 * e_scale);
|
|
|
|
e_widget_size_min_set(cfdata->o_list, mw, (160 * e_scale));
|
|
|
|
e_widget_ilist_thaw(cfdata->o_list);
|
2006-11-27 07:52:45 -08:00
|
|
|
edje_thaw();
|
|
|
|
evas_event_thaw(evas);
|
2006-06-22 11:47:19 -07:00
|
|
|
}
|
2006-05-19 17:03:20 -07:00
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
static void
|
|
|
|
_cb_list_selected(void *data)
|
2006-06-22 11:47:19 -07:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
const E_Ilist_Item *it;
|
|
|
|
Eina_List *l;
|
|
|
|
unsigned int loaded = 0;
|
2006-07-21 08:19:54 -07:00
|
|
|
|
2008-01-04 01:18:42 -08:00
|
|
|
if (!(cfdata = data)) return;
|
2012-06-20 23:19:43 -07:00
|
|
|
EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->o_list), l, it)
|
2006-05-19 17:03:20 -07:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
const char *name;
|
2010-04-09 12:38:28 -07:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
if ((!it->selected) || (it->header)) continue;
|
|
|
|
if (!(name = e_widget_ilist_item_value_get(it))) continue;
|
|
|
|
if (_search_hash(cfdata, name)) loaded++;
|
2006-05-19 17:03:20 -07:00
|
|
|
}
|
2010-04-10 17:20:38 -07:00
|
|
|
e_widget_disabled_set(cfdata->o_add, EINA_FALSE);
|
|
|
|
e_widget_disabled_set(cfdata->o_del, !loaded);
|
2006-05-19 17:03:20 -07:00
|
|
|
}
|
2007-07-15 19:15:37 -07:00
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
static void
|
|
|
|
_cb_add(void *data, void *data2 __UNUSED__)
|
2007-07-15 19:15:37 -07:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
const E_Ilist_Item *it;
|
|
|
|
Eina_List *l;
|
2011-01-15 17:22:41 -08:00
|
|
|
int update = 0;
|
2008-01-04 01:18:42 -08:00
|
|
|
|
|
|
|
if (!(cfdata = data)) return;
|
2012-06-20 23:19:43 -07:00
|
|
|
EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->o_list), l, it)
|
2008-01-04 01:18:42 -08:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
E_Config_Gadcon_Client *cgc;
|
|
|
|
CFGadget *gad;
|
|
|
|
Evas_Object *end;
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
if ((!it->selected) || (it->header)) continue;
|
|
|
|
if (!(name = e_widget_ilist_item_value_get(it))) continue;
|
|
|
|
if (!(cgc = e_gadcon_client_config_new(cfdata->gc, name))) continue;
|
2010-05-01 06:26:32 -07:00
|
|
|
if ((end = e_widget_ilist_item_end_get(it)))
|
2010-04-10 17:20:38 -07:00
|
|
|
edje_object_signal_emit(end, "e,state,checked", "e");
|
|
|
|
|
|
|
|
gad = E_NEW(CFGadget, 1);
|
|
|
|
gad->name = eina_stringshare_add(cgc->name);
|
|
|
|
gad->id = eina_stringshare_add(cgc->id);
|
|
|
|
eina_hash_direct_add(cfdata->gadget_hash, gad->id, gad);
|
|
|
|
|
2008-01-04 01:18:42 -08:00
|
|
|
update = 1;
|
|
|
|
}
|
2012-06-20 23:19:43 -07:00
|
|
|
if (update)
|
2008-01-04 01:18:42 -08:00
|
|
|
{
|
|
|
|
e_gadcon_unpopulate(cfdata->gc);
|
2012-06-20 23:47:26 -07:00
|
|
|
if (!e_gadcon_populate(cfdata->gc))
|
|
|
|
_cb_del(cfdata, NULL);
|
2008-01-04 01:18:42 -08:00
|
|
|
e_config_save_queue();
|
|
|
|
}
|
2010-04-10 17:20:38 -07:00
|
|
|
e_widget_ilist_unselect(cfdata->o_list);
|
|
|
|
e_widget_disabled_set(cfdata->o_add, EINA_TRUE);
|
|
|
|
e_widget_disabled_set(cfdata->o_del, EINA_TRUE);
|
2008-01-04 01:18:42 -08:00
|
|
|
}
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
static void
|
|
|
|
_cb_del(void *data, void *data2 __UNUSED__)
|
2008-01-04 01:18:42 -08:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
const E_Ilist_Item *it;
|
|
|
|
Eina_List *l;
|
2011-01-15 17:22:41 -08:00
|
|
|
int update = 0;
|
2008-01-04 01:18:42 -08:00
|
|
|
|
|
|
|
if (!(cfdata = data)) return;
|
2012-06-20 23:19:43 -07:00
|
|
|
EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->o_list), l, it)
|
2008-01-04 01:18:42 -08:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
E_Config_Gadcon_Client *cgc;
|
|
|
|
Eina_List *cl;
|
|
|
|
Evas_Object *end;
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
if ((!it->selected) || (it->header)) continue;
|
|
|
|
if (!(name = e_widget_ilist_item_value_get(it))) continue;
|
|
|
|
|
|
|
|
/* remove from actual gadget container */
|
2012-06-20 23:19:43 -07:00
|
|
|
EINA_LIST_FOREACH(cfdata->gc->cf->clients, cl, cgc)
|
2008-01-04 01:18:42 -08:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
CFGadget *gad;
|
|
|
|
|
2008-01-04 01:18:42 -08:00
|
|
|
if (strcmp(name, cgc->name)) continue;
|
2010-04-10 17:20:38 -07:00
|
|
|
|
|
|
|
/* remove from gadget hash if exists */
|
2010-05-01 06:26:32 -07:00
|
|
|
if ((gad = eina_hash_find(cfdata->gadget_hash, cgc->id)))
|
2010-04-10 17:20:38 -07:00
|
|
|
{
|
|
|
|
eina_hash_del(cfdata->gadget_hash, gad->id, gad);
|
|
|
|
if (gad->name) eina_stringshare_del(gad->name);
|
|
|
|
if (gad->id) eina_stringshare_del(gad->id);
|
|
|
|
E_FREE(gad);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set ilist end toggle if we don't have any more in the hash */
|
|
|
|
if (!_search_hash(cfdata, name))
|
|
|
|
{
|
2010-05-01 06:26:32 -07:00
|
|
|
if ((end = e_widget_ilist_item_end_get(it)))
|
2010-04-10 17:20:38 -07:00
|
|
|
edje_object_signal_emit(end, "e,state,unchecked", "e");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove from gadget container */
|
2008-01-04 01:18:42 -08:00
|
|
|
e_gadcon_client_config_del(cfdata->gc->cf, cgc);
|
2010-04-10 17:20:38 -07:00
|
|
|
|
2008-01-04 01:18:42 -08:00
|
|
|
update = 1;
|
2010-04-10 17:20:38 -07:00
|
|
|
break;
|
2008-01-04 01:18:42 -08:00
|
|
|
}
|
|
|
|
}
|
2012-06-20 23:19:43 -07:00
|
|
|
if (update)
|
2008-01-04 01:18:42 -08:00
|
|
|
{
|
|
|
|
e_gadcon_unpopulate(cfdata->gc);
|
|
|
|
e_gadcon_populate(cfdata->gc);
|
|
|
|
e_config_save_queue();
|
|
|
|
}
|
2010-04-10 17:20:38 -07:00
|
|
|
e_widget_ilist_unselect(cfdata->o_list);
|
|
|
|
e_widget_disabled_set(cfdata->o_add, EINA_TRUE);
|
|
|
|
e_widget_disabled_set(cfdata->o_del, EINA_TRUE);
|
2008-01-04 01:18:42 -08:00
|
|
|
}
|
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
static CFGadget *
|
|
|
|
_search_hash(E_Config_Dialog_Data *cfdata, const char *name)
|
2008-01-11 16:27:41 -08:00
|
|
|
{
|
2010-04-10 17:20:38 -07:00
|
|
|
Eina_Iterator *it;
|
|
|
|
CFGadget *gad, *ret = NULL;
|
2010-04-09 12:38:28 -07:00
|
|
|
|
2010-04-10 17:20:38 -07:00
|
|
|
if (!name) return NULL;
|
2012-06-20 23:19:43 -07:00
|
|
|
if (!(it = eina_hash_iterator_data_new(cfdata->gadget_hash)))
|
2010-04-10 17:20:38 -07:00
|
|
|
return NULL;
|
2012-06-20 23:19:43 -07:00
|
|
|
EINA_ITERATOR_FOREACH(it, gad)
|
2010-04-10 17:20:38 -07:00
|
|
|
{
|
|
|
|
if ((gad->name) && (!strcmp(gad->name, name)))
|
|
|
|
{
|
|
|
|
ret = gad;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eina_iterator_free(it);
|
|
|
|
return ret;
|
2008-01-11 16:27:41 -08:00
|
|
|
}
|
2010-04-10 17:31:13 -07:00
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_cb_mod_update(void *data, int type, void *event __UNUSED__)
|
2010-04-10 17:31:13 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
if (type != E_EVENT_MODULE_UPDATE) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
if (!(cfdata = data)) return ECORE_CALLBACK_PASS_ON;
|
2010-04-10 17:31:13 -07:00
|
|
|
_fill_list(cfdata);
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2010-04-10 17:31:13 -07:00
|
|
|
}
|