Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37906795
en ru br
ALT Linux repos
S:3.50.0-alt1
5.0: 2.26.1-alt1
4.1: 2.22.2-alt0.M41.2
4.0: 2.16.2-alt1
3.0: 2.10.2-alt1

Other repositories
Upstream:2.22.0

Group :: Graphical desktop/GNOME
RPM: gnome-panel

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: gnome-panel-2.23.6-launcher-desktop-files.patch
Download


diff -up gnome-panel-2.19.92/gnome-panel/panel-ditem-editor.c.launcher-desktop-files gnome-panel-2.19.92/gnome-panel/panel-ditem-editor.c
--- gnome-panel-2.19.92/gnome-panel/panel-ditem-editor.c.launcher-desktop-files	2007-09-04 13:34:26.000000000 -0400
+++ gnome-panel-2.19.92/gnome-panel/panel-ditem-editor.c	2007-09-13 12:13:36.000000000 -0400
@@ -973,6 +973,51 @@ panel_ditem_editor_icon_changed (PanelDI
 	g_free (file);
 }
 
+static gboolean
+update_editor_from_desktop_file (PanelDItemEditor *dialog,
+				 const gchar      *uri)
+{
+	GKeyFile *key_file;
+	char *name;
+	char *comment;
+	char *exec;
+	char *icon;
+	gboolean retval = FALSE;
+
+	key_file = g_key_file_new ();
+	if (g_key_file_load_from_file (key_file, uri, 0, NULL)) {
+		if (panel_key_file_get_boolean (key_file, "Terminal", FALSE)) 
+			gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->priv->type_combo), 1);
+		else
+			gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->priv->type_combo), 0); 
+
+		name = panel_key_file_get_locale_string (key_file, "Name");
+		comment = panel_key_file_get_locale_string (key_file, "Comment");
+		icon = panel_key_file_get_locale_string (key_file, "Icon");
+		exec = panel_key_file_get_string (key_file, "Exec");
+
+		gtk_entry_set_text (GTK_ENTRY (dialog->priv->name_entry), name ? name : "");
+		gtk_entry_set_text (GTK_ENTRY (dialog->priv->comment_entry), comment ? comment : "");
+		gtk_entry_set_text (GTK_ENTRY (dialog->priv->command_entry), exec ? exec : "");
+
+		/* Note: we need to set the icon last, since the editor
+		 * tries to guess the icon when the command is modified
+		 */ 
+		setup_icon_entry (dialog, icon);
+
+		g_free (name);
+		g_free (comment);
+		g_free (icon);
+		g_free (exec);
+
+		retval = TRUE;    
+	}
+
+	g_key_file_free (key_file);
+
+	return retval;
+}
+
 static void
 command_browse_chooser_response (GtkFileChooser   *chooser,
 				 gint              response_id,
@@ -986,7 +1031,11 @@ command_browse_chooser_response (GtkFile
 		case PANEL_DITEM_EDITOR_TYPE_APPLICATION:
 		case PANEL_DITEM_EDITOR_TYPE_TERMINAL_APPLICATION:
 			text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
-			uri = panel_util_make_exec_uri_for_desktop (text);
+			if (g_str_has_suffix (text, ".desktop") &&
+			    update_editor_from_desktop_file (dialog, text))
+				uri = NULL;
+			else 
+				uri = panel_util_make_exec_uri_for_desktop (text);
 			g_free (text);
 			break;
 		case PANEL_DITEM_EDITOR_TYPE_LINK:
@@ -996,8 +1045,9 @@ command_browse_chooser_response (GtkFile
 			g_assert_not_reached ();
 		}
 
-		gtk_entry_set_text (GTK_ENTRY (dialog->priv->command_entry),
-				    uri);
+		if (uri)
+			gtk_entry_set_text (GTK_ENTRY (dialog->priv->command_entry),
+				    	    uri);
 		g_free (uri);
 	}
 
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin