tizen 2.4 release
[framework/uifw/elementary.git] / src / examples / popup_example_02.c
index 2a5e030..3f8cef0 100644 (file)
@@ -2,31 +2,26 @@
 //gcc -o popup_example_02 popup_example_02.c -g `pkg-config --cflags --libs elementary`
 
 #include <Elementary.h>
-#define PACKAGE_DATA_DIR "../../data"
 
 static void _response_cb(void *data, Evas_Object *obj, void *event_info);
 
 EAPI_MAIN int
 elm_main(int argc, char **argv)
 {
-   Evas_Object *win, *bg, *popup, *btn1, *btn2, *btn3, *icon1;
+   Evas_Object *win, *popup, *btn1, *btn2, *btn3, *icon1;
    char buf[256];
 
-   win = elm_win_add(NULL, "popup", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Popup");
-   elm_win_autodel_set(win, EINA_TRUE);
+   elm_app_info_set(elm_main, "elementary", "images/logo_small.png");
    elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
 
-   bg = elm_bg_add(win);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   elm_win_resize_object_add(win, bg);
-   evas_object_show(bg);
+   win = elm_win_util_standard_add("popup", "Popup");
+   elm_win_autodel_set(win, EINA_TRUE);
 
    popup = elm_popup_add(win);
 
    // Setting popup content-text
    elm_object_text_set(popup, "This is the Content-Text for popup. The wrap"
-            "for the content-text is character wrapping");
+                       "for the content-text is character wrapping");
    // Setting the wrapping type to character wrapping
    elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR);
 
@@ -34,8 +29,8 @@ 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", PACKAGE_DATA_DIR);
-   elm_icon_file_set(icon1, buf, NULL);
+   snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
+   elm_image_file_set(icon1, buf, NULL);
    //Setting popup title-icon
    elm_object_part_content_set(popup, "title,icon", icon1);
 
@@ -59,6 +54,7 @@ elm_main(int argc, char **argv)
    elm_object_text_set(btn3, "Close");
    // Setting this action button
    elm_object_part_content_set(popup, "button3", btn3);
+   evas_object_smart_callback_add(btn3, "clicked", _response_cb, popup);
    // Setting the orientation of popup to Top
    elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP);
    // Display the popup object
@@ -68,7 +64,6 @@ elm_main(int argc, char **argv)
    evas_object_show(win);
 
    elm_run();
-   elm_shutdown();
 
    return 0;
 }
@@ -80,4 +75,3 @@ _response_cb(void *data, Evas_Object *obj,
 {
    evas_object_del(data);
 }
-