[gnome-software] Add a spinner for installing and removing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add a spinner for installing and removing
- Date: Mon, 2 Sep 2013 05:47:35 +0000 (UTC)
commit efaa11c39fdd2911d31e8e5375cc1b98f9821c7a
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Sep 2 01:46:14 2013 -0400
Add a spinner for installing and removing
Also restyle the buttons properly while the installation or
removal is ongoing.
src/gnome-software.ui | 9 ++++++++-
src/gs-shell-details.c | 26 ++++++++++++++++++++++++++
src/gs-shell.c | 3 +++
3 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/src/gnome-software.ui b/src/gnome-software.ui
index 88ece41..f2926bd 100644
--- a/src/gnome-software.ui
+++ b/src/gnome-software.ui
@@ -137,9 +137,16 @@
</object>
</child>
<child>
+ <object class="GtkSpinner" id="header_spinner">
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkButton" id="button_update_all">
<property name="label" translatable="yes">Restart & Install</property>
- <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<style>
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 20ab602..f0fc13e 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -79,11 +79,13 @@ gs_shell_details_refresh (GsShellDetails *shell_details)
case GS_APP_STATE_AVAILABLE:
gtk_widget_set_visible (widget, TRUE);
gtk_widget_set_sensitive (widget, TRUE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (widget), "suggested-action");
gtk_button_set_label (GTK_BUTTON (widget), _("Install"));
break;
case GS_APP_STATE_INSTALLING:
gtk_widget_set_visible (widget, TRUE);
gtk_widget_set_sensitive (widget, FALSE);
+ gtk_style_context_remove_class (gtk_widget_get_style_context (widget), "suggested-action");
gtk_button_set_label (GTK_BUTTON (widget), _("Installing"));
break;
case GS_APP_STATE_INSTALLED:
@@ -103,11 +105,13 @@ gs_shell_details_refresh (GsShellDetails *shell_details)
case GS_APP_STATE_INSTALLED:
gtk_widget_set_visible (widget, TRUE);
gtk_widget_set_sensitive (widget, TRUE);
+ gtk_style_context_add_class (gtk_widget_get_style_context (widget),
"destructive-action");
gtk_button_set_label (GTK_BUTTON (widget), _("Remove"));
break;
case GS_APP_STATE_REMOVING:
gtk_widget_set_visible (widget, TRUE);
gtk_widget_set_sensitive (widget, FALSE);
+ gtk_style_context_remove_class (gtk_widget_get_style_context (widget),
"destructive-action");
gtk_button_set_label (GTK_BUTTON (widget), _("Removing"));
break;
case GS_APP_STATE_AVAILABLE:
@@ -118,6 +122,28 @@ gs_shell_details_refresh (GsShellDetails *shell_details)
g_assert_not_reached ();
}
}
+
+ /* spinner */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header_spinner"));
+ if (kind == GS_APP_KIND_SYSTEM) {
+ gtk_widget_set_visible (widget, FALSE);
+ gtk_spinner_stop (GTK_SPINNER (widget));
+ } else {
+ switch (state) {
+ case GS_APP_STATE_INSTALLED:
+ case GS_APP_STATE_AVAILABLE:
+ gtk_widget_set_visible (widget, FALSE);
+ gtk_spinner_stop (GTK_SPINNER (widget));
+ break;
+ case GS_APP_STATE_INSTALLING:
+ case GS_APP_STATE_REMOVING:
+ gtk_spinner_start (GTK_SPINNER (widget));
+ gtk_widget_set_visible (widget, TRUE);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ }
}
/**
diff --git a/src/gs-shell.c b/src/gs-shell.c
index 4c051ce..862a5be 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -86,6 +86,9 @@ gs_shell_change_mode (GsShell *shell, GsShellMode mode, GsApp *app, GsCategory *
*/
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_update_all"));
gtk_widget_hide (widget);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "header_spinner"));
+ gtk_spinner_stop (GTK_SPINNER (widget));
+ gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
gtk_widget_hide (widget);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]