[gnome-software: 6/9] gs-repo-row: Drop unneeded GsPluginLoader property




commit 312f18bc7c60eea232d7a1a9dbc7c28db3862ad0
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Nov 23 16:28:43 2021 +0000

    gs-repo-row: Drop unneeded GsPluginLoader property
    
    Same for `GsReposSection`. The pointer to the `GsPluginLoader` is no
    longer needed as of the previous commit.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 src/gs-repo-row.c      | 11 +----------
 src/gs-repo-row.h      |  3 +--
 src/gs-repos-dialog.c  |  4 ++--
 src/gs-repos-section.c | 15 ++++-----------
 src/gs-repos-section.h |  3 +--
 5 files changed, 9 insertions(+), 27 deletions(-)
---
diff --git a/src/gs-repo-row.c b/src/gs-repo-row.c
index 9efa6f12e..9f871eb04 100644
--- a/src/gs-repo-row.c
+++ b/src/gs-repo-row.c
@@ -15,7 +15,6 @@
 
 typedef struct
 {
-       GsPluginLoader  *plugin_loader; /* owned */
        GsApp           *repo;
        GtkWidget       *name_label;
        GtkWidget       *hostname_label;
@@ -292,8 +291,6 @@ gs_repo_row_dispose (GObject *object)
                priv->refresh_idle_id = 0;
        }
 
-       g_clear_object (&priv->plugin_loader);
-
        G_OBJECT_CLASS (gs_repo_row_parent_class)->dispose (object);
 }
 
@@ -345,13 +342,9 @@ gs_repo_row_class_init (GsRepoRowClass *klass)
 
 /*
  * gs_repo_row_new:
- * @plugin_loader: a #GsPluginLoader
  * @repo: a #GsApp to represent the repo in the new row
  * @always_allow_enable_disable: always allow enabled/disable of the @repo
  *
- * The @plugin_loader is used to check which operations the associated plugin
- * for the @repo can do and which not, to show only relevant buttons on the row.
- *
  * The @always_allow_enable_disable, when %TRUE, means that the @repo in this row
  * can be always enabled/disabled by the user, if supported by the related plugin,
  * regardless of the other heuristics, which can avoid the repo enable/disable.
@@ -359,13 +352,11 @@ gs_repo_row_class_init (GsRepoRowClass *klass)
  * Returns: (transfer full): a newly created #GsRepoRow
  */
 GtkWidget *
