[nautilus] general: use nautilus_launch_application instead of gdk_spawn API



commit b569d2cfa31951f67229e3aab00cd7f33c1ff3db
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Dec 22 16:57:56 2010 +0100

    general: use nautilus_launch_application instead of gdk_spawn API

 libnautilus-private/nautilus-mime-actions.c |   15 ++++++---------
 src/file-manager/fm-desktop-icon-view.c     |    2 --
 src/file-manager/fm-directory-view.c        |   22 ++++++++--------------
 src/nautilus-tree-sidebar.c                 |    2 +-
 src/nautilus-window-menus.c                 |    5 ++---
 5 files changed, 17 insertions(+), 29 deletions(-)
---
diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c
index d6c0a6b..e41398a 100644
--- a/libnautilus-private/nautilus-mime-actions.c
+++ b/libnautilus-private/nautilus-mime-actions.c
@@ -1600,7 +1600,7 @@ activate_files (ActivateParameters *parameters)
 	GList *l;
 	int count;
 	char *uri;
-	char *executable_path, *quoted_path, *name;
+	char *executable_path, *quoted_path;
 	char *old_working_dir;
 	ActivationAction action;
 	GdkScreen *screen;
@@ -1682,12 +1682,10 @@ activate_files (ActivateParameters *parameters)
 		uri = nautilus_file_get_activation_uri (file);
 		executable_path = g_filename_from_uri (uri, NULL, NULL);
 		quoted_path = g_shell_quote (executable_path);
-		name = nautilus_file_get_name (file);
 
-		DEBUG ("Launching file name %s, path %s", name, quoted_path);
+		DEBUG ("Launching file path %s", quoted_path);
 
-		nautilus_launch_application_from_command (screen, name, quoted_path, FALSE, NULL);
-		g_free (name);
+		nautilus_launch_application_from_command (screen, quoted_path, FALSE, NULL);
 		g_free (quoted_path);
 		g_free (executable_path);
 		g_free (uri);
@@ -1701,12 +1699,11 @@ activate_files (ActivateParameters *parameters)
 		uri = nautilus_file_get_activation_uri (file);
 		executable_path = g_filename_from_uri (uri, NULL, NULL);
 		quoted_path = g_shell_quote (executable_path);
-		name = nautilus_file_get_name (file);
 
-		DEBUG ("Launching in terminal file name %s, quoted path %s", name, quoted_path);
+		DEBUG ("Launching in terminal file quoted path %s", quoted_path);
+
+		nautilus_launch_application_from_command (screen, quoted_path, TRUE, NULL);
 
-		nautilus_launch_application_from_command (screen, name, quoted_path, TRUE, NULL);
-		g_free (name);
 		g_free (quoted_path);
 		g_free (executable_path);
 		g_free (uri);
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 060ffa3..20e9750 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -633,7 +633,6 @@ action_new_launcher_callback (GtkAction *action, gpointer data)
 	desktop_directory = nautilus_get_desktop_directory ();
 
 	nautilus_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (data)),
-						  "gnome-desktop-item-edit", 
 						  "gnome-desktop-item-edit",
 						  FALSE,
 						  "--create-new", desktop_directory, NULL);
@@ -648,7 +647,6 @@ action_change_background_callback (GtkAction *action,
         g_assert (FM_DIRECTORY_VIEW (data));
 
 	nautilus_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (data)),
-						  _("Background"),
 						  "gnome-control-center",
 						  FALSE,
 						  "background", NULL);
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 7918c0f..0ac2d18 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -1436,7 +1436,6 @@ action_new_launcher_callback (GtkAction *action,
 	window = fm_directory_view_get_containing_window (view);
 	DEBUG ("Create new launcher in window=%p: %s", window, parent_uri);
 	nautilus_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (view)),
-						  "gnome-desktop-item-edit", 
 						  "gnome-desktop-item-edit",
 						  FALSE,
 						  "--create-new", parent_uri, NULL);
@@ -5122,7 +5121,7 @@ run_script_callback (GtkAction *action, gpointer callback_data)
 	char *local_file_path;
 	char *quoted_path;
 	char *old_working_dir;
-	char **parameters, *name;
+	char **parameters;
 	GtkWindow *window;
 	
 	launch_parameters = (ScriptLaunchParameters *) callback_data;
