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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Nov 13 13:30:20 EET 2008
Author: yangli
Date: 2008-11-13 13:30:19 +0200 (Thu, 13 Nov 2008)
New Revision: 16650

Modified:
   projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-private.c
Log:
create a virtual node

Modified: projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-private.c
===================================================================
--- projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-private.c	2008-11-13 11:24:08 UTC (rev 16649)
+++ projects/haf/branches/hildon-fm/fremantle/hildon-fm/hildon-file-system-private.c	2008-11-13 11:30:19 UTC (rev 16650)
@@ -144,25 +144,36 @@
     if (G_UNLIKELY(locations == NULL))
     {
         HildonFileSystemSpecialLocation *location;
+	HildonFileSystemSpecialLocation *virtual_location;
+ 
         const gchar *env;
         gchar *rootpath;
         GNode *rootnode;
-
+	GNode *virtual_node;
+	
         /* Invisible root node
            above everything else */
 
         location = g_object_new (HILDON_TYPE_FILE_SYSTEM_ROOT, NULL);
-        location->basepath = g_strdup ("file:///");
+	/* give it a very wrong path to prevent it list the file system layout */
+	location->basepath = g_strdup ("files:///");
         locations = g_node_new (location);
 
+	virtual_location = g_object_new(HILDON_TYPE_FILE_SYSTEM_SPECIAL_LOCATION, NULL);
+	virtual_location->basepath = g_strdup ("files:///");
+
+        virtual_node = g_node_new (virtual_location);
+
         rootpath =  get_local_device_root_path();
 
         /* Setup local device */
         location = g_object_new(HILDON_TYPE_FILE_SYSTEM_LOCAL_DEVICE, NULL);
         location->basepath = g_filename_to_uri(rootpath, NULL, NULL);
         rootnode = g_node_new(location);
-        g_node_append(locations, rootnode);
 
+	g_node_append(locations, virtual_node);
+	g_node_append(virtual_node, rootnode);
+
         /* Setup safe folders */
         setup_safe_folder(rootnode, rootpath, ".images",
             _("sfil_li_folder_images"), "qgn_list_filesys_image_fldr",
@@ -187,7 +198,7 @@
         if (env && env[0]) {
             location = g_object_new(HILDON_TYPE_FILE_SYSTEM_UPNP, NULL);
             location->basepath = g_strdup(env);
-            g_node_append_data(locations, location);
+            g_node_append_data(/*locations*/virtual_node, location);
         }
 
 	/* Setup multiple Bluetooth device support */
@@ -195,7 +206,7 @@
 	if (env && env[0]) {
 	  location = g_object_new(HILDON_TYPE_FILE_SYSTEM_OBEX, NULL);
 	  location->basepath = g_strdup(env);
-	  g_node_append_data(locations, location);
+	  g_node_append_data(/*locations*/virtual_node, location);
 	}
 
         /* Setup SMB
@@ -203,10 +214,9 @@
         {
           location = g_object_new (HILDON_TYPE_FILE_SYSTEM_SMB, NULL);
           location->basepath = g_strdup ("smb://");
-          g_node_append_data (locations, location);
+          g_node_append_data (/*locations*/virtual_node, location);
         }
     }
-
     return locations;
 }
 


More information about the maemo-commits mailing list