[maemo-commits] [maemo-commits] r15882 - projects/haf/branches/hildon-fm/fremantle/hildon-fm

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Aug 19 11:45:16 EEST 2008
Author: yangli
Date: 2008-08-19 11:45:09 +0300 (Tue, 19 Aug 2008)
New Revision: 15882

Modified:
   projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c
   projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c
   projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.h
Log:
filter out the files in folder change dialog and disable the up button when in the most upper level were done, backup

Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c
===================================================================
--- projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c	2008-08-19 07:03:18 UTC (rev 15881)
+++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-chooser-dialog.c	2008-08-19 08:45:09 UTC (rev 15882)
@@ -2041,7 +2041,7 @@
     HildonFileChooserDialogPrivate *priv = HILDON_FILE_CHOOSER_DIALOG(self)->priv;
     GtkTreeIter iter;
     GtkTreeIter cur_iter;
-    //gchar *gtk_tree_path_str;
+    gchar *gtk_tree_path_str;
     gchar *title;
     gchar *path_string;
     GList *list = NULL;
@@ -2051,30 +2051,30 @@
         gtk_tree_model_get(GTK_TREE_MODEL(priv->model), &iter,
                            HILDON_FILE_SYSTEM_MODEL_COLUMN_DISPLAY_NAME,
                            &title, -1);
+	gtk_tree_path_str = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(priv->model),
+	                    &iter);
+    } else
+        ULOG_INFO("Failed to get current folder iter");  
+    if(!g_strcasecmp(gtk_tree_path_str, "0")) {
+      gtk_widget_set_sensitive(priv->up_button, FALSE);
+    }
+    else {
+      gtk_widget_set_sensitive(priv->up_button, TRUE);
+    }
+    printf("yang: the path string is %s\n", gtk_tree_path_str);
+    free(gtk_tree_path_str);
+    while(g_strcasecmp(title, "/")/*!g_strcasecmp(gtk_tree_path_str, "0")*/){
+        //free(title);     
 	if(strlen(title) == 0)
 	  list = g_list_append(list, "Nokia"); 
 	else
 	  list = g_list_append(list, title); 
-	printf("yang : before the loop, the title is %s\n", title);
-	
-	/*gtk_tree_path_str = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(priv->model),
-	                      &iter);*/
-    } else
-        ULOG_INFO("Failed to get current folder iter");  
-
-    while(g_strcasecmp(title, "/")/*!g_strcasecmp(gtk_tree_path_str, "0")*/){
-        //free(title);
-        //free(gtk_tree_path_str);
 	cur_iter = iter;
 	gtk_tree_model_iter_parent(GTK_TREE_MODEL(priv->model), &iter, &cur_iter);
         gtk_tree_model_get(GTK_TREE_MODEL(priv->model), &iter,
                            HILDON_FILE_SYSTEM_MODEL_COLUMN_DISPLAY_NAME,
                            &title, -1);      
-	printf("yang : in the loop, the title is %s\n", title);
-	if(strlen(title) == 0)
-	  list = g_list_append(list, "Nokia"); 
-	else
-	  list = g_list_append(list, title); 
+
 	/*gtk_tree_path_str = gtk_tree_model_get_string_from_iter(GTK_TREE_MODEL(priv->model),
 	             &iter);*/
     }
@@ -2082,7 +2082,6 @@
     path_string = g_malloc(100);
     memset(path_string, 0, 100);
     for (list = g_list_last(list); list; list = list->prev) {
-      printf("yang : content is %s", list->data);
       if(strlen(path_string) == 0)
 	strcpy(path_string, list->data);
       else
@@ -2226,7 +2225,7 @@
     gtk_box_pack_start(GTK_BOX(priv->hbox_address), priv->up_button,
                        FALSE, TRUE, 0);
     gtk_box_pack_start(GTK_BOX(priv->hbox_address), priv->path_button,
-    TRUE, FALSE, 0);
+    FALSE, TRUE, 0);
     /* organize the new button and centralized it */
     priv->vbox_new = gtk_vbox_new(FALSE, HILDON_MARGIN_DEFAULT);
     label_up = gtk_label_new("");
@@ -2244,12 +2243,6 @@
     gtk_box_pack_start(GTK_BOX(priv->hbox_browser), priv->vbox_new,
       FALSE, FALSE, 0);
     gtk_widget_show(priv->filetree);
-    /* organize the box containing the vbox_browser and a new button */
-    /*priv->hbox_whole = gtk_hbox_new(FALSE, HILDON_MARGIN_DEFAULT);
-    gtk_box_pack_start(GTK_BOX(priv->hbox_whole), priv->vbox_browser,
-                       FALSE, FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(priv->hbox_whole), priv->vbox_new,
-    TRUE, FALSE, 0);*/
 
     priv->caption_control_location =
       hildon_caption_new(size_group, _("sfil_fi_save_objects_items"),
@@ -2364,6 +2357,8 @@
        "pane-position", get_global_pane_position (),
       NULL);
 
