[gnome-builder/wip/gtk4-port: 1234/1774] plugins/vcsui: stub out some terminal bits




commit a84248f808c1de78c859eb06cb7742d05842882d
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 30 16:27:36 2022 -0700

    plugins/vcsui: stub out some terminal bits
    
    Just to see how this might work to flip through things.

 src/plugins/vcsui/gbp-vcsui-clone-page.c  |  33 +++++++-
 src/plugins/vcsui/gbp-vcsui-clone-page.ui | 133 ++++++++++++++++--------------
 2 files changed, 101 insertions(+), 65 deletions(-)
---
diff --git a/src/plugins/vcsui/gbp-vcsui-clone-page.c b/src/plugins/vcsui/gbp-vcsui-clone-page.c
index 3078ffa9f..3d5d38e93 100644
--- a/src/plugins/vcsui/gbp-vcsui-clone-page.c
+++ b/src/plugins/vcsui/gbp-vcsui-clone-page.c
@@ -39,6 +39,7 @@ struct _GbpVcsuiClonePage
   AdwEntryRow *location_row;
   AdwEntryRow *author_name_row;
   AdwEntryRow *author_email_row;
+  GtkStack    *stack;
   VteTerminal *terminal;
 };
 
@@ -112,6 +113,30 @@ select_folder_action (GtkWidget  *widget,
   gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
 }
 
+static void
+clone_action (GtkWidget  *widget,
+              const char *action_name,
+              GVariant   *param)
+{
+  GbpVcsuiClonePage *self = (GbpVcsuiClonePage *)widget;
+  static guint count;
+
+  IDE_ENTRY;
+
+  g_assert (GBP_IS_VCSUI_CLONE_PAGE (self));
+
+  if (count++ % 2 == 0)
+  {
+    gtk_stack_set_visible_child_name (self->stack, "progress");
+  }
+  else
+  {
+    gtk_stack_set_visible_child_name (self->stack, "details");
+  }
+
+  IDE_EXIT;
+}
+
 static void
 gbp_vcsui_clone_page_dispose (GObject *object)
 {
@@ -133,15 +158,17 @@ gbp_vcsui_clone_page_class_init (GbpVcsuiClonePageClass *klass)
   gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
   gtk_widget_class_set_template_from_resource (widget_class, "/plugins/vcsui/gbp-vcsui-clone-page.ui");
 
-  gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, main);
-  gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, location_row);
-  gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, author_name_row);
   gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, author_email_row);
+  gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, author_name_row);
+  gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, location_row);
+  gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, main);
+  gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, stack);
   gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, terminal);
 
   gtk_widget_class_bind_template_callback (widget_class, location_row_changed_cb);
 
   gtk_widget_class_install_action (widget_class, "clone-page.select-folder", NULL, select_folder_action);
+  gtk_widget_class_install_action (widget_class, "clone-page.clone", NULL, clone_action);
 
   g_type_ensure (VTE_TYPE_TERMINAL);
 }
diff --git a/src/plugins/vcsui/gbp-vcsui-clone-page.ui b/src/plugins/vcsui/gbp-vcsui-clone-page.ui
index a8bc73703..13b90fb14 100644
--- a/src/plugins/vcsui/gbp-vcsui-clone-page.ui
+++ b/src/plugins/vcsui/gbp-vcsui-clone-page.ui
@@ -17,6 +17,16 @@
                 <child>
                   <object class="AdwEntryRow" id="uri_row">
                     <property name="title" translatable="yes">Repository URL</property>
+                    <child type="suffix">
+                      <object class="GtkMenuButton">
+                        <property name="icon-name">builder-vcs-branch-symbolic</property>
+                        <property name="tooltip-text" translatable="yes">Choose an alternate 
branch</property>
+                        <property name="valign">center</property>
+                        <style>
+                          <class name="flat"/>
+                        </style>
+                      </object>
+                    </child>
                   </object>
                 </child>
                 <child>
@@ -66,49 +76,71 @@
               </object>
             </child>
             <child>
