enlightenment/src/bin/e_int_config_modules.c

648 lines
18 KiB
C
Raw Normal View History

#include "e.h"
#include <assert.h>
typedef struct _CFModule CFModule;
2012-06-28 03:14:25 -07:00
typedef struct _CFType CFType;
typedef struct _CFTypes CFTypes;
struct _CFModule
{
2012-06-28 03:14:25 -07:00
const char *short_name, *name, *comment;
const char *icon, *orig_path;
E_Module *module;
Evas_Object *end;
2012-06-28 03:14:25 -07:00
int idx;
Eina_Bool enabled : 1;
};
struct _CFType
{
const char *key, *name, *icon;
2012-06-28 03:14:25 -07:00
Eina_Hash *modules_hash; /* just used before constructing list */
Eina_List *modules; /* sorted and ready to be used */
};
struct _E_Config_Dialog_Data
{
Evas *evas;
Evas_Object *l_modules;
Evas_Object *o_toolbar;
Evas_Object *b_load, *b_unload;
Evas_Object *o_desc;
Eina_List *types;
Ecore_Event_Handler *module_update;
2012-06-20 23:19:43 -07:00
struct
2012-06-28 03:14:25 -07:00
{
Eina_List *loaded, *unloaded;
2012-06-28 03:14:25 -07:00
} selected;
};
struct _CFTypes
{
2012-06-28 03:14:25 -07:00
size_t key_len;
const char *key, *name, *icon;
};
/* pre defined types (used to specify icon and i18n name) */
static const CFTypes _types[] =
{
2012-06-28 03:14:25 -07:00
#define _CFT(k, n, i) \
{sizeof(k) - 1, k, n, i}
2012-06-28 03:14:25 -07:00
_CFT("utils", N_("Utilities"), "modules-utils"),
_CFT("system", N_("System"), "modules-system"),
_CFT("look", N_("Look"), "modules-look"),
_CFT("files", N_("Files"), "modules-files"),
_CFT("launcher", N_("Launcher"), "modules-launcher"),
_CFT("core", N_("Core"), "modules-core"),
_CFT("mobile", N_("Mobile"), "modules-mobile"),
_CFT("settings", N_("Settings"), "modules-settings"),
#undef _CFT
2012-06-28 03:14:25 -07:00
{0, NULL, NULL, NULL}
};
/* local function protos */
2012-06-28 03:14:25 -07:00
static void _cftype_free(CFType *cft);
2012-06-28 03:14:25 -07:00
static void _widget_list_selection_changed(void *data, Evas_Object *obj __UNUSED__);
2012-06-28 03:14:25 -07:00
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);
2012-06-28 03:14:25 -07:00
static void _fill_cat_list(E_Config_Dialog_Data *cfdata);
static void _module_end_state_apply(CFModule *cfm);
2012-06-28 03:14:25 -07:00
static void _toolbar_select_cb(void *data, void *data2);
static CFType *_cftype_find(E_Config_Dialog_Data *cfdata, const char *key, const char *name, const char *icon);
2012-06-28 03:14:25 -07:00
static CFType *_cftype_new(const char *key, const char *name, const char *icon);
static void _load_module(E_Module_Desktop *md, Eina_Hash *types_hash);
2012-06-28 03:14:25 -07:00
static Eina_Bool _types_list_create_foreach_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata);
static int _types_list_sort(const void *data1, const void *data2);
2012-06-28 03:14:25 -07:00
static void _btn_cb_unload(void *data, void *data2);
static void _btn_cb_load(void *data, void *data2);
2006-01-07 02:39:46 -08:00
EAPI E_Config_Dialog *
compositor rewrite / charlie-foxtrot situation huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once. * compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine. ** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes ** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects ** protocol-specific window management and compositor functionality is now kept exclusively in backend files ** e_pixmap api provides generic client finding and rendering api ** screen/xinerama screens are now provided directly by compositor on startup and re-set on change ** e_comp_render_update finally replaced with eina_tiler ** wayland compositor no longer creates X windows ** compositor e_layout removed entirely * e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra * e_manager is just for screensaver and keybind stuff now, possibly remove later? * e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor ** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed. *** do NOT set interceptors on a client's comp_object. seriously. * startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor * ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get * e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas * deskmirror is (more) broken for now * illume is totally fucked * Ecore_X_Window replaced with Ecore_Window in most cases * edge binding XWindows replaced with regular canvas objects * some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result comp files and descriptions: e_comp.c - overall compositor functions, rendering/update loop, shape cutting e_comp_x.c - X window management and compositor functionality e_comp_wl.c - Wayland surface management and compositor functionality e_comp_canvas.c - general compositor canvas functions and utilities e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems additional authors: ivan.briano@intel.com feature: new compositor removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
e_int_config_modules(E_Comp *c, const char *params __UNUSED__)
{
E_Config_Dialog *cfd = NULL;
E_Config_Dialog_View *v = NULL;
if (e_config_dialog_find("E", "extensions/modules")) return NULL;
v = E_NEW(E_Config_Dialog_View, 1);
v->create_cfdata = _create_data;
v->free_cfdata = _free_data;
v->basic.create_widgets = _basic_create;
compositor rewrite / charlie-foxtrot situation huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once. * compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine. ** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes ** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects ** protocol-specific window management and compositor functionality is now kept exclusively in backend files ** e_pixmap api provides generic client finding and rendering api ** screen/xinerama screens are now provided directly by compositor on startup and re-set on change ** e_comp_render_update finally replaced with eina_tiler ** wayland compositor no longer creates X windows ** compositor e_layout removed entirely * e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra * e_manager is just for screensaver and keybind stuff now, possibly remove later? * e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor ** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed. *** do NOT set interceptors on a client's comp_object. seriously. * startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor * ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get * e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas * deskmirror is (more) broken for now * illume is totally fucked * Ecore_X_Window replaced with Ecore_Window in most cases * edge binding XWindows replaced with regular canvas objects * some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result comp files and descriptions: e_comp.c - overall compositor functions, rendering/update loop, shape cutting e_comp_x.c - X window management and compositor functionality e_comp_wl.c - Wayland surface management and compositor functionality e_comp_canvas.c - general compositor canvas functions and utilities e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems additional authors: ivan.briano@intel.com feature: new compositor removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
cfd = e_config_dialog_new(c, _("Module Settings"),
"E", "extensions/modules",
2012-06-28 03:14:25 -07:00
"preferences-plugin", 0, v, NULL);
return cfd;
}
static void *
_create_data(E_Config_Dialog *cfd __UNUSED__)
{
Eina_Hash *types_hash;
Eina_List *mods;
E_Module_Desktop *md;
E_Config_Dialog_Data *cfdata;
cfdata = E_NEW(E_Config_Dialog_Data, 1);
types_hash = eina_hash_string_superfast_new(NULL);
mods = e_module_desktop_list();
if (!mods)
{
2012-06-28 03:14:25 -07:00
eina_hash_free(types_hash);
return cfdata;
}
EINA_LIST_FREE(mods, md)
{
_load_module(md, types_hash);
e_module_desktop_free(md);
}
eina_hash_foreach(types_hash, _types_list_create_foreach_cb, cfdata);
eina_hash_free(types_hash);
cfdata->types = eina_list_sort(cfdata->types, -1, _types_list_sort);
return cfdata;
}
static void
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
CFType *cft;
2012-06-28 03:14:25 -07:00
EINA_LIST_FREE(cfdata->types, cft)
_cftype_free(cft);
eina_list_free(cfdata->selected.loaded);
eina_list_free(cfdata->selected.unloaded);
if (cfdata->module_update) ecore_event_handler_del(cfdata->module_update);
free(cfdata);
}
static Eina_Bool
_module_update(E_Config_Dialog_Data *cfdata, int type __UNUSED__, E_Event_Module_Update *ev)
{
CFType *cft;
Eina_List *l, *ll;
CFModule *cfm;
EINA_LIST_FOREACH(cfdata->types, l, cft)
{
EINA_LIST_FOREACH(cft->modules, ll, cfm)
if (cfm->short_name == ev->name)
{
cfm->enabled = ev->enabled;
_module_end_state_apply(cfm);
return ECORE_CALLBACK_RENEW;
}
}
return ECORE_CALLBACK_RENEW;
}
static Evas_Object *
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
{
Evas_Coord mw, mh;
Evas_Object *of, *ol;
e_dialog_resizable_set(cfd->dia, 1);
cfdata->evas = e_win_evas_get(cfd->dia->win);
of = e_widget_table_add(evas, 0);
2010-03-02 20:42:22 -08:00
cfdata->o_toolbar = e_widget_toolbar_add(evas, 32 * e_scale, 32 * e_scale);
e_widget_toolbar_scrollable_set(cfdata->o_toolbar, 1);
_fill_cat_list(cfdata);
e_widget_table_object_append(of, cfdata->o_toolbar, 0, 0, 2, 1, 1, 1, 1, 0);
2010-03-02 20:42:22 -08:00
cfdata->l_modules = e_widget_ilist_add(evas, 32 * e_scale, 32 * e_scale, NULL);
e_widget_ilist_multi_select_set(cfdata->l_modules, EINA_TRUE);
e_widget_ilist_go(cfdata->l_modules);
e_widget_size_min_get(cfdata->l_modules, &mw, &mh);
if (mw < (200 * e_scale)) mw = 200 * e_scale;
if (mh < (100 * e_scale)) mh = 100 * e_scale;
e_widget_size_min_set(cfdata->l_modules, mw, mh);
2012-06-20 23:19:43 -07:00
e_widget_on_change_hook_set(cfdata->l_modules,
_widget_list_selection_changed, cfdata);
e_widget_table_object_append(of, cfdata->l_modules, 0, 1, 2, 1, 1, 1, 1, 1);
ol = e_widget_button_add(evas, _("Load"), NULL, _btn_cb_load, cfdata, NULL);
cfdata->b_load = ol;
e_widget_disabled_set(ol, 1);
e_widget_table_object_append(of, ol, 0, 2, 1, 1, 1, 1, 1, 0);
ol = e_widget_button_add(evas, _("Unload"), NULL, _btn_cb_unload, cfdata, NULL);
cfdata->b_unload = ol;
e_widget_disabled_set(ol, 1);
e_widget_table_object_append(of, ol, 1, 2, 1, 1, 1, 1, 1, 0);
ol = e_widget_textblock_add(evas);
e_widget_size_min_set(ol, (200 * e_scale), 40 * e_scale);
cfdata->o_desc = ol;
e_widget_table_object_append(of, ol, 0, 3, 2, 1, 1, 0, 1, 0);
e_dialog_resizable_set(cfd->dia, 1);
e_util_win_auto_resize_fill(cfd->dia->win);
e_win_centered_set(cfd->dia->win, 1);
e_widget_focus_set(cfdata->o_toolbar, 1);
e_widget_toolbar_item_select(cfdata->o_toolbar, 0);
cfdata->module_update = ecore_event_handler_add(E_EVENT_MODULE_UPDATE, (Ecore_Event_Handler_Cb)_module_update, cfdata);
return of;
}
static void
_fill_cat_list(E_Config_Dialog_Data *cfdata)
{
Evas_Coord w, h;
Evas_Object *icon;
CFType *cft;
const CFTypes *itr;
evas_event_freeze(cfdata->evas);
edje_freeze();
for (itr = _types; itr->key_len > 0; itr++)
{
cft = _cftype_find(cfdata, itr->key, itr->name, itr->icon);
if (!cft)
{
WRN("CFT MISSING!!! key(%s) name(%s) icon(%s)", itr->key, itr->name, itr->icon);
continue;
}
icon = e_icon_add(cfdata->evas);
if (icon)
{
if (!e_util_icon_theme_set(icon, cft->icon))
{
evas_object_del(icon);
icon = NULL;
}
}
e_widget_toolbar_item_append(cfdata->o_toolbar, icon, _(cft->name),
_toolbar_select_cb, cfdata, cft);
}
e_widget_size_min_get(cfdata->o_toolbar, &w, &h);
e_widget_size_min_set(cfdata->o_toolbar, w, h);
edje_thaw();
evas_event_thaw(cfdata->evas);
}
static void
_list_item_append(E_Config_Dialog_Data *cfdata, CFModule *cfm)
{
Evas_Object *icon, *end;
if (!cfm->icon)
icon = NULL;
else
{
2012-06-28 03:14:25 -07:00
icon = e_icon_add(cfdata->evas);
if (icon)
{
if (!e_util_icon_theme_set(icon, cfm->icon))
{
if (cfm->orig_path)
{
char *dir = ecore_file_dir_get(cfm->orig_path);
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/%s.edj", dir, cfm->icon);
free(dir);
e_icon_file_edje_set(icon, buf, "icon");
}
else
{
evas_object_del(icon);
icon = NULL;
}
}
}
}
end = edje_object_add(cfdata->evas);
if (end)
{
2012-06-28 03:14:25 -07:00
if (e_theme_edje_object_set(end, "base/theme/widgets",
"e/widgets/ilist/toggle_end"))
{
cfm->end = end;
_module_end_state_apply(cfm);
}
else
{
EINA_LOG_ERR("your theme is missing 'e/widgets/ilist/toggle_end'!");
evas_object_del(end);
end = NULL;
}
}
2012-06-20 23:19:43 -07:00
e_widget_ilist_append_full(cfdata->l_modules, icon, end,
cfm->name, NULL, cfm, NULL);
}
static void
_toolbar_select_cb(void *data, void *data2)
{
CFType *cft, *cft_cat;
E_Config_Dialog_Data *cfdata;
Eina_List *l_type;
Evas_Coord w, h;
cfdata = data;
cft_cat = data2;
if (!cfdata || !cft_cat) return;
eina_list_free(cfdata->selected.loaded);
eina_list_free(cfdata->selected.unloaded);
cfdata->selected.loaded = NULL;
cfdata->selected.unloaded = NULL;
e_widget_disabled_set(cfdata->b_load, EINA_TRUE);
e_widget_disabled_set(cfdata->b_unload, EINA_TRUE);
e_widget_textblock_markup_set(cfdata->o_desc, _("No modules selected."));
evas_event_freeze(evas_object_evas_get(cfdata->l_modules));
edje_freeze();
e_widget_ilist_freeze(cfdata->l_modules);
e_widget_ilist_clear(cfdata->l_modules);
EINA_LIST_FOREACH(cfdata->types, l_type, cft)
{
CFModule *cfm;
Eina_List *l_module;
if (strcmp(cft->key, cft_cat->key))
continue;
EINA_LIST_FOREACH(cft->modules, l_module, cfm)
_list_item_append(cfdata, cfm);
}
e_widget_ilist_go(cfdata->l_modules);
e_widget_size_min_get(cfdata->l_modules, &w, &h);
e_widget_size_min_set(cfdata->l_modules, w, h);
e_widget_ilist_thaw(cfdata->l_modules);
edje_thaw();
evas_event_thaw(evas_object_evas_get(cfdata->l_modules));
}
static CFModule *
2010-03-13 13:56:25 -08:00
_module_new(const char *short_name, const Efreet_Desktop *desk)
{
CFModule *cfm = E_NEW(CFModule, 1);
if (!cfm) return NULL;
cfm->short_name = eina_stringshare_add(short_name);
if (desk->name)
cfm->name = eina_stringshare_add(desk->name);
else
cfm->name = eina_stringshare_ref(cfm->short_name);
cfm->icon = eina_stringshare_add(desk->icon);
cfm->comment = eina_stringshare_add(desk->comment);
cfm->orig_path = eina_stringshare_add(desk->orig_path);
return cfm;
}
static void
_module_free(CFModule *cfm)
{
eina_stringshare_del(cfm->short_name);
eina_stringshare_del(cfm->name);
eina_stringshare_del(cfm->icon);
eina_stringshare_del(cfm->comment);
eina_stringshare_del(cfm->orig_path);
E_FREE(cfm);
}
static void
_module_end_state_apply(CFModule *cfm)
{
const char *sig;
if (!cfm->end) return;
sig = cfm->enabled ? "e,state,checked" : "e,state,unchecked";
edje_object_signal_emit(cfm->end, sig, "e");
}
static CFType *
_cftype_find(E_Config_Dialog_Data *cfdata, const char *key, const char *name, const char *icon)
{
CFType *cft;
Eina_List *l;
EINA_LIST_FOREACH(cfdata->types, l, cft)
if ((!strcmp(cft->key, key)) && (!strcmp(cft->name, name)) && (!strcmp(cft->icon, icon))) return cft;
return NULL;
}
static CFType *
_cftype_new(const char *key, const char *name, const char *icon)
{
CFType *cft = E_NEW(CFType, 1);
if (!cft) return NULL;
cft->key = eina_stringshare_add(key);
cft->name = eina_stringshare_add(name);
cft->icon = eina_stringshare_add(icon);
//INF("CFT NEW: key(%s) name(%s) icon(%s)", key, name, icon);
return cft;
}
static void
_cftype_free(CFType *cft)
{
CFModule *cfm;
assert(cft->modules_hash == NULL); // must do it before calling this function
EINA_LIST_FREE(cft->modules, cfm)
_module_free(cfm);
eina_stringshare_del(cft->key);
eina_stringshare_del(cft->name);
eina_stringshare_del(cft->icon);
E_FREE(cft);
}
static CFType *
_cftype_new_from_key(const char *key)
{
const CFTypes *itr;
char name[1024], icon[1024];
size_t key_len;
if (!key) return NULL;
key_len = strlen(key);
for (itr = _types; itr->key_len > 0; itr++)
{
2012-06-28 03:14:25 -07:00
if (key_len != itr->key_len) continue;
if (strcmp(itr->key, key) != 0) continue;
return _cftype_new(itr->key, itr->name, itr->icon);
}
if ((key_len + 1) >= sizeof(name)) return NULL;
if ((key_len + sizeof("enlightenment/")) >= sizeof(icon)) return NULL;
memcpy(name, key, key_len + 1);
name[0] = toupper(name[0]);
snprintf(icon, sizeof(icon), "enlightenment/%s", key);
return _cftype_new(key, name, icon);
}
static void
_load_module(E_Module_Desktop *md, Eina_Hash *types_hash)
{
CFType *cft;
CFModule *cfm;
const char *type, *mod;
Eina_Bool new_type = EINA_FALSE;
mod = ecore_file_file_get(md->dir);
if (md->desktop->x)
type = eina_hash_find(md->desktop->x, "X-Enlightenment-ModuleType");
else
type = NULL;
if (!type) type = "utils"; // todo: warn?
cft = eina_hash_find(types_hash, type);
if (cft)
{
new_type = EINA_FALSE;
if ((cft->modules_hash) &&
(eina_hash_find(cft->modules_hash, mod)))
return;
}
else
{
cft = _cftype_new_from_key(type);
if (cft) new_type = EINA_TRUE;
else return;
}
2012-06-28 03:14:25 -07:00
cfm = _module_new(mod, md->desktop);
if (!cfm)
{
if (new_type) _cftype_free(cft);
return;
}
2012-06-28 03:14:25 -07:00
if (!cft->modules_hash)
cft->modules_hash = eina_hash_string_superfast_new(NULL);
eina_hash_direct_add(cft->modules_hash, cfm->short_name, cfm);
cft->modules = eina_list_append(cft->modules, cfm);
cfm->module = e_module_find(mod);
if (cfm->module)
cfm->enabled = e_module_enabled_get(cfm->module);
else
cfm->enabled = 0;
2012-06-28 03:14:25 -07:00
if (new_type)
eina_hash_direct_add(types_hash, cft->key, cft);
}
static int
_modules_list_sort(const void *data1, const void *data2)
{
const CFModule *m1 = data1, *m2 = data2;
return strcmp(m1->name, m2->name);
}
static Eina_Bool
_types_list_create_foreach_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
{
E_Config_Dialog_Data *cfdata = fdata;
CFType *cft = data;
// otherwise it should not be here
assert(cft->modules);
assert(cft->modules_hash);
eina_hash_free(cft->modules_hash);
cft->modules_hash = NULL;
cft->modules = eina_list_sort(cft->modules, -1, _modules_list_sort);
cfdata->types = eina_list_append(cfdata->types, cft);
// TODO be paranoid about list append failure, otherwise leaks memory
return EINA_TRUE;
}
static int
_types_list_sort(const void *data1, const void *data2)
{
const CFType *t1 = data1, *t2 = data2;
return strcmp(t1->name, t2->name);
}
static void
_widget_list_selection_changed(void *data, Evas_Object *obj __UNUSED__)
{
E_Config_Dialog_Data *cfdata = data;
const Eina_List *l;
const E_Ilist_Item *it;
CFModule *cfm = NULL;
const char *description;
cfdata->selected.loaded = eina_list_free(cfdata->selected.loaded);
cfdata->selected.unloaded = eina_list_free(cfdata->selected.unloaded);
EINA_LIST_FOREACH(e_widget_ilist_selected_items_get(cfdata->l_modules), l, it)
{
2012-06-28 03:14:25 -07:00
cfm = e_widget_ilist_item_data_get(it);
if (cfm->enabled)
{
cfdata->selected.loaded =
eina_list_append(cfdata->selected.loaded, cfm);
e_widget_disabled_set(cfdata->b_unload, 0);
e_widget_disabled_set(cfdata->b_load, 1);
2012-06-28 03:14:25 -07:00
}
else
{
cfdata->selected.unloaded =
eina_list_append(cfdata->selected.unloaded, cfm);
e_widget_disabled_set(cfdata->b_load, 0);
e_widget_disabled_set(cfdata->b_unload, 1);
2012-06-28 03:14:25 -07:00
}
}
if ((cfm) && (eina_list_count(cfdata->selected.loaded) + eina_list_count(cfdata->selected.unloaded) == 1))
description = cfm->comment;
else if (eina_list_count(cfdata->selected.loaded) + eina_list_count(cfdata->selected.unloaded) > 1)
description = _("More than one module selected.");
else
description = _("No modules selected.");
e_widget_textblock_markup_set(cfdata->o_desc, description);
}
static void
_btn_cb_unload(void *data, void *data2 __UNUSED__)
{
E_Config_Dialog_Data *cfdata = data;
CFModule *cfm;
EINA_LIST_FREE(cfdata->selected.loaded, cfm)
{
2012-06-28 03:14:25 -07:00
if (!cfm->module)
cfm->module = e_module_find(cfm->short_name);
2012-06-28 03:14:25 -07:00
if (cfm->module)
{
e_module_disable(cfm->module);
cfm->enabled = e_module_enabled_get(cfm->module);
}
2012-06-28 03:14:25 -07:00
_module_end_state_apply(cfm);
cfdata->selected.unloaded = eina_list_append(cfdata->selected.unloaded, cfm);
}
e_widget_disabled_set(cfdata->b_unload, 1);
e_widget_disabled_set(cfdata->b_load, 0);
}
static void
_btn_cb_load(void *data, void *data2 __UNUSED__)
{
E_Config_Dialog_Data *cfdata = data;
CFModule *cfm;
EINA_LIST_FREE(cfdata->selected.unloaded, cfm)
{
2012-06-28 03:14:25 -07:00
if (!cfm->module)
cfm->module = e_module_find(cfm->short_name);
if (!cfm->module)
cfm->module = e_module_new(cfm->short_name);
2012-06-28 03:14:25 -07:00
if (cfm->module)
{
e_module_enable(cfm->module);
cfm->enabled = e_module_enabled_get(cfm->module);
}
2012-06-28 03:14:25 -07:00
_module_end_state_apply(cfm);
cfdata->selected.loaded = eina_list_append(cfdata->selected.loaded, cfm);
}
e_widget_disabled_set(cfdata->b_load, 1);
e_widget_disabled_set(cfdata->b_unload, 0);
}
2012-06-28 03:14:25 -07:00