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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Jun 21 12:32:05 EEST 2007
Author: richard
Date: 2007-06-21 12:32:02 +0300 (Thu, 21 Jun 2007)
New Revision: 12409

Modified:
   projects/haf/trunk/hildon-fm/ChangeLog
   projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c
Log:
Improve fix for NB#59746.

Modified: projects/haf/trunk/hildon-fm/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-fm/ChangeLog	2007-06-21 09:07:53 UTC (rev 12408)
+++ projects/haf/trunk/hildon-fm/ChangeLog	2007-06-21 09:32:02 UTC (rev 12409)
@@ -1,3 +1,13 @@
+2007-06-21  Carlos Garnacho  <carlos at imendio.com>
+
+	* hildon-fm/hildon-file-system-private.c
+	(get_special_location_callback): Factor out node creation code to
+	(create_child_location): Added
+	(_hildon_file_system_get_special_location): Use
+	create_child_location() on the root node if no node was found,
+	this way it handles properly all drive:/// URIs (improvement to
+	the fix below for NB#59746).
+
 2007-06-21  Richard Hult  <richard at imendio.com>
 
 	* hildon-fm/hildon-file-system-storage-dialog.c: Remove the
@@ -16,7 +26,7 @@
 	(_hildon_file_system_get_locations): Make the root filesystem node
 	to have the uri file:///, this way
 	hildon_file_system_model_load_path() will create the correct node
-	hierarchy on top of it when no node is found (NB59746).
+	hierarchy on top of it when no node is found (NB#59746).
 
 2007-06-19  Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>
 

Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c
===================================================================
--- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c	2007-06-21 09:07:53 UTC (rev 12408)
+++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-system-private.c	2007-06-21 09:32:02 UTC (rev 12409)
@@ -224,6 +224,24 @@
     gboolean is_child;
 } CallbackData;
 
+static HildonFileSystemSpecialLocation *
+create_child_location (HildonFileSystemSpecialLocation *parent_location,
+		       GNode                           *parent,
+		       const gchar                     *uri)
+{
+    HildonFileSystemSpecialLocation *location;
+
+    location = hildon_file_system_special_location_create_child_location (
+	    parent_location, (gchar *) uri);
+
+    if (location) {
+        g_object_ref (location);
+	g_node_append_data (parent, location);
+    }
+
+    return location;
+}
+
 static gboolean get_special_location_callback(GNode *node, gpointer data)
 {
     HildonFileSystemSpecialLocation *candidate = node->data;
@@ -245,15 +263,8 @@
                 searched->is_child = FALSE;
             } else if (len_cand == 0
                        || searched->uri[len_cand] == G_DIR_SEPARATOR) {
-                searched->result =
-                    hildon_file_system_special_location_create_child_location(
-                    candidate, searched->uri);
+		searched->result = create_child_location (candidate, node, searched->uri);
                 searched->is_child = TRUE;
-                if (searched->result)
-                  {
-                    g_object_ref (searched->result);
-                    g_node_append_data (node, searched->result);
-                  }
             }
 
             return searched->result != NULL;
@@ -282,6 +293,13 @@
 
         g_node_traverse(locations, G_POST_ORDER, G_TRAVERSE_ALL, -1,
             get_special_location_callback, &data);
+
+	if (!data.result) {
+	    /* No matching node found, try to create one */
+	    data.result = create_child_location (locations->data, locations, data.uri);
+	    data.is_child = TRUE;
+        }
+
         g_free(data.uri);
     }
 


More information about the maemo-commits mailing list