diff options
author | Jacki <jacki@thejackimonster.de> | 2024-02-15 01:19:04 +0100 |
---|---|---|
committer | Jacki <jacki@thejackimonster.de> | 2024-02-15 01:19:04 +0100 |
commit | 7b87c26b8fe8f2811d8cbfe706ee8c85189c5457 (patch) | |
tree | de1f5f61d243118acc2ad698a4f23c8ca2f2e809 /src/ui/settings.c | |
parent | b8cc56e6c0ba1a92d6951cc085d8b7d5593a4452 (diff) | |
download | messenger-gtk-7b87c26b8fe8f2811d8cbfe706ee8c85189c5457.tar.gz messenger-gtk-7b87c26b8fe8f2811d8cbfe706ee8c85189c5457.zip |
Adjust code to allow building without libportal
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat (limited to 'src/ui/settings.c')
-rw-r--r-- | src/ui/settings.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/src/ui/settings.c b/src/ui/settings.c index 6589778..7855902 100644 --- a/src/ui/settings.c +++ b/src/ui/settings.c | |||
@@ -29,7 +29,10 @@ | |||
29 | 29 | ||
30 | #include <gnunet/gnunet_chat_lib.h> | 30 | #include <gnunet/gnunet_chat_lib.h> |
31 | #include <gnunet/gnunet_common.h> | 31 | #include <gnunet/gnunet_common.h> |
32 | |||
33 | #ifndef MESSENGER_APPLICATION_NO_PORTAL | ||
32 | #include <libportal/background.h> | 34 | #include <libportal/background.h> |
35 | #endif | ||
33 | 36 | ||
34 | static gboolean | 37 | static gboolean |
35 | handle_general_switch_state(UNUSED GtkSwitch *widget, | 38 | handle_general_switch_state(UNUSED GtkSwitch *widget, |
@@ -44,31 +47,16 @@ handle_general_switch_state(UNUSED GtkSwitch *widget, | |||
44 | } | 47 | } |
45 | 48 | ||
46 | static void | 49 | static void |
47 | _request_background_callback(GObject *source_object, | 50 | _request_background_callback(MESSENGER_Application *app, |
48 | GAsyncResult *result, | 51 | gboolean success, |
52 | gboolean error, | ||
49 | gpointer user_data) | 53 | gpointer user_data) |
50 | { | 54 | { |
51 | g_assert((source_object) && (result) && (user_data)); | 55 | g_assert((app) && (user_data)); |
52 | |||
53 | XdpPortal *portal = XDP_PORTAL(source_object); | ||
54 | MESSENGER_Request *request = (MESSENGER_Request*) user_data; | ||
55 | 56 | ||
56 | request_cleanup(request); | 57 | GtkSwitch *widget = GTK_SWITCH(user_data); |
57 | |||
58 | MESSENGER_Application *app = request->application; | ||
59 | GtkSwitch *widget = GTK_SWITCH(request->user_data); | ||
60 | |||
61 | GError *error = NULL; | ||
62 | gboolean success = xdp_portal_request_background_finish( | ||
63 | portal, result, &error | ||
64 | ); | ||
65 | |||
66 | request_drop(request); | ||
67 | 58 | ||
68 | if (error) { | 59 | if (error) { |
69 | g_printerr("ERROR: %s\n", error->message); | ||
70 | g_error_free(error); | ||
71 | |||
72 | gtk_widget_set_sensitive(GTK_WIDGET(widget), !success); | 60 | gtk_widget_set_sensitive(GTK_WIDGET(widget), !success); |
73 | gtk_switch_set_active(widget, success); | 61 | gtk_switch_set_active(widget, success); |
74 | return; | 62 | return; |