Merge "gengrid TC modified"
[framework/uifw/elementary.git] / tests / src / examples / thumb_example_01.c
1 //Compile with:
2 //gcc -g `pkg-config --cflags --libs elementary` thumb_example_01.c -o thumb_example_01
3
4 #include <Elementary.h>
5 #ifdef HAVE_CONFIG_H
6 # include "elementary_config.h"
7 #else
8 # define __UNUSED__
9 # define PACKAGE_DATA_DIR "."
10 #endif
11
12 static void
13 _generation_started_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
14 {
15    printf("thumbnail generation started.\n");
16 }
17
18 static void
19 _generation_finished_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
20 {
21    printf("thumbnail generation finished.\n");
22 }
23
24 static void
25 _generation_error_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
26 {
27    printf("thumbnail generation error.\n");
28 }
29
30 int
31 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
32 {
33 #if 0
34    Evas_Object *win, *bg;
35    Evas_Object *thumb;
36    Ethumb_Client *client;
37    char buf[PATH_MAX];
38
39    elm_need_ethumb();
40
41    win = elm_win_add(NULL, "thumb", ELM_WIN_BASIC);
42    elm_win_title_set(win, "Thumbnailer");
43    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
44    elm_win_autodel_set(win, EINA_TRUE);
45
46    bg = elm_bg_add(win);
47    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
48    elm_win_resize_object_add(win, bg);
49    evas_object_show(bg);
50
51    client = elm_thumb_ethumb_client_get();
52    if (!client)
53      {
54         printf("error: could not get Ethumb client.\n");
55         return 1;
56      }
57    ethumb_client_size_set(client, 160, 160);
58
59    thumb = elm_thumb_add(win);
60
61    evas_object_smart_callback_add(thumb, "generate,start", _generation_started_cb, NULL);
62    evas_object_smart_callback_add(thumb, "generate,stop", _generation_finished_cb, NULL);
63    evas_object_smart_callback_add(thumb, "generate,error", _generation_error_cb, NULL);
64
65    elm_thumb_editable_set(thumb, EINA_FALSE);
66    snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
67    elm_thumb_file_set(thumb, buf, NULL);
68    elm_thumb_reload(thumb);
69
70    evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
71    elm_win_resize_object_add(win, thumb);
72    evas_object_show(thumb);
73
74    evas_object_size_hint_min_set(bg, 160, 160);
75    evas_object_size_hint_max_set(bg, 640, 640);
76    evas_object_resize(win, 320, 320);
77    evas_object_show(win);
78
79    elm_run(); /* and run the program now, starting to handle all
80                * events, etc. */
81    elm_shutdown(); /* clean up and shut down */
82 #endif
83    /* exit code */
84    return 0;
85 }
86
87 ELM_MAIN()