[gnome-builder/wip/gtk4-port: 190/736] libide/gui: get some basic headerbar plumbing to work




commit dbe0b75712f2c5b39d34f15662f727852d811d2b
Author: Christian Hergert <chergert redhat com>
Date:   Tue Mar 29 17:01:47 2022 -0700

    libide/gui: get some basic headerbar plumbing to work

 src/libide/gui/ide-header-bar.ui        | 18 ++++++++++++------
 src/libide/gui/ide-omni-bar.c           |  1 -
 src/libide/gui/ide-omni-bar.ui          | 24 +++++++-----------------
 src/libide/gui/ide-primary-workspace.ui |  1 +
 src/libide/gui/ide-workspace.c          |  3 ++-
 src/main.c                              |  4 ++++
 6 files changed, 26 insertions(+), 25 deletions(-)
---
diff --git a/src/libide/gui/ide-header-bar.ui b/src/libide/gui/ide-header-bar.ui
index 636b4f8a9..977455b53 100644
--- a/src/libide/gui/ide-header-bar.ui
+++ b/src/libide/gui/ide-header-bar.ui
@@ -8,29 +8,35 @@
         <child type="start">
           <object class="GtkBox" id="left">
             <property name="hexpand">true</property>
+            <property name="spacing">6</property>
           </object>
         </child>
         <child type="title">
           <object class="GtkCenterBox" id="center_box">
             <child type="start">
               <object class="GtkBox" id="left_of_center">
+                <property name="margin-start">6</property>
+                <property name="margin-end">6</property>
               </object>
             </child>
             <child type="end">
               <object class="GtkBox" id="right_of_center">
+                <property name="margin-start">6</property>
+                <property name="margin-end">6</property>
               </object>
             </child>
           </object>
         </child>
+        <child type="end">
+          <object class="GtkMenuButton" id="menu_button">
+            <property name="icon-name">open-menu-symbolic</property>
+            <property name="primary">true</property>
+          </object>
+        </child>
         <child type="end">
           <object class="GtkBox" id="right">
             <property name="hexpand">true</property>
-            <child>
-              <object class="GtkMenuButton" id="menu_button">
-                <property name="icon-name">open-menu-symbolic</property>
-                <property name="primary">true</property>
-              </object>
-            </child>
+            <property name="spacing">6</property>
           </object>
         </child>
       </object>
diff --git a/src/libide/gui/ide-omni-bar.c b/src/libide/gui/ide-omni-bar.c
index 07dd647bf..844b0e2a8 100644
--- a/src/libide/gui/ide-omni-bar.c
+++ b/src/libide/gui/ide-omni-bar.c
@@ -275,7 +275,6 @@ ide_omni_bar_class_init (IdeOmniBarClass *klass)
   gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, sections_box);
   gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, stack);
   gtk_widget_class_bind_template_callback (widget_class, ide_omni_bar_notification_row_activated);
-  gtk_widget_class_set_css_name (widget_class, "omnibar");
 
   g_type_ensure (IDE_TYPE_NOTIFICATION_STACK);
 }
diff --git a/src/libide/gui/ide-omni-bar.ui b/src/libide/gui/ide-omni-bar.ui
index c08d1f154..792d1e449 100644
--- a/src/libide/gui/ide-omni-bar.ui
+++ b/src/libide/gui/ide-omni-bar.ui
@@ -7,7 +7,7 @@
     <property name="popover">
       <object class="GtkPopover" id="popover">
         <property name="width-request">500</property>
-        <property name="position">top</property>
+        <property name="position">bottom</property>
         <child>
           <object class="GtkBox">
             <property name="orientation">vertical</property>
@@ -38,25 +38,15 @@
           <class name="pan"/>
         </style>
         <child>
-          <object class="GtkButton">
-            <property name="action-name">omnibar.move-previous</property>
-            <child>
-              <object class="GtkImage">
-                <property name="icon-name">pan-up-symbolic</property>
-                <property name="pixel-size">12</property>
-              </object>
-            </child>
+          <object class="GtkImage">
+            <property name="icon-name">pan-up-symbolic</property>
+            <property name="pixel-size">12</property>
           </object>
         </child>
         <child>
-          <object class="GtkButton">
-            <property name="action-name">omnibar.move-next</property>
-            <child>
-              <object class="GtkImage">
-                <property name="icon-name">pan-down-symbolic</property>
-                <property name="pixel-size">12</property>
-              </object>
-            </child>
+          <object class="GtkImage">
+            <property name="icon-name">pan-down-symbolic</property>
+            <property name="pixel-size">12</property>
           </object>
         </child>
       </object>
diff --git a/src/libide/gui/ide-primary-workspace.ui b/src/libide/gui/ide-primary-workspace.ui
index 7c9ba3c27..f6d621bd0 100644
--- a/src/libide/gui/ide-primary-workspace.ui
+++ b/src/libide/gui/ide-primary-workspace.ui
@@ -6,6 +6,7 @@
         <property name="menu-id">ide-primary-workspace-menu</property>
         <child type="title">
           <object class="IdeOmniBar" id="omni_bar">
+            <property name="icon-name">builder-build-symbolic</property>
             <child type="placeholder">
               <object class="GtkLabel" id="project_title">
                 <property name="ellipsize">end</property>
diff --git a/src/libide/gui/ide-workspace.c b/src/libide/gui/ide-workspace.c
index 352b8ba25..4685e40b7 100644
--- a/src/libide/gui/ide-workspace.c
+++ b/src/libide/gui/ide-workspace.c
@@ -434,7 +434,8 @@ ide_workspace_init (IdeWorkspace *self)
   priv->box = g_object_new (GTK_TYPE_BOX,
                             "orientation", GTK_ORIENTATION_VERTICAL,
                             NULL);
-  gtk_window_set_child (GTK_WINDOW (self), GTK_WIDGET (priv->box));
+  adw_application_window_set_content (ADW_APPLICATION_WINDOW (self),
+                                      GTK_WIDGET (priv->box));
 
   /* Initialize GActions for workspace */
   _ide_workspace_init_actions (self);
diff --git a/src/main.c b/src/main.c
index 362d49cba..702e40a60 100644
--- a/src/main.c
+++ b/src/main.c
@@ -273,7 +273,11 @@ main (gint   argc,
              gtk_get_minor_version (),
              gtk_get_micro_version ());
 
+  /* Init libraries with initializers */
+  gtk_init ();
   gtk_source_init ();
+  adw_init ();
+  panel_init ();
 
   /* Initialize thread pools */
   _ide_thread_pool_init (FALSE);


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