System popup : evas -> ecore_evas -> class_set 97/47197/1
authorJin Yoon <jinny.yoon@samsung.com>
Tue, 1 Sep 2015 03:00:52 +0000 (12:00 +0900)
committerJin Yoon <jinny.yoon@samsung.com>
Tue, 1 Sep 2015 03:00:52 +0000 (12:00 +0900)
Change-Id: I3a2c009725ac0996cae04a3ddeb28d40e1728d73

src/share_panel.c

index 8e3cb68..a243296 100644 (file)
@@ -85,28 +85,45 @@ static void _rotate_cb(void *data, Evas_Object *obj, void *event)
 
 static Evas_Object *__create_win(share_panel_h share_panel)
 {
-       share_panel->win = elm_win_add(NULL, "Share Panel", ELM_WIN_BASIC);
-       retv_if(!share_panel->win, NULL);
+       Evas_Object *win = NULL;
+       Evas *e = NULL;
+       Ecore_Evas *ee = NULL;
 
-       elm_win_alpha_set(share_panel->win, EINA_TRUE);
-       if (elm_win_wm_rotation_supported_get(share_panel->win)) {
+       win = elm_win_add(NULL, "Share Panel", ELM_WIN_BASIC);
+       retv_if(!win, NULL);
+       elm_win_alpha_set(win, EINA_TRUE);
+
+       e = evas_object_evas_get(win);
+       goto_if(!e, error);
+
+       ee = ecore_evas_ecore_evas_get(e);
+       goto_if(!ee, error);
+
+       ecore_evas_name_class_set(ee, "SYSTEM_POPUP", "SYSTEM_POPUP");
+
+       if (elm_win_wm_rotation_supported_get(win)) {
                int rots[4] = {0, 90, 180, 270};
-               elm_win_wm_rotation_available_rotations_set(share_panel->win, rots, (sizeof(rots) / sizeof(int)));
+               elm_win_wm_rotation_available_rotations_set(win, rots, (sizeof(rots) / sizeof(int)));
        }
-
-       ecore_evas_name_class_set(ecore_evas_ecore_evas_get(evas_object_evas_get(share_panel->win)), "SYSTEM_POPUP", "SYSTEM_POPUP");
-       elm_win_screen_size_get(share_panel->win, NULL, NULL, &share_panel->root_width, &share_panel->root_height);
+       elm_win_screen_size_get(win, NULL, NULL, &share_panel->root_width, &share_panel->root_height);
        _D("screen size is (%d, %d)", share_panel->root_width, share_panel->root_height);
 
-       elm_object_event_callback_add(share_panel->win, _back_key_pressed, share_panel);
-       evas_object_smart_callback_add(share_panel->win, "wm,rotation,changed", _rotate_cb, share_panel);
+       elm_object_event_callback_add(win, _back_key_pressed, share_panel);
+       evas_object_smart_callback_add(win, "wm,rotation,changed", _rotate_cb, share_panel);
+
+       elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_HIDE);
+       elm_win_borderless_set(win, EINA_TRUE);
+       evas_object_show(win);
+
+       share_panel->win = win;
 
-       elm_win_indicator_mode_set(share_panel->win, ELM_WIN_INDICATOR_HIDE);
-       elm_win_borderless_set(share_panel->win, EINA_TRUE);
-       evas_object_show(share_panel->win);
+       return win;
 
-       return share_panel->win;
+error:
+       if (win)
+               evas_object_del(win);
 
+       return NULL;
 }