Ecore_Idler *idler_handler;
};
-static void _service_imageviewer_ug_result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *data);
static void _wallpaper_destroy(void *data);
static Evas_Object *main_gengrid_add(Evas_Object *parent, void *data);
-static void _edit_clicked_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
static int _lockscreen_gallery_scale_job_maker(int to_w, int to_h, int idx);
static void _lockscreen_gallery_destroy_func();
static void _wallpaper_show_focus_highlight(int selected_index) ;
static void _done_to_set_wallpaper();
static void _wallpaper_back_key_cb(void *data, Evas_Object *obj, void *event_info);
-static void _preview_clicked_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
+static void _preview_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _wallpaper_preview_main();
static int _lockscreen_gallery_file_cb(const char *src, const char *dst)
{
if (pItem != NULL) {
media_info_clone(pAssignFolderItem, pItem);
- media_info_get_display_name(*pAssignFolderItem, &pItem);
}
WALLPAPERUI_TRACE_END;
return FALSE;
}
-static void _done_button_cb()
-{
- WALLPAPERUI_TRACE_BEGIN;
-
- _done_to_set_wallpaper();
-
- WALLPAPERUI_TRACE_END;
-}
-
static media_content_orientation_e _lockscreen_gallery_get_orientation_by_path(const char *path)
{
WALLPAPERUI_TRACE_BEGIN;
sd->to_h = to_h;
sd->curr_job = job_idx;
sd->next_job = job_idx+1;
-
sd->idler_handler = ecore_idler_add(_lockscreen_gallery_scale_job_handler, sd);
}
WALLPAPERUI_TRACE_END;
}
-static void _gallery_service_imageviewer_ug_result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *data)
+static void _get_filename_extension_in_uppercase(const char * inputString, char *buf, int bufLength)
{
WALLPAPERUI_TRACE_BEGIN;
- elm_object_disabled_set(ad->win, EINA_FALSE);
- state_data.flag_edit_click = EINA_FALSE;
-
- if (result == APP_CONTROL_RESULT_SUCCEEDED) {
- char **path_array = NULL;
- int array_length = 0;
-
- int j = 0;
- bool bresult = false;
-
- if (app_control_get_extra_data_array(reply, "http://tizen.org/appcontrol/data/selected", &path_array, &array_length) == APP_CONTROL_ERROR_NONE) {
-
- for (j = 0; j < array_length; j++) {
- WALLPAPERUI_DBG("path_array[%d] = %s", j, path_array[j]);
- }
-
- if (!strstr(path_array[0], ".png")
- && !strstr(path_array[0], ".PNG")
- && !strstr(path_array[0], ".jpg")
- && !strstr(path_array[0], ".gif")) {
- WALLPAPERUI_DBG("Do not edit the image!: path_array[0] = %s", path_array[0]);
- return;
- }
-
- /*do not need go into preview_selection */
- if ((array_length == 1) && path_array[0]) {
- state_data.flag_changed = EINA_TRUE;
- state_data.flag_image_from_gallery = EINA_TRUE;
-
- vconf_set_int(VCONFKEY_LOCKSCREEN_WALLPAPER_TYPE, WALLPAPER_TYPE_GALLERY);
- WALLPAPERUI_DBG("Set VCONFKEY_LOCKSCREEN_WALLPAPER_TYPE = WALLPAPER_TYPE_GALLERY");
- memset(ad->saved_img_path, 0, sizeof(ad->saved_img_path));
- strncpy(ad->saved_img_path[0], path_array[0], MAX_LENGTH_LINE - 1);
- WALLPAPERUI_DBG("ad->saved_img_path[0] is %s", ad->saved_img_path[0]);
-
- elm_image_file_set(ad->preview_image, ad->saved_img_path[0], NULL);
- }
-
- int i = 0;
- for (i = 0; i < array_length; i++) {
- if (path_array[i]) {
- free(path_array[i]);
- path_array[i] = NULL;
+ if (!buf||!inputString||bufLength<1){
+ return;
+ }
+ char *pointChar = strrchr(inputString, '.');
+ if(pointChar) {
+ int i;
+ for (i=0; i < bufLength;++i, ++pointChar, ++buf){
+ if (*pointChar == '\0'){
+ break;
+ }
+ *buf = toupper(*pointChar);
}
- }
- _done_button_cb();
- }
}
+ *buf = '\0';
+
WALLPAPERUI_TRACE_END;
}
char **path_array = NULL;
int array_length = 0;
Elm_Object_Item *object_item = NULL;
- bool bresult = false;
int i = 0;
Thumbnail *item = NULL;
WALLPAPERUI_DBG("array_length < 1, do not get result from gallery");
return;
} else {
+ char file_ext[MAX_LENGTH_LINE] = {0, };
for (; i < array_length; i++) {
- if (!strcasestr(path_array[i], ".PNG")
- && !strcasestr(path_array[i], ".BMP")
- && !strcasestr(path_array[i], ".WBMP")
- && !strcasestr(path_array[i], ".PCX")
- && !strcasestr(path_array[i], ".TIFF")
- && !strcasestr(path_array[i], ".JPEG")
- && !strcasestr(path_array[i], ".TGA")
- && !strcasestr(path_array[i], ".EXIF")
- && !strcasestr(path_array[i], ".FPX")
- && !strcasestr(path_array[i], ".SVG")
- && !strcasestr(path_array[i], ".PSD")
- && !strcasestr(path_array[i], ".CDR")
- && !strcasestr(path_array[i], ".PCD")
- && !strcasestr(path_array[i], ".DXF")
- && !strcasestr(path_array[i], ".UFO")
- && !strcasestr(path_array[i], ".EPS")
- && !strcasestr(path_array[i], ".JPG")
- && !strcasestr(path_array[i], ".GIF")) {
+ _get_filename_extension_in_uppercase(path_array[i], file_ext, MAX_LENGTH_LINE);
+ if (*file_ext == 0) {
+ WALLPAPERUI_DBG("invalid image path: path_array[%d] = %d", i, path_array[i]);
+ return;
+ }
+ if (!strcmp(file_ext, ".PNG")
+ && !strcmp(file_ext, ".BMP")
+ && !strcmp(file_ext, ".WBMP")
+ && !strcmp(file_ext, ".PCX")
+ && !strcmp(file_ext, ".TIFF")
+ && !strcmp(file_ext, ".JPEG")
+ && !strcmp(file_ext, ".TGA")
+ && !strcmp(file_ext, ".EXIF")
+ && !strcmp(file_ext, ".FPX")
+ && !strcmp(file_ext, ".SVG")
+ && !strcmp(file_ext, ".PSD")
+ && !strcmp(file_ext, ".CDR")
+ && !strcmp(file_ext, ".PCD")
+ && !strcmp(file_ext, ".DXF")
+ && !strcmp(file_ext, ".UFO")
+ && !strcmp(file_ext, ".EPS")
+ && !strcmp(file_ext, ".JPG")
+ && !strcmp(file_ext, ".GIF")) {
WALLPAPERUI_DBG("invalid image path: path_array[%d] = %d", i, path_array[i]);
return;
} else {
}
}
}
-
memset(ad->saved_img_path, 0, sizeof(ad->saved_img_path));
strncpy(ad->saved_img_path[0], path_array[0], MAX_LENGTH_LINE - 1);
WALLPAPERUI_DBG("saved_img_path is %s", ad->saved_img_path[0]);
WALLPAPERUI_TRACE_END;
}
-static void _gallery_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
+static void _gallery_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
WALLPAPERUI_TRACE_BEGIN;
Thumbnail *item = (Thumbnail *)data;
elm_gengrid_item_selected_set(item->item, EINA_FALSE);
app_control_h svc_handle = NULL;
- Evas_Object *win = NULL;
if (obj) {
elm_object_signal_emit(obj, "unpressed", "elm");
if (!app_control_create(&svc_handle)) {
app_control_set_operation(svc_handle, APP_CONTROL_OPERATION_PICK);
- win = (Evas_Object *)ug_get_window();
app_control_set_launch_mode(svc_handle, APP_CONTROL_LAUNCH_MODE_GROUP);
app_control_set_app_id(svc_handle, "ug-gallery-efl");
app_control_set_mime(svc_handle, "image/*");
WALLPAPERUI_TRACE_END;
}
-static void _set_home_wallpaper(char *path)
-{
- WALLPAPERUI_TRACE_BEGIN;
-
- if (ecore_file_exists(path) != EINA_TRUE) {
- WALLPAPERUI_ERR("%s does not exist", path);
- return;
- }
-
- if (system_settings_set_value_string(SYSTEM_SETTINGS_KEY_WALLPAPER_HOME_SCREEN, path) != SYSTEM_SETTINGS_ERROR_NONE) {
- WALLPAPERUI_ERR("system_settings_set_value_string() failed");
- elm_exit();
- return;
- }
- WALLPAPERUI_TRACE_END;
-}
-
-static int _compare_cb(const void *d1, const void *d2)
-{
- WALLPAPERUI_TRACE_BEGIN;
-
- char *v1 = (char *)d1;
- char *v2 = (char *)d2;
-
- WALLPAPERUI_TRACE_END;
- return strcmp(v1, v2);
-}
-
static void _done_to_set_wallpaper()
{
WALLPAPERUI_TRACE_BEGIN;
- char path[6][MAX_LENGTH_LINE] = {{0 } } ;
char *p = NULL;
char filepath[MAX_LENGTH_LINE] = {0};
char filename[MAX_LENGTH_LINE] = {0};
int i = 0;
int index = 0;
char *temp_path[6] = {NULL};
- bool flag = true;
- int count = 0;
- char *temp = NULL;
- char string[MAX_LENGTH_LINE] = {0};
- Eina_List *path_list = NULL;
- Eina_List *file_list = NULL;
/*copy lock wallpaper */
while (i < MAX_MULTIPLE_SELECTION) {
WALLPAPERUI_TRACE_BEGIN;
/*delete unused files */
- Eina_List *path_list = NULL;
- int i = 0;
char path[6][MAX_LENGTH_LINE] = {{0 } };
- char filepath[MAX_LENGTH_LINE] = {0};
- int count = 0;
char *value = NULL;
- char *temp = NULL;
- char string[MAX_LENGTH_LINE] = {0};
- Eina_List *file_list = NULL;
memset(path, 0, sizeof(path));
WALLPAPERUI_TRACE_END;
}
-
-static void _main_preview_image_clicked_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+static void _main_preview_image_clicked_cb(void *data, Evas_Object *obj, void *event_info)
{
WALLPAPERUI_TRACE_BEGIN;
}
feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TAP);
- wallpaper_preview_main();
+ _wallpaper_preview_main();
WALLPAPERUI_TRACE_END;
}
-void wallpaper_preview_main()
+static void _wallpaper_preview_main()
{
WALLPAPERUI_TRACE_BEGIN;
elm_image_fill_outside_set(preview_image, EINA_TRUE);
elm_image_preload_disabled_set(preview_image, EINA_TRUE);
elm_object_part_content_set(preveiw_main_layout, "preview", preview_image);
- edje_object_signal_callback_add(_EDJ(preveiw_main_layout), "preview_clicked", "edj", _preview_clicked_cb, (void *)ad);
+ edje_object_signal_callback_add(_EDJ(preveiw_main_layout), "preview_clicked", "edj", _preview_clicked_cb, ad->navi_bar);
elm_object_part_content_unset(preveiw_main_layout, "thumblist");
evas_object_show(preveiw_main_layout);
Elm_Object_Item *navi_item = elm_naviframe_item_push(ad->navi_bar, NULL, NULL, NULL, preveiw_main_layout, NULL);
- elm_naviframe_item_title_visible_set(navi_item, EINA_FALSE);
-
+ elm_naviframe_item_title_enabled_set (navi_item, EINA_FALSE, EINA_FALSE);
WALLPAPERUI_TRACE_END;
}
-
HAPI void wallpaper_main_create_view(void *data)
{
WALLPAPERUI_TRACE_BEGIN;
char *value = NULL;
- char *from = NULL;
state_data.flag_edit_click = EINA_FALSE;
state_data.flag_changed = EINA_FALSE;
static void _wallpaper_on_item_selected(void *data, Evas_Object *obj, void *event_info)
{
WALLPAPERUI_TRACE_BEGIN;
- Thumbnail *temp_item = NULL;
Thumbnail *item = (Thumbnail *)data;
if (item == NULL) {
evas_object_size_hint_align_set(ad->gengrid, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_gengrid_align_set(ad->gengrid, 0.0, 1.0);
elm_gengrid_horizontal_set(ad->gengrid, EINA_TRUE);
- elm_gengrid_bounce_set(ad->gengrid, EINA_FALSE, EINA_FALSE);
+ elm_scroller_bounce_set(ad->gengrid, EINA_FALSE, EINA_FALSE);
elm_gengrid_multi_select_set(ad->gengrid, EINA_FALSE);
elm_object_style_set(ad->gengrid, "no_effect");
-
elm_gengrid_select_mode_set(ad->gengrid, ELM_OBJECT_SELECT_MODE_ALWAYS);
/*int iw, ih;
return ad->gengrid;
}
-static void _service_imageviewer_ug_result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *data)
-{
- WALLPAPERUI_TRACE_BEGIN;
- if (result == APP_CONTROL_RESULT_SUCCEEDED) {
- char **path_array = NULL;
- int array_length = 0;
- int j = 0;
-
- if (app_control_get_extra_data_array(reply, "http://tizen.org/appcontrol/data/selected", &path_array, &array_length) == APP_CONTROL_ERROR_NONE) {
- WALLPAPERUI_DBG("array_length = %d", array_length);
-
- for (j = 0; j < array_length; j++) {
- WALLPAPERUI_DBG("path_array[%d] = %s", j, path_array[j]);
- }
-
- if (!strstr(path_array[0], ".png") && !strstr(path_array[0], ".jpg")) {
- WALLPAPERUI_DBG("Do not edit the image!");
- return;
- }
-
- if (path_array[0]) {
- memset(ad->saved_img_path, 0, sizeof(ad->saved_img_path));
- strcpy(ad->saved_img_path[0], path_array[0]);
-
- elm_image_file_set(ad->preview_image, path_array[0], NULL);
-
- /*set home icon in main */
- state_data.flag_changed = EINA_TRUE;
-
- } else if (path_array[0] && array_length > 1) {
- memset(ad->saved_img_path[0], 0, sizeof(ad->saved_img_path[0]));
- strcpy(ad->saved_img_path[0], path_array[0]);
- WALLPAPERUI_DBG("ad->saved_img_path[%d] = %s", 0, ad->saved_img_path[0]);
-
- state_data.flag_changed = EINA_TRUE;
- }
-
- int i = 0;
- for (i = 0; i < array_length; i++) {
- if (path_array[i]) {
- free(path_array[i]);
- path_array[i] = NULL;
- }
- }
- _done_button_cb();
- }
- }
-
- WALLPAPERUI_TRACE_END;
-}
-
-static void _edit_clicked_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
- WALLPAPERUI_TRACE_BEGIN;
-
- Thumbnail *item = NULL;
- Elm_Object_Item *object_item = NULL;
- Evas_Object *win = NULL;
-
-
- feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TAP);
-
- WALLPAPERUI_DBG("1 flag_edit_click=%d", state_data.flag_edit_click);
-
- if (ad->preview_image_type == WALLPAPER_TYPE_DEFAULT || state_data.flag_edit_click == EINA_FALSE) {
- WALLPAPERUI_DBG("DEFAULT TYPE NOT SUPPORT PREVIEW");
- return;
- }
-
- app_control_h pService;
- app_control_create(&pService);
- app_control_set_operation(pService, "http://tizen.org/appcontrol/operation/image/crop");
- app_control_set_app_id(pService, "image-viewer-efl");
-/* app_control_set_uri(pService, lock_path[current_index]); */
-
-
- object_item = elm_gengrid_first_item_get(ad->gengrid);
- while (object_item) {
- item = (Thumbnail *)elm_object_item_data_get(object_item);
- if (item->path && item->bSelected) {
- WALLPAPERUI_DBG("path=%s", item->path);
- app_control_set_uri(pService, item->path);
- }
- object_item = elm_gengrid_item_next_get(object_item);
- }
-
- app_control_add_extra_data(pService, "http://tizen.org/appcontrol/data/image/crop_mode", "fit_to_screen");
- win = (Evas_Object *)ug_get_window();
- app_control_set_launch_mode(pService, APP_CONTROL_LAUNCH_MODE_GROUP);
- app_control_send_launch_request(pService, _service_imageviewer_ug_result_cb, data);
- app_control_destroy(pService);
-
- WALLPAPERUI_TRACE_END;
-}
-
-static void _preview_clicked_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+static void _preview_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
{
WALLPAPERUI_TRACE_BEGIN;
+ Evas_Object *navi_bar = (Evas_Object *)data;
if (state_data.flag_edit_click) {
WALLPAPERUI_DBG("flag_edit_click=%d", state_data.flag_edit_click);
feedback_play_type(FEEDBACK_TYPE_SOUND, FEEDBACK_PATTERN_TAP);
- elm_naviframe_item_pop(ad->navi_bar);
+ elm_naviframe_item_pop(navi_bar);
WALLPAPERUI_TRACE_END;
}