nautilus r13640 - in trunk: . libnautilus-private



Author: alexl
Date: Tue Jan 22 21:23:35 2008
New Revision: 13640
URL: http://svn.gnome.org/viewvc/nautilus?rev=13640&view=rev

Log:
2008-01-22  Alexander Larsson  <alexl redhat com>

        * libnautilus-private/nautilus-file.c:
        (nautilus_file_invalidate_extension_info_internal):
        (nautilus_file_add_string_attribute):
	Lazily allocate the extension info hashtable.
	Internalize the extension info attribute names.




Modified:
   trunk/ChangeLog
   trunk/libnautilus-private/nautilus-file.c

Modified: trunk/libnautilus-private/nautilus-file.c
==============================================================================
--- trunk/libnautilus-private/nautilus-file.c	(original)
+++ trunk/libnautilus-private/nautilus-file.c	Tue Jan 22 21:23:35 2008
@@ -6197,12 +6197,6 @@
 {
 	file->details->pending_info_providers =
 		nautilus_module_get_extensions_for_type (NAUTILUS_TYPE_INFO_PROVIDER);
-	if (!file->details->pending_extension_attributes) {
-		file->details->pending_extension_attributes = 
-			g_hash_table_new_full (g_str_hash, g_str_equal,
-					       (GDestroyNotify)g_free, 
-					       (GDestroyNotify)g_free);
-	}
 }
 
 void
@@ -6850,12 +6844,25 @@
 				    const char *value)
 {
 	if (file->details->pending_info_providers) {
+		/* Lazily create hashtable */
+		if (!file->details->pending_extension_attributes) {
+			file->details->pending_extension_attributes = 
+				g_hash_table_new_full (g_str_hash, g_str_equal,
+						       NULL, 
+						       (GDestroyNotify)g_free);
+		}
 		g_hash_table_insert (file->details->pending_extension_attributes,
-				     g_strdup (attribute_name),
+				     (char *)g_intern_string (attribute_name),
 				     g_strdup (value));
 	} else {
+		if (!file->details->extension_attributes) {
+			file->details->extension_attributes = 
+				g_hash_table_new_full (g_str_hash, g_str_equal,
+						       NULL, 
+						       (GDestroyNotify)g_free);
+		}
 		g_hash_table_insert (file->details->extension_attributes,
-				     g_strdup (attribute_name),
+				     (char *)g_intern_string (attribute_name),
 				     g_strdup (value));
 	}
 



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