[file-roller] use a GtkSearchBar for the filter
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] use a GtkSearchBar for the filter
- Date: Mon, 23 Dec 2013 15:51:49 +0000 (UTC)
commit 685bca22d42a0de06d749c49eb0ebd128322fffe
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon Dec 23 16:48:17 2013 +0100
use a GtkSearchBar for the filter
src/fr-window.c | 38 ++++++++++++--------------------------
1 files changed, 12 insertions(+), 26 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index 89f73b0..8757211 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -5196,7 +5196,7 @@ fr_window_activate_filter (FrWindow *window)
static void
-filter_entry_activate_cb (GtkEntry *entry,
+filter_entry_search_changed_cb (GtkEntry *entry,
FrWindow *window)
{
fr_window_activate_filter (window);
@@ -5511,33 +5511,19 @@ fr_window_construct (FrWindow *window)
/* filter bar */
- window->priv->filter_bar = filter_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
- g_object_set (window->priv->filter_bar,
- "halign", GTK_ALIGN_CENTER,
- "margin-left", 6,
- "border-width", 3,
- NULL);
- fr_window_attach (FR_WINDOW (window), window->priv->filter_bar, FR_WINDOW_AREA_FILTERBAR);
-
- /* * filter entry */
-
- window->priv->filter_entry = GTK_WIDGET (gtk_entry_new ());
- gtk_entry_set_icon_from_icon_name (GTK_ENTRY (window->priv->filter_entry),
- GTK_ENTRY_ICON_SECONDARY,
- "edit-find-symbolic");
- gtk_entry_set_icon_activatable (GTK_ENTRY (window->priv->filter_entry),
- GTK_ENTRY_ICON_SECONDARY,
- FALSE);
+ window->priv->filter_bar = gtk_search_bar_new ();
+ filter_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ window->priv->filter_entry = gtk_search_entry_new ();
gtk_entry_set_width_chars (GTK_ENTRY (window->priv->filter_entry), 40);
- gtk_box_pack_start (GTK_BOX (filter_box),
- window->priv->filter_entry, FALSE, FALSE, 6);
-
g_signal_connect (G_OBJECT (window->priv->filter_entry),
- "activate",
- G_CALLBACK (filter_entry_activate_cb),
+ "search-changed",
+ G_CALLBACK (filter_entry_search_changed_cb),
window);
-
- gtk_widget_show_all (filter_box);
+ gtk_search_bar_connect_entry (GTK_SEARCH_BAR (window->priv->filter_bar), GTK_ENTRY
(window->priv->filter_entry));
+ gtk_container_add (GTK_CONTAINER (window->priv->filter_bar), filter_box);
+ gtk_box_pack_start (GTK_BOX (filter_box), window->priv->filter_entry, TRUE, TRUE, 0);
+ gtk_widget_show_all (window->priv->filter_bar);
+ fr_window_attach (FR_WINDOW (window), window->priv->filter_bar, FR_WINDOW_AREA_FILTERBAR);
/* tree view */
@@ -7030,11 +7016,11 @@ void
fr_window_find (FrWindow *window,
gboolean active)
{
+ gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (window->priv->filter_bar), active);
if (active) {
window->priv->filter_mode = TRUE;
gtk_widget_show (window->priv->filter_bar);
gtk_widget_hide (window->priv->location_bar);
- gtk_widget_grab_focus (window->priv->filter_entry);
}
else {
window->priv->filter_mode = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]