Welcome a new Elementary widget: file selector button.
authorGustavo Lima Chaves <glima@profusion.mobi>
Thu, 8 Apr 2010 20:36:37 +0000 (20:36 +0000)
committerGustavo Lima Chaves <glima@profusion.mobi>
Thu, 8 Apr 2010 20:36:37 +0000 (20:36 +0000)
commit7ac62f3043ada908881cb045625468261dea4c4d
tree62b2231d773bdaadfe5c375257ab47c75f94284a
parentefcb72200299306c913c9f5794b8a7b3ad8b4574
Welcome a new Elementary widget: file selector button.

This is an elm button extended to launch a file selector on click and to callback_call registered funcs
when selection is completed.

Many uses may arise from it, but as a fresh 1st example here comes the first (primitive, but cool) video
player in edje:

externals {
  external: "emotion";
  external: "elm";
}

collections {
  group { name: "main";
     parts {
        part { name: "video";
           type: EXTERNAL;
           source: "emotion";
           description { state: "default" 0;
              rel1 {
                 offset: 10 10;
              }
              rel2 {
                 offset: -11 -61;
              }
              params {
                 choice: "engine" "gstreamer";
              }
           }
        }
        part { name: "play";
           type: RECT;
           description { state: "default" 0;
              color: 0 255 0 128;
              rel1 {
                 relative: 0 1;
                 offset: 10 -51;
              }
              rel2 {
                 relative: 0.3 1;
                 offset: -6 -11;
              }
           }
        }
        part { name: "pause";
           type: RECT;
           description { state: "default" 0;
              color: 255 0 0 128;
              rel1 {
                 relative: 0.3 1;
                 offset: 5 -51;
              }
              rel2 {
                 relative: 0.6 1;
                 offset: -6 -11;
              }
           }
        }

        part { name: "file_sel_btn";
           type: EXTERNAL;
           source: "elm/fileselector_button";
           description { state: "default" 0;
              rel1 {
                 relative: 0.6 1;
                 offset: 5 -51;
              }
              rel2 {
                 offset: -11 -11;
              }
              params {
                 string: "label" "open file";
                 string: "icon" "file";
              }
           }
        }

        programs {
           program {
              signal: "mouse,clicked,1";
              source: "play";
              after: "do_play";
           }
           program {
              name: "do_play";
              action: PARAM_SET "video" "play" "1";
           }
           program {
              signal: "mouse,clicked,1";
              source: "pause";
              action: PARAM_SET "video" "play" "0";
           }
           program {
              signal: "file,chosen";
              source: "file_sel_btn";
              action: PARAM_COPY "file_sel_btn" "path" "video" "file";
              after: "do_play";
           }
        }
     }
  }
}

Enjoy. I've seen bugs on the fileselector itself wrt to list selection logic.
I'll dig into then soon.

SVN revision: 47846
13 files changed:
data/edje_externals/Makefile.am
data/edje_externals/ico_fileselector_button.png [new file with mode: 0644]
data/edje_externals/icons.edc
src/bin/Makefile.am
src/bin/test.c
src/bin/test_fileselector_button.c [new file with mode: 0644]
src/edje_externals/Makefile.am
src/edje_externals/elm_fileselector_button.c [new file with mode: 0644]
src/edje_externals/modules.inc
src/lib/Elementary.h.in
src/lib/Makefile.am
src/lib/elc_fileselector.c
src/lib/elc_fileselector_button.c [new file with mode: 0644]