ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=4c0fc7559c2624b160b218e52be2c9f7794ad569

commit 4c0fc7559c2624b160b218e52be2c9f7794ad569
Author: Andy Williams <a...@andywilliams.me>
Date:   Mon Apr 25 14:56:55 2016 +0100

    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.
---
 src/lib/elementary/elementary_config.h |  8 ++++++++
 src/lib/elementary/elm_config.c        | 23 +++++++++++++++++++++++
 src/lib/elementary/elm_config.h        | 23 +++++++++++++++++++++++
 src/lib/elementary/elm_priv.h          |  3 ++-
 4 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/src/lib/elementary/elementary_config.h 
b/src/lib/elementary/elementary_config.h
index a5c0006..ae14f49 100644
--- a/src/lib/elementary/elementary_config.h
+++ b/src/lib/elementary/elementary_config.h
@@ -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"
+
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index aa72b4a..8dfe1b4 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -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)
 {
diff --git a/src/lib/elementary/elm_config.h b/src/lib/elementary/elm_config.h
index 023564f..558d859 100644
--- a/src/lib/elementary/elm_config.h
+++ b/src/lib/elementary/elm_config.h
@@ -974,6 +974,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
  *
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index a9772a9..d307983 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -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;

-- 


Reply via email to