/** * caja_launch_application_from_command: * * Fork off a process to launch an application with a given uri as * a parameter. * * @command_string: The application to be launched, with any desired * command-line options. * @parameters: Passed as parameters to the application after quoting each of them. */ void caja_launch_application_from_command_array (GdkScreen *screen, const char *name, const char *command_string, gboolean use_terminal, const char * const * parameters) { char *full_command, *tmp; char *quoted_parameter; const char * const *p; full_command = g_strdup (command_string); if (parameters != NULL) { for (p = parameters; *p != NULL; p++) { quoted_parameter = g_shell_quote (*p); tmp = g_strconcat (full_command, " ", quoted_parameter, NULL); g_free (quoted_parameter); g_free (full_command); full_command = tmp; } } if (use_terminal) { eel_mate_open_terminal_on_screen (full_command, screen); } else { gdk_spawn_command_line_on_screen (screen, full_command, NULL); } g_free (full_command); }
static void action_nautilus_manual_callback (GtkAction *action, gpointer user_data) { NautilusWindow *window; GError *error; GtkWidget *dialog; error = NULL; 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); } else { gnome_help_display_desktop_on_screen ( NULL, "user-guide", "user-guide.xml", "gosnautilus-1", gtk_window_get_screen (GTK_WINDOW (window)), &error); } if (error) { dialog = gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("There was an error displaying help: \n%s"), error->message); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_widget_show (dialog); g_error_free (error); } }
static void action_caja_manual_callback (GtkAction *action, gpointer user_data) { CajaWindow *window; GError *error; GtkWidget *dialog; error = NULL; window = CAJA_WINDOW (user_data); if (CAJA_IS_DESKTOP_WINDOW (window)) { #if GTK_CHECK_VERSION (3, 0, 0) GdkScreen *screen; GdkAppLaunchContext *launch_context; GAppInfo *app_info = NULL; app_info = g_app_info_create_from_commandline ("mate-help", NULL, G_APP_INFO_CREATE_NONE, &error); if (error == NULL) { screen = gtk_window_get_screen(GTK_WINDOW(window)); launch_context = gdk_app_launch_context_new (); gdk_app_launch_context_set_screen (launch_context, screen); g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (launch_context), &error); g_object_unref (launch_context); } if (app_info != NULL) g_object_unref (app_info); #else #if GTK_CHECK_VERSION (2, 24, 0) gdk_spawn_command_line_on_screen(gtk_window_get_screen(GTK_WINDOW(window)), "mate-help", &error); #else g_spawn_command_line_async("mate-help", &error); #endif #endif } else { gtk_show_uri (gtk_window_get_screen (GTK_WINDOW (window)), "help:mate-user-guide/goscaja-1", gtk_get_current_event_time (), &error); } if (error) { dialog = gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("There was an error displaying help: \n%s"), error->message); g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_widget_show (dialog); g_error_free (error); } }