Make Icon Theme Dialog play nice on small screens.
Fix some formatting. SVN revision: 50544
This commit is contained in:
parent
9e0d1a8180
commit
84bac7309c
|
@ -6,9 +6,8 @@
|
||||||
static void *_create_data(E_Config_Dialog *cfd);
|
static void *_create_data(E_Config_Dialog *cfd);
|
||||||
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
static int _basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
||||||
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||||
|
|
||||||
static int _sort_icon_themes(const void *data1, const void *data2);
|
static int _sort_icon_themes(const void *data1, const void *data2);
|
||||||
static Evas_Object *_icon_new(Evas *evas, const char *theme, const char *icon, unsigned int size);
|
static Evas_Object *_icon_new(Evas *evas, const char *theme, const char *icon, unsigned int size);
|
||||||
|
|
||||||
|
@ -19,19 +18,21 @@ struct _E_Config_Dialog_Data
|
||||||
const char *themename;
|
const char *themename;
|
||||||
int overrides;
|
int overrides;
|
||||||
int populating;
|
int populating;
|
||||||
struct {
|
struct
|
||||||
Evas_Object *list;
|
{
|
||||||
Evas_Object *checkbox;
|
Evas_Object *list;
|
||||||
Evas_Object *preview[4]; /* same size as _icon_previews */
|
Evas_Object *checkbox;
|
||||||
} gui;
|
Evas_Object *preview[4]; /* same size as _icon_previews */
|
||||||
|
} gui;
|
||||||
Ecore_Idler *fill_icon_themes_delayed;
|
Ecore_Idler *fill_icon_themes_delayed;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *_icon_previews[4] = {
|
static const char *_icon_previews[4] =
|
||||||
"system-run",
|
{
|
||||||
"system-file-manager",
|
"system-run",
|
||||||
"preferences-desktop-theme",
|
"system-file-manager",
|
||||||
"text-x-generic"
|
"preferences-desktop-theme",
|
||||||
|
"text-x-generic"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PREVIEW_SIZE (48)
|
#define PREVIEW_SIZE (48)
|
||||||
|
@ -47,13 +48,12 @@ e_int_config_icon_themes(E_Container *con, const char *params __UNUSED__)
|
||||||
|
|
||||||
v->create_cfdata = _create_data;
|
v->create_cfdata = _create_data;
|
||||||
v->free_cfdata = _free_data;
|
v->free_cfdata = _free_data;
|
||||||
v->basic.create_widgets = _basic_create_widgets;
|
v->basic.create_widgets = _basic_create;
|
||||||
v->basic.apply_cfdata = _basic_apply_data;
|
v->basic.apply_cfdata = _basic_apply;
|
||||||
v->basic.check_changed = _basic_check_changed;
|
v->basic.check_changed = _basic_check_changed;
|
||||||
|
|
||||||
cfd = e_config_dialog_new(con,
|
cfd = e_config_dialog_new(con, _("Icon Theme Settings"),
|
||||||
_("Icon Theme Settings"),
|
"E", "appearance/icon_theme",
|
||||||
"E", "appearance/icon_theme",
|
|
||||||
"preferences-icon-theme", 0, v, NULL);
|
"preferences-icon-theme", 0, v, NULL);
|
||||||
return cfd;
|
return cfd;
|
||||||
}
|
}
|
||||||
|
@ -62,9 +62,9 @@ static void
|
||||||
_fill_data(E_Config_Dialog_Data *cfdata)
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
cfdata->icon_themes = efreet_icon_theme_list_get();
|
cfdata->icon_themes = efreet_icon_theme_list_get();
|
||||||
cfdata->icon_themes = eina_list_sort(cfdata->icon_themes,
|
cfdata->icon_themes = eina_list_sort(cfdata->icon_themes,
|
||||||
eina_list_count(cfdata->icon_themes),
|
eina_list_count(cfdata->icon_themes),
|
||||||
_sort_icon_themes);
|
_sort_icon_themes);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -77,9 +77,7 @@ _create_data(E_Config_Dialog *cfd)
|
||||||
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
||||||
cfdata->cfd = cfd;
|
cfdata->cfd = cfd;
|
||||||
cfdata->themename = eina_stringshare_add(e_config->icon_theme);
|
cfdata->themename = eina_stringshare_add(e_config->icon_theme);
|
||||||
|
|
||||||
cfdata->overrides = e_config->icon_theme_overrides;
|
cfdata->overrides = e_config->icon_theme_overrides;
|
||||||
|
|
||||||
return cfdata;
|
return cfdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,18 +108,15 @@ _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
_basic_apply(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
E_Event_Config_Icon_Theme *ev;
|
E_Event_Config_Icon_Theme *ev;
|
||||||
|
|
||||||
if (!_basic_check_changed(cfd, cfdata))
|
if (!_basic_check_changed(cfd, cfdata)) return 1;
|
||||||
return 1;
|
|
||||||
|
|
||||||
eina_stringshare_del(e_config->icon_theme);
|
eina_stringshare_del(e_config->icon_theme);
|
||||||
e_config->icon_theme = eina_stringshare_ref(cfdata->themename);
|
e_config->icon_theme = eina_stringshare_ref(cfdata->themename);
|
||||||
|
|
||||||
e_config->icon_theme_overrides = !!cfdata->overrides;
|
e_config->icon_theme_overrides = !!cfdata->overrides;
|
||||||
|
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
|
|
||||||
ev = E_NEW(E_Event_Config_Icon_Theme, 1);
|
ev = E_NEW(E_Event_Config_Icon_Theme, 1);
|
||||||
|
@ -138,9 +133,13 @@ _populate_preview(E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
const char *t = cfdata->themename;
|
const char *t = cfdata->themename;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(_icon_previews)/sizeof(_icon_previews[0]); i++)
|
for (i = 0; i < sizeof(_icon_previews)/sizeof(_icon_previews[0]); i++)
|
||||||
{
|
{
|
||||||
char *path = efreet_icon_path_find(t, _icon_previews[i], PREVIEW_SIZE);
|
char *path;
|
||||||
|
|
||||||
|
if (!(path = efreet_icon_path_find(t, _icon_previews[i], PREVIEW_SIZE)))
|
||||||
|
continue;
|
||||||
if (e_icon_file_set(cfdata->gui.preview[i], path))
|
if (e_icon_file_set(cfdata->gui.preview[i], path))
|
||||||
e_icon_fill_inside_set(cfdata->gui.preview[i], EINA_TRUE);
|
e_icon_fill_inside_set(cfdata->gui.preview[i], EINA_TRUE);
|
||||||
free(path);
|
free(path);
|
||||||
|
@ -162,15 +161,16 @@ _fill_icon_themes(void *data)
|
||||||
struct _fill_icon_themes_data *d = data;
|
struct _fill_icon_themes_data *d = data;
|
||||||
Efreet_Icon_Theme *theme;
|
Efreet_Icon_Theme *theme;
|
||||||
Evas_Object *oc = NULL;
|
Evas_Object *oc = NULL;
|
||||||
const char **example_icon, *example_icons[] = {
|
const char **example_icon, *example_icons[] =
|
||||||
NULL,
|
{
|
||||||
"folder",
|
NULL,
|
||||||
"user-home",
|
"folder",
|
||||||
"text-x-generic",
|
"user-home",
|
||||||
"system-run",
|
"text-x-generic",
|
||||||
"preferences-system",
|
"system-run",
|
||||||
NULL,
|
"preferences-system",
|
||||||
};
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
if (!d->themes_loaded)
|
if (!d->themes_loaded)
|
||||||
{
|
{
|
||||||
|
@ -184,7 +184,13 @@ _fill_icon_themes(void *data)
|
||||||
|
|
||||||
if (!d->l)
|
if (!d->l)
|
||||||
{
|
{
|
||||||
|
int mw, mh;
|
||||||
|
|
||||||
e_widget_ilist_go(d->cfdata->gui.list);
|
e_widget_ilist_go(d->cfdata->gui.list);
|
||||||
|
|
||||||
|
e_widget_size_min_get(d->cfdata->gui.list, &mw, &mh);
|
||||||
|
e_widget_size_min_set(d->cfdata->gui.list, mw, 50);
|
||||||
|
|
||||||
d->cfdata->fill_icon_themes_delayed = NULL;
|
d->cfdata->fill_icon_themes_delayed = NULL;
|
||||||
d->cfdata->populating = EINA_FALSE;
|
d->cfdata->populating = EINA_FALSE;
|
||||||
_populate_preview(d->cfdata);
|
_populate_preview(d->cfdata);
|
||||||
|
@ -199,9 +205,7 @@ _fill_icon_themes(void *data)
|
||||||
example_icon = example_icons;
|
example_icon = example_icons;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
example_icon = example_icons + 1;
|
||||||
example_icon = example_icons + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; (*example_icon) && (!oc); example_icon++)
|
for (; (*example_icon) && (!oc); example_icon++)
|
||||||
oc = _icon_new(d->evas, theme->name.internal, *example_icon, 24);
|
oc = _icon_new(d->evas, theme->name.internal, *example_icon, 24);
|
||||||
|
@ -223,13 +227,15 @@ _fill_icon_themes(void *data)
|
||||||
static void
|
static void
|
||||||
_icon_theme_changed(void *data, Evas_Object *o __UNUSED__)
|
_icon_theme_changed(void *data, Evas_Object *o __UNUSED__)
|
||||||
{
|
{
|
||||||
E_Config_Dialog_Data *cfdata = data;
|
E_Config_Dialog_Data *cfdata;
|
||||||
|
|
||||||
|
cfdata = data;
|
||||||
if (cfdata->populating) return;
|
if (cfdata->populating) return;
|
||||||
_populate_preview(cfdata);
|
_populate_preview(cfdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
{
|
{
|
||||||
Evas_Object *o, *ilist, *checkbox, *ol;
|
Evas_Object *o, *ilist, *checkbox, *ol;
|
||||||
struct _fill_icon_themes_data *d;
|
struct _fill_icon_themes_data *d;
|
||||||
|
@ -240,7 +246,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
ilist = e_widget_ilist_add(evas, 24, 24, &(cfdata->themename));
|
ilist = e_widget_ilist_add(evas, 24, 24, &(cfdata->themename));
|
||||||
cfdata->gui.list = ilist;
|
cfdata->gui.list = ilist;
|
||||||
|
|
||||||
e_widget_size_min_set(ilist, 200, 240);
|
|
||||||
cfdata->populating = EINA_TRUE;
|
cfdata->populating = EINA_TRUE;
|
||||||
e_widget_on_change_hook_set(ilist, _icon_theme_changed, cfdata);
|
e_widget_on_change_hook_set(ilist, _icon_theme_changed, cfdata);
|
||||||
e_widget_list_object_append(o, ilist, 1, 1, 0.5);
|
e_widget_list_object_append(o, ilist, 1, 1, 0.5);
|
||||||
|
@ -251,13 +256,15 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf
|
||||||
cfdata->gui.preview[i] = e_icon_add(evas);
|
cfdata->gui.preview[i] = e_icon_add(evas);
|
||||||
e_icon_preload_set(cfdata->gui.preview[i], EINA_TRUE);
|
e_icon_preload_set(cfdata->gui.preview[i], EINA_TRUE);
|
||||||
e_icon_scale_size_set(cfdata->gui.preview[i], PREVIEW_SIZE);
|
e_icon_scale_size_set(cfdata->gui.preview[i], PREVIEW_SIZE);
|
||||||
e_widget_framelist_object_append_full
|
e_widget_framelist_object_append_full(ol, cfdata->gui.preview[i],
|
||||||
(ol, cfdata->gui.preview[i], 0, 0, 0, 0, 0.5, 0.5,
|
0, 0, 0, 0, 0.5, 0.5,
|
||||||
PREVIEW_SIZE, PREVIEW_SIZE, PREVIEW_SIZE, PREVIEW_SIZE);
|
PREVIEW_SIZE, PREVIEW_SIZE,
|
||||||
|
PREVIEW_SIZE, PREVIEW_SIZE);
|
||||||
}
|
}
|
||||||
e_widget_list_object_append(o, ol, 0, 0, 0.5);
|
e_widget_list_object_append(o, ol, 0, 0, 0.5);
|
||||||
|
|
||||||
checkbox = e_widget_check_add(evas, _("This overrides general theme"), &(cfdata->overrides));
|
checkbox = e_widget_check_add(evas, _("This overrides general theme"),
|
||||||
|
&(cfdata->overrides));
|
||||||
e_widget_size_min_get(checkbox, &mw, &mh);
|
e_widget_size_min_get(checkbox, &mw, &mh);
|
||||||
e_widget_list_object_append(o, checkbox, 0, 0, 0.0);
|
e_widget_list_object_append(o, checkbox, 0, 0, 0.0);
|
||||||
|
|
||||||
|
@ -296,9 +303,9 @@ static Evas_Object *
|
||||||
_icon_new(Evas *evas, const char *theme, const char *icon, unsigned int size)
|
_icon_new(Evas *evas, const char *theme, const char *icon, unsigned int size)
|
||||||
{
|
{
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
char *path = efreet_icon_path_find(theme, icon, size);
|
char *path;
|
||||||
if (!path) return NULL;
|
|
||||||
|
|
||||||
|
if (!(path = efreet_icon_path_find(theme, icon, size))) return NULL;
|
||||||
o = e_icon_add(evas);
|
o = e_icon_add(evas);
|
||||||
if (e_icon_file_set(o, path))
|
if (e_icon_file_set(o, path))
|
||||||
e_icon_fill_inside_set(o, 1);
|
e_icon_fill_inside_set(o, 1);
|
||||||
|
|
Loading…
Reference in New Issue