When selecting themes, if the current theme is what we selected in the list, disable the ok/apply buttons. Formatting. Code cleanup
SVN revision: 19698
This commit is contained in:
parent
9eb2e91ee1
commit
5431156f1e
|
@ -45,7 +45,6 @@ e_int_config_theme(E_Container *con)
|
||||||
v.advanced.create_widgets = NULL;
|
v.advanced.create_widgets = NULL;
|
||||||
/* create config diaolg for NULL object/data */
|
/* create config diaolg for NULL object/data */
|
||||||
cfd = e_config_dialog_new(con, _("Theme Selector"), NULL, 0, &v, NULL);
|
cfd = e_config_dialog_new(con, _("Theme Selector"), NULL, 0, &v, NULL);
|
||||||
//e_dialog_resizable_set(cfd->dia, 1);
|
|
||||||
return cfd;
|
return cfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,11 +53,9 @@ static void
|
||||||
_fill_data(CFData *cfdata)
|
_fill_data(CFData *cfdata)
|
||||||
{
|
{
|
||||||
/* get current theme */
|
/* get current theme */
|
||||||
|
|
||||||
E_Config_Theme * c;
|
E_Config_Theme * c;
|
||||||
c = e_theme_config_get("theme");
|
c = e_theme_config_get("theme");
|
||||||
cfdata->current_theme = strdup(c->file);
|
cfdata->current_theme = strdup(c->file);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -87,15 +84,9 @@ _free_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
static int
|
static int
|
||||||
_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
_basic_apply_data(E_Config_Dialog *cfd, CFData *cfdata)
|
||||||
{
|
{
|
||||||
E_Zone *z;
|
|
||||||
E_Desk *d;
|
|
||||||
E_Action *a;
|
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 */
|
/* 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_theme_config_set("theme", cfdata->theme);
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
|
|
||||||
|
@ -109,9 +100,17 @@ void
|
||||||
_e_config_theme_cb_standard(void *data)
|
_e_config_theme_cb_standard(void *data)
|
||||||
{
|
{
|
||||||
E_Cfg_Theme_Data *d;
|
E_Cfg_Theme_Data *d;
|
||||||
|
CFData *cfdata;
|
||||||
|
|
||||||
d = data;
|
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));
|
e_widget_image_object_set(d->cfd->data, e_thumb_evas_object_get(d->file, d->cfd->dia->win->evas, 160, 120, 1));
|
||||||
|
|
||||||
|
cfdata = d->cfd->cfdata;
|
||||||
|
if (!strcmp(cfdata->theme, cfdata->current_theme))
|
||||||
|
{
|
||||||
|
e_dialog_button_disable_num_set(d->cfd->dia, 0, 1);
|
||||||
|
e_dialog_button_disable_num_set(d->cfd->dia, 1, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,44 +175,27 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
if (edje_object_file_set(o, fulltheme, "desktop/background"))
|
if (edje_object_file_set(o, fulltheme, "desktop/background"))
|
||||||
{
|
{
|
||||||
Evas_Object *o = NULL;
|
Evas_Object *o = NULL;
|
||||||
char *noext, *ext;
|
char *noext;
|
||||||
E_Cfg_Theme_Data *cb_data;
|
E_Cfg_Theme_Data *cb_data;
|
||||||
|
|
||||||
o = e_thumb_generate_begin(fulltheme, 48, 48, cfd->dia->win->evas, &o, NULL, NULL);
|
o = e_thumb_generate_begin(fulltheme, 48, 48, cfd->dia->win->evas, &o, NULL, NULL);
|
||||||
|
noext = ecore_file_strip_ext(themefile);
|
||||||
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 = E_NEW(E_Cfg_Theme_Data, 1);
|
||||||
cb_data->cfd = cfd;
|
cb_data->cfd = cfd;
|
||||||
cb_data->file = strdup(fulltheme);
|
cb_data->file = strdup(fulltheme);
|
||||||
cb_data->theme = strdup(themefile);
|
cb_data->theme = strdup(themefile);
|
||||||
e_widget_ilist_append(il, o, noext, _e_config_theme_cb_standard, cb_data, themefile);
|
e_widget_ilist_append(il, o, noext, _e_config_theme_cb_standard, cb_data, themefile);
|
||||||
|
|
||||||
if (!(strcmp(themefile, cfdata->current_theme)))
|
if (!(strcmp(themefile, cfdata->current_theme)))
|
||||||
{
|
{
|
||||||
e_widget_ilist_selected_set(il, i);
|
e_widget_ilist_selected_set(il, i);
|
||||||
im = e_widget_image_add_from_object(evas, theme, 320, 240);
|
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));
|
e_widget_image_object_set(im, e_thumb_evas_object_get(fulltheme, evas, 320, 240, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
free(noext);
|
free(noext);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free(themefile);
|
||||||
evas_object_del(o);
|
evas_object_del(o);
|
||||||
ecore_evas_free(eebuf);
|
ecore_evas_free(eebuf);
|
||||||
ecore_list_destroy(themes);
|
ecore_list_destroy(themes);
|
||||||
|
@ -227,9 +209,8 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, CFData *cfdata)
|
||||||
if (im == NULL)
|
if (im == NULL)
|
||||||
{
|
{
|
||||||
theme = e_thumb_generate_begin(PACKAGE_DATA_DIR"/data/themes/default.edj",
|
theme = e_thumb_generate_begin(PACKAGE_DATA_DIR"/data/themes/default.edj",
|
||||||
160, 120, evas, &theme, NULL, NULL);
|
320, 240, evas, &theme, NULL, NULL);
|
||||||
im = e_widget_image_add_from_object(evas, theme,
|
im = e_widget_image_add_from_object(evas, theme, 320, 240);
|
||||||
320, 240);
|
|
||||||
}
|
}
|
||||||
cfd->data = im;
|
cfd->data = im;
|
||||||
e_widget_min_size_set(fr, 320, 240);
|
e_widget_min_size_set(fr, 320, 240);
|
||||||
|
|
Loading…
Reference in New Issue