[PATCH] setenv "DISPLAY" when activation extension menu item



The attached (totally untested) patch calls g_setenv before activating
an extension action, proxying the current FMDirectoryView's screen to
the environment of a spawning child process (NB: gtk_widget_get_screen
returns the default screen if the widget doesn't have a current screen).
Users complained that nautilus-open-terminal doesn't open on terminals
the correct display.

It also adds/removes a ref to the FMDirectoryView providing the
extension actions.

-- 
Christian Neumair <chris gnome-de org>

Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.741
diff -u -p -r1.741 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	30 Mar 2006 19:37:22 -0000	1.741
+++ src/file-manager/fm-directory-view.c	1 Apr 2006 19:05:08 -0000
@@ -4773,7 +4773,8 @@ extension_action_callback_data_free (Ext
 {
 	g_object_unref (data->item);
 	nautilus_file_list_free (data->selection);
-	
+	g_object_unref (data->view);
+
 	g_free (data);
 }
 
@@ -4817,6 +4818,12 @@ extension_action_slow_mime_types_ready_c
 	g_free (item_name);
 
 	if (is_valid) {
+		char *display;
+
+		display = gdk_screen_make_display_name (gtk_widget_get_screen (GTK_WIDGET (data->view)));
+		g_setenv ("DISPLAY", display, TRUE);
+		g_free (display);
+
 		nautilus_menu_item_activate (data->item);
 	}
 
@@ -4881,7 +4888,7 @@ add_extension_action_for_files (FMDirect
 
 	data = g_new0 (ExtensionActionCallbackData, 1);
 	data->item = g_object_ref (item);
-	data->view = view;
+	data->view = g_object_ref (view);
 	data->selection = nautilus_file_list_copy (files);
 	data->action = action;
 


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