[gtk/matthiasc/for-master: 3/4] gtk-demo: Use a native file chooser in the svg demo
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 3/4] gtk-demo: Use a native file chooser in the svg demo
- Date: Fri, 4 Dec 2020 03:31:53 +0000 (UTC)
commit d83554121f5f9d0212204d9798ae5b43644081c8
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 3 19:44:45 2020 -0500
gtk-demo: Use a native file chooser in the svg demo
demos/gtk-demo/paintable_svg.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/demos/gtk-demo/paintable_svg.c b/demos/gtk-demo/paintable_svg.c
index 9d87f121ac..a1c97721e1 100644
--- a/demos/gtk-demo/paintable_svg.c
+++ b/demos/gtk-demo/paintable_svg.c
@@ -13,11 +13,11 @@
static void
-open_response_cb (GtkWidget *dialog,
- int response,
- GtkPicture *picture)
+open_response_cb (GtkNativeDialog *dialog,
+ int response,
+ GtkPicture *picture)
{
- gtk_widget_hide (dialog);
+ gtk_native_dialog_hide (dialog);
if (response == GTK_RESPONSE_ACCEPT)
{
@@ -31,7 +31,7 @@ open_response_cb (GtkWidget *dialog,
g_object_unref (file);
}
- gtk_window_destroy (GTK_WINDOW (dialog));
+ gtk_native_dialog_destroy (dialog);
}
static void
@@ -39,24 +39,20 @@ show_file_open (GtkWidget *button,
GtkPicture *picture)
{
GtkFileFilter *filter;
- GtkWidget *dialog;
+ GtkFileChooserNative *dialog;
- dialog = gtk_file_chooser_dialog_new ("Open node file",
+ dialog = gtk_file_chooser_native_new ("Open node file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
- "_Cancel", GTK_RESPONSE_CANCEL,
- "_Load", GTK_RESPONSE_ACCEPT,
- NULL);
+ "_Load",
+ "_Cancel");
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
-
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-
+ gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), picture);
- gtk_widget_show (dialog);
+ gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
}
static GtkWidget *window;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]