[UX IMPL]Hierarchical Back in myfiles implemented 38/126138/3 submit/tizen/20170524.060757
authorshubham kumar <shubham.srib@samsung.com>
Thu, 20 Apr 2017 08:10:42 +0000 (13:40 +0530)
committershubham kumar <shubham.srib@samsung.com>
Fri, 21 Apr 2017 05:56:26 +0000 (11:26 +0530)
Change-Id: Id79af27af542da84b887d22a74029d7c972543a4
Signed-off-by: shubham kumar <shubham.srib@samsung.com>
inc/mf-main.h
inc/mf-util.h
src/common/mf-callback.c
src/common/mf-util.c
src/mf-main.c
src/widget/mf-view.c

index 4e9067a..90bea15 100644 (file)
@@ -364,6 +364,7 @@ struct appdata {
        Eina_List *download_edit_list;
        Eina_List *search_list;
        Eina_List *edit_search_list;
+       Eina_List *history;
        char *nTemp_entry;
        Evas_Object *label;
        char *file_name;
index 199d01f..ead9657 100644 (file)
@@ -369,6 +369,7 @@ int mf_util_get_internal_storage_id(void);
 void mf_file_decompression_start(void *data);
 void mf_file_compression_start(void *data);
 void mf_util_to_lower(char *str);
+void mf_util_history_list_clear(void *data);
 
 bool mf_util_get_supported_storage_cb(int storageId, storage_type_e type,
                storage_state_e state,
index e51e55b..114d721 100644 (file)
@@ -5177,7 +5177,21 @@ void mf_callback_backbutton_clicked_cb(void *data, Evas_Object * obj,
                                ap->mf_Status.entry_more = MORE_DEFAULT;
                        }
                } else {
-                       mf_callback_upper_click_cb(ap, NULL, NULL);
+                       mf_debug("called to delete the top");
+                       char *top_item = (char *)eina_list_nth(ap->history, 0);
+                       if (top_item) {
+                                       ap->history = eina_list_remove(ap->history, top_item);
+                                       SAFE_FREE_CHAR(top_item);
+                       }
+                       char *curr = (char *)eina_list_nth(ap->history, 0);
+                       if (curr && !strncmp(curr, "main_view", strlen(curr))) {
+                               ap->mf_Status.view_type = 1;
+                       } else if(curr) {
+                               mf_debug("curr path is %s", curr);
+                               ap->mf_Status.path = NULL;
+                               ap->mf_Status.path = g_string_new(curr);
+                       }
+                       mf_view_update(ap);
                }
        } else if (ap->mf_Status.more == MORE_EDIT_ADD_SHORTCUT) {
                //mf_callback_upper_click_cb(ap, NULL, NULL);
index b1309e4..da691ac 100644 (file)
@@ -107,6 +107,21 @@ bool mf_util_get_supported_storage_cb(int storageId, storage_type_e type,
        return true;
 }
 
+void mf_util_history_list_clear(void *data)
+{
+       struct appdata *ap = (struct appdata *)data;
+       MF_CHECK(ap);
+       char *p = NULL;
+       Eina_List *list;
+       EINA_LIST_FOREACH(ap->history, list, p) {
+               if (p) {
+                       SAFE_FREE_CHAR(p);
+               }
+       }
+       eina_list_free(ap->history);
+       ap->history = NULL;
+}
+
 /******************************
 ** Prototype    : __mf_util_is_mmc_supported
 ** Description  :
index af51b7c..58aab91 100644 (file)
@@ -731,6 +731,8 @@ bool __mf_main_create_app(void *data)
 
        ap->mf_Status.b_run_background = false;
 
+       ap->history = eina_list_prepend(ap->history, strdup("main_view"));
+
        mf_initialize_datacontrol_consumer(ap);
 
        MF_TRACE_END;
@@ -1051,10 +1053,10 @@ void __mf_main_terminate_app(void *data)
 
        mf_edit_folder_list_clear();
        mf_edit_file_list_clear();
+       mf_util_history_list_clear(ap);
 
        mf_fs_monitor_destory();
 
-       //mf_callback_imf_state_callback_del(ap);
        mf_util_free_eina_list_with_data(&ap->mf_FileOperation.folder_list,
                                                                         MYFILE_TYPE_FSNODE);
        mf_util_free_eina_list_with_data(&ap->mf_FileOperation.file_list,
index f361693..c6e5080 100644 (file)
@@ -276,7 +276,20 @@ void mf_view_refresh(void *data)
        mf_error(">>>>>>>>>>>> path is [%s]", ap->mf_Status.path->str);
        mf_error
                (">>>>>>>>>>>> ap->mf_Status.more =[%d], ap->mf_Status.view_type =[%d]",
-                ap->mf_Status.more, ap->mf_Status.view_type);
+                               ap->mf_Status.more, ap->mf_Status.view_type);
+       char *top_item = (char *)eina_list_nth(ap->history, 0);
+
+
+       mf_debug("top item is %s and path is  %s and length of top_item %d and path is %d", top_item, ap->mf_Status.path->str,
+                       strlen(top_item), strlen(ap->mf_Status.path->str));
+
+
+       if (!strncmp(top_item, "main_view", strlen(top_item)) || strncmp(top_item, ap->mf_Status.path->str, strlen(ap->mf_Status.path->str))
+                       || strncmp(top_item, ap->mf_Status.path->str, strlen(top_item))) {
+               if (!(ap->mf_Status.view_type == mf_view_root) && ap->mf_Status.more == MORE_DEFAULT) {
+                       ap->history = eina_list_prepend(ap->history, strdup(ap->mf_Status.path->str));
+               }
+       }
 
        mf_view_refresh_thumbnail_destroy();
        mf_error();