From 591a9487040c7786f03fa9053e3f58270af6ecde Mon Sep 17 00:00:00 2001
From: oreo639 <oreo6391@gmail.com>
Date: Sun, 21 Sep 2025 21:17:31 -0700
Subject: [PATCH] Fix requiring Liferea with girepository-2.0

Remove erroneous gi.require_version() from certain plugins, which should already
be loaded by gi_repository_require_private().

Use gi_repository_dup_default() instead of just calling gi_repository_new() and
throwing it away immediately after. This ensures the plugins get the typelib
already loaded when pygobject calls Repository.get_default().
---
 plugins/download-manager.py  | 1 -
 plugins/gnome-keyring.py     | 1 -
 src/plugins/plugins_engine.c | 3 +--
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/plugins/download-manager.py b/plugins/download-manager.py
index ea573d29b..e51591c36 100644
--- a/plugins/download-manager.py
+++ b/plugins/download-manager.py
@@ -24,7 +24,6 @@
 import time
 
 gi.require_version('Gtk', '3.0')
-gi.require_version('Liferea', '3.0')
 
 from gi.repository import GObject, GLib, Gtk, Gio, Liferea, Pango
 from urllib.parse import urlparse
diff --git a/plugins/gnome-keyring.py b/plugins/gnome-keyring.py
index 754fdaa47..fdd3484f5 100644
--- a/plugins/gnome-keyring.py
+++ b/plugins/gnome-keyring.py
@@ -19,7 +19,6 @@
 """
 
 import gi
-gi.require_version('Liferea', '3.0')
 gi.require_version('Secret', '1')
 from gi.repository import GObject, Liferea, Secret
 
diff --git a/src/plugins/plugins_engine.c b/src/plugins/plugins_engine.c
index b7a544d0b..dedd6d526 100644
--- a/src/plugins/plugins_engine.c
+++ b/src/plugins/plugins_engine.c
@@ -112,8 +112,7 @@ liferea_plugins_engine_init (LifereaPluginsEngine *plugins)
 		error = NULL;
 	}
 #else
-	g_autoptr(GIRepository) repo = gi_repository_new ();
-	if (!gi_repository_require_private (repo,
+	if (!gi_repository_require_private (gi_repository_dup_default (),
 		typelib_dir, "Liferea", "3.0", 0, &error)) {
 		g_warning ("Could not load Liferea repository: %s", error->message);
 		g_error_free (error);

