[gnome-builder/wip/gtk4-port] plugins/debuggerui: move debugger controls into header bar



commit 064c16bdff7bedc2eb5a2e13805616e71bb70f75
Author: Christian Hergert <chergert redhat com>
Date:   Sun May 8 12:56:40 2022 -0700

    plugins/debuggerui: move debugger controls into header bar

 src/plugins/debuggerui/ide-debugger-controls.ui    | 114 ++++++++++-----------
 .../debuggerui/ide-debugger-workspace-addin.c      |  19 ++--
 2 files changed, 68 insertions(+), 65 deletions(-)
---
diff --git a/src/plugins/debuggerui/ide-debugger-controls.ui b/src/plugins/debuggerui/ide-debugger-controls.ui
index 8c5615162..c48152a21 100644
--- a/src/plugins/debuggerui/ide-debugger-controls.ui
+++ b/src/plugins/debuggerui/ide-debugger-controls.ui
@@ -4,68 +4,64 @@
     <child>
       <object class="GtkRevealer" id="revealer">
         <property name="reveal-child">false</property>
-        <property name="transition-type">slide-up</property>
+        <property name="transition-type">slide-right</property>
         <property name="transition-duration">500</property>
         <child>
-          <object class="GtkFrame">
-            <property name="margin-bottom">12</property>
+          <object class="GtkBox">
+            <property name="margin-start">6</property>
+            <property name="orientation">horizontal</property>
+            <style>
+              <class name="linked"/>
+            </style>
             <child>
-              <object class="GtkBox">
-                <property name="orientation">horizontal</property>
-                <style>
-                  <class name="linked"/>
-                </style>
-                <child>
-                  <object class="GtkButton" id="pause_button">
-                    <property name="action-name">debugger.stop</property>
-                    <property name="tooltip-text" translatable="yes">Interrupt the program</property>
-                    <property name="icon-name">media-playback-pause-symbolic</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkButton" id="continue_button">
-                    <property name="action-name">debugger.continue</property>
-                    <property name="tooltip-text" translatable="yes">Continue running the program</property>
-                    <property name="icon-name">debug-continue-symbolic</property>
-                  </object>
-                </child>
-                <!--
-                <child>
-                  <object class="GtkButton" id="execute_from_cursor_button">
-                    <property name="action-name">debugger.execute-from-cursor</property>
-                    <property name="tooltip-text" translatable="yes">Execute from the current cursor 
position</property>
-                    <property name="icon-name">debug-execute-from-cursor-symbolic</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkButton" id="execute_to_cursor_button">
-                    <property name="action-name">debugger.execute-to-cursor</property>
-                    <property name="tooltip-text" translatable="yes">Execute until reaching the current 
cursor position</property>
-                  <property name="icon-name">debug-execute-to-cursor-symbolic</property>
-                  </object>
-                </child>
-                -->
-                <child>
-                  <object class="GtkButton" id="step_in_button">
-                    <property name="action-name">debugger.step-in</property>
-                    <property name="tooltip-text" translatable="yes">Execute the current line, stepping into 
any function calls</property>
-                    <property name="icon-name">debug-step-in-symbolic</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkButton" id="step_over_button">
-                    <property name="action-name">debugger.step-over</property>
-                    <property name="tooltip-text" translatable="yes">Execute the current line, stepping over 
any function calls</property>
-                    <property name="icon-name">debug-step-over-symbolic</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkButton" id="finish_button">
-                    <property name="action-name">debugger.finish</property>
-                    <property name="tooltip-text" translatable="yes">Run until the end of the 
function</property>
-                    <property name="icon-name">debug-step-out-symbolic</property>
-                  </object>
-                </child>
+              <object class="GtkButton" id="pause_button">
+                <property name="action-name">debugger.stop</property>
+                <property name="tooltip-text" translatable="yes">Interrupt the program</property>
+                <property name="icon-name">media-playback-pause-symbolic</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton" id="continue_button">
+                <property name="action-name">debugger.continue</property>
+                <property name="tooltip-text" translatable="yes">Continue running the program</property>
+                <property name="icon-name">debug-continue-symbolic</property>
+              </object>
+            </child>
+            <!--
+            <child>
+              <object class="GtkButton" id="execute_from_cursor_button">
+                <property name="action-name">debugger.execute-from-cursor</property>
+                <property name="tooltip-text" translatable="yes">Execute from the current cursor 
position</property>
+                <property name="icon-name">debug-execute-from-cursor-symbolic</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton" id="execute_to_cursor_button">
+                <property name="action-name">debugger.execute-to-cursor</property>
+                <property name="tooltip-text" translatable="yes">Execute until reaching the current cursor 
position</property>
+              <property name="icon-name">debug-execute-to-cursor-symbolic</property>
+              </object>
+            </child>
+            -->
+            <child>
+              <object class="GtkButton" id="step_in_button">
+                <property name="action-name">debugger.step-in</property>
+                <property name="tooltip-text" translatable="yes">Execute the current line, stepping into any 
function calls</property>
+                <property name="icon-name">debug-step-in-symbolic</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton" id="step_over_button">
+                <property name="action-name">debugger.step-over</property>
+                <property name="tooltip-text" translatable="yes">Execute the current line, stepping over any 
function calls</property>
+                <property name="icon-name">debug-step-over-symbolic</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton" id="finish_button">
+                <property name="action-name">debugger.finish</property>
+                <property name="tooltip-text" translatable="yes">Run until the end of the function</property>
+                <property name="icon-name">debug-step-out-symbolic</property>
               </object>
             </child>
           </object>
