[nautilus/antoniof/hide-path-border-on-small-windows: 10/11] toolbar: Remove pathbar border on small windows
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/antoniof/hide-path-border-on-small-windows: 10/11] toolbar: Remove pathbar border on small windows
- Date: Mon, 6 Aug 2018 19:02:44 +0000 (UTC)
commit 04f420bac62970dd47bd043d0941513366a60d81
Author: António Fernandes <antoniof gnome org>
Date: Wed Aug 1 21:57:44 2018 +0100
toolbar: Remove pathbar border on small windows
The border is necessary for the centered look in wide windows.
However, in small windows, it's only visual noise.
So, show borders only when the window is wide enough for the pathbar
container to grow to the maximum width. Also, remove the margin after
the search button, which looks weird now.
Related to https://gitlab.gnome.org/GNOME/nautilus/issues/548
src/nautilus-toolbar.c | 27 +++++++++++++++++++++++++++
src/resources/css/Adwaita.css | 2 +-
src/resources/ui/nautilus-toolbar.ui | 1 -
3 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index fa7e56d4c..3af4009d1 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -845,6 +845,29 @@ undo_manager_changed (NautilusToolbar *self)
update_menu_item (self->redo_button, self, "redo", redo_active, redo_label);
}
+static void
+on_width_maximized_changed (NautilusContainerMaxWidth *container,
+ gboolean width_maximized,
+ gpointer user_data)
+{
+ NautilusToolbar *self;
+ GtkStyleContext *context;
+
+ self = NAUTILUS_TOOLBAR (user_data);
+ context = gtk_widget_get_style_context (self->path_bar_container);
+
+ g_return_if_fail (gtk_style_context_has_class (context, "width-maximized") != width_maximized);
+
+ if (width_maximized)
+ {
+ gtk_style_context_add_class (context, "width-maximized");
+ }
+ else
+ {
+ gtk_style_context_remove_class (context, "width-maximized");
+ }
+}
+
static void
on_location_entry_close (GtkWidget *close_button,
NautilusToolbar *self)
@@ -908,6 +931,10 @@ nautilus_toolbar_constructed (GObject *object)
self->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL);
gtk_container_add (GTK_CONTAINER (self->path_bar_container),
self->path_bar);
+ g_signal_connect (self->toolbar_switcher_container_max_width,
+ "width-maximized-changed",
+ G_CALLBACK (on_width_maximized_changed),
+ self);
self->location_entry = nautilus_location_entry_new ();
gtk_container_add (GTK_CONTAINER (self->location_entry_container),
diff --git a/src/resources/css/Adwaita.css b/src/resources/css/Adwaita.css
index c1cf11071..22e0727de 100644
--- a/src/resources/css/Adwaita.css
+++ b/src/resources/css/Adwaita.css
@@ -68,7 +68,7 @@
.path-bar button:not(:backdrop):hover { box-shadow: inset 0 -3px @borders; }
-.path-bar-box {
+.path-bar-box.width-maximized {
border: 1px @borders solid;
border-radius: 3px;
}
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index f8bb6f92d..b447065aa 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -317,7 +317,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
- <property name="margin_end">24</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="toolbar_switcher_container">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]