summaryrefslogtreecommitdiff
path: root/src/examples/elementary/hoversel_example_01.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-03-01 10:23:32 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-03-01 10:23:32 -0500
commitfe82e6fdad37ddfa93153817efd0541d7ccd0b92 (patch)
tree45a6cdf81f805f7767ddf0eb9830f1a91fc8cf17 /src/examples/elementary/hoversel_example_01.c
parent338fb6451ad087e8b2e795c3717be9cb33b36fae (diff)
elementary: fix string usage in hoversel example.
Summary: Depends on D8073 Reviewers: zmike Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8074
Diffstat (limited to 'src/examples/elementary/hoversel_example_01.c')
-rw-r--r--src/examples/elementary/hoversel_example_01.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/examples/elementary/hoversel_example_01.c b/src/examples/elementary/hoversel_example_01.c
index 289996cf24..7ce97bb503 100644
--- a/src/examples/elementary/hoversel_example_01.c
+++ b/src/examples/elementary/hoversel_example_01.c
@@ -4,7 +4,6 @@
4#include <Elementary.h> 4#include <Elementary.h>
5 5
6static void _print_items(void *data, Evas_Object *obj, void *event_info); 6static void _print_items(void *data, Evas_Object *obj, void *event_info);
7static void _free(void *data, Evas_Object *obj, void *event_info);
8static void _add_item(void *data, Evas_Object *obj, void *event_info); 7static void _add_item(void *data, Evas_Object *obj, void *event_info);
9 8
10static void 9static void
@@ -108,21 +107,12 @@ static void
108_add_item(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 107_add_item(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
109{ 108{
110 static int num = 0; 109 static int num = 0;
111 char *str = malloc(sizeof(char) * 11); 110 Eina_Slstr *str;
112 Elm_Object_Item *hoversel_it;
113 111
114 if(is_eng) 112 if(is_eng)
115 snprintf(str, 11, "item %d", ++num); 113 str = eina_slstr_printf("item %d", ++num);
116 else 114 else
117 snprintf(str, 11, "بند %d", ++num); 115 str = eina_slstr_printf("بند %d", ++num);
118
119 hoversel_it = elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL,
120 str);
121 elm_object_item_del_cb_set(hoversel_it, _free);
122}
123 116
124static void 117 elm_hoversel_item_add(obj, str, NULL, ELM_ICON_NONE, NULL, str);
125_free(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
126{
127 free(data);
128} 118}