From 01566e5ee1cc585aeda44f58d76874ac1faaa63a Mon Sep 17 00:00:00 2001 From: Vitaly Minko Date: Thu, 28 Oct 2010 16:52:16 +0400 Subject: Copy topic selection manually since Ctrl-C is bound to the menu item. --- libempathy-gtk/empathy-chat.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index d6b9cf788..e946ae57f 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 -- cgit v1.2.3