e17/xsettings: fix theme option

- started to provide dpi setting, not enabled yet


SVN revision: 64711
This commit is contained in:
Hannes Janetzek 2011-11-03 21:22:23 +00:00
parent 42dd87aeee
commit 06f104ebec
1 changed files with 152 additions and 122 deletions

View File

@ -53,6 +53,7 @@ static Eina_Bool running = EINA_FALSE;
static const char _setting_icon_theme_name[] = "Net/IconThemeName";
static const char _setting_theme_name[] = "Net/ThemeName";
static const char _setting_font_name[] = "Gtk/FontName";
static const char _setting_xft_dpi[] = "Xft/DPI";
static Ecore_X_Atom
_e_xsettings_atom_screen_get(int screen_num)
@ -206,9 +207,9 @@ _e_xsettings_string_set(const char *name, const char *value)
s->last_change = ecore_x_current_time_get();
}
/* not used!!!
static void
_e_xsettings_int_set(const char *name, int value)
_e_xsettings_int_set(const char *name, int value, Eina_Bool set)
{
Setting *s;
Eina_List *l;
@ -221,7 +222,7 @@ _e_xsettings_int_set(const char *name, int value)
if (s->type != SETTING_TYPE_INT) continue;
if (s->name == name) break;
}
if (!value)
if (!set)
{
if (!s) return;
DBG("remove %s\n", name);
@ -251,7 +252,6 @@ _e_xsettings_int_set(const char *name, int value)
s->length = 12;
s->length += OFFSET_ADD(strlen(name));
}
*/
static unsigned char *
_e_xsettings_copy(unsigned char *buffer, Setting *s)
@ -381,7 +381,8 @@ _e_xsettings_icon_theme_set(void)
e_config->icon_theme);
return;
}
else if (e_config->xsettings.net_icon_theme_name)
if (e_config->xsettings.net_icon_theme_name)
{
_e_xsettings_string_set(_setting_icon_theme_name,
e_config->xsettings.net_icon_theme_name);
@ -400,14 +401,34 @@ _e_xsettings_theme_set(void)
if ((ct = e_theme_config_get("theme")))
{
char *theme;
if ((theme = edje_file_data_get(ct->file, "gtk-theme")))
{
char buf[4096], *dir;
Eina_List *xdg_dirs, *l;
e_user_homedir_snprintf(buf, sizeof(buf), ".themes/%s", theme);
if (ecore_file_exists(buf))
{
_e_xsettings_string_set(_setting_theme_name, theme);
return;
}
xdg_dirs = efreet_data_dirs_get();
EINA_LIST_FOREACH(xdg_dirs, l, dir)
{
snprintf(buf, sizeof(buf), "%s/themes/%s", dir, theme);
if (ecore_file_exists(buf))
{
_e_xsettings_string_set(_setting_theme_name, theme);
return;
}
}
}
else if (e_config->xsettings.net_theme_name)
}
}
if (e_config->xsettings.net_theme_name)
{
_e_xsettings_string_set(_setting_theme_name,
e_config->xsettings.net_theme_name);
@ -449,6 +470,17 @@ _e_xsettings_font_set(void)
_e_xsettings_string_set(_setting_font_name, NULL);
}
static void
_e_xsettings_xft_set(void)
{
if (e_config->scale.use_dpi)
_e_xsettings_int_set(_setting_xft_dpi, e_config->scale.base_dpi, EINA_TRUE);
else
_e_xsettings_int_set(_setting_xft_dpi, 0, EINA_FALSE);
}
static void
_e_xsettings_start(void)
{
@ -533,8 +565,6 @@ e_xsettings_shutdown(void)
EAPI void
e_xsettings_config_update(void)
{
DBG("update\n");
if (!e_config->xsettings.enabled)
{
_e_xsettings_stop();