[PATCH] Allow to rename .desktop file with empty name, update all used .desktop locales on rename



The attached patch ensures that we'll allow to rename .desktop files
with an empty name, and also updates the .desktop name for all locales
the user currently uses as he renames .desktp files.

I'm not sure whether we should apply renames to all languages,
gnome-ditem-edit is very similar to the proposed semantics, although it
just updates the first locale and "C".

The patch was compiled while tracking down
http://bugzilla.gnome.org/show_bug.cgi?id=439529


-- 
Christian Neumair <cneumair gnome org>
Index: libnautilus-private/nautilus-icon-canvas-item.c
===================================================================
--- libnautilus-private/nautilus-icon-canvas-item.c	(Revision 12955)
+++ libnautilus-private/nautilus-icon-canvas-item.c	(Arbeitskopie)
@@ -350,7 +350,8 @@ nautilus_icon_canvas_item_set_property (
 	switch (property_id) {
 
 	case PROP_EDITABLE_TEXT:
-		if (eel_strcmp (details->editable_text,
+		if (details->editable_text != NULL &&
+		    eel_strcmp (details->editable_text,
 				g_value_get_string (value)) == 0) {
 			return;
 		}
Index: libnautilus-private/nautilus-link-desktop-file.c
===================================================================
--- libnautilus-private/nautilus-link-desktop-file.c	(Revision 12955)
+++ libnautilus-private/nautilus-link-desktop-file.c	(Arbeitskopie)
@@ -184,13 +184,22 @@ nautilus_link_desktop_file_local_set_tex
 {
 	GnomeDesktopItem *desktop_file;
 	gboolean success;
+	const char ** p;
 
 	desktop_file = gnome_desktop_item_new_from_uri (uri, 0, NULL);
 	if (desktop_file == NULL) {
 		return FALSE;
 	}
 
-	gnome_desktop_item_set_localestring (desktop_file, "Name", text);
+	for (p = (const char **) g_get_language_names (); *p != NULL; p++) {
+		/* overwrite all languages the user will ever see */
+		if (strcmp (*p, "C")) {
+			gnome_desktop_item_set_localestring_lang (desktop_file, "Name", *p, text);
+		} else {
+			gnome_desktop_item_set_string (desktop_file, "Name", text);
+		}
+	}
+
 	success = gnome_desktop_item_save (desktop_file, NULL, FALSE, NULL);
 	gnome_desktop_item_unref (desktop_file);
 	


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