elementary: Add user setting for icon theme

Beginning of the icon lookup rework.
The library will now store user preference for
the icon theme to use.
This commit is contained in:
Andy Williams 2016-04-25 14:56:55 +01:00
parent e88423e994
commit 4c0fc7559c
4 changed files with 56 additions and 1 deletions

View File

@ -1,3 +1,11 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
/**
* @file
* @brief Definition of special values for user configuration.
*/
#define ELM_CONFIG_ICON_THEME_ELEMENTARY "_Elementary_Icon_Theme"

View File

@ -500,6 +500,7 @@ _desc_init(void)
ELM_CONFIG_VAL(D, T, popup_horizontal_align, T_DOUBLE);
ELM_CONFIG_VAL(D, T, popup_vertical_align, T_DOUBLE);
ELM_CONFIG_VAL(D, T, spinner_min_max_filter_enable, T_UCHAR);
ELM_CONFIG_VAL(D, T, icon_theme, T_STRING);
#undef T
#undef D
#undef T_INT
@ -1823,6 +1824,7 @@ _config_load(void)
_elm_config->naviframe_prev_btn_auto_pushed = EINA_TRUE;
_elm_config->popup_horizontal_align = 0.5;
_elm_config->popup_vertical_align = 0.5;
_elm_config->icon_theme = eina_stringshare_add(ELM_CONFIG_ICON_THEME_ELEMENTARY);
}
static void
@ -2166,6 +2168,10 @@ _config_update(void)
IFCFG(0x0009)
_elm_config->scroll_accel_factor = 7.0;
IFCFGEND
IFCFG(0x000a)
_elm_config->icon_theme = eina_stringshare_add(ELM_CONFIG_ICON_THEME_ELEMENTARY);
IFCFGEND
/**
* Fix user config for current ELM_CONFIG_EPOCH here.
**/
@ -2652,6 +2658,23 @@ elm_config_scale_set(double scale)
_elm_rescale();
}
EAPI const char *
elm_config_icon_theme_get(void)
{
return _elm_config->icon_theme;
}
EAPI void
elm_config_icon_theme_set(const char *theme)
{
eina_stringshare_del(_elm_config->icon_theme);
if (theme)
_elm_config->icon_theme = eina_stringshare_add(theme);
else
_elm_config->icon_theme = eina_stringshare_add(ELM_CONFIG_ICON_THEME_ELEMENTARY);
}
EAPI Eina_Bool
elm_config_password_show_last_get(void)
{

View File

@ -973,6 +973,29 @@ EAPI double elm_config_scale_get(void);
*/
EAPI void elm_config_scale_set(double scale);
/**
* Get the icon theme the user has set.
*
* This gets the global icon theme currently set or the default value
* ELM_CONFIG_ICON_THEME_ELEMENTARY.
*
* @return the icon theme to use
* @ingroup Elm_Icon
*/
EAPI const char *elm_config_icon_theme_get(void);
/**
* Set the icon theme for all elementary apps.
*
* This method will set the icon theme for all elm_icon_standard_set calls.
* Valid parameters are the name of an installed freedesktop.org icon theme
* or ELM_CONFIG_ICON_THEME_ELEMENTARY for the built in theme.
*
* @param the name of a freedesktop.org icon theme or ELM_CONFIG_ICON_THEME_ELEMENTARY
* @ingroup Elm_Icon
*/
EAPI void elm_config_icon_theme_set(const char *theme);
/**
* @defgroup Elm_Password_last_show Password show last
* @ingroup Elementary

View File

@ -134,7 +134,7 @@ struct _Elm_Theme
* the users config doesn't need to be wiped - simply new values need
* to be put in
*/
#define ELM_CONFIG_FILE_GENERATION 0x0009
#define ELM_CONFIG_FILE_GENERATION 0x000a
#define ELM_CONFIG_VERSION_EPOCH_OFFSET 16
#define ELM_CONFIG_VERSION ((ELM_CONFIG_EPOCH << ELM_CONFIG_VERSION_EPOCH_OFFSET) | \
ELM_CONFIG_FILE_GENERATION)
@ -317,6 +317,7 @@ struct _Elm_Config
int gl_depth;
int gl_stencil;
int gl_msaa;
const char *icon_theme;
/* Not part of the EET file */
Eina_Bool is_mirrored : 1;