aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2010-10-25 10:21:14 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2010-10-25 10:21:14 +0000
commit7edb27b10552bf92c626119a9c627fe87df69a76 (patch)
tree72b23aad151551429f69e0e1daa989ebc86a09a8
parentde632e8367d00389619ea1e38383c5ca211dd461 (diff)
downloadenlightenment-7edb27b10552bf92c626119a9c627fe87df69a76.tar.gz
enlightenment-7edb27b10552bf92c626119a9c627fe87df69a76.tar.xz
enlightenment-7edb27b10552bf92c626119a9c627fe87df69a76.zip
update ibar icon to match shelf size
SVN revision: 53852
-rw-r--r--src/bin/e_utils.c48
-rw-r--r--src/bin/e_utils.h3
-rw-r--r--src/modules/ibar/e_mod_main.c10
3 files changed, 60 insertions, 1 deletions
diff --git a/src/bin/e_utils.c b/src/bin/e_utils.c
index 3256d4c45..6b9b92e82 100644
--- a/src/bin/e_utils.c
+++ b/src/bin/e_utils.c
@@ -978,6 +978,26 @@ e_util_icon_add(const char *path, Evas *evas)
return o;
}
+EAPI void
+e_util_icon_file_set(Evas_Object *icon, const char *path)
+{
+ const char *ext;
+
+ if (!path) return;
+ if (!ecore_file_exists(path)) return;
+
+ ext = strrchr(path, '.');
+ if (ext)
+ {
+ if (!strcmp(ext, ".edj"))
+ e_icon_file_edje_set(icon, path, "icon");
+ else
+ e_icon_file_set(icon, path);
+ }
+ else
+ e_icon_file_set(icon, path);
+}
+
EAPI Evas_Object *
e_util_desktop_icon_add(Efreet_Desktop *desktop, unsigned int size, Evas *evas)
{
@@ -985,6 +1005,13 @@ e_util_desktop_icon_add(Efreet_Desktop *desktop, unsigned int size, Evas *evas)
return e_util_icon_theme_icon_add(desktop->icon, size, evas);
}
+EAPI void
+e_util_desktop_icon_file_set(Evas_Object *icon, Efreet_Desktop *desktop, unsigned int size)
+{
+ if ((!desktop) || (!desktop->icon)) return;
+ return e_util_icon_theme_icon_file_set(icon, desktop->icon, size);
+}
+
EAPI Evas_Object *
e_util_icon_theme_icon_add(const char *icon_name, unsigned int size, Evas *evas)
{
@@ -1007,6 +1034,27 @@ e_util_icon_theme_icon_add(const char *icon_name, unsigned int size, Evas *evas)
}
EAPI void
+e_util_icon_theme_icon_file_set(Evas_Object *icon, const char *icon_name, unsigned int size)
+{
+ if (!icon_name) return;
+ if (icon_name[0] == '/')
+ {
+ e_util_icon_file_set(icon, icon_name);
+ }
+ else
+ {
+ char *path;
+
+ path = efreet_icon_path_find(e_config->icon_theme, icon_name, size);
+ if (path)
+ {
+ e_util_icon_file_set(icon, path);
+ free(path);
+ }
+ }
+}
+
+EAPI void
e_util_desktop_menu_item_icon_add(Efreet_Desktop *desktop, unsigned int size, E_Menu_Item *mi)
{
char *path = NULL;
diff --git a/src/bin/e_utils.h b/src/bin/e_utils.h
index 2e96fab0d..65b308ac0 100644
--- a/src/bin/e_utils.h
+++ b/src/bin/e_utils.h
@@ -61,8 +61,11 @@ EAPI char *e_util_file_time_get(time_t ftime);
EAPI void e_util_library_path_strip(void);
EAPI void e_util_library_path_restore(void);
EAPI Evas_Object *e_util_icon_add(const char *path, Evas *evas);
+EAPI void e_util_icon_file_set(Evas_Object *icon, const char *path);
EAPI Evas_Object *e_util_desktop_icon_add(Efreet_Desktop *desktop, unsigned int size, Evas *evas);
+EAPI void e_util_desktop_icon_file_set(Evas_Object *icon, Efreet_Desktop *desktop, unsigned int size);
EAPI Evas_Object *e_util_icon_theme_icon_add(const char *icon_name, unsigned int size, Evas *evas);
+EAPI void e_util_icon_theme_icon_file_set(Evas_Object *icon, const char *icon_name, unsigned int size);
EAPI void e_util_desktop_menu_item_icon_add(Efreet_Desktop *desktop, unsigned int size, E_Menu_Item *mi);
EAPI int e_util_dir_check(const char *dir);
EAPI void e_util_defer_object_del(E_Object *obj);
diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c
index 4a2d266c5..231934a75 100644
--- a/src/modules/ibar/e_mod_main.c
+++ b/src/modules/ibar/e_mod_main.c
@@ -413,6 +413,15 @@ _ibar_resize_handle(IBar *b)
e_box_freeze(b->o_box);
EINA_LIST_FOREACH(b->icons, l, ic)
{
+ if ((w > 0) && (h > 0))
+ {
+ int size;
+
+ size = MAX(w, h);
+ /* TODO: Check icon padding */
+ if (ic->o_icon) e_util_desktop_icon_file_set(ic->o_icon, ic->app, size);
+ if (ic->o_icon2) e_util_desktop_icon_file_set(ic->o_icon2, ic->app, size);
+ }
e_box_pack_options_set(ic->o_holder,
1, 1, /* fill */
0, 0, /* expand */
@@ -589,7 +598,6 @@ _ibar_icon_free(IBar_Icon *ic)
static void
_ibar_icon_fill(IBar_Icon *ic)
{
- /* TODO: Correct icon size! */
if (ic->o_icon) evas_object_del(ic->o_icon);
ic->o_icon = e_util_desktop_icon_add(ic->app, 48,
evas_object_evas_get(ic->ibar->o_box));