+    hildon_file_selection_set_invisible_files(priv->filetree, TRUE);
+
     gtk_box_pack_start(GTK_BOX(GTK_DIALOG(obj)->vbox), 
 			       priv->hbox_address, FALSE, TRUE, 0);
     /*gtk_box_pack_start(GTK_BOX(GTK_DIALOG(obj)->vbox), 

Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c
===================================================================
--- projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c	2008-08-19 07:03:18 UTC (rev 15881)
+++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.c	2008-08-19 08:45:09 UTC (rev 15882)
@@ -138,7 +138,6 @@
     GtkWidget *view[4]; /* List, thumbnail, empty, repair */
     /* the pointer to the file_chooser_dialog to 
        notify to change the text in the path button */
-    GtkWidget *chooser_dialog; 
     int cur_view;
     GtkWidget *hpaned;
 
@@ -186,6 +185,9 @@
     gboolean show_hidden;
     gboolean show_upnp;
     gboolean currently_dragging;
+    /* ignoring listing the folders in the
+       content pane, file_chooser dialog needs this */
+    gboolean folders_ignoring;
     GtkFilePath *safe_folder;
 
     gchar **drag_data_uris;
@@ -195,6 +197,9 @@
     /* 1: use pannable area widget 
        0: use scrolled wnidow widget */
     gboolean pannable_flag;
+    /* set this flag to true, files will be filtered out, used
+       in for example, folder chooser dialog and some other similar dialogs */
+    gboolean invisible_files;
 };
 
 #if 0
@@ -673,17 +678,24 @@
             return FALSE;
     }
 
-    /* All files are shown if no filter is present */
-    if (!priv->filter)
-        return TRUE;
-
     gtk_tree_model_get(model, iter,
                        HILDON_FILE_SYSTEM_MODEL_COLUMN_IS_FOLDER,
                        &is_folder, -1);
 
-    if (is_folder)      /* Folders are always displayed */
+    if ((is_folder == FALSE) && priv->invisible_files) {
+      /* Files are NOT displayed in for example, 
+	 folder chooser dialog..., maybe more etc */
+        return FALSE;
+    }
+    else { 
+       /* Files are always displayed in most of the cases */
         return TRUE;
+    }
 
+    /* All files are shown if no filter is present */
+    if (!priv->filter)
+        return TRUE;
+
     memset(&info, 0, sizeof(GtkFileFilterInfo));
     info.contains = gtk_file_filter_get_needed(priv->filter);
 
@@ -3131,6 +3143,8 @@
     priv->view_filter = gtk_tree_model_filter_new(priv->main_model, temp_path);
     gtk_tree_path_free (temp_path);
 
+    hildon_file_selection_set_invisible_files(self, FALSE);
+
     gtk_tree_model_filter_set_visible_func
       (GTK_TREE_MODEL_FILTER (priv->view_filter), filter_func, priv, NULL);
 
@@ -3234,7 +3248,7 @@
     gtk_widget_hide (priv->view[3]);
 
     hildon_file_selection_inspect_view (priv);
-
+    priv->folders_ignoring = FALSE;
     return obj;
 }
 
@@ -4719,21 +4733,11 @@
    priv->chooser_dialog = chooser_dialog;
    }*/
 
-void get_current_tree_path(HildonFileSelection *self, char* uri)
+void hildon_file_selection_set_invisible_files(HildonFileSelection *self,
+					       gboolean visible)
 {
   HildonFileSelectionPrivate *priv = self->priv;
-  GtkTreeSelection *selection =
-    gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->dir_tree));
-  GtkTreeModel *model;
-  GtkTreeIter iter;
-
-  if (gtk_tree_selection_get_selected (selection, &model, &iter)){
-      char *device;
-
-      gtk_tree_model_get (model, &iter,
-			  HILDON_FILE_SYSTEM_MODEL_COLUMN_URI, &uri,
-			  -1);
-  }
+  priv->invisible_files = visible;
 }
 
 

Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.h
===================================================================
--- projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.h	2008-08-19 07:03:18 UTC (rev 15881)
+++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-selection.h	2008-08-19 08:45:09 UTC (rev 15882)
@@ -171,7 +171,10 @@
 void
 hildon_file_selection_set_current_folder_iter(HildonFileSelection * self,
                                               GtkTreeIter * main_iter);
+void hildon_file_selection_set_invisible_files(HildonFileSelection *self,
+					       gboolean visible);
 
+
 #ifndef HILDON_DISABLE_DEPRECATED
 gboolean hildon_file_selection_get_active_content_iter(HildonFileSelection
                                                        *self, GtkTreeIter *iter);


More information about the maemo-commits mailing list