From 21d70081948673d573a898164e907e2d79e6d470 Mon Sep 17 00:00:00 2001 From: seoz Date: Fri, 30 Mar 2012 06:34:07 +0000 Subject: [PATCH] elm examples: Removed macro for data dir. Used elm_app_info_set and elm_app_data_dir_get instead. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@69783 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/examples/bg_example_02.c | 8 +++--- src/examples/bg_example_03.c | 10 +++----- src/examples/general_funcs_example.c | 2 +- src/examples/gengrid_example.c | 4 +-- src/examples/icon_example_01.c | 1 - src/examples/image_example_01.c | 1 - src/examples/index_example_02.c | 4 +-- src/examples/layout_example_01.c | 8 +++--- src/examples/layout_example_03.c | 8 +++--- src/examples/map_example_02.c | 50 ++++++++++++++++++++++++------------ src/examples/photocam_example_01.c | 8 +++--- src/examples/popup_example_01.c | 1 - src/examples/popup_example_02.c | 4 +-- src/examples/popup_example_03.c | 4 +-- src/examples/progressbar_example.c | 8 +++--- src/examples/slideshow_example.c | 24 +++++++++-------- src/examples/thumb_example_01.c | 4 +-- src/examples/transit_example_03.c | 7 +++-- src/examples/transit_example_04.c | 8 +++--- src/examples/win_example.c | 6 +++-- 20 files changed, 90 insertions(+), 80 deletions(-) diff --git a/src/examples/bg_example_02.c b/src/examples/bg_example_02.c index ea5905c..eec6101 100644 --- a/src/examples/bg_example_02.c +++ b/src/examples/bg_example_02.c @@ -1,11 +1,8 @@ //Compile with: -//gcc -o bg_example_02 bg_example_02.c -g `pkg-config --cflags --libs elementary` -DDATA_DIR="\"\"" +//gcc -o bg_example_02 bg_example_02.c -g `pkg-config --cflags --libs elementary` //where directory is the a path where images/plant_01.jpg can be found. #include -#ifndef DATA_DIR -# define DATA_DIR "/usr/share/elementary" -#endif static void on_done(void *data, Evas_Object *obj, void *event_info) @@ -20,6 +17,7 @@ elm_main(int argc, char **argv) Evas_Object *win, *bg; char buf[PATH_MAX]; + elm_app_info_set(elm_main, "elementary", "images/plant_01.jpg"); win = elm_win_add(NULL, "bg-image", ELM_WIN_BASIC); elm_win_title_set(win, "Bg Image"); evas_object_smart_callback_add(win, "delete,request", on_done, NULL); @@ -28,7 +26,7 @@ elm_main(int argc, char **argv) bg = elm_bg_add(win); elm_bg_load_size_set(bg, 20, 20); elm_bg_option_set(bg, ELM_BG_OPTION_CENTER); - snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); elm_bg_file_set(bg, buf, NULL); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bg); diff --git a/src/examples/bg_example_03.c b/src/examples/bg_example_03.c index b48ea68..0ffe185 100644 --- a/src/examples/bg_example_03.c +++ b/src/examples/bg_example_03.c @@ -1,11 +1,8 @@ //Compile with: -//gcc -o bg_example_03 bg_example_03.c -g `pkg-config --cflags --libs elementary` -DDATA_DIR="\"\"" +//gcc -o bg_example_03 bg_example_03.c -g `pkg-config --cflags --libs elementary` //where directory is the a path where images/plant_01.jpg can be found. #include -#ifndef DATA_DIR -# define DATA_DIR "/usr/share/elementary" -#endif static void on_done(void *data, Evas_Object *obj, void *event_info) @@ -32,7 +29,7 @@ _cb_overlay_changed(void *data, Evas_Object *obj, void *event) Evas_Object *parent, *over; char buff[PATH_MAX]; - snprintf(buff, sizeof(buff), "%s/objects/test.edj", DATA_DIR); + snprintf(buff, sizeof(buff), "%s/objects/test.edj", elm_app_data_dir_get()); parent = elm_object_parent_widget_get(o_bg); over = edje_object_add(evas_object_evas_get(parent)); edje_object_file_set(over, buff, "bg_overlay"); @@ -67,6 +64,7 @@ elm_main(int argc, char **argv) Evas_Object *rd, *rdg; char buf[PATH_MAX]; + elm_app_info_set(elm_main, "elementary", "objects/test.edj"); win = elm_win_add(NULL, "bg-options", ELM_WIN_BASIC); elm_win_title_set(win, "Bg Options"); evas_object_smart_callback_add(win, "delete,request", on_done, NULL); @@ -83,7 +81,7 @@ elm_main(int argc, char **argv) evas_object_show(box); o_bg = elm_bg_add(win); - snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); elm_bg_file_set(o_bg, buf, NULL); evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL); diff --git a/src/examples/general_funcs_example.c b/src/examples/general_funcs_example.c index 6ad2749..626c272 100644 --- a/src/examples/general_funcs_example.c +++ b/src/examples/general_funcs_example.c @@ -6,7 +6,7 @@ #define BIN_DIR "/usr/bin" #define LIB_DIR "/usr/lib" -#define DATA_DIR "/usr/share/elementary" +#define DATA_DIR "/usr/local/share/elementary" #define WIDTH 300 #define HEIGHT 300 diff --git a/src/examples/gengrid_example.c b/src/examples/gengrid_example.c index e83357f..e3b345d 100644 --- a/src/examples/gengrid_example.c +++ b/src/examples/gengrid_example.c @@ -10,7 +10,6 @@ */ #include -#define DATA_DIR "../../data" typedef struct _Example_Item { @@ -325,7 +324,7 @@ _grid_content_get(void *data, Evas_Object *icon = elm_bg_add(obj); char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), "%s/images/%s", DATA_DIR, + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), it->path); elm_bg_file_set(icon, buf, NULL); @@ -431,6 +430,7 @@ elm_main(int argc, srand(time(NULL)); + elm_app_info_set(elm_main, "elementary", "images"); win = elm_win_add(NULL, "gengrid", ELM_WIN_BASIC); elm_win_title_set(win, "Generic Grid Example"); evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); diff --git a/src/examples/icon_example_01.c b/src/examples/icon_example_01.c index 729741d..daad19f 100644 --- a/src/examples/icon_example_01.c +++ b/src/examples/icon_example_01.c @@ -2,7 +2,6 @@ //gcc -g image_example_01.c -o image_example_01 `pkg-config --cflags --libs elementary` #include -#define DATA_DIR "." EAPI_MAIN int elm_main(int argc, char **argv) diff --git a/src/examples/image_example_01.c b/src/examples/image_example_01.c index b0daaeb..c61f76c 100644 --- a/src/examples/image_example_01.c +++ b/src/examples/image_example_01.c @@ -2,7 +2,6 @@ //gcc -g image_example_01.c -o image_example_01 `pkg-config --cflags --libs elementary` #include -#define DATA_DIR "." int elm_main(int argc, char **argv) diff --git a/src/examples/index_example_02.c b/src/examples/index_example_02.c index bb4bdbb..ff2acde 100644 --- a/src/examples/index_example_02.c +++ b/src/examples/index_example_02.c @@ -10,7 +10,6 @@ */ #include -#define DATA_DIR "../../data" static const char *items[] = \ { @@ -58,7 +57,7 @@ _grid_content_get(void *data, if (!strcmp(part, "elm.swallow.icon")) { char buf[PATH_MAX]; - snprintf(buf, sizeof(buf), "%s/images/%s", DATA_DIR, + snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(), "sky_01.jpg"); Evas_Object *icon = elm_bg_add(obj); @@ -98,6 +97,7 @@ elm_main(int argc, Elm_Gengrid_Item_Class gic; + elm_app_info_set(elm_main, "elementary", "images"); win = elm_win_add(NULL, "index", ELM_WIN_BASIC); elm_win_title_set(win, "Index Example"); evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); diff --git a/src/examples/layout_example_01.c b/src/examples/layout_example_01.c index 7e145d0..dfe3865 100644 --- a/src/examples/layout_example_01.c +++ b/src/examples/layout_example_01.c @@ -2,7 +2,6 @@ //gcc -g layout_example_01.c -o layout_example_01 `pkg-config --cflags --libs elementary` #include -#define DATA_DIR "." #define TABLE "example/table" #define BOX "example/box" @@ -57,7 +56,9 @@ elm_main(int argc, char **argv) Evas_Object *win, *bg, *icon, *icon2, *bt, *bt2, *layout; Evas_Object *clk; Evas_Object *item; + char buf[PATH_MAX]; + elm_app_info_set(elm_main, "elementary", "examples/layout_example.edj"); win = elm_win_add(NULL, "layout", ELM_WIN_BASIC); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); @@ -72,9 +73,8 @@ elm_main(int argc, char **argv) layout = elm_layout_add(win); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, layout); - elm_layout_file_set( - layout, DATA_DIR "/examples/layout_example.edj", - "example/mylayout"); + snprintf(buf, sizeof(buf), "%s/examples/layout_example.edj", elm_app_data_dir_get()); + elm_layout_file_set(layout, buf, "example/mylayout"); evas_object_show(layout); // Setting title diff --git a/src/examples/layout_example_03.c b/src/examples/layout_example_03.c index deab605..8c4c7b7 100644 --- a/src/examples/layout_example_03.c +++ b/src/examples/layout_example_03.c @@ -2,7 +2,6 @@ //gcc -g layout_example_03.c -o layout_example_03 `pkg-config --cflags --libs elementary` #include -#define DATA_DIR "." #define TITLE "example/title" #define SWALLOW "example/custom" @@ -44,7 +43,9 @@ EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *btn, *layout; + char buf[PATH_MAX]; + elm_app_info_set(elm_main, "elementary", "examples/layout_example.edj"); win = elm_win_add(NULL, "layout", ELM_WIN_BASIC); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_win_autodel_set(win, EINA_TRUE); @@ -59,9 +60,8 @@ elm_main(int argc, char **argv) layout = elm_layout_add(win); evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, layout); - elm_layout_file_set( - layout, DATA_DIR "/examples/layout_example.edj", - "example/mylayout3"); + snprintf(buf, sizeof(buf), "%s/examples/layout_example.edj", elm_app_data_dir_get()); + elm_layout_file_set(layout, buf, "example/mylayout3"); evas_object_show(layout); elm_object_signal_callback_add(layout, "size,changed", "", _size_changed_cb, layout); diff --git a/src/examples/map_example_02.c b/src/examples/map_example_02.c index 01db542..43e300a 100644 --- a/src/examples/map_example_02.c +++ b/src/examples/map_example_02.c @@ -10,9 +10,6 @@ */ #include -#ifndef DATA_DIR -# define DATA_DIR "/usr/share/elementary" -#endif typedef struct _Overlay_Data { @@ -20,18 +17,14 @@ typedef struct _Overlay_Data const char *file; } Overlay_Data; -Overlay_Data data_argentina = {"Argentina", - DATA_DIR"/images/rock_01.jpg"}; -Overlay_Data data_chile = {"Chile", - DATA_DIR"/images/rock_02.jpg"}; -Overlay_Data data_sampa = {"São Paulo", - DATA_DIR"/images/sky_01.jpg"}; -Overlay_Data data_rio = {"Rio de Janeiro", - DATA_DIR"/images/sky_02.jpg"}; -Overlay_Data data_brasilia = {"Brasília", - DATA_DIR"/images/sky_03.jpg"}; +Overlay_Data data_argentina = {"Argentina", NULL}; +Overlay_Data data_chile = {"Chile", NULL}; +Overlay_Data data_sampa = {"São Paulo", NULL}; +Overlay_Data data_rio = {"Rio de Janeiro", NULL}; +Overlay_Data data_brasilia = {"Brasília", NULL}; static Elm_Map_Overlay *bubble; +const char *data_dir; static Evas_Object * _icon_get(Evas_Object *obj, const char *file) @@ -45,25 +38,33 @@ _icon_get(Evas_Object *obj, const char *file) static Evas_Object * _city_icon_get(Evas_Object *obj) { - return _icon_get(obj, DATA_DIR"/images/icon_07.png"); + char buf[256]; + snprintf(buf, sizeof(buf), "%s/images/icon_07.png", data_dir); + return _icon_get(obj, buf); } static Evas_Object * _clas_city_icon_get(Evas_Object *obj) { - return _icon_get(obj, DATA_DIR"/images/icon_05.png"); + char buf[256]; + snprintf(buf, sizeof(buf), "%s/images/icon_05.png", data_dir); + return _icon_get(obj, buf); } static Evas_Object * _country_icon_get(Evas_Object *obj) { - return _icon_get(obj, DATA_DIR"/images/icon_06.png"); + char buf[256]; + snprintf(buf, sizeof(buf), "%s/images/icon_06.png", data_dir); + return _icon_get(obj, buf); } static Evas_Object * _clas_country_icon_get(Evas_Object *obj) { - return _icon_get(obj, DATA_DIR"/images/icon_04.png"); + char buf[256]; + snprintf(buf, sizeof(buf), "%s/images/icon_04.png", data_dir); + return _icon_get(obj, buf); } static Evas_Object * @@ -164,6 +165,21 @@ elm_main(int argc, char **argv) Evas_Object *win, *bg, *map, *box, *bt; Eina_List *ovls = NULL; Elm_Map_Overlay *ovl, *city_clas, *country_clas; + char buf[255]; + + elm_app_info_set(elm_main, "elementary", "images"); + data_dir = elm_app_data_dir_get(); + + snprintf(buf, sizeof(buf), "%s/images/rock_01.jpg", "sdf"); + data_argentina.file = strdup(buf); + snprintf(buf, sizeof(buf), "%s/images/rock_02.jpg", "sdf"); + data_chile.file = strdup(buf); + snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", "sdf"); + data_sampa.file = strdup(buf); + snprintf(buf, sizeof(buf), "%s/images/sky_02.jpg", "sdf"); + data_rio.file = strdup(buf); + snprintf(buf, sizeof(buf), "%s/images/sky_03.jpg", "sdf"); + data_brasilia.file = strdup(buf); win = elm_win_add(NULL, "map", ELM_WIN_BASIC); elm_win_title_set(win, "Map Overlay Example"); diff --git a/src/examples/photocam_example_01.c b/src/examples/photocam_example_01.c index 1dfdf7c..3bdec8e 100644 --- a/src/examples/photocam_example_01.c +++ b/src/examples/photocam_example_01.c @@ -3,9 +3,6 @@ //where directory is the path where images/insanely_huge_test_image.jpg can be found. #include -#ifndef DATA_DIR -# define DATA_DIR "/usr/share/elementary" -#endif static void _fit(void *data, Evas_Object *obj, void *event_info); static void _unfit(void *data, Evas_Object *obj, void *event_info); @@ -16,7 +13,9 @@ EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *obj, *photocam; + char buf[PATH_MAX]; + elm_app_info_set(elm_main, "elementary", "images/insanely_huge_test_image.jpg"); win = elm_win_add(NULL, "photocam", ELM_WIN_BASIC); elm_win_title_set(win, "Photocam"); elm_win_autodel_set(win, EINA_TRUE); @@ -28,7 +27,8 @@ elm_main(int argc, char **argv) evas_object_show(bg); photocam = elm_photocam_add(win); - elm_photocam_file_set(photocam, DATA_DIR"/images/insanely_huge_test_image.jpg"); + snprintf(buf, sizeof(buf), "%s/images/insanely_huge_test_image.jpg", elm_app_data_dir_get()); + elm_photocam_file_set(photocam, buf); elm_photocam_bounce_set(photocam, EINA_FALSE, EINA_TRUE); evas_object_smart_callback_add(photocam, "loaded,detail", _bring_in, NULL); evas_object_resize(photocam, 500, 400); diff --git a/src/examples/popup_example_01.c b/src/examples/popup_example_01.c index fa8d964..ee98726 100644 --- a/src/examples/popup_example_01.c +++ b/src/examples/popup_example_01.c @@ -2,7 +2,6 @@ //gcc -o popup_example_01 popup_example_01.c -g `pkg-config --cflags --libs elementary` #include -#define DATA_DIR "../../data" static void _block_clicked(void *data, Evas_Object *obj, void *event_info); static void _timeout(void *data, Evas_Object *obj, void *event_info); diff --git a/src/examples/popup_example_02.c b/src/examples/popup_example_02.c index 0f839d3..b66e05f 100644 --- a/src/examples/popup_example_02.c +++ b/src/examples/popup_example_02.c @@ -2,7 +2,6 @@ //gcc -o popup_example_02 popup_example_02.c -g `pkg-config --cflags --libs elementary` #include -#define DATA_DIR "../../data" static void _response_cb(void *data, Evas_Object *obj, void *event_info); @@ -12,6 +11,7 @@ elm_main(int argc, char **argv) Evas_Object *win, *bg, *popup, *btn1, *btn2, *btn3, *icon1; char buf[256]; + elm_app_info_set(elm_main, "elementary", "images/logo_small.png"); win = elm_win_add(NULL, "popup", ELM_WIN_BASIC); elm_win_title_set(win, "Popup"); elm_win_autodel_set(win, EINA_TRUE); @@ -34,7 +34,7 @@ elm_main(int argc, char **argv) elm_object_part_text_set(popup, "title,text", "Title"); icon1 = elm_icon_add(popup); - snprintf(buf, sizeof(buf), "%s/images/logo_small.png", DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); elm_icon_file_set(icon1, buf, NULL); //Setting popup title-icon elm_object_part_content_set(popup, "title,icon", icon1); diff --git a/src/examples/popup_example_03.c b/src/examples/popup_example_03.c index 175a884..97f09c9 100644 --- a/src/examples/popup_example_03.c +++ b/src/examples/popup_example_03.c @@ -2,7 +2,6 @@ //gcc -o popup_example_03 popup_example_03.c -g `pkg-config --cflags --libs elementary` #include -#define DATA_DIR "../../data" static void _item_selected_cb(void *data, Evas_Object *obj, void *event_info); static void _response_cb(void *data, Evas_Object *obj, void *event_info); @@ -14,6 +13,7 @@ elm_main(int argc, char **argv) Elm_Object_Item *popup_it1; char buf[256]; + elm_app_info_set(elm_main, "elementary", "images/logo_small.png"); win = elm_win_add(NULL, "popup", ELM_WIN_BASIC); elm_win_title_set(win, "Popup"); elm_win_autodel_set(win, EINA_TRUE); @@ -27,7 +27,7 @@ elm_main(int argc, char **argv) popup = elm_popup_add(win); icon1 = elm_icon_add(popup); - snprintf(buf, sizeof(buf), "%s/images/logo_small.png", DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); elm_icon_file_set(icon1, buf, NULL); //Seting popup title-text diff --git a/src/examples/progressbar_example.c b/src/examples/progressbar_example.c index ea254de..f7341a2 100644 --- a/src/examples/progressbar_example.c +++ b/src/examples/progressbar_example.c @@ -5,14 +5,11 @@ * See stdout/stderr for output. Compile with: * * @verbatim - * gcc -g progressbar_example.c -o progressbar_example `pkg-config --cflags --libs elementary` -DDATA_DIR="\"\"" + * gcc -g progressbar_example.c -o progressbar_example `pkg-config --cflags --libs elementary` * @endverbatim */ #include -#ifndef DATA_DIR -# define DATA_DIR "/usr/share/elementary" -#endif typedef struct Progressbar_Example { @@ -101,6 +98,7 @@ elm_main(int argc, Evas_Object *win, *bg, *pb, *bx, *hbx, *bt, *bt_bx, *ic1, *ic2; char buf[PATH_MAX]; + elm_app_info_set(elm_main, "elementary", "images/logo_small.png"); win = elm_win_add(NULL, "progressbar", ELM_WIN_BASIC); elm_win_title_set(win, "Progress bar example"); evas_object_smart_callback_add(win, "delete,request", _on_done, NULL); @@ -134,7 +132,7 @@ elm_main(int argc, example_data.pb2 = pb; ic1 = elm_icon_add(win); - snprintf(buf, sizeof(buf), "%s/images/logo_small.png", DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); elm_icon_file_set(ic1, buf, NULL); evas_object_size_hint_aspect_set(ic1, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); diff --git a/src/examples/slideshow_example.c b/src/examples/slideshow_example.c index ec4f5bf..db011b8 100644 --- a/src/examples/slideshow_example.c +++ b/src/examples/slideshow_example.c @@ -10,7 +10,6 @@ */ #include -#define DATA_DIR "../../data" static void _on_done(void *data, @@ -23,15 +22,7 @@ _on_done(void *data, static Evas_Object *slideshow, *bt_start, *bt_stop; static Elm_Slideshow_Item_Class itc; -static const char *img1 = DATA_DIR "/images/logo.png"; -static const char *img2 = DATA_DIR "/images/plant_01.jpg"; -static const char *img3 = DATA_DIR "/images/rock_01.jpg"; -static const char *img4 = DATA_DIR "/images/rock_02.jpg"; -static const char *img5 = DATA_DIR "/images/sky_01.jpg"; -static const char *img6 = DATA_DIR "/images/sky_04.jpg"; -static const char *img7 = DATA_DIR "/images/wood_01.jpg"; -static const char *img8 = DATA_DIR "/images/mystrale.jpg"; -static const char *img9 = DATA_DIR "/images/mystrale_2.jpg"; +static char img1[256], img2[256], img3[256], img4[256], img5[256], img6[256], img7[256], img8[256], img9[256]; static void _notify_show(void *data, @@ -182,6 +173,19 @@ elm_main(int argc, Elm_Object_Item *slide_first, *slide_last, *slide_it; const char *transition, *layout; const Eina_List *l, *list; + const char *data_dir; + + elm_app_info_set(elm_main, "elementary", "images"); + data_dir = elm_app_data_dir_get(); + snprintf(img1, sizeof(img1), "%s/images/logo.png", data_dir); + snprintf(img2, sizeof(img2), "%s/images/plant_01.jpg", data_dir); + snprintf(img3, sizeof(img3), "%s/images/rock_01.jpg", data_dir); + snprintf(img4, sizeof(img4), "%s/images/rock_02.jpg", data_dir); + snprintf(img5, sizeof(img5), "%s/images/sky_01.jpg", data_dir); + snprintf(img6, sizeof(img6), "%s/images/sky_04.jpg", data_dir); + snprintf(img7, sizeof(img7), "%s/images/wood_01.jpg", data_dir); + snprintf(img8, sizeof(img8), "%s/images/mystrale.jpg", data_dir); + snprintf(img9, sizeof(img9), "%s/images/mystrale_2.jpg", data_dir); win = elm_win_add(NULL, "slideshow", ELM_WIN_BASIC); elm_win_title_set(win, "Slideshow example"); diff --git a/src/examples/thumb_example_01.c b/src/examples/thumb_example_01.c index 7e388e6..ae4c219 100644 --- a/src/examples/thumb_example_01.c +++ b/src/examples/thumb_example_01.c @@ -2,7 +2,6 @@ //gcc -g thumb_example_01.c -o thumb_example_01 `pkg-config --cflags --libs elementary` #include -#define DATA_DIR "." static void _generation_started_cb(void *data, Evas_Object *o, void *event_info) @@ -32,6 +31,7 @@ elm_main(int argc, char **argv) elm_need_ethumb(); + elm_app_info_set(elm_main, "elementary", "images/plant_01.jpg"); win = elm_win_add(NULL, "thumb", ELM_WIN_BASIC); elm_win_title_set(win, "Thumbnailer"); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); @@ -57,7 +57,7 @@ elm_main(int argc, char **argv) evas_object_smart_callback_add(thumb, "generate,error", _generation_error_cb, NULL); elm_thumb_editable_set(thumb, EINA_FALSE); - snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); elm_thumb_file_set(thumb, buf, NULL); elm_thumb_reload(thumb); diff --git a/src/examples/transit_example_03.c b/src/examples/transit_example_03.c index 3ae2564..0bfc8fd 100644 --- a/src/examples/transit_example_03.c +++ b/src/examples/transit_example_03.c @@ -3,9 +3,6 @@ //where directory is the a path where images/icon_07.png can be found. #include -#ifndef DATA_DIR -# define DATA_DIR "/usr/share/elementary" -#endif /* structure to hold context for many callbacks */ struct Context { @@ -188,6 +185,8 @@ elm_main(int argc, char **argv) context.repeat_times = 0; context.tween_mode = ELM_TRANSIT_TWEEN_MODE_LINEAR; + elm_app_info_set(elm_main, "elementary", "images/icon_07.png"); + /* add a window */ win = elm_win_add(NULL, "transit", ELM_WIN_BASIC); elm_win_title_set(win, "Transit Example"); @@ -222,7 +221,7 @@ elm_main(int argc, char **argv) obj = elm_button_add(win); elm_object_text_set(obj, "Transformed object!"); icon = elm_icon_add(win); - snprintf(buf, sizeof(buf), "%s/images/icon_07.png", DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/icon_07.png", elm_app_data_dir_get()); elm_icon_file_set(icon, buf, NULL); elm_object_part_content_set(obj, "icon", icon); evas_object_move(obj, 160, 60); diff --git a/src/examples/transit_example_04.c b/src/examples/transit_example_04.c index c9a5aca..cf0338f 100644 --- a/src/examples/transit_example_04.c +++ b/src/examples/transit_example_04.c @@ -3,9 +3,6 @@ //where directory is the a path where images/icon_07.png can be found. #include -#ifndef DATA_DIR -# define DATA_DIR "/usr/share/elementary" -#endif static void _transit_flip(Elm_Transit *trans) @@ -96,6 +93,7 @@ elm_main(int argc, char **argv) char buf[PATH_MAX]; int i; + elm_app_info_set(elm_main, "elementary", "images/icon_07.png"); /* add a window */ win = elm_win_add(NULL, "transit", ELM_WIN_BASIC); elm_win_title_set(win, "Transit Example"); @@ -126,7 +124,7 @@ elm_main(int argc, char **argv) obj = elm_button_add(win); elm_object_text_set(obj, "Transformed object!"); icon = elm_icon_add(win); - snprintf(buf, sizeof(buf), "%s/images/icon_07.png", DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/icon_07.png", elm_app_data_dir_get()); elm_icon_file_set(icon, buf, NULL); elm_object_part_content_set(obj, "icon", icon); evas_object_move(obj, 160, 60); @@ -139,7 +137,7 @@ elm_main(int argc, char **argv) obj = elm_button_add(win); elm_object_text_set(obj, "Another object!"); icon = elm_icon_add(win); - snprintf(buf, sizeof(buf), "%s/images/icon_08.png", DATA_DIR); + snprintf(buf, sizeof(buf), "%s/images/icon_08.png", elm_app_data_dir_get()); elm_icon_file_set(icon, buf, NULL); elm_object_part_content_set(obj, "icon", icon); evas_object_move(obj, 160, 60); diff --git a/src/examples/win_example.c b/src/examples/win_example.c index f97ec76..87e985d 100644 --- a/src/examples/win_example.c +++ b/src/examples/win_example.c @@ -6,7 +6,6 @@ #endif #include -#define DATA_DIR "../../data" static void _btn_activate_cb(void *data, Evas_Object *obj, void *event) @@ -173,7 +172,9 @@ EAPI_MAIN int elm_main(int argc, char *argv[]) { Evas_Object *win, *win2, *bg, *bigbox, *box, *btn, *o; + char buf[256]; + elm_app_info_set(elm_main, "elementary", "images/logo.png"); win = elm_win_add(NULL, "win-example", ELM_WIN_BASIC); elm_win_title_set(win, "Elm_Win Example"); elm_win_focus_highlight_enabled_set(win, EINA_TRUE); @@ -210,7 +211,8 @@ elm_main(int argc, char *argv[]) evas_object_smart_callback_add(win2, "focus,in", _win_focused_cb, "managed"); o = elm_icon_add(win2); - elm_icon_file_set(o, DATA_DIR "/images/logo.png", NULL); + sprintf(buf, "%s/images/logo.png", elm_app_data_dir_get()); + elm_icon_file_set(o, buf, NULL); elm_icon_resizable_set(o, 0, 0); elm_icon_no_scale_set(o, EINA_TRUE); elm_win_resize_object_add(win2, o); -- 2.7.4