summaryrefslogtreecommitdiff
path: root/demos/gtk-demo/links.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-10-28 11:38:57 -0400
committerMatthias Clasen <mclasen@redhat.com>2022-10-29 13:31:41 -0400
commit756888a53d74762e4dbdeab20ba2786b5fc60f6c (patch)
treefdc9021e4bc7a057f7deaf4d8788066173e791fb /demos/gtk-demo/links.c
parent99e1643cdd6c317a3324498bf2008e86e9c593af (diff)
downloadgtk+-756888a53d74762e4dbdeab20ba2786b5fc60f6c.tar.gz
gtk-demo: Port to async dialog API
Diffstat (limited to 'demos/gtk-demo/links.c')
-rw-r--r--demos/gtk-demo/links.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/demos/gtk-demo/links.c b/demos/gtk-demo/links.c
index 63ac1d0c7f..7efcb125d6 100644
--- a/demos/gtk-demo/links.c
+++ b/demos/gtk-demo/links.c
@@ -7,38 +7,22 @@
#include <gtk/gtk.h>
-static void
-response_cb (GtkWidget *dialog,
- int response_id,
- gpointer data)
-{
- gtk_window_destroy (GTK_WINDOW (dialog));
-}
-
static gboolean
-activate_link (GtkWidget *label,
+activate_link (GtkWidget *label,
const char *uri,
- gpointer data)
+ gpointer data)
{
if (g_strcmp0 (uri, "keynav") == 0)
{
- GtkWidget *dialog;
- GtkWidget *parent;
-
- parent = GTK_WIDGET (gtk_widget_get_root (label));
- dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_INFO,
- GTK_BUTTONS_OK,
- "Keyboard navigation");
- gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
- "The term <i>keynav</i> is a shorthand for "
- "keyboard navigation and refers to the process of using "
- "a program (exclusively) via keyboard input.");
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ GtkAlertDialog *dialog;
- gtk_window_present (GTK_WINDOW (dialog));
- g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL);
+ dialog = gtk_alert_dialog_new ("Keyboard navigation");
+ gtk_alert_dialog_set_detail (dialog,
+ "The term ‘keynav’ is a shorthand for "
+ "keyboard navigation and refers to the process of using "
+ "a program (exclusively) via keyboard input.");
+ gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (label)));
+ g_object_unref (dialog);
return TRUE;
}