summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan Rathbone <poprocks@gmail.com>2023-01-25 17:07:35 +0000
committerLogan Rathbone <poprocks@gmail.com>2023-01-25 17:07:35 +0000
commita0c55e36136eb4469156f57877829ea39c016cbb (patch)
tree16764729f29839281597dc7d8ab332cfc81bcd4b
parent7e3cf22aba795935154c25e65e6fe8bc2895f05c (diff)
parent008c677ec2546cf9c3c267d9f1df0d248b41c630 (diff)
downloadzenity-gtk4-port.tar.gz
Merge branch 'libadwaita-port' into 'gtk4-port'3.90.0gtk4-port
zenity4: Port to libadwaita/AdwMessageDialog See merge request GNOME/zenity!22
-rw-r--r--.gitlab-ci.yml11
-rw-r--r--NEWS44
-rw-r--r--data/meson.build23
-rw-r--r--data/zenity.roff (renamed from data/zenity.1)58
-rw-r--r--help/C/forms.page2
-rw-r--r--meson.build27
-rw-r--r--meson_options.txt4
-rw-r--r--src/about.c6
-rw-r--r--src/calendar.c37
-rw-r--r--src/color.c26
-rw-r--r--src/entry.c34
-rw-r--r--src/fileselection.c23
-rw-r--r--src/forms.c44
-rw-r--r--src/main.c20
-rw-r--r--src/meson.build21
-rw-r--r--src/msg.c74
-rw-r--r--src/notification.c2
-rw-r--r--src/option.h2
-rw-r--r--src/password.c38
-rw-r--r--src/progress.c86
-rw-r--r--src/scale.c38
-rw-r--r--src/text.c79
-rw-r--r--src/tree.c36
-rw-r--r--src/util.c67
-rw-r--r--src/util.h25
-rw-r--r--src/zenity.gresource.xml.in (renamed from src/zenity.gresource.xml)4
-rw-r--r--src/zenity.h28
-rw-r--r--src/zenity.ui968
28 files changed, 764 insertions, 1063 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 50990ec..d406aa9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,10 @@
variables:
- DEPENDENCIES: gettext gettext-devel gcc redhat-rpm-config automake libtool autoconf autoconf-archive git
- gtk3-devel yelp-tools
+ DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel meson gtk4-devel yelp-tools webkit2gtk5.0-devel
-build_fedora_33:
- image: fedora:33
+build_fedora:
+ image: fedora:latest
before_script:
- dnf install -y --nogpgcheck $DEPENDENCIES
script:
- - ./autogen.sh
- - make -j
+ - meson -Dwebkitgtk=true build/
+ - ninja -C build/
diff --git a/NEWS b/NEWS
index 4fc6c9b..b492ac9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,45 @@
-Zenity 4.alpha.1
- - Initial port to GTK4 (Logan Rathbone)
+Zenity 3.90.0
+ - Initial alpha release based on libadwaita and GTK4 (Logan Rathbone)
+
+Zenity 3.44.0
+ - scale: set a page increment so mouse wheel can be used on widget (Hg)
+ - build: Use GNOME module post_install() (Matt Turner)
+ - docs: Fix incorrect markup (Andre Klapper)
+ - build: Replace deprecated functions (Logan Rathbone)
+ - Translation updates:
+ Alexander Shopov (bg)
+ Jiri Grönroos (fi)
+ Nart Tlisha (ab)
+ Sabri Ünal (tr)
+ Sergej A (ru)
+
+Zenity 3.43.0
+ - Documentation updates (Logan Rathbone)
+ - Bump WebkitGTK dependency to API 4.1, for GNOME 43 (Logan Rathbone)
+ - Translation updates:
+ Zurab Kargareteli (ka)
+
+Zenity 3.42.1
+ - scale: Make OK button default (allows pressing Enter to accept selected
+ value) (hydrargyrum)
+ - Fix maximum width of message dialogs to 60 characters, and make message
+ dialogs non-resizable (fixes regression from 3b64d05e) (David King)
+
+Zenity 3.42.0
+ - tree: Clicking row checks radio/checkboxes (Logan Rathbone)
+ - Fix search column selection with --imagelist (Janne Pulkkinen)
+ - Translation updates:
+ Asier Sarasua Garmendia (eu)
+ Efstathios Iosifidis (el)
+ Goran Vidović (hr)
+ Quentin PAGÈS (oc)
+ Alan Mortensen (da)
+ Daniel Mustieles (es)
+
+Zenity 3.41.0
+ - Port to meson (Logan Rathbone)
+ - Code cleanups (Simon McVittie)
+ - Translation updates (various contributors; see git log history)
Zenity 3.32.0
- Fix autotools warnings (Javier Jardón)
diff --git a/data/meson.build b/data/meson.build
index 04cfc15..6cdfea5 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -22,6 +22,25 @@ if desktop_file_validate_prg.found()
)
endif
-# manpage
+# manpage -- generated from help2man
-install_man('zenity.1')
+help2man = find_program('help2man', required: false)
+# help2man has to run zenity to generate the man page, which it can't do if
+# we're cross building. We also can't tell help2man what exe wrapper to use.
+if help2man.found() and not meson.is_cross_build()
+ help2man_opts = [
+ '--no-info',
+ '--section=1',
+ '--help-option=--help-all',
+ '--include=@INPUT@',
+ ]
+
+ custom_target('zenity.1',
+ output: 'zenity.1',
+ input: 'zenity.roff',
+ command: [
+ help2man, help2man_opts, '--output=@OUTPUT@', zenity
+ ],
+ install: true,
+ install_dir: join_paths(zenity_mandir, 'man1'))
+endif
diff --git a/data/zenity.1 b/data/zenity.roff
index 6f7f9bf..36d7596 100644
--- a/data/zenity.1
+++ b/data/zenity.roff
@@ -1,10 +1,5 @@
-.TH ZENITY 1 "January 2022"
-.SH NAME
-zenity \- display GTK+ dialogs
-.SH SYNOPSIS
-.B zenity
-.RI [ options ]
-.SH DESCRIPTION
+[description]
+
\fBzenity\fP is a program that will display GTK+ dialogs, and return
(either in the return code, or on standard output) the users
input. This allows you to present information, and ask for information
@@ -17,40 +12,7 @@ what the user typed into the text entry field.
.PP
Comprehensive documentation is also available in the GNOME Help Browser.
-.SH OPTIONS
-This program follows the usual GNU command line syntax, with long
-options starting with two dashes (`-').
-
-.SS
-Dialog Options
-
-.PP
-Options can be used in various combinations in order to craft many different
-types of dialogs.
-
-.PP
-For a summary of options, run \fBzenity \-\-help\fP. This will display the
-first hierarchy of options available. A separate series of help sub-categories
-for each of these options will be displayed.
-
-.PP
-For a full and complete list of all options for your build and an explanation
-of these options, run \fBzenity \-\-help\-all\fP
-
-.SS
-Miscellaneous options
-
-.TP
-.B \-?, \-\-help
-Show summary of options.
-.TP
-.B \-\-about
-Display an about dialog.
-.TP
-.B \-\-version
-Show version of program.
-
-.SH EXAMPLES
+[examples]
Display a file selector with the title \fISelect a file to
remove\fP. The file selected is returned on standard output.
@@ -85,10 +47,14 @@ zenity \-\-list \-\-checklist \-\-column "Buy" \-\-column "Item" TRUE Apples TRU
Display a progress dialog while searching for all the postscript files in your home directory
.P
find $HOME \-name '*.ps' | zenity \-\-progress \-\-pulsate
-.SH AUTHOR
-\fBZenity\fP was written by Glynn Foster <glynn.foster@sun.com>.
-.P
-This manual page was written by Ross Burton <ross@burtonini.com>.
-.SH SEE ALSO
+[author]
+
+.PP
+\fBZenity\fP was originally written by Glynn Foster <glynn.foster@sun.com>. It has since been maintained by a number of contributors since then.
+.PP
+This manual page was originally written by Ross Burton <ross@burtonini.com>. It currently contains portions which are automatically generated, and other portions written by its original author.
+
+[see also]
+
\fBdialog\fP(1)
diff --git a/help/C/forms.page b/help/C/forms.page
index 2b8ac54..24ba3d0 100644
--- a/help/C/forms.page
+++ b/help/C/forms.page
@@ -23,7 +23,7 @@
</item>
<item>
- <title>--add-password<cmd></cmd>=<var>FieldName</var></title>
+ <title><cmd>--add-password</cmd>=<var>FieldName</var></title>
<p>Add a new Password Entry in forms dialog. (Hide text)</p>
</item>
diff --git a/meson.build b/meson.build
index 94ec245..3714c42 100644
--- a/meson.build
+++ b/meson.build
@@ -1,5 +1,5 @@
project('zenity', 'c',
- version: '4.alpha.1',
+ version: '3.90.0',
meson_version: '>=0.57.0',
license: 'LGPL-2.1-or-later'
)
@@ -9,7 +9,7 @@ resource_base_path = '/org/gnome/Zenity'
version_arr = meson.project_version().split('.')
zenity_version_major = version_arr[0].to_int()
-zenity_version_minor = version_arr[1]
+zenity_version_minor = version_arr[1].to_int()
zenity_version_micro = version_arr[2].to_int()
zenity_prefix = get_option('prefix')
@@ -17,10 +17,11 @@ zenity_bindir = join_paths(zenity_prefix, get_option('bindir'))
zenity_libdir = join_paths(zenity_prefix, get_option('libdir'))
zenity_datadir = join_paths(zenity_prefix, get_option('datadir'))
zenity_localedir = join_paths(zenity_prefix, get_option('localedir'))
+zenity_mandir = join_paths(zenity_prefix, get_option('mandir'))
zenity_iconsdir = join_paths(zenity_datadir, 'icons')
zenity_root_dir = include_directories('.')
-zenity_po_dir = join_paths(meson.source_root(), 'po')
+zenity_po_dir = join_paths(meson.project_source_root(), 'po')
gnome = import('gnome')
i18n = import('i18n')
@@ -56,7 +57,7 @@ foreach h : check_headers
cc.has_header(h, required: true)
endforeach
-gtk_dep = dependency('gtk4', version: '>= 4.0.0')
+adw_dep = dependency('libadwaita-1', version: '>= 1.2')
# Optional dependencies
@@ -64,15 +65,14 @@ opt_missing_str = '''
Requested optional @0@ support but library not found.
Please ensure you have any required development libraries installed.'''
-# TODO
-#webkitgtk = dependency('webkit2gtk-4.0', version: '>= 2.8.1', required: false)
-#if get_option('webkitgtk')
-# if webkitgtk.found()
-# zenity_conf.set('HAVE_WEBKITGTK', true)
-# else
-# error(opt_missing_str.format('webkitgtk'))
-# endif
-#endif
+webkitgtk_dep = dependency('webkit2gtk-5.0', required: false)
+if get_option('webkitgtk')
+ if webkitgtk_dep.found()
+ zenity_conf.set('HAVE_WEBKITGTK', true)
+ else
+ error(opt_missing_str.format('webkitgtk'))
+ endif
+endif
configure_file(
output: 'config.h',
@@ -85,6 +85,7 @@ summary({'prefix': zenity_prefix,
'libdir': zenity_libdir,
'datadir': zenity_datadir,
'localedir': zenity_localedir,
+ 'mandir': zenity_mandir,
'iconsdir': zenity_iconsdir,
}, section: 'Directories')
diff --git a/meson_options.txt b/meson_options.txt
index deeaf4b..8509973 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1 @@
-#TODO
-#option('webkitgtk', type : 'boolean', value : true,
-# description : 'enable webkitgtk support')
+option('webkitgtk', type: 'boolean', value: false, description : 'enable webkitgtk support')
diff --git a/src/about.c b/src/about.c
index cac56c8..b71ea13 100644
--- a/src/about.c
+++ b/src/about.c
@@ -6,7 +6,7 @@
* Copyright © 2002 Sun Microsystems, Inc.
* Copyright © 2001 CodeFactory AB
* Copyright © 2001, 2002 Anders Carlsson
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -83,7 +83,7 @@ zenity_about (ZenityData *data)
VERSION,
"copyright",
"Copyright \xc2\xa9 2003 Sun Microsystems\n"
- "Copyright \xc2\xa9 2021 Logan Rathbone\n",
+ "Copyright \xc2\xa9 2021-2023 Logan Rathbone\n",
"comments",
_("Display dialog boxes from shell scripts"),
"authors",
@@ -117,5 +117,5 @@ zenity_about_close_cb (GtkWindow *window, gpointer data)
ZenityData *zen_data = data;
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
- zenity_util_gapp_quit (window);
+ zenity_util_gapp_quit (window, zen_data);
}
diff --git a/src/calendar.c b/src/calendar.c
index be8c8af..f5237d1 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -4,7 +4,7 @@
* calendar.c
*
* Copyright © 2002 Sun Microsystems, Inc.
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -35,20 +35,18 @@
static GtkWidget *calendar;
static ZenityCalendarData *zen_cal_data;
-static void zenity_calendar_dialog_response (GtkWidget *widget,
- int response, gpointer data);
+static void zenity_calendar_dialog_response (GtkWidget *widget, char *rstr, gpointer data);
void
zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
{
g_autoptr(GtkBuilder) builder = NULL;
GtkWidget *dialog;
- GtkWidget *button;
GObject *text;
zen_cal_data = cal_data;
- builder = zenity_util_load_ui_file ("zenity_calendar_dialog", NULL);
+ builder = zenity_util_load_ui_file ("zenity_calendar_dialog", "zenity_calendar_box", NULL);
if (builder == NULL) {
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
@@ -108,22 +106,17 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
if (data->extra_label)
{
- for (int i = 0; data->extra_label[i] != NULL; ++i) {
- gtk_dialog_add_button (GTK_DIALOG(dialog),
- data->extra_label[i], i);
- }
+ ZENITY_UTIL_ADD_EXTRA_LABELS (dialog)
}
- if (data->ok_label) {
- button = GTK_WIDGET (gtk_builder_get_object (builder,
- "zenity_calendar_ok_button"));
- gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
+ if (data->ok_label)
+ {
+ ZENITY_UTIL_SETUP_OK_BUTTON_LABEL (dialog);
}
- if (data->cancel_label) {
- button = GTK_WIDGET (gtk_builder_get_object (builder,
- "zenity_calendar_cancel_button"));
- gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
+ if (data->cancel_label)
+ {
+ ZENITY_UTIL_SETUP_CANCEL_BUTTON_LABEL (dialog);
}
zenity_util_gapp_main (GTK_WINDOW(dialog));
@@ -150,19 +143,19 @@ zenity_calendar_dialog_output (void)
}
static void
-zenity_calendar_dialog_response (GtkWidget *widget, int response,
- gpointer data)
+zenity_calendar_dialog_response (GtkWidget *widget, char *rstr, gpointer data)
{
ZenityData *zen_data = data;
+ ZenityExitCode response = zenity_util_parse_dialog_response (rstr);
switch (response)
{
- case GTK_RESPONSE_OK:
+ case ZENITY_OK:
zenity_calendar_dialog_output ();
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
break;
- case GTK_RESPONSE_CANCEL:
+ case ZENITY_CANCEL:
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
break;
@@ -178,5 +171,5 @@ zenity_calendar_dialog_response (GtkWidget *widget, int response,
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- zenity_util_gapp_quit (GTK_WINDOW(gtk_widget_get_native (widget)));
+ zenity_util_gapp_quit (GTK_WINDOW(gtk_widget_get_native (widget)), zen_data);
}
diff --git a/src/color.c b/src/color.c
index 4289407..d1f7c8e 100644
--- a/src/color.c
+++ b/src/color.c
@@ -4,7 +4,7 @@
* color.c
*
* Copyright © 2010 Berislav Kovacki
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -30,10 +30,12 @@
#include "zenity.h"
#include <string.h>
+/* TODO: port to GtkColorDialog */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
static ZenityData *zen_data;
-static void zenity_colorselection_dialog_response (GtkWidget *widget,
- int response, gpointer data);
+static void zenity_colorselection_dialog_response (GtkWidget *widget, int response, gpointer data);
void
zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
@@ -45,10 +47,7 @@ zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
dialog = gtk_color_chooser_dialog_new (data->dialog_title, NULL);
- g_signal_connect (G_OBJECT (dialog),
- "response",
- G_CALLBACK (zenity_colorselection_dialog_response),
- color_data);
+ g_signal_connect (dialog, "response", G_CALLBACK (zenity_colorselection_dialog_response), color_data);
if (color_data->color &&
gdk_rgba_parse (&color, color_data->color))
@@ -58,11 +57,7 @@ zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
if (data->extra_label)
{
- for (int i = 0; data->extra_label[i] != NULL; ++i)
- {
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- data->extra_label[i], i);
- }
+ ZENITY_UTIL_ADD_EXTRA_LABELS (dialog)
}
if (data->modal)
@@ -81,8 +76,7 @@ zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
}
static void
-zenity_colorselection_dialog_response (GtkWidget *widget,
- int response, gpointer data)
+zenity_colorselection_dialog_response (GtkWidget *widget, int response, gpointer data)
{
GdkRGBA color;
@@ -105,5 +99,7 @@ zenity_colorselection_dialog_response (GtkWidget *widget,
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- zenity_util_gapp_quit (GTK_WINDOW(widget));
+ zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data);
}
+
+G_GNUC_END_IGNORE_DEPRECATIONS
diff --git a/src/entry.c b/src/entry.c
index a6d67a4..bf94cd4 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -4,7 +4,7 @@
* entry.c
*
* Copyright © 2002 Sun Microsystems, Inc.
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -29,8 +29,7 @@
#include <config.h>
-static void zenity_entry_dialog_response (GtkWidget *widget,
- int response, gpointer data);
+static void zenity_entry_dialog_response (GtkWidget *widget, char *rstr, gpointer data);
static GtkWidget *entry;
static int n_entries = 0;
@@ -55,13 +54,12 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
{
g_autoptr(GtkBuilder) builder = NULL;
GtkWidget *dialog;
- GtkWidget *button;
GObject *text;
GSList *entries = NULL;
GSList *tmp;
GObject *vbox;
- builder = zenity_util_load_ui_file ("zenity_entry_dialog", NULL);
+ builder = zenity_util_load_ui_file ("zenity_entry_dialog", "zenity_entry_box", NULL);
if (builder == NULL)
{
@@ -72,8 +70,7 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
dialog = GTK_WIDGET(gtk_builder_get_object (builder,
"zenity_entry_dialog"));
- g_signal_connect (dialog, "response",
- G_CALLBACK(zenity_entry_dialog_response), data);
+ g_signal_connect (dialog, "response", G_CALLBACK(zenity_entry_dialog_response), data);
if (data->dialog_title)
gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
@@ -90,25 +87,17 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
if (data->extra_label)
{
- for (int i = 0; data->extra_label[i] != NULL; ++i)
- {
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- data->extra_label[i], i);
- }
+ ZENITY_UTIL_ADD_EXTRA_LABELS (dialog)
}
if (data->ok_label)
{
- button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_entry_ok_button"));
- gtk_button_set_label (GTK_BUTTON(button), data->ok_label);
+ ZENITY_UTIL_SETUP_OK_BUTTON_LABEL (dialog);
}
if (data->cancel_label)
{
- button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_entry_cancel_button"));
- gtk_button_set_label (GTK_BUTTON(button), data->cancel_label);
+ ZENITY_UTIL_SETUP_CANCEL_BUTTON_LABEL (dialog);
}
text = gtk_builder_get_object (builder, "zenity_entry_text");
@@ -202,18 +191,19 @@ zenity_entry_dialog_output (void)
}
static void
-zenity_entry_dialog_response (GtkWidget *widget, int response, gpointer data)
+zenity_entry_dialog_response (GtkWidget *widget, char *rstr, gpointer data)
{
ZenityData *zen_data = data;
+ ZenityExitCode response = zenity_util_parse_dialog_response (rstr);
switch (response)
{
- case GTK_RESPONSE_OK:
+ case ZENITY_OK:
zenity_entry_dialog_output ();
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
break;
- case GTK_RESPONSE_CANCEL:
+ case ZENITY_CANCEL:
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
break;
@@ -229,5 +219,5 @@ zenity_entry_dialog_response (GtkWidget *widget, int response, gpointer data)
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- zenity_util_gapp_quit (GTK_WINDOW(widget));
+ zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data);
}
diff --git a/src/fileselection.c b/src/fileselection.c
index e495f76..cf6a481 100644
--- a/src/fileselection.c
+++ b/src/fileselection.c
@@ -4,7 +4,7 @@
* fileselection.c
*
* Copyright © 2002 Sun Microsystems, Inc.
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -31,10 +31,13 @@
#include <config.h>
+/* TODO: port to GtkFileDialog.
+ */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
static ZenityData *zen_data;
-static void zenity_fileselection_dialog_response (GtkDialog *dialog,
- int response, gpointer data);
+static void zenity_fileselection_dialog_response (GtkWidget *widget, int response, gpointer data);
void
zenity_fileselection (ZenityData *data, ZenityFileData *file_data)
@@ -63,8 +66,7 @@ zenity_fileselection (ZenityData *data, ZenityFileData *file_data)
if (data->extra_label)
g_warning ("Cannot add extra labels to GtkFileChooserNative");
- g_signal_connect (dialog, "response",
- G_CALLBACK(zenity_fileselection_dialog_response), file_data);
+ g_signal_connect (dialog, "response", G_CALLBACK(zenity_fileselection_dialog_response), file_data);
if (file_data->uri)
{
@@ -179,11 +181,10 @@ zenity_fileselection_dialog_output (GtkFileChooser *chooser,
}
static void
-zenity_fileselection_dialog_response (GtkDialog *dialog,
- int response, gpointer data)
+zenity_fileselection_dialog_response (GtkWidget *widget, int response, gpointer data)
{
ZenityFileData *file_data = data;
- GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog);
+ GtkFileChooser *chooser = GTK_FILE_CHOOSER (widget);
switch (response)
{
@@ -192,7 +193,7 @@ zenity_fileselection_dialog_response (GtkDialog *dialog,
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
break;
- case GTK_RESPONSE_CANCEL:
+ case GTK_RESPONSE_REJECT:
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
break;
@@ -209,5 +210,7 @@ zenity_fileselection_dialog_response (GtkDialog *dialog,
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- zenity_util_gapp_quit (NULL);
+ zenity_util_gapp_quit (NULL, zen_data);
}
+
+G_GNUC_END_IGNORE_DEPRECATIONS
diff --git a/src/forms.c b/src/forms.c
index ea50349..4e4a60e 100644
--- a/src/forms.c
+++ b/src/forms.c
@@ -4,7 +4,7 @@
* forms.c
*
* Copyright © 2010 Arx Cruz
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,8 +33,7 @@
static ZenityData *zen_data;
static GSList *selected;
-static void zenity_forms_dialog_response (GtkWidget *widget,
- int response, gpointer data);
+static void zenity_forms_dialog_response (GtkWidget *widget, char *rstr, gpointer data);
static void
zenity_forms_dialog_get_selected (GtkTreeModel *model, GtkTreePath *path_buf,
@@ -228,7 +227,6 @@ zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data)
GtkWidget *dialog;
GtkWidget *grid;
GtkWidget *text;
- GtkWidget *button;
int list_count = 0;
int combo_count = 0;
@@ -236,7 +234,7 @@ zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data)
zen_data = data;
- builder = zenity_util_load_ui_file ("zenity_forms_dialog", NULL);
+ builder = zenity_util_load_ui_file ("zenity_forms_dialog", "zenity_forms_box", NULL);
if (builder == NULL) {
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
@@ -259,23 +257,17 @@ zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data)
if (data->extra_label)
{
- for (i = 0; data->extra_label[i] != NULL; ++i)
- {
- gtk_dialog_add_button (GTK_DIALOG(dialog),
- data->extra_label[i], i);
- }
+ ZENITY_UTIL_ADD_EXTRA_LABELS (dialog)
}
- if (data->ok_label) {
- button = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_forms_ok_button"));
- gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
+ if (data->ok_label)
+ {
+ ZENITY_UTIL_SETUP_OK_BUTTON_LABEL (dialog);
}
- if (data->cancel_label) {
- button = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_forms_cancel_button"));
- gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
+ if (data->cancel_label)
+ {
+ ZENITY_UTIL_SETUP_CANCEL_BUTTON_LABEL (dialog);
}
text = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_text"));
@@ -359,7 +351,7 @@ zenity_forms_dialog_output (ZenityFormsData *forms_data)
{
GSList *tmp, *tmp2;
guint day, year, month;
- GDate *date = NULL;
+ g_autoptr(GDate) date = NULL;
char time_string[128];
g_autofree char *combo_value = NULL;
GtkTreeSelection *selection;
@@ -407,9 +399,8 @@ zenity_forms_dialog_output (ZenityFormsData *forms_data)
"month", &month,
"year", &year,
NULL);
- date = g_date_new_dmy (year, month + 1, day);
- g_date_strftime (time_string,
- 127, forms_data->date_format, date);
+ date = g_date_new_dmy (day, month + 1, year);
+ g_date_strftime (time_string, sizeof time_string, forms_data->date_format, date);
g_print ("%s", time_string);
break;
@@ -441,18 +432,19 @@ zenity_forms_dialog_output (ZenityFormsData *forms_data)
}
static void
-zenity_forms_dialog_response (GtkWidget *widget, int response, gpointer data)
+zenity_forms_dialog_response (GtkWidget *widget, char *rstr, gpointer data)
{
ZenityFormsData *forms_data = data;
+ ZenityExitCode response = zenity_util_parse_dialog_response (rstr);
switch (response)
{
- case GTK_RESPONSE_OK:
+ case ZENITY_OK:
zenity_forms_dialog_output (forms_data);
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
break;
- case GTK_RESPONSE_CANCEL:
+ case ZENITY_CANCEL:
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
break;
@@ -468,5 +460,5 @@ zenity_forms_dialog_response (GtkWidget *widget, int response, gpointer data)
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- zenity_util_gapp_quit (GTK_WINDOW(widget));
+ zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data);
}
diff --git a/src/main.c b/src/main.c
index a4531fd..ec01b41 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,7 +4,7 @@
* main.c
*
* Copyright © 2002 Sun Microsystems, Inc.
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -27,7 +27,7 @@
#include "option.h"
#include "zenity.h"
-#include <gtk/gtk.h>
+#include <adwaita.h>
#include <locale.h>
#include <stdlib.h>
@@ -39,7 +39,7 @@ typedef struct {
} ZenityArgs;
static void
-command_line_cb (GtkApplication *app,
+command_line_cb (GApplication *app,
GApplicationCommandLine *command_line,
gpointer user_data)
{
@@ -125,17 +125,16 @@ command_line_cb (GtkApplication *app,
exit (-1);
}
- g_application_command_line_set_exit_status (command_line,
- results->data->exit_code);
-
g_free (args);
}
+static void dummy_log_func (void) { }
+
int
main (int argc, char *argv[])
{
ZenityArgs *args;
- g_autoptr(GtkApplication) app = NULL;
+ g_autoptr(AdwApplication) app = NULL;
int status;
/* <i18n> */
@@ -146,11 +145,16 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
/* </i18n> */
+ /* Turn off g_message's from libadwaita - this is to suppress the 'this is
+ * discouraged' message re: mapping dialogs without a transient parent.
+ */
+ g_log_set_handler ("Adwaita", G_LOG_LEVEL_MESSAGE, (GLogFunc)dummy_log_func, NULL);
+
args = g_new0 (ZenityArgs, 1);
args->argc = argc;
args->argv = argv;
- app = gtk_application_new (APP_ID, G_APPLICATION_HANDLES_COMMAND_LINE);
+ app = adw_application_new (APP_ID, G_APPLICATION_HANDLES_COMMAND_LINE);
g_signal_connect (app, "command-line", G_CALLBACK(command_line_cb), args);
status = g_application_run (G_APPLICATION(app), 0, NULL);
diff --git a/src/meson.build b/src/meson.build
index 9034cb2..2ee1889 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -15,12 +15,25 @@ zenity_sources = [
'scale.c',
'text.c',
'tree.c',
- 'util.c'
+ 'util.c',
]
+zenity_enums = gnome.mkenums_simple('zenity-enums',
+ sources: 'zenity.h',
+)
+
+zenity_res_conf = configuration_data()
+zenity_res_conf.set('resource_base_path', resource_base_path)
+
+zenity_res_in = configure_file(
+ input: 'zenity.gresource.xml.in',
+ output: 'zenity.gresource.xml',
+ configuration: zenity_res_conf
+)
+
zenity_res = gnome.compile_resources(
'zenity-resources',
- 'zenity.gresource.xml',
+ zenity_res_in,
c_name: 'zenity'
)
@@ -30,9 +43,9 @@ zenity_c_args = [
zenity = executable(
meson.project_name(),
- zenity_sources + zenity_res,
+ zenity_sources + zenity_enums + zenity_res,
include_directories: zenity_root_dir,
c_args: zenity_c_args,
- dependencies: gtk_dep,
+ dependencies: [adw_dep, webkitgtk_dep],
install: true
)
diff --git a/src/msg.c b/src/msg.c
index 985a733..87a5beb 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -4,7 +4,7 @@
* msg.c
*
* Copyright (C) 2002 Sun Microsystems, Inc.
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -29,31 +29,7 @@
#include "util.h"
#include "zenity.h"
-static void zenity_msg_dialog_response (GtkWidget *widget,
- int response, gpointer data);
-
-static void
-zenity_msg_construct_question_dialog (GtkWidget *dialog,
- ZenityMsgData *msg_data, ZenityData *data)
-{
- GtkWidget *cancel_button, *ok_button;
-
- cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- _("_No"), GTK_RESPONSE_CANCEL);
- ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
- _("_Yes"), GTK_RESPONSE_OK);
-
- gtk_widget_grab_focus
- (msg_data->default_cancel ? cancel_button : ok_button);
-
- if (data->cancel_label) {
- gtk_button_set_label (GTK_BUTTON (cancel_button), data->cancel_label);
- }
-
- if (data->ok_label) {
- gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
- }
-}
+static void zenity_msg_dialog_response (GtkWidget *widget, char *rstr, gpointer data);
/* FIXME - Is this still necessary with gtk4? */
static void
@@ -86,50 +62,42 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
{
g_autoptr(GtkBuilder) builder;
GtkWidget *dialog;
- GtkWidget *ok_button;
GObject *text;
GObject *image;
switch (msg_data->mode)
{
case ZENITY_MSG_WARNING:
- builder = zenity_util_load_ui_file ("zenity_warning_dialog", NULL);
+ builder = zenity_util_load_ui_file ("zenity_warning_dialog", "zenity_warning_box", NULL);
dialog = GTK_WIDGET (
gtk_builder_get_object (builder, "zenity_warning_dialog"));
text = gtk_builder_get_object (builder, "zenity_warning_text");
image = gtk_builder_get_object (builder, "zenity_warning_image");
- ok_button = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_warning_ok_button"));
break;
case ZENITY_MSG_QUESTION:
case ZENITY_MSG_SWITCH:
- builder = zenity_util_load_ui_file ("zenity_question_dialog", NULL);
+ builder = zenity_util_load_ui_file ("zenity_question_dialog", "zenity_question_box", NULL);
dialog = GTK_WIDGET (gtk_builder_get_object (builder,
"zenity_question_dialog"));
text = gtk_builder_get_object (builder, "zenity_question_text");
image = gtk_builder_get_object (builder, "zenity_question_image");
- ok_button = NULL;
break;
case ZENITY_MSG_ERROR:
- builder = zenity_util_load_ui_file ("zenity_error_dialog", NULL);
+ builder = zenity_util_load_ui_file ("zenity_error_dialog", "zenity_error_box", NULL);
dialog = GTK_WIDGET (gtk_builder_get_object (builder,
"zenity_error_dialog"));
text = gtk_builder_get_object (builder, "zenity_error_text");
image = gtk_builder_get_object (builder, "zenity_error_image");
- ok_button = GTK_WIDGET (gtk_builder_get_object (builder,
- "zenity_error_ok_button"));
break;
case ZENITY_MSG_INFO:
- builder = zenity_util_load_ui_file ("zenity_info_dialog", NULL);
+ builder = zenity_util_load_ui_file ("zenity_info_dialog", "zenity_info_box", NULL);
dialog = GTK_WIDGET (gtk_builder_get_object (builder,
"zenity_info_dialog"));
text = gtk_builder_get_object (builder, "zenity_info_text");
image = gtk_builder_get_object (builder, "zenity_info_image");
- ok_button = GTK_WIDGET (gtk_builder_get_object (builder,
- "zenity_info_ok_button"));
break;
default:
@@ -137,18 +105,13 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
dialog = NULL;
text = NULL;
image = NULL;
- ok_button = NULL;
g_assert_not_reached ();
break;
}
if (data->extra_label)
{
- for (int i = 0; data->extra_label[i] != NULL; ++i)
- {
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- data->extra_label[i], i);
- }
+ ZENITY_UTIL_ADD_EXTRA_LABELS (dialog)
}
if (builder == NULL) {
@@ -156,18 +119,14 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
return;
}
- g_signal_connect (G_OBJECT (dialog),
- "response",
- G_CALLBACK (zenity_msg_dialog_response),
- data);
+ g_signal_connect (dialog, "response", G_CALLBACK(zenity_msg_dialog_response), data);
if (data->dialog_title)
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
- if (ok_button) {
- if (data->ok_label) {
- gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
- }
+ if (data->ok_label)
+ {
+ ZENITY_UTIL_SETUP_OK_BUTTON_LABEL (dialog)
}
switch (msg_data->mode)
@@ -180,7 +139,6 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
case ZENITY_MSG_QUESTION:
gtk_window_set_icon_name (GTK_WINDOW(dialog),
"dialog-question");
- zenity_msg_construct_question_dialog (dialog, msg_data, data);
break;
case ZENITY_MSG_SWITCH:
@@ -256,16 +214,18 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
}
static void
-zenity_msg_dialog_response (GtkWidget *widget, int response, gpointer data) {
+zenity_msg_dialog_response (GtkWidget *widget, char *rstr, gpointer data)
+{
ZenityData *zen_data = data;
+ ZenityExitCode response = zenity_util_parse_dialog_response (rstr);
switch (response)
{
- case GTK_RESPONSE_OK:
+ case ZENITY_OK:
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
break;
- case GTK_RESPONSE_CANCEL:
+ case ZENITY_CANCEL:
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
break;
@@ -276,5 +236,5 @@ zenity_msg_dialog_response (GtkWidget *widget, int response, gpointer data) {
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- zenity_util_gapp_quit (GTK_WINDOW(widget));
+ zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data);
}
diff --git a/src/notification.c b/src/notification.c
index dc25e59..295c1c2 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -88,7 +88,7 @@ on_notification_default_action (GSimpleAction *self,
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
- zenity_util_gapp_quit (NULL);
+ zenity_util_gapp_quit (NULL, zen_data);
}
static gboolean
diff --git a/src/option.h b/src/option.h
index df4150a..5da7cfe 100644
--- a/src/option.h
+++ b/src/option.h
@@ -2,7 +2,7 @@
* option.h
*
* Copyright © 2002 Sun Microsystems, Inc.
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
diff --git a/src/password.c b/src/password.c
index 172fe4f..69dd683 100644
--- a/src/password.c
+++ b/src/password.c
@@ -4,7 +4,7 @@
* password.c
*
* Copyright © 2010 Arx Cruz
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,15 +33,13 @@
static ZenityData *zen_data;
-static void zenity_password_dialog_response (GtkWidget *widget,
- int response, gpointer data);
+static void zenity_password_dialog_response (GtkWidget *widget, char *rstr, gpointer data);
void
zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data)
{
GtkBuilder *builder;
GtkWidget *dialog;
- GtkWidget *button;
GtkWidget *grid;
GtkWidget *label;
int pass_row = 0;
@@ -49,7 +47,7 @@ zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data)
/* Set global */
zen_data = data;
- builder = zenity_util_load_ui_file ("zenity_password_dialog", NULL);
+ builder = zenity_util_load_ui_file ("zenity_password_dialog", "zenity_password_box", NULL);
if (builder == NULL)
{
@@ -62,25 +60,16 @@ zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data)
if (data->extra_label)
{
- for (int i = 0; data->extra_label[i] != NULL; ++i)
- {
- gtk_dialog_add_button (GTK_DIALOG(dialog),
- data->extra_label[i], i);
- }
+ ZENITY_UTIL_ADD_EXTRA_LABELS (dialog)
}
- if (data->ok_label)
- {
- button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_password_ok_button"));
- gtk_button_set_label (GTK_BUTTON(button), data->ok_label);
+ if (data->ok_label) {
+ ZENITY_UTIL_SETUP_OK_BUTTON_LABEL (dialog);
}
if (data->cancel_label)
{
- button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_password_cancel_button"));
- gtk_button_set_label (GTK_BUTTON(button), data->cancel_label);
+ ZENITY_UTIL_SETUP_CANCEL_BUTTON_LABEL (dialog);
}
grid = GTK_WIDGET(gtk_builder_get_object (builder,
@@ -136,8 +125,7 @@ zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data)
if (data->modal)
gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);
- g_signal_connect (dialog, "response",
- G_CALLBACK(zenity_password_dialog_response), password_data);
+ g_signal_connect (dialog, "response", G_CALLBACK(zenity_password_dialog_response), password_data);
zenity_util_show_dialog (dialog);
@@ -151,18 +139,18 @@ zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data)
}
static void
-zenity_password_dialog_response (GtkWidget *widget, int response,
- gpointer data)
+zenity_password_dialog_response (GtkWidget *widget, char *rstr, gpointer data)
{
ZenityPasswordData *password_data = data;
GtkEntryBuffer *user_buff, *pass_buff;
+ ZenityExitCode response = zenity_util_parse_dialog_response (rstr);
user_buff = gtk_entry_get_buffer (GTK_ENTRY(password_data->entry_username));
pass_buff = gtk_entry_get_buffer (GTK_ENTRY(password_data->entry_password));
switch (response)
{
- case GTK_RESPONSE_OK:
+ case ZENITY_OK:
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
if (password_data->username) {
g_print ("%s|%s\n",
@@ -175,7 +163,7 @@ zenity_password_dialog_response (GtkWidget *widget, int response,
}
break;
- case GTK_RESPONSE_CANCEL:
+ case ZENITY_CANCEL:
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
break;
@@ -186,5 +174,5 @@ zenity_password_dialog_response (GtkWidget *widget, int response,
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- zenity_util_gapp_quit (GTK_WINDOW(widget));
+ zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data);
}
diff --git a/src/progress.c b/src/progress.c
index 81d5e5f..cae1a6c 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -4,7 +4,7 @@
* progress.c
*
* Copyright © 2002 Sun Microsystems, Inc.
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -50,8 +50,7 @@ static gboolean auto_close;
gint zenity_progress_timeout (gpointer data);
gint zenity_progress_pulsate_timeout (gpointer data);
-static void zenity_progress_dialog_response (GtkWidget *widget,
- int response, gpointer data);
+static void zenity_progress_dialog_response (GtkWidget *widget, char *rstr, gpointer data);
static gboolean
zenity_progress_pulsate_progress_bar (gpointer user_data)
@@ -250,19 +249,15 @@ zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition,
if (percentage == 100)
{
- GObject *button;
-
- button = gtk_builder_get_object (builder,
- "zenity_progress_ok_button");
- gtk_widget_set_sensitive (GTK_WIDGET (button), TRUE);
- gtk_widget_grab_focus (GTK_WIDGET (button));
+ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "ok", TRUE);
+ adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG(parent), "ok");
if (progress_data->autoclose)
{
zen_data->exit_code =
zenity_util_return_exit_code (ZENITY_OK);
- zenity_util_gapp_quit (parent);
+ zenity_util_gapp_quit (parent, zen_data);
}
}
}
@@ -276,17 +271,10 @@ zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition,
{
/* We assume that we are done, so stop the pulsating and de-sensitize
* the buttons */
- GtkWidget *button;
-
- button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_progress_ok_button"));
- gtk_widget_set_sensitive (button, TRUE);
- gtk_widget_grab_focus (button);
+ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "ok", TRUE);
+ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "cancel", FALSE);
+ adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG(parent), "ok");
- button = GTK_WIDGET (gtk_builder_get_object (builder,
- "zenity_progress_cancel_button"));
-
- gtk_widget_set_sensitive (button, FALSE);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), 1.0);
zenity_progress_pulsate_stop ();
@@ -296,7 +284,7 @@ zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition,
if (progress_data->autoclose)
{
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
- zenity_util_gapp_quit (parent);
+ zenity_util_gapp_quit (parent, zen_data);
}
g_io_channel_shutdown (channel, TRUE, NULL);
@@ -331,13 +319,11 @@ void
zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
{
GtkWidget *dialog;
- GtkWidget *button;
GObject *text;
GObject *progress_bar;
- GObject *cancel_button, *ok_button;
zen_data = data;
- builder = zenity_util_load_ui_file ("zenity_progress_dialog", NULL);
+ builder = zenity_util_load_ui_file ("zenity_progress_dialog", "zenity_progress_box", NULL);
if (builder == NULL) {
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
@@ -351,8 +337,7 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
progress_bar = gtk_builder_get_object (builder, "zenity_progress_bar");
- g_signal_connect (dialog, "response",
- G_CALLBACK(zenity_progress_dialog_response), data);
+ g_signal_connect (dialog, "response", G_CALLBACK(zenity_progress_dialog_response), data);
if (data->dialog_title)
gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
@@ -384,25 +369,16 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
if (data->extra_label)
{
- for (int i = 0; data->extra_label[i] != NULL; ++i)
- {
- gtk_dialog_add_button (GTK_DIALOG(dialog),
- data->extra_label[i], i);
- }
+ ZENITY_UTIL_ADD_EXTRA_LABELS (dialog)
}
- if (data->ok_label)
- {
- button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_progress_ok_button"));
- gtk_button_set_label (GTK_BUTTON(button), data->ok_label);
+ if (data->ok_label) {
+ ZENITY_UTIL_SETUP_OK_BUTTON_LABEL (dialog);
}
if (data->cancel_label)
{
- button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_progress_cancel_button"));
- gtk_button_set_label (GTK_BUTTON(button), data->cancel_label);
+ ZENITY_UTIL_SETUP_CANCEL_BUTTON_LABEL (dialog);
}
if (progress_data->dialog_text) {
@@ -416,21 +392,22 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
}
autokill = progress_data->autokill;
-
auto_close = progress_data->autoclose;
- ok_button = gtk_builder_get_object (builder, "zenity_progress_ok_button");
-
no_cancel = progress_data->no_cancel;
- cancel_button =
- gtk_builder_get_object (builder, "zenity_progress_cancel_button");
- if (no_cancel) {
- gtk_widget_hide (GTK_WIDGET(cancel_button));
+ /* Unlike some other dialogs, this one starts off blank and we need to add
+ * the OK/Cancel buttons depending on the options.
+ */
+ if (no_cancel)
gtk_window_set_deletable (GTK_WINDOW(dialog), FALSE);
- }
+ else
+ adw_message_dialog_add_response (ADW_MESSAGE_DIALOG(dialog), "cancel", _("_Cancel"));
- if (no_cancel && auto_close)
- gtk_widget_hide (GTK_WIDGET(ok_button));
+ if (!auto_close)
+ {
+ adw_message_dialog_add_response (ADW_MESSAGE_DIALOG(dialog), "ok", _("_OK"));
+ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(dialog), "ok", FALSE);
+ }
zenity_util_show_dialog (dialog);
zenity_progress_read_info (progress_data);
@@ -445,16 +422,17 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
}
static void
-zenity_progress_dialog_response (GtkWidget *widget, int response,
- gpointer data)
+zenity_progress_dialog_response (GtkWidget *widget, char *rstr, gpointer data)
{
+ ZenityExitCode response = zenity_util_parse_dialog_response (rstr);
+
switch (response)
{
- case GTK_RESPONSE_OK:
+ case ZENITY_OK:
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
break;
- case GTK_RESPONSE_CANCEL:
+ case ZENITY_CANCEL:
/* We do not want to kill the parent process, in order to give the
* user the ability to choose the action to be taken. But we want
* to give people the option to choose this behavior.
@@ -478,5 +456,5 @@ zenity_progress_dialog_response (GtkWidget *widget, int response,
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- zenity_util_gapp_quit (GTK_WINDOW(widget));
+ zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data);
}
diff --git a/src/scale.c b/src/scale.c
index 2140040..7ac0f41 100644
--- a/src/scale.c
+++ b/src/scale.c
@@ -4,7 +4,7 @@
* scale.c
*
* Copyright © 2002 Sun Microsystems, Inc.
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,19 +33,16 @@
static GtkWidget *scale;
static void zenity_scale_value_changed (GtkWidget *widget, gpointer data);
-static void zenity_scale_dialog_response (GtkWidget *widget, int response,
- gpointer data);
+static void zenity_scale_dialog_response (GtkWidget *widget, char *rstr, gpointer data);
void
zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
{
g_autoptr(GtkBuilder) builder = NULL;
GtkWidget *dialog;
- GtkWidget *button;
GObject *text;
- builder =
- zenity_util_load_ui_file ("zenity_scale_dialog", "adjustment1", NULL);
+ builder = zenity_util_load_ui_file ("zenity_scale_dialog", "zenity_scale_adjustment", "zenity_scale_box", NULL);
if (builder == NULL) {
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
@@ -58,8 +55,7 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
GTK_WIDGET (gtk_builder_get_object (builder, "zenity_scale_hscale"));
text = gtk_builder_get_object (builder, "zenity_scale_text");
- g_signal_connect (dialog, "response",
- G_CALLBACK(zenity_scale_dialog_response), data);
+ g_signal_connect (dialog, "response", G_CALLBACK(zenity_scale_dialog_response), data);
if (scale_data->min_value >= scale_data->max_value)
{
@@ -92,24 +88,17 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
if (data->extra_label)
{
- for (int i = 0; data->extra_label[i] != NULL; ++i)
- {
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- data->extra_label[i], i);
- }
+ ZENITY_UTIL_ADD_EXTRA_LABELS (dialog)
}
- if (data->ok_label) {
- button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_scale_ok_button"));
- gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
+ if (data->ok_label)
+ {
+ ZENITY_UTIL_SETUP_OK_BUTTON_LABEL (dialog);
}
if (data->cancel_label)
{
- button = GTK_WIDGET (gtk_builder_get_object (builder,
- "zenity_scale_cancel_button"));
- gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
+ ZENITY_UTIL_SETUP_CANCEL_BUTTON_LABEL (dialog);
}
if (scale_data->dialog_text) {
@@ -151,18 +140,19 @@ zenity_scale_value_changed (GtkWidget *widget, gpointer data)
}
static void
-zenity_scale_dialog_response (GtkWidget *widget, int response, gpointer data)
+zenity_scale_dialog_response (GtkWidget *widget, char *rstr, gpointer data)
{
ZenityData *zen_data = data;
+ ZenityExitCode response = zenity_util_parse_dialog_response (rstr);
switch (response)
{
- case GTK_RESPONSE_OK:
+ case ZENITY_OK:
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
g_print ("%.0f\n", gtk_range_get_value (GTK_RANGE (scale)));
break;
- case GTK_RESPONSE_CANCEL:
+ case ZENITY_CANCEL:
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
break;
@@ -181,5 +171,5 @@ zenity_scale_dialog_response (GtkWidget *widget, int response, gpointer data)
break;
}
- zenity_util_gapp_quit (GTK_WINDOW(widget));
+ zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data);
}
diff --git a/src/text.c b/src/text.c
index 1df25b2..7c37855 100644
--- a/src/text.c
+++ b/src/text.c
@@ -4,7 +4,7 @@
* text.c
*
* Copyright © 2002 Sun Microsystems, Inc.
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -38,11 +38,9 @@
static ZenityTextData *zen_text_data;
-static void zenity_text_dialog_response (GtkWidget *widget, int response,
- gpointer data);
-static void zenity_text_toggle_button (GtkToggleButton *button, gpointer data);
+static void zenity_text_dialog_response (GtkWidget *widget, char *rstr, gpointer data);
+static void zenity_text_toggle_button (GtkCheckButton *button, AdwMessageDialog *dialog);
-// TODO - I don't think gtk4 support for webkit is fully "there" yet.
#ifdef HAVE_WEBKITGTK
static void
zenity_configure_webkit (WebKitWebView *web_view) {
@@ -78,7 +76,6 @@ zenity_configure_webkit (WebKitWebView *web_view) {
NULL);
g_object_set (G_OBJECT (settings), "enable-page-cache", FALSE, NULL);
g_object_set (G_OBJECT (settings), "enable-plugins", FALSE, NULL);
- g_object_set (G_OBJECT (settings), "enable-private-browsing", TRUE, NULL);
/*
Stick to defaults
"enforce-96-dpi" gboolean : Read / Write /
@@ -253,9 +250,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
{
g_autoptr(GtkBuilder) builder = NULL;
GtkWidget *dialog;
- GtkWidget *ok_button;
GtkWidget *checkbox;
- GtkWidget *cancel_button;
GObject *text_view;
GtkTextBuffer *text_buffer;
@@ -268,8 +263,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
#endif
zen_text_data = text_data;
- builder =
- zenity_util_load_ui_file ("zenity_text_dialog", "textbuffer1", NULL);
+ builder = zenity_util_load_ui_file ("zenity_text_dialog", "zenity_text_box", NULL);
if (builder == NULL) {
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
@@ -279,10 +273,6 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
dialog = GTK_WIDGET(gtk_builder_get_object (builder,
"zenity_text_dialog"));
- ok_button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_text_close_button"));
- cancel_button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_text_cancel_button"));
checkbox = GTK_WIDGET(gtk_builder_get_object (builder,
"zenity_text_checkbox"));
@@ -295,8 +285,6 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
gtk_window_set_icon_name (GTK_WINDOW(dialog),
"accessories-text-editor");
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
-
text_buffer = gtk_text_buffer_new (NULL);
text_view = gtk_builder_get_object (builder, "zenity_text_view");
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), text_buffer);
@@ -334,28 +322,24 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
if (data->extra_label)
{
- for (int i = 0; data->extra_label[i] != NULL; ++i)
- {
- gtk_dialog_add_button (GTK_DIALOG(dialog),
- data->extra_label[i], i);
- }
+ ZENITY_UTIL_ADD_EXTRA_LABELS (dialog)
}
if (data->ok_label) {
- gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
+ ZENITY_UTIL_SETUP_OK_BUTTON_LABEL (dialog);
}
- if (data->cancel_label) {
- gtk_button_set_label (GTK_BUTTON (cancel_button), data->cancel_label);
+ if (data->cancel_label)
+ {
+ ZENITY_UTIL_SETUP_CANCEL_BUTTON_LABEL (dialog);
}
if (text_data->checkbox) {
- gtk_widget_set_visible (GTK_WIDGET (checkbox), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (ok_button), FALSE);
- gtk_button_set_label (GTK_BUTTON (checkbox), text_data->checkbox);
+ gtk_widget_set_visible (GTK_WIDGET(checkbox), TRUE);
+ gtk_check_button_set_label (GTK_CHECK_BUTTON(checkbox), text_data->checkbox);
+ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(dialog), "ok", FALSE);
- g_signal_connect (checkbox, "toggled",
- G_CALLBACK(zenity_text_toggle_button), ok_button);
+ g_signal_connect (checkbox, "toggled", G_CALLBACK(zenity_text_toggle_button), dialog);
}
if (data->width > -1 || data->height > -1)
@@ -370,10 +354,13 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-/* TODO once gtk4 support fully lands in webkitgtk. */
#ifdef HAVE_WEBKITGTK
- if (text_data->html) {
- web_kit = webkit_web_view_new ();
+ if (text_data->html)
+ {
+ /* "ephemeral" == private browsing */
+ g_autoptr(WebKitWebContext) wk_context = webkit_web_context_new_ephemeral ();
+
+ web_kit = webkit_web_view_new_with_context (wk_context);
scrolled_window = GTK_WIDGET (
gtk_builder_get_object (builder, "zenity_text_scrolled_window"));
@@ -387,9 +374,9 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
webkit_web_view_load_uri (
WEBKIT_WEB_VIEW (web_kit), text_data->url);
} else {
- g_autoptr char *cwd = NULL;
- g_autoptr char *dirname = NULL;
- g_autoptr char *dirname_uri = NULL;
+ g_autofree char *cwd = NULL;
+ g_autofree char *dirname = NULL;
+ g_autofree char *dirname_uri = NULL;
dirname = text_data->uri ? g_path_get_dirname (text_data->uri)
: g_strdup ("/");
cwd = g_get_current_dir ();
@@ -410,9 +397,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
G_CALLBACK (zenity_text_webview_load_changed),
NULL);
- gtk_widget_destroy (GTK_WIDGET (text_view));
- gtk_container_add (GTK_CONTAINER (scrolled_window), web_kit);
- gtk_widget_show (GTK_WIDGET (web_kit));
+ gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW(scrolled_window), web_kit);
}
#endif /* HAVE_WEBKITGTK */
@@ -428,12 +413,9 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
}
static void
-zenity_text_toggle_button (GtkToggleButton *button, gpointer data)
+zenity_text_toggle_button (GtkCheckButton *button, AdwMessageDialog *dialog)
{
- GtkWidget *ok_button = GTK_WIDGET(data);
-
- gtk_widget_set_sensitive (ok_button,
- gtk_toggle_button_get_active (button));
+ adw_message_dialog_set_response_enabled (dialog, "ok", gtk_check_button_get_active (button));
}
static void
@@ -452,13 +434,14 @@ zenity_text_dialog_output (ZenityData *zen_data)
}
static void
-zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data)
+zenity_text_dialog_response (GtkWidget *widget, char *rstr, gpointer data)
{
ZenityData *zen_data = data;
+ ZenityExitCode response = zenity_util_parse_dialog_response (rstr);
switch (response)
{
- case GTK_RESPONSE_CLOSE:
+ case ZENITY_OK:
zenity_text_dialog_output (zen_data);
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
break;
@@ -468,6 +451,10 @@ zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data)
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_TIMEOUT);
break;
+ case ZENITY_CANCEL:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
default:
if (zen_data->extra_label &&
response < (int)g_strv_length (zen_data->extra_label))
@@ -477,5 +464,5 @@ zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data)
zenity_util_exit_code_with_data (ZENITY_ESC, zen_data);
break;
}
- zenity_util_gapp_quit (GTK_WINDOW(widget));
+ zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data);
}
diff --git a/src/tree.c b/src/tree.c
index 6f07973..aba2a3b 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -4,7 +4,7 @@
* tree.c
*
* Copyright © 2002 Sun Microsystems, Inc.
- * Copyright © 2021 Logan Rathbone
+ * Copyright © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -47,8 +47,7 @@ static GIOChannel *channel;
static int *zenity_tree_extract_column_indexes (char *indexes, int n_columns);
static gboolean zenity_tree_column_is_hidden (int column_index);
-static void zenity_tree_dialog_response (GtkWidget *widget, int response,
- gpointer data);
+static void zenity_tree_dialog_response (GtkWidget *widget, char *rstr, gpointer data);
static void zenity_tree_row_activated (GtkTreeView *tree_view,
GtkTreePath *tree_path, GtkTreeViewColumn *tree_col, gpointer data);
@@ -349,7 +348,6 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
{
g_autoptr(GtkBuilder) builder = NULL;
GtkWidget *dialog;
- GtkWidget *button;
GObject *text;
GtkTreeViewColumn *column;
GtkListStore *model;
@@ -358,7 +356,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
gboolean first_column = FALSE;
int i, column_index, n_columns;
- builder = zenity_util_load_ui_file ("zenity_tree_dialog", NULL);
+ builder = zenity_util_load_ui_file ("zenity_tree_dialog", "zenity_tree_box", NULL);
if (builder == NULL) {
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
@@ -406,8 +404,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
dialog = GTK_WIDGET(gtk_builder_get_object (builder,
"zenity_tree_dialog"));
- g_signal_connect (dialog, "response",
- G_CALLBACK(zenity_tree_dialog_response), data);
+ g_signal_connect (dialog, "response", G_CALLBACK(zenity_tree_dialog_response), data);
if (data->dialog_title)
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
@@ -417,23 +414,15 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
if (data->extra_label)
{
- for (int i = 0; data->extra_label[i] != NULL; ++i)
- {
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- data->extra_label[i], i);
- }
+ ZENITY_UTIL_ADD_EXTRA_LABELS (dialog)
}
if (data->ok_label) {
- button = GTK_WIDGET(gtk_builder_get_object (builder,
- "zenity_tree_ok_button"));
- gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
+ ZENITY_UTIL_SETUP_OK_BUTTON_LABEL (dialog)
}
if (data->cancel_label) {
- button = GTK_WIDGET (gtk_builder_get_object (builder,
- "zenity_tree_cancel_button"));
- gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
+ ZENITY_UTIL_SETUP_CANCEL_BUTTON_LABEL (dialog)
}
text = gtk_builder_get_object (builder, "zenity_tree_text");
@@ -804,18 +793,19 @@ zenity_tree_dialog_output (void)
}
static void
-zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data)
+zenity_tree_dialog_response (GtkWidget *widget, char *rstr, gpointer data)
{
ZenityData *zen_data = data;
+ ZenityExitCode response = zenity_util_parse_dialog_response (rstr);
switch (response)
{
- case GTK_RESPONSE_OK:
+ case ZENITY_OK:
zenity_tree_dialog_output ();
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
break;
- case GTK_RESPONSE_CANCEL:
+ case ZENITY_CANCEL:
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
break;
@@ -839,7 +829,7 @@ zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data)
g_io_channel_shutdown (channel, TRUE, NULL);
}
- zenity_util_gapp_quit (GTK_WINDOW(widget));
+ zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data);
}
static void
@@ -858,7 +848,7 @@ zenity_tree_row_activated (GtkTreeView *loc_tv, GtkTreePath *tree_path,
parent = GTK_WINDOW(gtk_widget_get_native (GTK_WIDGET(tree_view)));
- zenity_util_gapp_quit (parent);
+ zenity_util_gapp_quit (parent, zen_data);
}
static gboolean
diff --git a/src/util.c b/src/util.c
index ec60ba3..1cc21af 100644
--- a/src/util.c
+++ b/src/util.c
@@ -7,7 +7,7 @@
* © 1999, 2000 Red Hat Inc.
* © 1998 James Henstridge
* © 1995-2002 Free Software Foundation
- * © 2021 Logan Rathbone
+ * © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -32,6 +32,7 @@
#include "util.h"
#include "zenity.h"
+
#include <errno.h>
#include <locale.h>
#include <stdarg.h>
@@ -210,8 +211,8 @@ zenity_util_show_help (GError **error) {
}
int
-zenity_util_return_exit_code (ZenityExitCode value) {
-
+zenity_util_return_exit_code (ZenityExitCode value)
+{
const char *env_var = NULL;
int retval;
@@ -416,15 +417,12 @@ zenity_util_show_dialog (GtkWidget *dialog)
}
gboolean
-zenity_util_timeout_handle (gpointer data)
+zenity_util_timeout_handle (AdwMessageDialog *dialog)
{
- GtkDialog *dialog = GTK_DIALOG (data);
-
- if (dialog != NULL) {
- gtk_dialog_response (dialog, ZENITY_TIMEOUT);
+ if (dialog) {
+ adw_message_dialog_response (dialog, "timeout");
}
else {
- zenity_util_gapp_quit (GTK_WINDOW(dialog));
exit (ZENITY_TIMEOUT);
}
return FALSE;
@@ -450,14 +448,61 @@ zenity_util_gapp_main (GtkWindow *window)
}
void
-zenity_util_gapp_quit (GtkWindow *window)
+zenity_util_gapp_quit (GtkWindow *window, ZenityData *data)
{
+ /* This is a bit hack-ish, but GApplication doesn't really allow for
+ * customized exit statuses within that API.
+ */
+ if (data->exit_code != 0)
+ exit (data->exit_code);
+
if (window)
{
g_assert (GTK_IS_WINDOW (window));
- gtk_window_set_application (window, NULL);
+ gtk_window_destroy (window);
}
else {
g_application_release (g_application_get_default ());
}
}
+
+int
+zenity_util_parse_dialog_response (const char *response)
+{
+ if (g_strcmp0 (response, "ok") == 0 || g_strcmp0 (response, "yes") == 0)
+ {
+ return ZENITY_OK;
+ }
+ else if (g_strcmp0 (response, "cancel") == 0 || g_strcmp0 (response, "no") == 0)
+ {
+ return ZENITY_CANCEL;
+ }
+ else if (g_strcmp0 (response, "timeout") == 0)
+ {
+ return ZENITY_TIMEOUT;
+ }
+ else if (response[0] >= '0' && response[0] <= '9')
+ {
+ /* FIXME - atoi returns 0 on error, so this *could* mean the function
+ * failed - but that would be a programmer error, so we'll leave this
+ * in place.
+ */
+ return atoi (response);
+ }
+ else
+ {
+ return ZENITY_ESC;
+ }
+}
+
+GtkWidget *
+zenity_util_add_button (AdwMessageDialog *dialog, const char *button_text,
+ ZenityExitCode response_id)
+{
+ GtkWidget *w = GTK_WIDGET(dialog);
+ g_autofree char *response_str = g_strdup_printf ("%d", response_id);
+
+ adw_message_dialog_add_response (dialog, response_str, button_text);
+
+ return w;
+}
diff --git a/src/util.h b/src/util.h
index fd3d446..5ea703d 100644
--- a/src/util.h
+++ b/src/util.h
@@ -7,7 +7,7 @@
* © 1999, 2000 Red Hat Inc.
* © 1998 James Henstridge
* © 1995-2002 Free Software Foundation
- * © 2021 Logan Rathbone
+ * © 2021-2023 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,8 +33,7 @@
* Tom Tromey <tromey@redhat.com>
*/
-#ifndef UTIL_H
-#define UTIL_H
+#pragma once
#include "zenity.h"
#include <gtk/gtk.h>
@@ -43,6 +42,17 @@ G_BEGIN_DECLS
#define ZENITY_IMAGE_FULLPATH(filename) (PACKAGE_DATADIR "/" filename)
+#define ZENITY_UTIL_ADD_EXTRA_LABELS(DIALOG) \
+ for (int i = 0; data->extra_label[i] != NULL; ++i) { \
+ zenity_util_add_button (ADW_MESSAGE_DIALOG (DIALOG), data->extra_label[i], i); \
+ }
+
+#define ZENITY_UTIL_SETUP_OK_BUTTON_LABEL(DIALOG) \
+ adw_message_dialog_set_response_label (ADW_MESSAGE_DIALOG(DIALOG), "ok", data->ok_label);
+
+#define ZENITY_UTIL_SETUP_CANCEL_BUTTON_LABEL(DIALOG) \
+ adw_message_dialog_set_response_label (ADW_MESSAGE_DIALOG(DIALOG), "cancel", data->cancel_label);
+
GIcon *zenity_util_gicon_from_string (const char *str);
GtkBuilder *zenity_util_load_ui_file (const char *widget_root,
...) G_GNUC_NULL_TERMINATED;
@@ -53,11 +63,12 @@ void zenity_util_show_help (GError **error);
int zenity_util_return_exit_code (ZenityExitCode value);
void zenity_util_exit_code_with_data (ZenityExitCode value, ZenityData *data);
void zenity_util_show_dialog (GtkWidget *widget);
-gboolean zenity_util_timeout_handle (gpointer data);
+gboolean zenity_util_timeout_handle (AdwMessageDialog *dialog);
char *zenity_util_pango_font_description_to_css (PangoFontDescription *desc);
void zenity_util_gapp_main (GtkWindow *window);
-void zenity_util_gapp_quit (GtkWindow *window);
+void zenity_util_gapp_quit (GtkWindow *window, ZenityData *data);
+ZenityExitCode zenity_util_parse_dialog_response (const char *response);
+GtkWidget *zenity_util_add_button (AdwMessageDialog *dialog, const char
+ *button_text, ZenityExitCode response_id);
G_END_DECLS
-
-#endif /* UTIL_H */
diff --git a/src/zenity.gresource.xml b/src/zenity.gresource.xml.in
index 68efa13..4671d46 100644
--- a/src/zenity.gresource.xml
+++ b/src/zenity.gresource.xml.in
@@ -3,7 +3,7 @@
<!-- vim:ts=4 sw=4
-->
<!--
- Copyright © 2021 Logan Rathbone <poprocks@gmail.com>
+ Copyright © 2021-2023 Logan Rathbone <poprocks@gmail.com>
Zenity is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License as
@@ -22,7 +22,7 @@
-->
<gresources>
- <gresource prefix="/org/gnome/Zenity">
+ <gresource prefix="@resource_base_path@">
<file preprocess="xml-stripblanks" compressed="true">zenity.ui</file>
</gresource>
</gresources>
diff --git a/src/zenity.h b/src/zenity.h
index 0316ce5..20cac9f 100644
--- a/src/zenity.h
+++ b/src/zenity.h
@@ -1,15 +1,26 @@
/* vim: colorcolumn=80 ts=4 sw=4
*/
-#ifndef ZENITY_H
-#define ZENITY_H
+#pragma once
-#include <gtk/gtk.h>
+#include <adwaita.h>
#include <glib/gi18n.h>
+#include "zenity-enums.h" /* auto-generated by build system */
+
#include <config.h>
G_BEGIN_DECLS
+typedef enum
+{
+ ZENITY_OK = -1,
+ ZENITY_CANCEL = -2,
+ ZENITY_ESC = -3,
+ ZENITY_ERROR = -4,
+ ZENITY_EXTRA = -5,
+ ZENITY_TIMEOUT = -6
+} ZenityExitCode;
+
typedef struct {
char *dialog_title;
char *ok_label;
@@ -22,15 +33,6 @@ typedef struct {
gboolean modal;
} ZenityData;
-typedef enum {
- ZENITY_OK,
- ZENITY_CANCEL,
- ZENITY_ESC,
- ZENITY_ERROR,
- ZENITY_EXTRA,
- ZENITY_TIMEOUT
-} ZenityExitCode;
-
typedef struct {
char *dialog_text;
int day;
@@ -188,5 +190,3 @@ void zenity_password_dialog (
ZenityData *data, ZenityPasswordData *password_data);
void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data);
G_END_DECLS
-
-#endif /* ZENITY_H */
diff --git a/src/zenity.ui b/src/zenity.ui
index 03f9684..f2bb9b4 100644
--- a/src/zenity.ui
+++ b/src/zenity.ui
@@ -5,748 +5,486 @@
<interface>
<requires lib="gtk" version="4.0"/>
- <object class="GtkAdjustment" id="adjustment1">
+ <object class="AdwMessageDialog" id="zenity_scale_dialog">
+ <property name="title" translatable="yes">Adjust the scale value</property>
+ <property name="default_width">300</property>
+ <property name="default_height">100</property>
+ <property name="extra-child">zenity_scale_box</property>
+ <responses>
+ <response id="cancel" translatable="yes">_Cancel</response>
+ <response id="ok" translatable="yes">_OK</response>
+ </responses>
+ </object>
+ <object class="GtkAdjustment" id="zenity_scale_adjustment">
<property name="upper">100</property>
<property name="step_increment">1</property>
<property name="page_increment">1</property>
</object>
- <object class="GtkDialog" id="zenity_scale_dialog">
- <property name="visible">1</property>
- <property name="can_focus">0</property>
- <property name="title" translatable="yes">Adjust the scale value</property>
- <property name="default_width">300</property>
- <property name="default_height">100</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox11">
- <property name="can_focus">0</property>
- <child>
- <object class="GtkBox" id="vbox13">
- <property name="can_focus">0</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="zenity_scale_text">
- <property name="valign">center</property>
- <property name="can_focus">0</property>
- <property name="label" translatable="yes">Adjust the scale value</property>
- <property name="xalign">0</property>
- </object>
- </child>
- <child>
- <object class="GtkScale" id="zenity_scale_hscale">
- <property name="hexpand">true</property>
- <property name="draw-value">1</property>
- <property name="adjustment">adjustment1</property>
- <property name="digits">0</property>
- <property name="value_pos">right</property>
- </object>
- </child>
- </object>
- </child>
+ <object class="GtkBox" id="zenity_scale_box">
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="zenity_scale_text">
+ <property name="valign">center</property>
+ <property name="vexpand">true</property>
+ <property name="label" translatable="yes">Adjust the scale value</property>
+ <property name="xalign">0</property>
</object>
</child>
- <action-widgets>
- <action-widget response="-6">zenity_scale_cancel_button</action-widget>
- <action-widget response="-5" default="true">zenity_scale_ok_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
- <object class="GtkBox" id="dialog-action_area11">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="zenity_scale_cancel_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_Cancel</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="zenity_scale_ok_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
- </object>
- </child>
+ <child>
+ <object class="GtkScale" id="zenity_scale_hscale">
+ <property name="hexpand">true</property>
+ <property name="draw-value">1</property>
+ <property name="adjustment">zenity_scale_adjustment</property>
+ <property name="digits">0</property>
+ <property name="value_pos">right</property>
</object>
</child>
</object>
- <object class="GtkTextBuffer" id="textbuffer1"/>
- <object class="GtkDialog" id="zenity_text_dialog">
- <property name="can_focus">0</property>
+ <object class="AdwMessageDialog" id="zenity_text_dialog">
<property name="title" translatable="yes">Text View</property>
<property name="default_width">300</property>
<property name="default_height">200</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox5">
- <property name="can_focus">0</property>
- <property name="spacing">2</property>
+ <property name="resizable">true</property>
+ <property name="extra-child">zenity_text_box</property>
+ <responses>
+ <response id="cancel" translatable="yes">_Cancel</response>
+ <response id="ok" translatable="yes">_OK</response>
+ </responses>
+ </object>
+ <object class="GtkBox" id="zenity_text_box">
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkBox" id="vbox5">
+ <property name="hexpand">1</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkBox" id="vbox5">
- <property name="hexpand">1</property>
- <property name="can_focus">0</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkScrolledWindow" id="zenity_text_scrolled_window">
- <property name="vexpand">1</property>
- <property name="child">
- <object class="GtkTextView" id="zenity_text_view">
- <property name="pixels_above_lines">2</property>
- <property name="pixels_below_lines">2</property>
- <property name="editable">0</property>
- <property name="wrap_mode">word</property>
- <property name="left_margin">2</property>
- <property name="right_margin">2</property>
- <property name="buffer">textbuffer1</property>
- </object>
- </property>
- </object>
- </child>
- <child>
- <object class="GtkCheckButton" id="zenity_text_checkbox">
- <property name="valign">center</property>
- <property name="visible">0</property>
+ <object class="GtkScrolledWindow" id="zenity_text_scrolled_window">
+ <property name="vexpand">1</property>
+ <property name="child">
+ <object class="GtkTextView" id="zenity_text_view">
+ <property name="editable">false</property>
+ <property name="wrap_mode">word</property>
</object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_text_cancel_button</action-widget>
- <action-widget response="-7" default="true">zenity_text_close_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
- <object class="GtkBox" id="dialog-action_area5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="zenity_text_cancel_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_Cancel</property>
+ </property>
</object>
</child>
<child>
- <object class="GtkButton" id="zenity_text_close_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
+ <object class="GtkCheckButton" id="zenity_text_checkbox">
+ <property name="valign">center</property>
+ <property name="visible">0</property>
</object>
</child>
</object>
</child>
</object>
- <object class="GtkDialog" id="zenity_calendar_dialog">
- <property name="can_focus">0</property>
+ <object class="AdwMessageDialog" id="zenity_calendar_dialog">
<property name="title" translatable="yes">Calendar selection</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox2">
- <property name="can_focus">0</property>
- <property name="spacing">2</property>
+ <property name="extra-child">zenity_calendar_box</property>
+ <responses>
+ <response id="cancel" translatable="yes">_Cancel</response>
+ <response id="ok" translatable="yes">_OK</response>
+ </responses>
+ </object>
+ <object class="GtkBox" id="zenity_calendar_box">
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkBox" id="vbox1">
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkBox" id="vbox1">
- <property name="can_focus">0</property>
- <property name="orientation">vertical</property>
+ <object class="GtkBox" id="vbox2">
+ <property name="vexpand">1</property>
<property name="spacing">6</property>
<child>
- <object class="GtkBox" id="vbox2">
- <property name="vexpand">1</property>
- <property name="can_focus">0</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="zenity_calendar_text">
- <property name="halign">center</property>
- <property name="can_focus">0</property>
- <property name="label" translatable="yes">Select a date from below.</property>
- <property name="wrap">1</property>
- <property name="xalign">0</property>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_calendar_label">
- <property name="valign">center</property>
- <property name="can_focus">0</property>
- <property name="label" translatable="yes">C_alendar:</property>
- <property name="use_underline">1</property>
- <property name="mnemonic_widget">zenity_calendar</property>
+ <object class="GtkLabel" id="zenity_calendar_text">
+ <property name="halign">center</property>
+ <property name="label" translatable="yes">Select a date from below.</property>
+ <property name="wrap">1</property>
<property name="xalign">0</property>
- <accessibility>
- <property name="label" translatable="yes">Calendar</property>
- <relation name="labelled-by">zenity_calendar</relation>
- </accessibility>
- </object>
- </child>
- <child>
- <object class="GtkCalendar" id="zenity_calendar">
- <property name="valign">center</property>
</object>
</child>
</object>
</child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_calendar_cancel_button</action-widget>
- <action-widget response="-5" default="true">zenity_calendar_ok_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
- <object class="GtkBox" id="dialog-action_area2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<child>
- <object class="GtkButton" id="zenity_calendar_cancel_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_Cancel</property>
+ <object class="GtkLabel" id="zenity_calendar_label">
+ <property name="valign">center</property>
+ <property name="label" translatable="yes">C_alendar:</property>
+ <property name="use_underline">1</property>
+ <property name="mnemonic_widget">zenity_calendar</property>
+ <property name="xalign">0</property>
+ <accessibility>
+ <property name="label" translatable="yes">Calendar</property>
+ <relation name="labelled-by">zenity_calendar</relation>
+ </accessibility>
</object>
</child>
<child>
- <object class="GtkButton" id="zenity_calendar_ok_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
+ <object class="GtkCalendar" id="zenity_calendar">
+ <property name="valign">center</property>
+ <property name="vexpand">true</property>
</object>
</child>
</object>
</child>
</object>
- <object class="GtkDialog" id="zenity_entry_dialog">
- <property name="can_focus">0</property>
+ <object class="AdwMessageDialog" id="zenity_entry_dialog">
<property name="title" translatable="yes">Add a new entry</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox4">
- <property name="can_focus">0</property>
- <property name="orientation">vertical</property>
- <property name="spacing">2</property>
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="margin-bottom">12</property>
- <property name="margin-top">12</property>
- <child>
- <object class="GtkBox" id="vbox3">
- <property name="can_focus">0</property>
+ <property name="extra-child">zenity_entry_box</property>
+ <responses>
+ <response id="cancel" translatable="yes">_Cancel</response>
+ <response id="ok" translatable="yes">_OK</response>
+ </responses>
+ </object>
+ <object class="GtkBox" id="zenity_entry_box">
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
+ <object class="GtkBox" id="vbox3">
+ <child>
+ <object class="GtkBox" id="vbox4">
+ <property name="hexpand">1</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkBox" id="vbox4">
- <property name="hexpand">1</property>
- <property name="can_focus">0</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="zenity_entry_text">
- <property name="valign">center</property>
- <property name="can_focus">0</property>
- <property name="label" translatable="yes">_Enter new text:</property>
- <property name="use_underline">1</property>
- <property name="xalign">0</property>
- </object>
- </child>
- <child>
- <placeholder/>
- </child>
+ <object class="GtkLabel" id="zenity_entry_text">
+ <property name="valign">center</property>
+ <property name="label" translatable="yes">_Enter new text:</property>
+ <property name="use_underline">1</property>
+ <property name="xalign">0</property>
</object>
</child>
- </object>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_entry_cancel_button</action-widget>
- <action-widget response="-5" default="true">zenity_entry_ok_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
- <object class="GtkBox" id="dialog-action_area4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="zenity_entry_cancel_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_Cancel</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="zenity_entry_ok_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- <object class="GtkDialog" id="zenity_error_dialog">
- <property name="can_focus">0</property>
- <property name="title" translatable="yes">Error</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox7">
- <property name="can_focus">0</property>
- <property name="spacing">14</property>
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="margin-bottom">12</property>
- <property name="margin-top">12</property>
- <child>
- <object class="GtkBox" id="vbox8">
- <property name="can_focus">0</property>
<child>
- <object class="GtkBox" id="hbox3">
- <property name="hexpand">1</property>
- <property name="can_focus">0</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage" id="zenity_error_image">
- <property name="halign">center</property>
- <property name="can_focus">0</property>
- <property name="icon_name">dialog-error</property>
- <property name="icon_size">large</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_error_text">
- <property name="halign">center</property>
- <property name="label" translatable="yes">An error has occurred.</property>
- <property name="wrap">1</property>
- <property name="selectable">1</property>
- <property name="yalign">0</property>
- </object>
- </child>
- </object>
+ <placeholder/>
</child>
</object>
</child>
</object>
</child>
- <action-widgets>
- <action-widget response="-5" default="true">zenity_error_ok_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
- <object class="GtkBox" id="dialog-action_area7">
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="zenity_error_ok_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
- </object>
- </child>
- </object>
- </child>
</object>
- <object class="GtkDialog" id="zenity_forms_dialog">
- <property name="can_focus">0</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox12">
- <property name="can_focus">0</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkFrame" id="frame1">
- <property name="can_focus">0</property>
- <property name="child">
- <object class="GtkGrid" id="zenity_forms_grid">
- <property name="can_focus">0</property>
- <property name="margin-start">12</property>
- <property name="margin-end">6</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">6</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">10</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- </property>
- <child type="label">
- <object class="GtkLabel" id="zenity_forms_text">
- <property name="can_focus">0</property>
- <property name="label" translatable="yes">Forms dialog</property>
- <attributes>
- <attribute name="weight" value="bold"></attribute>
- </attributes>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_forms_cancel_button</action-widget>
- <action-widget response="-5" default="true">zenity_forms_ok_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
- <object class="GtkBox" id="dialog-action_area12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="zenity_forms_cancel_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_Cancel</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="zenity_forms_ok_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
- </object>
- </child>
- </object>
- </child>
+ <object class="AdwMessageDialog" id="zenity_error_dialog">
+ <property name="title" translatable="yes">Error</property>
+ <property name="extra-child">zenity_error_box</property>
+ <responses>
+ <response id="ok" translatable="yes">_OK</response>
+ </responses>
</object>
- <object class="GtkDialog" id="zenity_info_dialog">
- <property name="can_focus">0</property>
- <property name="title" translatable="yes">Information</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox9">
- <property name="can_focus">0</property>
- <property name="spacing">14</property>
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="margin-bottom">12</property>
- <property name="margin-top">12</property>
-
- <child>
- <object class="GtkBox" id="hbox4">
- <property name="can_focus">0</property>
+ <object class="GtkBox" id="zenity_error_box">
+ <property name="spacing">14</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
+ <object class="GtkBox" id="vbox8">
+ <child>
+ <object class="GtkBox" id="hbox3">
+ <property name="hexpand">1</property>
<property name="spacing">12</property>
<child>
- <object class="GtkImage" id="zenity_info_image">
+ <object class="GtkImage" id="zenity_error_image">
<property name="halign">center</property>
- <property name="can_focus">0</property>
- <property name="icon_name">dialog-information</property>
+ <property name="icon_name">dialog-error</property>
<property name="icon_size">large</property>
</object>
</child>
<child>
- <object class="GtkLabel" id="zenity_info_text">
+ <object class="GtkLabel" id="zenity_error_text">
<property name="halign">center</property>
- <property name="label" translatable="yes">All updates are complete.</property>
- <property name="wrap">1</property>
- <property name="selectable">1</property>
- <property name="yalign">0</property>
+ <property name="label" translatable="yes">An error has occurred.</property>
+ <property name="wrap">true</property>
+ <property name="selectable">true</property>
+ <property name="can-focus">false</property>
</object>
</child>
</object>
</child>
</object>
</child>
- <action-widgets>
- <action-widget response="-5" default="true">zenity_info_ok_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
- <object class="GtkBox" id="dialog-action_area3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="zenity_info_ok_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
- </object>
- </child>
- </object>
- </child>
</object>
- <object class="GtkDialog" id="zenity_progress_dialog">
- <property name="can_focus">0</property>
- <property name="title" translatable="yes">Progress</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox6">
- <property name="can_focus">0</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkBox" id="vbox7">
- <property name="halign">center</property>
- <property name="can_focus">0</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <object class="AdwMessageDialog" id="zenity_forms_dialog">
+ <property name="extra-child">zenity_forms_box</property>
+ <responses>
+ <response id="cancel" translatable="yes">_Cancel</response>
+ <response id="ok" translatable="yes">_OK</response>
+ </responses>
+ </object>
+ <object class="GtkBox" id="zenity_forms_box">
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="child">
+ <object class="GtkGrid" id="zenity_forms_grid">
+ <property name="margin-start">12</property>
+ <property name="margin-end">6</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">6</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">10</property>
<child>
- <object class="GtkLabel" id="zenity_progress_text">
- <property name="valign">center</property>
- <property name="can_focus">0</property>
- <property name="label" translatable="yes">Running...</property>
- <property name="wrap">1</property>
- <property name="xalign">0</property>
- </object>
+ <placeholder/>
</child>
<child>
- <object class="GtkProgressBar" id="zenity_progress_bar">
- <property name="valign">center</property>
- <property name="can_focus">0</property>
- <property name="pulse_step">0.10000000149</property>
- </object>
+ <placeholder/>
</child>
<child>
- <object class="GtkLabel" id="zenity_progress_time">
- <property name="valign">center</property>
- <property name="can_focus">0</property>
- <property name="xalign">0</property>
- </object>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
</child>
</object>
+ </property>
+ <child type="label">
+ <object class="GtkLabel" id="zenity_forms_text">
+ <property name="label" translatable="yes">Forms dialog</property>
+ <attributes>
+ <attribute name="weight" value="bold"></attribute>
+ </attributes>
+ </object>
</child>
</object>
</child>
- <action-widgets>
- <action-widget response="-6">zenity_progress_cancel_button</action-widget>
- <action-widget response="-5" default="true">zenity_progress_ok_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
- <object class="GtkBox" id="dialog-action_area6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkButton" id="zenity_progress_cancel_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_Cancel</property>
+ </object>
+ <object class="AdwMessageDialog" id="zenity_info_dialog">
+ <property name="title" translatable="yes">Information</property>
+ <property name="extra-child">zenity_info_box</property>
+ <responses>
+ <response id="ok" translatable="yes">_OK</response>
+ </responses>
+ </object>
+ <object class="GtkBox" id="zenity_info_box">
+ <property name="spacing">14</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
+ <object class="GtkBox" id="hbox4">
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="zenity_info_image">
+ <property name="halign">center</property>
+ <property name="icon_name">dialog-information</property>
+ <property name="icon_size">large</property>
</object>
</child>
<child>
- <object class="GtkButton" id="zenity_progress_ok_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
- <property name="sensitive">0</property>
+ <object class="GtkLabel" id="zenity_info_text">
+ <property name="halign">center</property>
+ <property name="vexpand">true</property>
+ <property name="label" translatable="yes">All updates are complete.</property>
+ <property name="wrap">true</property>
+ <property name="selectable">true</property>
+ <property name="can-focus">false</property>
</object>
</child>
</object>
</child>
</object>
- <object class="GtkDialog" id="zenity_question_dialog">
- <property name="can_focus">0</property>
- <property name="title" translatable="yes">Question</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox3">
- <property name="can_focus">0</property>
- <property name="spacing">14</property>
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="margin-bottom">12</property>
- <property name="margin-top">12</property>
+ <object class="AdwMessageDialog" id="zenity_progress_dialog">
+ <property name="title" translatable="yes">Progress</property>
+ <property name="extra-child">zenity_progress_box</property>
+ </object>
+ <object class="GtkBox" id="zenity_progress_box">
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkBox" id="vbox7">
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkBox" id="hbox1">
- <property name="can_focus">0</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage" id="zenity_question_image">
- <property name="can_focus">0</property>
- <property name="icon_name">dialog-question</property>
- <property name="icon_size">large</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_question_text">
- <property name="halign">center</property>
- <property name="label" translatable="yes">Are you sure you want to proceed?</property>
- <property name="wrap">1</property>
- <property name="selectable">1</property>
- <property name="yalign">0</property>
- </object>
- </child>
+ <object class="GtkLabel" id="zenity_progress_text">
+ <property name="valign">center</property>
+ <property name="label" translatable="yes">Running...</property>
+ <property name="wrap">1</property>
+ <property name="xalign">0</property>
</object>
</child>
- </object>
-
- </child>
- <child internal-child="action_area">
- <object class="GtkBox" id="zenity_question_button_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- </child>
- </object>
- <object class="GtkDialog" id="zenity_tree_dialog">
- <property name="can_focus">0</property>
- <property name="title" translatable="yes">Select items from the list</property>
- <property name="default_width">300</property>
- <property name="default_height">196</property>
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox8">
- <property name="can_focus">0</property>
<child>
- <object class="GtkBox" id="vbox10">
- <property name="can_focus">0</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="zenity_tree_text">
- <property name="valign">center</property>
- <property name="can_focus">0</property>
- <property name="label" translatable="yes">Select items from the list below.</property>
- <property name="xalign">0</property>
- </object>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="zenity_tree_window">
- <property name="hexpand">1</property>
- <property name="vexpand">1</property>
- <property name="child">
- <object class="GtkTreeView" id="zenity_tree_view">
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection1"/>
- </child>
- </object>
- </property>
- </object>
- </child>
+ <object class="GtkProgressBar" id="zenity_progress_bar">
+ <property name="valign">center</property>
+ <property name="hexpand">true</property>
+ <property name="pulse_step">0.10000000149</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="zenity_progress_time">
+ <property name="valign">center</property>
+ <property name="xalign">0</property>
</object>
</child>
</object>
</child>
- <action-widgets>
- <action-widget response="-6">zenity_tree_cancel_button</action-widget>
- <action-widget response="-5" default="true">zenity_tree_ok_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
- <object class="GtkBox" id="dialog-action_area8">
- <property name="can_focus">False</property>
+ </object>
+ <object class="AdwMessageDialog" id="zenity_question_dialog">
+ <property name="title" translatable="yes">Question</property>
+ <property name="extra-child">zenity_question_box</property>
+ <responses>
+ <response id="no" translatable="yes">_No</response>
+ <response id="yes" translatable="yes">_Yes</response>
+ </responses>
+ </object>
+ <object class="GtkBox" id="zenity_question_box">
+ <property name="spacing">14</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
+ <object class="GtkBox" id="hbox1">
+ <property name="spacing">12</property>
<child>
- <object class="GtkButton" id="zenity_tree_cancel_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_Cancel</property>
+ <object class="GtkImage" id="zenity_question_image">
+ <property name="icon_name">dialog-question</property>
+ <property name="icon_size">large</property>
</object>
</child>
<child>
- <object class="GtkButton" id="zenity_tree_ok_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
+ <object class="GtkLabel" id="zenity_question_text">
+ <property name="halign">center</property>
+ <property name="vexpand">true</property>
+ <property name="label" translatable="yes">Are you sure you want to proceed?</property>
+ <property name="wrap">true</property>
+ <property name="selectable">true</property>
+ <property name="can-focus">false</property>
</object>
</child>
</object>
</child>
</object>
- <object class="GtkDialog" id="zenity_warning_dialog">
- <property name="can_focus">0</property>
- <property name="title" translatable="yes">Warning</property>
- <property name="resizable">false</property>
-
- <child internal-child="content_area">
- <object class="GtkBox" id="dialog-vbox1">
- <property name="can_focus">0</property>
- <property name="spacing">14</property>
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="margin-bottom">12</property>
- <property name="margin-top">12</property>
+ <object class="AdwMessageDialog" id="zenity_tree_dialog">
+ <property name="title" translatable="yes">Select items from the list</property>
+ <property name="default_width">300</property>
+ <property name="default_height">196</property>
+ <property name="extra-child">zenity_tree_box</property>
+ <property name="resizable">true</property>
+ <responses>
+ <response id="cancel" translatable="yes">_Cancel</response>
+ <response id="ok" translatable="yes">_OK</response>
+ </responses>
+ </object>
+ <object class="GtkBox" id="zenity_tree_box">
+ <child>
+ <object class="GtkBox" id="vbox10">
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkBox" id="hbox2">
- <property name="can_focus">0</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage" id="zenity_warning_image">
- <property name="can_focus">0</property>
- <property name="icon_name">dialog-warning</property>
- <property name="icon_size">large</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_warning_text">
- <property name="halign">center</property>
- <property name="vexpand">true</property>
- <property name="hexpand">true</property>
- <property name="label" translatable="yes">Are you sure you want to proceed?</property>
- <property name="wrap">1</property>
- <property name="selectable">1</property>
- </object>
- </child>
+ <object class="GtkLabel" id="zenity_tree_text">
+ <property name="valign">center</property>
+ <property name="label" translatable="yes">Select items from the list below.</property>
+ <property name="xalign">0</property>
</object>
</child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-5" default="true">zenity_warning_ok_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
- <object class="GtkBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<child>
- <object class="GtkButton" id="zenity_warning_ok_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
+ <object class="GtkScrolledWindow" id="zenity_tree_window">
+ <property name="hexpand">1</property>
+ <property name="vexpand">1</property>
+ <property name="child">
+ <object class="GtkTreeView" id="zenity_tree_view">
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
+ </object>
+ </property>
</object>
</child>
</object>
</child>
</object>
-
-
-
-
-
-
-
- <object class="GtkDialog" id="zenity_password_dialog">
+ <object class="AdwMessageDialog" id="zenity_warning_dialog">
<property name="title" translatable="yes">Warning</property>
<property name="resizable">false</property>
-
- <child internal-child="content_area">
- <object class="GtkBox"> <!-- vbox -->
- <property name="orientation">vertical</property>
- <property name="spacing">14</property>
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="margin-bottom">12</property>
- <property name="margin-top">12</property>
+ <property name="extra-child">zenity_warning_box</property>
+ <responses>
+ <response id="ok" translatable="yes">_OK</response>
+ </responses>
+ </object>
+ <object class="GtkBox" id="zenity_warning_box">
+ <property name="spacing">14</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
+ <object class="GtkBox" id="hbox2">
+ <property name="spacing">12</property>
<child>
- <object class="GtkBox">
- <property name="orientation">horizontal</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage" id="zenity_password_image">
- <property name="icon_name">dialog-password</property>
- <property name="icon_size">large</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_password_title">
- <property name="label" translatable="yes">Type your password</property>
- </object>
- </child>
+ <object class="GtkImage" id="zenity_warning_image">
+ <property name="icon_name">dialog-warning</property>
+ <property name="icon_size">large</property>
</object>
</child>
<child>
- <object class="GtkGrid" id="zenity_password_grid">
- <property name="column-spacing">12</property>
- <property name="row-spacing">6</property>
+ <object class="GtkLabel" id="zenity_warning_text">
+ <property name="halign">center</property>
+ <property name="vexpand">true</property>
+ <property name="hexpand">true</property>
+ <property name="label" translatable="yes">Are you sure you want to proceed?</property>
+ <property name="wrap">true</property>
+ <property name="selectable">true</property>
+ <property name="can-focus">false</property>
</object>
</child>
- </object> <!-- !vbox -->
+ </object>
</child>
- <action-widgets>
- <action-widget response="ok" default="true">zenity_password_ok_button</action-widget>
- <action-widget response="cancel">zenity_password_cancel_button</action-widget>
- </action-widgets>
- <child internal-child="action_area">
+ </object>
+ <object class="AdwMessageDialog" id="zenity_password_dialog">
+ <property name="title" translatable="yes">Warning</property>
+ <property name="resizable">false</property>
+ <property name="extra-child">zenity_password_box</property>
+ <responses>
+ <response id="cancel" translatable="yes">_Cancel</response>
+ <response id="ok" translatable="yes">_OK</response>
+ </responses>
+ </object>
+ <object class="GtkBox" id="zenity_password_box">
+ <property name="orientation">vertical</property>
+ <property name="spacing">14</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="orientation">horizontal</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkButton" id="zenity_password_ok_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_OK</property>
+ <object class="GtkImage" id="zenity_password_image">
+ <property name="icon_name">dialog-password</property>
+ <property name="icon_size">large</property>
</object>
</child>
<child>
- <object class="GtkButton" id="zenity_password_cancel_button">
- <property name="use-underline">true</property>
- <property name="label" translatable="yes">_Cancel</property>
+ <object class="GtkLabel" id="zenity_password_title">
+ <property name="label" translatable="yes">Type your password</property>
</object>
</child>
</object>
</child>
- </object>
+ <child>
+ <object class="GtkGrid" id="zenity_password_grid">
+ <property name="column-spacing">12</property>
+ <property name="row-spacing">6</property>
+ </object>
+ </child>
+ </object> <!-- !vbox -->
</interface>