[gnome-software/wip/william/update-all] Allow installation of just OS updates



commit f035bc3125e3b3d96cdcbc9a33f1c22ed348885d
Author: William Hua <william hua canonical com>
Date:   Thu Apr 7 19:07:03 2016 +0100

    Allow installation of just OS updates

 src/plugins/gs-plugin-apt.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-apt.c b/src/plugins/gs-plugin-apt.c
index 53e08b6..f3d5009 100644
--- a/src/plugins/gs-plugin-apt.c
+++ b/src/plugins/gs-plugin-apt.c
@@ -862,6 +862,43 @@ gs_plugin_app_update (GsPlugin *plugin,
                      GCancellable *cancellable,
                      GError **error)
 {
+       GPtrArray *related;
+       GsApp *app_tmp;
+       GList *apps;
+       guint i;
+       gboolean result;
+
+       if (gs_app_get_kind (app) == AS_APP_KIND_OS_UPDATE) {
+               related = gs_app_get_related (app);
+               apps = NULL;
+
+               for (i = 0; i < related->len; i++) {
+                       app_tmp = g_ptr_array_index (related, related->len - i - 1);
+                       gs_app_set_state (app_tmp, AS_APP_STATE_INSTALLING);
+                       apps = g_list_prepend (apps, app);
+               }
+
+               if (aptd_transaction (plugin, "UpgradePackages", NULL, apps, error)) {
+                       for (i = 0; i < related->len; i++) {
+                               app_tmp = g_ptr_array_index (related, i);
+                               gs_app_set_state (app_tmp, AS_APP_STATE_INSTALLED);
+                       }
+
+                       return TRUE;
+               } else {
+                       for (i = 0; i < related->len; i++) {
+                               app_tmp = g_ptr_array_index (related, i);
+                               gs_app_set_state (app_tmp, AS_APP_STATE_UPDATABLE_LIVE);
+                       }
+
+                       return FALSE;
+               }
+
+               g_list_free (apps);
+
+               return result;
+       }
+
        if (!app_is_ours (app))
                return TRUE;
 


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