[gnome-builder] git: add spinner widget during clone operation
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] git: add spinner widget during clone operation
- Date: Wed, 27 Apr 2016 22:35:08 +0000 (UTC)
commit 77e29a3a7a7bb03fa450c0ea7c4af59f929e79a0
Author: Christian Hergert <christian hergert me>
Date: Wed Apr 27 15:34:56 2016 -0700
git: add spinner widget during clone operation
Sometimes it takes some time to get initial progress notification from
libgit2, so set a spinner active to let the user know we are doing
something in the mean time.
plugins/git/ide-git-clone-widget.c | 6 ++++++
plugins/git/ide-git-clone-widget.ui | 19 +++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/plugins/git/ide-git-clone-widget.c b/plugins/git/ide-git-clone-widget.c
index 927c8de..214e15d 100644
--- a/plugins/git/ide-git-clone-widget.c
+++ b/plugins/git/ide-git-clone-widget.c
@@ -37,6 +37,7 @@ struct _IdeGitCloneWidget
GtkEntry *clone_uri_entry;
GtkLabel *clone_error_label;
GtkProgressBar *clone_progress;
+ GtkSpinner *clone_spinner;
guint is_ready : 1;
};
@@ -188,6 +189,7 @@ ide_git_clone_widget_class_init (IdeGitCloneWidgetClass *klass)
gtk_widget_class_bind_template_child (widget_class, IdeGitCloneWidget, clone_location_button);
gtk_widget_class_bind_template_child (widget_class, IdeGitCloneWidget, clone_location_entry);
gtk_widget_class_bind_template_child (widget_class, IdeGitCloneWidget, clone_progress);
+ gtk_widget_class_bind_template_child (widget_class, IdeGitCloneWidget, clone_spinner);
gtk_widget_class_bind_template_child (widget_class, IdeGitCloneWidget, clone_uri_entry);
}
@@ -370,6 +372,8 @@ ide_git_clone_widget_clone_async (IdeGitCloneWidget *self,
req = clone_request_new (uri, location);
}
+ gtk_spinner_start (self->clone_spinner);
+
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_task_data (task, req, clone_request_free);
g_task_run_in_thread (task, ide_git_clone_widget_worker);
@@ -383,5 +387,7 @@ ide_git_clone_widget_clone_finish (IdeGitCloneWidget *self,
g_return_val_if_fail (IDE_IS_GIT_CLONE_WIDGET (self), FALSE);
g_return_val_if_fail (G_IS_TASK (result), FALSE);
+ gtk_spinner_stop (self->clone_spinner);
+
return g_task_propagate_boolean (G_TASK (result), error);
}
diff --git a/plugins/git/ide-git-clone-widget.ui b/plugins/git/ide-git-clone-widget.ui
index 610b791..7006cae 100644
--- a/plugins/git/ide-git-clone-widget.ui
+++ b/plugins/git/ide-git-clone-widget.ui
@@ -124,6 +124,24 @@
</child>
</object>
</child>
+ <child>
+ <object class="GtkBox">
+ <property name="halign">start</property>
+ <property name="hexpand">true</property>
+ <property name="valign">start</property>
+ <property name="vexpand">true</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkSpinner" id="clone_spinner">
+ <property name="active">false</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
</object>
</child>
<child>
@@ -160,6 +178,7 @@
<widgets>
<widget name="clone_location_label"/>
<widget name="clone_location_button"/>
+ <widget name="clone_spinner"/>
<widget name="clone_uri_label"/>
<widget name="clone_uri_entry"/>
</widgets>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]