Re: [Nautilus-list] Redhat merge status



On Wed, 26 Sep 2001, Darin Adler wrote:

> on 9/26/01 10:02 AM, Alex Larsson at alexl redhat com wrote:
> 
> > * We disable automatic appends of thrash emblems because of performance
> > problems with it.
> 
> For 1.0.5, I think we should either do this or fix the performance problem.

The performance problem is that it calls eel_uri_is_in_trash() for each 
files, which causes it to search for trash in the directory of the file 
using gnome_vfs_find_directory(). This can be quite costly i believe.

> > * We disable the unreadable emblem, because it shows up all over the
> > place, like on smb shares and in start-here:. Our thoughts is that it
> > should be changed to only show if the read permission of the file is
> > different from the directory it is in.
> 
> I think that's the right design. Maybe we can implement that design for
> 1.0.5. Shouldn't be too tricky.

Not really.
 
> > * We have a gross linux specific hack to not store thumbnail images on NFS
> > filesystems. I think this is sort of busted...
> 
> We need something like this in the main code, don't you think? I don't
> really have a feel for it -- I don't use systems with NFS myself.

I'm not sure we really need this. I don't see the point really. On my 
system at work $HOME is on NFS too, so writing global thumbnails to avoid 
writing over NFS gives you nothing.

I don't know what the reasoning here was. Havoc?
 
> > * We have a gross hack to make NautilusMonitor to work with favorites:
> > (Essentially strcmp + replace with hardcoded filename path)
> 
> I'd like to see this gross hack in HEAD Nautilus until we move monitoring
> into gnome-vfs (the "non-gross" fix).

I've attached the patch to the end of this mail. This hack is nothing i'm 
proud of. Apparently a hunk of it accidentally got merged already. In 
nautilus-directory.c (nautilus_directory_make_uri_canonical) the 
strcmp (canonical, "favorites:") != 0) is needed to make monitoring work 
for both favorites: and favorites:///.

BTW, in NautilusMonitor we should be using the userdata field of FAMEvent 
for the uri instead of the current get_request_hash_table() hack.

> > * Some background performance/flash hacks that depens on hacks in our
> > gnome-libs packages
> 
> What's the chance of getting this into HEAD?

I don't really know how this works. But i'll send the patches in another 
mail.
 
> > * Remove the warning about running Nautilus as root.
> 
> I could see this on HEAD.
>
> > * Remove the "Nautilus is searching your disks for trash folders" dialog
> 
> I think this is right for HEAD too. I was under the impression that the
> changes to gnome-vfs meant there really was no "searching" going on any
> more.

I can do these if you want.

/ Alex

Favorites badhack:

Index: nautilus-monitor.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-monitor.c,v
retrieving revision 1.16
diff -u -p -r1.16 nautilus-monitor.c
--- nautilus-monitor.c	2001/09/15 19:18:00	1.16
+++ nautilus-monitor.c	2001/09/26 20:31:02
@@ -39,6 +39,9 @@
 #include <libgnome/gnome-util.h>
 #include <libgnomevfs/gnome-vfs-utils.h>
 
+#include <libgnomevfs/gnome-vfs-uri.h>
+#include <string.h>
+
 struct NautilusMonitor {
 	FAMRequest request;
 };
@@ -80,6 +83,19 @@ get_fam_connection (void)
 	return &connection;
 }
 
