forked from enlightenment/enlightenment
module_config: Ported to the new e_configure
This commit is contained in:
parent
f8519aa6cd
commit
350222c77a
|
@ -27,7 +27,7 @@ EINTERN void
|
|||
e_configure_init(void)
|
||||
{
|
||||
e_configure_registry_category_add("extensions", 90, _("Extensions"), NULL, "preferences-extensions");
|
||||
e_configure_registry_item_add("extensions/modules", 10, _("Modules"), NULL, "preferences-plugin", e_int_config_modules);
|
||||
//e_configure_registry_item_add("extensions/modules", 10, _("Modules"), NULL, "preferences-plugin", e_int_config_modules);
|
||||
e_configure_registry_category_add("appearance", 10, _("Look"), NULL,
|
||||
"preferences-look");
|
||||
e_configure_registry_item_add("appearance/comp", 120, _("Compositor"), NULL, "preferences-composite", e_int_config_comp);
|
||||
|
@ -273,7 +273,7 @@ e_configure_registry_exists(const char *path)
|
|||
static void
|
||||
_e_configure_menu_module_item_cb(void *data __UNUSED__, E_Menu *m EINA_UNUSED, E_Menu_Item *mi __UNUSED__)
|
||||
{
|
||||
e_int_config_modules(NULL, NULL);
|
||||
/* e_int_config_modules(NULL, NULL); */ //need to find a way to port the menus etc. at the end ...
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -10,6 +10,7 @@ struct _CFModule
|
|||
const char *short_name, *name, *comment;
|
||||
const char *icon, *orig_path;
|
||||
E_Module *module;
|
||||
Elm_Object_Item *item;
|
||||
Evas_Object *end;
|
||||
int idx;
|
||||
Eina_Bool enabled : 1;
|
||||
|
@ -18,23 +19,14 @@ struct _CFModule
|
|||
struct _CFType
|
||||
{
|
||||
const char *key, *name, *icon;
|
||||
Elm_Object_Item *gindex;
|
||||
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;
|
||||
struct
|
||||
{
|
||||
Eina_List *loaded, *unloaded;
|
||||
} selected;
|
||||
};
|
||||
|
||||
struct _CFTypes
|
||||
|
@ -48,14 +40,14 @@ static const CFTypes _types[] =
|
|||
{
|
||||
#define _CFT(k, n, i) \
|
||||
{sizeof(k) - 1, k, n, i}
|
||||
_CFT("utils", N_("Utilities"), "modules-utils"),
|
||||
_CFT("system", N_("System"), "modules-system"),
|
||||
_CFT("utils", N_("Utilities"), "application-utilities"),
|
||||
_CFT("system", N_("System"), "application-system"),
|
||||
_CFT("look", N_("Look"), "modules-look"),
|
||||
_CFT("files", N_("Files"), "modules-files"),
|
||||
_CFT("files", N_("Files"), "folder"),
|
||||
_CFT("launcher", N_("Launcher"), "modules-launcher"),
|
||||
_CFT("core", N_("Core"), "modules-core"),
|
||||
_CFT("core", N_("Core"), "e-logo"),
|
||||
_CFT("mobile", N_("Mobile"), "modules-mobile"),
|
||||
_CFT("settings", N_("Settings"), "modules-settings"),
|
||||
_CFT("settings", N_("Settings"), "application-desktop"),
|
||||
#undef _CFT
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
|
@ -63,46 +55,33 @@ static const CFTypes _types[] =
|
|||
/* local function protos */
|
||||
static void _cftype_free(CFType *cft);
|
||||
|
||||
static void _widget_list_selection_changed(void *data, Evas_Object *obj __UNUSED__);
|
||||
|
||||
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 _fill_cat_list(E_Config_Dialog_Data *cfdata);
|
||||
static void _module_end_state_apply(CFModule *cfm);
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
static void _btn_cb_unload(void *data, void *data2);
|
||||
static void _btn_cb_load(void *data, void *data2);
|
||||
static Evas_Object *e_int_config_modules_create_cb(const char *path, const char *part, Evas_Object *parent, void *cbdata, void *data);
|
||||
static Eina_Bool e_int_config_modules_apply_cb(const char *path, const char *part, Evas_Object *obj, void *cbdata, void *data);
|
||||
static void* e_int_config_modules_data_cb(const char *path, const char *part, void *data);
|
||||
static void e_int_config_modules_free_cb(const char *path, const char *part, void *cbdata, void *data);
|
||||
|
||||
EAPI E_Config_Dialog *
|
||||
e_int_config_modules(Evas_Object *parent EINA_UNUSED, const char *params __UNUSED__)
|
||||
EAPI void
|
||||
e_int_config_modules_init(void)
|
||||
{
|
||||
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;
|
||||
|
||||
cfd = e_config_dialog_new(NULL, _("Module Settings"),
|
||||
"E", "extensions/modules",
|
||||
"preferences-plugin", 0, v, NULL);
|
||||
return cfd;
|
||||
e_config_panel_item_add("modules", "preferences-plugin", _("Modules100"), "Extensions to extend Enlightenments functions", 0, "modules");
|
||||
e_config_panel_part_add("modules", "modules", _("Modules"), _("Mark a module as loaded to load them on startup"), 1, "extensions",
|
||||
e_int_config_modules_create_cb, e_int_config_modules_apply_cb, e_int_config_modules_data_cb, e_int_config_modules_free_cb, NULL);
|
||||
}
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd __UNUSED__)
|
||||
static void*
|
||||
e_int_config_modules_data_cb(const char *path, const char *part, void *data)
|
||||
{
|
||||
Eina_Hash *types_hash;
|
||||
Eina_List *mods;
|
||||
|
@ -133,16 +112,14 @@ _create_data(E_Config_Dialog *cfd __UNUSED__)
|
|||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||
e_int_config_modules_free_cb(const char *path, const char *part, void *cbdata, void *data)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata = cbdata;
|
||||
CFType *cft;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -167,200 +144,6 @@ _module_update(E_Config_Dialog_Data *cfdata, int type __UNUSED__, E_Event_Module
|
|||
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 = evas_object_evas_get(cfd->dia->win);
|
||||
|
||||
of = e_widget_table_add(e_win_evas_win_get(evas), 0);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
elm_win_center(cfd->dia->win, 1, 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
|
||||
{
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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 *
|
||||
_module_new(const char *short_name, const Efreet_Desktop *desk)
|
||||
{
|
||||
|
@ -552,96 +335,249 @@ _types_list_sort(const void *data1, const void *data2)
|
|||
}
|
||||
|
||||
static void
|
||||
_widget_list_selection_changed(void *data, Evas_Object *obj __UNUSED__)
|
||||
_toolbar_selected_cb(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata = data;
|
||||
const Eina_List *l;
|
||||
const E_Ilist_Item *it;
|
||||
CFModule *cfm = NULL;
|
||||
const char *description;
|
||||
CFType *cft = data;
|
||||
elm_genlist_item_bring_in(cft->gindex, ELM_GENLIST_ITEM_SCROLLTO_TOP);
|
||||
}
|
||||
|
||||
cfdata->selected.loaded = eina_list_free(cfdata->selected.loaded);
|
||||
cfdata->selected.unloaded = eina_list_free(cfdata->selected.unloaded);
|
||||
static void
|
||||
toolbar_item(Evas_Object *obj, CFType *cft)
|
||||
{
|
||||
Elm_Object_Item *it;
|
||||
Evas_Object *ic;
|
||||
|
||||
EINA_LIST_FOREACH(e_widget_ilist_selected_items_get(cfdata->l_modules), l, it)
|
||||
it = elm_toolbar_item_append(obj, cft->icon, cft->name, _toolbar_selected_cb, cft);
|
||||
}
|
||||
|
||||
static char *
|
||||
_group_item_label_get(void *data, Evas_Object *obj, const char *part)
|
||||
{
|
||||
CFType *cft = data;
|
||||
|
||||
return strdup(cft->name);
|
||||
}
|
||||
|
||||
static char *
|
||||
_item_label_get(void *data, Evas_Object *obj, const char *part)
|
||||
{
|
||||
CFModule *cfm = data;
|
||||
|
||||
return strdup(cfm->name);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_item_gen(CFModule *cfm, Evas_Object *icon)
|
||||
{
|
||||
if (!cfm->icon)
|
||||
return EINA_FALSE;
|
||||
if (!elm_icon_standard_set(icon, cfm->icon))
|
||||
{
|
||||
cfm = e_widget_ilist_item_data_get(it);
|
||||
|
||||
if (cfm->enabled)
|
||||
if (cfm->orig_path)
|
||||
{
|
||||
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);
|
||||
char *dir = ecore_file_dir_get(cfm->orig_path);
|
||||
char buf[PATH_MAX];
|
||||
snprintf(buf, sizeof(buf), "%s/%s.edj", dir, cfm->icon);
|
||||
if (!ecore_file_exists(buf))
|
||||
{
|
||||
free(dir);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else
|
||||
elm_image_file_set(icon, buf, "icon");
|
||||
free(dir);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
return EINA_FALSE;
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Evas_Object*
|
||||
_item_content_get(void *data, Evas_Object *obj, const char *part)
|
||||
{
|
||||
CFModule *cfm = data;
|
||||
Evas_Object *icon;
|
||||
|
||||
if (!strcmp(part, "elm.swallow.icon"))
|
||||
{
|
||||
if (!cfm->icon)
|
||||
icon = NULL;
|
||||
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);
|
||||
icon = elm_icon_add(obj);
|
||||
_item_gen(cfm, icon);
|
||||
evas_object_size_hint_min_set(icon, 64, 64);
|
||||
}
|
||||
}
|
||||
|
||||
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.");
|
||||
{
|
||||
cfm->end = icon = elm_check_add(obj);
|
||||
elm_object_style_set(icon, "led");
|
||||
evas_object_freeze_events_set(icon, EINA_TRUE);
|
||||
elm_check_state_set(icon, cfm->enabled);
|
||||
//TODO delete hook!!
|
||||
}
|
||||
|
||||
e_widget_textblock_markup_set(cfdata->o_desc, description);
|
||||
return icon;
|
||||
}
|
||||
|
||||
static void
|
||||
_btn_cb_unload(void *data, void *data2 __UNUSED__)
|
||||
_list_selected(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata = data;
|
||||
CFModule *cfm;
|
||||
CFModule *mod = elm_object_item_data_get(event);
|
||||
Evas_Object *w = data;
|
||||
Evas_Object *load = evas_object_data_get(w, "__load_btn");
|
||||
Evas_Object *unload = evas_object_data_get(w, "__unload_btn");
|
||||
|
||||
EINA_LIST_FREE(cfdata->selected.loaded, cfm)
|
||||
{
|
||||
if (!cfm->module)
|
||||
cfm->module = e_module_find(cfm->short_name);
|
||||
|
||||
if (cfm->module)
|
||||
{
|
||||
e_module_disable(cfm->module);
|
||||
cfm->enabled = e_module_enabled_get(cfm->module);
|
||||
}
|
||||
|
||||
_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);
|
||||
elm_object_disabled_set(load, mod->enabled);
|
||||
elm_object_disabled_set(unload, !mod->enabled);
|
||||
}
|
||||
|
||||
static void
|
||||
_btn_cb_load(void *data, void *data2 __UNUSED__)
|
||||
_load_cb(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata = data;
|
||||
CFModule *cfm;
|
||||
Evas_Object *list = data;
|
||||
Evas_Object *w = elm_object_parent_widget_get(list);
|
||||
Evas_Object *unload = evas_object_data_get(w, "__unload_btn");
|
||||
Elm_Object_Item *sel = elm_genlist_selected_item_get(list);
|
||||
CFModule *cfm = elm_object_item_data_get(sel);
|
||||
|
||||
EINA_LIST_FREE(cfdata->selected.unloaded, cfm)
|
||||
if (!cfm->module)
|
||||
cfm->module = e_module_find(cfm->short_name);
|
||||
if (!cfm->module)
|
||||
cfm->module = e_module_new(cfm->short_name);
|
||||
if (cfm->module)
|
||||
{
|
||||
if (!cfm->module)
|
||||
cfm->module = e_module_find(cfm->short_name);
|
||||
if (!cfm->module)
|
||||
cfm->module = e_module_new(cfm->short_name);
|
||||
|
||||
if (cfm->module)
|
||||
{
|
||||
e_module_enable(cfm->module);
|
||||
cfm->enabled = e_module_enabled_get(cfm->module);
|
||||
}
|
||||
|
||||
_module_end_state_apply(cfm);
|
||||
cfdata->selected.loaded = eina_list_append(cfdata->selected.loaded, cfm);
|
||||
e_module_enable(cfm->module);
|
||||
cfm->enabled = e_module_enabled_get(cfm->module);
|
||||
}
|
||||
|
||||
e_widget_disabled_set(cfdata->b_load, 1);
|
||||
e_widget_disabled_set(cfdata->b_unload, 0);
|
||||
elm_check_state_set(cfm->end, EINA_TRUE);
|
||||
elm_object_disabled_set(unload, EINA_FALSE);
|
||||
elm_object_disabled_set(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_unload_cb(void *data, Evas_Object *obj, void *event)
|
||||
{
|
||||
Evas_Object *list = data;
|
||||
Evas_Object *w = elm_object_parent_widget_get(list);
|
||||
Evas_Object *load = evas_object_data_get(w, "__load_btn");
|
||||
Elm_Object_Item *sel = elm_genlist_selected_item_get(list);
|
||||
CFModule *cfm = elm_object_item_data_get(sel);
|
||||
|
||||
if (!cfm->module)
|
||||
cfm->module = e_module_find(cfm->short_name);
|
||||
|
||||
if (cfm->module)
|
||||
{
|
||||
e_module_disable(cfm->module);
|
||||
cfm->enabled = e_module_enabled_get(cfm->module);
|
||||
}
|
||||
|
||||
elm_check_state_set(cfm->end, EINA_FALSE);
|
||||
elm_object_disabled_set(load, EINA_FALSE);
|
||||
elm_object_disabled_set(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
static Evas_Object*
|
||||
e_int_config_modules_create_cb(const char *path, const char *part, Evas_Object *parent, void *cbdata, void *data)
|
||||
{
|
||||
Evas_Object *bx, *bx2, *tb, *list, *lb, *load, *unload;
|
||||
|
||||
bx = elm_box_add(parent);
|
||||
evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_show(bx);
|
||||
|
||||
tb = elm_toolbar_add(parent);
|
||||
elm_toolbar_icon_order_lookup_set(tb, ELM_ICON_LOOKUP_THEME_FDO);
|
||||
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
|
||||
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, 0.0);
|
||||
elm_box_pack_end(bx, tb);
|
||||
evas_object_show(tb);
|
||||
|
||||
list = elm_genlist_add(parent);
|
||||
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_box_pack_end(bx, list);
|
||||
evas_object_show(list);
|
||||
|
||||
bx2 = elm_box_add(parent);
|
||||
evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, 0.0);
|
||||
evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
|
||||
elm_box_horizontal_set(bx2, EINA_TRUE);
|
||||
elm_box_pack_end(bx, bx2);
|
||||
evas_object_show(bx2);
|
||||
|
||||
load = elm_button_add(parent);
|
||||
elm_object_text_set(load, _("load"));
|
||||
elm_object_disabled_set(load, EINA_TRUE);
|
||||
evas_object_data_set(bx, "__load_btn", load);
|
||||
evas_object_smart_callback_add(load, "clicked", _load_cb, list);
|
||||
evas_object_size_hint_align_set(load, EVAS_HINT_FILL, 0.0);
|
||||
evas_object_size_hint_weight_set(load, EVAS_HINT_EXPAND, 0.0);
|
||||
elm_box_pack_end(bx2, load);
|
||||
evas_object_show(load);
|
||||
|
||||
unload = elm_button_add(parent);
|
||||
elm_object_text_set(unload, _("unload"));
|
||||
elm_object_disabled_set(unload, EINA_TRUE);
|
||||
evas_object_data_set(bx, "__unload_btn", unload);
|
||||
evas_object_smart_callback_add(unload, "clicked", _unload_cb, list);
|
||||
evas_object_size_hint_align_set(unload, EVAS_HINT_FILL, 0.0);
|
||||
evas_object_size_hint_weight_set(unload, EVAS_HINT_EXPAND, 0.0);
|
||||
elm_box_pack_end(bx2, unload);
|
||||
evas_object_show(unload);
|
||||
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata = cbdata;
|
||||
Eina_List *node;
|
||||
CFType *cft;
|
||||
Elm_Genlist_Item_Class *itc_group, *itc_item;
|
||||
|
||||
/*groupindex class*/
|
||||
itc_group = elm_genlist_item_class_new();
|
||||
itc_group->item_style = "group_index";
|
||||
itc_group->func.text_get = _group_item_label_get;
|
||||
itc_group->func.content_get = NULL;
|
||||
itc_group->func.state_get = NULL;
|
||||
itc_group->func.del = NULL;
|
||||
|
||||
itc_item = elm_genlist_item_class_new();
|
||||
itc_item->item_style = "default";
|
||||
itc_item->func.text_get = _item_label_get;
|
||||
itc_item->func.content_get = _item_content_get;
|
||||
itc_item->func.state_get = NULL;
|
||||
itc_item->func.del = NULL;
|
||||
|
||||
EINA_LIST_FOREACH(cfdata->types, node, cft)
|
||||
{
|
||||
CFModule *cfm;
|
||||
Eina_List *l_module;
|
||||
Elm_Object_Item *item, *it;
|
||||
|
||||
cft->gindex = item = elm_genlist_item_append(list, itc_group, cft, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
|
||||
elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
|
||||
|
||||
toolbar_item(tb, cft);
|
||||
|
||||
EINA_LIST_FOREACH(cft->modules, l_module, cfm)
|
||||
{
|
||||
cfm->item = it = elm_genlist_item_append(list, itc_item, cfm,
|
||||
item, ELM_GENLIST_ITEM_NONE,
|
||||
_list_selected, bx);
|
||||
elm_genlist_item_tooltip_text_set(it, cfm->comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bx;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
e_int_config_modules_apply_cb(const char *path, const char *part, Evas_Object *obj, void *cbdata, void *data)
|
||||
{
|
||||
//Nothing to do here we save things directly
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#define E_INT_CONFIG_MODULES_H
|
||||
|
||||
EAPI E_Config_Dialog *e_int_config_modules(Evas_Object *parent, const char *params);
|
||||
EAPI void e_int_config_modules_init(void);
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -1671,7 +1671,7 @@ _e_main_efreet_paths_init(void)
|
|||
static Eina_Bool
|
||||
_e_main_modules_load_after(void *d EINA_UNUSED, int type EINA_UNUSED, void *ev EINA_UNUSED)
|
||||
{
|
||||
e_int_config_modules(NULL, NULL);
|
||||
e_config_panel_show("modules");
|
||||
E_FREE_FUNC(mod_init_end, ecore_event_handler_del);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue