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
This commit is contained in:
parent
4c0fc7559c
commit
5bb29101a9
|
@ -1550,6 +1550,7 @@ _config_free(Elm_Config *cfg)
|
||||||
eina_stringshare_del(cfg->indicator_service_90);
|
eina_stringshare_del(cfg->indicator_service_90);
|
||||||
eina_stringshare_del(cfg->indicator_service_180);
|
eina_stringshare_del(cfg->indicator_service_180);
|
||||||
eina_stringshare_del(cfg->indicator_service_270);
|
eina_stringshare_del(cfg->indicator_service_270);
|
||||||
|
eina_stringshare_del(cfg->icon_theme);
|
||||||
free(cfg);
|
free(cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2661,6 +2662,9 @@ elm_config_scale_set(double scale)
|
||||||
EAPI const char *
|
EAPI const char *
|
||||||
elm_config_icon_theme_get(void)
|
elm_config_icon_theme_get(void)
|
||||||
{
|
{
|
||||||
|
if (!_elm_config->icon_theme)
|
||||||
|
return ELM_CONFIG_ICON_THEME_ELEMENTARY;
|
||||||
|
|
||||||
return _elm_config->icon_theme;
|
return _elm_config->icon_theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -446,35 +446,16 @@ _internal_elm_icon_standard_set(Evas_Object *obj,
|
||||||
|
|
||||||
ELM_ICON_DATA_GET(obj, sd);
|
ELM_ICON_DATA_GET(obj, sd);
|
||||||
|
|
||||||
/* try locating the icon using the specified lookup order */
|
/* try locating the icon using the specified theme */
|
||||||
switch (sd->lookup_order)
|
if (!strcmp(ELM_CONFIG_ICON_THEME_ELEMENTARY, elm_config_icon_theme_get()))
|
||||||
|
{
|
||||||
|
ret = _icon_standard_set(obj, name);
|
||||||
|
if (ret && fdo) *fdo = EINA_FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
case ELM_ICON_LOOKUP_FDO:
|
|
||||||
ret = _icon_freedesktop_set(obj, name, _icon_size_min_get(obj));
|
ret = _icon_freedesktop_set(obj, name, _icon_size_min_get(obj));
|
||||||
if (ret && fdo) *fdo = EINA_TRUE;
|
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:
|
|
||||||
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)
|
if (ret)
|
||||||
|
@ -485,13 +466,17 @@ _internal_elm_icon_standard_set(Evas_Object *obj,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_path_is_absolute(name))
|
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,
|
/* if that fails, see if icon name is in the format size/name. if so,
|
||||||
try locating a fallback without the size specification */
|
try locating a fallback without the size specification */
|
||||||
if (!(tmp = strchr(name, '/'))) return EINA_FALSE;
|
if (!(tmp = strchr(name, '/'))) return EINA_FALSE;
|
||||||
++tmp;
|
++tmp;
|
||||||
if (*tmp) return elm_icon_standard_set(obj, tmp);
|
if (*tmp) return _internal_elm_icon_standard_set(obj, tmp, fdo);
|
||||||
/* give up */
|
/* give up */
|
||||||
return EINA_FALSE;
|
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));
|
evas_obj_smart_add(eo_super(obj, MY_CLASS));
|
||||||
elm_widget_sub_object_parent_add(obj);
|
elm_widget_sub_object_parent_add(obj);
|
||||||
|
|
||||||
priv->lookup_order = ELM_ICON_LOOKUP_THEME_FDO;
|
|
||||||
|
|
||||||
priv->thumb.request = NULL;
|
priv->thumb.request = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -774,16 +757,17 @@ _elm_icon_standard_get(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd)
|
||||||
return sd->stdicon;
|
return sd->stdicon;
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EINA_DEPRECATED EOLIAN static void
|
||||||
_elm_icon_order_lookup_set(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd, Elm_Icon_Lookup_Order order)
|
_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
|
EINA_DEPRECATED EOLIAN static Elm_Icon_Lookup_Order
|
||||||
_elm_icon_order_lookup_get(Eo *obj EINA_UNUSED, Elm_Icon_Data *sd)
|
_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
|
EAPI void
|
||||||
|
|
|
@ -10,6 +10,8 @@ enum Elm.Icon.Lookup_Order
|
||||||
{
|
{
|
||||||
[[Lookup order used by elm_icon_standard_set(). Should look for icons in
|
[[Lookup order used by elm_icon_standard_set(). Should look for icons in
|
||||||
the theme, FDO paths, or both?
|
the theme, FDO paths, or both?
|
||||||
|
|
||||||
|
Warning: This enum will be removed as the lookup_order is deprecated.
|
||||||
]]
|
]]
|
||||||
legacy: elm_icon_lookup;
|
legacy: elm_icon_lookup;
|
||||||
fdo_theme, [[Icon look up order: freedesktop, theme.]]
|
fdo_theme, [[Icon look up order: freedesktop, theme.]]
|
||||||
|
@ -24,6 +26,8 @@ class Elm.Icon (Elm.Image)
|
||||||
eo_prefix: elm_obj_icon;
|
eo_prefix: elm_obj_icon;
|
||||||
methods {
|
methods {
|
||||||
@property order_lookup {
|
@property order_lookup {
|
||||||
|
[[Warning: the order_lookup property is deprecated.
|
||||||
|
See elm_config_icon_theme_set instead.]]
|
||||||
set {
|
set {
|
||||||
[[Sets the icon lookup order used by elm_icon_standard_set().
|
[[Sets the icon lookup order used by elm_icon_standard_set().
|
||||||
|
|
||||||
|
|
|
@ -2484,7 +2484,6 @@ _item_new(Evas_Object *obj,
|
||||||
elm_interface_atspi_accessible_type_set(VIEW(it), ELM_ATSPI_TYPE_DISABLED);
|
elm_interface_atspi_accessible_type_set(VIEW(it), ELM_ATSPI_TYPE_DISABLED);
|
||||||
|
|
||||||
icon_obj = elm_icon_add(VIEW(it));
|
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)
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
||||||
_access_widget_item_register(it);
|
_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(obj, EVAS_CALLBACK_MOVE, _move_cb, obj);
|
||||||
evas_object_event_callback_add
|
evas_object_event_callback_add
|
||||||
(priv->bx, EVAS_CALLBACK_RESIZE, _resize_cb, obj);
|
(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);
|
_elm_toolbar_highlight_in_theme(obj);
|
||||||
_sizing_eval(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);
|
icon_obj = elm_icon_add(obj);
|
||||||
elm_icon_order_lookup_set(icon_obj, sd->lookup_order);
|
|
||||||
if (!icon_obj) goto error_state_add;
|
if (!icon_obj) goto error_state_add;
|
||||||
|
|
||||||
if (!_item_icon_set(icon_obj, "toolbar/", icon))
|
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);
|
return eina_list_data_get(prev_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EINA_DEPRECATED EOLIAN static void
|
||||||
_elm_toolbar_icon_order_lookup_set(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd, Elm_Icon_Lookup_Order order)
|
_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;
|
// this method's behaviour has been overridden by elm_config_icon_theme_set
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Elm_Icon_Lookup_Order
|
EINA_DEPRECATED EOLIAN static Elm_Icon_Lookup_Order
|
||||||
_elm_toolbar_icon_order_lookup_get(Eo *obj EINA_UNUSED, Elm_Toolbar_Data *sd)
|
_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
|
EOLIAN static void
|
||||||
|
|
|
@ -106,7 +106,10 @@ class Elm.Toolbar (Elm.Widget, Elm.Interface_Scrollable,
|
||||||
[[Sets icon lookup order, for toolbar items' icons.
|
[[Sets icon lookup order, for toolbar items' icons.
|
||||||
|
|
||||||
Icons added before calling this function will not be affected.
|
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 {
|
set {
|
||||||
}
|
}
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -24,7 +24,6 @@ struct _Elm_Icon_Data
|
||||||
{
|
{
|
||||||
Evas_Object *obj; // the object itself
|
Evas_Object *obj; // the object itself
|
||||||
const char *stdicon;
|
const char *stdicon;
|
||||||
Elm_Icon_Lookup_Order lookup_order;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -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_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_Item_Data *reorder_empty, *reorder_item;
|
||||||
Elm_Toolbar_Shrink_Mode shrink_mode;
|
Elm_Toolbar_Shrink_Mode shrink_mode;
|
||||||
Elm_Icon_Lookup_Order lookup_order;
|
|
||||||
int theme_icon_size, priv_icon_size,
|
int theme_icon_size, priv_icon_size,
|
||||||
icon_size;
|
icon_size;
|
||||||
int standard_priority;
|
int standard_priority;
|
||||||
|
|
Loading…
Reference in New Issue