2 //gcc -g `pkg-config --cflags --libs elementary` thumb_example_01.c -o thumb_example_01
4 #include <Elementary.h>
6 # include "elementary_config.h"
9 # define PACKAGE_DATA_DIR "."
13 _generation_started_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
15 printf("thumbnail generation started.\n");
19 _generation_finished_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
21 printf("thumbnail generation finished.\n");
25 _generation_error_cb(void *data __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__)
27 printf("thumbnail generation error.\n");
31 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
33 Evas_Object *win, *bg;
35 Ethumb_Client *client;
40 win = elm_win_add(NULL, "thumb", ELM_WIN_BASIC);
41 elm_win_title_set(win, "Thumbnailer");
42 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
43 elm_win_autodel_set(win, EINA_TRUE);
46 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
47 elm_win_resize_object_add(win, bg);
50 client = elm_thumb_ethumb_client_get();
53 printf("error: could not get Ethumb client.\n");
56 ethumb_client_size_set(client, 160, 160);
58 thumb = elm_thumb_add(win);
60 evas_object_smart_callback_add(thumb, "generate,start", _generation_started_cb, NULL);
61 evas_object_smart_callback_add(thumb, "generate,stop", _generation_finished_cb, NULL);
62 evas_object_smart_callback_add(thumb, "generate,error", _generation_error_cb, NULL);
64 elm_thumb_editable_set(thumb, EINA_FALSE);
65 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
66 elm_thumb_file_set(thumb, buf, NULL);
67 elm_thumb_reload(thumb);
69 evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
70 elm_win_resize_object_add(win, thumb);
71 evas_object_show(thumb);
73 evas_object_size_hint_min_set(bg, 160, 160);
74 evas_object_size_hint_max_set(bg, 640, 640);
75 evas_object_resize(win, 320, 320);
76 evas_object_show(win);
78 elm_run(); /* and run the program now, starting to handle all
80 elm_shutdown(); /* clean up and shut down */