[gnome-software: 10/14] gs-plugin-job: Drop filter-flags property




commit 73dc9343e0d2d3c09dc0286a097cf6429ac92f8f
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Jan 25 16:28:33 2022 +0000

    gs-plugin-job: Drop filter-flags property
    
    This hasn’t been used since 255e4bde5f060b0ca9c0dc912ddeacddc701dfc9.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1472

 lib/gs-plugin-job-private.h |  1 -
 lib/gs-plugin-job.c         | 34 ----------------------------------
 lib/gs-plugin-job.h         |  2 --
 lib/gs-plugin-loader.c      | 37 -------------------------------------
 4 files changed, 74 deletions(-)
---
diff --git a/lib/gs-plugin-job-private.h b/lib/gs-plugin-job-private.h
index 53acf8ae7..f75dda95f 100644
--- a/lib/gs-plugin-job-private.h
+++ b/lib/gs-plugin-job-private.h
@@ -15,7 +15,6 @@
 G_BEGIN_DECLS
 
 GsPluginAction          gs_plugin_job_get_action               (GsPluginJob    *self);
-GsPluginRefineFlags     gs_plugin_job_get_filter_flags         (GsPluginJob    *self);
 GsAppListFilterFlags    gs_plugin_job_get_dedupe_flags         (GsPluginJob    *self);
 GsPluginRefineFlags     gs_plugin_job_get_refine_flags         (GsPluginJob    *self);
 gboolean                gs_plugin_job_has_refine_flags         (GsPluginJob    *self,
diff --git a/lib/gs-plugin-job.c b/lib/gs-plugin-job.c
index 03eaf249d..163ce2b1d 100644
--- a/lib/gs-plugin-job.c
+++ b/lib/gs-plugin-job.c
@@ -18,7 +18,6 @@
 typedef struct
 {
        GsPluginRefineFlags      refine_flags;
-       GsPluginRefineFlags      filter_flags;
        GsAppListFilterFlags     dedupe_flags;
        gboolean                 interactive;
        gboolean                 propagate_error;
@@ -44,7 +43,6 @@ enum {
        PROP_AGE,
        PROP_SEARCH,
        PROP_REFINE_FLAGS,
-       PROP_FILTER_FLAGS,
        PROP_DEDUPE_FLAGS,
        PROP_INTERACTIVE,
        PROP_APP,
@@ -72,10 +70,6 @@ gs_plugin_job_to_string (GsPluginJob *self)
                g_string_append_printf (str, " on plugin=%s",
                                        gs_plugin_get_name (priv->plugin));
        }
-       if (priv->filter_flags > 0) {
-               g_autofree gchar *tmp = gs_plugin_refine_flags_to_string (priv->filter_flags);
-               g_string_append_printf (str, " with filter-flags=%s", tmp);
-       }
        if (priv->dedupe_flags > 0)
                g_string_append_printf (str, " with dedupe-flags=%" G_GUINT64_FORMAT, priv->dedupe_flags);
        if (priv->refine_flags > 0) {
@@ -147,14 +141,6 @@ gs_plugin_job_set_refine_flags (GsPluginJob *self, GsPluginRefineFlags refine_fl
        priv->refine_flags = refine_flags;
 }
 
-void
-gs_plugin_job_set_filter_flags (GsPluginJob *self, GsPluginRefineFlags filter_flags)
-{
-       GsPluginJobPrivate *priv = gs_plugin_job_get_instance_private (self);
-       g_return_if_fail (GS_IS_PLUGIN_JOB (self));
-       priv->filter_flags = filter_flags;
-}
-
 void
 gs_plugin_job_set_dedupe_flags (GsPluginJob *self, GsAppListFilterFlags dedupe_flags)
 {
@@ -171,14 +157,6 @@ gs_plugin_job_get_refine_flags (GsPluginJob *self)
        return priv->refine_flags;
 }
 
-GsPluginRefineFlags
-gs_plugin_job_get_filter_flags (GsPluginJob *self)
-{
-       GsPluginJobPrivate *priv = gs_plugin_job_get_instance_private (self);
-       g_return_val_if_fail (GS_IS_PLUGIN_JOB (self), GS_PLUGIN_REFINE_FLAGS_NONE);
-       return priv->filter_flags;
-}
-
 GsAppListFilterFlags
 gs_plugin_job_get_dedupe_flags (GsPluginJob *self)
 {
@@ -461,9 +439,6 @@ gs_plugin_job_get_property (GObject *obj, guint prop_id, GValue *value, GParamSp
        case PROP_REFINE_FLAGS:
                g_value_set_flags (value, priv->refine_flags);
                break;
-       case PROP_FILTER_FLAGS:
-               g_value_set_flags (value, priv->filter_flags);
-               break;
        case PROP_DEDUPE_FLAGS:
                g_value_set_flags (value, priv->dedupe_flags);
                break;
@@ -518,9 +493,6 @@ gs_plugin_job_set_property (GObject *obj, guint prop_id, const GValue *value, GP
        case PROP_REFINE_FLAGS:
                gs_plugin_job_set_refine_flags (self, g_value_get_flags (value));
                break;
-       case PROP_FILTER_FLAGS:
-               gs_plugin_job_set_filter_flags (self, g_value_get_flags (value));
-               break;
        case PROP_DEDUPE_FLAGS:
                gs_plugin_job_set_dedupe_flags (self, g_value_get_flags (value));
                break;
@@ -601,11 +573,6 @@ gs_plugin_job_class_init (GsPluginJobClass *klass)
                                    G_PARAM_READWRITE);
        g_object_class_install_property (object_class, PROP_REFINE_FLAGS, pspec);
 
-       pspec = g_param_spec_flags ("filter-flags", NULL, NULL,
-                                   GS_TYPE_PLUGIN_REFINE_FLAGS, GS_PLUGIN_REFINE_FLAGS_NONE,
-                                   G_PARAM_READWRITE);
-       g_object_class_install_property (object_class, PROP_FILTER_FLAGS, pspec);
-
        pspec = g_param_spec_flags ("dedupe-flags", NULL, NULL,
                                    GS_TYPE_APP_LIST_FILTER_FLAGS, GS_APP_LIST_FILTER_FLAG_NONE,
                                    G_PARAM_READWRITE);
@@ -669,7 +636,6 @@ gs_plugin_job_init (GsPluginJob *self)
        GsPluginJobPrivate *priv = gs_plugin_job_get_instance_private (self);
 
        priv->refine_flags = GS_PLUGIN_REFINE_FLAGS_NONE;
-       priv->filter_flags = GS_PLUGIN_REFINE_FLAGS_NONE;
        priv->dedupe_flags = GS_APP_LIST_FILTER_FLAG_KEY_ID |
                             GS_APP_LIST_FILTER_FLAG_KEY_SOURCE |
                             GS_APP_LIST_FILTER_FLAG_KEY_VERSION;
diff --git a/lib/gs-plugin-job.h b/lib/gs-plugin-job.h
index d512eeb0b..376e6c5e9 100644
--- a/lib/gs-plugin-job.h
+++ b/lib/gs-plugin-job.h
@@ -38,8 +38,6 @@ struct _GsPluginJobClass
 
 void            gs_plugin_job_set_refine_flags         (GsPluginJob    *self,
                                                         GsPluginRefineFlags refine_flags);
-void            gs_plugin_job_set_filter_flags         (GsPluginJob    *self,
-                                                        GsPluginRefineFlags filter_flags);
 void            gs_plugin_job_set_dedupe_flags         (GsPluginJob    *self,
                                                         GsAppListFilterFlags dedupe_flags);
 void            gs_plugin_job_set_interactive          (GsPluginJob    *self,
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 8120ed78c..c14006a15 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -3092,10 +3092,7 @@ gs_plugin_loader_process_thread_cb (GTask *task,
        g_autoptr(GsAppList) list = g_object_ref (gs_plugin_job_get_list (helper->plugin_job));
        GsPluginAction action = gs_plugin_job_get_action (helper->plugin_job);
        GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (object);
-       GsPluginRefineFlags filter_flags;
        gboolean add_to_pending_array = FALSE;
-       guint max_results;
-       GsAppListSortFunc sort_func;
        g_autoptr(GMainContext) context = g_main_context_new ();
        g_autoptr(GMainContextPusher) pusher = g_main_context_pusher_new (context);
        g_autofree gchar *job_debug = NULL;
@@ -3224,40 +3221,6 @@ gs_plugin_loader_process_thread_cb (GTask *task,
                }
        }
 
-       /* refine with enough data so that the sort_func in
-        * gs_plugin_loader_job_sorted_truncation() can do what it needs */
-       filter_flags = gs_plugin_job_get_filter_flags (helper->plugin_job);
-       max_results = gs_plugin_job_get_max_results (helper->plugin_job);
-       sort_func = gs_plugin_job_get_sort_func (helper->plugin_job, NULL);
-       if (filter_flags > 0 && max_results > 0 && sort_func != NULL) {
-               g_autoptr(GsPluginJob) refine_job = NULL;
-               g_autoptr(GAsyncResult) refine_result = NULL;
-               g_autoptr(GsAppList) new_list = NULL;
-
-               g_debug ("running filter flags with early refine");
-
-               refine_job = gs_plugin_job_refine_new (list, filter_flags | 
GS_PLUGIN_REFINE_FLAGS_DISABLE_FILTERING);
-               gs_plugin_loader_job_process_async (plugin_loader, refine_job,
-                                                   cancellable,
-                                                   async_result_cb,
-                                                   &refine_result);
-
-               /* FIXME: Make this sync until the enclosing function is
-                * refactored to be async. */
-               while (refine_result == NULL)
-                       g_main_context_iteration (g_main_context_get_thread_default (), TRUE);
-
-               new_list = gs_plugin_loader_job_process_finish (plugin_loader, refine_result, &error);
-               if (new_list == NULL) {
-                       gs_utils_error_convert_gio (&error);
-                       g_task_return_error (task, g_steal_pointer (&error));
-                       return;
-               }
-
-               /* Update the app list in case the refine resolved any wildcards. */
-               g_set_object (&list, new_list);
-       }
-
        /* filter to reduce to a sane set */
        gs_plugin_loader_job_sorted_truncation (helper);
 


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