summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2021-11-23 20:30:40 +0000
committerAntónio Fernandes <antoniof@gnome.org>2021-12-06 00:24:52 +0000
commit690a03bb63aca62ed4e92c74aa9b398f60360caf (patch)
tree4b078a2bec7f035530b0aed7638cf6322ecd0070
parenta43fb2deab7c7379f9e341c500ecde4d4462f35d (diff)
downloadnautilus-690a03bb63aca62ed4e92c74aa9b398f60360caf.tar.gz
toolbar: Stop using custom max width container
We have been using NautilusMaxWidthContainer on the title widget in order to set a size where it stops expanding and starts centering. But we can achieve the same visual result (with default font) by setting a the location entry's :max-width-chars to 88. This is going to allow us to drop the custom container at a later point, which is going to help wtih the transition to GTK4. As a side effect, now the pathbar can grow beyond the max width if neecessary to display more of a path. I see this as a nice bonus!
-rw-r--r--src/nautilus-location-entry.c2
-rw-r--r--src/nautilus-toolbar.c14
2 files changed, 6 insertions, 10 deletions
diff --git a/src/nautilus-location-entry.c b/src/nautilus-location-entry.c
index 4e1043396..0cc8ca140 100644
--- a/src/nautilus-location-entry.c
+++ b/src/nautilus-location-entry.c
@@ -1015,7 +1015,7 @@ nautilus_location_entry_new (void)
{
GtkWidget *entry;
- entry = gtk_widget_new (NAUTILUS_TYPE_LOCATION_ENTRY, "max-width-chars", 350, NULL);
+ entry = gtk_widget_new (NAUTILUS_TYPE_LOCATION_ENTRY, NULL);
return entry;
}
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index b52920853..3875aecc1 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -40,7 +40,6 @@
#include "nautilus-toolbar-menu-sections.h"
#include "nautilus-ui-utilities.h"
#include "nautilus-window.h"
-#include "nautilus-container-max-width.h"
#define OPERATION_MINIMUM_TIME 2 /*s */
#define NEEDS_ATTENTION_ANIMATION_TIMEOUT 2000 /*ms */
@@ -50,7 +49,6 @@
#define ANIMATION_Y_GROW 30
/* Just design, context at https://gitlab.gnome.org/GNOME/nautilus/issues/548#note_274131 */
-#define SWITCHER_MAX_WIDTH 840
typedef enum
{
@@ -70,7 +68,6 @@ struct _NautilusToolbar
GtkWidget *search_container;
GtkWidget *toolbar_switcher;
GtkWidget *toolbar_switcher_container;
- NautilusContainerMaxWidth *toolbar_switcher_container_max_width;
GtkWidget *path_bar;
GtkWidget *location_entry;
@@ -903,13 +900,8 @@ nautilus_toolbar_constructed (GObject *object)
self->path_bar_container = GTK_WIDGET (gtk_builder_get_object (builder, "path_bar_container"));
self->location_entry_container = GTK_WIDGET (gtk_builder_get_object (builder, "location_entry_container"));
- self->toolbar_switcher_container_max_width = nautilus_container_max_width_new ();
- nautilus_container_max_width_set_max_width (self->toolbar_switcher_container_max_width,
- SWITCHER_MAX_WIDTH);
- gtk_container_add (GTK_CONTAINER (self->toolbar_switcher_container_max_width),
- self->toolbar_switcher);
gtk_container_add (GTK_CONTAINER (self->toolbar_switcher_container),
- GTK_WIDGET (self->toolbar_switcher_container_max_width));
+ self->toolbar_switcher);
self->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL);
gtk_container_add (GTK_CONTAINER (self->path_bar_container),
@@ -968,6 +960,10 @@ nautilus_toolbar_constructed (GObject *object)
g_signal_connect (self->location_entry, "notify::has-focus",
G_CALLBACK (on_location_entry_focus_changed), self);
+ /* Setting a max width on one entry to effectively set a max expansion for
+ * the whole title widget. */
+ gtk_entry_set_max_width_chars (GTK_ENTRY (self->location_entry), 88);
+
gtk_widget_show_all (GTK_WIDGET (self));
toolbar_update_appearance (self);
}