From 011783da148ce9c81d042feecd202f6935f7ef71 Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Thu, 19 Jan 2023 14:07:34 -0500 Subject: Initial port to libadwaita --- data/meson.build | 23 +- data/zenity.1 | 94 ----- data/zenity.roff | 60 +++ meson.build | 6 +- src/about.c | 6 +- src/calendar.c | 37 +- src/color.c | 21 +- src/entry.c | 34 +- src/fileselection.c | 25 +- src/forms.c | 37 +- src/main.c | 13 +- src/meson.build | 21 +- src/msg.c | 74 +--- src/notification.c | 2 +- src/option.h | 2 +- src/password.c | 38 +- src/progress.c | 86 ++-- src/scale.c | 38 +- src/text.c | 54 +-- src/tree.c | 36 +- src/util.c | 67 ++- src/util.h | 25 +- src/zenity.gresource.xml | 28 -- src/zenity.gresource.xml.in | 28 ++ src/zenity.h | 28 +- src/zenity.ui | 967 ++++++++++++++++---------------------------- 26 files changed, 753 insertions(+), 1097 deletions(-) delete mode 100644 data/zenity.1 create mode 100644 data/zenity.roff delete mode 100644 src/zenity.gresource.xml create mode 100644 src/zenity.gresource.xml.in 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.1 deleted file mode 100644 index 6f7f9bf..0000000 --- a/data/zenity.1 +++ /dev/null @@ -1,94 +0,0 @@ -.TH ZENITY 1 "January 2022" -.SH NAME -zenity \- display GTK+ dialogs -.SH SYNOPSIS -.B zenity -.RI [ options ] -.SH 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 -from the user, from all manner of shell scripts. -.PP -For example, \fBzenity \-\-question\fP will return either 0, 1 or 5, -depending on whether the user pressed \fIOK\fP, \fICancel\fP or timeout -has been reached. \fBzenity \-\-entry\fP will output on standard output -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 - -Display a file selector with the title \fISelect a file to -remove\fP. The file selected is returned on standard output. -.IP -zenity \-\-title="Select a file to remove" \-\-file-selection -.PP -Display a text entry dialog with the title \fISelect Host\fP and the -text \fISelect the host you would like to flood-ping\fP. The entered -text is returned on standard output. -.IP -zenity \-\-title "Select Host" \-\-entry \-\-text "Select the host you would like to flood-ping" -.PP -Display a dialog, asking \fIMicrosoft Windows has been found! Would -you like to remove it?\fP. The return code will be 0 (true in shell) -if \fIOK\fP is selected, and 1 (false) if \fICancel\fP is selected. -.IP -zenity \-\-question \-\-title "Alert" \-\-text "Microsoft Windows has been found! Would you like to remove it?" -.PP -Show the search results in a list dialog with the title \fISearch Results\fP -and the text \fIFinding all header files...\fP. -.IP -find . \-name '*.h' | zenity \-\-list \-\-title "Search Results" \-\-text "Finding all header files.." \-\-column "Files" -.PP -Show a passive notification -.IP -zenity \-\-notification \-\-icon=software-update-available \-\-text "System update necessary!" -.PP -Display a weekly shopping list in a check list dialog with \fIApples\fP and \fIOranges\fP pre selected -.IP -zenity \-\-list \-\-checklist \-\-column "Buy" \-\-column "Item" TRUE Apples TRUE Oranges FALSE Pears FALSE Toothpaste -.PP -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 . -.P -This manual page was written by Ross Burton . - -.SH SEE ALSO -\fBdialog\fP(1) diff --git a/data/zenity.roff b/data/zenity.roff new file mode 100644 index 0000000..36d7596 --- /dev/null +++ b/data/zenity.roff @@ -0,0 +1,60 @@ +[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 +from the user, from all manner of shell scripts. +.PP +For example, \fBzenity \-\-question\fP will return either 0, 1 or 5, +depending on whether the user pressed \fIOK\fP, \fICancel\fP or timeout +has been reached. \fBzenity \-\-entry\fP will output on standard output +what the user typed into the text entry field. +.PP +Comprehensive documentation is also available in the GNOME Help Browser. + +[examples] + +Display a file selector with the title \fISelect a file to +remove\fP. The file selected is returned on standard output. +.IP +zenity \-\-title="Select a file to remove" \-\-file-selection +.PP +Display a text entry dialog with the title \fISelect Host\fP and the +text \fISelect the host you would like to flood-ping\fP. The entered +text is returned on standard output. +.IP +zenity \-\-title "Select Host" \-\-entry \-\-text "Select the host you would like to flood-ping" +.PP +Display a dialog, asking \fIMicrosoft Windows has been found! Would +you like to remove it?\fP. The return code will be 0 (true in shell) +if \fIOK\fP is selected, and 1 (false) if \fICancel\fP is selected. +.IP +zenity \-\-question \-\-title "Alert" \-\-text "Microsoft Windows has been found! Would you like to remove it?" +.PP +Show the search results in a list dialog with the title \fISearch Results\fP +and the text \fIFinding all header files...\fP. +.IP +find . \-name '*.h' | zenity \-\-list \-\-title "Search Results" \-\-text "Finding all header files.." \-\-column "Files" +.PP +Show a passive notification +.IP +zenity \-\-notification \-\-icon=software-update-available \-\-text "System update necessary!" +.PP +Display a weekly shopping list in a check list dialog with \fIApples\fP and \fIOranges\fP pre selected +.IP +zenity \-\-list \-\-checklist \-\-column "Buy" \-\-column "Item" TRUE Apples TRUE Oranges FALSE Pears FALSE Toothpaste +.PP +Display a progress dialog while searching for all the postscript files in your home directory +.P +find $HOME \-name '*.ps' | zenity \-\-progress \-\-pulsate + +[author] + +.PP +\fBZenity\fP was originally written by Glynn Foster . It has since been maintained by a number of contributors since then. +.PP +This manual page was originally written by Ross Burton . It currently contains portions which are automatically generated, and other portions written by its original author. + +[see also] + +\fBdialog\fP(1) diff --git a/meson.build b/meson.build index 94ec245..97d0284 100644 --- a/meson.build +++ b/meson.build @@ -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 @@ -85,6 +86,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/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..667c1ad 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 @@ -32,8 +32,7 @@ static ZenityData *zen_data; -static void zenity_colorselection_dialog_response (GtkWidget *widget, - int response, gpointer data); +static void zenity_colorselection_dialog_response (GtkWidget *widget, char *rstr, gpointer data); void zenity_colorselection (ZenityData *data, ZenityColorData *color_data) @@ -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,20 +76,20 @@ 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, char *rstr, gpointer data) { GdkRGBA color; + 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); gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color); g_print ("%s\n", gdk_rgba_to_string (&color)); break; - case GTK_RESPONSE_CANCEL: + case ZENITY_CANCEL: zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL); break; @@ -105,5 +100,5 @@ 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); } 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 -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..4cf544d 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,14 @@ #include +/* GtkFileChooser deprecated in 4.10, but we want to maintain backwards + * compatibility with GTK 4.0. + */ +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, char *rstr, gpointer data); void zenity_fileselection (ZenityData *data, ZenityFileData *file_data) @@ -63,8 +67,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 +182,11 @@ zenity_fileselection_dialog_output (GtkFileChooser *chooser, } static void -zenity_fileselection_dialog_response (GtkDialog *dialog, - int response, gpointer data) +zenity_fileselection_dialog_response (GtkWidget *widget, char *rstr, gpointer data) { ZenityFileData *file_data = data; - GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog); + GtkFileChooser *chooser = GTK_FILE_CHOOSER (widget); + ZenityExitCode response = zenity_util_parse_dialog_response (rstr); switch (response) { @@ -192,7 +195,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 +212,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..f3ce547 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")); @@ -441,18 +433,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 +461,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..b224bf1 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 +#include #include #include @@ -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,9 +125,6 @@ command_line_cb (GtkApplication *app, exit (-1); } - g_application_command_line_set_exit_status (command_line, - results->data->exit_code); - g_free (args); } @@ -135,7 +132,7 @@ int main (int argc, char *argv[]) { ZenityArgs *args; - g_autoptr(GtkApplication) app = NULL; + g_autoptr(AdwApplication) app = NULL; int status; /* */ @@ -150,7 +147,7 @@ main (int argc, char *argv[]) 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..0c03b31 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, 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..f539c7a 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,9 +38,8 @@ 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 @@ -253,9 +252,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 +265,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 +275,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 +287,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 +324,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) @@ -428,12 +414,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 +435,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_ESC: zenity_text_dialog_output (zen_data); zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK); break; @@ -477,5 +461,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 #include #include @@ -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 */ -#ifndef UTIL_H -#define UTIL_H +#pragma once #include "zenity.h" #include @@ -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 deleted file mode 100644 index 68efa13..0000000 --- a/src/zenity.gresource.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - zenity.ui - - diff --git a/src/zenity.gresource.xml.in b/src/zenity.gresource.xml.in new file mode 100644 index 0000000..4671d46 --- /dev/null +++ b/src/zenity.gresource.xml.in @@ -0,0 +1,28 @@ + + + + + + + + zenity.ui + + 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 +#include #include +#include "zenity-enums.h" /* auto-generated by build system */ + #include 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..7fcbb02 100644 --- a/src/zenity.ui +++ b/src/zenity.ui @@ -5,748 +5,485 @@ - + + Adjust the scale value + 300 + 100 + zenity_scale_box + + _Cancel + _OK + + + 100 1 1 - - 1 - 0 - Adjust the scale value - 300 - 100 - - - 0 - - - 0 - vertical - 6 - - - center - 0 - Adjust the scale value - 0 - - - - - true - 1 - adjustment1 - 0 - right - - - - + + vertical + 6 + + + center + true + Adjust the scale value + 0 - - zenity_scale_cancel_button - zenity_scale_ok_button - - - - True - False - - - true - _Cancel - - - - - true - _OK - - + + + true + 1 + zenity_scale_adjustment + 0 + right - - - 0 + Text View 300 200 - - - 0 - 2 + zenity_text_box + + _Cancel + _OK + + + + 2 + + + 1 + vertical - - 1 - 0 - vertical - - - 1 - - - 2 - 2 - 0 - word - 2 - 2 - textbuffer1 - - - - - - - center - 0 + + 1 + + + false + word - - - - - - - zenity_text_cancel_button - zenity_text_close_button - - - - True - False - - - true - _Cancel + - - true - _OK + + center + 0 - - 0 + Calendar selection - - - 0 - 2 + zenity_calendar_box + + _Cancel + _OK + + + + 2 + + + vertical + 6 - - 0 - vertical + + 1 6 - - 1 - 0 - 6 - - - center - 0 - Select a date from below. - 1 - 0 - - - - - - - center - 0 - C_alendar: - 1 - zenity_calendar + + center + Select a date from below. + 1 0 - - Calendar - zenity_calendar - - - - - - center - - - - zenity_calendar_cancel_button - zenity_calendar_ok_button - - - - True - False - - true - _Cancel + + center + C_alendar: + 1 + zenity_calendar + 0 + + Calendar + zenity_calendar + - - true - _OK + + center + true - - 0 + Add a new entry - - - 0 - vertical - 2 - 12 - 12 - 12 - 12 - - - 0 + zenity_entry_box + + _Cancel + _OK + + + + vertical + 2 + 12 + 12 + 12 + 12 + + + + + 1 + vertical + 6 - - 1 - 0 - vertical - 6 - - - center - 0 - _Enter new text: - 1 - 0 - - - - - + + center + _Enter new text: + 1 + 0 - - - - - - zenity_entry_cancel_button - zenity_entry_ok_button - - - - True - False - - - true - _Cancel - - - - - true - _OK - - - - - - - 0 - Error - - - 0 - 14 - 12 - 12 - 12 - 12 - - - 0 - - 1 - 0 - 12 - - - center - 0 - dialog-error - large - - - - - center - An error has occurred. - 1 - 1 - 0 - - - + - - zenity_error_ok_button - - - - False - - - true - _OK - - - - - - 0 - - - 0 - 2 - - - 0 - - - 0 - 12 - 6 - 12 - 6 - 6 - 10 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - Forms dialog - - - - - - - - - - - zenity_forms_cancel_button - zenity_forms_ok_button - - - - True - False - - - true - _Cancel - - - - - true - _OK - - - - + + Error + zenity_error_box + + _OK + - - 0 - Information - - - 0 - 14 - 12 - 12 - 12 - 12 - - - - 0 + + 14 + 12 + 12 + 12 + 12 + + + + + 1 12 - + center - 0 - dialog-information + dialog-error large - + center - All updates are complete. - 1 - 1 - 0 + An error has occurred. + true + true + false - - zenity_info_ok_button - - - - True - False - - - true - _OK - - - - - - 0 - Progress - - - 0 - 2 - - - center - 0 - vertical - 6 + + zenity_forms_box + + _Cancel + _OK + + + + 2 + + + + + 12 + 6 + 12 + 6 + 6 + 10 - - center - 0 - Running... - 1 - 0 - + - - center - 0 - 0.10000000149 - + - - center - 0 - 0 - + + + + + + + + + + + + + + + + + + + + + + + Forms dialog + + + + - - zenity_progress_cancel_button - zenity_progress_ok_button - - - - True - False - - - true - _Cancel + + + Information + zenity_info_box + + _OK + + + + 14 + 12 + 12 + 12 + 12 + + + 12 + + + center + dialog-information + large - - true - _OK - 0 + + center + true + All updates are complete. + true + true + false - - 0 - Question - - - 0 - 14 - 12 - 12 - 12 - 12 + + Progress + zenity_progress_box + + + 2 + + + vertical + 6 - - 0 - 12 - - - 0 - dialog-question - large - - - - - center - Are you sure you want to proceed? - 1 - 1 - 0 - - + + center + Running... + 1 + 0 - - - - - - True - False - - - - - 0 - Select items from the list - 300 - 196 - - - 0 - - 0 - vertical - 6 - - - center - 0 - Select items from the list below. - 0 - - - - - 1 - 1 - - - - - - - - - + + center + true + 0.10000000149 + + + + + center + 0 - - zenity_tree_cancel_button - zenity_tree_ok_button - - - - False + + + Question + zenity_question_box + + _No + _Yes + + + + 14 + 12 + 12 + 12 + 12 + + + 12 - - true - _Cancel + + dialog-question + large - - true - _OK + + center + true + Are you sure you want to proceed? + true + true + false - - 0 - Warning - false - - - - 0 - 14 - 12 - 12 - 12 - 12 + + Select items from the list + 300 + 196 + zenity_tree_box + true + + _Cancel + _OK + + + + + + vertical + 6 - - 0 - 12 - - - 0 - dialog-warning - large - - - - - center - true - true - Are you sure you want to proceed? - 1 - 1 - - + + center + Select items from the list below. + 0 - - - - zenity_warning_ok_button - - - - True - False - - true - _OK + + 1 + 1 + + + + + + + - - - - - - - - + Warning false - - - - vertical - 14 - 12 - 12 - 12 - 12 + zenity_warning_box + + _OK + + + + 14 + 12 + 12 + 12 + 12 + + + 12 - - horizontal - 12 - - - dialog-password - large - - - - - Type your password - - + + dialog-warning + large - - 12 - 6 + + center + true + true + Are you sure you want to proceed? + true + true + false - + - - zenity_password_ok_button - zenity_password_cancel_button - - + + + Warning + false + zenity_password_box + + _Cancel + _OK + + + + vertical + 14 + 12 + 12 + 12 + 12 + - True - False + horizontal + 12 - - true - _OK + + dialog-password + large - - true - _Cancel + + Type your password - + + + 12 + 6 + + + -- cgit v1.2.1 From 95baf6459dd574df9941b0e66a240972465e267d Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 00:37:34 -0500 Subject: ci: Run test on fedora:latest image. It might work. Maybe. --- .gitlab-ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50990ec..4d5cd93 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 gtk4-devel yelp-tools -build_fedora_33: - image: fedora:33 +build_fedora: + image: fedora:latest before_script: - dnf install -y --nogpgcheck $DEPENDENCIES script: - - ./autogen.sh - - make -j + - meson build/ + - ninja -C build/ -- cgit v1.2.1 From 05921d7f6b0dd519b95f1b868e93bafd081237ca Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 00:44:48 -0500 Subject: ci: add meson as dep --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4d5cd93..bf209dc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ variables: - DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel gtk4-devel yelp-tools + DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel meson gtk4-devel yelp-tools build_fedora: image: fedora:latest -- cgit v1.2.1 From 9a25ce0f68abd73af9024d48cb7e1925303c2183 Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 14:21:59 -0500 Subject: text: Re-add webkit support for gtk4 --- meson.build | 17 ++++++++--------- meson_options.txt | 4 +--- src/meson.build | 2 +- src/text.c | 21 ++++++++++----------- 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/meson.build b/meson.build index 97d0284..222d264 100644 --- a/meson.build +++ b/meson.build @@ -65,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', 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/meson.build b/src/meson.build index 0c03b31..2ee1889 100644 --- a/src/meson.build +++ b/src/meson.build @@ -46,6 +46,6 @@ zenity = executable( zenity_sources + zenity_enums + zenity_res, include_directories: zenity_root_dir, c_args: zenity_c_args, - dependencies: adw_dep, + dependencies: [adw_dep, webkitgtk_dep], install: true ) diff --git a/src/text.c b/src/text.c index f539c7a..1cdebad 100644 --- a/src/text.c +++ b/src/text.c @@ -41,7 +41,6 @@ static ZenityTextData *zen_text_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) { @@ -77,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 / @@ -356,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")); @@ -373,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 (); @@ -396,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 */ -- cgit v1.2.1 From dc57e6a0a215425e883195d512f4392eb786b19d Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 14:22:51 -0500 Subject: ci: Add help2man as build-dep and enable webkitgtk for test build --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bf209dc..1b93631 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,10 +1,10 @@ variables: - DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel meson gtk4-devel yelp-tools + DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel meson gtk4-devel yelp-tools help2man build_fedora: image: fedora:latest before_script: - dnf install -y --nogpgcheck $DEPENDENCIES script: - - meson build/ + - meson -Dwebkitgtk=true build/ - ninja -C build/ -- cgit v1.2.1 From b3a793621f033b34ab26173217b91003873db864 Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 14:27:05 -0500 Subject: ci: add webkit2gtk5.0-devel as dep --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1b93631..89cd3ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ variables: - DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel meson gtk4-devel yelp-tools help2man + DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel meson gtk4-devel yelp-tools help2man webkit2gtk5.0-devel build_fedora: image: fedora:latest -- cgit v1.2.1 From 4207034e6f854469f5a2f691586994a8de001a9c Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 16:35:47 -0500 Subject: build: Escape single quotes in help2man custom target --- data/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/meson.build b/data/meson.build index 6cdfea5..940e175 100644 --- a/data/meson.build +++ b/data/meson.build @@ -31,7 +31,7 @@ if help2man.found() and not meson.is_cross_build() help2man_opts = [ '--no-info', '--section=1', - '--help-option=--help-all', + '--help-option=\'--help-all\'', '--include=@INPUT@', ] -- cgit v1.2.1 From 42bc71053027e007740e87852c4c82a887dc4c0d Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 16:42:08 -0500 Subject: Revert "build: Escape single quotes in help2man custom target" This reverts commit 4207034e6f854469f5a2f691586994a8de001a9c. --- data/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/meson.build b/data/meson.build index 940e175..6cdfea5 100644 --- a/data/meson.build +++ b/data/meson.build @@ -31,7 +31,7 @@ if help2man.found() and not meson.is_cross_build() help2man_opts = [ '--no-info', '--section=1', - '--help-option=\'--help-all\'', + '--help-option=--help-all', '--include=@INPUT@', ] -- cgit v1.2.1 From b7ac6cf738d7b9f43e382575794cc3dad9a62fd0 Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 16:54:11 -0500 Subject: ci: Try adding perl-Thread-Queue as dep to fix help2man not working --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 89cd3ef..dd9f448 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ variables: - DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel meson gtk4-devel yelp-tools help2man webkit2gtk5.0-devel + DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel meson gtk4-devel yelp-tools perl-Thread-Queue help2man webkit2gtk5.0-devel build_fedora: image: fedora:latest -- cgit v1.2.1 From 24161970e8de99685b3c0d35400cc73d08c858ea Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 17:14:47 -0500 Subject: ci: remove deps for help2man. Just doesn't seem work on CI though it works everywhere else and I can't figure out why. --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dd9f448..d406aa9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ variables: - DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel meson gtk4-devel yelp-tools perl-Thread-Queue help2man webkit2gtk5.0-devel + DEPENDENCIES: gettext gettext-devel gcc git libadwaita-devel meson gtk4-devel yelp-tools webkit2gtk5.0-devel build_fedora: image: fedora:latest -- cgit v1.2.1 From 9c5bcb6591f7c15e354eee509989454ebb29236c Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 19:24:36 -0500 Subject: text: Make resizable --- src/zenity.ui | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zenity.ui b/src/zenity.ui index 7fcbb02..f2bb9b4 100644 --- a/src/zenity.ui +++ b/src/zenity.ui @@ -45,6 +45,7 @@ Text View 300 200 + true zenity_text_box _Cancel -- cgit v1.2.1 From 184285174106e1153577287dc0a2c01b761f44af Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 20:31:30 -0500 Subject: color/filesel: ignore deprecations and fix signal handlers These dialogs still use the old GtkDialog-based API. --- src/color.c | 19 ++++++++++--------- src/fileselection.c | 8 +++----- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/color.c b/src/color.c index 667c1ad..d1f7c8e 100644 --- a/src/color.c +++ b/src/color.c @@ -30,9 +30,12 @@ #include "zenity.h" #include +/* TODO: port to GtkColorDialog */ +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + static ZenityData *zen_data; -static void zenity_colorselection_dialog_response (GtkWidget *widget, char *rstr, gpointer data); +static void zenity_colorselection_dialog_response (GtkWidget *widget, int response, gpointer data); void zenity_colorselection (ZenityData *data, ZenityColorData *color_data) @@ -44,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)) @@ -76,20 +76,19 @@ zenity_colorselection (ZenityData *data, ZenityColorData *color_data) } static void -zenity_colorselection_dialog_response (GtkWidget *widget, char *rstr, gpointer data) +zenity_colorselection_dialog_response (GtkWidget *widget, int response, gpointer data) { GdkRGBA color; - ZenityExitCode response = zenity_util_parse_dialog_response (rstr); switch (response) { - case ZENITY_OK: + case GTK_RESPONSE_OK: zenity_util_exit_code_with_data (ZENITY_OK, zen_data); gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color); g_print ("%s\n", gdk_rgba_to_string (&color)); break; - case ZENITY_CANCEL: + case GTK_RESPONSE_CANCEL: zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL); break; @@ -102,3 +101,5 @@ zenity_colorselection_dialog_response (GtkWidget *widget, char *rstr, gpointer d } zenity_util_gapp_quit (GTK_WINDOW(widget), zen_data); } + +G_GNUC_END_IGNORE_DEPRECATIONS diff --git a/src/fileselection.c b/src/fileselection.c index 4cf544d..cf6a481 100644 --- a/src/fileselection.c +++ b/src/fileselection.c @@ -31,14 +31,13 @@ #include -/* GtkFileChooser deprecated in 4.10, but we want to maintain backwards - * compatibility with GTK 4.0. +/* TODO: port to GtkFileDialog. */ G_GNUC_BEGIN_IGNORE_DEPRECATIONS static ZenityData *zen_data; -static void zenity_fileselection_dialog_response (GtkWidget *widget, char *rstr, gpointer data); +static void zenity_fileselection_dialog_response (GtkWidget *widget, int response, gpointer data); void zenity_fileselection (ZenityData *data, ZenityFileData *file_data) @@ -182,11 +181,10 @@ zenity_fileselection_dialog_output (GtkFileChooser *chooser, } static void -zenity_fileselection_dialog_response (GtkWidget *widget, char *rstr, gpointer data) +zenity_fileselection_dialog_response (GtkWidget *widget, int response, gpointer data) { ZenityFileData *file_data = data; GtkFileChooser *chooser = GTK_FILE_CHOOSER (widget); - ZenityExitCode response = zenity_util_parse_dialog_response (rstr); switch (response) { -- cgit v1.2.1 From f4176bf1bd5d0150902cebe664ff6ff232404511 Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 20:59:05 -0500 Subject: text: Fix dialog response signal handler --- src/text.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/text.c b/src/text.c index 1cdebad..7c37855 100644 --- a/src/text.c +++ b/src/text.c @@ -441,7 +441,7 @@ zenity_text_dialog_response (GtkWidget *widget, char *rstr, gpointer data) switch (response) { - case ZENITY_ESC: + case ZENITY_OK: zenity_text_dialog_output (zen_data); zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK); break; @@ -451,6 +451,10 @@ zenity_text_dialog_response (GtkWidget *widget, char *rstr, 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)) -- cgit v1.2.1 From 50937a124573d40291049ee3984a14e95231f2ae Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Tue, 24 Jan 2023 21:23:42 -0500 Subject: forms: Fix parameter order in calendar segment --- src/forms.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/forms.c b/src/forms.c index f3ce547..4e4a60e 100644 --- a/src/forms.c +++ b/src/forms.c @@ -351,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; @@ -399,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; -- cgit v1.2.1 From 68222026a11d1d679c346da54124b8ca85c1bb18 Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Wed, 25 Jan 2023 11:24:10 -0500 Subject: main: suppress "this is discouraged" message from libadwaita Bit of a hack, but I can just see us getting bug report after bug report about this message if it's left in. --- src/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.c b/src/main.c index b224bf1..ec01b41 100644 --- a/src/main.c +++ b/src/main.c @@ -128,6 +128,8 @@ command_line_cb (GApplication *app, g_free (args); } +static void dummy_log_func (void) { } + int main (int argc, char *argv[]) { @@ -143,6 +145,11 @@ main (int argc, char *argv[]) textdomain (GETTEXT_PACKAGE); /* */ + /* 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; -- cgit v1.2.1 From 702de313a310242f4dc2662a0fd97c49aa282d1c Mon Sep 17 00:00:00 2001 From: Andre Klapper Date: Mon, 2 Jan 2023 11:30:34 +0100 Subject: docs: Fix incorrect markup Fixes #50 (cherry picked from commit f0cfc48822e7c83c40b54e54418df2cd877250ea) --- help/C/forms.page | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ - --add-password<cmd></cmd>=<var>FieldName</var> + <cmd>--add-password</cmd>=<var>FieldName</var>

Add a new Password Entry in forms dialog. (Hide text)

-- cgit v1.2.1 From 008c677ec2546cf9c3c267d9f1df0d248b41c630 Mon Sep 17 00:00:00 2001 From: Logan Rathbone Date: Wed, 25 Jan 2023 12:00:45 -0500 Subject: Zenity 3.90.0 --- NEWS | 44 ++++++++++++++++++++++++++++++++++++++++++-- meson.build | 4 ++-- 2 files changed, 44 insertions(+), 4 deletions(-) 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/meson.build b/meson.build index 222d264..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') -- cgit v1.2.1