[nautilus/wip/antoniof/gtk4-preparation-step-container-api: 1/9] toolbar: Stop using custom max width container
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-step-container-api: 1/9] toolbar: Stop using custom max width container
- Date: Mon, 6 Dec 2021 00:24:47 +0000 (UTC)
commit c0f9f3261f10b7980c3e5fb47b3b146f376ec311
Author: António Fernandes <antoniof gnome org>
Date: Tue Nov 23 20:30:40 2021 +0000
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!
src/nautilus-location-entry.c | 2 +-
src/nautilus-toolbar.c | 14 +++++---------
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]