[gnome-builder/wip/gtk4-port: 453/736] plugins/vcsui: port clone widget to GTK 4




commit 4cdb09f4c0918ddd070066909e77578a85e3ef4f
Author: Christian Hergert <chergert redhat com>
Date:   Wed Apr 6 17:25:54 2022 -0700

    plugins/vcsui: port clone widget to GTK 4
    
    This is the rest of the basic port, insomuchas it compiles. Nothing has
    actually been tested of course.

 src/plugins/vcsui/gbp-vcsui-clone-widget.c  | 30 +++++++++++++++--------------
 src/plugins/vcsui/gbp-vcsui-clone-widget.ui | 10 +++++-----
 src/plugins/vcsui/meson.build               |  2 +-
 3 files changed, 22 insertions(+), 20 deletions(-)
---
diff --git a/src/plugins/vcsui/gbp-vcsui-clone-widget.c b/src/plugins/vcsui/gbp-vcsui-clone-widget.c
index b31cc6f9e..912753642 100644
--- a/src/plugins/vcsui/gbp-vcsui-clone-widget.c
+++ b/src/plugins/vcsui/gbp-vcsui-clone-widget.c
@@ -24,15 +24,15 @@
 
 #include <glib/gi18n.h>
 #include <libpeas/peas.h>
+
+#include <libide-greeter.h>
 #include <libide-vcs.h>
 
 #include "gbp-vcsui-clone-widget.h"
