#include "gtkorientable.h"
#include "gtkscrolledwindow.h"
#include "gtktextview.h"
-#include "gtkshow.h"
+#include "gtkfilelauncher.h"
#include "gtkmain.h"
#include "gtktogglebutton.h"
#include "gtktypebuiltins.h"
* 
*
* About dialogs often contain links and email addresses. `GtkAboutDialog`
- * displays these as clickable links. By default, it calls [func@Gtk.show_uri]
+ * displays these as clickable links. By default, it calls [method@Gtk.FileLauncher.launch]
* when a user clicks one. The behaviour can be overridden with the
* [signal@Gtk.AboutDialog::activate-link] signal.
*
* Emitted every time a URL is activated.
*
* Applications may connect to it to override the default behaviour,
- * which is to call [func@Gtk.show_uri].
+ * which is to call [method@Gtk.FileLauncher.launch].
*
* Returns: `TRUE` if the link has been activated
*/
gtk_about_dialog_activate_link (GtkAboutDialog *about,
const char *uri)
{
- gtk_show_uri (GTK_WINDOW (about), uri, GDK_CURRENT_TIME);
+ GtkFileLauncher *launcher;
+ GFile *file;
+
+ launcher = gtk_file_launcher_new ();
+ file = g_file_new_for_uri (uri);
+
+ gtk_file_launcher_launch (launcher, GTK_WINDOW (about), file, NULL, NULL, NULL);
+
+ g_object_unref (launcher);
+ g_object_unref (file);
+
return TRUE;
}
#include "gtkcheckbutton.h"
#include "gtkwindowgroup.h"
#include <glib/gi18n-lib.h>
-#include "gtkshow.h"
+#include "gtkfilelauncher.h"
#include "gtkmain.h"
#include "gtkscrollable.h"
#include "gtkpopover.h"
GtkWindow *toplevel = GTK_IS_WINDOW (root) ? GTK_WINDOW (root) : NULL;
GFileInfo *info;
GFile *file;
- char *uri;
+ GtkFileLauncher *launcher;
info = g_list_model_get_item (G_LIST_MODEL (impl->selection_model), impl->browse_files_popover_item);
file = _gtk_file_info_get_file (info);
-#ifdef G_OS_WIN32
-
- uri = g_file_get_uri (file);
- gtk_show_uri (toplevel, uri, GDK_CURRENT_TIME);
- g_free (uri);
-
-#else
-
- if (gdk_should_use_portal ())
- {
- g_openuri_portal_open_async (file, TRUE, toplevel, NULL, NULL, NULL);
- }
- else
- {
- GDBusConnection *bus;
- GVariantBuilder uris_builder;
- GVariant *result;
- GError *error = NULL;
-
- uri = g_file_get_uri (file);
-
- bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
-
- g_variant_builder_init (&uris_builder, G_VARIANT_TYPE ("as"));
- g_variant_builder_add (&uris_builder, "s", uri);
-
- result = g_dbus_connection_call_sync (bus,
- FILE_MANAGER_DBUS_NAME,
- FILE_MANAGER_DBUS_PATH,
- FILE_MANAGER_DBUS_IFACE,
- "ShowFolders",
- g_variant_new ("(ass)", &uris_builder, ""),
- NULL, /* ignore returned type */
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &error);
- if (error)
- {
- if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_NAME_HAS_NO_OWNER) ||
- g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN))
- g_debug ("No " FILE_MANAGER_DBUS_NAME " available");
- else
- g_warning ("Failed to call ShowFolders: %s", error->message);
-
- g_error_free (error);
- }
-
- if (result)
- g_variant_unref (result);
- else
- gtk_show_uri (toplevel, uri, GDK_CURRENT_TIME);
-
- g_free (uri);
- }
-
-#endif
+ launcher = gtk_file_launcher_new ();
+ gtk_file_launcher_open_containing_folder (launcher, toplevel, file, NULL, NULL, NULL);
+ g_object_unref (launcher);
g_clear_object (&info);
}
char *uri = g_file_get_uri (file);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gtk_show_uri_full (parent, uri, self->timestamp, cancellable, show_uri_done, task);
+ gtk_show_uri_full (parent, uri, GDK_CURRENT_TIME, cancellable, show_uri_done, task);
G_GNUC_END_IGNORE_DEPRECATIONS
g_free (uri);
#include "gtkshortcut.h"
#include "gtkshortcutcontroller.h"
#include "gtkshortcuttrigger.h"
-#include "gtkshow.h"
+#include "gtkfilelauncher.h"
#include "gtksnapshot.h"
#include "gtkrenderbackgroundprivate.h"
#include "gtkrenderborderprivate.h"
{
GtkWidget *widget = GTK_WIDGET (self);
GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
+ GFile *file;
+ GtkFileLauncher *launcher;
if (!GTK_IS_WINDOW (toplevel))
return FALSE;
- gtk_show_uri (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME);
+ file = g_file_new_for_uri (uri);
+ launcher = gtk_file_launcher_new ();
+ gtk_file_launcher_launch (launcher, GTK_WINDOW (toplevel), file, NULL, NULL, NULL);
+ g_object_unref (launcher);
+ g_object_unref (file);
return TRUE;
}
* Gets emitted to activate a URI.
*
* Applications may connect to it to override the default behaviour,
- * which is to call gtk_show_uri().
+ * which is to call [method@Gtk.FileLauncher.launch].
*
* Returns: %TRUE if the link has been activated
*/
* The URI bound to a `GtkLinkButton` can be set specifically using
* [method@Gtk.LinkButton.set_uri].
*
- * By default, `GtkLinkButton` calls [func@Gtk.show_uri] when the button
+ * By default, `GtkLinkButton` calls [method@Gtk.FileLauncher.launch] when the button
* is clicked. This behaviour can be overridden by connecting to the
* [signal@Gtk.LinkButton::activate-link] signal and returning %TRUE from
* the signal handler.
#include "gtkmarshalers.h"
#include "gtkpopovermenu.h"
#include "gtkprivate.h"
-#include "gtkshow.h"
+#include "gtkfilelauncher.h"
#include "gtksizerequest.h"
#include "gtktooltip.h"
#include "gtkwidgetprivate.h"
*
* Emitted each time the `GtkLinkButton` is clicked.
*
- * The default handler will call [func@Gtk.show_uri] with the URI
+ * The default handler will call [method@Gtk.FileLauncher.launch] with the URI
* stored inside the [property@Gtk.LinkButton:uri] property.
*
* To override the default behavior, you can connect to the
gtk_link_button_activate_link (GtkLinkButton *link_button)
{
GtkWidget *toplevel;
+ GFile *file;
+ GtkFileLauncher *launcher;
toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (link_button)));
- gtk_show_uri (GTK_WINDOW (toplevel), link_button->uri, GDK_CURRENT_TIME);
+ file = g_file_new_for_uri (link_button->uri);
+ launcher = gtk_file_launcher_new ();
+ gtk_file_launcher_launch (launcher, GTK_WINDOW (toplevel), file, NULL, NULL, NULL);
+ g_object_unref (launcher);
+ g_object_unref (file);
+
gtk_link_button_set_visited (link_button, TRUE);
return TRUE;
#include "gtkprintsettings.h"
#include "gtkpagesetup.h"
#include "gtkprintbackendprivate.h"
-#include "gtkshow.h"
+#include "gtkfilelauncher.h"
#include <glib/gi18n-lib.h>
#include "gtkwindowprivate.h"
#include "gtkprivate.h"
GtkWindow *parent,
const char *filename)
{
- char *uri;
-
- uri = g_filename_to_uri (filename, NULL, NULL);
- gtk_show_uri (parent, uri, GDK_CURRENT_TIME);
- g_free (uri);
+ GFile *file;
+ GtkFileLauncher *launcher;
+
+ file = g_file_new_for_path (filename);
+ launcher = gtk_file_launcher_new ();
+ gtk_file_launcher_launch (launcher, parent, file, NULL, NULL, NULL);
+ g_object_unref (launcher);
+ g_object_unref (file);
}
#include "gtkprinter.h"
#include "gtkprintjob.h"
#include "gtklabel.h"
+#include "gtkfilelauncher.h"
#include <glib/gi18n-lib.h>
if (error != NULL)
{
- char * uri;
+ GFile *file;
+ GtkFileLauncher *launcher;
g_warning ("Error launching preview: %s", error->message);
+ g_clear_error (&error);
- g_error_free (error);
- error = NULL;
- uri = g_filename_to_uri (filename, NULL, NULL);
- gtk_show_uri (parent, uri, GDK_CURRENT_TIME);
- g_free (uri);
+ file = g_file_new_for_path (filename);
+ launcher = gtk_file_launcher_new ();
+ gtk_file_launcher_launch (launcher, parent, file, NULL, NULL, NULL);
+ g_object_unref (launcher);
+ g_object_unref (file);
}
out: