summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-07-12 11:24:02 -0700
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-17 21:58:00 +0200
commit33d2e55e9707ac0bbee1adb85ba3de6b7cf712a4 (patch)
treeb8286004e02fa18bccba1bac8d0cee6de16743cb
parent477611f01460f4b9881f2b5dd4b88f463d8f81b0 (diff)
elementary: simplify example by using Efl.Model_Provider.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9307
-rw-r--r--src/examples/elementary/layout_property_bind.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/examples/elementary/layout_property_bind.c b/src/examples/elementary/layout_property_bind.c
index 2b911018ef..d55d94781a 100644
--- a/src/examples/elementary/layout_property_bind.c
+++ b/src/examples/elementary/layout_property_bind.c
@@ -18,6 +18,7 @@ struct _Layout_Model_Data
18{ 18{
19 Eo *fileview; 19 Eo *fileview;
20 Eo *model; 20 Eo *model;
21 Eo *provider;
21 Evas_Object *label; 22 Evas_Object *label;
22 Evas_Object *entry; 23 Evas_Object *entry;
23 Evas_Object *img; 24 Evas_Object *img;
@@ -55,10 +56,7 @@ _list_selected_cb(void *data EINA_UNUSED, const Efl_Event *event)
55 Eo *child = event->info; 56 Eo *child = event->info;
56 57
57 printf("LIST selected model\n"); 58 printf("LIST selected model\n");
58 efl_ui_view_model_set(priv->label, child); 59 efl_ui_view_model_set(priv->provider, child);
59 efl_ui_view_model_set(priv->entry, child);
60 efl_ui_view_model_set(priv->img, child);
61 efl_ui_view_model_set(priv->bt, child);
62} 60}
63 61
64static void 62static void
@@ -140,13 +138,16 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
140 _widget_init(bxr); 138 _widget_init(bxr);
141 elm_object_part_content_set(panes, "right", bxr); 139 elm_object_part_content_set(panes, "right", bxr);
142 140
141 priv->provider = efl_add(EFL_MODEL_PROVIDER_CLASS, win);
142 efl_provider_register(bxr, EFL_MODEL_PROVIDER_CLASS, priv->provider);
143
143 /*Label widget */ 144 /*Label widget */
144 _label_init(win, bxr, "FILENAME:"); 145 _label_init(win, bxr, "FILENAME:");
145 priv->label = _label_init(win, bxr, ""); 146 priv->label = _label_init(win, bxr, "");
146 efl_ui_property_bind(priv->label, "default", "path"); //connect "default" to "filename" property 147 efl_ui_property_bind(priv->label, "default", "path"); //connect "default" to "filename" property
147 148
148 /* Entry widget */ 149 /* Entry widget */
149 priv->entry = elm_entry_add(win); 150 priv->entry = elm_entry_add(bxr);
150 efl_ui_property_bind(priv->entry, "elm.text", "path"); //connect "elm.text" to "path" property 151 efl_ui_property_bind(priv->entry, "elm.text", "path"); //connect "elm.text" to "path" property
151 elm_entry_single_line_set(priv->entry, EINA_TRUE); 152 elm_entry_single_line_set(priv->entry, EINA_TRUE);
152 elm_box_pack_end(bxr, priv->entry); 153 elm_box_pack_end(bxr, priv->entry);
@@ -155,7 +156,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
155 evas_object_show(priv->entry); 156 evas_object_show(priv->entry);
156 157
157 /* Button widget */ 158 /* Button widget */
158 priv->bt = elm_button_add(win); 159 priv->bt = elm_button_add(bxr);
159 elm_box_pack_end(bxr, priv->bt); 160 elm_box_pack_end(bxr, priv->bt);
160 elm_object_text_set(priv->bt, "update model"); 161 elm_object_text_set(priv->bt, "update model");
161 evas_object_smart_callback_add(priv->bt, "clicked", _update_cb, priv); 162 evas_object_smart_callback_add(priv->bt, "clicked", _update_cb, priv);
@@ -164,11 +165,11 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
164 evas_object_show(priv->bt); 165 evas_object_show(priv->bt);
165 166
166 /* Image widget */ 167 /* Image widget */
167 img_factory = efl_add(EFL_UI_IMAGE_FACTORY_CLASS, win); 168 img_factory = efl_add(EFL_UI_IMAGE_FACTORY_CLASS, bxr);
168 efl_ui_property_bind(img_factory, "", "path"); //connect to "path" property 169 efl_ui_property_bind(img_factory, "", "path"); //connect to "path" property
169 efl_ui_factory_bind(priv->bt, "icon", img_factory); 170 efl_ui_factory_bind(priv->bt, "icon", img_factory);
170 171
171 efl_future_then(win, efl_ui_factory_create(img_factory, NULL, win), 172 efl_future_then(win, efl_ui_factory_create(img_factory, NULL, bxr),
172 .success = _wait_for_image, 173 .success = _wait_for_image,
173 .data = priv); 174 .data = priv);
174 175