diff options
Diffstat (limited to 'src/popup-color-theme-main.c')
-rwxr-xr-x | src/popup-color-theme-main.c | 266 |
1 files changed, 0 insertions, 266 deletions
diff --git a/src/popup-color-theme-main.c b/src/popup-color-theme-main.c deleted file mode 100755 index d04a8ab..0000000 --- a/src/popup-color-theme-main.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * - * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved. - * - * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 - * - * 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 <Elementary.h> -#include <vconf.h> -#include <efl_assist.h> -#include <app_control.h> - -#include "wallpaper-ui-service-debug.h" -#include "wallpaper-ui-service.h" -#include "wallpaper-ui-service-main.h" - - -static void _popup_color_theme_button1_clicked_cb(void *data, Evas_Object *obj, void *event_info) -{ - WALLPAPERUI_DBG(); - - wallpaper_ui_service_appdata *ad = data; - ret_if(ad == NULL); - - int ret = 0; - -/* app_control_h setting_svc = NULL; - ret = app_control_create(&setting_svc); - if(ret != 0) { - WALLPAPERUI_ERR("app_control_create() failed"); - return; - } - ret = app_control_set_operation(setting_svc, APP_CONTROL_OPERATION_DEFAULT); - if(ret != 0) { - WALLPAPERUI_ERR("app_control_set_operation() failed"); - app_control_destroy(setting_svc); - return; - } - ret = app_control_set_package(setting_svc, "setting-color-theme-efl"); - if(ret != 0) { - WALLPAPERUI_ERR("app_control_set_package() failed"); - app_control_destroy(setting_svc); - return; - } - ret = app_control_send_launch_request(setting_svc, NULL, NULL); - if(ret != 0) { - WALLPAPERUI_ERR("app_control_send_launch_request() failed"); - app_control_destroy(setting_svc); - return; - } - app_control_destroy(setting_svc);*/ - - WALLPAPERUI_DBG("from %d",ad->sel_popup_data.launch_from); - - if(ad->sel_popup_data.launch_from == WALLPAPER_POPUP_FROM_GALLERY) - { - util_wallpaper_set(data); - reply_to_sender(ad,APP_CONTROL_RESULT_SUCCEEDED); - elm_exit(); - } - else - { - if(ad->color_popup_data.popup) { - evas_object_del(ad->color_popup_data.popup); - ad->color_popup_data.popup = NULL; - } - } - -} - -static void _popup_color_theme_button2_clicked_cb(void *data, Evas_Object *obj, void *event_info) -{ - WALLPAPERUI_DBG(); - - wallpaper_ui_service_appdata *ad = data; - ret_if(ad == NULL); - - if(ad->color_popup_data.file_path != NULL) { - WALLPAPERUI_DBG("ad->color_popup_data.file_path %s",ad->color_popup_data.file_path); - int theme_index = 0; // default = 0 - theme_index = ea_theme_suitable_theme_get_from_image(ad->color_popup_data.file_path); - //----------------------------------------------------------------------------------------------- - // function call with the index & vconf set - vconf_set_int(VCONFKEY_SETAPPL_CHANGE_UI_THEME_INT, theme_index); - // LOGIC HERE - - Eina_Bool result = ea_theme_input_colors_set(theme_index, EA_THEME_STYLE_DEFAULT); - if( result == EINA_TRUE ) { - ea_theme_system_colors_apply(); - } - } - - if(ad->color_popup_data.popup) { - evas_object_del(ad->color_popup_data.popup); - ad->color_popup_data.popup = NULL; - } - - /* save wallpaper */ - if(ad->sel_popup_data.launch_from == WALLPAPER_POPUP_FROM_GALLERY){ - util_wallpaper_set(data); - reply_to_sender(ad,APP_CONTROL_RESULT_SUCCEEDED); - elm_exit(); - }else{ - done_to_set_wallpaper(); - } -#if 0 - Eina_Bool result = ea_theme_input_colors_set(ad->color_popup_data.theme_index, EA_THEME_STYLE_DARK); - if(result == EINA_TRUE) - { - ea_theme_system_colors_apply(); - vconf_set_int(VCONFKEY_SETAPPL_CHANGE_UI_THEME_INT, ad->color_popup_data.theme_index); - } - else - { - WALLPAPERUI_ERR("ea_theme_input_colors_set(%d) failed", ad->color_popup_data.theme_index); - } -#endif -} - -static Evas_Object *_popup_color_theme_color_applied_image_get(Evas_Object *parent, int *color_theme, const char *bg_file) -{ - retv_if(bg_file == NULL, NULL); - - int theme_index = -1; - - theme_index = ea_theme_suitable_theme_get_from_image(bg_file); - Eina_List *colors = ea_theme_input_colors_get(theme_index); - int r = 0; - int g = 0; - int b = 0; - if(colors) - { - Ea_Theme_Color_hsv *color = eina_list_data_get(colors); - if(color) - { - evas_color_hsv_to_rgb((float)color->h, color->s/100.0, color->v/100.0, &r, &g, &b); - WALLPAPERUI_DBG("theme index(%d) r(%d) g(%d) b(%d)", theme_index, r, g, b); - } - EINA_LIST_FREE(colors, color) - free(color); - - *color_theme = theme_index; - } - else - { - WALLPAPERUI_ERR("getting bg_set failed"); - return NULL; - } - - Evas *evas = evas_object_evas_get(parent); - if(evas == NULL) - { - WALLPAPERUI_ERR("evas_object_evas_get() failed"); - return NULL; - } - - Evas_Object *rect = evas_object_rectangle_add(evas); - evas_object_color_set(rect, r, g, b, 255); - elm_object_part_content_set(parent, "elm.swallow.icon.bg", rect); - Evas_Object *image = elm_image_add(parent); - elm_image_file_set(image, ICONDIR"/A01-1_popup_wallpaper_home_ef.png", NULL); - elm_object_part_content_set(parent, "elm.swallow.icon", image); - - return image; -} - -static void _popup_color_theme_popup_response_cb(void *data, Evas_Object *obj, void *event_info) -{ - wallpaper_ui_service_appdata *ad = data; - WALLPAPERUI_DBG("_response_cb"); - - if(ad->color_popup_data.popup) { - evas_object_del(ad->color_popup_data.popup); - ad->color_popup_data.popup = NULL; - } - WALLPAPERUI_DBG("_response_cb end"); - WALLPAPERUI_DBG("from %d",ad->sel_popup_data.launch_from); - if(ad->sel_popup_data.launch_from == WALLPAPER_POPUP_FROM_GALLERY) - { - reply_to_sender(ad,APP_CONTROL_RESULT_FAILED); - elm_exit(); - } -} - -Evas_Object *popup_color_theme_util_create_view(void *data) -{ - WALLPAPERUI_DBG("popup_wallpaper_main_create_view begin"); - - wallpaper_ui_service_appdata *ad = data; - retv_if(ad == NULL, NULL); - retv_if(ad->win == NULL, NULL); - - Evas_Object *popup = NULL; - Evas_Object *btn1 = NULL; - Evas_Object *btn2 = NULL; - - popup = elm_popup_add(ad->win); - if(popup == NULL) - { - WALLPAPERUI_ERR("elm_popup_add() failed"); - goto err; - } - elm_object_part_text_set(popup, "title,text", APP_STRING("IDS_ST_HEADER_COLOUR_THEME")); - - evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - - elm_object_translatable_text_set(popup, APP_STRING("IDS_ST_BODY_THE_COLOUR_THEME_WILL_BE_CHANGED_TO" - "_MATCH_YOUR_SELECTED_WALLPAPER_TO_SET_THE_COLOUR_THEME_MANUALLY_GO_TO_MSG")); - - /* setting button */ - btn1 = elm_button_add(popup); - if(btn1 == NULL) - { - WALLPAPERUI_ERR("elm_button_add() failed"); - goto err; - } - elm_object_style_set(btn1, "popup"); - elm_object_text_set(btn1, APP_STRING("IDS_LCKSCN_BUTTON_CANCEL")); - elm_object_part_content_set(popup, "button1", btn1); - evas_object_smart_callback_add(btn1, "clicked", _popup_color_theme_button1_clicked_cb, data); - - /* ok button */ - btn2 = elm_button_add(popup); - if(btn2 == NULL) - { - WALLPAPERUI_ERR("elm_button_add() failed"); - goto err; - } - elm_object_style_set(btn2, "popup"); - elm_object_text_set(btn2, APP_STRING("IDS_ST_BUTTON_OK_ABB")); - elm_object_part_content_set(popup, "button2", btn2); - evas_object_smart_callback_add(btn2, "clicked", _popup_color_theme_button2_clicked_cb, data); - - evas_object_show(popup); - ad->color_popup_data.popup = popup; - evas_object_smart_callback_add(popup, "block,clicked", _popup_color_theme_popup_response_cb, ad); - ea_object_event_callback_add(popup, EA_CALLBACK_BACK, _popup_color_theme_popup_response_cb, ad); - - return popup; - -err: - - if(btn1) - { - evas_object_del(btn1); - } - - if(popup) - { - evas_object_del(popup); - } - - return NULL; -} |