[nautilus] Add event for search bar getting focus
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus] Add event for search bar getting focus
- Date: Thu, 17 Dec 2009 12:09:51 +0000 (UTC)
commit e5806d3a65f0b6dda23d4c4c12d53a5d09cc1f52
Author: Alexander Larsson <alexl redhat com>
Date: Thu Dec 17 12:09:06 2009 +0100
Add event for search bar getting focus
src/nautilus-search-bar.c | 27 ++++++++++++++++++++++++++-
src/nautilus-search-bar.h | 1 +
2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-search-bar.c b/src/nautilus-search-bar.c
index 8ed94ac..b8d5240 100644
--- a/src/nautilus-search-bar.c
+++ b/src/nautilus-search-bar.c
@@ -37,6 +37,7 @@ struct NautilusSearchBarDetails {
enum {
ACTIVATE,
CANCEL,
+ FOCUS_IN,
LAST_SIGNAL
};
@@ -79,7 +80,16 @@ nautilus_search_bar_class_init (NautilusSearchBarClass *class)
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
-
+
+ signals[FOCUS_IN] =
+ g_signal_new ("focus-in",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusSearchBarClass, focus_in),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
signals[CANCEL] =
g_signal_new ("cancel",
G_TYPE_FROM_CLASS (class),
@@ -120,6 +130,19 @@ entry_activate_cb (GtkWidget *entry, NautilusSearchBar *bar)
}
}
+static gboolean
+focus_in_event_callback (GtkWidget *widget,
+ GdkEventFocus *event,
+ gpointer user_data)
+{
+ NautilusSearchBar *bar;
+
+ bar = NAUTILUS_SEARCH_BAR (user_data);
+
+ g_signal_emit (bar, signals[FOCUS_IN], 0);
+
+ return FALSE;
+}
static void
nautilus_search_bar_init (NautilusSearchBar *bar)
@@ -158,6 +181,8 @@ nautilus_search_bar_init (NautilusSearchBar *bar)
G_CALLBACK (entry_activate_cb), bar);
g_signal_connect (bar->details->entry, "icon-release",
G_CALLBACK (entry_icon_release_cb), bar);
+ g_signal_connect (bar->details->entry, "focus-in-event",
+ G_CALLBACK (focus_in_event_callback), bar);
gtk_widget_show (bar->details->entry);
}
diff --git a/src/nautilus-search-bar.h b/src/nautilus-search-bar.h
index 8b24fba..0bc7c9a 100644
--- a/src/nautilus-search-bar.h
+++ b/src/nautilus-search-bar.h
@@ -51,6 +51,7 @@ typedef struct {
void (* activate) (NautilusSearchBar *bar);
void (* cancel) (NautilusSearchBar *bar);
+ void (* focus_in) (NautilusSearchBar *bar);
} NautilusSearchBarClass;
GType nautilus_search_bar_get_type (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]