- misc checks
- add theme selector (basic mode only) from Chady SVN revision: 19148
This commit is contained in:
parent
b6bc092d13
commit
6121b94137
|
@ -121,6 +121,7 @@ e_widget_slider.h \
|
|||
e_int_config_window_manipulation.h \
|
||||
e_int_config_window_display.h \
|
||||
e_int_config_background.h \
|
||||
e_int_config_theme.h \
|
||||
e_int_config_menus.h \
|
||||
e_deskpreview.h \
|
||||
e_exebuf.h \
|
||||
|
@ -226,6 +227,7 @@ e_widget_slider.c \
|
|||
e_int_config_window_manipulation.c \
|
||||
e_int_config_window_display.c \
|
||||
e_int_config_background.c \
|
||||
e_int_config_theme.c \
|
||||
e_int_config_menus.c \
|
||||
e_deskpreview.c \
|
||||
e_exebuf.c \
|
||||
|
|
|
@ -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 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/themes", _("Theme Selector"), e_int_config_theme);
|
||||
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
|
||||
|
|
|
@ -42,6 +42,7 @@ e_icon_file_set(Evas_Object *obj, const char *file)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
/* smart code here */
|
||||
evas_object_image_file_set(sd->obj, file, NULL);
|
||||
_e_icon_smart_reconfigure(sd);
|
||||
|
@ -53,6 +54,7 @@ e_icon_file_key_set(Evas_Object *obj, const char *file, const char *key)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
/* smart code here */
|
||||
evas_object_image_file_set(sd->obj, file, key);
|
||||
_e_icon_smart_reconfigure(sd);
|
||||
|
@ -64,6 +66,7 @@ e_icon_file_edje_set(Evas_Object *obj, const char *file, const char *part)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
/* smart code here */
|
||||
if (sd->obj) evas_object_del(sd->obj);
|
||||
sd->obj = edje_object_add(evas_object_evas_get(obj));
|
||||
|
@ -77,6 +80,7 @@ e_icon_object_set(Evas_Object *obj, Evas_Object *o)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
/* smart code here */
|
||||
if (sd->obj) evas_object_del(sd->obj);
|
||||
sd->obj = o;
|
||||
|
@ -90,6 +94,7 @@ e_icon_file_get(Evas_Object *obj)
|
|||
char *file;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return NULL;
|
||||
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
||||
{
|
||||
edje_object_file_get(sd->obj, (const char **)&file, NULL);
|
||||
|
@ -105,6 +110,7 @@ e_icon_smooth_scale_set(Evas_Object *obj, int smooth)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
||||
return;
|
||||
evas_object_image_smooth_scale_set(sd->obj, smooth);
|
||||
|
@ -116,6 +122,7 @@ e_icon_smooth_scale_get(Evas_Object *obj)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return 0;
|
||||
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
||||
return 0;
|
||||
return evas_object_image_smooth_scale_get(sd->obj);
|
||||
|
@ -127,6 +134,7 @@ e_icon_alpha_set(Evas_Object *obj, int alpha)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
||||
return;
|
||||
evas_object_image_alpha_set(sd->obj, alpha);
|
||||
|
@ -138,6 +146,7 @@ e_icon_alpha_get(Evas_Object *obj)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return 0;
|
||||
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
||||
return 0;
|
||||
return evas_object_image_alpha_get(sd->obj);
|
||||
|
@ -149,6 +158,7 @@ e_icon_size_get(Evas_Object *obj, int *w, int *h)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
return evas_object_image_size_get(sd->obj, w, h);
|
||||
}
|
||||
|
||||
|
@ -168,6 +178,7 @@ e_icon_fill_inside_set(Evas_Object *obj, int fill_inside)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if (((sd->fill_inside) && (fill_inside)) ||
|
||||
((!sd->fill_inside) && (!fill_inside))) return;
|
||||
sd->fill_inside = fill_inside;
|
||||
|
@ -180,6 +191,7 @@ e_icon_data_set(Evas_Object *obj, void *data, int w, int h)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return;
|
||||
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
||||
return;
|
||||
evas_object_image_size_set(sd->obj, w, h);
|
||||
|
@ -192,6 +204,7 @@ e_icon_data_get(Evas_Object *obj, int *w, int *h)
|
|||
E_Smart_Data *sd;
|
||||
|
||||
sd = evas_object_smart_data_get(obj);
|
||||
if (!sd) return NULL;
|
||||
if (!strcmp(evas_object_type_get(sd->obj), "edje"))
|
||||
return NULL;
|
||||
evas_object_image_size_get(sd->obj, w, h);
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
#include "e_int_config_window_manipulation.h"
|
||||
#include "e_int_config_window_display.h"
|
||||
#include "e_int_config_background.h"
|
||||
#include "e_int_config_theme.h"
|
||||
#include "e_int_config_menus.h"
|
||||
#include "e_deskpreview.h"
|
||||
#include "e_exebuf.h"
|
||||
|
|
|
@ -92,7 +92,8 @@ _basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
|||
//e_bg_add(cfd->con, z, 0, 0, cfdata->file);
|
||||
if (e_config->desktop_default_background) evas_stringshare_del(e_config->desktop_default_background);
|
||||
e_config->desktop_default_background = evas_stringshare_add(cfdata->file);
|
||||
e_bg_update();
|
||||
e_bg_update();
|
||||
e_config_save_queue();
|
||||
return 1; /* Apply was OK */
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,243 @@
|
|||
/*
|
||||
* 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_Theme_Data E_Cfg_Theme_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);
|
||||
|
||||
/* Actual config data we will be playing with whil the dialog is active */
|
||||
struct _CFData
|
||||
{
|
||||
/*- BASIC -*/
|
||||
char *theme;
|
||||
char *current_theme;
|
||||
/*- ADVANCED -*/
|
||||
|
||||
};
|
||||
|
||||
struct _E_Cfg_Theme_Data
|
||||
{
|
||||
E_Config_Dialog *cfd;
|
||||
char *file;
|
||||
char *theme;
|
||||
};
|
||||
|
||||
/* a nice easy setup function that does the dirty work */
|
||||
E_Config_Dialog *
|
||||
e_int_config_theme(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 = NULL;
|
||||
v.advanced.create_widgets = NULL;
|
||||
/* create config diaolg for NULL object/data */
|
||||
cfd = e_config_dialog_new(con, _("Theme Selector"), NULL, 0, &v, NULL);
|
||||
//e_dialog_resizable_set(cfd->dia, 1);
|
||||
return cfd;
|
||||
}
|
||||
|
||||
/**--CREATE--**/
|
||||
static void
|
||||
_fill_data(CFData *cfdata)
|
||||
{
|
||||
/* get current theme */
|
||||
|
||||
E_Config_Theme * c;
|
||||
c = e_theme_config_get("theme");
|
||||
cfdata->current_theme = strdup(c->file);
|
||||
|
||||
}
|
||||
|
||||
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->current_theme);
|
||||
free(cfdata);
|
||||
}
|
||||
|
||||
/**--APPLY--**/
|
||||
static int
|
||||
_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||
{
|
||||
E_Zone *z;
|
||||
E_Desk *d;
|
||||
E_Action *a;
|
||||
|
||||
z = e_zone_current_get(cfd->con);
|
||||
d = e_desk_current_get(z);
|
||||
/* Actually take our cfdata settings and apply them in real life */
|
||||
printf("set theme: %s\n", cfdata->theme);
|
||||
|
||||
e_theme_config_set("theme", cfdata->theme);
|
||||
e_config_save_queue();
|
||||
|
||||
a = e_action_find("restart");
|
||||
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
|
||||
|
||||
return 1; /* Apply was OK */
|
||||
}
|
||||
|
||||
void
|
||||
_e_config_theme_cb_standard(void *data)
|
||||
{
|
||||
E_Cfg_Theme_Data *d;
|
||||
|
||||
d = data;
|
||||
e_widget_image_object_set(d->cfd->data, e_thumb_evas_object_get(d->file, d->cfd->dia->win->evas, 160, 120, 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, *fr, *im = NULL;
|
||||
Evas_Object *il;
|
||||
char buf[4096];
|
||||
char *homedir;
|
||||
Evas_Object *theme;
|
||||
|
||||
theme = edje_object_add(evas);
|
||||
|
||||
_fill_data(cfdata);
|
||||
cfdata->theme = NULL;
|
||||
|
||||
o = e_widget_table_add(evas, 0);
|
||||
|
||||
il = e_widget_ilist_add(evas, 48, 48, &(cfdata->theme));
|
||||
homedir = e_user_homedir_get();
|
||||
if (homedir)
|
||||
{
|
||||
snprintf(buf, sizeof(buf), "%s/.e/e/themes", homedir);
|
||||
free(homedir);
|
||||
}
|
||||
|
||||
if ((ecore_file_exists(buf)) && (ecore_file_is_dir(buf)))
|
||||
{
|
||||
Ecore_List *themes;
|
||||
|
||||
themes = ecore_file_ls(buf);
|
||||
if (themes)
|
||||
{
|
||||
/* add default theme */
|
||||
ecore_list_prepend(themes, strdup("default.edj"));
|
||||
ecore_list_goto_first(themes);
|
||||
|
||||
char *themefile;
|
||||
char fulltheme[PATH_MAX];
|
||||
Evas_Object *o;
|
||||
Ecore_Evas *eebuf;
|
||||
Evas *evasbuf;
|
||||
int i = 0;
|
||||
|
||||
eebuf = ecore_evas_buffer_new(1, 1);
|
||||
evasbuf = ecore_evas_get(eebuf);
|
||||
o = edje_object_add(evasbuf);
|
||||
|
||||
while ((themefile = ecore_list_next(themes)))
|
||||
{
|
||||
if (!strcmp(themefile, "default.edj"))
|
||||
snprintf(fulltheme, sizeof(fulltheme), PACKAGE_DATA_DIR"/data/themes/default.edj");
|
||||
else
|
||||
snprintf(fulltheme, sizeof(fulltheme), "%s/%s", buf, themefile);
|
||||
if (ecore_file_is_dir(fulltheme))
|
||||
continue;
|
||||
|
||||
/* minimum theme requirements */
|
||||
if (edje_object_file_set(o, fulltheme, "desktop/background"))
|
||||
{
|
||||
Evas_Object *o = NULL;
|
||||
char *noext, *ext;
|
||||
E_Cfg_Theme_Data *cb_data;
|
||||
|
||||
o = e_thumb_generate_begin(fulltheme, 48, 48, cfd->dia->win->evas, &o, NULL, NULL);
|
||||
|
||||
ext = strrchr(themefile ,'.');
|
||||
|
||||
if (!ext)
|
||||
{
|
||||
noext = strdup(themefile);
|
||||
}
|
||||
else
|
||||
{
|
||||
noext = malloc((ext - themefile + 1));
|
||||
if (themefile)
|
||||
{
|
||||
memcpy(noext, themefile, ext - themefile);
|
||||
noext[ext - themefile] = 0;
|
||||
}
|
||||
}
|
||||
cb_data = E_NEW(E_Cfg_Theme_Data, 1);
|
||||
cb_data->cfd = cfd;
|
||||
cb_data->file = strdup(fulltheme);
|
||||
cb_data->theme = strdup(themefile);
|
||||
e_widget_ilist_append(il, o, noext, _e_config_theme_cb_standard, cb_data, themefile);
|
||||
|
||||
if (!(strcmp(themefile, cfdata->current_theme)))
|
||||
{
|
||||
e_widget_ilist_select_set(il, i);
|
||||
im = e_widget_image_add_from_object(evas, theme, 320, 240);
|
||||
e_widget_image_object_set(im, e_thumb_evas_object_get(fulltheme, evas, 160, 120, 1));
|
||||
}
|
||||
|
||||
free(noext);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
evas_object_del(o);
|
||||
ecore_evas_free(eebuf);
|
||||
ecore_list_destroy(themes);
|
||||
}
|
||||
}
|
||||
|
||||
e_widget_ilist_go(il);
|
||||
e_widget_min_size_set(il, 240, 60);
|
||||
e_widget_table_object_append(o, il, 0, 0, 1, 2, 1, 1, 1, 1);
|
||||
fr = e_widget_framelist_add(evas, "Preview", 0);
|
||||
if (im == NULL)
|
||||
{
|
||||
theme = e_thumb_generate_begin(PACKAGE_DATA_DIR"/data/themes/default.edj",
|
||||
160, 120, evas, &theme, NULL, NULL);
|
||||
im = e_widget_image_add_from_object(evas, theme,
|
||||
320, 240);
|
||||
}
|
||||
cfd->data = im;
|
||||
e_widget_min_size_set(fr, 340, 260);
|
||||
e_widget_table_object_append(o, fr, 1, 0, 1, 1, 1, 1, 1, 1);
|
||||
e_widget_framelist_object_append(fr, im);
|
||||
|
||||
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_THEME_H
|
||||
#define E_INT_CONFIG_THEME_H
|
||||
|
||||
EAPI E_Config_Dialog *e_int_config_theme(E_Container *con);
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -325,7 +325,7 @@ _e_thumb_etheme_create(char *file, Evas_Coord w, Evas_Coord h, int *ww, int *hh,
|
|||
evas_object_move(clock, (w * 0.9), (h * 0.9));
|
||||
evas_object_resize(clock, w * 0.1, h * 0.1);
|
||||
/* start */
|
||||
evas_object_move(start, (w * 0.9), (h * 0.9));
|
||||
evas_object_move(start, 0.1, (h * 0.9));
|
||||
evas_object_resize(start, w * 0.1, h * 0.1);
|
||||
/* pager */
|
||||
evas_object_move(pager[0], (w * 0.3), (h * 0.9));
|
||||
|
@ -593,12 +593,15 @@ _e_thumb_cb_exe_exit(void *data, int type, void *event)
|
|||
t->w,
|
||||
t->h,
|
||||
1);
|
||||
data = e_icon_data_get(tmp, &w, &h);
|
||||
e_icon_data_set(t->obj, data, w, h);
|
||||
evas_object_del(tmp);
|
||||
if(t->cb)
|
||||
t->cb(t->obj, t->data);
|
||||
free(t);
|
||||
if (tmp && t)
|
||||
{
|
||||
data = e_icon_data_get(tmp, &w, &h);
|
||||
e_icon_data_set(t->obj, data, w, h);
|
||||
evas_object_del(tmp);
|
||||
if(t->cb)
|
||||
t->cb(t->obj, t->data);
|
||||
free(t);
|
||||
}
|
||||
}
|
||||
|
||||
pid = -1;
|
||||
|
|
Loading…
Reference in New Issue