+static GHashTable * 
+get_uri_hash_table (void)
+{
+	static GHashTable *table;
+
+	if (table == NULL) {
+		table = eel_g_hash_table_new_free_at_exit
+			(NULL, NULL, "nautilus-monitor.c: FAM URI requests");
+	}
+	return table;
+}
+
+
 static GHashTable *
 get_request_hash_table (void)
 {
@@ -98,6 +114,18 @@ get_event_uri (const FAMEvent *event)
         const char *base_path;
 	char *path, *uri;
 
+ 
+	/* For strange uri's like favorites: we do this stupid hack */
+	uri = g_hash_table_lookup (get_uri_hash_table (),
+				   GINT_TO_POINTER (FAMREQUEST_GETREQNUM (&event->fr)));
+	if (uri) {
+		if (event->filename[0] == '/') {
+			return g_strdup (uri);
+		} else {
+			return g_strconcat (uri, "///", event->filename, NULL);
+		}
+        }
+	
         /* FAM doesn't tell us when something is a full path and when
 	 * it's just partial so we have to look and see if it starts
 	 * with a /.
@@ -244,6 +272,28 @@ nautilus_monitor_active (void)
 #endif
 }
 
+static char *
+fixup_local_path (const char *uri_text)
+{
+	GnomeVFSURI *uri;
+	gchar *path = NULL;
+	/* Ugly hack to catch writes to favorites: */
+
+	uri = gnome_vfs_uri_new (uri_text);
+	if (uri == NULL)
+		return NULL;
+	if (gnome_vfs_uri_get_scheme (uri) != NULL &&
+	    strcmp (gnome_vfs_uri_get_scheme (uri), "favorites") == 0)
+		path = g_strconcat (g_get_home_dir (),
+				    "/.gnome/apps",
+				    gnome_vfs_uri_get_path (uri),
+				    NULL);
+	gnome_vfs_uri_unref (uri);
+
+	return path;
+}
+
+
 NautilusMonitor *
 nautilus_monitor_file (const char *uri)
 {
@@ -253,6 +303,7 @@ nautilus_monitor_file (const char *uri)
         FAMConnection *connection;
         char *path;
 	NautilusMonitor *monitor;
+	gboolean fixed = FALSE;
 
         connection = get_fam_connection ();
 	if (connection == NULL) {
@@ -261,6 +312,10 @@ nautilus_monitor_file (const char *uri)
 
 	path = gnome_vfs_get_local_path_from_uri (uri);
 	if (path == NULL) {
+		path = fixup_local_path (uri);
+		fixed = TRUE;
+	}
+	if (path == NULL) {
 		return NULL;
 	}
 
@@ -276,6 +331,14 @@ nautilus_monitor_file (const char *uri)
 	monitor = g_new0 (NautilusMonitor, 1);
 	FAMMonitorFile (connection, path, &monitor->request, NULL);
 
+	if (fixed) {
+		GHashTable *uri_table = get_uri_hash_table ();
+
+		g_hash_table_insert (uri_table,
+				     GINT_TO_POINTER (FAMREQUEST_GETREQNUM (&monitor->request)),
+				     g_strdup (uri));
+	}
+	
 	g_free (path);
 
 	return monitor;
@@ -293,6 +356,7 @@ nautilus_monitor_directory (const char *
         FAMConnection *connection;
         char *path;
 	NautilusMonitor *monitor;
+	gboolean fixed = FALSE;
 
         connection = get_fam_connection ();
 	if (connection == NULL) {
@@ -301,6 +365,10 @@ nautilus_monitor_directory (const char *
 
 	path = gnome_vfs_get_local_path_from_uri (uri);
 	if (path == NULL) {
+		path = fixup_local_path (uri);
+		fixed = TRUE;
+	}
+	if (path == NULL) {
 		return NULL;
 	}
         
@@ -323,6 +391,14 @@ nautilus_monitor_directory (const char *
 			     GINT_TO_POINTER (FAMREQUEST_GETREQNUM (&monitor->request)),
 			     path);
 
+	if (fixed) {
+		GHashTable *uri_table = get_uri_hash_table ();
+
+		g_hash_table_insert (uri_table,
+				     GINT_TO_POINTER (FAMREQUEST_GETREQNUM (&monitor->request)),
+				     g_strdup (uri));
+	}
+	
 	return monitor;
 #endif
 }
@@ -336,6 +412,7 @@ nautilus_monitor_cancel (NautilusMonitor
         FAMConnection *connection;
 	int reqnum;
 	char *path;
+	char *uri;
 
 	if (monitor == NULL) {
 		return;
@@ -347,6 +424,13 @@ nautilus_monitor_cancel (NautilusMonitor
 	g_hash_table_remove (get_request_hash_table (),
 			     GINT_TO_POINTER (reqnum));
 	g_free (path);
+	uri = g_hash_table_lookup (get_uri_hash_table (),
+				   GINT_TO_POINTER (reqnum));
+	if (uri) {
+		g_hash_table_remove (get_uri_hash_table (),
+				     GINT_TO_POINTER (reqnum));
+		g_free (uri);
+	}
 
         connection = get_fam_connection ();
 	g_return_if_fail (connection != NULL);





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]