[zenity/gtk4-port: 12/25] Mass cleanup and finish meson migration.




commit 2aac67b9c184ad533510d61569a5763e87ecf7f3
Author: Logan Rathbone <poprocks gmail com>
Date:   Sun Feb 14 22:27:01 2021 -0500

    Mass cleanup and finish meson migration.
    
    Autotools purged.

 COPYING                                       | 216 ++++++++++++++------------
 MAINTAINERS                                   |   7 -
 Makefile.am                                   |  32 ----
 NEWS                                          |   3 +
 README                                        |  12 --
 README.md                                     |  18 +++
 THANKS                                        | 158 -------------------
 TODO                                          |  14 --
 autogen.sh                                    |  38 -----
 configure.ac                                  | 140 -----------------
 data/Makefile.am                              |  23 ---
 data/gnome-tshirt.png                         | Bin 4147 -> 0 bytes
 data/hawaii-shirt.png                         | Bin 13730 -> 0 bytes
 data/meson.build                              |   1 +
 data/monk.png                                 | Bin 9773 -> 0 bytes
 data/sunglasses.png                           | Bin 2721 -> 0 bytes
 data/surfboard.png                            | Bin 14484 -> 0 bytes
 data/zenity-calendar.png                      | Bin 2857 -> 0 bytes
 data/zenity-entry.png                         | Bin 1669 -> 0 bytes
 data/zenity-file.png                          | Bin 1343 -> 0 bytes
 data/zenity-list.png                          | Bin 256 -> 0 bytes
 data/zenity-notification.png                  | Bin 898 -> 0 bytes
 data/zenity-progress.png                      | Bin 4509 -> 0 bytes
 data/zenity-scale.png                         | Bin 240 -> 0 bytes
 data/zenity-text.png                          | Bin 3523 -> 0 bytes
 help/{ChangeLog => ChangeLog.pre-git}         |   0
 help/LINGUAS                                  |   1 +
 help/Makefile.am                              |  45 ------
 help/meson.build                              |  48 ++++++
 {data => icons/hicolor/48x48/apps}/zenity.png | Bin
 icons/meson.build                             |   4 +
 meson.build                                   |  55 +++++--
 po/{ChangeLog => ChangeLog.pre-git}           |   0
 po/Makevars                                   |  78 ----------
 po/{POTFILES.in => POTFILES}                  |   0
 po/POTFILES.skip                              |   2 -
 po/meson.build                                |   4 +
 src/Makefile.am                               |  57 -------
 src/about.c                                   |  48 ++----
 src/calendar.c                                |   5 +-
 src/color.c                                   |  22 +--
 src/entry.c                                   |   4 +-
 src/main.c                                    |  21 +--
 src/meson.build                               |  10 ++
 src/msg.c                                     |  20 +--
 src/notification.c                            |  12 +-
 src/progress.c                                |  33 ++--
 src/scale.c                                   |   4 +-
 src/text.c                                    |   6 +-
 src/tree.c                                    | 128 +++++++--------
 src/util.c                                    | 105 ++-----------
 51 files changed, 377 insertions(+), 997 deletions(-)
---
diff --git a/COPYING b/COPYING
index bf50f20d..4362b491 100644
--- a/COPYING
+++ b/COPYING
@@ -1,112 +1,125 @@
-                 GNU LIBRARY GENERAL PUBLIC LICENSE
-                      Version 2, June 1991
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
 
- Copyright (C) 1991 Free Software Foundation, Inc.
-                   59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-[This is the first released version of the library GPL.  It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
 
-                           Preamble
+                            Preamble
 
   The licenses for most software are designed to take away your
 freedom to share and change it.  By contrast, the GNU General Public
 Licenses are intended to guarantee your freedom to share and change
 free software--to make sure the software is free for all its users.
 
-  This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it.  You can use it for
-your libraries, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
 
   To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
 
   For example, if you distribute copies of the library, whether gratis
 or for a fee, you must give the recipients all the rights that we gave
 you.  You must make sure that they, too, receive or can get the source
-code.  If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
 it.  And you must show them these terms so they know their rights.
 
-  Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
 permission to copy, distribute and/or modify the library.
 
-  Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library.  If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
 
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software.  To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
-  Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs.  This
-license, the GNU Library General Public License, applies to certain
-designated libraries.  This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
-  The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it.  Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program.  However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
-  Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries.  We
-concluded that weaker conditions might promote sharing better.
-
-  However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves.  This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them.  (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.)  The hope is that this
-will lead to faster development of free libraries.
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
 
   The precise terms and conditions for copying, distribution and
 modification follow.  Pay close attention to the difference between a
 "work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, while the latter only
-works together with the library.
-
-  Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
 
-                 GNU LIBRARY GENERAL PUBLIC LICENSE
+                  GNU LESSER GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
-  0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License").  Each licensee is
-addressed as "you".
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
 
   A "library" means a collection of software functions and/or data
 prepared so as to be conveniently linked with application programs
@@ -133,7 +146,7 @@ such a program is covered only if its contents constitute a work based
 on the Library (independent of the use of the Library in a tool for
 writing it).  Whether that is true depends on what the Library does
 and what the program that uses the Library does.
-  
+
   1. You may copy and distribute verbatim copies of the Library's
 complete source code as you receive it, in any medium, provided that
 you conspicuously and appropriately publish on each copy an
@@ -255,7 +268,7 @@ distribute the object code for the work under the terms of Section 6.
 Any executables containing that work also fall under Section 6,
 whether or not they are linked directly with the Library itself.
 
-  6. As an exception to the Sections above, you may also compile or
+  6. As an exception to the Sections above, you may also combine or
 link a "work that uses the Library" with the Library to produce a
 work containing portions of the Library, and distribute that work
 under terms of your choice, provided that the terms permit
@@ -282,23 +295,31 @@ of these things:
     Library will not necessarily be able to recompile the application
     to use the modified definitions.)
 
-    b) Accompany the work with a written offer, valid for at
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
     least three years, to give the same user the materials
     specified in Subsection 6a, above, for a charge no more
     than the cost of performing this distribution.
 
