diff options
author | Mike Blumenkrantz <zmike@osg.samsung.com> | 2016-03-22 12:23:51 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@osg.samsung.com> | 2016-03-22 12:23:51 -0400 |
commit | 750aa4644a7bc21b9816852c384eaf052d79a903 (patch) | |
tree | 5e5b2ecec60b17c86e5513200e69141ff7263121 | |
parent | 403e86d67c76aae0a173083ddd8e84fa1b30b2c9 (diff) | |
download | enlightenment-750aa4644a7bc21b9816852c384eaf052d79a903.tar.gz |
rework systray theme applying code
potentially the most overoptimized string handling code I've ever seen.
CID 1039843
-rw-r--r-- | src/modules/systray/e_mod_main.c | 58 |
1 files changed, 8 insertions, 50 deletions
diff --git a/src/modules/systray/e_mod_main.c b/src/modules/systray/e_mod_main.c index dfe230e381..02e8baef62 100644 --- a/src/modules/systray/e_mod_main.c +++ b/src/modules/systray/e_mod_main.c @@ -126,72 +126,30 @@ _systray_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA static void _systray_theme(Evas_Object *o, const char *shelf_style, const char *gc_style) { - const char base_theme[] = "base/theme/modules/systray"; - const char *path = _systray_theme_path(); - char buf[128], *p; - size_t len, avail; - - len = eina_strlcpy(buf, _group_gadget, sizeof(buf)); - if (len >= sizeof(buf)) - goto fallback; - p = buf + len; - *p = '/'; - p++; - avail = sizeof(buf) - len - 2; + char buf[4096]; if (shelf_style && gc_style) { - size_t r; - r = snprintf(p, avail, "%s/%s", shelf_style, gc_style); - if (r < avail && e_theme_edje_object_set(o, base_theme, buf)) + snprintf(buf, sizeof(buf), "%s/%s/%s", _group_gadget, shelf_style, gc_style); + if (e_theme_edje_object_set(o, NULL, buf)) return; } if (shelf_style) { - size_t r; - r = eina_strlcpy(p, shelf_style, avail); - if (r < avail && e_theme_edje_object_set(o, base_theme, buf)) + snprintf(buf, sizeof(buf), "%s/%s", _group_gadget, shelf_style); + if (e_theme_edje_object_set(o, NULL, buf)) return; } if (gc_style) { - size_t r; - r = eina_strlcpy(p, gc_style, avail); - if (r < avail && e_theme_edje_object_set(o, base_theme, buf)) + snprintf(buf, sizeof(buf), "%s/%s", _group_gadget, gc_style); + if (e_theme_edje_object_set(o, NULL, buf)) return; } - if (e_theme_edje_object_set(o, base_theme, _group_gadget)) - return; - - if (shelf_style && gc_style) - { - size_t r; - r = snprintf(p, avail, "%s/%s", shelf_style, gc_style); - if (r < avail && edje_object_file_set(o, path, buf)) - return; - } - - if (shelf_style) - { - size_t r; - r = eina_strlcpy(p, shelf_style, avail); - if (r < avail && edje_object_file_set(o, path, buf)) - return; - } - - if (gc_style) - { - size_t r; - r = eina_strlcpy(p, gc_style, avail); - if (r < avail && edje_object_file_set(o, path, buf)) - return; - } - -fallback: - edje_object_file_set(o, path, _group_gadget); + e_theme_edje_object_set(o, NULL, _group_gadget); } static E_Gadcon_Client * |