-gs_repo_row_new (GsPluginLoader        *plugin_loader,
-                GsApp *repo,
+gs_repo_row_new (GsApp *repo,
                 gboolean always_allow_enable_disable)
 {
        GsRepoRow *row = g_object_new (GS_TYPE_REPO_ROW, NULL);
        GsRepoRowPrivate *priv = gs_repo_row_get_instance_private (row);
-       priv->plugin_loader = g_object_ref (plugin_loader);
        priv->always_allow_enable_disable = always_allow_enable_disable;
        gs_repo_row_set_repo (row, repo);
        return GTK_WIDGET (row);
diff --git a/src/gs-repo-row.h b/src/gs-repo-row.h
index 83c8cdf48..0cbbdc657 100644
--- a/src/gs-repo-row.h
+++ b/src/gs-repo-row.h
@@ -24,8 +24,7 @@ struct _GsRepoRowClass
        void                    (*switch_clicked)       (GsRepoRow      *row);
 };
 
-GtkWidget      *gs_repo_row_new                        (GsPluginLoader *plugin_loader,
-                                                        GsApp          *repo,
+GtkWidget      *gs_repo_row_new                        (GsApp          *repo,
                                                         gboolean        always_allow_enable_disable);
 GsApp          *gs_repo_row_get_repo                   (GsRepoRow      *row);
 void            gs_repo_row_mark_busy                  (GsRepoRow      *row);
diff --git a/src/gs-repos-dialog.c b/src/gs-repos-dialog.c
index ed956163f..56869c68c 100644
--- a/src/gs-repos-dialog.c
+++ b/src/gs-repos-dialog.c
@@ -383,7 +383,7 @@ add_repo (GsReposDialog *dialog,
 
        section = g_hash_table_lookup (dialog->sections, origin_ui);
        if (section == NULL) {
-               section = gs_repos_section_new (dialog->plugin_loader, FALSE);
+               section = gs_repos_section_new (FALSE);
                adw_preferences_group_set_title (ADW_PREFERENCES_GROUP (section),
                                                 origin_ui);
                g_signal_connect_object (section, "remove-clicked",
@@ -538,7 +538,7 @@ get_sources_cb (GsPluginLoader *plugin_loader,
                section_id = g_strdup_printf ("fedora-third-party::1::%p", widget);
                g_hash_table_insert (dialog->sections, g_steal_pointer (&section_id), widget);
 
-               section = GS_REPOS_SECTION (gs_repos_section_new (dialog->plugin_loader, TRUE));
+               section = GS_REPOS_SECTION (gs_repos_section_new (TRUE));
                gs_repos_section_set_sort_key (section, "900");
                g_signal_connect_object (section, "switch-clicked",
                                         G_CALLBACK (repo_section_switch_clicked_cb), dialog, 0);
diff --git a/src/gs-repos-section.c b/src/gs-repos-section.c
index 4519026c5..611e76384 100644
--- a/src/gs-repos-section.c
+++ b/src/gs-repos-section.c
@@ -18,7 +18,6 @@ struct _GsReposSection
        AdwPreferencesGroup      parent_instance;
        GtkWidget               *title;
        GtkListBox              *list;
-       GsPluginLoader          *plugin_loader;
        gchar                   *sort_key;
        gboolean                 always_allow_enable_disable;
 };
@@ -82,7 +81,6 @@ gs_repos_section_finalize (GObject *object)
 {
        GsReposSection *self = GS_REPOS_SECTION (object);
 
-       g_clear_object (&self->plugin_loader);
        g_free (self->sort_key);
 
        G_OBJECT_CLASS (gs_repos_section_parent_class)->finalize (object);
@@ -133,11 +131,10 @@ gs_repos_section_init (GsReposSection *self)
 
 /*
  * gs_repos_section_new:
- * @plugin_loader: a #GsPluginLoader
  * @always_allow_enable_disable: always allow enable/disable of the repos in this section
  *
- * Creates a new #GsReposSection. The %plugin_loader is passed
- * to each #GsRepoRow, the same as the @always_allow_enable_disable.
+ * Creates a new #GsReposSection. @always_allow_enable_disable is passed to each
+ * #GsRepoRow.
  *
  * The @always_allow_enable_disable, when %TRUE, means that every repo in this section
  * can be enabled/disabled by the user, if supported by the related plugin, regardless
@@ -146,16 +143,12 @@ gs_repos_section_init (GsReposSection *self)
  * Returns: (transfer full): a newly created #GsReposSection
  */
 GtkWidget *
-gs_repos_section_new (GsPluginLoader *plugin_loader,
-                     gboolean always_allow_enable_disable)
+gs_repos_section_new (gboolean always_allow_enable_disable)
 {
        GsReposSection *self;
 
-       g_return_val_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader), NULL);
-
        self = g_object_new (GS_TYPE_REPOS_SECTION, NULL);
 
-       self->plugin_loader = g_object_ref (plugin_loader);
        self->always_allow_enable_disable = always_allow_enable_disable;
 
        return GTK_WIDGET (self);
@@ -176,7 +169,7 @@ gs_repos_section_add_repo (GsReposSection *self,
        if (!self->sort_key)
                self->sort_key = g_strdup (gs_app_get_metadata_item (repo, "GnomeSoftware::SortKey"));
 
-       row = gs_repo_row_new (self->plugin_loader, repo, self->always_allow_enable_disable);
+       row = gs_repo_row_new (repo, self->always_allow_enable_disable);
 
        g_signal_connect (row, "remove-clicked",
                          G_CALLBACK (repo_remove_clicked_cb), self);
diff --git a/src/gs-repos-section.h b/src/gs-repos-section.h
index 9f373f94c..e26189fae 100644
--- a/src/gs-repos-section.h
+++ b/src/gs-repos-section.h
@@ -20,8 +20,7 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (GsReposSection, gs_repos_section, GS, REPOS_SECTION, AdwPreferencesGroup)
 
-GtkWidget      *gs_repos_section_new                   (GsPluginLoader         *plugin_loader,
-                                                        gboolean                always_allow_enable_disable);
+GtkWidget      *gs_repos_section_new                   (gboolean                always_allow_enable_disable);
 void            gs_repos_section_add_repo              (GsReposSection         *self,
                                                         GsApp                  *repo);
 const gchar    *gs_repos_section_get_title             (GsReposSection         *self);


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