-    c) If distribution of the work is made by offering access to copy
+    d) If distribution of the work is made by offering access to copy
     from a designated place, offer equivalent access to copy the above
     specified materials from the same place.
 
-    d) Verify that the user has already received a copy of these
+    e) Verify that the user has already received a copy of these
     materials or that you have already sent this user a copy.
 
   For an executable, the required form of the "work that uses the
 Library" must include any data and utility programs needed for
 reproducing the executable from it.  However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
 components (compiler, kernel, and so on) of the operating system on
 which the executable runs, unless that component itself accompanies
 the executable.
@@ -347,7 +368,7 @@ Library), the recipient automatically receives a license from the
 original licensor to copy, distribute, link with or modify the Library
 subject to these terms and conditions.  You may not impose any further
 restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+You are not responsible for enforcing compliance by third parties with
 this License.
 
   11. If, as a consequence of a court judgment or allegation of patent
@@ -390,7 +411,7 @@ excluded.  In such case, this License incorporates the limitation as if
 written in the body of this License.
 
   13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
+versions of the Lesser General Public License from time to time.
 Such new versions will be similar in spirit to the present version,
 but may differ in detail to address new problems or concerns.
 
@@ -411,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
 of all derivatives of our free software and of promoting the sharing
 and reuse of software generally.
 
-                           NO WARRANTY
+                            NO WARRANTY
 
   15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
 WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
@@ -434,7 +455,7 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 DAMAGES.
 
-                    END OF TERMS AND CONDITIONS
+                     END OF TERMS AND CONDITIONS
 
            How to Apply These Terms to Your New Libraries
 
@@ -453,19 +474,18 @@ convey the exclusion of warranty; and each file should have at least the
     Copyright (C) <year>  <name of author>
 
     This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
+    modify it under the terms of the GNU Lesser General Public
     License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
+    version 2.1 of the License, or (at your option) any later version.
 
     This library is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
+    Lesser General Public License for more details.
 
-    You should have received a copy of the GNU Library General Public
-    License along with this library; if not, write to the 
-    Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
-    Boston, MA  02111-1307  USA.
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 Also add information on how to contact you by electronic and paper mail.
 
diff --git a/NEWS b/NEWS
index 37d8e3d0..4fc6c9bc 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+Zenity 4.alpha.1
+    - Initial port to GTK4 (Logan Rathbone)
+
 Zenity 3.32.0
     - Fix autotools warnings (Javier Jardón)
     - Use upstream autoreconf instead deprecated gnome-autogen (Javier Jardón)
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..6a010863
--- /dev/null
+++ b/README.md
@@ -0,0 +1,18 @@
+# Zenity
+
+This is zenity the GNOME port of the venerable 'dialog' program,
+which allows you to display dialog boxes from the command-line
+and shell scripts.
+
+This software is licensed under the GNU Lesser General Public
+License, version 2.1, or, at your option, a later version.
+
+Please see COPYING for a full copy of the license.
+
+## Dependencies
+
+gtk >= 4.0.0
+
+## Optional Dependencies
+
+libnotify >= 0.6.1
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 00000000..c85889ef
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1 @@
+install_man('zenity.1')
diff --git a/help/ChangeLog b/help/ChangeLog.pre-git
similarity index 100%
rename from help/ChangeLog
rename to help/ChangeLog.pre-git
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 00000000..9940fa36
--- /dev/null
+++ b/help/LINGUAS
@@ -0,0 +1 @@
+bg ca cs da de el en_GB es eu fi fr gl hu ja oc pl pt_BR ru sl sv uk zh_CN
diff --git a/help/meson.build b/help/meson.build
new file mode 100644
index 00000000..cd09412b
--- /dev/null
+++ b/help/meson.build
@@ -0,0 +1,48 @@
+help_pages = [
+  'legal.xml',
+  'calendar.page',
+  'color-selection.page',
+  'entry.page',
+  'error.page',
+  'file-selection.page',
+  'forms.page',
+  'index.page',
+  'info.page',
+  'intro.page',
+  'list.page',
+  'message.page',
+  'notification.page',
+  'password.page',
+  'progress.page',
+  'question.page',
+  'scale.page',
+  'text.page',
+  'usage.page',
+  'warning.page'
+]
+
+help_media = [
+  'figures/zenity-calendar-screenshot.png',
+  'figures/zenity-colorselection-screenshot.png',
+  'figures/zenity-entry-screenshot.png',
+  'figures/zenity-error-screenshot.png',
+  'figures/zenity-fileselection-screenshot.png',
+  'figures/zenity-forms-screenshot.png',
+  'figures/zenity-information-screenshot.png',
+  'figures/zenity-list-screenshot.png',
+  'figures/zenity-notification-listen-screenshot.png',
+  'figures/zenity-notification-screenshot.png',
+  'figures/zenity-password-screenshot.png',
+  'figures/zenity-progress-screenshot.png',
+  'figures/zenity-question-screenshot.png',
+  'figures/zenity-scale-screenshot.png',
+  'figures/zenity-text-screenshot.png',
+  'figures/zenity-warning-screenshot.png'
+]
+
+gnome.yelp(
+  meson.project_name(),
+  sources: help_pages,
+  media: help_media,
+  symlink_media: false
+)
diff --git a/data/zenity.png b/icons/hicolor/48x48/apps/zenity.png
similarity index 100%
rename from data/zenity.png
rename to icons/hicolor/48x48/apps/zenity.png
diff --git a/icons/meson.build b/icons/meson.build
new file mode 100644
index 00000000..11fe0f69
--- /dev/null
+++ b/icons/meson.build
@@ -0,0 +1,4 @@
+install_subdir(
+  'hicolor',
+  install_dir: zenity_iconsdir
+)
diff --git a/meson.build b/meson.build
index 9798bc4f..a1a4031d 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
 project('zenity', 'c',
   version: '4.alpha.1',
-  meson_version: '>=0.50.0',
-  license: 'LGPL-2.0-or-later'
+  meson_version: '>=0.53.0',
+  license: 'LGPL-2.1-or-later'
 )
 
 version_arr = meson.project_version().split('.')
