[empathy: 1/2] Copy topic selection manually since Ctrl-C is bound to the menu item.



commit 01566e5ee1cc585aeda44f58d76874ac1faaa63a
Author: Vitaly Minko <vitaly minko gmail com>
Date:   Thu Oct 28 16:52:16 2010 +0400

    Copy topic selection manually since Ctrl-C is bound to the menu item.

 libempathy-gtk/empathy-chat.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index d6b9cf7..e946ae5 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -3385,6 +3385,31 @@ empathy_chat_copy (EmpathyChat *chat)
 
 		gtk_text_buffer_copy_clipboard (buffer, clipboard);
 	}
+	else {
+		gint start_offset;
+		gint end_offset;
+		EmpathyChatPriv *priv = GET_PRIV (chat);
+
+		if (gtk_label_get_selection_bounds (GTK_LABEL (priv->label_topic),
+							       &start_offset,
+							       &end_offset)) {
+			gchar *start;
+			gchar *end;
+			gchar *selection;
+			const gchar *topic;
+			GtkClipboard *clipboard;
+
+			topic = gtk_label_get_text (GTK_LABEL (priv->label_topic));
+			start = g_utf8_offset_to_pointer (topic, start_offset);
+			end = g_utf8_offset_to_pointer (topic, end_offset);
+			selection = g_strndup (start, end - start);
+
+			clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+			gtk_clipboard_set_text (clipboard, selection, -1);
+
+			g_free (selection);
+		}
+	}
 }
 
 void



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