diff --git a/demos/gtk-demo/search_entry2.c b/demos/gtk-demo/search_entry2.c index 839d4d5aa7..4d6b7a4d16 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))