[file-roller/wip/gtk4: 24/54] window: fixed filter bar style and height
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller/wip/gtk4: 24/54] window: fixed filter bar style and height
- Date: Sun, 2 Oct 2022 17:56:49 +0000 (UTC)
commit 317ee5eb8503e6ba02a500bab3ce52330a473ab8
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Oct 1 14:50:55 2022 +0200
window: fixed filter bar style and height
src/fr-window.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index b9209d27..f352add5 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -4719,9 +4719,12 @@ static void
filter_entry_search_changed_cb (GtkSearchEntry *entry,
FrWindow *window)
{
- fr_window_activate_filter (window);
+ FrWindowPrivate *private = fr_window_get_instance_private (window);
+ if (private->filter_mode)
+ fr_window_activate_filter (window);
}
+
static void
filter_entry_stop_search_cb (GtkSearchEntry *entry,
FrWindow *window)
@@ -4729,6 +4732,7 @@ filter_entry_stop_search_cb (GtkSearchEntry *entry,
fr_window_deactivate_filter (window);
}
+
static void
fr_window_attach (FrWindow *window,
GtkWidget *child,
@@ -4806,7 +4810,6 @@ fr_window_construct (FrWindow *window)
GtkWidget *list_scrolled_window;
GtkWidget *navigation_commands;
GtkWidget *location_box;
- GtkWidget *filter_box;
GtkWidget *tree_scrolled_window;
GtkWidget *button;
GtkTreeSelection *selection;
@@ -4979,9 +4982,12 @@ fr_window_construct (FrWindow *window)
/* filter bar */
- private->filter_bar = gtk_search_bar_new ();
- filter_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
+ private->filter_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (private->filter_bar)),
"locationbar");
+
private->filter_entry = gtk_search_entry_new ();
+ gtk_widget_set_hexpand (private->filter_entry, TRUE);
+ gtk_widget_set_halign (private->filter_entry, GTK_ALIGN_CENTER);
gtk_editable_set_width_chars (GTK_EDITABLE (private->filter_entry), 40);
g_signal_connect (GTK_SEARCH_ENTRY (private->filter_entry),
"search-changed",
@@ -4991,10 +4997,7 @@ fr_window_construct (FrWindow *window)
"stop-search",
G_CALLBACK (filter_entry_stop_search_cb),
window);
- gtk_search_bar_connect_entry (GTK_SEARCH_BAR (private->filter_bar), GTK_EDITABLE
(private->filter_entry));
- gtk_search_bar_set_child (GTK_SEARCH_BAR (private->filter_bar), filter_box);
- _gtk_box_pack_start (GTK_BOX (filter_box), private->filter_entry, TRUE, FALSE);
- gtk_widget_show (private->filter_bar);
+ gtk_box_append (GTK_BOX (private->filter_bar), private->filter_entry);
fr_window_attach (FR_WINDOW (window), private->filter_bar, FR_WINDOW_AREA_FILTERBAR);
/* tree view */
@@ -6675,11 +6678,12 @@ fr_window_find (FrWindow *window,
gboolean active)
{
FrWindowPrivate *private = fr_window_get_instance_private (window);
- gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (private->filter_bar), active);
+
if (active) {
private->filter_mode = TRUE;
gtk_widget_show (private->filter_bar);
gtk_widget_hide (private->location_bar);
+ gtk_widget_grab_focus (private->filter_entry);
}
else {
private->filter_mode = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]