2 //gcc -g `pkg-config --cflags --libs elementary` thumb_example_01.c -o thumb_example_01
4 #include <Elementary.h>
5 #define PACKAGE_DATA_DIR "."
8 _generation_started_cb(void *data, Evas_Object *o, void *event_info)
10 printf("thumbnail generation started.\n");
14 _generation_finished_cb(void *data, Evas_Object *o, void *event_info)
16 printf("thumbnail generation finished.\n");
20 _generation_error_cb(void *data, Evas_Object *o, void *event_info)
22 printf("thumbnail generation error.\n");
26 elm_main(int argc, char **argv)
28 Evas_Object *win, *bg;
30 Ethumb_Client *client;
35 win = elm_win_add(NULL, "thumb", ELM_WIN_BASIC);
36 elm_win_title_set(win, "Thumbnailer");
37 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
38 elm_win_autodel_set(win, EINA_TRUE);
41 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
42 elm_win_resize_object_add(win, bg);
45 client = elm_thumb_ethumb_client_get();
48 printf("error: could not get Ethumb client.\n");
51 ethumb_client_size_set(client, 160, 160);
53 thumb = elm_thumb_add(win);
55 evas_object_smart_callback_add(thumb, "generate,start", _generation_started_cb, NULL);
56 evas_object_smart_callback_add(thumb, "generate,stop", _generation_finished_cb, NULL);
57 evas_object_smart_callback_add(thumb, "generate,error", _generation_error_cb, NULL);
59 elm_thumb_editable_set(thumb, EINA_FALSE);
60 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
61 elm_thumb_file_set(thumb, buf, NULL);
62 elm_thumb_reload(thumb);
64 evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
65 elm_win_resize_object_add(win, thumb);
66 evas_object_show(thumb);
68 evas_object_size_hint_min_set(bg, 160, 160);
69 evas_object_size_hint_max_set(bg, 640, 640);
70 evas_object_resize(win, 320, 320);
71 evas_object_show(win);
73 elm_run(); /* and run the program now, starting to handle all
75 elm_shutdown(); /* clean up and shut down */