Merge branch 'for-main' into 'main'

openuriportal: Avoid some extra warnings

See merge request GNOME/gtk!7937
This commit is contained in:
Matthias Clasen 2024-11-19 16:01:52 +00:00
commit 0dd9805f38
5 changed files with 22 additions and 16 deletions

View File

@ -27,6 +27,7 @@
#include "gdkcontentserializer.h"
#include "gdkcontentdeserializer.h"
#include "gdkdebugprivate.h"
#include "gdkprivate.h"
#include <gio/gio.h>
@ -600,16 +601,17 @@ file_transfer_portal_register (void)
{
called = TRUE;
file_transfer_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
| G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS
| G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
NULL,
"org.freedesktop.portal.Documents",
"/org/freedesktop/portal/documents",
"org.freedesktop.portal.FileTransfer",
NULL,
NULL);
if (gdk_should_use_portal ())
file_transfer_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES
| G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS
| G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
NULL,
"org.freedesktop.portal.Documents",
"/org/freedesktop/portal/documents",
"org.freedesktop.portal.FileTransfer",
NULL,
NULL);
if (file_transfer_proxy && !proxy_has_owner (file_transfer_proxy))
g_clear_object (&file_transfer_proxy);

View File

@ -24,6 +24,7 @@
#include "gtkdialogerror.h"
#include "gtkopenuriportal.h"
#include "deprecated/gtkshow.h"
#include "gdk/gdkprivate.h"
#include <glib/gi18n-lib.h>
#ifdef G_OS_WIN32
@ -498,7 +499,8 @@ gtk_file_launcher_launch (GtkFileLauncher *self,
}
#ifndef G_OS_WIN32
if (gtk_openuri_portal_is_available ())
if (gdk_should_use_portal () &&
gtk_openuri_portal_is_available ())
{
GtkOpenuriFlags flags = 0;

View File

@ -66,8 +66,7 @@ init_openuri_portal (void)
g_warning ("Cannot create OpenURI portal proxy: %s", error->message);
g_error_free (error);
}
if (gtk_xdp_open_uri_get_version (openuri) < 3)
else if (gtk_xdp_open_uri_get_version (openuri) < 3)
{
g_warning ("Not a supported version of the OpenURI portal: %u", gtk_xdp_open_uri_get_version (openuri));
g_clear_object (&openuri);

View File

@ -825,7 +825,7 @@ static gboolean
ensure_portal_proxy (GtkPrintDialog *self,
GError **error)
{
if (gdk_display_get_debug_flags (NULL) & GDK_DEBUG_NO_PORTALS)
if (!gdk_should_use_portal ())
return FALSE;
if (!self->portal)

View File

@ -24,6 +24,7 @@
#include "gtkdialogerror.h"
#include "gtkopenuriportal.h"
#include "deprecated/gtkshow.h"
#include "gdk/gdkprivate.h"
#include <glib/gi18n-lib.h>
/**
@ -307,8 +308,10 @@ gtk_uri_launcher_launch (GtkUriLauncher *self,
}
#ifndef G_OS_WIN32
if (gtk_openuri_portal_is_available ())
gtk_openuri_portal_open_uri_async (self->uri, parent, cancellable, open_done, task);
if (gdk_should_use_portal () && gtk_openuri_portal_is_available ())
{
gtk_openuri_portal_open_uri_async (self->uri, parent, cancellable, open_done, task);
}
else
#endif
{