diff --git a/gtk/deprecated/gtkshow.c b/gtk/deprecated/gtkshow.c index 6a160c7ee3..cfed84ced4 100644 --- a/gtk/deprecated/gtkshow.c +++ b/gtk/deprecated/gtkshow.c @@ -27,8 +27,13 @@ #include "gtkalertdialog.h" #include +#ifdef G_OS_WIN32 +#include "gtkshowwin32.h" +#endif + G_GNUC_BEGIN_IGNORE_DEPRECATIONS +#ifndef G_OS_WIN32 typedef struct { GtkWindow *parent; char *handle; @@ -86,6 +91,24 @@ window_handle_exported (GtkWindow *window, data); } +#else /* G_OS_WIN32 */ +static void +show_win32_done (GObject *source, + GAsyncResult *result, + gpointer user_data) +{ + GTask *task = user_data; + GError *error = NULL; + + if (gtk_show_uri_win32_finish (GTK_WINDOW (source), result, &error)) + g_task_return_boolean (task, TRUE); + else + g_task_return_error (task, error); + + g_object_unref (task); +} +#endif + /** * gtk_show_uri_full: * @parent: (nullable): parent window @@ -114,6 +137,7 @@ gtk_show_uri_full (GtkWindow *parent, GAsyncReadyCallback callback, gpointer user_data) { +#ifndef G_OS_WIN32 GtkShowUriData *data; GdkAppLaunchContext *context; GdkDisplay *display; @@ -138,6 +162,17 @@ gtk_show_uri_full (GtkWindow *parent, if (!parent || !gtk_window_export_handle (parent, window_handle_exported, data)) window_handle_exported (parent, NULL, data); + +#else /* G_OS_WIN32 */ + GTask *task; + + g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent)); + g_return_if_fail (uri != NULL); + + task = g_task_new (parent, cancellable, callback, user_data); + g_task_set_source_tag (task, gtk_show_uri_full); + gtk_show_uri_win32 (parent, uri, FALSE, cancellable, show_win32_done, task); +#endif } /** diff --git a/gtk/gtkfilelauncher.c b/gtk/gtkfilelauncher.c index 955eadf054..a36fff9d2a 100644 --- a/gtk/gtkfilelauncher.c +++ b/gtk/gtkfilelauncher.c @@ -26,6 +26,10 @@ #include "deprecated/gtkshow.h" #include +#ifdef G_OS_WIN32 +#include "gtkshowwin32.h" +#endif + /** * GtkFileLauncher: * @@ -432,7 +436,11 @@ show_uri_done (GObject *source, GTask *task = G_TASK (data); GError *error = NULL; +#ifndef G_OS_WIN32 if (!gtk_show_uri_full_finish (parent, result, &error)) +#else + if (!gtk_show_uri_win32_finish (parent, result, &error)) +#endif { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_CANCELLED, "Cancelled by user"); @@ -503,7 +511,6 @@ gtk_file_launcher_launch (GtkFileLauncher *self, gtk_openuri_portal_open_async (self->file, FALSE, flags, parent, cancellable, open_done, task); } else -#endif { char *uri = g_file_get_uri (self->file); @@ -513,6 +520,11 @@ G_GNUC_END_IGNORE_DEPRECATIONS g_free (uri); } +#else /* G_OS_WIN32 */ + char *path = g_file_get_path (self->file); + gtk_show_uri_win32 (parent, path, self->always_ask, cancellable, show_uri_done, task); + g_free (path); +#endif } /**