-              <object class="AdwPreferencesGroup">
-                <property name="title" translatable="yes">Repository Details</property>
-                <child>
-                  <object class="AdwEntryRow" id="branch_row">
-                    <property name="title" translatable="yes">Branch</property>
-                  </object>
-                </child>
+              <object class="GtkStack" id="stack">
+                <property name="hhomogeneous">true</property>
+                <property name="vhomogeneous">true</property>
+                <property name="transition-type">crossfade</property>
+                <property name="transition-duration">300</property>
                 <child>
-                  <object class="GtkLabel">
-                    <property name="xalign">0</property>
-                    <property name="margin-top">12</property>
-                    <property name="wrap">true</property>
-                    <property name="label" translatable="yes">Specify a branch to clone if necessary. Unless 
specified, the default branch will be used.</property>
-                    <style>
-                      <class name="caption"/>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                </child>
-              </object>
-            </child>
-            <child>
-              <object class="AdwPreferencesGroup">
-                <child>
-                  <object class="AdwEntryRow" id="author_name_row">
-                    <property name="title" translatable="yes">Author</property>
-                  </object>
-                </child>
-                <child>
-                  <object class="AdwEntryRow" id="author_email_row">
-                    <property name="title" translatable="yes">Email</property>
+                  <object class="GtkStackPage">
+                    <property name="name">details</property>
+                    <property name="child">
+                      <object class="AdwPreferencesGroup">
+                        <property name="title" translatable="yes">Author Details</property>
+                        <child>
+                          <object class="AdwEntryRow" id="author_name_row">
+                            <property name="title" translatable="yes">Name</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="AdwEntryRow" id="author_email_row">
+                            <property name="title" translatable="yes">Email</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="xalign">0</property>
+                            <property name="margin-top">12</property>
+                            <property name="wrap">true</property>
+                            <property name="label" translatable="yes">You may specify authorship information 
to override defaults.</property>
+                            <style>
+                              <class name="caption"/>
+                              <class name="dim-label"/>
+                            </style>
+                          </object>
+                        </child>
+                      </object>
+                    </property>
                   </object>
                 </child>
                 <child>
-                  <object class="GtkLabel">
-                    <property name="xalign">0</property>
-                    <property name="margin-top">12</property>
-                    <property name="wrap">true</property>
-                    <property name="label" translatable="yes">You may specify authorship information to 
override defaults.</property>
-                    <style>
-                      <class name="caption"/>
-                      <class name="dim-label"/>
-                    </style>
+                  <object class="GtkStackPage">
+                    <property name="name">progress</property>
+                    <property name="child">
+                      <object class="AdwPreferencesGroup">
+                        <property name="title" translatable="yes">Status</property>
+                        <child>
+                          <object class="GtkScrolledWindow">
+                            <style>
+                              <class name="card"/>
+                            </style>
+                            <property name="has-frame">false</property>
+                            <property name="min-content-height">100</property>
+                            <property name="max-content-height">300</property>
+                            <property name="vscrollbar-policy">external</property>
+                            <property name="hscrollbar-policy">never</property>
+                            <child>
+                              <object class="VteTerminal" id="terminal">
+                                <property name="margin-top">9</property>
+                                <property name="margin-bottom">9</property>
+                                <property name="margin-start">9</property>
+                                <property name="margin-end">9</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </property>
                   </object>
                 </child>
               </object>
@@ -124,29 +156,6 @@
                 </style>
               </object>
             </child>
-            <child>
-              <object class="GtkFrame">
-                <style>
-                  <class name="card"/>
-                </style>
-                <child>
-                  <object class="GtkScrolledWindow">
-                    <property name="min-content-height">100</property>
-                    <property name="max-content-height">300</property>
-                    <property name="vscrollbar-policy">external</property>
-                    <property name="hscrollbar-policy">never</property>
-                    <child>
-                      <object class="VteTerminal" id="terminal">
-                        <property name="margin-top">9</property>
-                        <property name="margin-bottom">9</property>
-                        <property name="margin-start">9</property>
-                        <property name="margin-end">9</property>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-              </object>
-            </child>
           </object>
         </child>
       </object>


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