2 //gcc -g thumb_example_01.c -o thumb_example_01 `pkg-config --cflags --libs elementary`
4 #include <Elementary.h>
7 _generation_started_cb(void *data, Evas_Object *o, void *event_info)
9 printf("thumbnail generation started.\n");
13 _generation_finished_cb(void *data, Evas_Object *o, void *event_info)
15 printf("thumbnail generation finished.\n");
19 _generation_error_cb(void *data, Evas_Object *o, void *event_info)
21 printf("thumbnail generation error.\n");
25 elm_main(int argc, char **argv)
27 Evas_Object *win, *bg;
31 Ethumb_Client *client;
36 elm_app_info_set(elm_main, "elementary", "images/plant_01.jpg");
37 win = elm_win_add(NULL, "thumb", ELM_WIN_BASIC);
38 elm_win_title_set(win, "Thumbnailer");
39 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
40 elm_win_autodel_set(win, EINA_TRUE);
43 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
44 elm_win_resize_object_add(win, bg);
48 client = elm_thumb_ethumb_client_get();
51 printf("error: could not get Ethumb client.\n");
54 ethumb_client_size_set(client, 160, 160);
57 thumb = elm_thumb_add(win);
59 evas_object_smart_callback_add(thumb, "generate,start", _generation_started_cb, NULL);
60 evas_object_smart_callback_add(thumb, "generate,stop", _generation_finished_cb, NULL);
61 evas_object_smart_callback_add(thumb, "generate,error", _generation_error_cb, NULL);
63 elm_thumb_editable_set(thumb, EINA_FALSE);
64 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
65 elm_thumb_file_set(thumb, buf, NULL);
66 elm_thumb_reload(thumb);
68 evas_object_size_hint_weight_set(thumb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
69 elm_win_resize_object_add(win, thumb);
70 evas_object_show(thumb);
72 evas_object_size_hint_min_set(bg, 160, 160);
73 evas_object_size_hint_max_set(bg, 640, 640);
74 evas_object_resize(win, 320, 320);
75 evas_object_show(win);
77 elm_run(); /* and run the program now, starting to handle all
79 elm_shutdown(); /* clean up and shut down */