[gnome-software] Add the concept of a 'local' not-yet-installed package file
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add the concept of a 'local' not-yet-installed package file
- Date: Wed, 29 Jan 2014 11:41:52 +0000 (UTC)
commit 32d8c397d1176a11cfc4c0e8d0e727ae2d3a2e10
Author: Richard Hughes <richard hughsie com>
Date: Wed Jan 29 10:59:38 2014 +0000
Add the concept of a 'local' not-yet-installed package file
src/gs-app-widget.c | 1 +
src/gs-app.c | 12 +++++++++++-
src/gs-app.h | 1 +
src/gs-shell-details.c | 3 +++
src/plugins/gs-plugin-packagekit-refresh.c | 2 +-
5 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-app-widget.c b/src/gs-app-widget.c
index b2432f7..4cb74c3 100644
--- a/src/gs-app-widget.c
+++ b/src/gs-app-widget.c
@@ -204,6 +204,7 @@ gs_app_widget_refresh (GsAppWidget *app_widget)
gtk_label_set_label (GTK_LABEL (priv->label), _("Pending"));
break;
case GS_APP_STATE_AVAILABLE:
+ case GS_APP_STATE_LOCAL:
gtk_widget_set_visible (priv->button, TRUE);
/* TRANSLATORS: this is a button next to the search results that
* allows the application to be easily installed */
diff --git a/src/gs-app.c b/src/gs-app.c
index 97f355e..05cd63a 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -153,6 +153,8 @@ gs_app_state_to_string (GsAppState state)
return "installed";
if (state == GS_APP_STATE_AVAILABLE)
return "available";
+ if (state == GS_APP_STATE_LOCAL)
+ return "local";
if (state == GS_APP_STATE_QUEUED)
return "queued";
if (state == GS_APP_STATE_INSTALLING)
@@ -362,6 +364,7 @@ gs_app_set_state_internal (GsApp *app, GsAppState state)
if (state == GS_APP_STATE_INSTALLED ||
state == GS_APP_STATE_QUEUED ||
state == GS_APP_STATE_AVAILABLE ||
+ state == GS_APP_STATE_LOCAL ||
state == GS_APP_STATE_UPDATABLE ||
state == GS_APP_STATE_UNAVAILABLE)
state_change_ok = TRUE;
@@ -411,6 +414,12 @@ gs_app_set_state_internal (GsApp *app, GsAppState state)
state == GS_APP_STATE_AVAILABLE)
state_change_ok = TRUE;
break;
+ case GS_APP_STATE_LOCAL:
+ /* local has to go into an action state */
+ if (state == GS_APP_STATE_UNKNOWN ||
+ state == GS_APP_STATE_INSTALLING)
+ state_change_ok = TRUE;
+ break;
default:
g_warning ("state %s unhandled",
gs_app_state_to_string (priv->state));
@@ -429,7 +438,8 @@ gs_app_set_state_internal (GsApp *app, GsAppState state)
priv->state = state;
if (state == GS_APP_STATE_UNKNOWN ||
- state == GS_APP_STATE_AVAILABLE)
+ state == GS_APP_STATE_LOCAL ||
+ state == GS_APP_STATE_AVAILABLE)
app->priv->install_date = 0;
return TRUE;
diff --git a/src/gs-app.h b/src/gs-app.h
index 9254d37..a150811 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -74,6 +74,7 @@ typedef enum {
GS_APP_STATE_REMOVING,
GS_APP_STATE_UPDATABLE,
GS_APP_STATE_UNAVAILABLE, /* we found a reference to this */
+ GS_APP_STATE_LOCAL,
GS_APP_STATE_LAST
} GsAppState;
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index adc4279..441d7ea 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -101,6 +101,7 @@ gs_shell_details_refresh (GsShellDetails *shell_details)
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
switch (state) {
case GS_APP_STATE_AVAILABLE:
+ case GS_APP_STATE_LOCAL:
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");
@@ -159,6 +160,7 @@ gs_shell_details_refresh (GsShellDetails *shell_details)
gtk_style_context_remove_class (gtk_widget_get_style_context (widget),
"destructive-action");
gtk_button_set_label (GTK_BUTTON (widget), _("_Cancel"));
break;
+ case GS_APP_STATE_LOCAL:
case GS_APP_STATE_AVAILABLE:
case GS_APP_STATE_INSTALLING:
case GS_APP_STATE_UNAVAILABLE:
@@ -185,6 +187,7 @@ gs_shell_details_refresh (GsShellDetails *shell_details)
case GS_APP_STATE_QUEUED:
case GS_APP_STATE_UPDATABLE:
case GS_APP_STATE_UNAVAILABLE:
+ case GS_APP_STATE_LOCAL:
gtk_widget_set_visible (widget, FALSE);
gtk_spinner_stop (GTK_SPINNER (widget));
break;
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index 73f62db..0112b21 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -228,7 +228,7 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
package_id = pk_details_get_package_id (item);
split = pk_package_id_split (package_id);
gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
- gs_app_set_state (app, GS_APP_STATE_AVAILABLE);
+ gs_app_set_state (app, GS_APP_STATE_LOCAL);
gs_app_set_name (app, split[PK_PACKAGE_ID_NAME]);
gs_app_set_version (app, split[PK_PACKAGE_ID_VERSION]);
gs_app_set_metadata (app, "PackageKit::local-filename", filename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]