[gnome-builder/wip/chergert/libpanel-changes] libpanel: port to updated libpanel API




commit e3f4226341018b5650fcfa3946b9c87b3c60bbe1
Author: Christian Hergert <chergert redhat com>
Date:   Mon Sep 12 21:41:04 2022 -0700

    libpanel: port to updated libpanel API
    
    This minimally ports Builder to the GNOME/libpanel!14 API changes.

 src/libide/editor/ide-editor-workspace.ui          | 12 +++++-----
 src/libide/gui/ide-frame.c                         |  2 +-
 src/libide/gui/ide-pane.c                          | 27 +++++++++++-----------
 src/libide/gui/ide-panel-position.c                | 25 ++++++++++----------
 src/libide/gui/ide-panel-position.h                |  8 +++----
 src/libide/gui/ide-primary-workspace.ui            | 12 +++++-----
 src/libide/gui/ide-workspace.c                     | 24 +++++++++----------
 src/plugins/buildui/gbp-buildui-workspace-addin.c  |  4 ++--
 .../debuggerui/ide-debugger-workspace-addin.c      |  2 +-
 src/plugins/grep/gbp-grep-popover.c                |  2 +-
 src/plugins/grep/gbp-grep-workspace-addin.c        |  2 +-
 .../messages/gbp-messages-workspace-addin.c        |  2 +-
 .../gbp-project-tree-workspace-addin.c             |  2 +-
 .../terminal/gbp-terminal-workspace-addin.c        |  2 +-
 src/plugins/testui/gbp-testui-workspace-addin.c    |  4 ++--
 src/plugins/todo/gbp-todo-workspace-addin.c        |  2 +-
 16 files changed, 66 insertions(+), 66 deletions(-)
---
diff --git a/src/libide/editor/ide-editor-workspace.ui b/src/libide/editor/ide-editor-workspace.ui
index 4c37571f2..7bc9a9c39 100644
--- a/src/libide/editor/ide-editor-workspace.ui
+++ b/src/libide/editor/ide-editor-workspace.ui
@@ -11,9 +11,9 @@
           </object>
         </child>
         <child type="left">
-          <object class="PanelDockSwitcher">
+          <object class="PanelToggleButton">
             <property name="dock">dock</property>
-            <property name="position">start</property>
+            <property name="area">start</property>
           </object>
         </child>
         <child type="title">
@@ -30,9 +30,9 @@
           </object>
         </child>
         <child type="right">
-          <object class="PanelDockSwitcher">
+          <object class="PanelToggleButton">
             <property name="dock">dock</property>
-            <property name="position">end</property>
+            <property name="area">end</property>
           </object>
         </child>
       </object>
@@ -70,9 +70,9 @@
     <child internal-child="statusbar">
       <object class="PanelStatusbar">
         <child type="suffix">
-          <object class="PanelDockSwitcher">
+          <object class="PanelToggleButton">
             <property name="dock">dock</property>
-            <property name="position">bottom</property>
+            <property name="area">bottom</property>
           </object>
         </child>
       </object>
diff --git a/src/libide/gui/ide-frame.c b/src/libide/gui/ide-frame.c
index 339d0f067..f0f281448 100644
--- a/src/libide/gui/ide-frame.c
+++ b/src/libide/gui/ide-frame.c
@@ -358,7 +358,7 @@ ide_frame_get_position (IdeFrame *self)
 
   /* Frames are always in the center grid */
   ret = ide_panel_position_new ();
-  ide_panel_position_set_edge (ret, PANEL_DOCK_POSITION_CENTER);
+  ide_panel_position_set_area (ret, PANEL_AREA_CENTER);
 
   /* Implausible but handle it anyway */
   grid = PANEL_GRID (gtk_widget_get_ancestor (GTK_WIDGET (self), PANEL_TYPE_GRID));
