Removed unused rename functionality code 54/106554/1
authorRahul Dadhich <r.dadhich@samsung.com>
Thu, 8 Dec 2016 08:11:53 +0000 (13:41 +0530)
committerbhutani.92 <bhutani.92@samsung.com>
Thu, 22 Dec 2016 05:18:33 +0000 (10:48 +0530)
Change-Id: I3e64860eea40a5a25408e2d9b7f5c202bc403dec
Signed-off-by: Rahul Dadhich <r.dadhich@samsung.com>
inc/gallery.h
project_def.prop
res/edje/gl-gengrid-item-albums.edc
src/2dview/gl-albums-edit.c
src/2dview/gl-albums-rename.c [deleted file]
src/2dview/gl-albums-rename.h [deleted file]
src/features/gl-albums.c
src/util/gl-lang.c
src/util/gl-util.c

index f0ac90a..5323ced 100644 (file)
@@ -223,7 +223,6 @@ typedef enum _gl_view_mode
        GL_VIEW_ALBUMS,
        GL_VIEW_ALBUMS_EDIT,
        GL_VIEW_ALBUMS_SELECT,
-       GL_VIEW_ALBUMS_RENAME,
        GL_VIEW_TIMELINE,
        GL_VIEW_THUMBS,
        GL_VIEW_THUMBS_EDIT,
index 0511933..12649da 100644 (file)
@@ -9,7 +9,7 @@ type = app
 profile = mobile-3.0
 
 # C Sources
-USER_SRCS = src/util/gl-fs.c src/features/gl-albums.c src/data/gl-data-util.c src/2dview/gl-albums-rename.c src/util/gl-ext-ug-load.c src/features/gl-thumbs-sel.c src/data/gl-local-data.c src/features/gl-entry.c src/widget/gl-gesture.c src/widget/gl-tile.c src/widget/gl-rotate-bg.c src/util/gl-lang.c src/widget/gl-ctxpopup.c src/util/gl-db-update.c src/features/gl-main.c src/util/gl-thread-util.c src/widget/gl-editfield.c src/widget/gl-controlbar.c src/widget/gl-notify.c src/gallery.c src/util/gl-file-util.c src/util/gl-debug.c src/2dview/gl-timeline.c src/widget/gl-button.c src/util/gl-ta.c src/2dview/gl-albums-new.c src/2dview/gl-albums-edit.c src/widget/gl-nocontents.c src/data/gl-data-type.c src/widget/gl-progressbar.c src/widget/gl-thumb.c src/widget/gl-popup.c src/features/gl-pinchzoom.c src/features/gl-albums-sel.c src/data/gl-data.c src/features/gl-thumbs-edit.c src/util/gl-ui-util.c src/util/gl-util.c src/features/gl-thumbs.c
+USER_SRCS = src/util/gl-fs.c src/features/gl-albums.c src/data/gl-data-util.c src/util/gl-ext-ug-load.c src/features/gl-thumbs-sel.c src/data/gl-local-data.c src/features/gl-entry.c src/widget/gl-gesture.c src/widget/gl-tile.c src/widget/gl-rotate-bg.c src/util/gl-lang.c src/widget/gl-ctxpopup.c src/util/gl-db-update.c src/features/gl-main.c src/util/gl-thread-util.c src/widget/gl-editfield.c src/widget/gl-controlbar.c src/widget/gl-notify.c src/gallery.c src/util/gl-file-util.c src/util/gl-debug.c src/2dview/gl-timeline.c src/widget/gl-button.c src/util/gl-ta.c src/2dview/gl-albums-new.c src/2dview/gl-albums-edit.c src/widget/gl-nocontents.c src/data/gl-data-type.c src/widget/gl-progressbar.c src/widget/gl-thumb.c src/widget/gl-popup.c src/features/gl-pinchzoom.c src/features/gl-albums-sel.c src/data/gl-data.c src/features/gl-thumbs-edit.c src/util/gl-ui-util.c src/util/gl-util.c src/features/gl-thumbs.c
 USER_SRCS_ABS = 
 
 # EDC Sources
index d1b56ec..5bc56e3 100644 (file)
@@ -804,6 +804,18 @@ group {
                        action: STATE_SET "show" 0.0;
                        target: "sd_card_icon_img_bg";
                }
+               program { name: "focus_in";
+                       signal: "elm,state,focused";
+                       source: "elm";
+                       action: STATE_SET "enabled" 0.0;
+                       target: "focus_bg";
+               }
+               program { name: "focus_out";
+                       signal: "elm,state,unfocused";
+                       source: "elm";
+                       action: STATE_SET "default" 0.0;
+                       target: "focus_bg";
+               }
                GL_GENGRID_FOCUS("focus_event")
                GL_GENGRID_SOUND("focus_event")
                GL_GENGRID_PLARY_SOUND
