[gnome-software/wip/jrocha/limit-parallel-ops: 4/4] Make the QUEUED_FOR_INSTALL UX consistent with having a pending-action
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/jrocha/limit-parallel-ops: 4/4] Make the QUEUED_FOR_INSTALL UX consistent with having a pending-action
- Date: Wed, 24 Jan 2018 22:32:40 +0000 (UTC)
commit 5d7fb371d366b56b8ca446d2cd51880054544e53
Author: Joaquim Rocha <jrocha endlessm com>
Date: Fri Jan 19 18:36:28 2018 +0100
Make the QUEUED_FOR_INSTALL UX consistent with having a pending-action
Apps can get assigned an AS_APP_STATE_QUEUED_FOR_INSTALL state which
means they will not be installed until the network is connected again.
The UX for showing this state in the details page consisted in showin a
"Pending" string and a cancel button.
This is very similar to the UX of the apps when they have a
pending-action assigned to them, but actually less informative.
Thus, for consistency and improvement, these changes make the UX for the
QUEUED_FOR_INSTALL state the same as for pending-action.
lib/gs-app.c | 9 +++++++--
src/gs-details-page.c | 42 ++++++++++++++++++------------------------
src/gs-details-page.ui | 15 ++-------------
3 files changed, 27 insertions(+), 39 deletions(-)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index dc6de9b7..0d25d470 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -1120,8 +1120,13 @@ gs_app_set_state (GsApp *app, AsAppState state)
if (gs_app_set_state_internal (app, state)) {
/* since the state changed, and the pending-action refers to
- * actions that usually change the state, we reset it here */
- gs_app_set_pending_action_internal (app, GS_PLUGIN_ACTION_UNKNOWN);
+ * actions that usually change the state, we assign it to the
+ * appropriate action here */
+ GsPluginAction action = GS_PLUGIN_ACTION_UNKNOWN;
+ if (priv->state == AS_APP_STATE_QUEUED_FOR_INSTALL)
+ action = GS_PLUGIN_ACTION_INSTALL;
+ gs_app_set_pending_action_internal (app, action);
+
gs_app_queue_notify (app, "state");
}
}
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 16b1688c..208384bb 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -111,7 +111,6 @@ struct _GsDetailsPage
GtkWidget *label_details_updated_value;
GtkWidget *label_details_version_value;
GtkWidget *label_failed;
- GtkWidget *label_pending;
GtkWidget *label_license_nonfree_details;
GtkWidget *label_licenses_intro;
GtkWidget *list_box_addons;
@@ -240,10 +239,12 @@ app_has_pending_action (GsApp *app)
* expected states */
if (gs_app_get_state (app) != AS_APP_STATE_AVAILABLE &&
gs_app_get_state (app) != AS_APP_STATE_UPDATABLE_LIVE &&
- gs_app_get_state (app) != AS_APP_STATE_UPDATABLE)
+ gs_app_get_state (app) != AS_APP_STATE_UPDATABLE &&
+ gs_app_get_state (app) != AS_APP_STATE_QUEUED_FOR_INSTALL)
return FALSE;
- return gs_app_get_pending_action (app) != GS_PLUGIN_ACTION_UNKNOWN;
+ return (gs_app_get_pending_action (app) != GS_PLUGIN_ACTION_UNKNOWN) ||
+ (gs_app_get_state (app) == AS_APP_STATE_QUEUED_FOR_INSTALL);
}
static void
@@ -273,16 +274,6 @@ gs_details_page_switch_to (GsPage *page, gboolean scroll_up)
state = gs_app_get_state (self->app);
- /* label */
- switch (state) {
- case AS_APP_STATE_QUEUED_FOR_INSTALL:
- gtk_widget_set_visible (self->label_pending, TRUE);
- break;
- default:
- gtk_widget_set_visible (self->label_pending, FALSE);
- break;
- }
-
/* install button */
switch (state) {
case AS_APP_STATE_AVAILABLE:
@@ -293,9 +284,6 @@ gs_details_page_switch_to (GsPage *page, gboolean scroll_up)
* can be installed */
gtk_button_set_label (GTK_BUTTON (self->button_install), _("_Install"));
break;
- case AS_APP_STATE_QUEUED_FOR_INSTALL:
- gtk_widget_set_visible (self->button_install, FALSE);
- break;
case AS_APP_STATE_INSTALLING:
gtk_widget_set_visible (self->button_install, FALSE);
break;
@@ -313,6 +301,7 @@ gs_details_page_switch_to (GsPage *page, gboolean scroll_up)
case AS_APP_STATE_INSTALLED:
case AS_APP_STATE_REMOVING:
case AS_APP_STATE_UPDATABLE:
+ case AS_APP_STATE_QUEUED_FOR_INSTALL:
gtk_widget_set_visible (self->button_install, FALSE);
break;
case AS_APP_STATE_UPDATABLE_LIVE:
@@ -388,12 +377,6 @@ gs_details_page_switch_to (GsPage *page, gboolean scroll_up)
/* TRANSLATORS: button text in the header when an application can be erased */
gtk_button_set_label (GTK_BUTTON (self->button_remove), _("_Remove"));
break;
- case AS_APP_STATE_QUEUED_FOR_INSTALL:
- gtk_widget_set_visible (self->button_remove, TRUE);
- gtk_widget_set_sensitive (self->button_remove, TRUE);
- gtk_style_context_remove_class (gtk_widget_get_style_context (self->button_remove),
"destructive-action");
- gtk_button_set_label (GTK_BUTTON (self->button_remove), _("_Cancel"));
- break;
case AS_APP_STATE_AVAILABLE_LOCAL:
case AS_APP_STATE_AVAILABLE:
case AS_APP_STATE_INSTALLING:
@@ -402,6 +385,7 @@ gs_details_page_switch_to (GsPage *page, gboolean scroll_up)
case AS_APP_STATE_UNKNOWN:
case AS_APP_STATE_PURCHASABLE:
case AS_APP_STATE_PURCHASING:
+ case AS_APP_STATE_QUEUED_FOR_INSTALL:
gtk_widget_set_visible (self->button_remove, FALSE);
break;
default:
@@ -1862,12 +1846,18 @@ gs_details_page_get_app (GsDetailsPage *self)
}
static void
-gs_details_page_app_remove_button_cb (GtkWidget *widget, GsDetailsPage *self)
+gs_details_page_remove_app (GsDetailsPage *self)
{
g_set_object (&self->app_cancellable, gs_app_get_cancellable (self->app));
gs_page_remove_app (GS_PAGE (self), self->app, self->app_cancellable);
}
+static void
+gs_details_page_app_remove_button_cb (GtkWidget *widget, GsDetailsPage *self)
+{
+ gs_details_page_remove_app (self);
+}
+
static void
gs_details_page_app_cancel_button_cb (GtkWidget *widget, GsDetailsPage *self)
{
@@ -1876,6 +1866,11 @@ gs_details_page_app_cancel_button_cb (GtkWidget *widget, GsDetailsPage *self)
/* reset the pending-action from the app if needed */
gs_app_set_pending_action (self->app, GS_PLUGIN_ACTION_UNKNOWN);
+
+ /* FIXME: We should be able to revert the QUEUED_FOR_INSTALL without
+ * having to pretend to remove the app */
+ if (gs_app_get_state (self->app) == AS_APP_STATE_QUEUED_FOR_INSTALL)
+ gs_details_page_remove_app (self);
}
static void
@@ -2442,7 +2437,6 @@ gs_details_page_class_init (GsDetailsPageClass *klass)
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_details_updated_value);
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_details_version_value);
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_failed);
- gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, label_pending);
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, list_box_addons);
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_reviews);
gtk_widget_class_bind_template_child (widget_class, GsDetailsPage, box_details_screenshot_fallback);
diff --git a/src/gs-details-page.ui b/src/gs-details-page.ui
index 68a9fb9b..22d3efdf 100644
--- a/src/gs-details-page.ui
+++ b/src/gs-details-page.ui
@@ -338,17 +338,6 @@
<property name="position">5</property>
</packing>
</child>
- <child>
- <object class="GtkLabel" id="label_pending">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Pending</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">6</property>
- </packing>
- </child>
<child>
<object class="GtkLinkButton" id="button_details_add_shortcut">
<property name="visible">False</property>
@@ -360,7 +349,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">7</property>
+ <property name="position">6</property>
<property name="pack-type">end</property>
</packing>
</child>
@@ -375,7 +364,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">8</property>
+ <property name="position">7</property>
<property name="pack-type">end</property>
</packing>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]