aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorFelix Kaser <f.kaser@gmx.net>2010-07-29 22:53:28 +0800
committerFelix Kaser <f.kaser@gmx.net>2010-07-29 22:53:28 +0800
commitdf5cfb43b2c1bb9d0cd5f55b7397cfd327aedd34 (patch)
tree8c4a83faca6522e980cf72b65c57ef4957509e14 /libempathy-gtk
parentf42a546df394424e9ca71e123e2482bcc021ed82 (diff)
downloadgsoc2013-empathy-df5cfb43b2c1bb9d0cd5f55b7397cfd327aedd34.tar
gsoc2013-empathy-df5cfb43b2c1bb9d0cd5f55b7397cfd327aedd34.tar.gz
gsoc2013-empathy-df5cfb43b2c1bb9d0cd5f55b7397cfd327aedd34.tar.bz2
gsoc2013-empathy-df5cfb43b2c1bb9d0cd5f55b7397cfd327aedd34.tar.lz
gsoc2013-empathy-df5cfb43b2c1bb9d0cd5f55b7397cfd327aedd34.tar.xz
gsoc2013-empathy-df5cfb43b2c1bb9d0cd5f55b7397cfd327aedd34.tar.zst
gsoc2013-empathy-df5cfb43b2c1bb9d0cd5f55b7397cfd327aedd34.zip
added return value for the keynav signal
now the hook widget can decide if it wants to handle the event or not. in case of the treeview this allows us to navigate in the search entry with left and right and navigate in the treeview with up and down since those are catched by the treeview
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-individual-view.c8
-rw-r--r--libempathy-gtk/empathy-live-search.c12
2 files changed, 13 insertions, 7 deletions
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 92bdeacf5..a479268a0 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -1283,23 +1283,27 @@ individual_view_search_activate_cb (GtkWidget *search,
}
}
-static void
+static gboolean
individual_view_search_key_navigation_cb (GtkWidget *search,
GdkEvent *event,
EmpathyIndividualView *view)
{
GdkEventKey *eventkey = ((GdkEventKey *) event);
+ gboolean ret = FALSE;
+
if (eventkey->keyval == GDK_Up || eventkey->keyval == GDK_Down)
{
GdkEvent *new_event;
new_event = gdk_event_copy (event);
gtk_widget_grab_focus (GTK_WIDGET (view));
- gtk_widget_event (GTK_WIDGET (view), new_event);
+ ret = gtk_widget_event (GTK_WIDGET (view), new_event);
gtk_widget_grab_focus (search);
gdk_event_free (new_event);
}
+
+ return ret;
}
static void
diff --git a/libempathy-gtk/empathy-live-search.c b/libempathy-gtk/empathy-live-search.c
index 3b6e18ee3..c029d0f5b 100644
--- a/libempathy-gtk/empathy-live-search.c
+++ b/libempathy-gtk/empathy-live-search.c
@@ -30,6 +30,7 @@
#include <libempathy/empathy-utils.h>
#include "empathy-live-search.h"
+#include "empathy-gtk-marshal.h"
G_DEFINE_TYPE (EmpathyLiveSearch, empathy_live_search, GTK_TYPE_HBOX)
@@ -132,6 +133,7 @@ live_search_entry_key_pressed_cb (GtkEntry *entry,
gpointer user_data)
{
EmpathyLiveSearch *self = EMPATHY_LIVE_SEARCH (user_data);
+ gboolean ret;
/* if esc key pressed, hide the search */
if (event->keyval == GDK_Escape)
@@ -144,8 +146,8 @@ live_search_entry_key_pressed_cb (GtkEntry *entry,
if (event->keyval == GDK_Up || event->keyval == GDK_Down
|| event->keyval == GDK_Left || event->keyval == GDK_Right)
{
- g_signal_emit (self, signals[KEYNAV], 0, event);
- return TRUE;
+ g_signal_emit (self, signals[KEYNAV], 0, event, &ret);
+ return ret;
}
return FALSE;
@@ -393,9 +395,9 @@ empathy_live_search_class_init (EmpathyLiveSearchClass *klass)
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
- NULL, NULL,
- g_cclosure_marshal_VOID__BOXED,
- G_TYPE_NONE, 1, GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+ g_signal_accumulator_true_handled, NULL,
+ _empathy_gtk_marshal_BOOLEAN__BOXED,
+ G_TYPE_BOOLEAN, 1, GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
param_spec = g_param_spec_object ("hook-widget", "Live Searchs Hook Widget",
"The live search catches key-press-events on this widget",