]> git.0d.be Git - empathy.git/commitdiff
chat-text-view: override GtkTextView copy_clipboard
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 26 Nov 2009 11:38:07 +0000 (11:38 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 26 Nov 2009 14:38:53 +0000 (14:38 +0000)
This allow us to hook our copy_clipboard function as so have pretty pasting
when copying using the text view context menu (#603031).

libempathy-gtk/empathy-chat-text-view.c

index a46f6a4c50c639e6c7376375c1c04e207f4920e4..4f38865f61d92f438a1e84d778a822cf5eface9d 100644 (file)
@@ -73,6 +73,8 @@ typedef struct {
 
 static void chat_text_view_iface_init (EmpathyChatViewIface *iface);
 
+static void chat_text_view_copy_clipboard (EmpathyChatView *view);
+
 G_DEFINE_TYPE_WITH_CODE (EmpathyChatTextView, empathy_chat_text_view,
                         GTK_TYPE_TEXT_VIEW,
                         G_IMPLEMENT_INTERFACE (EMPATHY_TYPE_CHAT_VIEW,
@@ -579,11 +581,18 @@ chat_text_view_finalize (GObject *object)
        G_OBJECT_CLASS (empathy_chat_text_view_parent_class)->finalize (object);
 }
 
+static void
+text_view_copy_clipboard (GtkTextView *text_view)
+{
+       chat_text_view_copy_clipboard (EMPATHY_CHAT_VIEW (text_view));
+}
+
 static void
 empathy_chat_text_view_class_init (EmpathyChatTextViewClass *klass)
 {
        GObjectClass   *object_class = G_OBJECT_CLASS (klass);
        GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+       GtkTextViewClass *text_view_class = GTK_TEXT_VIEW_CLASS (klass);
 
        object_class->finalize = chat_text_view_finalize;
        object_class->get_property = chat_text_view_get_property;
@@ -592,6 +601,8 @@ empathy_chat_text_view_class_init (EmpathyChatTextViewClass *klass)
        widget_class->size_allocate = chat_text_view_size_allocate;
        widget_class->drag_motion = chat_text_view_drag_motion;
 
+       text_view_class->copy_clipboard = text_view_copy_clipboard;
+
        g_object_class_install_property (object_class,
                                         PROP_LAST_CONTACT,
                                         g_param_spec_object ("last-contact",