=?WINDOWS-1252?Q?Re:_[PATCH]_Bug_516007_=96_Use_standard::descript?= =?WINDOWS-1252?Q?ion_file_attribute_as_window_title_if_availible?=



On Fri, Apr 25, 2008 at 4:18 PM, Paweł Paprota <ppawel fastmail fm> wrote:
> Hello!
>
>  Patch waiting for review.
>
>  http://bugzilla.gnome.org/show_bug.cgi?id=516007
>  http://bugzilla.gnome.org/attachment.cgi?id=109930&action=view

Your patch is doing synchronous I/O to query the description, which we
shouldn't do in Nautilus. The NautilusDirectory is already querying
that information, it's just a matter of adding a field for it in the
NautilusFile, copying the data from the GFileInfo to the NautilusFile
in update_info_internal(), adding an accessor
nautilus_file_get_description(), and then using it here. And here's a
patch that does exactly that, plus kills an extra unneeded key in one
of the defines. Alex must have been running low on coffee ;). I'll
attach it to the bug when I get home.

-A.Walton

>  --
>  Paweł
>
> --
>  nautilus-list mailing list
>  nautilus-list gnome org
>  http://mail.gnome.org/mailman/listinfo/nautilus-list
>
Index: src/nautilus-location-bar.c
===================================================================
--- src/nautilus-location-bar.c	(revision 14090)
+++ src/nautilus-location-bar.c	(working copy)
@@ -532,6 +532,7 @@
 	bar = NAUTILUS_LOCATION_BAR (navigation_bar);
 	
 	user_location = gtk_editable_get_chars (GTK_EDITABLE (bar->details->entry), 0, -1);
+
 	location = g_file_parse_name (user_location);
 	g_free (user_location);
 	uri = g_file_get_uri (location);
@@ -553,6 +554,7 @@
 	GFile *last_location;
 	
 	current_text = gtk_entry_get_text (GTK_ENTRY (bar->details->entry));
+
 	location = g_file_parse_name (current_text);
 	last_location = g_file_parse_name (bar->details->last_location);
 	
Index: configure.in
===================================================================
--- configure.in	(revision 14090)
+++ configure.in	(working copy)
@@ -39,6 +39,7 @@
 AM_INIT_AUTOMAKE
 AM_MAINTAINER_MODE
 AC_SUBST([ACLOCAL_AMFLAGS], ["\${ACLOCAL_FLAGS}"])
+AC_SUBST([NAUTILUS_EXTENSION_VERSION], nautilus_extension_current.nautilus_extension_revision])
 
 AC_SUBST(BONOBO_ACTIVATION_REQUIRED, [bonobo_activation_minver])
 AC_SUBST(BONOBO_REQUIRED, [bonobo_minver])
Index: libnautilus-private/nautilus-file-private.h
===================================================================
--- libnautilus-private/nautilus-file-private.h	(revision 14090)
+++ libnautilus-private/nautilus-file-private.h	(working copy)
@@ -46,7 +46,7 @@
 	 GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS)
 
 #define NAUTILUS_FILE_DEFAULT_ATTRIBUTES				\
-	"standard::*,access::*,mountable::*,time::*,unix::*,owner::*,selinux::*,thumbnail::*,mountable::*"
+	"standard::*,access::*,mountable::*,time::*,unix::*,owner::*,selinux::*,thumbnail::*"
 
 /* These are in the typical sort order. Known things come first, then
  * things where we can't know, finally things where we don't yet know.
@@ -90,7 +90,8 @@
 	
 	eel_ref_str mime_type;
 	
-	char* selinux_context;
+	char *selinux_context;
+	char *description;
 	
 	GError *get_info_error;
 	
Index: libnautilus-private/nautilus-file.c
===================================================================
--- libnautilus-private/nautilus-file.c	(revision 14090)
+++ libnautilus-private/nautilus-file.c	(working copy)
@@ -1552,6 +1552,7 @@
 	GIcon *icon;
 	GFile *old_activation_location;
 	const char *activation_uri;
+	const char *description;
 	
 	if (file->details->is_gone) {
 		return FALSE;
@@ -1806,6 +1807,13 @@
 		file->details->selinux_context = g_strdup (selinux_context);
 	}
 	
+	description = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION);
+	if (eel_strcmp (file->details->description, description) != 0) {
+		changed = TRUE;
+		g_free (file->details->description);
+		file->details->description = g_strdup (description);
+	}
+	
 	if (update_name) {
 		name = g_file_info_get_name (info);
 		if (file->details->name == NULL ||
@@ -3008,6 +3016,21 @@
 {
 	return g_strdup (eel_ref_str_peek (file->details->name));
 }
+
+/**
+ * nautilus_file_get_description:
+ * @file: a #NautilusFile.
+ * 
+ * Gets the standard::description key from @file, if 
+ * it has been cached.
+ * 
+ * Returns: a string containing the standard::description key, or %NULL.
+ */
+char *
+nautilus_file_get_description (NautilusFile *file)
+{
+	return g_strdup (file->details->description);
+}
    
 void             
 nautilus_file_monitor_add (NautilusFile *file,
Index: libnautilus-private/nautilus-file.h
===================================================================
--- libnautilus-private/nautilus-file.h	(revision 14090)
+++ libnautilus-private/nautilus-file.h	(working copy)
@@ -155,6 +155,7 @@
 char *                  nautilus_file_get_edit_name                     (NautilusFile                   *file);
 char *                  nautilus_file_get_name                          (NautilusFile                   *file);
 GFile *                 nautilus_file_get_location                      (NautilusFile                   *file);
+char *			 nautilus_file_get_description			 (NautilusFile			 *file);
 char *                  nautilus_file_get_uri                           (NautilusFile                   *file);
 char *                  nautilus_file_get_uri_scheme                    (NautilusFile                   *file);
 NautilusFile *          nautilus_file_get_parent                        (NautilusFile                   *file);
Index: libnautilus-private/nautilus-file-utilities.c
===================================================================
--- libnautilus-private/nautilus-file-utilities.c	(revision 14090)
+++ libnautilus-private/nautilus-file-utilities.c	(working copy)
@@ -66,7 +66,10 @@
 	title = NULL;
 	if (location) {
 		file = nautilus_file_get (location);
-		title = nautilus_file_get_display_name (file);
+		title = nautilus_file_get_description (file);
+		if (title == NULL) {
+			title = nautilus_file_get_display_name (file);
+		}
 		nautilus_file_unref (file);
 	}
 


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