index 1894d9f..56c28ba 100644 (file)
@@ -17,7 +17,6 @@
 #include <errno.h>
 #include "gl-albums.h"
 #include "gl-albums-edit.h"
-#include "gl-albums-rename.h"
 #include "gl-debug.h"
 #include "gl-strings.h"
 #include "gl-ui-util.h"
diff --git a/src/2dview/gl-albums-rename.c b/src/2dview/gl-albums-rename.c
deleted file mode 100644 (file)
index 4f71aec..0000000
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.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 "gl-debug.h"
-#include "gl-fs.h"
-#include "gl-entry.h"
-#include "gl-albums-rename.h"
-#include "gl-albums.h"
-#include "gl-ui-util.h"
-#include "gl-util.h"
-#include "gl-controlbar.h"
-#include "gl-editfield.h"
-#include "gl-button.h"
-#include "gl-popup.h"
-#include "gl-strings.h"
-#include "gl-fs.h"
-#include "gl-db-update.h"
-#include "gl-file-util.h"
-
-static void __gl_albums_rename_trans_finished(void *data)
-{
-       GL_CHECK(data);
-       gl_appdata *ad = (gl_appdata *)data;
-       int view_mode = gl_get_view_mode(ad);
-       gl_dbgW("view_mode: %d", view_mode);
-
-       /* Clear previous view after animation finished */
-       if (view_mode == GL_VIEW_ALBUMS_RENAME) {
-               elm_gengrid_clear(ad->albuminfo.view);
-       }
-}
-
-static int __gl_albums_rename_pop_view(void *data)
-{
-       GL_CHECK_VAL(data, -1);
-       gl_appdata *ad = (gl_appdata *)data;
-       GL_CHECK_VAL(ad->maininfo.naviframe, -1);
-       gl_dbg("");
-
-       ad->albuminfo.selected = NULL;
-       /* Update album view */
-       gl_set_view_mode(data, GL_VIEW_ALBUMS);
-       _gl_albums_change_mode(data, false);
-       return 0;
-}
-
-/* dont call elm_naviframe_item_pop in this callback */
-static Eina_Bool __gl_albums_rename_pop_cb(void *data, Elm_Object_Item *it)
-
-{
-       /* If the back button is clicked or H/W Back key is pressed,
-       this callback will be called right before the
-       current view pop. User may implement application logic here. */
-
-       /* To proceed the popping, please return the EINA_TRUE or not,
-       popping will be canceled.
-       If it needs to delete the current view without any transition effect,
-       then call the elm_object_item_del() here and then return the EINA_FALSE */
-
-       gl_dbg("");
-       GL_CHECK_VAL(data, -1);
-       gl_appdata *ad = (gl_appdata *)data;
-       ad->albuminfo.selected = NULL;
-       /* Update edit view */
-       gl_set_view_mode(data, GL_VIEW_ALBUMS_EDIT);
-       gl_albums_update_items(data);
-       return EINA_TRUE;
-}
-
-/*It is used by rename in longpressed event popup, after rename, should pop to album view, not album edit view*/
-static Eina_Bool __gl_albums_rename_pop_to_album_cb(void *data, Elm_Object_Item *it)
-
-{
-       gl_dbg("");
-       GL_CHECK_VAL(data, -1);
-       gl_appdata *ad = (gl_appdata *)data;
-       ad->albuminfo.selected = NULL;
-       /* Update edit view */
-       gl_set_view_mode(data, GL_VIEW_ALBUMS);
-       gl_albums_update_items(data);
-       return EINA_TRUE;
-}
-
-/*
-* @param b_enter
-*      True: Enter key on Keyboard pressed, False: Button Done clicked
-*/
-static int __gl_albums_rename_process(void *data, bool b_enter)
-{
-       gl_dbg("b_enter: %d", b_enter);
-       GL_CHECK_VAL(data, -1);
-       gl_appdata *ad = (gl_appdata *)data;
-       bool b_root_path = false;
-       gl_cluster *album_item = NULL;
-
-       /*If click "Done", will back to album view, pop callback should not be called.*/
-       evas_object_data_del(ad->entryinfo.entry, "gl_entry_pop_cb_key");
-
-       if (gl_get_view_mode(ad) != GL_VIEW_ALBUMS_RENAME) {
-               gl_dbgE("View mode is wrong!");
-               goto RENAME_FAILED;
-       }
-
-       album_item = ad->albuminfo.selected;
-       if (album_item == NULL || album_item->cluster == NULL ||
-               album_item->cluster->uuid == NULL) {
-               gl_dbgE("selected_album is NULL!");
-               goto RENAME_FAILED;
-       }
-
-       char name[GL_FILE_NAME_LEN_MAX] = { 0, };
-       /* Get utf8 format string */
-       int ret = -1;
-       ret = gl_get_entry_text(ad->entryinfo.entry, name,
-                               GL_FILE_NAME_LEN_MAX);
-       if (ret != 0) {
-               gl_dbgE("Get entry text failed!");
-               goto RENAME_FAILED;
-       }
-
-       /* Get valid name */
-       if (_gl_validate_album_name(data, name) != 0) {
-               if (b_enter) {
-                       _gl_editfield_hide_imf(ad);
-               }
-               return -1;
-       }
-
-       gl_sdbg("Valid album name: %s", name);
-       /* Get src folder path */
-       char old_path[GL_DIR_PATH_LEN_MAX] = { 0, };
-       if (album_item->cluster->path) {
-               g_strlcpy(old_path, album_item->cluster->path,
-                         GL_DIR_PATH_LEN_MAX);
-               gl_sdbg("Src folder: %s", old_path);
-               if (_gl_data_is_root_path(old_path)) {
-                       /**
-                       * Root path, couldn't rename root path,
-                       * make the new dest folder
-                       * and move all files for root path to it.
-                       */
-                       gl_dbg("Rename [No Name] album's name.");
-                       b_root_path = true;
-               }
-       } else {
-               gl_dbgE("gl_db_get_folder_fullpath failed(%d)!", ret);
-               goto RENAME_FAILED;
-       }
-
-       /* Get dest folder path */
-       char new_path[GL_DIR_PATH_LEN_MAX] = { 0, };
-       char parent[GL_DIR_PATH_LEN_MAX] = { 0, };
-
-       if (b_root_path) {
-               char *default_images_path = _gl_get_directory_path(STORAGE_DIRECTORY_IMAGES);
-               GL_CHECK_VAL(default_images_path, -1);
-               snprintf(new_path, GL_DIR_PATH_LEN_MAX, "%s/%s",
-                               default_images_path, name);
-               g_strlcpy(parent, default_images_path, GL_DIR_PATH_LEN_MAX);
-               GL_FREE(default_images_path);
-       } else {
-               g_strlcpy(new_path, old_path, GL_DIR_PATH_LEN_MAX);
-               g_strlcpy(parent, old_path, GL_DIR_PATH_LEN_MAX);
-
-               int i = 0;
-               int length = strlen(old_path);
-               for (i = length; i >= 0; i--) {
-                       if (new_path[i] == '/') {
-                               gl_dbg("length=%d, i=%d", length, i);
-                               /* Path like "/root/abc/" */
-                               if (i == length - 1) {
-                                       continue;
-                               }
-                               memcpy(&new_path[i + 1], name, strlen(name));
-                               new_path[i + 1 + strlen(name)] =  '\0';
-                               parent[i] =  '\0';
-                               break;
-                       }
-               }
-       }
-
-       gl_sdbg("Dest folder: %s", new_path);
-       if (!g_strcmp0(old_path, new_path))
-       {
-               gl_dbgW("Same as current name!");
-               goto RENAME_FAILED;
-       }
-
-       /**
-       * If dir is empty, 1 is returned,
-       * if it contains at least 1 file, 0 is returned.
-       * On failure, -1 is returned.
-       */
-       {
-               memset(new_path, 0x00, GL_DIR_PATH_LEN_MAX);
-               snprintf(new_path, GL_DIR_PATH_LEN_MAX, "%s/%s", parent, name);
-               gl_sdbg("New dir path: %s", new_path);
-               int res = gl_file_dir_is_empty(new_path);
-               gl_dbg("file_dir_is_empty return value: %d", res);
-               if (res == 0) {
-                       char *popup_desc = NULL;
-                       popup_desc = (char *)calloc(GL_POPUP_STRING_MAX,
-                                                   sizeof(char));
-                       if (popup_desc == NULL) {
-                               gl_dbgE("memory allocation fail!");
-                               return -1;
-                       }
-
-                       snprintf(popup_desc, GL_POPUP_STRING_MAX, "%s<br>%s",
-                                GL_STR_SAME_NAME_ALREADY_IN_USE, GL_STR_RETRY_Q);
-                       popup_desc[strlen(popup_desc)] = '\0';
-                       gl_popup_create_popup(ad, GL_POPUP_ALBUM_RENAME_DUPLICATE,
-                                             popup_desc);
-                       GL_FREE(popup_desc);
-                       gl_dbgW("New folder already exists!");
-                       return -1;
-               }
-       }
-
-       _gl_db_update_lock_once(ad, true);
-       if (b_root_path) {
-               /**
-               * Case 1: Rename virtual album 'No Name'.
-               * It couldn't be done by updating album record in DB directly.
-               * Cuz it would change the folder path of all folder records,
-               * to make them invalid.
-               *
-               * Create new folder under default images path,
-               * Move all medias under root path to new folder.
-               */
-               if (gl_make_new_album(name) == false) {
-                       gl_popup_create_popup(ad, GL_POPUP_NOBUT,
-                                             GL_STR_UNABLE_tO_RENAME);
-                       gl_dbgE("Failed to make a new directory!");
-                       goto RENAME_FAILED;
-               }
-
-               /* Move medias from 'No Name' album to new album */
-               if (gl_move_root_album(ad, album_item, new_path) != 0) {
-                       gl_dbg("gl_move_root_album failed!");
-                       gl_popup_create_popup(ad, GL_POPUP_NOBUT,
-                                             GL_STR_UNABLE_tO_RENAME);
-                       goto RENAME_FAILED;
-               } else {
-                       gl_dbg("New album added, update albums list.");
-                       ad->albuminfo.selected = NULL;
-                       _gl_data_update_cluster_list(ad);
-               }
-       } else {
-               /**
-               * Case 2: Rename normal album. Update album record in DB.
-               */
-               media_folder_set_name(album_item->cluster->folder_h, name);
-               ret = media_folder_update_to_db(album_item->cluster->folder_h);
-               if (ret < 0) {
-                       gl_dbg("media_folder_set_name failed (%d)!", ret);
-                       goto RENAME_FAILED;
-               }
-
-               /**
-               * Change folder name in file system
-               * for some special name, DB update success, but file mv failed.
-               * So, do this first.
-               */
-               if (gl_file_exists(old_path)) {
-                       if (!gl_file_mv(old_path, new_path)) {
-                               gl_dbg("file_mv failed!");
-                       }
-               } else {
-                       gl_dbgW("Source folder path doesn't exist!");
-               }
-               /* Update memory */
-               GL_FREEIF(album_item->cluster->display_name);
-               album_item->cluster->display_name = strdup(name);
-               GL_FREEIF(album_item->cluster->path);
-               album_item->cluster->path = strdup(new_path);
-       }
-
-       elm_naviframe_item_pop(ad->maininfo.naviframe);
-       __gl_albums_rename_pop_view(data);
-       return 0;
-
-RENAME_FAILED:
-
-       elm_naviframe_item_pop(ad->maininfo.naviframe);
-       __gl_albums_rename_pop_view(data);
-       return -1;
-}
-
-int _gl_albums_rename_create_view(void *data, gl_cluster *album)
-{
-       GL_CHECK_VAL(album, -1);
-       GL_CHECK_VAL(album->cluster, -1);
-       GL_CHECK_VAL(album->cluster->display_name, -1);
-       GL_CHECK_VAL(data, -1);
-       gl_appdata *ad = (gl_appdata *)data;
-       gl_dbg("");
-
-       ad->entryinfo.mode = GL_ENTRY_RENAME_ALBUM;
-
-       /* Create entry view */
-       if (_gl_entry_create_view(data, album->cluster->display_name, GL_STR_ID_CHNAGE_NAME) < 0) {
-               ad->entryinfo.mode = GL_ENTRY_NONE;
-               return -1;
-       }
-       /* Set callbacks */
-       Evas_Object *entry = _gl_editfield_get_entry(data);
-       GL_CHECK_VAL(entry, -1);
-       evas_object_data_set(entry, "gl_entry_process_cb_key",
-                            __gl_albums_rename_process);
-       if (GL_VIEW_ALBUMS == gl_get_view_mode(data))
-               evas_object_data_set(entry, "gl_entry_pop_cb_key",
-                                    __gl_albums_rename_pop_to_album_cb);
-       else
-               evas_object_data_set(entry, "gl_entry_pop_cb_key",
-                                    __gl_albums_rename_pop_cb);
-
-       evas_object_data_set(entry, "gl_entry_transit_cb_key",
-                            __gl_albums_rename_trans_finished);
-       gl_set_view_mode(data, GL_VIEW_ALBUMS_RENAME);
-       return 0;
-}
-
-int _gl_albums_rename_update_view(void *data)
-{
-       GL_CHECK_VAL(data, -1);
-       gl_appdata *ad = (gl_appdata *)data;
-       gl_dbg("");
-
-       if (gl_check_gallery_empty(data) ||
-               ad->albuminfo.elist->edit_cnt == 0) {
-               /* Remove invalid widgets */
-               gl_del_invalid_widgets(data, GL_INVALID_NONE);
-               gl_dbgW("None editable albums, show albums view!");
-               _gl_albums_change_mode(data, false);
-               return 0;
-       }
-
-       /* Album selected for rename was deleted */
-       if (ad->albuminfo.selected == NULL) {
-               gl_dbgW("Rename invalid album!");
-               /* Remove rename view */
-               elm_naviframe_item_pop(ad->maininfo.naviframe);
-               return 0;
-       }
-
-       /* Cluster list updated, clear view */
-       elm_gengrid_clear(ad->albuminfo.view);
-       return 0;
-}
-
-int _gl_albums_rename_update_lang(void *data)
-{
-       GL_CHECK_VAL(data, -1);
-       gl_appdata *ad = (gl_appdata *)data;
-       GL_CHECK_VAL(ad->entryinfo.nf_it, -1);
-
-       if (ad->popupinfo.popup) {
-               char *popup_desc = (char *)calloc(GL_POPUP_STRING_MAX,
-                                                 sizeof(char));
-               if (popup_desc) {
-                       snprintf(popup_desc, GL_POPUP_STRING_MAX, "%s<br>%s",
-                                GL_STR_SAME_NAME_ALREADY_IN_USE, GL_STR_RETRY_Q);
-                       popup_desc[strlen(popup_desc)] = '\0';
-                       gl_popup_create_popup(ad, GL_POPUP_ALBUM_RENAME_DUPLICATE,
-                                             popup_desc);
-                       GL_FREE(popup_desc);
-               }
-       }
-
-       return 0;
-}
-
diff --git a/src/2dview/gl-albums-rename.h b/src/2dview/gl-albums-rename.h
deleted file mode 100644 (file)
index 9b37e8e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.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.
- */
-
-#ifndef _GL_ALBUMS_RENAME_H_
-#define _GL_ALBUMS_RENAME_H_
-
-#include <Elementary.h>
-#include "gallery.h"
-
-int _gl_albums_rename_create_view(void *data, gl_cluster *album);
-int _gl_albums_rename_update_view(void *data);
-int _gl_albums_rename_update_lang(void *data);
-
-#endif
-
index d358cf5..8a32317 100644 (file)
@@ -32,7 +32,6 @@
 #include "gl-thumbs-edit.h"
 #include "gl-albums-sel.h"
 #include "gl-albums-edit.h"
