gnome-terminal r2880 - trunk/src
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-terminal r2880 - trunk/src
- Date: Sun, 8 Jun 2008 11:36:55 +0000 (UTC)
Author: chpe
Date: Sun Jun 8 11:36:55 2008
New Revision: 2880
URL: http://svn.gnome.org/viewvc/gnome-terminal?rev=2880&view=rev
Log:
Paste text/uri-list as shell-quoted file paths. Bug #537112.
Modified:
trunk/src/terminal-window.c
Modified: trunk/src/terminal-window.c
==============================================================================
--- trunk/src/terminal-window.c (original)
+++ trunk/src/terminal-window.c Sun Jun 8 11:36:55 2008
@@ -2521,15 +2521,67 @@
}
static void
+clipboard_uris_received_cb (GtkClipboard *clipboard,
+ GtkSelectionData *selection_data,
+ TerminalScreen *screen)
+{
+ char **uris;
+ char *text;
+
+ uris = gtk_selection_data_get_uris (selection_data);
+ if (!uris) {
+ g_object_unref (screen);
+ return;
+ }
+
+ terminal_util_transform_uris_to_quoted_fuse_paths (uris);
+
+ text = g_strjoinv (" ", uris);
+ vte_terminal_feed_child (VTE_TERMINAL (screen), text, strlen (text));
+ g_free (text);
+
+ g_strfreev (uris);
+
+ g_object_unref (screen);
+}
+
+static void
+clipboard_targets_received_cb (GtkClipboard *clipboard,
+ GdkAtom *targets,
+ int n_targets,
+ TerminalScreen *screen)
+{
+ if (!targets) {
+ g_object_unref (screen);
+ return;
+ }
+
+ if (gtk_targets_include_uri (targets, n_targets)) {
+ gtk_clipboard_request_contents (clipboard,
+ gdk_atom_intern ("text/uri-list", FALSE),
+ (GtkClipboardReceivedFunc) clipboard_uris_received_cb,
+ g_object_ref (screen));
+ } else /* if (gtk_targets_include_text (targets, n_targets)) */ {
+ vte_terminal_paste_clipboard (VTE_TERMINAL (screen));
+ }
+
+ g_object_unref (screen);
+}
+
+static void
edit_paste_callback (GtkAction *action,
TerminalWindow *window)
{
TerminalWindowPrivate *priv = window->priv;
+ GtkClipboard *clipboard;
if (!priv->active_screen)
return;
- vte_terminal_paste_clipboard (VTE_TERMINAL (priv->active_screen));
+ clipboard = gtk_widget_get_clipboard (GTK_WIDGET (window), GDK_SELECTION_CLIPBOARD);
+ gtk_clipboard_request_targets (clipboard,
+ (GtkClipboardTargetsReceivedFunc) clipboard_targets_received_cb,
+ g_object_ref (priv->active_screen));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]