vinagre r316 - in trunk: . src
- From: jwendell svn gnome org
- To: svn-commits-list gnome org
- Subject: vinagre r316 - in trunk: . src
- Date: Tue, 6 May 2008 01:54:32 +0100 (BST)
Author: jwendell
Date: Tue May 6 00:54:31 2008
New Revision: 316
URL: http://svn.gnome.org/viewvc/vinagre?rev=316&view=rev
Log:
2008-05-05 Jonh Wendell <jwendell gnome org>
* src/vinagre-tab.c,
* src/vinagre-window.c: Handle correctly clipboard. Closes #530582.
Modified:
trunk/ChangeLog
trunk/src/vinagre-tab.c
trunk/src/vinagre-window.c
Modified: trunk/src/vinagre-tab.c
==============================================================================
--- trunk/src/vinagre-tab.c (original)
+++ trunk/src/vinagre-tab.c Tue May 6 00:54:31 2008
@@ -47,6 +47,7 @@
gboolean save_password;
guint32 keyring_item_id;
VinagreTabState state;
+ gchar *clipboard_str;
};
G_DEFINE_TYPE(VinagreTab, vinagre_tab, GTK_TYPE_VBOX)
@@ -178,7 +179,10 @@
tab);
g_object_unref (tab->priv->conn);
tab->priv->conn = NULL;
-
+
+ g_free (tab->priv->clipboard_str);
+ tab->priv->clipboard_str = NULL;
+
G_OBJECT_CLASS (vinagre_tab_parent_class)->finalize (object);
}
@@ -332,22 +336,45 @@
vinagre_notebook_remove_tab (tab->priv->nb, tab);
}
+/* text was actually requested */
+static void
+copy_cb (GtkClipboard *clipboard,
+ GtkSelectionData *data,
+ guint info,
+ VinagreTab *tab)
+{
+ gtk_selection_data_set_text (data, tab->priv->clipboard_str, -1);
+}
+
static void
vnc_server_cut_text_cb (VncDisplay *vnc, const gchar *text, VinagreTab *tab)
{
GtkClipboard *cb;
- gchar *out;
gsize a, b;
+ GtkTargetEntry targets[] = {
+ {"UTF8_STRING", 0, 0},
+ {"COMPOUND_TEXT", 0, 0},
+ {"TEXT", 0, 0},
+ {"STRING", 0, 0},
+ };
if (!text)
return;
- out = g_convert (text, -1, "utf-8", "iso8859-1", &a, &b, NULL);
- if (out) {
- cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
- gtk_clipboard_set_text (cb, out, -1);
- g_free (out);
- }
+ g_free (tab->priv->clipboard_str);
+ tab->priv->clipboard_str = g_convert (text, -1, "utf-8", "iso8859-1", &a, &b, NULL);
+
+ if (tab->priv->clipboard_str)
+ {
+ cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+
+ gtk_clipboard_set_with_owner (cb,
+ targets,
+ G_N_ELEMENTS(targets),
+ (GtkClipboardGetFunc) copy_cb,
+ NULL,
+ G_OBJECT (tab));
+ }
}
static void
@@ -601,6 +628,7 @@
tab->priv->save_password = FALSE;
tab->priv->keyring_item_id = 0;
tab->priv->state = VINAGRE_TAB_STATE_INITIALIZING;
+ tab->priv->clipboard_str = NULL;
/* Create the scrolled window */
tab->priv->scroll = gtk_scrolled_window_new (NULL, NULL);
Modified: trunk/src/vinagre-window.c
==============================================================================
--- trunk/src/vinagre-window.c (original)
+++ trunk/src/vinagre-window.c Tue May 6 00:54:31 2008
@@ -943,13 +943,18 @@
{
gchar *text;
+ if (!window->priv->active_tab)
+ return;
+
+ if (gtk_clipboard_get_owner (cb) == G_OBJECT (window->priv->active_tab))
+ return;
+
text = gtk_clipboard_wait_for_text (cb);
- if (text) {
- if (window->priv->active_tab)
- vinagre_tab_paste_text (VINAGRE_TAB (window->priv->active_tab), text);
- g_free (text);
- }
+ if (!text)
+ return;
+ vinagre_tab_paste_text (VINAGRE_TAB (window->priv->active_tab), text);
+ g_free (text);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]