Improve Fileselector test: all API are exposed in the test now(is_save, folder_only...
authorDavide Andreoli <dave@gurumeditation.it>
Mon, 22 Nov 2010 23:17:56 +0000 (23:17 +0000)
committerDavide Andreoli <dave@gurumeditation.it>
Mon, 22 Nov 2010 23:17:56 +0000 (23:17 +0000)
SVN revision: 54844

legacy/elementary/src/bin/test_fileselector.c

index d3136b0..027ed15 100644 (file)
@@ -39,16 +39,45 @@ _is_save_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNU
 }
 
 static void
+_folder_only_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Evas_Object *fs = data;
+   printf("Toggle Folder only\n");
+   if (elm_fileselector_folder_only_get(fs))
+      elm_fileselector_folder_only_set(fs, EINA_FALSE);
+   else
+      elm_fileselector_folder_only_set(fs, EINA_TRUE);
+}
+
+static void
+_expandable_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Evas_Object *fs = data;
+   printf("Toggle Expandable\n");
+   if (elm_fileselector_expandable_get(fs))
+      elm_fileselector_expandable_set(fs, EINA_FALSE);
+   else
+      elm_fileselector_expandable_set(fs, EINA_TRUE);
+}
+
+static void
 _sel_get_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
    Evas_Object *fs = data;
    printf("Get Selected: %s\n", elm_fileselector_selected_get(fs));
 }
 
+static void
+_path_get_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Evas_Object *fs = data;
+   printf("Get Path: %s\n", elm_fileselector_path_get(fs));
+}
+
 void
 test_fileselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *fs, *bg, *vbox, *hbox, *bt;
+   Evas_Object *win, *fs, *bg, *vbox, *hbox, *bt, *sep;
 
    /* Set the locale according to the system pref.
     * If you dont do so the file selector will order the files list in
@@ -89,23 +118,54 @@ test_fileselector(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *even
    evas_object_smart_callback_add(fs, "selected", my_fileselector_selected, win);
    
    /* test buttons */
+   sep = elm_separator_add(win);
+   elm_separator_horizontal_set(sep, EINA_TRUE);
+   elm_box_pack_end(vbox, sep);
+   evas_object_show(sep);
+
    hbox = elm_box_add(win);
    elm_box_horizontal_set(hbox, EINA_TRUE);
    elm_box_pack_end(vbox, hbox);
    evas_object_show(hbox);
    
-   bt = elm_button_add(win);
-   elm_button_label_set(bt, "Toggle is_save");
-   evas_object_smart_callback_add(bt, "clicked", _is_save_clicked, fs);
+   bt = elm_check_add(win);
+   elm_check_label_set(bt, "is save");
+   elm_check_state_set(bt, elm_fileselector_is_save_get(fs));
+   evas_object_smart_callback_add(bt, "changed", _is_save_clicked, fs);
    elm_box_pack_end(hbox, bt);
    evas_object_show(bt);
    
+   bt = elm_check_add(win);
+   elm_check_label_set(bt, "folder only");
+   elm_check_state_set(bt, elm_fileselector_folder_only_get(fs));
+   evas_object_smart_callback_add(bt, "changed", _folder_only_clicked, fs);
+   elm_box_pack_end(hbox, bt);
+   evas_object_show(bt);
+
+   bt = elm_check_add(win);
+   elm_check_label_set(bt, "expandable");
+   elm_check_state_set(bt, elm_fileselector_expandable_get(fs));
+   evas_object_smart_callback_add(bt, "changed", _expandable_clicked, fs);
+   elm_box_pack_end(hbox, bt);
+   evas_object_show(bt);
+
+   hbox = elm_box_add(win);
+   elm_box_horizontal_set(hbox, EINA_TRUE);
+   elm_box_pack_end(vbox, hbox);
+   evas_object_show(hbox);
+
    bt = elm_button_add(win);
-   elm_button_label_set(bt, "sel get");
+   elm_button_label_set(bt, "selected get");
    evas_object_smart_callback_add(bt, "clicked", _sel_get_clicked, fs);
    elm_box_pack_end(hbox, bt);
    evas_object_show(bt);
 
+   bt = elm_button_add(win);
+   elm_button_label_set(bt, "path get");
+   evas_object_smart_callback_add(bt, "clicked", _path_get_clicked, fs);
+   elm_box_pack_end(hbox, bt);
+   evas_object_show(bt);
+
    evas_object_resize(win, 240, 350);
    evas_object_show(win);
 }