[gtk+] gtk-demo: Show search entry signals
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk-demo: Show search entry signals
- Date: Sat, 24 Jan 2015 18:36:06 +0000 (UTC)
commit a0ecb44b41ed5625aa05e101959110f09a089b5c
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Dec 27 18:53:21 2014 -0500
gtk-demo: Show search entry signals
demos/gtk-demo/search_entry2.c | 51 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/demos/gtk-demo/search_entry2.c b/demos/gtk-demo/search_entry2.c
index 839d4d5..4d6b7a4 100644
--- a/demos/gtk-demo/search_entry2.c
+++ b/demos/gtk-demo/search_entry2.c
@@ -42,6 +42,34 @@ window_key_press_event_cb (GtkWidget *widget,
return gtk_search_bar_handle_event (bar, event);
}
+static void
+search_changed (GtkSearchEntry *entry,
+ GtkLabel *label)
+{
+ gtk_label_set_text (label, "search-changed");
+}
+
+static void
+next_match (GtkSearchEntry *entry,
+ GtkLabel *label)
+{
+ gtk_label_set_text (label, "next-match");
+}
+
+static void
+previous_match (GtkSearchEntry *entry,
+ GtkLabel *label)
+{
+ gtk_label_set_text (label, "previous-match");
+}
+
+static void
+stop_search (GtkSearchEntry *entry,
+ GtkLabel *label)
+{
+ gtk_label_set_text (label, "stop-search");
+}
+
GtkWidget *
do_search_entry2 (GtkWidget *do_widget)
{
@@ -99,6 +127,8 @@ do_search_entry2 (GtkWidget *do_widget)
gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
label = gtk_label_new ("Result:");
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_widget_set_margin_start (label, 6);
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
label = gtk_label_new ("");
@@ -108,6 +138,27 @@ do_search_entry2 (GtkWidget *do_widget)
G_CALLBACK (search_changed_cb), label);
g_signal_connect (entry, "changed",
G_CALLBACK (changed_cb), label);
+
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 0);
+
+ label = gtk_label_new ("Signal:");
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+ gtk_widget_set_margin_start (label, 6);
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+
+ label = gtk_label_new ("");
+ gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
+
+ g_signal_connect (entry, "search-changed",
+ G_CALLBACK (search_changed), label);
+ g_signal_connect (entry, "next-match",
+ G_CALLBACK (next_match), label);
+ g_signal_connect (entry, "previous-match",
+ G_CALLBACK (previous_match), label);
+ g_signal_connect (entry, "stop-search",
+ G_CALLBACK (stop_search), label);
}
if (!gtk_widget_get_visible (window))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]