Pass more info to file type capplet



This has been mouldering my tree for a while.  It merges in the
results of previous comments.  Do I need to add a ref to the
NautilusFile when passing it to the dialog ?

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.5441
diff -u -w -r1.5441 ChangeLog
--- ChangeLog	16 Jul 2002 20:08:03 -0000	1.5441
+++ ChangeLog	16 Jul 2002 22:02:59 -0000
@@ -414,6 +414,15 @@
 	* src/nautilus-bookmarks-window.c
 	(repopulate): remove cut and paste complexity.
 
+2002-07-02  Jody Goldberg <jody gnome org>
+
+	* libnautilus-private/nautilus-program-chooser.c
+	(launch_mime_capplet) : That a NautilusFile and pass both the mime
+	  type and the name to the capplet so that it can make more
+	  intelligent defaults if necessary.
+	(launch_mime_capplet_on_ok) : adjust to changes in launch_mime_capplet.
+	(launch_mime_capplet_and_close_dialog) : ditto.
+
 2002-07-01  Michael Meeks  <michael ximian com>
 
 	* src/nautilus-bookmarks-window.c
Index: libnautilus-private/nautilus-program-chooser.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-program-chooser.c,v
retrieving revision 1.75
diff -u -w -r1.75 nautilus-program-chooser.c
--- libnautilus-private/nautilus-program-chooser.c	12 Jul 2002 18:46:12 -0000	1.75
+++ libnautilus-private/nautilus-program-chooser.c	16 Jul 2002 22:02:59 -0000
@@ -961,13 +961,20 @@
 }
 
 static void
-launch_mime_capplet (const char *mime_type)
+launch_mime_capplet (NautilusFile *file)
 {
-	char *command;
+	char *command, *tmp, *mime_type, *file_name;
 
-	command = g_strconcat (FILE_TYPES_CAPPLET_NAME, " ", mime_type, NULL);
+	tmp = nautilus_file_get_mime_type (file);
+	mime_type = g_shell_quote (tmp); g_free (tmp);
+	tmp = nautilus_file_get_name (file);
+	file_name = g_shell_quote (tmp); g_free (tmp);
+
+	command = g_strconcat (FILE_TYPES_CAPPLET_NAME, " ", mime_type, " ", file_name, NULL);
 	nautilus_launch_application_from_command (FILE_TYPES_CAPPLET_NAME, command, NULL, FALSE);
 	g_free (command);
+	g_free (file_name);
+	g_free (mime_type);
 }
 
 static void
@@ -985,16 +992,11 @@
 launch_mime_capplet_and_close_dialog (GtkButton *button, gpointer callback_data)
 {
 	ProgramFilePair *file_pair;
-	char *mime_type;
 	
 	g_assert (GTK_IS_BUTTON (button));
 
 	file_pair = get_selected_program_file_pair (NAUTILUS_PROGRAM_CHOOSER (callback_data));
-	mime_type = nautilus_file_get_mime_type (file_pair->file);
-	launch_mime_capplet (mime_type);
-	
-	g_free (mime_type);
-
+ 	launch_mime_capplet (file_pair->file);
 	gtk_dialog_response (GTK_DIALOG (callback_data),
 		GTK_RESPONSE_DELETE_EVENT);
 }
@@ -1610,7 +1612,7 @@
 
 	g_signal_connect (dialog, "response",
 			  G_CALLBACK (launch_mime_capplet_on_ok),
-			  nautilus_file_get_mime_type (file));
+			  file);
 
 	g_free (unavailable_message);
 	g_free (file_name);



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