Merge branch 'matthiasc/for-main' into 'main'

Use GtkUriLauncher where appropriate

See merge request GNOME/gtk!5432
This commit is contained in:
Matthias Clasen 2023-01-15 18:48:22 +00:00
commit fc24f401b7
3 changed files with 12 additions and 21 deletions

View File

@ -44,13 +44,13 @@
#include "gtkorientable.h"
#include "gtkscrolledwindow.h"
#include "gtktextview.h"
#include "gtkfilelauncher.h"
#include "gtkmain.h"
#include "gtktogglebutton.h"
#include "gtktypebuiltins.h"
#include "gtkstack.h"
#include "gtkstackswitcher.h"
#include "gtksettings.h"
#include "gtkurilauncher.h"
#include "gtkheaderbar.h"
#include "gtkprivate.h"
#include <glib/gi18n-lib.h>
@ -932,16 +932,13 @@ static gboolean
gtk_about_dialog_activate_link (GtkAboutDialog *about,
const char *uri)
{
GtkFileLauncher *launcher;
GFile *file;
GtkUriLauncher *launcher;
file = g_file_new_for_uri (uri);
launcher = gtk_file_launcher_new (file);
launcher = gtk_uri_launcher_new (uri);
gtk_file_launcher_launch (launcher, GTK_WINDOW (about), NULL, NULL, NULL);
gtk_uri_launcher_launch (launcher, GTK_WINDOW (about), NULL, NULL, NULL);
g_object_unref (launcher);
g_object_unref (file);
return TRUE;
}

View File

@ -40,7 +40,6 @@
#include "gtkshortcut.h"
#include "gtkshortcutcontroller.h"
#include "gtkshortcuttrigger.h"
#include "gtkfilelauncher.h"
#include "gtksnapshot.h"
#include "gtkrenderbackgroundprivate.h"
#include "gtkrenderborderprivate.h"
@ -48,6 +47,7 @@
#include "gtktextutilprivate.h"
#include "gtktooltip.h"
#include "gtktypebuiltins.h"
#include "gtkurilauncher.h"
#include "gtkwidgetprivate.h"
#include "gtkpopovermenu.h"
#include "gtknative.h"
@ -2102,17 +2102,14 @@ gtk_label_activate_link (GtkLabel *self,
{
GtkWidget *widget = GTK_WIDGET (self);
GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
GFile *file;
GtkFileLauncher *launcher;
GtkUriLauncher *launcher;
if (!GTK_IS_WINDOW (toplevel))
return FALSE;
file = g_file_new_for_uri (uri);
launcher = gtk_file_launcher_new (file);
gtk_file_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL);
launcher = gtk_uri_launcher_new (uri);
gtk_uri_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL);
g_object_unref (launcher);
g_object_unref (file);
return TRUE;
}

View File

@ -65,9 +65,9 @@
#include "gtkmarshalers.h"
#include "gtkpopovermenu.h"
#include "gtkprivate.h"
#include "gtkfilelauncher.h"
#include "gtksizerequest.h"
#include "gtktooltip.h"
#include "gtkurilauncher.h"
#include "gtkwidgetprivate.h"
#include <string.h>
@ -479,16 +479,13 @@ static gboolean
gtk_link_button_activate_link (GtkLinkButton *link_button)
{
GtkWidget *toplevel;
GFile *file;
GtkFileLauncher *launcher;
GtkUriLauncher *launcher;
toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (link_button)));
file = g_file_new_for_uri (link_button->uri);
launcher = gtk_file_launcher_new (file);
gtk_file_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL);
launcher = gtk_uri_launcher_new (link_button->uri);
gtk_uri_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL);
g_object_unref (launcher);
g_object_unref (file);
gtk_link_button_set_visited (link_button, TRUE);