diff --git a/src/libide/gui/ide-pane.c b/src/libide/gui/ide-pane.c
index 073a66b78..25619f632 100644
--- a/src/libide/gui/ide-pane.c
+++ b/src/libide/gui/ide-pane.c
@@ -94,7 +94,7 @@ ide_pane_popover_positioner_present (IdePopoverPositioner *positioner,
   IdePane *self = (IdePane *)positioner;
   IdePanePrivate *priv = ide_pane_get_instance_private (self);
   g_autoptr(IdePanelPosition) position = NULL;
-  PanelDockPosition edge = 0;
+  PanelArea area = 0;
   GdkRectangle translated;
   double x, y;
 
@@ -104,9 +104,9 @@ ide_pane_popover_positioner_present (IdePopoverPositioner *positioner,
   g_assert (pointing_to != NULL);
 
   if ((position = ide_pane_get_position (self)) &&
-      ide_panel_position_get_edge (position, &edge))
+      ide_panel_position_get_area (position, &area))
     {
-      if (edge == PANEL_DOCK_POSITION_START)
+      if (area == PANEL_AREA_START)
         gtk_popover_set_position (popover, GTK_POS_RIGHT);
       else
         gtk_popover_set_position (popover, GTK_POS_LEFT);
@@ -249,11 +249,11 @@ IdePanelPosition *
 ide_pane_get_position (IdePane *self)
 {
   static GType dock_child_type = G_TYPE_INVALID;
-  PanelDockPosition position;
+  PanelArea area;
   IdePanelPosition *ret;
   GtkWidget *frame;
   GtkWidget *paned;
-  GtkWidget *edge;
+  GtkWidget *child;
   guint n_pages;
   int depth = 0;
   int row_or_column = 0;
@@ -283,24 +283,23 @@ ide_pane_get_position (IdePane *self)
   if (!(paned = gtk_widget_get_ancestor (frame, PANEL_TYPE_PANED)))
     g_return_val_if_reached (NULL);
 
-  for (GtkWidget *child = gtk_widget_get_first_child (paned);
-       child != NULL && !gtk_widget_is_ancestor (frame, child);
-       child = gtk_widget_get_next_sibling (child))
+  for (GtkWidget *iter = gtk_widget_get_first_child (paned);
+       iter != NULL && !gtk_widget_is_ancestor (frame, iter);
+       iter = gtk_widget_get_next_sibling (iter))
     row_or_column++;
 
-  if (!(edge = gtk_widget_get_ancestor (paned, dock_child_type)))
+  if (!(child = gtk_widget_get_ancestor (paned, dock_child_type)))
     g_return_val_if_reached (NULL);
 
-  g_object_get (edge,
-                "position", &position,
+  g_object_get (child,
+                "area", &area,
                 NULL);
 
   ret = ide_panel_position_new ();
-  ide_panel_position_set_edge (ret, position);
+  ide_panel_position_set_area (ret, area);
   ide_panel_position_set_depth (ret, depth);
 
-  if (position == PANEL_DOCK_POSITION_START ||
-      position == PANEL_DOCK_POSITION_END)
+  if (area == PANEL_AREA_START || area == PANEL_AREA_END)
     ide_panel_position_set_row (ret, row_or_column);
   else
     ide_panel_position_set_column (ret, row_or_column);
diff --git a/src/libide/gui/ide-panel-position.c b/src/libide/gui/ide-panel-position.c
index 2d8acdd20..bbed21f7f 100644
--- a/src/libide/gui/ide-panel-position.c
+++ b/src/libide/gui/ide-panel-position.c
@@ -29,11 +29,11 @@ struct _IdePanelPosition
   guint column : 8;
   guint row : 8;
   guint depth : 9;
-  PanelDockPosition edge : 3;
+  PanelArea area : 3;
   guint column_set : 1;
   guint row_set : 1;
   guint depth_set : 1;
-  guint edge_set : 1;
+  guint area_set : 1;
 };
 
 G_DEFINE_BOXED_TYPE (IdePanelPosition, ide_panel_position, ide_panel_position_ref, ide_panel_position_unref)
@@ -57,25 +57,26 @@ ide_panel_position_unref (IdePanelPosition *self)
 }
 
 gboolean
-ide_panel_position_get_edge (IdePanelPosition  *self,
-                             PanelDockPosition *edge)
+ide_panel_position_get_area (IdePanelPosition *self,
+                             PanelArea        *area)
 {
   g_return_val_if_fail (self != NULL, FALSE);
 
-  if (edge != NULL)
-    *edge = self->edge;
+  if (area != NULL)
+    *area = self->area;
 
-  return self->edge_set;
+  return self->area_set;
 }
 
 void
-ide_panel_position_set_edge (IdePanelPosition  *self,
-                             PanelDockPosition  edge)
+ide_panel_position_set_area (IdePanelPosition *self,
+                             PanelArea         area)
 {
   g_return_if_fail (self != NULL);
+  g_return_if_fail (area <= PANEL_AREA_CENTER);
 
-  self->edge = edge;
-  self->edge_set = TRUE;
+  self->area = area;
+  self->area_set = TRUE;
 }
 
 /**
@@ -170,5 +171,5 @@ ide_panel_position_is_indeterminate (IdePanelPosition *self)
 {
   g_return_val_if_fail (self != NULL, TRUE);
 
-  return !self->column_set || !self->row_set || !self->edge_set;
+  return !self->column_set || !self->row_set || !self->area_set;
 }
diff --git a/src/libide/gui/ide-panel-position.h b/src/libide/gui/ide-panel-position.h
index 127459a9a..cf6646be4 100644
--- a/src/libide/gui/ide-panel-position.h
+++ b/src/libide/gui/ide-panel-position.h
@@ -43,11 +43,11 @@ IdePanelPosition *ide_panel_position_ref              (IdePanelPosition  *self);
 IDE_AVAILABLE_IN_ALL
 void              ide_panel_position_unref            (IdePanelPosition  *self);
 IDE_AVAILABLE_IN_ALL
-gboolean          ide_panel_position_get_edge         (IdePanelPosition  *self,
-                                                       PanelDockPosition *edge);
+gboolean          ide_panel_position_get_area         (IdePanelPosition  *self,
+                                                       PanelArea         *area);
 IDE_AVAILABLE_IN_ALL
-void              ide_panel_position_set_edge         (IdePanelPosition  *self,
-                                                       PanelDockPosition  edge);
+void              ide_panel_position_set_area         (IdePanelPosition  *self,
+                                                       PanelArea          area);
 IDE_AVAILABLE_IN_ALL
 gboolean          ide_panel_position_get_row          (IdePanelPosition  *self,
                                                        guint             *row);
diff --git a/src/libide/gui/ide-primary-workspace.ui b/src/libide/gui/ide-primary-workspace.ui
index d558e1c34..deaf9307e 100644
--- a/src/libide/gui/ide-primary-workspace.ui
+++ b/src/libide/gui/ide-primary-workspace.ui
@@ -11,9 +11,9 @@
           </object>
         </child>
         <child type="left">
-          <object class="PanelDockSwitcher">
+          <object class="PanelToggleButton">
             <property name="dock">dock</property>
-            <property name="position">start</property>
+            <property name="area">start</property>
             <property name="tooltip-text" translatable="yes">Toggle Left Panel (F9)</property>
           </object>
         </child>
@@ -45,9 +45,9 @@
           <object class="IdeNotificationsButton" id="notifications_button"/>
         </child>
         <child type="right">
-          <object class="PanelDockSwitcher">
+          <object class="PanelToggleButton">
             <property name="dock">dock</property>
-            <property name="position">end</property>
+            <property name="area">end</property>
             <property name="tooltip-text" translatable="yes">Toggle Right Panel</property>
           </object>
         </child>
@@ -99,9 +99,9 @@
     <child internal-child="statusbar">
       <object class="PanelStatusbar">
         <child type="suffix">
-          <object class="PanelDockSwitcher">
+          <object class="PanelToggleButton">
             <property name="dock">dock</property>
-            <property name="position">bottom</property>
+            <property name="area">bottom</property>
             <property name="tooltip-text" translatable="yes">Toggle Bottom Panel (Ctrl+F9)</property>
           </object>
         </child>
diff --git a/src/libide/gui/ide-workspace.c b/src/libide/gui/ide-workspace.c
index c802514ae..fce2a60a3 100644
--- a/src/libide/gui/ide-workspace.c
+++ b/src/libide/gui/ide-workspace.c
@@ -1254,7 +1254,7 @@ _ide_workspace_find_frame (IdeWorkspace     *self,
                            PanelPaned       *dock_bottom,
                            IdeGrid          *grid)
 {
-  PanelDockPosition edge;
+  PanelArea area;
   PanelPaned *paned = NULL;
   PanelFrame *ret;
   GtkWidget *parent;
@@ -1270,10 +1270,10 @@ _ide_workspace_find_frame (IdeWorkspace     *self,
   g_return_val_if_fail (!dock_end || PANEL_IS_PANED (dock_end), NULL);
   g_return_val_if_fail (!dock_bottom || PANEL_IS_PANED (dock_bottom), NULL);
 
-  if (!ide_panel_position_get_edge (position, &edge))
-    edge = PANEL_DOCK_POSITION_CENTER;
+  if (!ide_panel_position_get_area (position, &area))
+    area = PANEL_AREA_CENTER;
 
-  if (edge == PANEL_DOCK_POSITION_CENTER)
+  if (area == PANEL_AREA_CENTER)
     {
       gboolean has_column = ide_panel_position_get_column (position, &column);
       gboolean has_row = ide_panel_position_get_row (position, &row);
@@ -1293,28 +1293,28 @@ _ide_workspace_find_frame (IdeWorkspace     *self,
       IDE_RETURN (ret);
     }
 
-  switch (edge)
+  switch (area)
     {
-    case PANEL_DOCK_POSITION_START:
+    case PANEL_AREA_START:
       paned = dock_start;
       ide_panel_position_get_row (position, &nth);
       break;
 
-    case PANEL_DOCK_POSITION_END:
+    case PANEL_AREA_END:
       paned = dock_end;
       ide_panel_position_get_row (position, &nth);
       break;
 
-    case PANEL_DOCK_POSITION_BOTTOM:
+    case PANEL_AREA_BOTTOM:
       paned = dock_bottom;
       ide_panel_position_get_column (position, &nth);
       break;
 
-    case PANEL_DOCK_POSITION_TOP:
+    case PANEL_AREA_TOP:
       g_warning ("Top panel is not supported");
       return NULL;
 
-    case PANEL_DOCK_POSITION_CENTER:
+    case PANEL_AREA_CENTER:
     default:
       return NULL;
     }
@@ -1323,8 +1323,8 @@ _ide_workspace_find_frame (IdeWorkspace     *self,
     {
       parent = panel_frame_new ();
 
-      if (edge == PANEL_DOCK_POSITION_START ||
-          edge == PANEL_DOCK_POSITION_END)
+      if (area == PANEL_AREA_START ||
+          area == PANEL_AREA_END)
         gtk_orientable_set_orientation (GTK_ORIENTABLE (parent), GTK_ORIENTATION_VERTICAL);
       else
         gtk_orientable_set_orientation (GTK_ORIENTABLE (parent), GTK_ORIENTATION_HORIZONTAL);
diff --git a/src/plugins/buildui/gbp-buildui-workspace-addin.c 
b/src/plugins/buildui/gbp-buildui-workspace-addin.c
index 2941100ce..554a93e27 100644
--- a/src/plugins/buildui/gbp-buildui-workspace-addin.c
+++ b/src/plugins/buildui/gbp-buildui-workspace-addin.c
@@ -346,14 +346,14 @@ gbp_buildui_workspace_addin_load (IdeWorkspaceAddin *addin,
   gbp_buildui_omni_bar_section_set_context (self->omni_bar_section, context);
 
   log_position = ide_panel_position_new ();
-  ide_panel_position_set_edge (log_position, PANEL_DOCK_POSITION_BOTTOM);
+  ide_panel_position_set_area (log_position, PANEL_AREA_BOTTOM);
   ide_panel_position_set_depth (log_position, 2);
 
   self->log_pane = g_object_new (GBP_TYPE_BUILDUI_LOG_PANE, NULL);
   ide_workspace_add_pane (workspace, IDE_PANE (self->log_pane), log_position);
 
   pane_position = ide_panel_position_new ();
-  ide_panel_position_set_edge (pane_position, PANEL_DOCK_POSITION_START);
+  ide_panel_position_set_area (pane_position, PANEL_AREA_START);
   ide_panel_position_set_depth (pane_position, 1);
 
   self->pane = g_object_new (GBP_TYPE_BUILDUI_PANE, NULL);
diff --git a/src/plugins/debuggerui/ide-debugger-workspace-addin.c 
b/src/plugins/debuggerui/ide-debugger-workspace-addin.c
index 86c7f46bc..9bea86aeb 100644
--- a/src/plugins/debuggerui/ide-debugger-workspace-addin.c
+++ b/src/plugins/debuggerui/ide-debugger-workspace-addin.c
@@ -266,7 +266,7 @@ ide_debugger_workspace_addin_add_ui (IdeDebuggerWorkspaceAddin *self)
                             gtk_label_new (_("Console")));
 
   position = ide_panel_position_new ();
-  ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_BOTTOM);
+  ide_panel_position_set_area (position, PANEL_AREA_BOTTOM);
 
   ide_workspace_add_pane (self->workspace, IDE_PANE (self->panel), position);
 }
diff --git a/src/plugins/grep/gbp-grep-popover.c b/src/plugins/grep/gbp-grep-popover.c
index 6345ed427..a54551772 100644
--- a/src/plugins/grep/gbp-grep-popover.c
+++ b/src/plugins/grep/gbp-grep-popover.c
@@ -76,7 +76,7 @@ gbp_grep_popover_button_clicked_cb (GbpGrepPopover *self,
   context = ide_widget_get_context (GTK_WIDGET (workspace));
 
   position = ide_panel_position_new ();
-  ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_BOTTOM);
+  ide_panel_position_set_area (position, PANEL_AREA_BOTTOM);
 
   use_regex = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->regex_button));
   at_word_boundaries = gtk_check_button_get_active (GTK_CHECK_BUTTON (self->whole_button));
diff --git a/src/plugins/grep/gbp-grep-workspace-addin.c b/src/plugins/grep/gbp-grep-workspace-addin.c
index 48fb6e79e..dd31c0f3f 100644
--- a/src/plugins/grep/gbp-grep-workspace-addin.c
+++ b/src/plugins/grep/gbp-grep-workspace-addin.c
@@ -66,7 +66,7 @@ gbp_grep_workspace_addin_load (IdeWorkspaceAddin *addin,
   self->panel = g_object_new (GBP_TYPE_GREP_PANEL, NULL);
 
   position = ide_panel_position_new ();
-  ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_BOTTOM);
+  ide_panel_position_set_area (position, PANEL_AREA_BOTTOM);
   ide_workspace_add_pane (workspace, self->panel, position);
 }
 
diff --git a/src/plugins/messages/gbp-messages-workspace-addin.c 
b/src/plugins/messages/gbp-messages-workspace-addin.c
index 8785e82f8..ce9eded86 100644
--- a/src/plugins/messages/gbp-messages-workspace-addin.c
+++ b/src/plugins/messages/gbp-messages-workspace-addin.c
@@ -42,7 +42,7 @@ gbp_messages_workspace_addin_load (IdeWorkspaceAddin *addin,
   g_assert (IDE_IS_WORKSPACE (workspace));
 
   position = ide_panel_position_new ();
-  ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_BOTTOM);
+  ide_panel_position_set_area (position, PANEL_AREA_BOTTOM);
 
   self->panel = g_object_new (GBP_TYPE_MESSAGES_PANEL, NULL);
   ide_workspace_add_pane (workspace, IDE_PANE (self->panel), position);
diff --git a/src/plugins/project-tree/gbp-project-tree-workspace-addin.c 
b/src/plugins/project-tree/gbp-project-tree-workspace-addin.c
index bc45bff3f..d0d41030f 100644
--- a/src/plugins/project-tree/gbp-project-tree-workspace-addin.c
+++ b/src/plugins/project-tree/gbp-project-tree-workspace-addin.c
@@ -51,7 +51,7 @@ gbp_project_tree_workspace_addin_load (IdeWorkspaceAddin *addin,
                     (IdePane **)&self->pane);
 
   position = ide_panel_position_new ();
-  ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_START);
+  ide_panel_position_set_area (position, PANEL_AREA_START);
   ide_panel_position_set_row (position, 0);
   ide_panel_position_set_depth (position, 0);
 
diff --git a/src/plugins/terminal/gbp-terminal-workspace-addin.c 
b/src/plugins/terminal/gbp-terminal-workspace-addin.c
index 3592e6283..c6a75f31d 100644
--- a/src/plugins/terminal/gbp-terminal-workspace-addin.c
+++ b/src/plugins/terminal/gbp-terminal-workspace-addin.c
@@ -265,7 +265,7 @@ gbp_terminal_workspace_addin_load (IdeWorkspaceAddin *addin,
 
   /* Always add the terminal panel to primary/editor workspaces */
   position = ide_panel_position_new ();
-  ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_BOTTOM);
+  ide_panel_position_set_area (position, PANEL_AREA_BOTTOM);
   page = g_object_new (IDE_TYPE_TERMINAL_PAGE,
                        "respawn-on-exit", TRUE,
                        "visible", TRUE,
diff --git a/src/plugins/testui/gbp-testui-workspace-addin.c b/src/plugins/testui/gbp-testui-workspace-addin.c
index 8eddc50ce..f8417c4c1 100644
--- a/src/plugins/testui/gbp-testui-workspace-addin.c
+++ b/src/plugins/testui/gbp-testui-workspace-addin.c
@@ -169,14 +169,14 @@ gbp_testui_workspace_addin_load (IdeWorkspaceAddin *addin,
                            self,
                            G_CONNECT_SWAPPED);
   position = ide_panel_position_new ();
-  ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_START);
+  ide_panel_position_set_area (position, PANEL_AREA_START);
   ide_panel_position_set_row (position, 0);
   ide_panel_position_set_depth (position, 2);
   ide_workspace_add_pane (workspace, IDE_PANE (self->panel), position);
 
   self->output_panel = gbp_testui_output_panel_new (pty);
   output_position = ide_panel_position_new ();
-  ide_panel_position_set_edge (output_position, PANEL_DOCK_POSITION_BOTTOM);
+  ide_panel_position_set_area (output_position, PANEL_AREA_BOTTOM);
   ide_workspace_add_pane (workspace, IDE_PANE (self->output_panel), output_position);
 
   IDE_EXIT;
diff --git a/src/plugins/todo/gbp-todo-workspace-addin.c b/src/plugins/todo/gbp-todo-workspace-addin.c
index aa9c8dde5..6a8e17a38 100644
--- a/src/plugins/todo/gbp-todo-workspace-addin.c
+++ b/src/plugins/todo/gbp-todo-workspace-addin.c
@@ -147,7 +147,7 @@ gbp_todo_workspace_addin_load (IdeWorkspaceAddin *addin,
                            G_CONNECT_SWAPPED);
 
   position = ide_panel_position_new ();
-  ide_panel_position_set_edge (position, PANEL_DOCK_POSITION_START);
+  ide_panel_position_set_area (position, PANEL_AREA_START);
   ide_panel_position_set_row (position, 0);
   ide_panel_position_set_depth (position, 3);
 


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