-#include "gl-albums-rename.h"
 #include "gl-albums-new.h"
 #include "gl-strings.h"
 #include "gl-nocontents.h"
@@ -913,8 +912,6 @@ int gl_albums_update_view(void *data)
                gl_albums_update_items(data);
        } else if (view_mode == GL_VIEW_ALBUMS_EDIT) {
                _gl_albums_edit_update_view(data);
-       } else if (view_mode == GL_VIEW_ALBUMS_RENAME) {
-               _gl_albums_rename_update_view(data);
        }
        return 0;
 }
index 9f339b2..c9be102 100644 (file)
@@ -28,7 +28,6 @@
 #include "gl-albums-sel.h"
 #include "gl-timeline.h"
 #include "gl-albums-edit.h"
-#include "gl-albums-rename.h"
 #include "gl-thumbs.h"
 #include "gl-thumbs-sel.h"
 #include "gl-thumbs-edit.h"
@@ -71,10 +70,6 @@ int _gl_lang_update(void *data)
        case GL_VIEW_ALBUMS_EDIT:
                _gl_albums_edit_update_lang(data);
                break;
-       case GL_VIEW_ALBUMS_RENAME:
-               __gl_lang_update_albums(data);
-               _gl_albums_edit_update_lang(data);
-               break;
        case GL_VIEW_ALBUMS_SELECT:
                __gl_lang_update_albums(data);
                break;
index 832a85d..f984c64 100644 (file)
@@ -1829,8 +1829,8 @@ Eina_Bool gl_update_view(void *data, int mode)
        }
 
        if (view_mode == GL_VIEW_ALBUMS ||
-               view_mode == GL_VIEW_ALBUMS_EDIT ||
-               view_mode == GL_VIEW_ALBUMS_RENAME || view_mode == GL_VIEW_ALBUM_REORDER) {
+               view_mode == GL_VIEW_ALBUMS_EDIT
+                       || view_mode == GL_VIEW_ALBUM_REORDER) {
                /* Albums list should be updated first */
                gl_albums_update_view(ad);
        } else if (view_mode == GL_VIEW_THUMBS) {