forked from enlightenment/enlightenment
parent
11b56e5d17
commit
71040b0586
|
@ -123,7 +123,8 @@ e_int_config_window_display.h \
|
||||||
e_int_config_background.h \
|
e_int_config_background.h \
|
||||||
e_int_config_menus.h \
|
e_int_config_menus.h \
|
||||||
e_deskpreview.h \
|
e_deskpreview.h \
|
||||||
e_exebuf.h
|
e_exebuf.h \
|
||||||
|
e_int_config_modules.h
|
||||||
|
|
||||||
enlightenment_src = \
|
enlightenment_src = \
|
||||||
e_user.c \
|
e_user.c \
|
||||||
|
@ -228,6 +229,7 @@ e_int_config_background.c \
|
||||||
e_int_config_menus.c \
|
e_int_config_menus.c \
|
||||||
e_deskpreview.c \
|
e_deskpreview.c \
|
||||||
e_exebuf.c \
|
e_exebuf.c \
|
||||||
|
e_int_config_modules.c \
|
||||||
$(ENLIGHTENMENTHEADERS)
|
$(ENLIGHTENMENTHEADERS)
|
||||||
|
|
||||||
enlightenment_SOURCES = \
|
enlightenment_SOURCES = \
|
||||||
|
|
|
@ -526,15 +526,15 @@ e_config_init(void)
|
||||||
{
|
{
|
||||||
E_Config_Module *em;
|
E_Config_Module *em;
|
||||||
|
|
||||||
em = E_NEW(E_Config_Module, 1);
|
/*em = E_NEW(E_Config_Module, 1);
|
||||||
em->name = evas_stringshare_add("start");
|
em->name = evas_stringshare_add("start");
|
||||||
em->enabled = 1;
|
em->enabled = 1;
|
||||||
e_config->modules = evas_list_append(e_config->modules, em);
|
e_config->modules = evas_list_append(e_config->modules, em);*/
|
||||||
em = E_NEW(E_Config_Module, 1);
|
em = E_NEW(E_Config_Module, 1);
|
||||||
em->name = evas_stringshare_add("ibar");
|
em->name = evas_stringshare_add("ibar");
|
||||||
em->enabled = 1;
|
em->enabled = 1;
|
||||||
e_config->modules = evas_list_append(e_config->modules, em);
|
e_config->modules = evas_list_append(e_config->modules, em);
|
||||||
em = E_NEW(E_Config_Module, 1);
|
/* em = E_NEW(E_Config_Module, 1);
|
||||||
em->name = evas_stringshare_add("ibox");
|
em->name = evas_stringshare_add("ibox");
|
||||||
em->enabled = 0;
|
em->enabled = 0;
|
||||||
e_config->modules = evas_list_append(e_config->modules, em);
|
e_config->modules = evas_list_append(e_config->modules, em);
|
||||||
|
@ -565,7 +565,7 @@ e_config_init(void)
|
||||||
em = E_NEW(E_Config_Module, 1);
|
em = E_NEW(E_Config_Module, 1);
|
||||||
em->name = evas_stringshare_add("randr");
|
em->name = evas_stringshare_add("randr");
|
||||||
em->enabled = 1;
|
em->enabled = 1;
|
||||||
e_config->modules = evas_list_append(e_config->modules, em);
|
e_config->modules = evas_list_append(e_config->modules, em);*/
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
E_Font_Fallback* eff;
|
E_Font_Fallback* eff;
|
||||||
|
|
|
@ -32,6 +32,7 @@ e_config_dialog_new(E_Container *con, char *title, char *icon, int icon_size, E_
|
||||||
cfd->icon_size = icon_size;
|
cfd->icon_size = icon_size;
|
||||||
}
|
}
|
||||||
cfd->data = data;
|
cfd->data = data;
|
||||||
|
cfd->hide_buttons = 0;
|
||||||
|
|
||||||
_e_config_dialog_go(cfd, E_CONFIG_DIALOG_CFDATA_TYPE_BASIC);
|
_e_config_dialog_go(cfd, E_CONFIG_DIALOG_CFDATA_TYPE_BASIC);
|
||||||
|
|
||||||
|
@ -69,6 +70,7 @@ _e_config_dialog_go(E_Config_Dialog *cfd, E_Config_Dialog_CFData_Type type)
|
||||||
pdia = cfd->dia;
|
pdia = cfd->dia;
|
||||||
cfd->dia = e_dialog_new(cfd->con);
|
cfd->dia = e_dialog_new(cfd->con);
|
||||||
cfd->dia->data = cfd;
|
cfd->dia->data = cfd;
|
||||||
|
cfd->view_dirty=0;
|
||||||
e_object_del_attach_func_set(E_OBJECT(cfd->dia), _e_config_dialog_cb_dialog_del);
|
e_object_del_attach_func_set(E_OBJECT(cfd->dia), _e_config_dialog_cb_dialog_del);
|
||||||
e_dialog_title_set(cfd->dia, cfd->title);
|
e_dialog_title_set(cfd->dia, cfd->title);
|
||||||
if (cfd->icon) e_dialog_icon_set(cfd->dia, cfd->icon, cfd->icon_size);
|
if (cfd->icon) e_dialog_icon_set(cfd->dia, cfd->icon, cfd->icon_size);
|
||||||
|
@ -110,11 +112,15 @@ _e_config_dialog_go(E_Config_Dialog *cfd, E_Config_Dialog_CFData_Type type)
|
||||||
e_widget_on_change_hook_set(o, _e_config_dialog_cb_changed, cfd);
|
e_widget_on_change_hook_set(o, _e_config_dialog_cb_changed, cfd);
|
||||||
e_dialog_content_set(cfd->dia, o, mw, mh);
|
e_dialog_content_set(cfd->dia, o, mw, mh);
|
||||||
|
|
||||||
|
if(!cfd->hide_buttons)
|
||||||
|
{
|
||||||
e_dialog_button_add(cfd->dia, _("OK"), NULL, _e_config_dialog_cb_ok, cfd);
|
e_dialog_button_add(cfd->dia, _("OK"), NULL, _e_config_dialog_cb_ok, cfd);
|
||||||
e_dialog_button_add(cfd->dia, _("Apply"), NULL, _e_config_dialog_cb_apply, cfd);
|
e_dialog_button_add(cfd->dia, _("Apply"), NULL, _e_config_dialog_cb_apply, cfd);
|
||||||
e_dialog_button_add(cfd->dia, _("Cancel"), NULL, NULL, NULL);
|
//e_dialog_button_add(cfd->dia, _("Cancel"), NULL, NULL, NULL);
|
||||||
e_dialog_button_disable_num_set(cfd->dia, 0, 1);
|
e_dialog_button_disable_num_set(cfd->dia, 0, 1);
|
||||||
e_dialog_button_disable_num_set(cfd->dia, 1, 1);
|
e_dialog_button_disable_num_set(cfd->dia, 1, 1);
|
||||||
|
}
|
||||||
|
e_dialog_button_add(cfd->dia, _("Cancel"), NULL, NULL, NULL);
|
||||||
e_win_centered_set(cfd->dia->win, 1);
|
e_win_centered_set(cfd->dia->win, 1);
|
||||||
e_dialog_show(cfd->dia);
|
e_dialog_show(cfd->dia);
|
||||||
cfd->view_type = type;
|
cfd->view_type = type;
|
||||||
|
@ -164,8 +170,11 @@ _e_config_dialog_cb_apply(void *data, E_Dialog *dia)
|
||||||
ok = cfd->view.advanced.apply_cfdata(cfd, cfd->cfdata);
|
ok = cfd->view.advanced.apply_cfdata(cfd, cfd->cfdata);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
_e_config_dialog_go(cfd, cfd->view_type);
|
||||||
|
/*
|
||||||
e_dialog_button_disable_num_set(cfd->dia, 0, 1);
|
e_dialog_button_disable_num_set(cfd->dia, 0, 1);
|
||||||
e_dialog_button_disable_num_set(cfd->dia, 1, 1);
|
e_dialog_button_disable_num_set(cfd->dia, 1, 1);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,6 +202,14 @@ _e_config_dialog_cb_changed(void *data, Evas_Object *obj)
|
||||||
E_Config_Dialog *cfd;
|
E_Config_Dialog *cfd;
|
||||||
|
|
||||||
cfd = data;
|
cfd = data;
|
||||||
|
|
||||||
|
if(cfd->view_dirty)
|
||||||
|
{
|
||||||
|
_e_config_dialog_go(cfd, cfd->view_type);
|
||||||
|
}
|
||||||
|
else if(!cfd->hide_buttons)
|
||||||
|
{
|
||||||
e_dialog_button_disable_num_set(cfd->dia, 0, 0);
|
e_dialog_button_disable_num_set(cfd->dia, 0, 0);
|
||||||
e_dialog_button_disable_num_set(cfd->dia, 1, 0);
|
e_dialog_button_disable_num_set(cfd->dia, 1, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ struct _E_Config_Dialog
|
||||||
int icon_size;
|
int icon_size;
|
||||||
E_Dialog *dia;
|
E_Dialog *dia;
|
||||||
void *data;
|
void *data;
|
||||||
|
int view_dirty;
|
||||||
|
int hide_buttons;
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI E_Config_Dialog *e_config_dialog_new(E_Container *con, char *title, char *icon, int icon_size, E_Config_Dialog_View *view, void *data);
|
EAPI E_Config_Dialog *e_config_dialog_new(E_Container *con, char *title, char *icon, int icon_size, E_Config_Dialog_View *view, void *data);
|
||||||
|
|
|
@ -64,6 +64,7 @@ e_configure_show(E_Container *con)
|
||||||
e_configure_standard_item_add(eco, "enlightenment/e", _("Window Manipulation"), e_int_config_window_manipulation);
|
e_configure_standard_item_add(eco, "enlightenment/e", _("Window Manipulation"), e_int_config_window_manipulation);
|
||||||
e_configure_standard_item_add(eco, "enlightenment/e", _("Window Display"), e_int_config_window_display);
|
e_configure_standard_item_add(eco, "enlightenment/e", _("Window Display"), e_int_config_window_display);
|
||||||
//e_configure_standard_item_add(eco, "enlightenment/desktops", _("Background Settings"), e_int_config_background);
|
//e_configure_standard_item_add(eco, "enlightenment/desktops", _("Background Settings"), e_int_config_background);
|
||||||
|
e_configure_standard_item_add(eco, "enlightenment/modules", _("Module Settings"), e_int_config_modules);
|
||||||
|
|
||||||
/* FIXME: we should have a way for modules to hook in here and add their
|
/* FIXME: we should have a way for modules to hook in here and add their
|
||||||
* own entries
|
* own entries
|
||||||
|
|
|
@ -104,3 +104,4 @@
|
||||||
#include "e_int_config_menus.h"
|
#include "e_int_config_menus.h"
|
||||||
#include "e_deskpreview.h"
|
#include "e_deskpreview.h"
|
||||||
#include "e_exebuf.h"
|
#include "e_exebuf.h"
|
||||||
|
#include "e_int_config_modules.h"
|
||||||
|
|
|
@ -0,0 +1,439 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#include "e.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* PROTOTYPES - same all the time */
|
||||||
|
typedef struct _CFData CFData;
|
||||||
|
typedef struct _E_Cfg_Mod_Data E_Cfg_Mod_Data;
|
||||||
|
|
||||||
|
|
||||||
|
static void *_create_data(E_Config_Dialog *cfd);
|
||||||
|
static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||||
|
static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||||
|
static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||||
|
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
|
||||||
|
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
|
||||||
|
|
||||||
|
void _e_config_module_list(Evas_List **b,char *dir, int loaded);
|
||||||
|
void _e_config_mod_cb_standard(void *data);
|
||||||
|
void *_module_load(void *data, void *data2);
|
||||||
|
void *_module_unload(void *data, void *data2);
|
||||||
|
|
||||||
|
|
||||||
|
/* Actual config data we will be playing with whil the dialog is active */
|
||||||
|
struct _CFData
|
||||||
|
{
|
||||||
|
/*- BASIC -*/
|
||||||
|
int mode;
|
||||||
|
/*- ADVANCED -*/
|
||||||
|
Evas_List *mods, *umods;
|
||||||
|
E_Module *cur_mod;
|
||||||
|
Evas_Object *mod_name;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
Evas_Object *configure, *enable, *disable;
|
||||||
|
Evas_Object *load, *unload, *loaded, *unloaded;
|
||||||
|
} gui;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _E_Cfg_Mod_Data
|
||||||
|
{
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
int loaded;
|
||||||
|
E_Module *mod;
|
||||||
|
char *mod_name;// use this for unloaded mods
|
||||||
|
};
|
||||||
|
|
||||||
|
/* a nice easy setup function that does the dirty work */
|
||||||
|
E_Config_Dialog *
|
||||||
|
e_int_config_modules(E_Container *con)
|
||||||
|
{
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
E_Config_Dialog_View v;
|
||||||
|
|
||||||
|
/* methods */
|
||||||
|
v.create_cfdata = _create_data;
|
||||||
|
v.free_cfdata = _free_data;
|
||||||
|
v.basic.apply_cfdata = _basic_apply_data;
|
||||||
|
v.basic.create_widgets = _basic_create_widgets;
|
||||||
|
v.advanced.apply_cfdata = _advanced_apply_data;
|
||||||
|
v.advanced.create_widgets = _advanced_create_widgets;
|
||||||
|
/* create config diaolg for NULL object/data */
|
||||||
|
cfd = e_config_dialog_new(con, _("Modules Settings"), NULL, 0, &v, NULL);
|
||||||
|
return cfd;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME : redo this to setup list of loaded and unloaded modules in one pass (easy):)*/
|
||||||
|
void
|
||||||
|
_e_config_module_list(Evas_List **b,char *dir,int loaded)
|
||||||
|
{
|
||||||
|
Evas_List *l;
|
||||||
|
l = *b;
|
||||||
|
char fullpath[PATH_MAX];
|
||||||
|
if ((ecore_file_exists(dir)) && (ecore_file_is_dir(dir)))
|
||||||
|
{
|
||||||
|
Ecore_List *mods;
|
||||||
|
mods = ecore_file_ls(dir);
|
||||||
|
if (mods)
|
||||||
|
{
|
||||||
|
char *mod;
|
||||||
|
int i = 0;
|
||||||
|
while ((mod = ecore_list_next(mods)))
|
||||||
|
{
|
||||||
|
snprintf(fullpath, sizeof(fullpath), "%s/%s", dir, mod);
|
||||||
|
if (ecore_file_is_dir(fullpath))
|
||||||
|
{
|
||||||
|
E_Module *m;
|
||||||
|
m = e_module_find(mod);
|
||||||
|
|
||||||
|
if(!m && !loaded)
|
||||||
|
l = evas_list_append(l,mod);
|
||||||
|
else if(m && loaded)
|
||||||
|
l = evas_list_append(l,m);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*b=l;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
_e_config_mod_cb_standard(void *data)
|
||||||
|
{
|
||||||
|
E_Cfg_Mod_Data *d;
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
CFData *cfdata;
|
||||||
|
E_Module *m;
|
||||||
|
|
||||||
|
d = data;
|
||||||
|
cfd = d->cfd;
|
||||||
|
cfdata = cfd->cfdata;
|
||||||
|
|
||||||
|
if(cfd->view_type == E_CONFIG_DIALOG_CFDATA_TYPE_BASIC)
|
||||||
|
{
|
||||||
|
|
||||||
|
m = d->mod;
|
||||||
|
cfd->data=m;
|
||||||
|
|
||||||
|
if(m->enabled)
|
||||||
|
{
|
||||||
|
e_widget_disabled_set( cfdata->gui.enable, 1);
|
||||||
|
e_widget_disabled_set( cfdata->gui.disable, 0);
|
||||||
|
if(m->func.config)
|
||||||
|
e_widget_disabled_set( cfdata->gui.configure, 0);
|
||||||
|
else
|
||||||
|
e_widget_disabled_set( cfdata->gui.configure, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e_widget_disabled_set( cfdata->gui.configure, 1);
|
||||||
|
e_widget_disabled_set( cfdata->gui.enable, 0);
|
||||||
|
e_widget_disabled_set( cfdata->gui.disable, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else /* Load / Unload menu */
|
||||||
|
{
|
||||||
|
if(!d->loaded)/* unloaded module was clicked */
|
||||||
|
{
|
||||||
|
cfd->data=d->mod_name;
|
||||||
|
e_widget_disabled_set(cfdata->gui.load,0);
|
||||||
|
e_widget_disabled_set(cfdata->gui.unload,1);
|
||||||
|
e_widget_disabled_set(cfdata->gui.loaded,1);
|
||||||
|
}
|
||||||
|
else /* this is a loaded module */
|
||||||
|
{
|
||||||
|
cfd->data=d->mod;
|
||||||
|
e_widget_disabled_set(cfdata->gui.load,1);
|
||||||
|
e_widget_disabled_set(cfdata->gui.unload,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
_module_load(void *data, void *data2)
|
||||||
|
{
|
||||||
|
E_Cfg_Mod_Data *d;
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
CFData *cfdata;
|
||||||
|
Evas_Object *ob;
|
||||||
|
|
||||||
|
cfd = data;
|
||||||
|
cfdata = cfd->cfdata;
|
||||||
|
e_module_new(cfd->data);
|
||||||
|
|
||||||
|
cfd->view_dirty=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
_module_unload(void *data, void *data2)
|
||||||
|
{
|
||||||
|
E_Module *m;
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
CFData *cfdata;
|
||||||
|
|
||||||
|
cfd = data;
|
||||||
|
m = cfd->data;
|
||||||
|
cfdata = cfd->cfdata;
|
||||||
|
|
||||||
|
e_module_disable(m);
|
||||||
|
e_object_del(E_OBJECT(m));
|
||||||
|
e_config_save_queue();
|
||||||
|
cfd->view_dirty=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
_module_enable(void *data, void *data2)/* this enables and disables :) */
|
||||||
|
{
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
CFData *cfdata;
|
||||||
|
E_Module *m;
|
||||||
|
E_Cfg_Mod_Data *d;
|
||||||
|
|
||||||
|
cfd = data;
|
||||||
|
m = cfd->data;
|
||||||
|
|
||||||
|
if(m->enabled)
|
||||||
|
{
|
||||||
|
e_module_save(m);
|
||||||
|
e_module_disable(m);
|
||||||
|
|
||||||
|
e_widget_disabled_set( cfdata->gui.configure, 1);
|
||||||
|
e_widget_disabled_set( cfdata->gui.enable, 0);
|
||||||
|
e_widget_disabled_set( cfdata->gui.disable, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e_module_enable(m);
|
||||||
|
|
||||||
|
if(m->func.config)
|
||||||
|
e_widget_disabled_set( cfdata->gui.configure, 0);
|
||||||
|
e_widget_disabled_set( cfdata->gui.enable, 1);
|
||||||
|
e_widget_disabled_set( cfdata->gui.disable, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
_module_configure(void *data, void *data2)
|
||||||
|
{
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
CFData *cfdata;
|
||||||
|
E_Module *m;
|
||||||
|
|
||||||
|
cfd = data;
|
||||||
|
m = cfd->data;
|
||||||
|
cfdata = cfd->cfdata;
|
||||||
|
if(m->func.config)
|
||||||
|
{
|
||||||
|
m->func.config(m);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("Can't run config no module!!!\n");// Debug!!
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**--CREATE--**/
|
||||||
|
static void
|
||||||
|
_fill_data(CFData *cfdata)
|
||||||
|
{
|
||||||
|
char buf[4096];
|
||||||
|
char fullpath[PATH_MAX];
|
||||||
|
Evas_List *l=NULL;
|
||||||
|
|
||||||
|
cfdata->umods = NULL;
|
||||||
|
|
||||||
|
cfdata->mods= NULL;
|
||||||
|
//e_module_list();
|
||||||
|
|
||||||
|
/* We could use e_module_list() but this method gives us alphabetical order */
|
||||||
|
for(l = e_path_dir_list_get(path_modules);l;l = l->next)
|
||||||
|
{
|
||||||
|
E_Path_Dir *epd;
|
||||||
|
epd = l->data;
|
||||||
|
_e_config_module_list(&(cfdata->mods),epd->dir,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(l = e_path_dir_list_get(path_modules);l;l = l->next)
|
||||||
|
{
|
||||||
|
E_Path_Dir *epd;
|
||||||
|
epd = l->data;
|
||||||
|
_e_config_module_list(&(cfdata->umods),epd->dir,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
_create_data(E_Config_Dialog *cfd)
|
||||||
|
{
|
||||||
|
/* Create cfdata - cfdata is a temporary block of config data that this
|
||||||
|
* dialog will be dealing with while configuring. it will be applied to
|
||||||
|
* the running systems/config in the apply methods
|
||||||
|
*/
|
||||||
|
CFData *cfdata;
|
||||||
|
|
||||||
|
cfdata = E_NEW(CFData, 1);
|
||||||
|
_fill_data(cfdata);
|
||||||
|
|
||||||
|
return cfdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_free_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* Free the cfdata */
|
||||||
|
free(cfdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**--APPLY--**/
|
||||||
|
static int
|
||||||
|
_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
|
{
|
||||||
|
return 1; /* Apply was OK */
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
return 1; /* Apply was OK */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**--GUI--**/
|
||||||
|
static Evas_Object *
|
||||||
|
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* generate the core widget layout for a basic dialog */
|
||||||
|
Evas_Object *o, *ob, *of, *sob;
|
||||||
|
E_Radio_Group *rg;
|
||||||
|
Evas_List *l;
|
||||||
|
E_Module *m;
|
||||||
|
|
||||||
|
_fill_data(cfdata);
|
||||||
|
cfd->hide_buttons = 1;
|
||||||
|
|
||||||
|
o = e_widget_list_add(evas, 0, 1);
|
||||||
|
of = e_widget_framelist_add(evas, "Modules", 1);
|
||||||
|
ob = e_widget_ilist_add(evas,16,16,NULL);
|
||||||
|
for(l = cfdata->mods;l;l = l->next)
|
||||||
|
{
|
||||||
|
E_Cfg_Mod_Data *cb_data;
|
||||||
|
m = l->data;
|
||||||
|
sob = e_icon_add(evas);
|
||||||
|
if (m->icon_file)
|
||||||
|
e_icon_file_set(sob,m->icon_file);
|
||||||
|
/*else if (mod->edje_icon_file)
|
||||||
|
* {
|
||||||
|
* if (mod->edje_icon_key)
|
||||||
|
*/
|
||||||
|
cb_data = E_NEW(E_Cfg_Mod_Data, 1);
|
||||||
|
cb_data->cfd = cfd;
|
||||||
|
cb_data->mod = m;
|
||||||
|
e_widget_ilist_append(ob, sob, m->name, _e_config_mod_cb_standard, cb_data, m->name);
|
||||||
|
}
|
||||||
|
e_widget_min_size_set(ob, 120, 120);
|
||||||
|
e_widget_ilist_go(ob);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
of = e_widget_frametable_add(evas, "Actions", 1);
|
||||||
|
|
||||||
|
ob = e_widget_button_add(evas, "Enable", NULL, _module_enable, cfd, NULL);
|
||||||
|
cfdata->gui.enable = ob;
|
||||||
|
e_widget_disabled_set(ob, 1);
|
||||||
|
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 32, 32, 1, 1);
|
||||||
|
|
||||||
|
ob = e_widget_button_add(evas, "Disable", NULL, _module_enable, cfd, NULL);
|
||||||
|
cfdata->gui.disable = ob;
|
||||||
|
e_widget_disabled_set(ob, 1);
|
||||||
|
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 32, 32, 1, 1);
|
||||||
|
|
||||||
|
ob = e_widget_button_add(evas, "Configure", NULL, _module_configure, cfd, NULL);
|
||||||
|
cfdata->gui.configure=ob;
|
||||||
|
e_widget_disabled_set(ob, 1);
|
||||||
|
e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 32, 32, 1, 1);
|
||||||
|
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* generate the core widget layout for an advanced dialog */
|
||||||
|
Evas_Object *o, *ob, *of, *sob;
|
||||||
|
E_Radio_Group *rg;
|
||||||
|
Evas_List *l;
|
||||||
|
E_Module *m;
|
||||||
|
|
||||||
|
|
||||||
|
_fill_data(cfdata);
|
||||||
|
cfd->hide_buttons = 1;
|
||||||
|
|
||||||
|
o = e_widget_list_add(evas, 0, 1);
|
||||||
|
|
||||||
|
of = e_widget_framelist_add(evas, "Loaded", 1);
|
||||||
|
ob = e_widget_ilist_add(evas,16,16,NULL);
|
||||||
|
for(l = cfdata->mods;l;l = l->next)
|
||||||
|
{
|
||||||
|
E_Cfg_Mod_Data *cb_data;
|
||||||
|
m = l->data;
|
||||||
|
sob = e_icon_add(evas);
|
||||||
|
if (m->icon_file)
|
||||||
|
e_icon_file_set(sob,m->icon_file);
|
||||||
|
cb_data = E_NEW(E_Cfg_Mod_Data, 1);
|
||||||
|
cb_data->cfd = cfd;
|
||||||
|
cb_data->loaded = 1;
|
||||||
|
cb_data->mod = m;
|
||||||
|
e_widget_ilist_append(ob, sob, m->name, _e_config_mod_cb_standard, cb_data, m->name);
|
||||||
|
}
|
||||||
|
cfdata->gui.loaded = ob;
|
||||||
|
e_widget_ilist_go(ob);
|
||||||
|
e_widget_min_size_set(ob, 120, 120);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
of = e_widget_list_add(evas, 0, 0);
|
||||||
|
ob = e_widget_button_add(evas, "Load", NULL, _module_load, cfd, NULL);
|
||||||
|
cfdata->gui.load = ob;
|
||||||
|
e_widget_disabled_set(ob, 1);
|
||||||
|
e_widget_list_object_append(of, ob, 1, 1, 0.5);
|
||||||
|
|
||||||
|
ob = e_widget_button_add(evas, "Unload", NULL, _module_unload, cfd, NULL);
|
||||||
|
cfdata->gui.unload = ob;
|
||||||
|
e_widget_disabled_set(ob, 1);
|
||||||
|
e_widget_list_object_append(of, ob, 1, 1, 0.5);
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
of = e_widget_framelist_add(evas, "Unloaded", 1);
|
||||||
|
ob = e_widget_ilist_add(evas,16,16,NULL);
|
||||||
|
for(l = cfdata->umods;l;l = l->next)
|
||||||
|
{
|
||||||
|
char *mod;
|
||||||
|
char *icon;
|
||||||
|
char buf[PATH_MAX];
|
||||||
|
E_Cfg_Mod_Data *cb_data;
|
||||||
|
|
||||||
|
mod = l->data;
|
||||||
|
sob = e_icon_add(evas);
|
||||||
|
snprintf(buf, sizeof(buf), "%s/module_icon.png", mod);
|
||||||
|
icon = e_path_find(path_modules, buf);
|
||||||
|
e_icon_file_set(sob,icon);
|
||||||
|
cb_data = E_NEW(CFData,1);
|
||||||
|
cb_data->cfd = cfd;
|
||||||
|
cb_data->loaded = 0;
|
||||||
|
cb_data->mod_name = strdup(mod);
|
||||||
|
e_widget_ilist_append(ob, sob, mod, _e_config_mod_cb_standard, cb_data, mod);
|
||||||
|
}
|
||||||
|
cfdata->gui.unloaded = ob;
|
||||||
|
e_widget_ilist_go(ob);
|
||||||
|
e_widget_min_size_set(ob, 120, 120);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
|
*/
|
||||||
|
#ifdef E_TYPEDEFS
|
||||||
|
#else
|
||||||
|
#ifndef E_INT_CONFIG_MODULES_H
|
||||||
|
#define E_INT_CONFIG_MODULES_H
|
||||||
|
|
||||||
|
EAPI E_Config_Dialog *e_int_config_modules(E_Container *con);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
|
@ -12,7 +12,7 @@ struct _Main_Data
|
||||||
E_Menu *apps;
|
E_Menu *apps;
|
||||||
E_Menu *desktops;
|
E_Menu *desktops;
|
||||||
E_Menu *clients;
|
E_Menu *clients;
|
||||||
E_Menu *modules;
|
//E_Menu *modules;
|
||||||
E_Menu *gadgets;
|
E_Menu *gadgets;
|
||||||
E_Menu *themes;
|
E_Menu *themes;
|
||||||
E_Menu *config;
|
E_Menu *config;
|
||||||
|
@ -85,13 +85,14 @@ e_int_menus_main_new(void)
|
||||||
|
|
||||||
mi = e_menu_item_new(m);
|
mi = e_menu_item_new(m);
|
||||||
e_menu_item_separator_set(mi, 1);
|
e_menu_item_separator_set(mi, 1);
|
||||||
|
/*
|
||||||
subm = e_module_menu_new();
|
subm = e_module_menu_new();
|
||||||
dat->modules = subm;
|
dat->modules = subm;
|
||||||
mi = e_menu_item_new(m);
|
mi = e_menu_item_new(m);
|
||||||
e_menu_item_label_set(mi, _("Modules"));
|
e_menu_item_label_set(mi, _("Modules"));
|
||||||
e_util_menu_item_edje_icon_set(mi, "enlightenment/modules");
|
e_util_menu_item_edje_icon_set(mi, "enlightenment/modules");
|
||||||
e_menu_item_submenu_set(mi, subm);
|
e_menu_item_submenu_set(mi, subm);
|
||||||
|
*/
|
||||||
|
|
||||||
subm = e_int_menus_desktops_new();
|
subm = e_int_menus_desktops_new();
|
||||||
dat->desktops = subm;
|
dat->desktops = subm;
|
||||||
|
@ -345,7 +346,7 @@ _e_int_menus_main_del_hook(void *obj)
|
||||||
if (dat)
|
if (dat)
|
||||||
{
|
{
|
||||||
e_object_del(E_OBJECT(dat->apps));
|
e_object_del(E_OBJECT(dat->apps));
|
||||||
e_object_del(E_OBJECT(dat->modules));
|
/* e_object_del(E_OBJECT(dat->modules));*/
|
||||||
e_object_del(E_OBJECT(dat->desktops));
|
e_object_del(E_OBJECT(dat->desktops));
|
||||||
e_object_del(E_OBJECT(dat->clients));
|
e_object_del(E_OBJECT(dat->clients));
|
||||||
e_object_del(E_OBJECT(dat->gadgets));
|
e_object_del(E_OBJECT(dat->gadgets));
|
||||||
|
|
|
@ -135,6 +135,8 @@ e_module_new(char *name)
|
||||||
m->func.save = dlsym(m->handle, "e_modapi_save");
|
m->func.save = dlsym(m->handle, "e_modapi_save");
|
||||||
m->func.info = dlsym(m->handle, "e_modapi_info");
|
m->func.info = dlsym(m->handle, "e_modapi_info");
|
||||||
m->func.about = dlsym(m->handle, "e_modapi_about");
|
m->func.about = dlsym(m->handle, "e_modapi_about");
|
||||||
|
m->func.config = dlsym(m->handle, "e_modapi_config");
|
||||||
|
|
||||||
if ((!m->func.init) ||
|
if ((!m->func.init) ||
|
||||||
(!m->func.shutdown) ||
|
(!m->func.shutdown) ||
|
||||||
(!m->func.save) ||
|
(!m->func.save) ||
|
||||||
|
@ -156,6 +158,8 @@ e_module_new(char *name)
|
||||||
m->func.save = NULL;
|
m->func.save = NULL;
|
||||||
m->func.info = NULL;
|
m->func.info = NULL;
|
||||||
m->func.about = NULL;
|
m->func.about = NULL;
|
||||||
|
m->func.config = NULL;
|
||||||
|
|
||||||
dlclose(m->handle);
|
dlclose(m->handle);
|
||||||
m->handle = NULL;
|
m->handle = NULL;
|
||||||
m->error = 1;
|
m->error = 1;
|
||||||
|
@ -177,6 +181,7 @@ e_module_new(char *name)
|
||||||
m->func.save = NULL;
|
m->func.save = NULL;
|
||||||
m->func.info = NULL;
|
m->func.info = NULL;
|
||||||
m->func.about = NULL;
|
m->func.about = NULL;
|
||||||
|
m->func.config = NULL;
|
||||||
dlclose(m->handle);
|
dlclose(m->handle);
|
||||||
m->handle = NULL;
|
m->handle = NULL;
|
||||||
m->error = 1;
|
m->error = 1;
|
||||||
|
|
|
@ -30,6 +30,7 @@ struct _E_Module
|
||||||
int (*save) (E_Module *m);
|
int (*save) (E_Module *m);
|
||||||
int (*info) (E_Module *m);
|
int (*info) (E_Module *m);
|
||||||
int (*about) (E_Module *m);
|
int (*about) (E_Module *m);
|
||||||
|
int (*config) (E_Module *m);
|
||||||
} func;
|
} func;
|
||||||
|
|
||||||
unsigned char enabled : 1;
|
unsigned char enabled : 1;
|
||||||
|
|
|
@ -134,6 +134,21 @@ e_modapi_about(E_Module *m)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_modapi_config(E_Module *m)
|
||||||
|
{
|
||||||
|
Battery *e;
|
||||||
|
Battery_Face *face;
|
||||||
|
|
||||||
|
e = m->data;
|
||||||
|
if (!e) return 0;
|
||||||
|
if (!e->faces) return 0;
|
||||||
|
face = e->faces->data;
|
||||||
|
if (!face) return 0;
|
||||||
|
e_int_config_battery(face->con, face->battery);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* module private routines */
|
/* module private routines */
|
||||||
static Battery *
|
static Battery *
|
||||||
_battery_new()
|
_battery_new()
|
||||||
|
|
|
@ -18,8 +18,8 @@ typedef struct _Status Status;
|
||||||
|
|
||||||
struct _Config
|
struct _Config
|
||||||
{
|
{
|
||||||
double poll_time;
|
double poll_time;
|
||||||
int alarm;
|
int alarm;
|
||||||
Evas_List *faces;
|
Evas_List *faces;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,17 +30,17 @@ struct _Config_Face
|
||||||
|
|
||||||
struct _Battery
|
struct _Battery
|
||||||
{
|
{
|
||||||
E_Menu *config_menu;
|
E_Menu *config_menu;
|
||||||
Evas_List *faces;
|
Evas_List *faces;
|
||||||
|
|
||||||
Config *conf;
|
Config *conf;
|
||||||
int alarm_triggered;
|
int alarm_triggered;
|
||||||
|
|
||||||
int battery_check_mode;
|
int battery_check_mode;
|
||||||
Ecore_Timer *battery_check_timer;
|
Ecore_Timer *battery_check_timer;
|
||||||
int battery_prev_drain;
|
int battery_prev_drain;
|
||||||
int battery_prev_ac;
|
int battery_prev_ac;
|
||||||
int battery_prev_battery;
|
int battery_prev_battery;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Battery_Face
|
struct _Battery_Face
|
||||||
|
|
|
@ -97,6 +97,21 @@ e_modapi_about(E_Module *module)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_modapi_config(E_Module *m)
|
||||||
|
{
|
||||||
|
Clock *e;
|
||||||
|
Clock_Face *face;
|
||||||
|
|
||||||
|
e = m->data;
|
||||||
|
if (!e) return 0;
|
||||||
|
if (!e->faces) return 0;
|
||||||
|
face = e->faces->data;
|
||||||
|
if (!face) return 0;
|
||||||
|
e_int_config_clock(face->con, face);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* module private routines */
|
/* module private routines */
|
||||||
static Clock *
|
static Clock *
|
||||||
_clock_new()
|
_clock_new()
|
||||||
|
|
|
@ -94,6 +94,32 @@ static void _ibar_bar_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *m
|
||||||
static void _ibar_drag_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y);
|
static void _ibar_drag_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y);
|
||||||
static void _ibar_drag_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
|
static void _ibar_drag_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
|
||||||
|
|
||||||
|
/* PROTOTYPES - same all the time */
|
||||||
|
typedef struct _CFData CFData;
|
||||||
|
|
||||||
|
static void *_create_data(E_Config_Dialog *cfd);
|
||||||
|
static void _free_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||||
|
static int _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||||
|
static int _advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata);
|
||||||
|
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
|
||||||
|
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata);
|
||||||
|
static void _ibar_config_dialog(IBar *ib);
|
||||||
|
|
||||||
|
|
||||||
|
/* Actual config data we will be playing with whil the dialog is active */
|
||||||
|
struct _CFData
|
||||||
|
{
|
||||||
|
/*- BASIC -*/
|
||||||
|
//int mode;
|
||||||
|
/*- ADVANCED -*/
|
||||||
|
int follower;
|
||||||
|
double follow_speed;
|
||||||
|
int iconsize;
|
||||||
|
int autofit;
|
||||||
|
double autoscroll_speed;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Config Updated Function Protos */
|
/* Config Updated Function Protos */
|
||||||
static void _ibar_bar_cb_width_auto(void *data);
|
static void _ibar_bar_cb_width_auto(void *data);
|
||||||
static void _ibar_bar_cb_follower(void *data);
|
static void _ibar_bar_cb_follower(void *data);
|
||||||
|
@ -162,6 +188,16 @@ e_modapi_about(E_Module *m)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_modapi_config(E_Module *m)
|
||||||
|
{
|
||||||
|
IBar *ib;
|
||||||
|
|
||||||
|
ib = m->data;
|
||||||
|
if (ib) _ibar_config_dialog(ib);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* module private routines */
|
/* module private routines */
|
||||||
static IBar *
|
static IBar *
|
||||||
_ibar_new()
|
_ibar_new()
|
||||||
|
@ -642,7 +678,6 @@ static void
|
||||||
_ibar_bar_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi)
|
_ibar_bar_cb_menu_configure(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
{
|
{
|
||||||
IBar_Bar *ibb;
|
IBar_Bar *ibb;
|
||||||
E_Config_Dialog *cfd;
|
|
||||||
|
|
||||||
ibb = data;
|
ibb = data;
|
||||||
if (!ibb) return;
|
if (!ibb) return;
|
||||||
|
@ -1782,6 +1817,7 @@ _ibar_bar_cb_iconsize_change(void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
static void
|
static void
|
||||||
_ibar_bar_cb_menu_enabled(void *data, E_Menu *m, E_Menu_Item *mi)
|
_ibar_bar_cb_menu_enabled(void *data, E_Menu *m, E_Menu_Item *mi)
|
||||||
{
|
{
|
||||||
|
@ -1822,4 +1858,266 @@ _ibar_drag_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Co
|
||||||
evas_object_resize(o, w, h);
|
evas_object_resize(o, w, h);
|
||||||
evas_object_resize(data, w, h);
|
evas_object_resize(data, w, h);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* Config dialog info */
|
||||||
|
static void
|
||||||
|
_ibar_config_dialog(IBar *ib)
|
||||||
|
{
|
||||||
|
E_Config_Dialog *cfd;
|
||||||
|
E_Config_Dialog_View v;
|
||||||
|
E_Manager *man;
|
||||||
|
E_Container *con;
|
||||||
|
//IBar *ib;
|
||||||
|
//ib = ibb->ibar;
|
||||||
|
man = e_manager_current_get();
|
||||||
|
//if (!man) return NULL;
|
||||||
|
con = e_container_current_get(man);
|
||||||
|
|
||||||
|
/* methods */
|
||||||
|
v.create_cfdata = _create_data;
|
||||||
|
v.free_cfdata = _free_data;
|
||||||
|
v.basic.apply_cfdata = _basic_apply_data;
|
||||||
|
v.basic.create_widgets = _basic_create_widgets;
|
||||||
|
v.advanced.apply_cfdata = _advanced_apply_data;
|
||||||
|
v.advanced.create_widgets = _advanced_create_widgets;
|
||||||
|
cfd = e_config_dialog_new(con, _("IBar Configuration"), NULL, 0, &v, ib);
|
||||||
|
//ib->conf_diag = cfd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**--CREATE--**/
|
||||||
|
static void
|
||||||
|
_fill_data(IBar *ib,CFData *cfdata)
|
||||||
|
{
|
||||||
|
cfdata->autofit = (ib->conf->width == IBAR_WIDTH_AUTO);
|
||||||
|
cfdata->autoscroll_speed = ib->conf->autoscroll_speed;
|
||||||
|
cfdata->follower = ib->conf->follower;
|
||||||
|
cfdata->follow_speed = ib->conf->follow_speed;
|
||||||
|
cfdata->iconsize = ib->conf->iconsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
_create_data(E_Config_Dialog *cfd)
|
||||||
|
{
|
||||||
|
/* Create cfdata - cfdata is a temporary block of config data that this
|
||||||
|
* dialog will be dealing with while configuring. it will be applied to
|
||||||
|
* the running systems/config in the apply methods
|
||||||
|
*/
|
||||||
|
CFData *cfdata;
|
||||||
|
IBar *ib;
|
||||||
|
ib = cfd->data;
|
||||||
|
|
||||||
|
cfdata = E_NEW(CFData, 1);
|
||||||
|
_fill_data(ib,cfdata);
|
||||||
|
return cfdata;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_free_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* Free the cfdata */
|
||||||
|
|
||||||
|
free(cfdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**--APPLY--**/
|
||||||
|
static int
|
||||||
|
_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
|
{
|
||||||
|
IBar *ib;
|
||||||
|
IBar_Bar *ibb;
|
||||||
|
Evas_List *l;
|
||||||
|
ib = cfd->data;
|
||||||
|
|
||||||
|
/* Follower */
|
||||||
|
if ((cfdata->follower) && (!ib->conf->follower))
|
||||||
|
{
|
||||||
|
ib->conf->follower = 1;
|
||||||
|
for (l = ib->bars; l; l = l->next)
|
||||||
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
|
||||||
|
ibb = l->data;
|
||||||
|
if (ibb->overlay_object) continue;
|
||||||
|
o = edje_object_add(ibb->evas);
|
||||||
|
ibb->overlay_object = o;
|
||||||
|
evas_object_layer_set(o, 2);
|
||||||
|
e_theme_edje_object_set(o, "base/theme/modules/ibar",
|
||||||
|
"modules/ibar/follower");
|
||||||
|
evas_object_show(o);
|
||||||
|
_ibar_bar_follower_reset(ibb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!(cfdata->follower) && (ib->conf->follower))
|
||||||
|
{
|
||||||
|
ib->conf->follower = 0;
|
||||||
|
for (l = ib->bars; l; l = l->next)
|
||||||
|
{
|
||||||
|
ibb = l->data;
|
||||||
|
if (!ibb->overlay_object) continue;
|
||||||
|
evas_object_del(ibb->overlay_object);
|
||||||
|
ibb->overlay_object = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Auto fit */
|
||||||
|
if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED))
|
||||||
|
{
|
||||||
|
ib->conf->width = IBAR_WIDTH_AUTO;
|
||||||
|
for (l = ib->bars; l; l = l->next)
|
||||||
|
{
|
||||||
|
ibb = l->data;
|
||||||
|
_ibar_bar_update_policy(ibb);
|
||||||
|
_ibar_bar_frame_resize(ibb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!(cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_AUTO))
|
||||||
|
{
|
||||||
|
ib->conf->width = IBAR_WIDTH_FIXED;
|
||||||
|
for (l = ib->bars; l; l = l->next)
|
||||||
|
{
|
||||||
|
ibb = l->data;
|
||||||
|
_ibar_bar_update_policy(ibb);
|
||||||
|
_ibar_bar_frame_resize(ibb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_advanced_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
|
{
|
||||||
|
IBar *ib;
|
||||||
|
IBar_Bar *ibb;
|
||||||
|
Evas_List *l;
|
||||||
|
ib = cfd->data;
|
||||||
|
|
||||||
|
/* Follower */
|
||||||
|
if ((cfdata->follower) && (!ib->conf->follower))
|
||||||
|
{
|
||||||
|
ib->conf->follower = 1;
|
||||||
|
for (l = ib->bars; l; l = l->next)
|
||||||
|
{
|
||||||
|
Evas_Object *o;
|
||||||
|
|
||||||
|
ibb = l->data;
|
||||||
|
if (ibb->overlay_object) continue;
|
||||||
|
o = edje_object_add(ibb->evas);
|
||||||
|
ibb->overlay_object = o;
|
||||||
|
evas_object_layer_set(o, 2);
|
||||||
|
e_theme_edje_object_set(o, "base/theme/modules/ibar",
|
||||||
|
"modules/ibar/follower");
|
||||||
|
evas_object_show(o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!(cfdata->follower) && (ib->conf->follower))
|
||||||
|
{
|
||||||
|
ib->conf->follower = 0;
|
||||||
|
for (l = ib->bars; l; l = l->next)
|
||||||
|
{
|
||||||
|
ibb = l->data;
|
||||||
|
if (!ibb->overlay_object) continue;
|
||||||
|
evas_object_del(ibb->overlay_object);
|
||||||
|
ibb->overlay_object = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Auto fit */
|
||||||
|
if ((cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_FIXED))
|
||||||
|
{
|
||||||
|
ib->conf->width = IBAR_WIDTH_AUTO;
|
||||||
|
for (l = ib->bars; l; l = l->next)
|
||||||
|
{
|
||||||
|
ibb = l->data;
|
||||||
|
_ibar_bar_update_policy(ibb);
|
||||||
|
_ibar_bar_frame_resize(ibb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!(cfdata->autofit) && (ib->conf->width == IBAR_WIDTH_AUTO))
|
||||||
|
{
|
||||||
|
ib->conf->width = IBAR_WIDTH_FIXED;
|
||||||
|
for (l = ib->bars; l; l = l->next)
|
||||||
|
{
|
||||||
|
ibb = l->data;
|
||||||
|
_ibar_bar_update_policy(ibb);
|
||||||
|
_ibar_bar_frame_resize(ibb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Icon size */
|
||||||
|
if (cfdata->iconsize != ib->conf->iconsize)
|
||||||
|
{
|
||||||
|
ib->conf->iconsize = cfdata->iconsize;
|
||||||
|
for (l = ib->bars; l; l = l->next)
|
||||||
|
{
|
||||||
|
ibb = l->data;
|
||||||
|
_ibar_bar_cb_iconsize_change(ibb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
e_config_save_queue();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**--GUI--**/
|
||||||
|
static Evas_Object *
|
||||||
|
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* generate the core widget layout for a basic dialog */
|
||||||
|
Evas_Object *o, *ob;
|
||||||
|
E_Radio_Group *rg;
|
||||||
|
IBar *ib;
|
||||||
|
ib = cfd->data;
|
||||||
|
|
||||||
|
_fill_data(ib,cfdata);
|
||||||
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
|
ob = e_widget_check_add(evas, _("Follower"), &(cfdata->follower));
|
||||||
|
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||||
|
ob = e_widget_check_add(evas, _("Auto fit"), &(cfdata->autofit));
|
||||||
|
e_widget_list_object_append(o, ob, 1, 1, 0.5);
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
|
{
|
||||||
|
/* generate the core widget layout for an advanced dialog */
|
||||||
|
Evas_Object *o, *ob, *of,*oo;
|
||||||
|
E_Radio_Group *rg;
|
||||||
|
IBar *ib;
|
||||||
|
ib = cfd->data;
|
||||||
|
|
||||||
|
_fill_data(ib,cfdata);
|
||||||
|
|
||||||
|
o = e_widget_list_add(evas, 0, 0);
|
||||||
|
|
||||||
|
of = e_widget_framelist_add(evas, _("Follower"), 0);
|
||||||
|
ob = e_widget_check_add(evas, _("Visible"), &(cfdata->follower));
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_label_add(evas, _("Follow speed"));
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01,0, &(cfdata->follow_speed), NULL, 200);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
|
||||||
|
of = e_widget_framelist_add(evas, _("Icon size"), 0);
|
||||||
|
ob = e_widget_slider_add(evas, 1, 0, _("%3.0f px"), 8.0, 128.0, 1.0,0, NULL, &(cfdata->iconsize), 200);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
|
||||||
|
of = e_widget_framelist_add(evas, _("Width"), 0);
|
||||||
|
ob = e_widget_check_add(evas, _("Auto fit"), &(cfdata->autofit));
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_label_add(evas, _("Autoscroll speed"));
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
ob = e_widget_slider_add(evas, 1, 0, _("%1.2f px/s"), 0.0, 1.0, 0.01,0, &(cfdata->autoscroll_speed), NULL, 200);
|
||||||
|
e_widget_framelist_object_append(of, ob);
|
||||||
|
e_widget_list_object_append(o, of, 1, 1, 0.5);
|
||||||
|
|
||||||
|
|
||||||
|
return o;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,21 @@ e_modapi_about(E_Module *m)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_modapi_config(E_Module *m)
|
||||||
|
{
|
||||||
|
IBox *e;
|
||||||
|
IBox_Box *face;
|
||||||
|
|
||||||
|
e = m->data;
|
||||||
|
if (!e) return 0;
|
||||||
|
if (!e->boxes) return 0;
|
||||||
|
face = e->boxes->data;
|
||||||
|
if (!face) return 0;
|
||||||
|
e_int_config_ibox(face->con, face->ibox);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* module private routines */
|
/* module private routines */
|
||||||
static IBox *
|
static IBox *
|
||||||
_ibox_new()
|
_ibox_new()
|
||||||
|
|
|
@ -155,6 +155,21 @@ e_modapi_about(E_Module *module)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_modapi_config(E_Module *m)
|
||||||
|
{
|
||||||
|
Pager *e;
|
||||||
|
Pager_Face *face;
|
||||||
|
|
||||||
|
e = m->data;
|
||||||
|
if (!e) return 0;
|
||||||
|
if (!e->faces) return 0;
|
||||||
|
face = e->faces->data;
|
||||||
|
if (!face) return 0;
|
||||||
|
e_int_config_pager(e_container_current_get(e_manager_current_get()), e);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* module private routines */
|
/* module private routines */
|
||||||
static Pager *
|
static Pager *
|
||||||
_pager_new(void)
|
_pager_new(void)
|
||||||
|
|
|
@ -101,6 +101,21 @@ e_modapi_about(E_Module *m)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
e_modapi_config(E_Module *m)
|
||||||
|
{
|
||||||
|
Temperature *e;
|
||||||
|
Temperature_Face *face;
|
||||||
|
|
||||||
|
e = m->data;
|
||||||
|
if (!e) return 0;
|
||||||
|
if (!e->faces) return 0;
|
||||||
|
face = e->faces->data;
|
||||||
|
if (!face) return 0;
|
||||||
|
e_int_config_temperature(face->con, face->temp);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* module private routines */
|
/* module private routines */
|
||||||
static Temperature *
|
static Temperature *
|
||||||
_temperature_new()
|
_temperature_new()
|
||||||
|
|
Loading…
Reference in New Issue