diff --git a/gtk/gopenuriportal.h b/gtk/gopenuriportal.h deleted file mode 100644 index 047a9f3896..0000000000 --- a/gtk/gopenuriportal.h +++ /dev/null @@ -1,52 +0,0 @@ -/* GIO - GLib Input, Output and Streaming Library - * - * Copyright 2017 Red Hat, Inc. - * - * SPDX-License-Identifier: LGPL-2.1-or-later - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef __G_OPEN_URI_PORTAL_H__ - -#include "gtkwindow.h" -#include -#include - -G_BEGIN_DECLS - -gboolean g_openuri_portal_is_available (void); - -void g_openuri_portal_open_async (GFile *file, - gboolean open_folder, - GtkWindow *window, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean g_openuri_portal_open_finish (GAsyncResult *result, - GError **error); - -void g_openuri_portal_open_uri_async (const char *uri, - GtkWindow *window, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean g_openuri_portal_open_uri_finish (GAsyncResult *result, - GError **error); - -G_END_DECLS - -#endif diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index b6382ccdba..775c40554f 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -96,7 +96,7 @@ #include "gtkexpression.h" #ifndef G_OS_WIN32 -#include "gopenuriportal.h" +#include "gtkopenuriportal.h" #endif #include diff --git a/gtk/gtkfilelauncher.c b/gtk/gtkfilelauncher.c index 6e4f840876..a4c7fc5379 100644 --- a/gtk/gtkfilelauncher.c +++ b/gtk/gtkfilelauncher.c @@ -22,7 +22,7 @@ #include "gtkfilelauncher.h" #include "gtkdialogerror.h" -#include "gopenuriportal.h" +#include "gtkopenuriportal.h" #include "deprecated/gtkshow.h" #include @@ -219,7 +219,7 @@ open_done (GObject *source, GTask *task = G_TASK (data); GError *error = NULL; - if (!g_openuri_portal_open_finish (result, &error)) + if (!gtk_openuri_portal_open_finish (result, &error)) g_task_return_error (task, error); else g_task_return_boolean (task, TRUE); @@ -367,9 +367,9 @@ gtk_file_launcher_launch (GtkFileLauncher *self, } #ifndef G_OS_WIN32 - if (g_openuri_portal_is_available ()) + if (gtk_openuri_portal_is_available ()) { - g_openuri_portal_open_async (self->file, FALSE, parent, cancellable, open_done, task); + gtk_openuri_portal_open_async (self->file, FALSE, parent, cancellable, open_done, task); } else #endif @@ -461,9 +461,9 @@ gtk_file_launcher_open_containing_folder (GtkFileLauncher *self, } #ifndef G_OS_WIN32 - if (g_openuri_portal_is_available ()) + if (gtk_openuri_portal_is_available ()) { - g_openuri_portal_open_async (self->file, TRUE, parent, cancellable, open_done, task); + gtk_openuri_portal_open_async (self->file, TRUE, parent, cancellable, open_done, task); } else #endif diff --git a/gtk/gopenuriportal.c b/gtk/gtkopenuriportal.c similarity index 87% rename from gtk/gopenuriportal.c rename to gtk/gtkopenuriportal.c index bc3211eb3d..10001cacf4 100644 --- a/gtk/gopenuriportal.c +++ b/gtk/gtkopenuriportal.c @@ -26,7 +26,7 @@ #include #include -#include "gopenuriportal.h" +#include "gtkopenuriportal.h" #include "xdp-dbus.h" #include "gtkwindowprivate.h" #include "gtkprivate.h" @@ -43,7 +43,7 @@ #endif -static GXdpOpenURI *openuri; +static GtkXdpOpenURI *openuri; static gboolean init_openuri_portal (void) @@ -57,10 +57,10 @@ init_openuri_portal (void) if (connection != NULL) { - openuri = gxdp_open_uri_proxy_new_sync (connection, 0, - PORTAL_BUS_NAME, - PORTAL_OBJECT_PATH, - NULL, &error); + openuri = gtk_xdp_open_uri_proxy_new_sync (connection, 0, + PORTAL_BUS_NAME, + PORTAL_OBJECT_PATH, + NULL, &error); if (openuri == NULL) { g_warning ("Cannot create OpenURI portal proxy: %s", error->message); @@ -83,7 +83,7 @@ init_openuri_portal (void) } gboolean -g_openuri_portal_is_available (void) +gtk_openuri_portal_is_available (void) { return init_openuri_portal (); } @@ -169,7 +169,7 @@ open_call_done (GObject *source, GAsyncResult *result, gpointer user_data) { - GXdpOpenURI *portal = GXDP_OPEN_URI (source); + GtkXdpOpenURI *portal = GTK_XDP_OPEN_URI (source); GTask *task = user_data; OpenUriData *data = g_task_get_task_data (task); GError *error = NULL; @@ -179,13 +179,13 @@ open_call_done (GObject *source, switch (data->call) { case OPEN_FILE: - res = gxdp_open_uri_call_open_file_finish (portal, &path, NULL, result, &error); + res = gtk_xdp_open_uri_call_open_file_finish (portal, &path, NULL, result, &error); break; case OPEN_FOLDER: - res = gxdp_open_uri_call_open_directory_finish (portal, &path, NULL, result, &error); + res = gtk_xdp_open_uri_call_open_directory_finish (portal, &path, NULL, result, &error); break; case OPEN_URI: - res = gxdp_open_uri_call_open_uri_finish (portal, &path, result, &error); + res = gtk_xdp_open_uri_call_open_uri_finish (portal, &path, result, &error); break; default: g_assert_not_reached (); @@ -341,7 +341,7 @@ open_uri (OpenUriData *data, if (open_folder) { data->call = OPEN_FOLDER; - gxdp_open_uri_call_open_directory (openuri, + gtk_xdp_open_uri_call_open_directory (openuri, parent_window ? parent_window : "", g_variant_new ("h", fd_id), opts, @@ -353,7 +353,7 @@ open_uri (OpenUriData *data, else { data->call = OPEN_FILE; - gxdp_open_uri_call_open_file (openuri, + gtk_xdp_open_uri_call_open_file (openuri, parent_window ? parent_window : "", g_variant_new ("h", fd_id), opts, @@ -373,7 +373,7 @@ open_uri (OpenUriData *data, uri = g_file_get_uri (file); data->call = OPEN_URI; - gxdp_open_uri_call_open_uri (openuri, + gtk_xdp_open_uri_call_open_uri (openuri, parent_window ? parent_window : "", uri ? uri : data->uri, opts, @@ -441,12 +441,12 @@ window_handle_exported (GtkWindow *window, } void -g_openuri_portal_open_async (GFile *file, - gboolean open_folder, - GtkWindow *parent, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +gtk_openuri_portal_open_async (GFile *file, + gboolean open_folder, + GtkWindow *parent, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { OpenUriData *data; @@ -465,27 +465,27 @@ g_openuri_portal_open_async (GFile *file, data->cancellable = cancellable ? g_object_ref (cancellable) : NULL; data->task = g_task_new (parent, cancellable, callback, user_data); g_task_set_check_cancellable (data->task, FALSE); - g_task_set_source_tag (data->task, g_openuri_portal_open_async); + g_task_set_source_tag (data->task, gtk_openuri_portal_open_async); if (!parent || !gtk_window_export_handle (parent, window_handle_exported, data)) window_handle_exported (parent, NULL, data); } gboolean -g_openuri_portal_open_finish (GAsyncResult *result, - GError **error) +gtk_openuri_portal_open_finish (GAsyncResult *result, + GError **error) { - g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == g_openuri_portal_open_async, FALSE); + g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_openuri_portal_open_async, FALSE); return g_task_propagate_boolean (G_TASK (result), error); } void -g_openuri_portal_open_uri_async (const char *uri, - GtkWindow *parent, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) +gtk_openuri_portal_open_uri_async (const char *uri, + GtkWindow *parent, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { OpenUriData *data; @@ -503,17 +503,17 @@ g_openuri_portal_open_uri_async (const char *uri, data->cancellable = cancellable ? g_object_ref (cancellable) : NULL; data->task = g_task_new (parent, cancellable, callback, user_data); g_task_set_check_cancellable (data->task, FALSE); - g_task_set_source_tag (data->task, g_openuri_portal_open_uri_async); + g_task_set_source_tag (data->task, gtk_openuri_portal_open_uri_async); if (!parent || !gtk_window_export_handle (parent, window_handle_exported, data)) window_handle_exported (parent, NULL, data); } gboolean -g_openuri_portal_open_uri_finish (GAsyncResult *result, - GError **error) +gtk_openuri_portal_open_uri_finish (GAsyncResult *result, + GError **error) { - g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == g_openuri_portal_open_uri_async, FALSE); + g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_openuri_portal_open_uri_async, FALSE); return g_task_propagate_boolean (G_TASK (result), error); } diff --git a/gtk/gtkopenuriportal.h b/gtk/gtkopenuriportal.h new file mode 100644 index 0000000000..9d7d0fca37 --- /dev/null +++ b/gtk/gtkopenuriportal.h @@ -0,0 +1,52 @@ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright 2017 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_OPEN_URI_PORTAL_H__ + +#include "gtkwindow.h" +#include +#include + +G_BEGIN_DECLS + +gboolean gtk_openuri_portal_is_available (void); + +void gtk_openuri_portal_open_async (GFile *file, + gboolean open_folder, + GtkWindow *window, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean gtk_openuri_portal_open_finish (GAsyncResult *result, + GError **error); + +void gtk_openuri_portal_open_uri_async (const char *uri, + GtkWindow *window, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean gtk_openuri_portal_open_uri_finish (GAsyncResult *result, + GError **error); + +G_END_DECLS + +#endif diff --git a/gtk/gtkurilauncher.c b/gtk/gtkurilauncher.c index cf705651ea..bf6e2e260b 100644 --- a/gtk/gtkurilauncher.c +++ b/gtk/gtkurilauncher.c @@ -22,7 +22,7 @@ #include "gtkurilauncher.h" #include "gtkdialogerror.h" -#include "gopenuriportal.h" +#include "gtkopenuriportal.h" #include "deprecated/gtkshow.h" #include @@ -221,7 +221,7 @@ open_done (GObject *source, GTask *task = G_TASK (data); GError *error = NULL; - if (!g_openuri_portal_open_uri_finish (result, &error)) + if (!gtk_openuri_portal_open_uri_finish (result, &error)) g_task_return_error (task, error); else g_task_return_boolean (task, TRUE); @@ -300,8 +300,8 @@ gtk_uri_launcher_launch (GtkUriLauncher *self, } #ifndef G_OS_WIN32 - if (g_openuri_portal_is_available ()) - g_openuri_portal_open_uri_async (self->uri, parent, cancellable, open_done, task); + if (gtk_openuri_portal_is_available ()) + gtk_openuri_portal_open_uri_async (self->uri, parent, cancellable, open_done, task); else #endif G_GNUC_BEGIN_IGNORE_DEPRECATIONS diff --git a/gtk/meson.build b/gtk/meson.build index 22fe7fb816..82ad8eff7a 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -758,7 +758,7 @@ if not (x11_enabled or win32_enabled) endif if not os_win32 - gtk_sources += ['gopenuriportal.c', ] + gtk_sources += ['gtkopenuriportal.c', ] endif gen_gtk_gresources_xml = find_program('gen-gtk-gresources-xml.py') @@ -991,7 +991,7 @@ else xdp_dbus_generated = gnome.gdbus_codegen('xdp-dbus', sources : 'org.freedesktop.portal.OpenURI.xml', interface_prefix : 'org.freedesktop.portal.', - namespace : 'GXdp', + namespace : 'GtkXdp', ) endif