/* * Copyright 2012 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.tizenopensource.org/license * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include #include #include #include #include #include "ivug-common.h" #include "ivug-parameter.h" #include "ivug-popup.h" #include "ivug-ext-ug.h" #include "ivug-widget.h" #include "ivug-main.h" #include "ivug-setas-view.h" #include "ivug-slider.h" #include "ivug-listpopup.h" /* Used for storing cropped image. */ #define IVUG_HOME_SCREEN_TEMP_PATH DATA_PATH"/.homescreen_tmp.jpg"; #define IVUG_LOCK_SCREEN_TEMP_PATH DATA_PATH"/.lockscreen_tmp.jpg"; /* Final image path */ #define IVUG_HOME_SCREEN_PATH DATA_PATH"/.homescreen.jpg"; #define IVUG_LOCK_SCREEN_PATH DATA_PATH"/.lockscreen.jpg"; /* Image displays when incomming call is recevied. */ #define IVUG_RESULT_BUNDLE_KEY_ERROR "Error" #define IVUG_RESULT_BUNDLE_VALUE_NOT_SUPPORTED "not_supported_file_type" #define CLICK_TIME_MAX (500) // click time. #define CLICK_WIDTH_MIN (elm_config_finger_size_get() >> 1) //click width, if mouse move under this value and under click time, it is click. #define CLICK_INTERVAL_TIME 0.15 #define SETAS_EDJ_FILE EDJ_PATH"/ivug-setas.edj" #define IVUG_RESPONSE_OK (1) #define TRANSITION_EFFECT //set as enum { IVUG_SET_AS_TYPE_HOME = 0x00, IVUG_SET_AS_TYPE_LOCK, IVUG_SET_AS_TYPE_BOTH, IVUG_SET_AS_TYPE_MAX, }; static void _ivug_setas_on_icon_set_clicked(void *data, Evas_Object* obj, const char *emission, const char *source ); /*********************************Common Part**************************************/ static void _setas_ug_view_deleted(void * data, Evas * e, Evas_Object * obj, void * event_info) { char *szView = (char *)data; MSG_SETAS_WARN("%s is destroyed", szView); return; } static void _ivug_setas_view_remove(Ivug_SetAsView *pSetAsView) { MSG_SETAS_HIGH("Start destroy ug"); ug_destroy_me(gGetUGHandle()); return; } static void _ivug_setas_view_show_icons(Evas_Object *layout) { ivug_retm_if(!layout, "pSetAsView->layout is NULL"); elm_win_indicator_mode_set(ug_get_window(), ELM_WIN_INDICATOR_SHOW); edje_object_signal_emit(_EDJ(layout), "setasview,show,btn_cancel","elm"); edje_object_signal_emit(_EDJ(layout), "setasview,show,btn_ok","elm"); } static void _ivug_setas_view_hide_icons(Evas_Object *layout) { ivug_retm_if(!layout, "pSetAsView->layout is NULL"); elm_win_indicator_mode_set(ug_get_window(), ELM_WIN_INDICATOR_HIDE); edje_object_signal_emit(_EDJ(layout), "setasview,hide,btn_cancel","elm"); edje_object_signal_emit(_EDJ(layout), "setasview,hide,btn_ok","elm"); } static void _ivug_setas_view_unregister_set_signal(Evas_Object *layout, void (*func) (void *data, Evas_Object *obj, const char *emission, const char *source)) { ivug_retm_if(!layout, "pSetAsView->layout is NULL"); edje_object_signal_callback_del(_EDJ(layout), "setasview,set,clicked", "", func); } static Eina_Bool _ivug_setas_view_click_cb(void *data) { Ivug_SetAsView *setas_data = (Ivug_SetAsView *)data; if (setas_data->click_timer) { ecore_timer_del(setas_data->click_timer); setas_data->click_timer = NULL; } setas_data->b_hide_bar_flag = !(setas_data->b_hide_bar_flag); MSG_SETAS_HIGH("Bar flag is %d", setas_data->b_hide_bar_flag); if(setas_data->b_hide_bar_flag) { _ivug_setas_view_hide_icons(setas_data->layout); } else { _ivug_setas_view_show_icons(setas_data->layout); } return ECORE_CALLBACK_CANCEL; } static void _ivug_setas_view_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { Ivug_SetAsView *setas_data = (Ivug_SetAsView *)data; Evas_Event_Mouse_Down *ev = event_info; MSG_SETAS_HIGH("Mouse down!"); ivug_ret_if(!data); setas_data->down_pos.x = ev->canvas.x; setas_data->down_pos.y = ev->canvas.y; setas_data->timestamp = ev->timestamp; if (setas_data->click_timer) { ecore_timer_del(setas_data->click_timer); setas_data->click_timer = NULL; } } static void _ivug_setas_view_mouse_up_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info) { Ivug_SetAsView *setas_data = (Ivug_SetAsView *)data; Evas_Event_Mouse_Up *ev = event_info; int step; unsigned int interval_time; MSG_SETAS_HIGH("Mouse up!"); ivug_ret_if(!data); step = setas_data->down_pos.x - ev->canvas.x; interval_time = ev->timestamp - setas_data->timestamp; if(ev->flags & EVAS_BUTTON_DOUBLE_CLICK) { MSG_SETAS_HIGH("double clicked"); return; } if ((step < CLICK_WIDTH_MIN && step > -CLICK_WIDTH_MIN) && (interval_time < CLICK_TIME_MAX && interval_time > 0) ) { MSG_SETAS_HIGH("clicked"); setas_data->click_timer = ecore_timer_add(CLICK_INTERVAL_TIME, _ivug_setas_view_click_cb , data); return ; } } /********************************* Common Function **************************************/ static void _ivug_setas_view_send_result(struct ui_gadget *ug, const char *key1, const char *val1, const char *key2, const char *val2) { ivug_ret_if(!ug); bundle *b; b = bundle_create(); if(key1 && val1) { MSG_SETAS_HIGH("Bundle 1 : [%s = %s]", key1, val1); bundle_add(b, key1, val1); } if(key2 && val2) { MSG_SETAS_HIGH("Bundle 2 : [%s = %s]", key2, val2); bundle_add(b, key2, val2); } ug_send_result(ug, b); bundle_free(b); } static void _ivug_setas_view_response_cb( void *data, Evas_Object *obj, void *event_info ) { MSG_SETAS_HIGH( "response callback=%d",(int)event_info); evas_object_hide(obj); evas_object_del(obj); ivug_retm_if(!data, "data is NULL"); _ivug_setas_view_remove((Ivug_SetAsView *)data); } /** * @brief * * @param title * @param txt_noti */ static Evas_Object* _ivug_setas_view_show_exit_popup( Evas_Object *parent, const char *title, const char *desc, void *data) { MSG_SETAS_HIGH( "title: %s, desc %s", title, desc); Evas_Object* style1_popup = elm_popup_add(parent); evas_object_size_hint_weight_set(style1_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_popup_timeout_set(style1_popup, (double)2.0); elm_object_text_set(style1_popup, desc); elm_object_part_text_set(style1_popup, "title,text", title); evas_object_smart_callback_add(style1_popup, "timeout", _ivug_setas_view_response_cb, data); evas_object_show(style1_popup); evas_object_layer_set(style1_popup, EVAS_LAYER_MAX); return style1_popup; } static Eina_Bool _ivug_setas_view_resize_save(Evas_Object *org, const char *filepath, int w, int h) { IV_ASSERT(org != NULL); IV_ASSERT(filepath != NULL); if(w <= 0 || h <= 0) { MSG_SETAS_ERROR("input size parameter is invalid, w = %d, h = %d", w, h); return EINA_FALSE; } int img_w = 0; int img_h = 0; evas_object_image_size_get(org, &img_w, &img_h); MSG_SETAS_LOW("img_w = %d, img_h = %d", img_w, img_h); MSG_SETAS_LOW("w = %d, h = %d", w, h); char *ImgBuffer = evas_object_image_data_get(org, EINA_FALSE); Ecore_Evas *ee; Evas *evas; ee = ecore_evas_buffer_new(w, h); IV_ASSERT(ee != NULL); evas = ecore_evas_get(ee); IV_ASSERT(evas != NULL); Evas_Object *input; input = evas_object_image_filled_add(evas); IV_ASSERT(input != NULL); evas_object_image_size_set(input, img_w, img_h); evas_object_image_data_set(input, ImgBuffer); evas_object_image_smooth_scale_set(input, EINA_TRUE); evas_object_move(input, 0, 0); evas_object_resize(input, w, h); evas_object_show(input); evas_object_image_data_update_add(input, 0, 0, w, h); Ecore_Evas *ee_dest; Evas *evas_dest; ee_dest = ecore_evas_buffer_new(1, 1); IV_ASSERT(ee_dest != NULL); evas_dest = ecore_evas_get(ee_dest); IV_ASSERT(evas_dest != NULL); Evas_Object *output; output = evas_object_image_filled_add(evas_dest); IV_ASSERT(output != NULL); void *data = NULL; data = (void*)ecore_evas_buffer_pixels_get(ee); IV_ASSERT(data != NULL); evas_object_image_size_set(output, w, h); evas_object_image_data_set(output, data); if (evas_object_image_save(output, filepath, NULL, NULL) == EINA_FALSE) { MSG_SETAS_ERROR("evas_object_image_save error. %s", filepath); evas_object_del(input); evas_object_del(output); return EINA_FALSE; } else { int fd = open(filepath, O_RDONLY); if(fd < 0) { MSG_SETAS_ERROR("%s open error[%d]", filepath, fd); evas_object_del(input); evas_object_del(output); return EINA_FALSE; } fsync(fd); int ret = close(fd); if(ret < 0) { MSG_SETAS_ERROR("%s open error[%d]", filepath, ret); } } evas_object_del(input); evas_object_del(output); return EINA_TRUE; } static Eina_Bool _ivug_setas_view_screen_create_file(Ivug_SetAsView *pSetAsView, char* screen_file) { // Delete the home screen file if exist if (ivug_remove_file(screen_file) == false) { MSG_SETAS_ERROR( "Detele file %s failed", screen_file); return EINA_FALSE; } int x = 0; int y = 0; int w = 0; int h = 0; Evas *canvas; Ecore_Evas *ee; ee = ecore_evas_buffer_new(1, 1); if (!ee) { MSG_DETAIL_ERROR("Cannot get EVAS"); return EINA_FALSE; } canvas = ecore_evas_get(ee); Evas_Object *img = evas_object_image_add(canvas); evas_object_image_file_set(img, NULL, NULL); evas_object_image_load_orientation_set(img, EINA_TRUE); evas_object_image_load_scale_down_set(img, 0); evas_object_image_file_set(img, pSetAsView->file_path, NULL); Evas_Load_Error error = evas_object_image_load_error_get(img); if ( error != EVAS_LOAD_ERROR_NONE) { MSG_SETAS_ERROR("Decoding Error(%d) : %s", error, pSetAsView->file_path); evas_object_image_file_set(img, NULL, NULL); evas_object_del(img); ecore_evas_free(ee); return EINA_FALSE; } elm_photocam_image_region_get(pSetAsView->photocam, &x, &y, &w, &h); double zoom = elm_photocam_zoom_get(pSetAsView->photocam); if(zoom != 0.0) { w = w/zoom; h = h/zoom; } MSG_SETAS_HIGH("w = %d, h = %d", w, h); if(_ivug_setas_view_resize_save(img, screen_file, w, h) == EINA_FALSE) { MSG_SETAS_ERROR("setas image save faied."); evas_object_image_file_set(img, NULL, NULL); evas_object_del(img); ecore_evas_free(ee); return EINA_FALSE; } evas_object_image_file_set(img, NULL, NULL); evas_object_del(img); ecore_evas_free(ee); return EINA_TRUE; } static void _ivug_setas_on_change_home_screen(void *data, Evas_Object *obj, void *event_info) { IV_ASSERT(data != NULL); MSG_SETAS_HIGH("Change Home Screen"); Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data; // TODO : Remove dependancy char* homescreen_path = IVUG_HOME_SCREEN_PATH; Eina_Bool ret = EINA_FALSE; if((ret = _ivug_setas_view_screen_create_file(pSetAsView, homescreen_path)) == EINA_FALSE) { MSG_SETAS_ERROR( "Create screen file failed"); goto end; } if( (ret = ivug_config_set_homescreen_image(homescreen_path)) == EINA_TRUE) { pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_HOME_SCREEN_WALLPAPER, IDS_SUCCESS, pSetAsView); } else { pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_HOME_SCREEN_WALLPAPER, IDS_FAILED, pSetAsView); } MSG_SETAS_HIGH("Set Home screen: %s", homescreen_path); end: if(ret == EINA_TRUE) { _ivug_setas_view_send_result(gGetUGHandle(), "homescreen_path", homescreen_path, NULL, NULL); } } static void _ivug_setas_on_change_lock_screen(void *data, Evas_Object *obj, void *event_info) { IV_ASSERT(data != NULL); MSG_SETAS_HIGH("Change Lock Screen"); Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data; char* lockscreen_path = IVUG_LOCK_SCREEN_PATH; Eina_Bool ret = EINA_FALSE; if((ret = _ivug_setas_view_screen_create_file(pSetAsView, lockscreen_path)) == EINA_FALSE) { MSG_SETAS_ERROR( "Create screen file failed"); goto end; } //Set the lock screen if((ret = ivug_config_set_lockscreen_image(lockscreen_path)) == EINA_TRUE) { pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_LOCK_SCREEN_WALLPAPER, IDS_SUCCESS, pSetAsView); } else { pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_LOCK_SCREEN_WALLPAPER, IDS_FAILED, pSetAsView); } MSG_SETAS_HIGH("Set Lock screen: %s", lockscreen_path); end: if(ret == EINA_TRUE) { _ivug_setas_view_send_result(gGetUGHandle(), "lockscreen_path", lockscreen_path, NULL, NULL); } } static void _ivug_setas_on_change_homeNlock_screen(void *data, Evas_Object *obj, void *event_info) { IV_ASSERT(data != NULL); MSG_SETAS_HIGH("Change Lock Screen"); Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data; // Set homescreen image char* homescreen_path = IVUG_HOME_SCREEN_PATH; char* lockscreen_path = IVUG_LOCK_SCREEN_PATH; Eina_Bool ret = EINA_FALSE; if((ret = _ivug_setas_view_screen_create_file(pSetAsView, homescreen_path)) == EINA_FALSE) { MSG_SETAS_ERROR( "Create screen file failed"); goto end; } char* temp_lock_path = IVUG_LOCK_SCREEN_TEMP_PATH; if (ivug_remove_file(temp_lock_path) == false) { MSG_SETAS_ERROR( "Detele file %s: failed", temp_lock_path); goto end; } // Make a copy from home screen to lock screen if((ret = ecore_file_cp(homescreen_path, temp_lock_path)) == EINA_FALSE) { MSG_SETAS_ERROR( "File copy failed"); goto end; } else { if(ivug_rename_file(temp_lock_path, lockscreen_path) == false) { MSG_SETAS_ERROR( "Rename file %s to %s failed", temp_lock_path, lockscreen_path ); if(ivug_remove_file(temp_lock_path)== false) { MSG_SETAS_ERROR( "delete tmp lock file failed %s", temp_lock_path); } ret = EINA_FALSE; goto end; } sync(); //sync copied file. } char *title = elm_entry_utf8_to_markup(IDS_HOME_AND_LOCK_SCREEN_WALLPAPER); ret = ivug_config_set_homescreen_image(homescreen_path); if ( ret == false) { pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, title, IDS_FAILED, pSetAsView); } else { ret = ivug_config_set_lockscreen_image(lockscreen_path); if ( ret == false) { // TODO : Do I revet homescreen if either failed????? pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, title, IDS_FAILED, pSetAsView); } else { pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, title, IDS_SUCCESS, pSetAsView); } } MSG_SETAS_HIGH("Set Home&Lock screen: %s %s", homescreen_path, lockscreen_path); free(title); end: if(ret == EINA_TRUE) { _ivug_setas_view_send_result(gGetUGHandle(), "homescreen_path", homescreen_path, "lockscreen_path", lockscreen_path); } } static void _ivug_setas_wallpaper_set_selected_cb(void *data, Evas_Object *obj, void *event_info) { IV_ASSERT(data != NULL); Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data; ivug_listpopup_item *item = event_info; edje_object_signal_callback_add(_EDJ(pSetAsView->layout), "setasview,set,clicked", "", _ivug_setas_on_icon_set_clicked, (void *)pSetAsView); if ( item == NULL ) // Cancel is selected { MSG_SETAS_HIGH("Cancel is selected"); evas_object_del(pSetAsView->genlist_popup); pSetAsView->genlist_popup = NULL; return; } MSG_SETAS_HIGH("Create SetAsView. name= %s", item->caption); switch(item->index) { case IVUG_SET_AS_TYPE_HOME: _ivug_setas_on_change_home_screen(data, NULL, NULL); break; case IVUG_SET_AS_TYPE_LOCK: _ivug_setas_on_change_lock_screen(data, NULL, NULL); break; case IVUG_SET_AS_TYPE_BOTH: _ivug_setas_on_change_homeNlock_screen(data, NULL, NULL); break; default: MSG_SETAS_ERROR("Unknown Set as type : %d", item->index); break; } evas_object_del(pSetAsView->genlist_popup); pSetAsView->genlist_popup = NULL; } static void _ivug_setas_on_icon_cancel_clicked(void *data, Evas_Object* obj, const char *emission, const char *source ) { MSG_SETAS_HIGH("Cancel button clicked"); ivug_ret_if(!data); Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data; _ivug_setas_view_remove(pSetAsView); } static void _ivug_setas_on_icon_set_clicked(void *data, Evas_Object* obj, const char *emission, const char *source ) { MSG_SETAS_HIGH("On Btn Done clicke"); ivug_ret_if(!data); Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data; _ivug_setas_view_unregister_set_signal(pSetAsView->layout, _ivug_setas_on_icon_set_clicked); if(pSetAsView->set_type == IVUG_CTRLBAR_SET_SCREEN_UNDEFINED) { // In case of setting->wallpaper MSG_SETAS_HIGH("Create setas wallpaper popup"); ivug_listpopup_itemlist items = ivug_listpopup_itemlist_new(); ivug_listpopup_itemlist_add(items, IVUG_SET_AS_TYPE_HOME, NULL, IDS_HOME_SCREEN_WALLPAPER, NULL , false); ivug_listpopup_itemlist_add(items, IVUG_SET_AS_TYPE_LOCK, NULL, IDS_LOCK_SCREEN_WALLPAPER, NULL , false); ivug_listpopup_itemlist_add(items, IVUG_SET_AS_TYPE_BOTH, NULL, IDS_HOME_AND_LOCK_SCREEN_WALLPAPER, NULL , false); pSetAsView->genlist_popup = ivug_listpopup_show(pSetAsView->layout, IDS_SET_AS, items, _ivug_setas_wallpaper_set_selected_cb, pSetAsView); ivug_listpopup_itemlist_free(items); } } static void _ivug_setas_on_photocam_loaded(void *data, Evas_Object *obj, void *event_info) { Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *) data; IV_ASSERT(pSetAsView != NULL); Evas_Load_Error error = (Evas_Load_Error)event_info; if ( error != EVAS_LOAD_ERROR_NONE ) { MSG_SETAS_ERROR("Error occured during decoding. Error=%d", error); // Show popup & Exit. pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_ERROR, IDS_INVALID_IMAGE_FILE, pSetAsView ); return; } elm_object_part_content_set(pSetAsView->layout, "setasview.photocam", pSetAsView->photocam); edje_object_signal_emit(_EDJ(pSetAsView->layout), "setasview,enable,btn_ok", "elm"); edje_object_signal_callback_add(_EDJ(pSetAsView->layout), "setasview,set,clicked", "", _ivug_setas_on_icon_set_clicked, (void *)pSetAsView); } static Ivug_SetAsView *_create_setas_view(Evas_Object *parent, const char* filepath, ivug_set_screen_type screen_type) { IV_ASSERT(filepath != NULL); Ivug_SetAsView *pSetAsView = (Ivug_SetAsView *)calloc(1, sizeof(Ivug_SetAsView)); if ( pSetAsView == NULL ) { MSG_SETAS_ERROR("Cannot allocate memory"); return NULL; } pSetAsView->file_path = strdup(filepath); pSetAsView->set_type = screen_type; pSetAsView->layout = ivug_layout_add(parent , SETAS_EDJ_FILE, "setas_view"); if ( pSetAsView->layout == NULL ) { MSG_SETAS_ERROR("Cannot create layout."); free(pSetAsView); return NULL; } Evas_Object *photocam; photocam = elm_photocam_add(pSetAsView->layout); elm_photocam_zoom_mode_set(photocam, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT); elm_photocam_paused_set(photocam, EINA_TRUE); edje_object_signal_emit(_EDJ(pSetAsView->layout), "setasview,disable,btn_ok","elm"); // Disable ok button _ivug_setas_view_show_icons(pSetAsView->layout); evas_object_smart_callback_add(photocam, "loaded", _ivug_setas_on_photocam_loaded, (void *)pSetAsView); pSetAsView->photocam = photocam; Evas_Load_Error error = EVAS_LOAD_ERROR_NONE; // Get Screen size Evas_Coord w, h; evas_object_geometry_get(pSetAsView->layout, NULL, NULL, &w, &h); evas_object_show(photocam); error = elm_photocam_file_set(photocam, filepath); if ( error != EVAS_LOAD_ERROR_NONE ) { // TODO : What is good for error handing?????? MSG_SETAS_ERROR("FileSet Error=%d", error); if ( error == EVAS_LOAD_ERROR_UNKNOWN_FORMAT ) { _ivug_setas_view_send_result(gGetUGHandle(), IVUG_RESULT_BUNDLE_KEY_ERROR, IVUG_RESULT_BUNDLE_VALUE_NOT_SUPPORTED, NULL, NULL); ivug_setas_view_destroy(pSetAsView); return NULL; } else if ( error == EVAS_LOAD_ERROR_PERMISSION_DENIED ) { pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_ERROR, IDS_PERMISSION_DENIED, pSetAsView ); return pSetAsView; } else { pSetAsView->popup = _ivug_setas_view_show_exit_popup(pSetAsView->layout, IDS_ERROR, IDS_INVALID_IMAGE_FILE, pSetAsView ); return pSetAsView; } } edje_object_signal_callback_add(_EDJ(pSetAsView->layout), "setasview,cancel,clicked", "", _ivug_setas_on_icon_cancel_clicked, (void *)pSetAsView); const Evas_Object *event = edje_object_part_object_get(_EDJ(pSetAsView->layout), "event"); if(!event) { MSG_SETAS_ERROR("event object is NULL"); } else { evas_object_event_callback_add((Evas_Object *)event, EVAS_CALLBACK_MOUSE_DOWN, _ivug_setas_view_mouse_down_cb, pSetAsView); evas_object_event_callback_add((Evas_Object *)event, EVAS_CALLBACK_MOUSE_UP, _ivug_setas_view_mouse_up_cb, pSetAsView); } return pSetAsView; } Ivug_SetAsView * ivug_setas_view_screen_ug_create(Evas_Object *parent, const char* filepath) { Ivug_SetAsView *pSetAsView = NULL; MSG_SETAS_HIGH("Wallpaper UG creates"); pSetAsView = _create_setas_view(parent, filepath, IVUG_CTRLBAR_SET_SCREEN_UNDEFINED); if ( pSetAsView == NULL ) { MSG_SETAS_ERROR("Cannot create Wallpaper UG"); return NULL; } evas_object_event_callback_add(pSetAsView->layout, EVAS_CALLBACK_DEL, _setas_ug_view_deleted, "Wallpaper UG"); return pSetAsView; } Evas_Object * ivug_setas_view_object_get(Ivug_SetAsView *pSetAsView) { IV_ASSERT(pSetAsView != NULL); return pSetAsView->layout; } void ivug_setas_view_destroy(Ivug_SetAsView *pSetAsView) { MSG_SETAS_HIGH("Removing SetAs VIew"); ivug_ret_if(!pSetAsView); const Evas_Object *event = edje_object_part_object_get(_EDJ(pSetAsView->layout), "event"); if(event != NULL) { evas_object_event_callback_del((Evas_Object *)event, EVAS_CALLBACK_MOUSE_DOWN, _ivug_setas_view_mouse_down_cb); evas_object_event_callback_del((Evas_Object *)event, EVAS_CALLBACK_MOUSE_UP, _ivug_setas_view_mouse_up_cb); } if (pSetAsView->click_timer) { ecore_timer_del(pSetAsView->click_timer); pSetAsView->click_timer = NULL; } if(pSetAsView->genlist_popup) { evas_object_del(pSetAsView->genlist_popup); pSetAsView->genlist_popup = NULL; } if(pSetAsView->popup) { evas_object_del(pSetAsView->popup); pSetAsView->popup = NULL; } if(pSetAsView->select_box) { evas_object_del(pSetAsView->select_box); pSetAsView->select_box = NULL; } if(pSetAsView->photocam) { evas_object_del(pSetAsView->photocam); pSetAsView->photocam = NULL; } if(pSetAsView->file_path) { free(pSetAsView->file_path); pSetAsView->file_path = NULL; } if(pSetAsView->layout) { evas_object_del(pSetAsView->layout); pSetAsView->layout = NULL; } if ( pSetAsView->ly_effect) { evas_object_del(pSetAsView->ly_effect); pSetAsView->ly_effect = NULL; } if(pSetAsView) { free(pSetAsView); } pSetAsView = NULL; }