[gnome-software] trivial: Include the plugin name in the journal messages



commit d34e3319da7e84f90783db3a4b92032442ae8f8d
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jun 28 19:51:34 2017 +0100

    trivial: Include the plugin name in the journal messages

 lib/gs-plugin-job-private.h |    1 +
 lib/gs-plugin-job.c         |   20 ++++++++++++++++++++
 lib/gs-plugin-job.h         |    2 ++
 lib/gs-plugin-loader.c      |    3 +++
 4 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/lib/gs-plugin-job-private.h b/lib/gs-plugin-job-private.h
index 8792135..d1dd62d 100644
--- a/lib/gs-plugin-job-private.h
+++ b/lib/gs-plugin-job-private.h
@@ -47,6 +47,7 @@ GsAuth                        *gs_plugin_job_get_auth                 (GsPluginJob    
*self);
 GsApp                  *gs_plugin_job_get_app                  (GsPluginJob    *self);
 GsAppList              *gs_plugin_job_get_list                 (GsPluginJob    *self);
 GFile                  *gs_plugin_job_get_file                 (GsPluginJob    *self);
+GsPlugin               *gs_plugin_job_get_plugin               (GsPluginJob    *self);
 GsCategory             *gs_plugin_job_get_category             (GsPluginJob    *self);
 AsReview               *gs_plugin_job_get_review               (GsPluginJob    *self);
 GsPrice                        *gs_plugin_job_get_price                (GsPluginJob    *self);
diff --git a/lib/gs-plugin-job.c b/lib/gs-plugin-job.c
index eb8d66e..4fc13ca 100644
--- a/lib/gs-plugin-job.c
+++ b/lib/gs-plugin-job.c
@@ -34,6 +34,7 @@ struct _GsPluginJob
        GsPluginFailureFlags     failure_flags;
        guint                    max_results;
        guint64                  age;
+       GsPlugin                *plugin;
        GsPluginAction           action;
        GsAppListSortFunc        sort_func;
        gpointer                 sort_func_data;
@@ -121,6 +122,10 @@ gs_plugin_job_to_string (GsPluginJob *self)
                g_autofree gchar *path = g_file_get_path (self->file);
                g_string_append_printf (str, " with file=%s", path);
        }
+       if (self->plugin != NULL) {
+               g_string_append_printf (str, " on plugin=%s",
+                                       gs_plugin_get_name (self->plugin));
+       }
        if (self->list != NULL && gs_app_list_length (self->list) > 0) {
                g_autofree const gchar **unique_ids = NULL;
                g_autofree gchar *unique_ids_str = NULL;
@@ -346,6 +351,20 @@ gs_plugin_job_get_file (GsPluginJob *self)
 }
 
 void
+gs_plugin_job_set_plugin (GsPluginJob *self, GsPlugin *plugin)
+{
+       g_return_if_fail (GS_IS_PLUGIN_JOB (self));
+       g_set_object (&self->plugin, plugin);
+}
+
+GsPlugin *
+gs_plugin_job_get_plugin (GsPluginJob *self)
+{
+       g_return_val_if_fail (GS_IS_PLUGIN_JOB (self), NULL);
+       return self->plugin;
+}
+
+void
 gs_plugin_job_set_category (GsPluginJob *self, GsCategory *category)
 {
        g_return_if_fail (GS_IS_PLUGIN_JOB (self));
@@ -504,6 +523,7 @@ gs_plugin_job_finalize (GObject *obj)
        g_clear_object (&self->app);
        g_clear_object (&self->list);
        g_clear_object (&self->file);
+       g_clear_object (&self->plugin);
        g_clear_object (&self->category);
        g_clear_object (&self->review);
        g_clear_object (&self->price);
diff --git a/lib/gs-plugin-job.h b/lib/gs-plugin-job.h
index 70a908e..6d2f050 100644
--- a/lib/gs-plugin-job.h
+++ b/lib/gs-plugin-job.h
@@ -60,6 +60,8 @@ void           gs_plugin_job_set_list                 (GsPluginJob    *self,
                                                         GsAppList      *list);
 void            gs_plugin_job_set_file                 (GsPluginJob    *self,
                                                         GFile          *file);
+void            gs_plugin_job_set_plugin               (GsPluginJob    *self,
+                                                        GsPlugin       *plugin);
 void            gs_plugin_job_set_category             (GsPluginJob    *self,
                                                         GsCategory     *category);
 void            gs_plugin_job_set_review               (GsPluginJob    *self,
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index b21af1a..902621b 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -506,6 +506,9 @@ gs_plugin_loader_call_vfunc (GsPluginLoaderHelper *helper,
        if (list == NULL)
                list = gs_plugin_job_get_list (helper->plugin_job);
 
+       /* set what plugin is running on the job */
+       gs_plugin_job_set_plugin (helper->plugin_job, plugin);
+
        /* run the correct vfunc */
        gs_plugin_loader_action_start (helper->plugin_loader, plugin, FALSE);
        switch (action) {


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