[Telepathy] swapping return/ctrl-return keybindings
Brian J. Murrell
brian at interlinx.bc.ca
Thu Mar 19 14:53:02 PDT 2009
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.
More information about the telepathy
mailing list