-#include "ide-greeter-private.h"
-#include "ide-greeter-workspace.h"
 
 struct _GbpVcsuiCloneWidget
 {
-  IdeSurface           parent_instance;
+  GtkWidget            parent_instance;
 
   /* This extension set contains IdeVcsCloner implementations which we
    * use to validate URIs, as well as provide some toggles for how the
@@ -53,7 +53,7 @@ struct _GbpVcsuiCloneWidget
   GtkWidget           *scroller;
   IdeFileChooserEntry *destination_chooser;
   GtkLabel            *destination_label;
-  DzlRadioBox         *kind_radio;
+  IdeRadioBox         *kind_radio;
   GtkLabel            *kind_label;
   GtkLabel            *status_message;
   GtkEntry            *uri_entry;
@@ -68,7 +68,7 @@ struct _GbpVcsuiCloneWidget
   guint                vcs_valid : 1;
 };
 
-G_DEFINE_FINAL_TYPE (GbpVcsuiCloneWidget, gbp_vcsui_clone_widget, IDE_TYPE_SURFACE)
+G_DEFINE_FINAL_TYPE (GbpVcsuiCloneWidget, gbp_vcsui_clone_widget, GTK_TYPE_WIDGET)
 
 enum {
   PROP_0,
@@ -111,7 +111,7 @@ gbp_vcsui_clone_widget_addin_added_cb (PeasExtensionSet *set,
 
   title = ide_vcs_cloner_get_title (cloner);
 
-  dzl_radio_box_add_item (self->kind_radio,
+  ide_radio_box_add_item (self->kind_radio,
                           peas_plugin_info_get_module_name (plugin_info),
                           title);
 
@@ -138,7 +138,7 @@ gbp_vcsui_clone_widget_addin_removed_cb (PeasExtensionSet *set,
 
   self->n_addins--;
 
-  dzl_radio_box_remove_item (self->kind_radio,
+  ide_radio_box_remove_item (self->kind_radio,
                              peas_plugin_info_get_module_name (plugin_info));
 
   if (self->n_addins < 2)
@@ -196,7 +196,7 @@ gbp_vcsui_clone_widget_validate (GbpVcsuiCloneWidget *self)
                                 &validate);
 
   if (validate.valid)
-    dzl_gtk_widget_remove_style_class (GTK_WIDGET (self->uri_entry), "error");
+    gtk_widget_remove_css_class (GTK_WIDGET (self->uri_entry), "error");
   else
     gtk_widget_add_css_class (GTK_WIDGET (self->uri_entry), "error");
 
@@ -282,15 +282,15 @@ gbp_vcsui_clone_widget_destination_changed (GbpVcsuiCloneWidget *self,
                                             IdeFileChooserEntry *chooser)
 {
   g_assert (GBP_IS_VCSUI_CLONE_WIDGET (self));
-  g_assert (DZL_IS_FILE_CHOOSER_ENTRY (chooser));
+  g_assert (IDE_IS_FILE_CHOOSER_ENTRY (chooser));
 
   gbp_vcsui_clone_widget_update (self);
 }
 
-static void
+static gboolean
 gbp_vcsui_clone_widget_grab_focus (GtkWidget *widget)
 {
-  gtk_widget_grab_focus (GTK_WIDGET (GBP_VCSUI_CLONE_WIDGET (widget)->uri_entry));
+  return gtk_widget_grab_focus (GTK_WIDGET (GBP_VCSUI_CLONE_WIDGET (widget)->uri_entry));
 }
 
 static void
@@ -304,6 +304,8 @@ gbp_vcsui_clone_widget_dispose (GObject *object)
   g_clear_object (&self->addins);
   g_clear_object (&self->destination);
 
+  g_clear_pointer ((GtkWidget **)&self->scroller, gtk_widget_unparent);
+
   G_OBJECT_CLASS (gbp_vcsui_clone_widget_parent_class)->dispose (object);
 }
 
@@ -317,7 +319,7 @@ gbp_vcsui_clone_widget_context_set (GtkWidget  *widget,
   g_assert (GBP_IS_VCSUI_CLONE_WIDGET (self));
   g_assert (!context || IDE_IS_CONTEXT (context));
 
-  gtk_entry_set_text (self->author_entry, g_get_real_name ());
+  gtk_editable_set_text (GTK_EDITABLE (self->author_entry), g_get_real_name ());
 
   file = g_file_new_for_path (ide_get_projects_dir ());
   ide_file_chooser_entry_set_file (self->destination_chooser, file);
@@ -478,7 +480,7 @@ gbp_vcsui_clone_widget_set_uri (GbpVcsuiCloneWidget *self,
         }
     }
 
-  gtk_entry_set_text (self->uri_entry, uri);
+  gtk_editable_set_text (GTK_EDITABLE (self->uri_entry), uri);
 }
 
 static void
@@ -543,7 +545,7 @@ gbp_vcsui_clone_widget_clone (GbpVcsuiCloneWidget *self)
 
   g_return_if_fail (GBP_IS_VCSUI_CLONE_WIDGET (self));
 
-  if (!(module_name = dzl_radio_box_get_active_id (self->kind_radio)) ||
+  if (!(module_name = ide_radio_box_get_active_id (self->kind_radio)) ||
       !(plugin_info = peas_engine_get_plugin_info (engine, module_name)) ||
       !(addin = (IdeVcsCloner *)peas_extension_set_get_extension (self->addins, plugin_info)))
     {
diff --git a/src/plugins/vcsui/gbp-vcsui-clone-widget.ui b/src/plugins/vcsui/gbp-vcsui-clone-widget.ui
index 5d4e74219..25e98858b 100644
--- a/src/plugins/vcsui/gbp-vcsui-clone-widget.ui
+++ b/src/plugins/vcsui/gbp-vcsui-clone-widget.ui
@@ -18,7 +18,7 @@
                 <property name="vexpand">true</property>
                 <property name="visible">true</property>
                 <child>
-                  <object class="DzlThreeGrid" id="grid">
+                  <object class="IdeThreeGrid" id="grid">
                     <property name="column-spacing">12</property>
                     <!-- can't use row-spacing because we have to animate in
                          the revealer which messes up the margins.  -->
@@ -130,7 +130,7 @@
                         <property name="orientation">vertical</property>
                         <property name="visible">true</property>
                         <child>
-                          <object class="DzlThreeGrid">
+                          <object class="IdeThreeGrid">
                             <property name="column-spacing">12</property>
                             <property name="row-spacing">12</property>
                             <property name="visible">true</property>
@@ -150,7 +150,7 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="DzlRadioBox" id="kind_radio">
+                              <object class="IdeRadioBox" id="kind_radio">
                                 <property name="visible">false</property>
                                 <property name="valign">center</property>
                               </object>
@@ -241,7 +241,7 @@
                   </object>
                 </child>
                 <child>
-                  <object class="DzlThreeGrid">
+                  <object class="IdeThreeGrid">
                     <property name="margin-top">12</property>
                     <property name="column-spacing">12</property>
                     <property name="visible">true</property>
@@ -261,7 +261,7 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="DzlFileChooserEntry" id="destination_chooser">
+                      <object class="IdeFileChooserEntry" id="destination_chooser">
                         <property name="action">select-folder</property>
                         <property name="create-folders">true</property>
                         <property name="valign">center</property>
diff --git a/src/plugins/vcsui/meson.build b/src/plugins/vcsui/meson.build
index bbc4c39a9..f81762888 100644
--- a/src/plugins/vcsui/meson.build
+++ b/src/plugins/vcsui/meson.build
@@ -3,7 +3,7 @@ plugins_sources += files([
   'gbp-vcsui-tree-addin.c',
   'gbp-vcsui-workbench-addin.c',
   'gbp-vcsui-editor-page-addin.c',
-  # 'gbp-vcsui-clone-widget.c',
+  'gbp-vcsui-clone-widget.c',
 ])
 
 plugin_vcsui_resources = gnome.compile_resources(


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