[niepce/gtk4: 2/10] gtk4: Fix the layout of the top inner UI




commit 88319a942e7b58c57a6005cb6ef03a50dc5c8ef0
Author: Hubert Figuière <hub figuiere net>
Date:   Sun Mar 20 11:55:27 2022 -0400

    gtk4: Fix the layout of the top inner UI

 src/niepce/ui/moduleshellwidget.cpp   | 10 +++-------
 src/niepce/ui/moduleshellwidget.hpp   |  4 ++--
 src/niepce/ui/workspacecontroller.cpp |  1 +
 3 files changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/src/niepce/ui/moduleshellwidget.cpp b/src/niepce/ui/moduleshellwidget.cpp
index 262cd7f..62ecad6 100644
--- a/src/niepce/ui/moduleshellwidget.cpp
+++ b/src/niepce/ui/moduleshellwidget.cpp
@@ -28,19 +28,15 @@ namespace ui {
 
 ModuleShellWidget::ModuleShellWidget()
     : Gtk::Box(Gtk::Orientation::VERTICAL)
-    , m_mainbox(Gtk::Orientation::HORIZONTAL)
-    , m_mainbar(Gtk::Orientation::HORIZONTAL)
+    , m_mainbox()
 {
     set_spacing(4);
-    // XXX m_mainbar.set_layout(Gtk::BUTTONBOX_START);
-    m_mainbar.set_spacing(4);
     m_menubutton.set_direction(Gtk::ArrowType::NONE);
     m_menubutton.set_icon_name("view-more-symbolic");
-    m_mainbox.append(m_menubutton);
-    m_mainbox.append(m_mainbar);
+    m_mainbox.set_end_widget(m_menubutton);
     append(m_mainbox);
 
-    m_mainbox.append(m_switcher);
+    m_mainbox.set_center_widget(m_switcher);
     m_stack.property_visible_child().signal_changed().connect(
         sigc::mem_fun(*this, &ModuleShellWidget::stack_changed));
     append(m_stack);
diff --git a/src/niepce/ui/moduleshellwidget.hpp b/src/niepce/ui/moduleshellwidget.hpp
index e2e86c9..899d097 100644
--- a/src/niepce/ui/moduleshellwidget.hpp
+++ b/src/niepce/ui/moduleshellwidget.hpp
@@ -23,6 +23,7 @@
 #include <utility>
 
 #include <gtkmm/box.h>
+#include <gtkmm/centerbox.h>
 #include <gtkmm/menubutton.h>
 #include <gtkmm/stack.h>
 #include <gtkmm/stackswitcher.h>
@@ -52,8 +53,7 @@ public:
     sigc::signal<void(const std::string &)> signal_deactivated;
 
 private:
-    Gtk::Box m_mainbox;
-    Gtk::Box m_mainbar;
+    Gtk::CenterBox m_mainbox;
     Gtk::MenuButton         m_menubutton;
     Gtk::Stack              m_stack;
     Gtk::StackSwitcher      m_switcher;
diff --git a/src/niepce/ui/workspacecontroller.cpp b/src/niepce/ui/workspacecontroller.cpp
index 897c405..7e28c9e 100644
--- a/src/niepce/ui/workspacecontroller.cpp
+++ b/src/niepce/ui/workspacecontroller.cpp
@@ -423,6 +423,7 @@ Gtk::Widget * WorkspaceController::buildWidget()
     // TODO make it a mnemonic
     m_label.set_text_with_mnemonic(Glib::ustring(_("_Workspace")));
     m_label.set_mnemonic_widget(m_librarytree);
+    m_label.set_hexpand(true);
     header->append(m_label);
     Gtk::MenuButton* add_btn = Gtk::manage(new Gtk::MenuButton);
     add_btn->set_direction(Gtk::ArrowType::NONE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]