@@ -10,11 +10,10 @@ zenity_version_minor = version_arr[1]
 zenity_version_micro = version_arr[2].to_int()
 
 zenity_prefix = get_option('prefix')
+zenity_bindir = join_paths(zenity_prefix, get_option('bindir'))
 zenity_libdir = join_paths(zenity_prefix, get_option('libdir'))
-zenity_includedir = join_paths(zenity_prefix, get_option('includedir'))
 zenity_datadir = join_paths(zenity_prefix, get_option('datadir'))
 zenity_localedir = join_paths(zenity_prefix, get_option('localedir'))
-zenity_appdatadir = join_paths(zenity_datadir, 'metainfo')
 zenity_iconsdir = join_paths(zenity_datadir, 'icons')
 
 zenity_root_dir = include_directories('.')
@@ -53,28 +52,56 @@ endforeach
 
 gtk_dep = dependency('gtk4', version: '>= 4.0.0')
 
+# Optional dependencies
+
+opt_missing_str = '''
+Requested optional @0@ support but library not found.
+Please ensure you have any required development libraries installed.'''
+
+libnotify = dependency('libnotify', version: '>= 0.6.1', required: false)
 if get_option('libnotify')
-  libnotify = dependency('libnotify', version: '>= 0.6.1')
-  zenity_conf.set('HAVE_LIBNOTIFY', true)
+  if libnotify.found()
+    zenity_conf.set('HAVE_LIBNOTIFY', true)
+  else
+    error(opt_missing_str.format('libnotify'))
+  endif
 endif
 
 # TODO
+#webkitgtk = dependency('webkit2gtk-4.0', version: '>= 2.8.1', required: false)
 #if get_option('webkitgtk')
-#  webkitgtk = dependency('webkit2gtk-4.0', version: '>= 2.8.1')
-#  zenity_conf.set('HAVE_WEBKITGTK', true)
+#  if webkitgtk.found()
+#    zenity_conf.set('HAVE_WEBKITGTK', true)
+#  else
+#    error(opt_missing_str.format('webkitgtk'))
+#  endif
 #endif
 
+perl = find_program('perl', required: false)
+if perl.found()
+  zenity_conf.set('PERL', perl.path())
+endif
+
 configure_file(
   output: 'config.h',
   configuration: zenity_conf
 )
 
-update_icon_cache_prg = find_program('gtk-update-icon-cache',
-  required : false)
+# Print a summary of options at the end.
+
+summary({'prefix': zenity_prefix,
+         'libdir': zenity_libdir,
+         'datadir': zenity_datadir,
+        'localedir': zenity_localedir,
+        'iconsdir': zenity_iconsdir,
+        }, section: 'Directories')
 
-perl = find_program('perl', required: true)
+summary({'libnotify': get_option('libnotify'),
+         'gdialog script': perl.found(),
+        }, section: 'Configuration')
 
 subdir('src')
-#subdir('data')
-#subdir('po')
-#subdir('help')
+subdir('data')
+subdir('icons')
+subdir('po')
+subdir('help')
diff --git a/po/ChangeLog b/po/ChangeLog.pre-git
similarity index 100%
rename from po/ChangeLog
rename to po/ChangeLog.pre-git
diff --git a/po/POTFILES.in b/po/POTFILES
similarity index 100%
rename from po/POTFILES.in
rename to po/POTFILES
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 00000000..66362aa5
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,4 @@
+i18n.gettext(
+  meson.project_name(),
+  preset: 'glib'
+)
diff --git a/src/about.c b/src/about.c
index 338cca30..cac56c8a 100644
--- a/src/about.c
+++ b/src/about.c
@@ -34,18 +34,12 @@
 
 #include <config.h>
 
-#define GTK_RESPONSE_CREDITS 0
-
-#define ZENITY_CANVAS_X 400.0
-#define ZENITY_CANVAS_Y 280.0
-
 static GtkWidget *dialog;
 
-static void zenity_about_dialog_response (GtkWidget *widget,
-               int response, gpointer data);
+static void zenity_about_close_cb (GtkWindow *window, gpointer data);
 
 /* Sync with the people in the THANKS file */