@@ -5145,16 +5144,14 @@ run_script_callback (GtkAction *action, gpointer callback_data)
 
 	screen = gtk_widget_get_screen (GTK_WIDGET (launch_parameters->directory_view));
 
-	name = nautilus_file_get_name (launch_parameters->file);
 	/* FIXME: handle errors with dialog? Or leave up to each script? */
 	window = fm_directory_view_get_containing_window (launch_parameters->directory_view);
 
-	DEBUG ("run_script_callback, name=\"%s\", script_path=\"%s\" (omitting script parameters)",
-	       name, local_file_path);
+	DEBUG ("run_script_callback, script_path=\"%s\" (omitting script parameters)",
+	       local_file_path);
 
-	nautilus_launch_application_from_command_array (screen, name, quoted_path, FALSE,
+	nautilus_launch_application_from_command_array (screen, quoted_path, FALSE,
 							(const char * const *) parameters);
-	g_free (name);
 	g_strfreev (parameters);
 
 	nautilus_file_list_free (selected_files);
@@ -6083,7 +6080,6 @@ invoke_external_bulk_rename_utility (FMDirectoryView *view,
 	char *bulk_rename_tool;
 	GList *walk;
 	NautilusFile *file;
-	GError *error = NULL;
 
 	/* assemble command line */
 	bulk_rename_tool = get_bulk_rename_tool ();
@@ -6100,12 +6096,9 @@ invoke_external_bulk_rename_utility (FMDirectoryView *view,
 	}
 
 	/* spawning and error handling */
-	gdk_spawn_command_line_on_screen (gtk_widget_get_screen (GTK_WIDGET (view)), cmd->str, &error);
+	nautilus_launch_application_from_command (gtk_widget_get_screen (GTK_WIDGET (view)),
+						  cmd->str, FALSE, NULL);
 	g_string_free (cmd, TRUE);
-	if (error != NULL) {
-		eel_show_error_dialog (_("Could not invoke bulk rename utility"), error->message, NULL);
-		g_error_free (error);
-	}
 }
 
 static void
@@ -9954,7 +9947,8 @@ fm_directory_view_move_copy_items (const GList *item_uris,
 		if (screen == NULL) {
 			screen = gdk_screen_get_default ();
 		}
-		gdk_spawn_command_line_on_screen (screen, command, NULL);
+
+		nautilus_launch_application_from_command (screen, command, FALSE, NULL);
 		g_free (command);
 
 		return;
diff --git a/src/nautilus-tree-sidebar.c b/src/nautilus-tree-sidebar.c
index 8d51e7f..9a4cc81 100644
--- a/src/nautilus-tree-sidebar.c
+++ b/src/nautilus-tree-sidebar.c
@@ -379,7 +379,7 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
 			g_object_unref (location);
 		} else {
 			DEBUG ("Tree sidebar, launching application for %s", file_uri);
-			nautilus_launch_application_from_command (screen, NULL, file_uri, FALSE, NULL);
+			nautilus_launch_application_from_command (screen, file_uri, FALSE, NULL);
 			g_free (file_uri);
 		}
 		   
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 702c37a..046759b 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -49,6 +49,7 @@
 #include <libnautilus-private/nautilus-ui-utilities.h>
 #include <libnautilus-private/nautilus-module.h>
 #include <libnautilus-private/nautilus-undo-manager.h>
+#include <libnautilus-private/nautilus-program-choosing.h>
 #include <libnautilus-private/nautilus-search-directory.h>
 #include <libnautilus-private/nautilus-search-engine.h>
 #include <libnautilus-private/nautilus-signaller.h>
@@ -546,9 +547,7 @@ action_nautilus_manual_callback (GtkAction *action,
 	window = NAUTILUS_WINDOW (user_data);
 
 	if (NAUTILUS_IS_DESKTOP_WINDOW (window)) {
-		gdk_spawn_command_line_on_screen (
-			gtk_window_get_screen (GTK_WINDOW (window)),
-			"gnome-help", &error);
+		nautilus_launch_application_from_command (gtk_window_get_screen (GTK_WINDOW (window)), "gnome-help", FALSE, NULL);
 	} else {
 		gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (window)),
 			      "ghelp:user-guide#gosnautilus-1",



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