[Telepathy] swapping return/ctrl-return keybindings
Olivier Le Thanh Duong
olivier at lethanh.be
Fri Mar 20 08:29:51 PDT 2009
On Thu, Mar 19, 2009 at 10:53 PM, Brian J. Murrell
<brian at interlinx.bc.ca> wrote:
> On Thu, 19 Mar 2009 20:22:47 +0000, Brian J. Murrell wrote:
>
> I think I'm close. Here's the patch.
>
> --- empathy-2.25.92.orig/libempathy-gtk/empathy-chat.c
> +++ empathy-2.25.92/libempathy-gtk/empathy-chat.c
> @@ -707,6 +707,7 @@
> return TRUE;
> }
>
> +#if 0
> /* Catch enter but not ctrl/shift-enter */
> if (IS_ENTER (event->keyval) &&
> !(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK))) {
> @@ -727,6 +728,7 @@
> chat_input_text_view_send (chat);
> return TRUE;
> }
> +#endif
>
> text_view_sw = gtk_widget_get_parent (GTK_WIDGET (chat->view));
>
> @@ -1275,6 +1277,7 @@
> GList *list = NULL;
> gchar *filename;
> GtkTextBuffer *buffer;
> + GtkBindingSet *binding_set;
>
> filename = empathy_file_lookup ("empathy-chat.glade",
> "libempathy-gtk");
> @@ -1311,6 +1314,7 @@
> "left-margin", 2,
> "wrap-mode", GTK_WRAP_WORD_CHAR,
> NULL);
> + gtk_widget_set_name(chat->input_text_view, "empathy_input_text_view");
> g_signal_connect (chat->input_text_view, "key-press-event",
> G_CALLBACK (chat_input_key_press_event_cb),
> chat);
> @@ -1323,6 +1327,11 @@
> g_signal_connect (chat->input_text_view, "populate-popup",
> G_CALLBACK (chat_input_populate_popup_cb),
> chat);
> + g_signal_connect (chat->input_text_view, "message_send",
> + G_CALLBACK (chat_input_text_view_send),
> + chat);
> + binding_set = gtk_binding_set_by_class ((G_OBJECT_GET_CLASS(G_OBJECT(chat->input_text_view))));
> + gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "message_send", 0);
> buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (chat->input_text_view));
> g_signal_connect (buffer, "changed",
> G_CALLBACK (chat_input_text_buffer_changed_cb),
>
> Per my .gtkrc-2.0, return does just simply open a new line in the entry
> and ctrl-return does call the message_send signal, but unfortunately,
> that's yielding:
>
> (lt-empathy:3805): Gtk-WARNING **: gtk_binding_entry_activate(): binding
> "my-empathy-bindings::<Control>Return": could not find signal
> "message_send" in the `GtkTextView' class ancestry
>
> Not sure why though. I thought I attached it to chat->input_text_view
> properly.
>
> Ideas?
>
> b.
>
>
> _______________________________________________
> telepathy mailing list
> telepathy at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/telepathy
>
Hey,
I'm no gtk or empathy expert but I think this error is caused by the
fact that input_text_view is a stock TextView and thus don't have the
'message_send' signal and gtk_binding_entry_add_signal doesn't create
a signal.
What you should do is create this signal in EmpathyChat and connect
chat_input_text_view_send to it (or a callback which call this
function). And then ask your binding to fire up this signal
Hope this helps,
Olivier.
--
Olivier Lê Thanh Duong <olivier at lethanh.be>
Phone : +32485608639 Jabber: olethanh at gmail.com
More information about the telepathy
mailing list