toolbar: Unify toolbar UI definitions

The toolbar's UI definition is split among two files because we used to
have a NautilusContainerMaxWidth between them, which is not GtkBuildable.

With out custom container gone from the toolbar, we can simplify this,
while also reduce the usage of GtkContainer API, which is gone in GTK4.
This commit is contained in:
António Fernandes 2021-11-23 20:53:16 +00:00
parent 690a03bb63
commit 57e3910e5e
4 changed files with 40 additions and 94 deletions

View file

@ -67,7 +67,6 @@ struct _NautilusToolbar
GtkWidget *location_entry_container;
GtkWidget *search_container;
GtkWidget *toolbar_switcher;
GtkWidget *toolbar_switcher_container;
GtkWidget *path_bar;
GtkWidget *location_entry;
@ -891,18 +890,8 @@ on_location_entry_focus_changed (GObject *object,
static void
nautilus_toolbar_constructed (GObject *object)
{
g_autoptr (GtkBuilder) builder = NULL;
NautilusToolbar *self = NAUTILUS_TOOLBAR (object);
builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-toolbar-switcher.ui");
self->toolbar_switcher = GTK_WIDGET (gtk_builder_get_object (builder, "toolbar_switcher"));
self->search_container = GTK_WIDGET (gtk_builder_get_object (builder, "search_container"));
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"));
gtk_container_add (GTK_CONTAINER (self->toolbar_switcher_container),
self->toolbar_switcher);
self->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL);
gtk_container_add (GTK_CONTAINER (self->path_bar_container),
self->path_bar);
@ -1231,7 +1220,10 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, app_menu);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, back_button);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, forward_button);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, toolbar_switcher_container);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, toolbar_switcher);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, search_container);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, path_bar_container);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, location_entry_container);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_menu_zoom_section);
gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_menu_undo_redo_section);

View file

@ -5,7 +5,6 @@
<file compressed="true">ui/nautilus-search-popover.ui</file>
<file>ui/nautilus-pathbar-context-menu.ui</file>
<file>ui/nautilus-toolbar.ui</file>
<file>ui/nautilus-toolbar-switcher.ui</file>
<file>ui/nautilus-toolbar-view-menu.ui</file>
<file>ui/nautilus-column-chooser.ui</file>
<file>ui/nautilus-list-view-column-editor.ui</file>

View file

@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkStack" id="toolbar_switcher">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<property name="transition_type">crossfade</property>
<child>
<object class="GtkBox" id="path_bar_container">
<property name="can_focus">False</property>
<property name="valign">center</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<style>
<class name="path-bar-box"/>
</style>
</object>
<packing>
<property name="name">pathbar</property>
</packing>
</child>
<child>
<object class="GtkBox" id="location_entry_container">
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<style>
<class name="linked"/>
</style>
</object>
<packing>
<property name="name">location</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="search_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="name">search</property>
<property name="position">2</property>
</packing>
</child>
</object>
</interface>

View file

@ -439,17 +439,48 @@
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="toolbar_switcher_container">
<object class="GtkStack" id="toolbar_switcher">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">False</property>
<property name="transition_type">crossfade</property>
<child>
<placeholder/>
<object class="GtkBox" id="path_bar_container">
<property name="can_focus">False</property>
<property name="valign">center</property>
<style>
<class name="path-bar-box"/>
</style>
</object>
<packing>
<property name="name">pathbar</property>
</packing>
</child>
<child>
<object class="GtkBox" id="location_entry_container">
<property name="can_focus">False</property>
<style>
<class name="linked"/>
</style>
</object>
<packing>
<property name="name">location</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="search_container">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
</object>
<packing>
<property name="name">search</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="search_button">
@ -477,9 +508,6 @@
</packing>
</child>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkBox" id="navigation_box">