[maemo-commits] [maemo-commits] r15345 - in projects/haf/trunk/hildon-fm: . debian hildon-fm

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Apr 3 20:05:12 EEST 2008
Author: marivoll
Date: 2008-04-03 20:05:09 +0300 (Thu, 03 Apr 2008)
New Revision: 15345

Modified:
   projects/haf/trunk/hildon-fm/ChangeLog
   projects/haf/trunk/hildon-fm/debian/changelog
   projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-selection.c
Log:
	* hildon-fm/hildon-file-selection.c
	(hildon_file_selection_selection_changed): Use a path for the
	dir_sort model when getting the row reference from it.
	(hildon_file_selection_matches_current_view): Return FALSE when
	the current_folder row reference is invalid.  This happens when
	the current folder has been deleted (N79697, again).
	(sort_function): Items with negative sort weight (such as folders)
	are always sorted by name (N77225).


Modified: projects/haf/trunk/hildon-fm/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-fm/ChangeLog	2008-04-03 14:16:00 UTC (rev 15344)
+++ projects/haf/trunk/hildon-fm/ChangeLog	2008-04-03 17:05:09 UTC (rev 15345)
@@ -1,3 +1,14 @@
+2008-04-03  Marius Vollmer  <marius.vollmer at nokia.com>
+
+	* hildon-fm/hildon-file-selection.c
+	(hildon_file_selection_selection_changed): Use a path for the
+	dir_sort model when getting the row reference from it.
+	(hildon_file_selection_matches_current_view): Return FALSE when
+	the current_folder row reference is invalid.  This happens when
+	the current folder has been deleted (N79697, again).
+	(sort_function): Items with negative sort weight (such as folders)
+	are always sorted by name (N77225).
+
 2008-18-03  Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>
 
 	* hildon-fm/hildon-file-selection.c

Modified: projects/haf/trunk/hildon-fm/debian/changelog
===================================================================
--- projects/haf/trunk/hildon-fm/debian/changelog	2008-04-03 14:16:00 UTC (rev 15344)
+++ projects/haf/trunk/hildon-fm/debian/changelog	2008-04-03 17:05:09 UTC (rev 15345)
@@ -1,3 +1,9 @@
+libhildonfm (1:2.0.3~unreleased) unstable; urgency=low
+
+  * Fixes: NB#79697, NB#77225.
+
+ -- Marius Vollmer <marius.vollmer at nokia.com>  Thu, 03 Apr 2008 19:07:54 +0300
+
 libhildonfm (1:2.0.2) unstable; urgency=low
 
   * Reverted the patch for NB#79697, it made Bookmarks to crash in startup.

Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-selection.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-selection.c	2008-04-03 14:16:00 UTC (rev 15344)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-selection.c	2008-04-03 17:05:09 UTC (rev 15345)
@@ -737,6 +737,9 @@
         return diff;
     }
 
+    /* In case of fodlers sort only by name */
+    if (weight_a < 0) key = HILDON_FILE_SELECTION_SORT_NAME;
+
     if (key == HILDON_FILE_SELECTION_SORT_MODIFIED) {
         GtkFileTime time_a, time_b;
 		gint retval;
@@ -771,7 +774,7 @@
 
     /* Sort by name. This allways applies for directories and also for
        files when name sorting is selected */
-    if (weight_a < 0 || key == HILDON_FILE_SELECTION_SORT_NAME) {
+    if (key == HILDON_FILE_SELECTION_SORT_NAME) {
         gchar *title_a, *title_b;
         gint value;
 
@@ -1240,14 +1243,17 @@
 {
     if (GTK_IS_TREE_MODEL_FILTER(priv->view_filter)) {
         GtkTreePath *current_path;
-        gint result;
+        gint result = 1;
 
         g_object_get(priv->view_filter, "virtual-root", &current_path,
                      NULL);
 
         g_assert(current_path); /* Content pane should always have root
                                    (no local device level allowed) */
-        result = gtk_tree_path_compare(path, current_path);
+        if (!gtk_tree_path_compare(path, current_path) && gtk_tree_row_reference_valid(priv->current_folder)) 
+                /* after deleting a folder the new and current (deleted) paths are same 
+                   but current_folder is invalid for the current (deleted) row */
+                result = 0;
         gtk_tree_path_free(current_path);
 
         return (result == 0);
@@ -1546,7 +1552,7 @@
     if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
 
         GtkTreeIter sort_iter, main_iter;
-        GtkTreePath *sort_path;
+        GtkTreePath *sort_path, *dir_sort_path;
 
         g_assert(model == priv->dir_filter
           && GTK_IS_TREE_MODEL_FILTER(model));
@@ -1559,11 +1565,13 @@
                                                        &sort_iter);
             sort_path =
                 gtk_tree_model_get_path(priv->main_model, &main_iter);
+            dir_sort_path = gtk_tree_model_get_path(priv->dir_sort, &sort_iter);
 
             /* Check that we have actually changed the folder */
             if (hildon_file_selection_matches_current_view(priv, sort_path))
             {
                 gtk_tree_path_free(sort_path);
+                gtk_tree_path_free(dir_sort_path);
                 ULOG_INFO("Current folder re-selected => Asked to reload (if on gateway)");
                 _hildon_file_system_model_queue_reload(
                     HILDON_FILE_SYSTEM_MODEL(priv->main_model),
@@ -1582,7 +1590,8 @@
             }
 
             gtk_tree_row_reference_free (priv->current_folder);
-            priv->current_folder = gtk_tree_row_reference_new(priv->dir_sort, sort_path);
+            priv->current_folder = gtk_tree_row_reference_new(priv->dir_sort, dir_sort_path);
+            gtk_tree_path_free(dir_sort_path);
 
         if (hildon_file_selection_content_pane_visible(priv)) {
 	    gint sort_column = GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID;


More information about the maemo-commits mailing list