[gnome-software: 13/21] malcontent: Stop connecting to D-Bus manually
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 13/21] malcontent: Stop connecting to D-Bus manually
- Date: Wed, 27 Apr 2022 10:41:23 +0000 (UTC)
commit 406e93711f94cd14d1ddeab639d4289c2aff7827
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed Mar 30 16:01:37 2022 +0100
malcontent: Stop connecting to D-Bus manually
Instead use the D-Bus connection provided by `GsPlugin`.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1694
plugins/malcontent/gs-plugin-malcontent.c | 27 ++-------------------------
1 file changed, 2 insertions(+), 25 deletions(-)
---
diff --git a/plugins/malcontent/gs-plugin-malcontent.c b/plugins/malcontent/gs-plugin-malcontent.c
index 56e945553..d8825a9f4 100644
--- a/plugins/malcontent/gs-plugin-malcontent.c
+++ b/plugins/malcontent/gs-plugin-malcontent.c
@@ -15,6 +15,7 @@
#include <math.h>
#include "gs-plugin-malcontent.h"
+#include "gs-plugin-private.h"
/*
* SECTION:
@@ -280,9 +281,6 @@ gs_plugin_malcontent_init (GsPluginMalcontent *self)
gs_plugin_set_appstream_id (plugin, "org.gnome.Software.Plugin.Malcontent");
}
-static void get_bus_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data);
static void get_app_filter_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data);
@@ -299,28 +297,7 @@ gs_plugin_malcontent_setup_async (GsPlugin *plugin,
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_source_tag (task, gs_plugin_malcontent_setup_async);
- g_bus_get (G_BUS_TYPE_SYSTEM, cancellable, get_bus_cb, g_steal_pointer (&task));
-}
-
-static void
-get_bus_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
-{
- g_autoptr(GTask) task = g_steal_pointer (&user_data);
- GsPluginMalcontent *self = g_task_get_source_object (task);
- GCancellable *cancellable = g_task_get_cancellable (task);
- g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&self->mutex);
- g_autoptr(GDBusConnection) system_bus = NULL;
- g_autoptr(GError) local_error = NULL;
-
- system_bus = g_bus_get_finish (result, &local_error);
- if (system_bus == NULL) {
- g_task_return_error (task, g_steal_pointer (&local_error));
- return;
- }
-
- self->manager = mct_manager_new (system_bus);
+ self->manager = mct_manager_new (gs_plugin_get_system_bus_connection (plugin));
self->manager_app_filter_changed_id = g_signal_connect (self->manager,
"app-filter-changed",
(GCallback) app_filter_changed_cb,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]