[gnome-software/wip/rancell/ubuntu-ratings-3-18: 3/19] More ubuntu plugin work



commit 85b7995531627a53c29313af533c41f9c5c4958a
Author: Robert Ancell <robert ancell canonical com>
Date:   Wed Oct 7 10:07:51 2015 +1300

    More ubuntu plugin work

 src/plugins/Makefile.am                |    4 ++--
 src/plugins/gs-plugin-ubuntu-ratings.c |   20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 717a55e..12bff16 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -132,9 +132,9 @@ libgs_plugin_local_ratings_la_LDFLAGS = -module -avoid-version
 libgs_plugin_local_ratings_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(WARN_CFLAGS)
 
 libgs_plugin_ubuntu_ratings_la_SOURCES = gs-plugin-ubuntu-ratings.c
-libgs_plugin_ubuntu_ratings_la_LIBADD = $(GS_PLUGIN_LIBS)
+libgs_plugin_ubuntu_ratings_la_LIBADD = $(GS_PLUGIN_LIBS) $(SOUP_LIBS)
 libgs_plugin_ubuntu_ratings_la_LDFLAGS = -module -avoid-version
-libgs_plugin_ubuntu_ratings_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(WARN_CFLAGS)
+libgs_plugin_ubuntu_ratings_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(WARNINGFLAGS_C)
 
 libgs_plugin_packagekit_la_SOURCES =                   \
        gs-plugin-packagekit.c                          \
diff --git a/src/plugins/gs-plugin-ubuntu-ratings.c b/src/plugins/gs-plugin-ubuntu-ratings.c
index c402cef..2fca1c8 100644
--- a/src/plugins/gs-plugin-ubuntu-ratings.c
+++ b/src/plugins/gs-plugin-ubuntu-ratings.c
@@ -21,9 +21,11 @@
 
 #include <config.h>
 
+#include <libsoup/soup.h>
 #include <gs-plugin.h>
 
 struct GsPluginPrivate {
+       SoupSession             *session;
 };
 
 /**
@@ -35,6 +37,8 @@ gs_plugin_get_name (void)
        return "ubuntu-ratings";
 }
 
+#define GS_PLUGIN_UBUNTU_RATINGS_SERVER                "https://reviews.ubuntu.com/reviews";
+
 /**
  * gs_plugin_initialize:
  */
@@ -43,6 +47,13 @@ gs_plugin_initialize (GsPlugin *plugin)
 {
        /* create private area */
        plugin->priv = GS_PLUGIN_GET_PRIVATE (GsPluginPrivate);
+
+       /* check that we are running on Fedora */
+       if (!gs_plugin_check_distro_id (plugin, "ubuntu")) {
+               gs_plugin_set_enabled (plugin, FALSE);
+               g_debug ("disabling '%s' as we're not Fedora", plugin->name);
+               return;
+       }
 }
 
 /**
@@ -61,6 +72,8 @@ gs_plugin_get_deps (GsPlugin *plugin)
 void
 gs_plugin_destroy (GsPlugin *plugin)
 {
+       if (plugin->priv->session != NULL)
+               g_object_unref (plugin->priv->session);
 }
 
 /**
@@ -88,6 +101,13 @@ gs_plugin_refine (GsPlugin *plugin,
        GList *l;
        GsApp *app;
 
+       /* We only update ratings */
+       if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING) == 0)
+               return TRUE;
+
+       /* Download records */
+       /* ... */
+
        for (l = *list; l != NULL; l = l->next) {
                app = GS_APP (l->data);
                if (gs_app_get_id (app) == NULL)


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