forked from enlightenment/enlightenment
make some more config vars have a gui.
SVN revision: 66597
This commit is contained in:
parent
61b0f13cb0
commit
accf9be609
|
@ -286,10 +286,10 @@ struct _E_Config
|
|||
|
||||
struct {
|
||||
struct {
|
||||
int icon_size;
|
||||
int icon_size; // GUI
|
||||
} main, secondary, extra;
|
||||
double timeout;
|
||||
unsigned char do_input;
|
||||
double timeout; // GUI
|
||||
unsigned char do_input; // GUI
|
||||
Eina_List *actions;
|
||||
} syscon;
|
||||
|
||||
|
|
|
@ -21,7 +21,9 @@ pkg_LTLIBRARIES = module.la
|
|||
module_la_SOURCES = e_mod_main.c \
|
||||
e_mod_main.h \
|
||||
e_syscon.c \
|
||||
e_syscon.h
|
||||
e_syscon.h \
|
||||
e_int_config_syscon.c \
|
||||
e_int_config_syscon.h
|
||||
|
||||
module_la_LIBADD = @e_libs@ @dlopen_libs@
|
||||
module_la_LDFLAGS = -module -avoid-version
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
#include "e.h"
|
||||
|
||||
static void *_create_data(E_Config_Dialog *cfd);
|
||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||
static int _basic_check_changed(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);
|
||||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
struct {
|
||||
int icon_size;
|
||||
} main, secondary, extra;
|
||||
double timeout;
|
||||
int do_input;
|
||||
Eina_List *actions;
|
||||
|
||||
struct {
|
||||
Eina_List *disable_iconified;
|
||||
Eina_List *disable_scroll_animate;
|
||||
Eina_List *disable_warp;
|
||||
Evas_Object *min_w, *min_h;
|
||||
} gui;
|
||||
};
|
||||
|
||||
E_Config_Dialog *
|
||||
e_int_config_syscon(E_Container *con, const char *params __UNUSED__)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
E_Config_Dialog_View *v;
|
||||
|
||||
if (e_config_dialog_find("E", "windows/conf_syscon")) return NULL;
|
||||
v = E_NEW(E_Config_Dialog_View, 1);
|
||||
|
||||
v->create_cfdata = _create_data;
|
||||
v->free_cfdata = _free_data;
|
||||
v->basic.apply_cfdata = _basic_apply;
|
||||
v->basic.create_widgets = _basic_create;
|
||||
v->basic.check_changed = _basic_check_changed;
|
||||
|
||||
cfd = e_config_dialog_new(con, _("Syscon Settings"),
|
||||
"E", "windows/conf_syscon",
|
||||
"preferences-syscon", 0, v, NULL);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
static void
|
||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Config_Syscon_Action *sa, *sa2;
|
||||
|
||||
cfdata->main.icon_size = e_config->syscon.main.icon_size;
|
||||
cfdata->secondary.icon_size = e_config->syscon.secondary.icon_size;
|
||||
cfdata->extra.icon_size = e_config->syscon.extra.icon_size;
|
||||
cfdata->timeout = e_config->syscon.timeout;
|
||||
cfdata->do_input = e_config->syscon.do_input;
|
||||
EINA_LIST_FOREACH(e_config->syscon.actions, l, sa)
|
||||
{
|
||||
sa2 = E_NEW(E_Config_Syscon_Action, 1);
|
||||
if (sa->action) sa2->action = strdup(sa->action);
|
||||
if (sa->params) sa2->params = strdup(sa->params);
|
||||
if (sa->button) sa2->button = strdup(sa->button);
|
||||
if (sa->icon) sa2->icon = strdup(sa->icon);
|
||||
sa2->is_main = sa->is_main;
|
||||
cfdata->actions = eina_list_append(cfdata->actions, sa2);
|
||||
}
|
||||
}
|
||||
|
||||
static void *
|
||||
_create_data(E_Config_Dialog *cfd __UNUSED__)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata;
|
||||
|
||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||
if (!cfdata) return NULL;
|
||||
_fill_data(cfdata);
|
||||
return cfdata;
|
||||
}
|
||||
|
||||
static void
|
||||
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
E_Config_Syscon_Action *sa;
|
||||
|
||||
EINA_LIST_FREE(cfdata->actions, sa)
|
||||
{
|
||||
if (sa->action) free((char *)sa->action);
|
||||
if (sa->params) free((char *)sa->params);
|
||||
if (sa->button) free((char *)sa->button);
|
||||
if (sa->icon) free((char *)sa->icon);
|
||||
E_FREE(sa);
|
||||
}
|
||||
E_FREE(cfdata);
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Eina_List *l;
|
||||
E_Config_Syscon_Action *sa, *sa2;
|
||||
|
||||
e_config->syscon.main.icon_size = cfdata->main.icon_size;
|
||||
e_config->syscon.secondary.icon_size = cfdata->secondary.icon_size;
|
||||
e_config->syscon.extra.icon_size = cfdata->extra.icon_size;
|
||||
e_config->syscon.timeout = cfdata->timeout;
|
||||
e_config->syscon.do_input = cfdata->do_input;
|
||||
EINA_LIST_FOREACH(cfdata->actions, l, sa)
|
||||
{
|
||||
sa2 = E_NEW(E_Config_Syscon_Action, 1);
|
||||
if (sa->action) sa2->action = eina_stringshare_add(sa->action);
|
||||
if (sa->params) sa2->params = eina_stringshare_add(sa->params);
|
||||
if (sa->button) sa2->button = eina_stringshare_add(sa->button);
|
||||
if (sa->icon) sa2->icon = eina_stringshare_add(sa->icon);
|
||||
sa2->is_main = sa->is_main;
|
||||
e_config->syscon.actions = eina_list_append(e_config->syscon.actions, sa2);
|
||||
}
|
||||
e_config_save_queue();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
_basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata __UNUSED__)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||
{
|
||||
Evas_Object *otb, *ol, *ob;
|
||||
|
||||
otb = e_widget_toolbook_add(evas, (48 * e_scale), (48 * e_scale));
|
||||
|
||||
ol = e_widget_list_add(evas, 0, 0);
|
||||
ob = e_widget_label_add(evas, _("Main"));
|
||||
e_widget_list_object_append(ol, ob, 1, 0, 0.0);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 16.0, 256.0, 1.0, 0,
|
||||
NULL, &(cfdata->main.icon_size), 100);
|
||||
e_widget_list_object_append(ol, ob, 1, 0, 0.0);
|
||||
ob = e_widget_label_add(evas, _("Secondary"));
|
||||
e_widget_list_object_append(ol, ob, 1, 0, 0.0);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 16.0, 256.0, 1.0, 0,
|
||||
NULL, &(cfdata->secondary.icon_size), 100);
|
||||
e_widget_list_object_append(ol, ob, 1, 0, 0.0);
|
||||
ob = e_widget_label_add(evas, _("Extra"));
|
||||
e_widget_list_object_append(ol, ob, 1, 0, 0.0);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.0f"), 16.0, 256.0, 1.0, 0,
|
||||
NULL, &(cfdata->extra.icon_size), 100);
|
||||
e_widget_list_object_append(ol, ob, 1, 0, 0.0);
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Icon Sizes"), ol,
|
||||
0, 0, 1, 0, 0.5, 0.0);
|
||||
|
||||
ol = e_widget_list_add(evas, 0, 0);
|
||||
ob = e_widget_check_add(evas, _("Do default action after timeout"), &(cfdata->do_input));
|
||||
e_widget_list_object_append(ol, ob, 1, 0, 0.0);
|
||||
ob = e_widget_label_add(evas, _("Timeout"));
|
||||
e_widget_list_object_append(ol, ob, 1, 0, 0.0);
|
||||
ob = e_widget_slider_add(evas, 1, 0, _("%1.1f"), 0.0, 60.0, 0.1, 0,
|
||||
&(cfdata->timeout), NULL, 100);
|
||||
e_widget_list_object_append(ol, ob, 1, 0, 0.0);
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Default Action"), ol,
|
||||
0, 0, 1, 0, 0.5, 0.0);
|
||||
|
||||
e_widget_toolbook_page_show(otb, 0);
|
||||
|
||||
return otb;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
#ifdef E_TYPEDEFS
|
||||
#else
|
||||
#ifndef E_INT_CONFIG_SYSCON_H
|
||||
#define E_INT_CONFIG_SYSCON_H
|
||||
|
||||
E_Config_Dialog *e_int_config_syscon(E_Container *con, const char *params __UNUSED__);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -33,6 +33,8 @@ e_modapi_init(E_Module *m)
|
|||
}
|
||||
maug = e_int_menus_menu_augmentation_add_sorted
|
||||
("main/8", _("System"), _e_mod_menu_add, NULL, NULL, NULL);
|
||||
e_configure_registry_category_add("advanced", 80, _("Advanced"), NULL, "preferences-advanced");
|
||||
e_configure_registry_item_add("advanced/syscon", 10, _("Syscon"), NULL, "preferences-syscon", e_int_config_syscon);
|
||||
e_module_delayed_set(m, 1);
|
||||
return m;
|
||||
}
|
||||
|
@ -40,6 +42,10 @@ e_modapi_init(E_Module *m)
|
|||
EAPI int
|
||||
e_modapi_shutdown(E_Module *m __UNUSED__)
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
while ((cfd = e_config_dialog_get("E", "advanced/conf_syscon"))) e_object_del(E_OBJECT(cfd));
|
||||
e_configure_registry_item_del("advanced/syscon");
|
||||
e_configure_registry_category_del("advanced");
|
||||
/* remove module-supplied menu additions */
|
||||
if (maug)
|
||||
{
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
|
||||
#define E_TYPEDEFS 1
|
||||
#include "e_syscon.h"
|
||||
#include "e_int_config_syscon.h"
|
||||
|
||||
#undef E_TYPEDEFS
|
||||
#include "e_syscon.h"
|
||||
#include "e_int_config_syscon.h"
|
||||
|
||||
EAPI extern E_Module_Api e_modapi;
|
||||
|
||||
|
|
Loading…
Reference in New Issue