LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gnome-panel-desktop-item-edit-BNC237389.patch of Package gnome-panel-nld (Project home:winddss:gnome-panel-nld)

--- gnome-panel/menu-ditem.c
+++ gnome-panel/menu-ditem.c
@@ -14,6 +14,8 @@
 	REVERT_BUTTON
 };
 
+const gchar * saved_name;
+
 static void
 ditem_properties_clicked (GtkWidget *w, int response, gpointer data)
 {
@@ -45,10 +47,26 @@
 	GnomeDesktopItem *ditem;
 	const char *loc;
 	GError *error = NULL;
+	const gchar * name;
 
 	g_object_set_data (G_OBJECT (dedit), "apply_timeout", NULL);
 
 	ditem = gnome_ditem_edit_get_ditem (GNOME_DITEM_EDIT (dedit));
+
+	/* hack to workaround the bug that the Name= field is stripped and empty TryExec is added*/
+	name = gnome_desktop_item_get_string(ditem, GNOME_DESKTOP_ITEM_NAME);
+	if(!name)
+	{
+		if(saved_name)
+			name = saved_name;
+		else if (!(name = gnome_desktop_item_get_localestring_lang(ditem, GNOME_DESKTOP_ITEM_NAME, "en_US")))
+			name = "No name";
+		gnome_desktop_item_set_string(ditem, GNOME_DESKTOP_ITEM_NAME, name);
+	}
+	name = gnome_desktop_item_get_string(ditem, GNOME_DESKTOP_ITEM_TRY_EXEC);
+	if(name && name[0] == '\0')
+		gnome_desktop_item_set_string(ditem, GNOME_DESKTOP_ITEM_TRY_EXEC, NULL);
+
 	loc = g_object_get_data (G_OBJECT (dedit), "location");
 	gnome_desktop_item_save (ditem,
 				 loc /* under */,
@@ -180,6 +198,10 @@
 	gnome_icon_theme_set_allow_svg (panel_icon_theme, TRUE);
 	g_return_val_if_fail (loc != NULL, NULL);
 	ditem = gnome_desktop_item_new_from_uri (loc, 0, NULL);		
+
+	/* hack to workaround the bug that the Name= field is stripped */
+	saved_name = gnome_desktop_item_get_string(ditem, GNOME_DESKTOP_ITEM_NAME);
+
 	icon=gnome_desktop_item_get_string (ditem, GNOME_DESKTOP_ITEM_ICON);
 	themeicon=gnome_desktop_item_find_icon (panel_icon_theme, icon, 48, 0);
 	gnome_desktop_item_set_string (ditem, GNOME_DESKTOP_ITEM_ICON, themeicon);