diff --git a/src/plugins/debuggerui/ide-debugger-workspace-addin.c 
b/src/plugins/debuggerui/ide-debugger-workspace-addin.c
index e0b1446c5..8ab5ba102 100644
--- a/src/plugins/debuggerui/ide-debugger-workspace-addin.c
+++ b/src/plugins/debuggerui/ide-debugger-workspace-addin.c
@@ -265,6 +265,7 @@ static void
 ide_debugger_workspace_addin_add_ui (IdeDebuggerWorkspaceAddin *self)
 {
   g_autoptr(IdePanelPosition) position = NULL;
+  IdeHeaderBar *header_bar;
   GtkNotebook *notebook;
   PanelPaned *hpaned;
 
@@ -272,10 +273,14 @@ ide_debugger_workspace_addin_add_ui (IdeDebuggerWorkspaceAddin *self)
   g_assert (self->workspace != NULL);
 
   self->controls = g_object_new (IDE_TYPE_DEBUGGER_CONTROLS,
-                                 "halign", GTK_ALIGN_CENTER,
-                                 "valign", GTK_ALIGN_END,
+                                 "visible", FALSE,
                                  NULL);
-  ide_workspace_add_overlay (self->workspace, GTK_WIDGET (self->controls));
+
+  header_bar = ide_workspace_get_header_bar (self->workspace);
+  ide_header_bar_add (header_bar,
+                      IDE_HEADER_BAR_POSITION_RIGHT_OF_CENTER,
+                      100,
+                      GTK_WIDGET (self->controls));
 
   ide_pane_observe (g_object_new (IDE_TYPE_PANE,
                                   "title", _("Debugger"),
@@ -402,6 +407,7 @@ ide_debugger_workspace_addin_unload (IdeWorkspaceAddin *addin,
                                      IdeWorkspace      *workspace)
 {
   IdeDebuggerWorkspaceAddin *self = (IdeDebuggerWorkspaceAddin *)addin;
+  IdeHeaderBar *header_bar;
 
   IDE_ENTRY;
 
@@ -414,13 +420,14 @@ ide_debugger_workspace_addin_unload (IdeWorkspaceAddin *addin,
   gtk_widget_insert_action_group (GTK_WIDGET (self->workspace), "debugger", NULL);
   ide_run_manager_remove_handler (self->run_manager, "debugger");
 
+  header_bar = ide_workspace_get_header_bar (workspace);
+  ide_header_bar_remove (header_bar, GTK_WIDGET (self->controls));
+  self->controls = NULL;
+
   g_clear_object (&self->debugger_signals);
   g_clear_object (&self->debug_manager_signals);
   g_clear_object (&self->run_manager);
 
-  ide_workspace_remove_overlay (self->workspace, GTK_WIDGET (self->controls));
-  self->controls = NULL;
-
   ide_clear_pane ((IdePane **)&self->panel);
   ide_clear_page ((IdePage **)&self->disassembly_view);
 


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