? onlyshowin2.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-vfs/ChangeLog,v
retrieving revision 1.1678
diff -u -a -r1.1678 ChangeLog
--- ChangeLog	10 Dec 2003 12:39:21 -0000	1.1678
+++ ChangeLog	14 Dec 2003 23:16:48 -0000
@@ -1,3 +1,9 @@
+2003-12-15  Marcin Krzyżanowski  <krzak@pld-linux.org>
+
+	* modules/vfolder/vfolder-common.c (entry_new):
+	If OnlyShowIn field exists but does not contain the string "GNOME"
+	no new entry is created.
+
 2003-12-10  Alexander Larsson  <alexl@redhat.com>
 
 	* libgnomevfs/gnome-vfs-module-callback-marshall.c:
Index: modules/vfolder/vfolder-common.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/modules/vfolder/vfolder-common.c,v
retrieving revision 1.5
diff -u -a -r1.5 vfolder-common.c
--- modules/vfolder/vfolder-common.c	24 Apr 2003 15:46:24 -0000	1.5
+++ modules/vfolder/vfolder-common.c	14 Dec 2003 23:16:52 -0000
@@ -50,12 +50,40 @@
 	   gushort      weight)
 {
 	Entry *entry;
+	gchar *onlyshowin;
 
 	entry = g_new0 (Entry, 1);
+	entry->filename = g_strdup (filename);
+
+	entry_quick_read_keys (entry, 
+			       "OnlyShowIn",
+			       &onlyshowin,
+			       NULL,
+			       NULL);
+
+	if (onlyshowin) {
+		char **parsed = g_strsplit (onlyshowin, ";", -1);
+		gboolean show = FALSE;
+		int i;
+		
+		for (i = 0; parsed[i] != NULL; i++) {
+			if (!g_ascii_strcasecmp(parsed[i],"GNOME"))
+				show=TRUE;
+		}
+		
+		g_free (onlyshowin);
+		g_strfreev (parsed);
+		
+		if (!show) {
+			g_free (entry->filename);
+			g_free (entry);
+			return NULL;
+		}
+	}
+
 	entry->refcnt = 1;
 	entry->allocs = 0;
 	entry->info = info;
-	entry->filename = g_strdup (filename);
 	entry->displayname = g_strdup (displayname);
 	entry->user_private = user_private;
 	entry->weight = weight;
@@ -81,6 +109,8 @@
 void 
 entry_unref (Entry *entry)
 {
+	if (entry == NULL) return;
+	
 	entry->refcnt--;
 
 	if (entry->refcnt == 0) {
@@ -734,11 +764,10 @@
 		}
 	}
 
-	if (entry) {
+	if (entry)
 		folder_add_entry (folder, entry);
-		entry_unref (entry);
-	}
 
+	entry_unref (entry);
 	return entry != NULL;
 }
 
@@ -785,9 +814,12 @@
 				   basename, 
 				   TRUE,
 				   1000 /*weight*/);
-		folder_add_entry (folder, entry);
+				   
+	        if (entry) {
+			folder_add_entry (folder, entry);
+			entry_unref (entry);
+		}
 
-		entry_unref (entry);
 		gnome_vfs_uri_unref (uri);
 		g_free (basename);
 
@@ -866,7 +898,7 @@
 				   900   /*weight*/);
 
 		/* Include unless specifically excluded by query */
-		if (!query || query_try_match (query, folder, entry)) {
+		if (entry && (!query || query_try_match (query, folder, entry))) {
 			D (g_print ("ADDING EXTENDED ENTRY: "
 				    "%s, %s, #%d!\n",
 				    folder_get_name (folder),