-static const gchar *const authors[] = {"Glynn Foster <glynn foster sun com>",
+static const char *const authors[] = {"Glynn Foster <glynn foster sun com>",
        "Lucas Rocha <lucasr gnome org>",
        "Mike Newman <mikegtn gnome org>",
        NULL};
@@ -56,8 +50,6 @@ static const char *documenters[] = {"Glynn Foster <glynn foster sun com>",
        "GNOME Documentation Project",
        NULL};
 
-static gchar *translators;
-
 static const char *license[] = {
        N_ ("This program is free software; you can redistribute it and/or modify "
                "it under the terms of the GNU Lesser General Public License as "
@@ -79,15 +71,13 @@ zenity_about (ZenityData *data)
 {
        char *license_trans;
 
-       translators = _("translator-credits");
-
        license_trans = g_strconcat (
                _(license[0]), "\n", _(license[1]), "\n", _(license[2]), "\n", NULL);
 
        dialog = gtk_about_dialog_new ();
 
        g_object_set (G_OBJECT (dialog),
-               "name",
+               "program-name",
                "Zenity",
                "version",
                VERSION,
@@ -100,46 +90,32 @@ zenity_about (ZenityData *data)
                authors,
                "documenters",
                documenters,
-               "translator-credits",
-               translators,
                "website",
                "https://gitlab.gnome.org/GNOME/zenity";,
                "wrap-license",
                TRUE,
                "license",
                license_trans,
+               "icon-name",
+               "zenity",
+               "logo-icon-name",
+               "zenity",
                NULL);
 
        g_free (license_trans);
 
-       zenity_util_set_window_icon (dialog,
-                       NULL, ZENITY_IMAGE_FULLPATH ("zenity.png"));
-
-       g_signal_connect (G_OBJECT (dialog),
-               "response",
-               G_CALLBACK (zenity_about_dialog_response),
-               data);
+       g_signal_connect (dialog, "close-request",
+                       G_CALLBACK(zenity_about_close_cb), data);
 
        zenity_util_show_dialog (dialog);
        zenity_util_gapp_main (GTK_WINDOW (dialog));
 }
 
 static void
-zenity_about_dialog_response (GtkWidget *widget, int response, gpointer data)
+zenity_about_close_cb (GtkWindow *window, gpointer data)
 {
        ZenityData *zen_data = data;
 
-       g_return_if_fail (GTK_IS_WINDOW (GTK_WINDOW(widget)));
-
-       switch (response) {
-               case GTK_RESPONSE_CLOSE:
-                       zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
-                       break;
-
-               default:
-                       /* Esc dialog */
-                       zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
-                       break;
-       }
-       zenity_util_gapp_quit (GTK_WINDOW(widget));
+       zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
+       zenity_util_gapp_quit (window);
 }
diff --git a/src/calendar.c b/src/calendar.c
index f674e4cb..07696ab4 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -64,9 +64,8 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
        if (data->dialog_title)
                gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
 
-       zenity_util_set_window_icon (dialog,
-               data->window_icon,
-               ZENITY_IMAGE_FULLPATH ("zenity-calendar.png"));
+       gtk_window_set_icon_name (GTK_WINDOW(dialog),
+                       "x-office-calendar");
 
        if (data->width > -1 || data->height > -1)
                gtk_window_set_default_size (GTK_WINDOW(dialog),
diff --git a/src/color.c b/src/color.c
index 3dd2624e..42894076 100644
--- a/src/color.c
+++ b/src/color.c
@@ -39,7 +39,6 @@ void
 zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
 {
        GtkWidget *dialog;
-       GtkWidget *button;
        GdkRGBA color;
 
        zen_data = data;
@@ -59,31 +58,13 @@ zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
 
        if (data->extra_label)
        {
-               int i = 0;
-
-               while (data->extra_label[i] != NULL)
+               for (int i = 0; data->extra_label[i] != NULL; ++i)
                {
                        gtk_dialog_add_button (GTK_DIALOG (dialog),
                                        data->extra_label[i], i);
-                       i++;
                }
        }
 
-       // FIXME
-#if 0
-       if (data->ok_label) {
-               g_object_get (G_OBJECT (dialog), "ok-button", &button, NULL);
-               gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
-               g_object_unref (G_OBJECT (button));
-       }
-
-       if (data->cancel_label) {
-               g_object_get (G_OBJECT (dialog), "cancel-button", &button, NULL);
-               gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
-               g_object_unref (G_OBJECT (button));
-       }
-#endif
-
        if (data->modal)
                gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 
@@ -99,7 +80,6 @@ zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
        zenity_util_gapp_main (GTK_WINDOW(dialog));
 }
 
-// FIXME - this shoudl probably use the color-activated signal
 static void
 zenity_colorselection_dialog_response (GtkWidget *widget,
                int response, gpointer data)
diff --git a/src/entry.c b/src/entry.c
index 85323e7d..f1160698 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -78,8 +78,8 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
        if (data->dialog_title)
                gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
 
-       zenity_util_set_window_icon (dialog,
-                       data->window_icon, ZENITY_IMAGE_FULLPATH ("zenity-entry.png"));
+       gtk_window_set_icon_name (GTK_WINDOW(dialog),
+                       "insert-text");
 
        if (data->width > -1 || data->height > -1)
                gtk_window_set_default_size (GTK_WINDOW (dialog),
diff --git a/src/main.c b/src/main.c
index 3649ad5b..01545bec 100644
--- a/src/main.c
+++ b/src/main.c
@@ -39,11 +39,12 @@ typedef struct {
 } ZenityArgs;
 
 static void
-activate_cb (GtkApplication *app, gpointer user_data)
+command_line_cb (GtkApplication *app,
+               GApplicationCommandLine *command_line,
+               gpointer user_data)
 {
        ZenityArgs *args = user_data;
        ZenityParsingOptions *results;
-       int retval;
 
        results = zenity_option_parse (args->argc, args->argv);
 
@@ -128,14 +129,11 @@ activate_cb (GtkApplication *app, gpointer user_data)
                        exit (-1);
        }
 
-       retval = results->data->exit_code;
-
        zenity_option_free ();
        g_free (args);
 
-       /* FIXME - pass retval to gapplication properly.
-        * exit (retval);
-        */
+       g_application_command_line_set_exit_status (command_line,
+                       results->data->exit_code);
 }
 
 int
@@ -157,9 +155,12 @@ main (int argc, char *argv[])
        args->argc = argc;
        args->argv = argv;
 
-       app = gtk_application_new ("org.gnome.Zenity", G_APPLICATION_FLAGS_NONE);
-       g_signal_connect (app, "activate",
-                       G_CALLBACK(activate_cb), args);
+       app = gtk_application_new ("org.gnome.Zenity",
+                       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);
        g_object_unref (app);
 
diff --git a/src/meson.build b/src/meson.build
index 374e79a3..1d3cd82c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -41,3 +41,13 @@ zenity = executable(
   c_args: zenity_c_args,
   install: true
 )
+
+if perl.found()
+  configure_file(
+    input: 'gdialog.in',
+    output: 'gdialog',
+    configuration: zenity_conf,
+    install_dir: zenity_bindir,
+    install: true
+  )
+endif
diff --git a/src/msg.c b/src/msg.c
index e7af4f7b..5b8e7a9c 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -173,29 +173,29 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
        switch (msg_data->mode)
        {
                case ZENITY_MSG_WARNING:
-                       zenity_util_set_window_icon_from_icon_name (
-                               dialog, data->window_icon, "dialog-warning");
+                       gtk_window_set_icon_name (GTK_WINDOW(dialog),
+                                       "dialog-warning");
                        break;
 
                case ZENITY_MSG_QUESTION:
-                       zenity_util_set_window_icon_from_icon_name (
-                               dialog, data->window_icon, "dialog-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:
-                       zenity_util_set_window_icon_from_icon_name (
-                               dialog, data->window_icon, "dialog-question");
+                       gtk_window_set_icon_name (GTK_WINDOW(dialog),
+                                       "dialog-question");
                        break;
 
                case ZENITY_MSG_ERROR:
-                       zenity_util_set_window_icon_from_icon_name (
-                               dialog, data->window_icon, "dialog-error");
+                       gtk_window_set_icon_name (GTK_WINDOW(dialog),
+                                       "dialog-error");
                        break;
 
                case ZENITY_MSG_INFO:
-                       zenity_util_set_window_icon_from_icon_name (
-                               dialog, data->window_icon, "dialog-information");
+                       gtk_window_set_icon_name (GTK_WINDOW(dialog),
+                                       "dialog-information");
                        break;
 
                default:
diff --git a/src/notification.c b/src/notification.c
index 20a47f75..e5cfe279 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -75,7 +75,7 @@ on_notification_default_action (NotifyNotification *n,
 
        zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
 
-       exit(zen_data->exit_code);
+       zenity_util_gapp_quit (NULL);
 }
 
 static GHashTable *
@@ -378,10 +378,7 @@ zenity_notification (ZenityData *data,
        {
                zenity_notification_listen_on_stdin (data);
 
-               /* FIXME - gtk_main () was here. Possibly replace this with the
-                * zenity_util_gapp_main function and a corresponding  _quit in
-                * place of the exit calls. 
-                */
+               zenity_util_gapp_main (NULL);
        }
        else
        {
@@ -431,10 +428,7 @@ zenity_notification (ZenityData *data,
                        (GSourceFunc) zenity_util_timeout_handle,
                        NULL);
 
-               /* FIXME - gtk_main () was here. Possibly replace this with the
-                * zenity_util_gapp_main function and a corresponding  _quit in
-                * place of the exit calls. 
-                */
+               zenity_util_gapp_main (NULL);
        }
 }
 
diff --git a/src/progress.c b/src/progress.c
index 69836c4b..06e54e00 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -156,12 +156,14 @@ zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition,
        static ZenityProgressData *progress_data;
        static GObject *progress_bar;
        static GObject *progress_label;
+       static GtkWindow *parent;
        float percentage = 0.0;
        GIOStatus status = G_IO_STATUS_NORMAL;
 
        progress_data = data;
        progress_bar = gtk_builder_get_object (builder, "zenity_progress_bar");
        progress_label = gtk_builder_get_object (builder, "zenity_progress_text");
+       parent = GTK_WINDOW(gtk_widget_get_native (GTK_WIDGET(progress_bar)));
 
        if ((condition & G_IO_IN) != 0)
        {
@@ -259,12 +261,12 @@ zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition,
                                        gtk_widget_set_sensitive (GTK_WIDGET (button), TRUE);
                                        gtk_widget_grab_focus (GTK_WIDGET (button));
 
-                                       if (progress_data->autoclose) {
+                                       if (progress_data->autoclose)
+                                       {
                                                zen_data->exit_code =
                                                        zenity_util_return_exit_code (ZENITY_OK);
-                                               // FIXME - don't know how to replace gtk_main_quit
-                                               // here.
-                                               exit(zen_data->exit_code);
+
+                                               zenity_util_gapp_quit (parent);
                                        }
                                }
                        }
@@ -296,10 +298,10 @@ zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition,
 
                g_object_unref (builder);
 
-               if (progress_data->autoclose) {
+               if (progress_data->autoclose)
+               {
                        zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
-                       // FIXME - not sure how to replace gtk_main_quit here
-                       exit(zen_data->exit_code);
+                       zenity_util_gapp_quit (parent);
                }
 
                g_io_channel_shutdown (channel, TRUE, NULL);
@@ -330,18 +332,6 @@ zenity_progress_read_info (ZenityProgressData *progress_data)
        }
 }
 
-// FIXME - I don't have context as to what this is supposed to accomplish,
-// and it uses signals that are gone in gtk4, so I'm just going to remove
-// for now and see if necessary - if so will replace later.
-#if 0
-static void
-zenity_text_size_allocate (GtkWidget *widget, GtkAllocation *allocation,
-               gpointer data)
-{
-       gtk_widget_set_size_request (widget, allocation->width / 2, -1);
-}
-#endif
-
 void
 zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
 {
@@ -372,9 +362,8 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
        if (data->dialog_title)
                gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
 
-       zenity_util_set_window_icon (dialog,
-               data->window_icon,
-               ZENITY_IMAGE_FULLPATH ("zenity-progress.png"));
+       gtk_window_set_icon_name (GTK_WINDOW(dialog),
+                       "appointment-soon");
 
        if (data->width > -1 || data->height > -1)
                gtk_window_set_default_size (GTK_WINDOW(dialog),
diff --git a/src/scale.c b/src/scale.c
index 180a0c33..62714a5b 100644
--- a/src/scale.c
+++ b/src/scale.c
@@ -79,8 +79,8 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
        if (data->dialog_title)
                gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
 
-       zenity_util_set_window_icon (dialog, data->window_icon,
-                       ZENITY_IMAGE_FULLPATH ("zenity-scale.png"));
+       gtk_window_set_icon_name (GTK_WINDOW(dialog),
+                       "dialog-question");
 
        if (data->width > -1 || data->height > -1) {
                gtk_window_set_default_size (GTK_WINDOW(dialog),
diff --git a/src/text.c b/src/text.c
index 291b5da9..09c8c438 100644
--- a/src/text.c
+++ b/src/text.c
@@ -294,8 +294,8 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
        if (data->dialog_title)
                gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
 
-       zenity_util_set_window_icon (dialog, data->window_icon,
-                       ZENITY_IMAGE_FULLPATH ("zenity-text.png"));
+       gtk_window_set_icon_name (GTK_WINDOW(dialog),
+                       "accessories-text-editor");
 
        gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
 
@@ -373,7 +373,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data)
        if (data->modal)
                gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 
-// FIXME - TODO
+/* TODO once gtk4 support fully lands in webkitgtk. */
 #ifdef HAVE_WEBKITGTK
        if (text_data->html) {
                web_kit = webkit_web_view_new ();
diff --git a/src/tree.c b/src/tree.c
index 26a9ca4b..5f995835 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -35,10 +35,10 @@
 
 #include <config.h>
 
-#define MAX_ELEMENTS_BEFORE_SCROLLING 5
 #define PRINT_HIDE_COLUMN_SEPARATOR ","
 
 static GtkBuilder *builder;
+static GtkTreeView *tree_view;
 static GSList *selected;
 static char *separator;
 static gboolean print_all_columns = FALSE;
@@ -138,7 +138,6 @@ static gboolean
 zenity_tree_handle_stdin (GIOChannel *channel, GIOCondition condition,
                gpointer data)
 {
-       static GtkTreeView *tree_view;
        GtkTreeModel *model;
        static GtkTreeIter iter;
        static int column_count = 0;
@@ -149,7 +148,9 @@ zenity_tree_handle_stdin (GIOChannel *channel, GIOCondition condition,
        static gboolean first_time = TRUE;
        GIOStatus status = G_IO_STATUS_NORMAL;
 
-       tree_view = GTK_TREE_VIEW (data);
+       /* Make sure global is properly defined */
+       g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), FALSE);
+
        n_columns =
                GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tree_view), "n_columns"));
        editable =
@@ -195,8 +196,8 @@ zenity_tree_handle_stdin (GIOChannel *channel, GIOCondition condition,
                        if (status != G_IO_STATUS_NORMAL)
                        {
                                if (error) {
-                                       g_warning (
-                                               "zenity_tree_handle_stdin () : %s", error->message);
+                                       g_warning ("%s: %s",
+                                               __func__, error->message);
                                        g_error_free (error);
                                        error = NULL;
                                }
@@ -239,22 +240,6 @@ zenity_tree_handle_stdin (GIOChannel *channel, GIOCondition condition,
                                                &iter, n_columns, TRUE, -1);
                        }
 
-                       if (row_count == MAX_ELEMENTS_BEFORE_SCROLLING)
-                       {
-                               GtkWidget *scrolled_window;
-                               GtkRequisition rectangle;
-
-                               gtk_widget_get_preferred_size (GTK_WIDGET(tree_view),
-                                               &rectangle, NULL);
-                               scrolled_window = GTK_WIDGET(gtk_builder_get_object (builder,
-                                                       "zenity_tree_window"));
-                               gtk_widget_set_size_request (scrolled_window,
-                                               -1, rectangle.height);
-                               gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scrolled_window),
-                                       GTK_POLICY_AUTOMATIC,
-                                       GTK_POLICY_AUTOMATIC);
-                       }
-
                        column_count++;
 
                } while ((g_io_channel_get_buffer_condition (channel) & G_IO_IN) ==
@@ -273,9 +258,13 @@ zenity_tree_handle_stdin (GIOChannel *channel, GIOCondition condition,
 }
 
 static void
-zenity_tree_fill_entries_from_stdin (GtkTreeView *tree_view, gint n_columns,
+zenity_tree_fill_entries_from_stdin (GtkTreeView *loc_tv, int n_columns,
        gboolean toggles, gboolean editable)
 {
+       /* No reason this should fail. Sanity check. */
+       g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+       g_assert (loc_tv == tree_view);
+
        g_object_set_data (
                G_OBJECT (tree_view), "n_columns", GINT_TO_POINTER (n_columns));
        g_object_set_data (
@@ -286,18 +275,22 @@ zenity_tree_fill_entries_from_stdin (GtkTreeView *tree_view, gint n_columns,
        channel = g_io_channel_unix_new (0);
        g_io_channel_set_encoding (channel, NULL, NULL);
        g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL);
-       g_io_add_watch (
-               channel, G_IO_IN | G_IO_HUP, zenity_tree_handle_stdin, tree_view);
+       g_io_add_watch (channel,
+                       G_IO_IN | G_IO_HUP, zenity_tree_handle_stdin, NULL);
 }
 
 static void
-zenity_tree_fill_entries (GtkTreeView *tree_view, const char **args,
+zenity_tree_fill_entries (GtkTreeView *loc_tv, const char **args,
        int n_columns, gboolean toggles, gboolean editable)
 {
        GtkTreeModel *model;
        GtkTreeIter iter;
        int i = 0;
 
+       /* No reason this should fail. Sanity check. */
+       g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+       g_assert (loc_tv == tree_view);
+
        model = gtk_tree_view_get_model (tree_view);
 
        g_object_set_data (
@@ -323,26 +316,10 @@ zenity_tree_fill_entries (GtkTreeView *tree_view, const char **args,
                                        GTK_LIST_STORE (model), &iter, j, args[i + j], -1);
                }
 
-               if (editable)
-                       gtk_list_store_set (
-                               GTK_LIST_STORE (model), &iter, n_columns, TRUE, -1);
-
-               if (i == MAX_ELEMENTS_BEFORE_SCROLLING)
-               {
-                       GtkWidget *scrolled_window;
-                       GtkRequisition rectangle;
-
-                       gtk_widget_get_preferred_size (
-                               GTK_WIDGET (tree_view), &rectangle, NULL);
-                       scrolled_window = GTK_WIDGET (
-                               gtk_builder_get_object (builder, "zenity_tree_window"));
-                       gtk_widget_set_size_request (scrolled_window, -1, rectangle.height);
-                       gtk_scrolled_window_set_policy (
-                               GTK_SCROLLED_WINDOW (scrolled_window),
-                               GTK_POLICY_AUTOMATIC,
-                               GTK_POLICY_AUTOMATIC);
+               if (editable) {
+                       gtk_list_store_set (GTK_LIST_STORE(model),
+                                       &iter, n_columns, TRUE, -1);
                }
-
                i += n_columns;
        }
 }
@@ -384,7 +361,6 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
 {
        GtkWidget *dialog;
        GtkWidget *button;
-       GObject *tree_view;
        GObject *text;
        GtkTreeViewColumn *column;
        GtkListStore *model;
@@ -477,15 +453,17 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
                gtk_label_set_markup (GTK_LABEL(text),
                                g_strcompress (tree_data->dialog_text));
 
-       zenity_util_set_window_icon (dialog, data->window_icon,
-                       ZENITY_IMAGE_FULLPATH ("zenity-list.png"));
+       gtk_window_set_icon_name (GTK_WINDOW(dialog),
+                       "view-sort-ascending");
 
        if (data->width > -1 || data->height > -1) {
                gtk_window_set_default_size (GTK_WINDOW(dialog),
                                data->width, data->height);
        }
 
-       tree_view = gtk_builder_get_object (builder, "zenity_tree_view");
+       /* Define global tree_view. */
+       tree_view = GTK_TREE_VIEW(gtk_builder_get_object (builder,
+                               "zenity_tree_view"));
 
        if (!(tree_data->radiobox || tree_data->checkbox))
        {
@@ -519,23 +497,23 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
        else
                gtk_list_store_set_column_types (model, n_columns, column_types);
 
-       gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (model));
+       gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL(model));
 
        if (! (tree_data->radiobox || tree_data->checkbox))
        {
                if (tree_data->multi)
                        gtk_tree_selection_set_mode (
-                               gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
+                               gtk_tree_view_get_selection (tree_view),
                                GTK_SELECTION_MULTIPLE);
                else
                        gtk_tree_selection_set_mode (
-                               gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
+                               gtk_tree_view_get_selection (tree_view),
                                GTK_SELECTION_SINGLE);
        }
        else
        {
                gtk_tree_selection_set_mode (
-                       gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
+                       gtk_tree_view_get_selection (tree_view),
                        GTK_SELECTION_NONE);
        }
 
@@ -585,7 +563,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
                                        cell_renderer = gtk_cell_renderer_text_new ();
                                        g_signal_connect (cell_renderer, "edited",
                                                G_CALLBACK (zenity_cell_edited_callback),
-                                               gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)));
+                                               gtk_tree_view_get_model (tree_view));
 
                                        g_object_set_data (G_OBJECT (cell_renderer),
                                                "column",
@@ -627,7 +605,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
                                cell_renderer = gtk_cell_renderer_text_new ();
                                g_signal_connect (cell_renderer, "edited",
                                        G_CALLBACK (zenity_cell_edited_callback),
-                                       gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)));
+                                       gtk_tree_view_get_model (tree_view));
 
                                g_object_set_data (G_OBJECT (cell_renderer),
                                        "column",
@@ -657,24 +635,24 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
                                gtk_tree_view_column_set_visible (column, FALSE);
                }
 
-               gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
+               gtk_tree_view_append_column (tree_view, column);
                column_index++;
        }
 
        if (tree_data->hide_header)
-               gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
+               gtk_tree_view_set_headers_visible (tree_view, FALSE);
 
        if (tree_data->radiobox || tree_data->checkbox)
        {
                if (tree_data->data && *tree_data->data) {
-                       zenity_tree_fill_entries (GTK_TREE_VIEW (tree_view),
+                       zenity_tree_fill_entries (tree_view,
                                tree_data->data,
                                n_columns,
                                TRUE,
                                tree_data->editable);
                }
                else {
-                       zenity_tree_fill_entries_from_stdin (GTK_TREE_VIEW (tree_view),
+                       zenity_tree_fill_entries_from_stdin (tree_view,
                                n_columns,
                                TRUE,
                                tree_data->editable);
@@ -683,13 +661,13 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
        else
        {
                if (tree_data->data && *tree_data->data) {
-                       zenity_tree_fill_entries (GTK_TREE_VIEW (tree_view),
+                       zenity_tree_fill_entries (tree_view,
                                tree_data->data,
                                n_columns,
                                FALSE,
                                tree_data->editable);
                } else {
-                       zenity_tree_fill_entries_from_stdin (GTK_TREE_VIEW (tree_view),
+                       zenity_tree_fill_entries_from_stdin (tree_view,
                                n_columns,
                                FALSE,
                                tree_data->editable);
@@ -699,7 +677,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
        zenity_util_show_dialog (dialog);
 
        if (tree_data->mid_search) {
-               gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (tree_view),
+               gtk_tree_view_set_search_equal_func (tree_view,
                        (GtkTreeViewSearchEqualFunc) zenity_mid_search_func,
                        model,
                        NULL);
@@ -718,7 +696,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
 
 static void
 zenity_tree_dialog_get_selected (GtkTreeModel *model, GtkTreePath *path_buf,
-       GtkTreeIter *iter, GtkTreeView *tree_view)
+       GtkTreeIter *iter, gpointer user_data)
 {
        GValue value = G_VALUE_INIT;
        int n_columns, i;
@@ -749,7 +727,7 @@ zenity_tree_dialog_get_selected (GtkTreeModel *model, GtkTreePath *path_buf,
 
 static gboolean
 zenity_tree_dialog_toggle_get_selected (GtkTreeModel *model, GtkTreePath *path,
-       GtkTreeIter *iter, GtkTreeView *tree_view)
+       GtkTreeIter *iter, gpointer user_data)
 {
        GValue toggle_value = G_VALUE_INIT;
        int n_columns, i;
@@ -794,25 +772,25 @@ zenity_tree_dialog_toggle_get_selected (GtkTreeModel *model, GtkTreePath *path,
 static void
 zenity_tree_dialog_output (void)
 {
-       GObject *tree_view;
        GtkTreeSelection *selection;
        GtkTreeModel *model;
 
-       tree_view = gtk_builder_get_object (builder, "zenity_tree_view");
-       model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
+       g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+
+       model = gtk_tree_view_get_model (tree_view);
 
        if (gtk_tree_model_get_column_type (model, 0) == G_TYPE_BOOLEAN)
        {
                gtk_tree_model_foreach (model,
                        (GtkTreeModelForeachFunc) zenity_tree_dialog_toggle_get_selected,
-                       GTK_TREE_VIEW (tree_view));
+                       NULL);
        }
        else
        {
-               selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+               selection = gtk_tree_view_get_selection (tree_view);
                gtk_tree_selection_selected_foreach (selection,
                        (GtkTreeSelectionForeachFunc) zenity_tree_dialog_get_selected,
-                       GTK_TREE_VIEW (tree_view));
+                       NULL);
        }
 
 
@@ -871,16 +849,22 @@ zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data)
 }
 
 static void
-zenity_tree_row_activated (GtkTreeView *tree_view, GtkTreePath *tree_path,
+zenity_tree_row_activated (GtkTreeView *loc_tv, GtkTreePath *tree_path,
        GtkTreeViewColumn *tree_col, gpointer data)
 {
+       GtkWindow *parent;
        ZenityData *zen_data = data;
 
+       /* No reason this should fail. Sanity check. */
+       g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
+       g_assert (loc_tv == tree_view);
+
        zenity_tree_dialog_output ();
        zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
 
-       // FIXME - TEST - not sure how to replace gtk_main_quit here.
-       exit(zen_data->exit_code);
+       parent = GTK_WINDOW(gtk_widget_get_native (GTK_WIDGET(tree_view)));
+
+       zenity_util_gapp_quit (parent);
 }
 
 static gboolean
diff --git a/src/util.c b/src/util.c
index 4a921496..51cfe279 100644
--- a/src/util.c
+++ b/src/util.c
@@ -178,6 +178,7 @@ zenity_util_fill_file_buffer (GtkTextBuffer *buffer, const char *filename) {
        return TRUE;
 }
 
+#if 0
 const char *
 zenity_util_icon_name_from_filename (const char *filename) {
        if (!filename || !filename[0])
@@ -193,10 +194,13 @@ zenity_util_icon_name_from_filename (const char *filename) {
                return "dialog-error";
        return NULL;
 }
+#endif
 
+#if 0
 void
-zenity_util_set_window_icon_from_file (
-       GtkWidget *widget, const char *filename) {
+zenity_util_set_window_icon_from_file (GtkWidget *widget,
+               const char *filename)
+{
        const char *icon_name;
 
        icon_name = zenity_util_icon_name_from_filename (filename);
@@ -207,10 +211,11 @@ zenity_util_set_window_icon_from_file (
                                __func__);
        }
 }
+#endif
 
+#if 0
 void
-zenity_util_set_window_icon (GtkWidget *widget,
-               const char *filename, const char *default_file)
+zenity_util_set_window_icon (GtkWidget *widget, const char *icon_name)
 {
        if (filename != NULL) {
                zenity_util_set_window_icon_from_file (widget, filename);
@@ -219,15 +224,19 @@ zenity_util_set_window_icon (GtkWidget *widget,
                                __func__);
        }
 }
+#endif
 
+#if 0
 void
-zenity_util_set_window_icon_from_icon_name (
-       GtkWidget *widget, const char *filename, const char *default_icon_name) {
+zenity_util_set_window_icon_from_icon_name (GtkWidget *widget,
+               const char *filename, const char *default_icon_name)
+{
        if (filename != NULL)
                zenity_util_set_window_icon_from_file (widget, filename);
        else
                gtk_window_set_icon_name (GTK_WINDOW (widget), default_icon_name);
 }
+#endif
 
 void
 zenity_util_show_help (GError **error) {
@@ -311,88 +320,7 @@ zenity_util_exit_code_with_data (ZenityExitCode value, ZenityData *zen_data)
        zen_data->exit_code = zenity_util_return_exit_code (value);
 }
 
-#if 0
-// FIXME - ???
-//#ifdef GDK_WINDOWING_X11
-
-static Window
-transient_get_xterm (void) {
-       const char *wid_str = g_getenv ("WINDOWID");
-       if (wid_str) {
-               char *wid_str_end;
-               int ret;
-               Window wid = strtoul (wid_str, &wid_str_end, 10);
-               if (*wid_str != '\0' && *wid_str_end == '\0' && wid != 0) {
-                       XWindowAttributes attrs;
-                       gdk_error_trap_push ();
-                       ret = XGetWindowAttributes (
-                               GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), wid, &attrs);
-                       gdk_flush ();
-                       if (gdk_error_trap_pop () != 0 || ret == 0) {
-                               return None;
-                       }
-                       return wid;
-               }
-       }
-       return None;
-}
-
-static void
-transient_x_free (void *ptr) {
-       if (ptr)
-               XFree (ptr);
-}
-
-static gboolean
-transient_is_toplevel (Window wid) {
-       XTextProperty prop;
-       Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
-       if (!XGetWMName (dpy, wid, &prop))
-               return FALSE;
-       transient_x_free (prop.value);
-       return !!prop.value;
-}
-
-/*
- * GNOME Terminal doesn't give us its toplevel window, but the WM needs a
- * toplevel XID for proper stacking.  Other terminals work fine without this
- * magic.  We can't use GDK here since "xterm" is a foreign window.
- */
-
-static Window
-transient_get_xterm_toplevel (void) {
-       Window xterm = transient_get_xterm ();
-       Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
-       while (xterm != None && !transient_is_toplevel (xterm)) {
-               Window root, parent, *children;
-               unsigned nchildren;
-               XQueryTree (dpy, xterm, &root, &parent, &children, &nchildren);
-               transient_x_free (children);
-               if (parent == root)
-                       xterm = None;
-               else
-                       xterm = parent;
-       }
-       return xterm;
-}
-
-static void
-zenity_util_make_transient (GdkWindow *window, Window parent) {
-       Window parent_window = parent;
-       if (parent_window == 0)
-               parent_window = transient_get_xterm_toplevel ();
-       if (parent_window != None) {
-               XSetTransientForHint (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
-                       GDK_WINDOW_XID (window),
-                       parent_window);
-       }
-}
-
-#endif /* GDK_WINDOWING_X11 */
-
-/* helper for common_set_gtkhex_font_from_settings.
- * 
- * This function was written by Matthias Clasen and is included somewhere in
+/* This function was written by Matthias Clasen and is included somewhere in
  * the GTK source tree.. I believe it is also included in libdazzle, but I
  * didn't want to include a whole dependency just for one function. LGPL, but
  * credit where credit is due!
@@ -522,7 +450,6 @@ zenity_util_pango_font_description_to_css (PangoFontDescription *desc)
 void
 zenity_util_show_dialog (GtkWidget *dialog)
 {
-       gtk_widget_realize (dialog);    // FIXME - doubt this is necessary.
        gtk_widget_show (dialog);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]