diff options
Diffstat (limited to 'src/examples/elementary/filemvc.c')
-rw-r--r-- | src/examples/elementary/filemvc.c | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/src/examples/elementary/filemvc.c b/src/examples/elementary/filemvc.c index f09657bafc..6935e9387b 100644 --- a/src/examples/elementary/filemvc.c +++ b/src/examples/elementary/filemvc.c @@ -35,15 +35,14 @@ _cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void efl_unref(priv->fileview); efl_unref(priv->treeview); efl_unref(priv->formview); - efl_unref(priv->treemodel); } -static Eina_Bool -_filter_cb(void *data EINA_UNUSED, Eio_File *handler EINA_UNUSED, const Eina_File_Direct_Info *info) +static int +_filter_cb(void *data EINA_UNUSED, Eio_Model *model, Eina_File_Direct_Info *info) { - if (info->type == EINA_FILE_DIR && info->path[info->name_start] != '.') return EINA_TRUE; + if (info->type == EINA_FILE_DIR && info->path[info->name_start] != '.') return 1; - return EINA_FALSE; + return 0; } static void @@ -58,39 +57,14 @@ _list_selected_cb(void *data EINA_UNUSED, const Efl_Event *event) } static void -_promise_then(void *data, const Efl_Event *event) -{ - Efl_Model_Test_Filemvc_Data *priv = data; - char *path; - Eo *model; - Efl_Future_Event_Success* info = event->info; - Eina_Value* value = info->value; - - eina_value_get(value, &path); - model = efl_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(efl_added, path)); - elm_view_list_model_set(priv->fileview, model); -} - -static void -_promise_error(void *data EINA_UNUSED, const Efl_Event* err EINA_UNUSED) -{ - printf("Promise error!\n"); -} - -static void _tree_selected_cb(void *data, const Efl_Event *event) { Efl_Model_Test_Filemvc_Data *priv = data; Eo *child = event->info; - Efl_Future *f; printf("TREE selected model\n"); - f = efl_model_property_get(child, "path"); - efl_ref(f); - efl_future_then(f, &_promise_then, &_promise_error, NULL, priv); - efl_future_link(event->object, f); - efl_unref(f); + elm_view_list_model_set(priv->fileview, child); } static void @@ -150,12 +124,12 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) else dirname = EFL_MODEL_TEST_FILENAME_PATH; //treemodel - priv.treemodel = efl_add(EIO_MODEL_CLASS, NULL, eio_model_path_set(efl_added, dirname)); - eio_model_children_filter_set(priv.treemodel, _filter_cb, NULL); + priv.treemodel = efl_add(EIO_MODEL_CLASS, win, eio_model_path_set(efl_added, dirname)); + eio_model_children_filter_set(priv.treemodel, NULL, _filter_cb, NULL); //treeview genlist = elm_genlist_add(win); - priv.treeview = efl_add(ELM_VIEW_LIST_CLASS, NULL, elm_view_list_genlist_set(efl_added, genlist, ELM_GENLIST_ITEM_TREE, NULL)); + priv.treeview = efl_add_ref(ELM_VIEW_LIST_CLASS, NULL, elm_view_list_genlist_set(efl_added, genlist, ELM_GENLIST_ITEM_TREE, NULL)); elm_view_list_property_connect(priv.treeview, "filename", "elm.text"); elm_view_list_property_connect(priv.treeview, "icon", "elm.swallow.icon"); elm_view_list_model_set(priv.treeview, priv.treemodel); @@ -170,7 +144,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) //listview genlist = elm_genlist_add(win); - priv.fileview = efl_add(ELM_VIEW_LIST_CLASS, NULL, elm_view_list_genlist_set(efl_added, genlist, ELM_GENLIST_ITEM_NONE, "double_label")); + priv.fileview = efl_add_ref(ELM_VIEW_LIST_CLASS, NULL, elm_view_list_genlist_set(efl_added, genlist, ELM_GENLIST_ITEM_NONE, "double_label")); elm_view_list_property_connect(priv.fileview, "filename", "elm.text"); elm_view_list_property_connect(priv.fileview, "mime_type", "elm.text.sub"); @@ -184,7 +158,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) bxr = elm_box_add(win); _widget_init(bxr); elm_object_part_content_set(vpanes, "right", bxr); - priv.formview = efl_add(ELM_VIEW_FORM_CLASS, NULL); + priv.formview = efl_add_ref(ELM_VIEW_FORM_CLASS, NULL); /*Label widget */ elm_view_form_widget_add(priv.formview, "filename", _label_init(win, bxr, "File Name")); |