[gnome-builder/wip/gtk4-port] plugins/vcsui: show error message on failures



commit 84306f01740afdb2de15647ecfb2e5e2f9a0bed3
Author: Christian Hergert <chergert redhat com>
Date:   Tue May 31 23:32:41 2022 -0700

    plugins/vcsui: show error message on failures

 src/plugins/vcsui/gbp-vcsui-clone-page.c  |  6 ++++++
 src/plugins/vcsui/gbp-vcsui-clone-page.ui | 14 +++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/vcsui/gbp-vcsui-clone-page.c b/src/plugins/vcsui/gbp-vcsui-clone-page.c
index 43a872d2d..521a4c7ac 100644
--- a/src/plugins/vcsui/gbp-vcsui-clone-page.c
+++ b/src/plugins/vcsui/gbp-vcsui-clone-page.c
@@ -48,6 +48,7 @@ struct _GbpVcsuiClonePage
   VteTerminal        *terminal;
   AdwEntryRow        *uri_row;
   IdeProgressIcon    *progress;
+  GtkLabel           *failure_message;
 
   IdeVcsCloneRequest *request;
 };
@@ -144,6 +145,8 @@ gbp_vcsui_clone_page_clone_cb (GObject      *object,
     {
       g_message ("Failed to clone repository: %s", error->message);
       gtk_stack_set_visible_child_name (self->stack, "details");
+      gtk_label_set_label (self->failure_message,
+                           _("A failure occurred while cloning the repository."));
       IDE_GOTO (failure);
     }
   else
@@ -244,6 +247,8 @@ clone_action (GtkWidget  *widget,
   ide_greeter_workspace_begin (greeter);
   gtk_widget_action_set_enabled (widget, "clone-page.clone", FALSE);
 
+  gtk_label_set_label (self->failure_message, NULL);
+
   ide_vcs_clone_request_clone_async (self->request,
                                      notif,
                                      NULL,
@@ -389,6 +394,7 @@ gbp_vcsui_clone_page_class_init (GbpVcsuiClonePageClass *klass)
   gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, author_name_row);
   gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, branch_button);
   gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, branch_label);
+  gtk_widget_class_bind_template_child (widget_class, GbpVcsuiClonePage, failure_message);
   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, progress);
diff --git a/src/plugins/vcsui/gbp-vcsui-clone-page.ui b/src/plugins/vcsui/gbp-vcsui-clone-page.ui
index 0c7392c24..cc158ad39 100644
--- a/src/plugins/vcsui/gbp-vcsui-clone-page.ui
+++ b/src/plugins/vcsui/gbp-vcsui-clone-page.ui
@@ -258,18 +258,30 @@
             </child>
             <child>
               <object class="GtkBox">
-                <property name="halign">end</property>
                 <property name="margin-top">12</property>
                 <property name="spacing">16</property>
+                <child>
+                  <object class="GtkLabel" id="failure_message">
+                    <property name="wrap">true</property>
+                    <property name="hexpand">true</property>
+                    <property name="xalign">0</property>
+                    <property name="valign">center</property>
+                    <style>
+                      <class name="error"/>
+                    </style>
+                  </object>
+                </child>
                 <child>
                   <object class="IdeProgressIcon" id="progress">
                     <property name="visible">false</property>
+                    <property name="valign">center</property>
                   </object>
                 </child>
                 <child>
                   <object class="GtkButton">
                     <property name="action-name">clone-page.clone</property>
                     <property name="label" translatable="yes">Clone Repository</property>
+                    <property name="valign">center</property>
                     <style>
                       <class name="suggested-action"/>
                     </style>


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