[gnome-software] flatpak: Add support for getting recent releases



commit 79a8f6d7c0397c548cf08551744ed19678ced491
Author: Richard Hughes <richard hughsie com>
Date:   Mon May 15 15:18:12 2017 +0100

    flatpak: Add support for getting recent releases

 plugins/flatpak/gs-flatpak.c        |   13 ++++++++++++-
 plugins/flatpak/gs-flatpak.h        |    7 ++++++-
 plugins/flatpak/gs-plugin-flatpak.c |   20 +++++++++++++++++++-
 3 files changed, 37 insertions(+), 3 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 3cf6bdc..9d6f910 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -1,7 +1,7 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
  *
  * Copyright (C) 2016 Joaquim Rocha <jrocha endlessm com>
- * Copyright (C) 2016 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2016-2017 Richard Hughes <richard hughsie com>
  *
  * Licensed under the GNU General Public License Version 2
  *
@@ -3215,6 +3215,17 @@ gs_flatpak_add_featured (GsFlatpak *self,
                                          cancellable, error);
 }
 
+gboolean
+gs_flatpak_add_recent (GsFlatpak *self,
+                      GsAppList *list,
+                      guint64 age,
+                      GCancellable *cancellable,
+                      GError **error)
+{
+       return gs_appstream_add_recent (self->plugin, self->store, list, age,
+                                       cancellable, error);
+}
+
 static void
 gs_flatpak_store_app_added_cb (AsStore *store, AsApp *app, GsFlatpak *self)
 {
diff --git a/plugins/flatpak/gs-flatpak.h b/plugins/flatpak/gs-flatpak.h
index 5cf015e..5773eee 100644
--- a/plugins/flatpak/gs-flatpak.h
+++ b/plugins/flatpak/gs-flatpak.h
@@ -1,7 +1,7 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
  *
  * Copyright (C) 2016 Joaquim Rocha <jrocha endlessm com>
- * Copyright (C) 2016 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2016-2017 Richard Hughes <richard hughsie com>
  *
  * Licensed under the GNU General Public License Version 2
  *
@@ -138,6 +138,11 @@ gboolean   gs_flatpak_add_featured         (GsFlatpak              *self,
                                                 GsAppList              *list,
                                                 GCancellable           *cancellable,
                                                 GError                 **error);
+gboolean       gs_flatpak_add_recent           (GsFlatpak              *self,
+                                                GsAppList              *list,
+                                                guint64                 age,
+                                                GCancellable           *cancellable,
+                                                GError                 **error);
 void           gs_plugin_flatpak_error_convert (GError                 **perror);
 
 G_END_DECLS
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index 22065a8..e7b8e98 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -1,7 +1,7 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
  *
  * Copyright (C) 2016 Joaquim Rocha <jrocha endlessm com>
- * Copyright (C) 2016 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2016-2017 Richard Hughes <richard hughsie com>
  *
  * Licensed under the GNU General Public License Version 2
  *
@@ -598,3 +598,21 @@ gs_plugin_add_featured (GsPlugin *plugin,
        }
        return TRUE;
 }
+
+gboolean
+gs_plugin_add_recent (GsPlugin *plugin,
+                     GsAppList *list,
+                     guint64 age,
+                     GCancellable *cancellable,
+                     GError **error)
+{
+       GsPluginData *priv = gs_plugin_get_data (plugin);
+       for (guint i = 0; i < priv->flatpaks->len; i++) {
+               GsFlatpak *flatpak = g_ptr_array_index (priv->flatpaks, i);
+               if (gs_flatpak_get_flags (flatpak) & GS_FLATPAK_FLAG_IS_TEMPORARY)
+                       continue;
+               if (!gs_flatpak_add_recent (flatpak, list, age, cancellable, error))
+                       return FALSE;
+       }
+       return TRUE;
+}


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