summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2016-04-25 16:57:13 +0100
committerAndy Williams <andy@andywilliams.me>2016-04-25 16:57:13 +0100
commit5bb29101a90357b618ec4ed12549655e8744597f (patch)
treecabdb52368dc27592582f58b5b2194982b2ba41a
parent4c0fc7559c2624b160b218e52be2c9f7794ad569 (diff)
downloadefl-5bb29101a90357b618ec4ed12549655e8744597f.tar.gz
elementary: Replace icon lookup_order with icon_theme.
The definition of where to load icons is now up to the user (through the configuration of the icon_theme config value) rather than being defined in code per-app or even per-component
-rw-r--r--src/lib/elementary/elm_config.c4
-rw-r--r--src/lib/elementary/elm_icon.c56
-rw-r--r--src/lib/elementary/elm_icon.eo4
-rw-r--r--src/lib/elementary/elm_toolbar.c24
-rw-r--r--src/lib/elementary/elm_toolbar.eo5
-rw-r--r--src/lib/elementary/elm_widget_icon.h1
-rw-r--r--src/lib/elementary/elm_widget_toolbar.h1
7 files changed, 39 insertions, 56 deletions
diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c
index 8dfe1b40c9..36ee5c7816 100644
--- a/src/lib/elementary/elm_config.c
+++ b/src/lib/elementary/elm_config.c
@@ -1550,6 +1550,7 @@ _config_free(Elm_Config *cfg)
eina_stringshare_del(cfg->indicator_service_90);
eina_stringshare_del(cfg->indicator_service_180);
eina_stringshare_del(cfg->indicator_service_270);
+ eina_stringshare_del(cfg->icon_theme);
free(cfg);
}
@@ -2661,6 +2662,9 @@ elm_config_scale_set(double scale)
EAPI const char *
elm_config_icon_theme_get(void)
{
+ if (!_elm_config->icon_theme)
+ return ELM_CONFIG_ICON_THEME_ELEMENTARY;
+
return _elm_config->icon_theme;
}
diff --git a/src/lib/elementary/elm_icon.c b/src/lib/elementary/elm_icon.c
index d049c16f1b..55fc2d9414 100644
--- a/src/lib/elementary/elm_icon.c
+++ b/src/lib/elementary/elm_icon.c
@@ -446,35 +446,16 @@ _internal_elm_icon_standard_set(Evas_Object *obj,
ELM_ICON_DATA_GET(obj, sd);
- /* try locating the icon using the specified lookup order */
- switch (sd->lookup_order)
+ /* try locating the icon using the specified theme */
+ if (!strcmp(ELM_CONFIG_ICON_THEME_ELEMENTARY, elm_config_icon_theme_get()))
{
- case ELM_ICON_LOOKUP_FDO:
- ret = _icon_freedesktop_set(obj, name, _icon_size_min_get(obj));
- if (ret && fdo) *fdo = EINA_TRUE;
- break;
-
- case ELM_ICON_LOOKUP_THEME:
- ret = _icon_standard_set(obj, name);
- break;
-
- case ELM_ICON_LOOKUP_THEME_FDO:
ret = _icon_standard_set(obj, name);
- if (!ret)
- {
- ret = _icon_freedesktop_set(obj, name, _icon_size_min_get(obj));
- if (ret && fdo) *fdo = EINA_TRUE;
- }
- break;
-
- case ELM_ICON_LOOKUP_FDO_THEME:
- default:
+ if (ret && fdo) *fdo = EINA_FALSE;
+ }
+ else
+ {
ret = _icon_freedesktop_set(obj, name, _icon_size_min_get(obj));
- if (!ret)
- ret = _icon_standard_set(obj, name);
- else if (fdo)
- *fdo = EINA_TRUE;
- break;
+ if (ret && fdo) *fdo = EINA_TRUE;
}
if (ret)
@@ -485,13 +466,17 @@ _internal_elm_icon_standard_set(Evas_Object *obj,
}
if (_path_is_absolute(name))
- return _icon_file_set(sd, obj, name);
+ {
+ if (fdo)
+ *fdo = EINA_FALSE;
+ return _icon_file_set(sd, obj, name);
+ }
/* if that fails, see if icon name is in the format size/name. if so,
try locating a fallback without the size specification */
if (!(tmp = strchr(name, '/'))) return EINA_FALSE;
++tmp;
- if (*tmp) return elm_icon_standard_set(obj, tmp);
+ if (*tmp) return _internal_elm_icon_standard_set(obj, tmp, fdo);
/* give up */
return EINA_FALSE;
}
@@ -530,8 +515,6 @@ _elm_icon_evas_object_smart_add(Eo *obj, Elm_Icon_Data *priv)
evas_obj_smart_add(eo_super(obj, MY_CLASS));
elm_widget_sub_object_parent_add(obj);
- priv->lookup_order = ELM_ICON_LOOKUP_THEME_FDO;
-
priv->thumb.request = NULL;
}
@@ -774,16 +757,17 @@ _elm_icon_standard_get(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd)
return sd->stdicon;
}
-EOLIAN static void
-_elm_icon_order_lookup_set(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd, Elm_Icon_Lookup_Order order)
+EINA_DEPRECATED EOLIAN static void
+_elm_icon_order_lookup_set(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd EINA_UNUSED,
+ Elm_Icon_Lookup_Order order EINA_UNUSED)
{
- sd->lookup_order = order;
+ // this method's behaviour has been overridden by elm_config_icon_theme_set
}
-EOLIAN static Elm_Icon_Lookup_Order
-_elm_icon_order_lookup_get(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd)
+EINA_DEPRECATED EOLIAN static Elm_Icon_Lookup_Order
+_elm_icon_order_lookup_get(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd EINA_UNUSED)
{
- return sd->lookup_order;
+ return ELM_ICON_LOOKUP_FDO_THEME;
}
EAPI void
diff --git a/src/lib/elementary/elm_icon.eo b/src/lib/elementary/elm_icon.eo
index 146c5b32d1..e783d764da 100644
--- a/src/lib/elementary/elm_icon.eo
+++ b/src/lib/elementary/elm_icon.eo
@@ -10,6 +10,8 @@ enum Elm.Icon.Lookup_Order
{
[[Lookup order used by elm_icon_standard_set(). Should look for icons in
the theme, FDO paths, or both?
+
+ Warning: This enum will be removed as the lookup_order is deprecated.
]]
legacy: elm_icon_lookup;
fdo_theme, [[Icon look up order: freedesktop, theme.]]
@@ -24,6 +26,8 @@ class Elm.Icon (Elm.Image)
eo_prefix: elm_obj_icon;
methods {
@property order_lookup {
+ [[Warning: the order_lookup property is deprecated.
+ See elm_config_icon_theme_set instead.]]
set {
[[Sets the icon lookup order used by elm_icon_standard_set().
diff --git a/src/lib/elementary/elm_toolbar.c b/src/lib/elementary/elm_toolbar.c
index 6c1662fffc..039cebf8a2 100644
--- a/src/lib/elementary/elm_toolbar.c
+++ b/src/lib/elementary/elm_toolbar.c
@@ -2484,7 +2484,6 @@ _item_new(Evas_Object *obj,
elm_interface_atspi_accessible_type_set(VIEW(it), ELM_ATSPI_TYPE_DISABLED);
icon_obj = elm_icon_add(VIEW(it));
- elm_icon_order_lookup_set(icon_obj, sd->lookup_order);
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
_access_widget_item_register(it);
@@ -2896,7 +2895,6 @@ _elm_toolbar_evas_object_smart_add(Eo *obj, Elm_Toolbar_Data *priv)
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move_cb, obj);
evas_object_event_callback_add
(priv->bx, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
- elm_toolbar_icon_order_lookup_set(obj, ELM_ICON_LOOKUP_THEME_FDO);
_elm_toolbar_highlight_in_theme(obj);
_sizing_eval(obj);
@@ -3646,7 +3644,6 @@ _elm_toolbar_item_state_add(Eo *eo_item, Elm_Toolbar_Item_Data *item,
}
icon_obj = elm_icon_add(obj);
- elm_icon_order_lookup_set(icon_obj, sd->lookup_order);
if (!icon_obj) goto error_state_add;
if (!_item_icon_set(icon_obj, "toolbar/", icon))
@@ -3810,24 +3807,17 @@ _elm_toolbar_item_state_prev(Eo *eo_item EINA_UNUSED, Elm_Toolbar_Item_Data *ite
return eina_list_data_get(prev_state);
}
-EOLIAN static void
-_elm_toolbar_icon_order_lookup_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd, Elm_Icon_Lookup_Order order)
+EINA_DEPRECATED EOLIAN static void
+_elm_toolbar_icon_order_lookup_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd EINA_UNUSED,
+ Elm_Icon_Lookup_Order order EINA_UNUSED)
{
- Elm_Toolbar_Item_Data *it;
-
-
- if (sd->lookup_order == order) return;
- sd->lookup_order = order;
- EINA_INLIST_FOREACH(sd->items, it)
- elm_icon_order_lookup_set(it->icon, order);
- if (sd->more_item)
- elm_icon_order_lookup_set(sd->more_item->icon, order);
+ // this method's behaviour has been overridden by elm_config_icon_theme_set
}
-EOLIAN static Elm_Icon_Lookup_Order
-_elm_toolbar_icon_order_lookup_get(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
+EINA_DEPRECATED EOLIAN static Elm_Icon_Lookup_Order
+_elm_toolbar_icon_order_lookup_get(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd EINA_UNUSED)
{
- return sd->lookup_order;
+ return ELM_ICON_LOOKUP_FDO_THEME;
}
EOLIAN static void
diff --git a/src/lib/elementary/elm_toolbar.eo b/src/lib/elementary/elm_toolbar.eo
index 96e5865aba..17af71759c 100644
--- a/src/lib/elementary/elm_toolbar.eo
+++ b/src/lib/elementary/elm_toolbar.eo
@@ -106,7 +106,10 @@ class Elm.Toolbar (Elm.Widget, Elm.Interface_Scrollable,
[[Sets icon lookup order, for toolbar items' icons.
Icons added before calling this function will not be affected.
- The default lookup order is #ELM_ICON_LOOKUP_THEME_FDO.]]
+ The default lookup order is #ELM_ICON_LOOKUP_THEME_FDO.
+
+ Warning: the icon_order_lookup property is deprecated.
+ See elm_config_icon_theme_set instead.]]
set {
}
get {
diff --git a/src/lib/elementary/elm_widget_icon.h b/src/lib/elementary/elm_widget_icon.h
index 477a02b5a3..ab1e7f1ea8 100644
--- a/src/lib/elementary/elm_widget_icon.h
+++ b/src/lib/elementary/elm_widget_icon.h
@@ -24,7 +24,6 @@ struct _Elm_Icon_Data
{
Evas_Object *obj; // the object itself
const char *stdicon;
- Elm_Icon_Lookup_Order lookup_order;
struct
{
diff --git a/src/lib/elementary/elm_widget_toolbar.h b/src/lib/elementary/elm_widget_toolbar.h
index 51be6168ad..79ba5a809e 100644
--- a/src/lib/elementary/elm_widget_toolbar.h
+++ b/src/lib/elementary/elm_widget_toolbar.h
@@ -39,7 +39,6 @@ struct _Elm_Toolbar_Data
Elm_Object_Item *last_focused_item; /**< This records the last focused item when widget looses focus. This is required to set the focus on last focused item when widgets gets focus. */
Elm_Toolbar_Item_Data *reorder_empty, *reorder_item;
Elm_Toolbar_Shrink_Mode shrink_mode;
- Elm_Icon_Lookup_Order lookup_order;
int theme_icon_size, priv_icon_size,
icon_size;
int standard_priority;