summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan Rathbone <poprocks@gmail.com>2021-06-28 22:18:19 -0400
committerLogan Rathbone <poprocks@gmail.com>2021-06-28 22:18:19 -0400
commitf919a7ac20b7f3dce4ae3ca6acb467508b486851 (patch)
treeefa8127d9af6f86db7437f2e463499474f52f2e8
parentca284f14cd2b90964f57c2e0016ef0d82be2a67a (diff)
parent9c98fe67a84590bab8478266a74ba9df6dcc58b8 (diff)
downloadzenity-f919a7ac20b7f3dce4ae3ca6acb467508b486851.tar.gz
Merge branch 'LARathbone/zenity-gtk4-port' into gtk4-port
-rw-r--r--COPYING216
-rw-r--r--MAINTAINERS7
-rw-r--r--Makefile.am32
-rw-r--r--NEWS3
-rw-r--r--README12
-rw-r--r--README.md18
-rw-r--r--THANKS158
-rw-r--r--TODO14
-rwxr-xr-xautogen.sh38
-rw-r--r--configure.ac140
-rw-r--r--data/Makefile.am23
-rw-r--r--data/gnome-tshirt.pngbin4147 -> 0 bytes
-rw-r--r--data/hawaii-shirt.pngbin13730 -> 0 bytes
-rw-r--r--data/meson.build1
-rw-r--r--data/monk.pngbin9773 -> 0 bytes
-rw-r--r--data/sunglasses.pngbin2721 -> 0 bytes
-rw-r--r--data/surfboard.pngbin14484 -> 0 bytes
-rw-r--r--data/zenity-calendar.pngbin2857 -> 0 bytes
-rw-r--r--data/zenity-entry.pngbin1669 -> 0 bytes
-rw-r--r--data/zenity-file.pngbin1343 -> 0 bytes
-rw-r--r--data/zenity-list.pngbin256 -> 0 bytes
-rw-r--r--data/zenity-notification.pngbin898 -> 0 bytes
-rw-r--r--data/zenity-progress.pngbin4509 -> 0 bytes
-rw-r--r--data/zenity-scale.pngbin240 -> 0 bytes
-rw-r--r--data/zenity-text.pngbin3523 -> 0 bytes
-rw-r--r--data/zenity.17
-rw-r--r--[-rwxr-xr-x]help/C/l10n.txt0
-rw-r--r--help/C/notification.page8
-rw-r--r--help/C/usage.page8
-rw-r--r--help/ChangeLog.pre-git (renamed from help/ChangeLog)0
-rw-r--r--help/LINGUAS1
-rw-r--r--help/Makefile.am45
-rw-r--r--help/meson.build48
-rw-r--r--icons/hicolor/48x48/apps/zenity.png (renamed from data/zenity.png)bin2342 -> 2342 bytes
-rw-r--r--icons/meson.build4
-rw-r--r--meson.build109
-rw-r--r--meson_options.txt6
-rw-r--r--meson_post_install.py15
-rw-r--r--po/ChangeLog.pre-git (renamed from po/ChangeLog)0
-rw-r--r--po/Makevars78
-rw-r--r--po/POTFILES (renamed from po/POTFILES.in)0
-rw-r--r--po/POTFILES.skip2
-rw-r--r--po/en_CA.po784
-rw-r--r--po/meson.build4
-rw-r--r--src/Makefile.am57
-rw-r--r--src/about.c272
-rw-r--r--src/calendar.c143
-rw-r--r--src/color.c69
-rw-r--r--src/entry.c182
-rw-r--r--src/fileselection.c200
-rw-r--r--src/forms.c357
-rw-r--r--src/main.c110
-rw-r--r--src/meson.build53
-rw-r--r--src/msg.c145
-rw-r--r--src/notification.c240
-rw-r--r--src/option.c1973
-rw-r--r--src/option.h13
-rw-r--r--src/password.c215
-rw-r--r--src/progress.c307
-rw-r--r--src/scale.c121
-rw-r--r--src/text.c213
-rw-r--r--src/tree.c556
-rw-r--r--src/util.c393
-rw-r--r--src/util.h69
-rw-r--r--src/zenity.gresource.xml28
-rw-r--r--src/zenity.h122
-rw-r--r--src/zenity.ui1901
67 files changed, 4700 insertions, 4820 deletions
diff --git a/COPYING b/COPYING
index bf50f20..4362b49 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/MAINTAINERS b/MAINTAINERS
deleted file mode 100644
index b33bb87..0000000
--- a/MAINTAINERS
+++ /dev/null
@@ -1,7 +0,0 @@
-Luis Medinas
-E-mail: lmedinas@src.gnome.org
-Userid: lmedinas
-
-Arx Cruz
-E-mail: arxcruz@src.gnome.org
-Userid: arxcruz
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 81ae6a7..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1,32 +0,0 @@
-ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-AM_CPPFLAGS = src
-
-SUBDIRS = \
- src \
- po \
- data \
- help
-
-EXTRA_DIST = \
- autogen.sh \
- config.rpath \
- COPYING \
- HACKING \
- ChangeLog \
- NEWS \
- README \
- AUTHORS
-
-dist-hook:
- @if test -d "$(srcdir)/.git"; \
- then \
- echo Creating ChangeLog && \
- ( cd "$(top_srcdir)" && \
- echo '# Generated by Makefile. Do not edit.'; echo; \
- $(top_srcdir)/missing --run git log --stat ) > ChangeLog.tmp \
- && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
- || ( rm -f ChangeLog.tmp ; \
- echo Failed to generate ChangeLog >&2 ); \
- else \
- echo A git clone is required to generate a ChangeLog >&2; \
- fi
diff --git a/NEWS b/NEWS
index 37d8e3d..4fc6c9b 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 b/README
deleted file mode 100644
index d869950..0000000
--- a/README
+++ /dev/null
@@ -1,12 +0,0 @@
-Zen Understanding -
-===================
-This is zenity - a rewrite of gdialog, the GNOME port of dialog
-which allows you to display dialog boxes from the commandline
-and shell scripts. If you understand, things are just as they
-are. If you don't understand, things are just as they are.
-
-This software is licensed under the LGPL.
-
-Zen Requirements -
-==================
-gtk+-3.0
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6a01086
--- /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/THANKS b/THANKS
deleted file mode 100644
index 2ffed68..0000000
--- a/THANKS
+++ /dev/null
@@ -1,158 +0,0 @@
- "Authors",
- "=======",
- "Glynn Foster <glynn foster sun com>",
- "Mike Newman <mikegtn gnome org>",
- "Lucas Rocha <lucasr gnome org>",
-
- "Patches from the following people",
- "=================================",
- "Darren Adams <darrenadams dsl pipex com>"
- "Timo Aaltonen <tjaaltonen gnome cc hut fi>",
- "Peter Astrand <astrand lysator liu se>",
- "Jonathan Blandford <jrb redhat com>",
- "Paul Bolle <pebolle tiscali nl>",
- "Paolo Borelli <pborelli katamail com>",
- "Leonardo Boshell <p kapcoweb com>",
- "Ross Burton <ross burtonini com>",
- "Damien Carbery <damien carbery sun com>",
- "Anders Carlsson <andersca codefactory se>",
- "Ed Catmur <ed catmur co uk>",
- "Nicholas Curran <quasar austar net au>",
- "John Fleck <jfleck inkstain net>",
- "Sebastian Heinlein <glatzor pimpzkru de>",
- "James Henstridge <james daa com au>",
- "Chris Lahey <clahey ximian com>",
- "Mihai T Lazarescu <mihai email it>",
- "Sebastian Kapfer <sebastian_kapfer web de>",
- "Tomasz Koczko <kloczek pld org pl>",
- "Jordi Mallach <jordi sindominio net>",
- "Kjartan Maraas <kmaraas gnome org>",
- "Breda McColgan <breda mccolgan sun com>",
- "Baptiste Mille-Mathias <bmm80 free fr>",
- "Buhan Milne <bgmilne linux-mandrake com>",
- "Christian Monneckes <c-w-m gmx de>",
- "Ivan Noris <vix vazka sk>",
- "Carlos Parra <cparra emergya info>",
- "Havoc Pennington <hp redhat com>",
- "Jan Arne Petersen <jpetersen uni-bonn de>",
- "Kevin C Krinke <kckrinke opendoorsoftware com>",
- "Sriram Ramkrishna <sri aracnet com>",
- "Kristian Rietveld <kris gtk org>",
- "Lucas Rocha <lucasr im ufba br>",
- "Christian Rose <menthos menthos com>",
- "Jakub Steiner <jimmac ximian com>",
- "Luke Suchocki <gnome lukiepoo com>",
- "Daniel d'Surreal <dagmar speakeasy net>",
- "Hidetoshi Tajima <hidetoshi tajima sun com>",
- "Tom Tromey <tromey redhat com>",
- "Yann <bloch iie cnam fr>",
- "Norman Rasmussen <normanr gmail com>",
- "Benoît Dejean <tazforever dlfp org>",
- "",
- "And all the translators that rock my world",
- "==========================================",
- "Vincent van Adrighem <v vanadrighem dirck mine nu>",
- "Taneem Ahmed <taneem bengalinux org>",
- "Takeshi Aihana <aihana gnome gr jp>",
- "Amanpreet Singh Alam <amanlinux netscape net>",
- "Metin Amiroff <metin karegen com>",
- "Sanlig Badral <badral openmn org>",
- "John C Barstow <jbowtie amathaine com>",
- "Aygimantas Beruka <uid0 tuxfamily org>",
- "Alberto Fernandez Benito <afernn euskalnet net>",
- "Stefano Canepa <sc linux it>",
- "Young-Ho Cha <ganadist mizi com>",
- "Abel Cheung <maddog linux org hk>",
- "Zbigniew Chyla <cyba gnome pl>",
- "Mohammad Damt <mdamt bisnisweb com>",
- "Fatih Demir <kabalak gtranslator org>",
- "Laurent Dhima <laurenti alblinux net>",
- "Paul Duffy <dubhthach frink nuigalway ie>",
- "Laszlo Dvornik <dvornik gnome hu>",
- "Maxim Dziumanenko <mvd mylinux com ua>",
- "Francisco Javier Fernandez <serrador arrakis es>",
- "Artur Flinta <aflinta cvs gnome org>",
- "Alessio Frusciante <algol firenze linux it>",
- "Evandro Fernandes Giovanini <evandrofg ig com br>",
- "Pablo Gonzalo del Campo <pablodc bigfoot com>",
- "Dhurba Gnawali <dhurbagnawali hotmail com>",
- "Sammi Gunnarsson <sammi techattack nu>",
- "Martin Willemoes Hansen <mwh sysrq dk>",
- "Dafydd Harries <daf parnassus ath cx>",
- "Raphael Higino <raphaelh cvs gnome org>",
- "Wang Jian <lark linux net cn>",
- "Guntupalli Karunakar <karunakar freedomink org>",
- "Tomas Kuliavas <tokul users sourceforge net>",
- "Priit Laes <amd tt ee>",
- "Inaki Larranaga <dooteo euskalgnu org>",
- "Ole Laursen <olau hardworking dk>",
- "Toivo Leedjrv <toivo linux ee>",
- "David Lodge <dave cirt net>",
- "Duarte Loreto <happyguy_pt hotmail com>",
- "Johanna Makkonen <johanna makkonen iki fi>",
- "Jordi Mallach <jordi sindominio net>",
- "Kjartan Maraas <kmaraas gnome org>",
- "Jordi Mas <jmas softcatala org>",
- "Kamagasako Masatoshi <emerald gnome gr jp>",
- "Dmitry G Mastrukov <dmitry taurussoft org>",
- "Arafat Medini <lumina silverpen de>",
- "Christophe Merlet <redfox redfoxcenter org>",
- "Mike Newman <mikegtn gnome org>",
- "Ahmad Riza H Nst <rizahnst eriagempita co id>",
- "Alexandre Folle de Menezes <afmenez terra com br>",
- "Christian Neumair <chris gnome-de org>",
- "Metin Omirov <metin karegen com>",
- "Gareth Owen <gowen72 yahoo com>",
- "Kostas Papadimas <pkst gmx net>",
- "Ankit Patel <ankit redhat com>",
- "Sami Pesonen <sampeson iki fi>",
- "Roozbeh Pournader <roozbeh sharif edu>",
- "Jarkko Ranta <jjranta cc joensuu fi>",
- "Rostislav Raykov <zbrox dir bg>",
- "Hendrik Richter <hendrik gnome de org>",
- "Christian Rose <menthos menthos com>",
- "Changwoo Ryu <cwryu debian org>",
- "Pablo Saratxaga <pablo mandrakesoft com>",
- "Robert Sedak <robert sedak sk htnet hr>",
- "Paisa Seeluangsawat <paisa users sf net>",
- "Danilo Segan <dsegan gmx net>",
- "Alexander Shopov <ash contact bg>",
- "Aasmund Skjaveland <aasmunds fys uio no>",
- "Yuriy Syrota <rasta renome rovno ua>",
- "Marcel Telka <marcel telka sk>",
- "Andras Timar <timar gnome hu>",
- "Miloslav Trmac <mitr volny cz>",
- "Mugurel Tudor <mugurelu go ro>",
- "Daniel Yacob <locales geez org>",
- "Funda Wang <fundawang linux net cn>",
- "Alexander Winston <alexander winston comcast net>",
- "Theppitak Karoonboonyanan <thep linux thai net>",
- "Martin Willemoes Hansen <mwh sysrq dk>",
- "Ignacio Casal Quinteiro <nacho.resa gmail com>",
- "Pawan Chitrakar <pawan nplinux org>",
- "Rajesh Ranjan <rajeshkajha yahoo org>",
- "Vladimir Petkov <vpetkov i-space org>",
- "Abduxukur Abdurixit <abduxukur.abdurixit t-systems ch>",
- "Adi Attar <aattar cvs gnome org>",
- "Steve Murphy <murf e-tools com>",
- "Josep Puigdemont <josep imatge-sintetica com>",
- "Adam Weinberger <adamw gnome org>",
- "Ivar Smolin <okul linux ee>",
- "Jens Seidel <jensseidel users sf net>",
- "Benoît Dejean <tazforever dlfp org>",
- "Yair Hershkovitz <yairhr gmail com>",
- "Clytie Siddall <clytie riverland net au>",
- "Ilkka Tuohela <hile iki fi>",
- "Chao-Hsiung Liao <j_h_liau yahoo com tw>",
- "Žygimantas Beručka <zygis gnome org>",
- "Gabor Kelemen <kelemeng gnome hu>",
- "Telsa Gwynne <hobbit aloss ukuu org uk>",
- "Slobodan D. Sredojevic <ssl uns ns ac yu>",
- "Baris Cicek <baris teamforce name tr>",
- "Runa Bhattacharjee <runa bengalinux org>",
- "Erdal Ronahi <erdal.ronahi gmail com>",
- "Luca Ferretti <elle.uca infinito it>",
- "Lasse Bang Mikkelsen <lbm fatalerror dk>",
- "Vincent Untz <vuntz gnome org>",
- "Leonid Kanter <leon asplinux ru>",
- "Daniel Nylander <po danielnylander se>",
diff --git a/TODO b/TODO
deleted file mode 100644
index 98329fd..0000000
--- a/TODO
+++ /dev/null
@@ -1,14 +0,0 @@
-* Support extra buttons, help buttons with the ability to change the label on the button
- - Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com>
-* Would be nice to have an option to use your own icon in the info/warning/message/question dialogs
- - Suggested by Kevin Krinke <kckrinke@opendoorsoftware.com>
-* Add pixmap support to list dialog
- - Suggested by Dani Brody <brodydani@hotmail.com>
-* Add new format
- --list --column=check,hide --column=pixmap --column=string,editable
- - Suggested by Dani Brody <brodydani@hotmail.com>
-* Add support for DML (Dialog Meta Language)
- - ftp://ftp.pld.org.pl/people/malekith/dml/
- - Suggested by Michal Moskal <malekith@pld-linux.org>
-
-For further information about future development, see http://live.gnome.org/Zenity
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index d9d12ec..0000000
--- a/autogen.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
-test -n "$srcdir" || srcdir=$(dirname "$0")
-test -n "$srcdir" || srcdir=.
-
-olddir=$(pwd)
-
-cd $srcdir
-
-(test -f configure.ac) || {
- echo "*** ERROR: Directory '$srcdir' does not look like the top-level project directory ***"
- exit 1
-}
-
-# shellcheck disable=SC2016
-PKG_NAME=$(autoconf --trace 'AC_INIT:$1' configure.ac)
-
-if [ "$#" = 0 -a "x$NOCONFIGURE" = "x" ]; then
- echo "*** WARNING: I am going to run 'configure' with no arguments." >&2
- echo "*** If you wish to pass any to it, please specify them on the" >&2
- echo "*** '$0' command line." >&2
- echo "" >&2
-fi
-
-autoreconf --verbose --force --install || exit 1
-
-cd "$olddir"
-if [ "$NOCONFIGURE" = "" ]; then
- $srcdir/configure "$@" || exit 1
-
- if [ "$1" = "--help" ]; then
- exit 0
- else
- echo "Now type 'make' to compile $PKG_NAME" || exit 1
- fi
-else
- echo "Skipping configure process."
-fi
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 5dccdb0..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,140 +0,0 @@
-AC_INIT([Zenity],[3.32.0],[https://bugzilla.gnome.org/enter_bug.cgi?product=zenity],[zenity])
-
-AC_PREREQ([2.69])
-
-AC_CONFIG_HEADERS([config.h])
-AC_CONFIG_SRCDIR([src])
-AC_CONFIG_MACRO_DIR([m4])
-
-AM_INIT_AUTOMAKE([1.10 foreign no-dist-gzip dist-xz])
-AM_MAINTAINER_MODE([enable])
-
-m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
-
-# *******************************
-# Debug
-# *******************************
-
-AX_CHECK_ENABLE_DEBUG([yes],[GNOME_ENABLE_DEBUG])
-
-# Check for programs
-AC_PROG_CC
-
-GTK_REQUIRED=3.0.0
-
-PKG_CHECK_MODULES([ZENITY],[gtk+-3.0 >= $GTK_REQUIRED glib-2.0])
-AC_SUBST([ZENITY_CFLAGS])
-AC_SUBST([ZENITY_LIBS])
-
-dnl *************************
-dnl Check for the GTK+ backend, if it's X11, we -lX11
-dnl *************************
-
-zenity_save_cflags="$CFLAGS"
-# pull in the CFLAGS to locate gdkconfig.h
-CFLAGS=`$PKG_CONFIG --cflags gtk+-3.0`
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#include <gdk/gdk.h>
-
-int main(void) {
-#ifndef GDK_WINDOWING_X11
-#error GDK_WINDOWING_X11 not defined
-#endif
- return 0;
-}
-])],
- GDK_BACKEND_X11=yes,
- GDK_BACKEND_X11=no)
-
-CFLAGS="$zenity_save_cflags"
-
-if test "x$GDK_BACKEND_X11" = "xyes"; then
- PKG_CHECK_MODULES(X, x11)
- ZENITY_CFLAGS="$ZENITY_CFLAGS $X_CFLAGS"
- ZENITY_LIBS="$ZENITY_LIBS $X_LIBS"
-fi
-
-# *******************************
-# perl check
-# *******************************
-
-AC_PATH_PROG([PERL],[perl],)
-
-# *******************************
-# libnotify check
-# *******************************
-
-LIBNOTIFY_REQUIRED=0.6.1
-
-AC_ARG_ENABLE([libnotify],
- [AS_HELP_STRING([--enable-libnotify],
- [Enable libnotify support])],
- [],
- [enable_libnotify=yes])
-
-if test x$enable_libnotify = xyes; then
- PKG_CHECK_MODULES([LIBNOTIFY], [libnotify >= $LIBNOTIFY_REQUIRED],
- [HAVE_LIBNOTIFY="yes"],[HAVE_LIBNOTIFY="no"])
- AC_SUBST([LIBNOTIFY_CFLAGS])
- AC_SUBST([LIBNOTIFY_LIBS])
- if test "x$HAVE_LIBNOTIFY" = "xyes"; then
- AC_DEFINE([HAVE_LIBNOTIFY], [1], [libnotify is available on this machine])
- fi
-fi
-
-# *******************************
-# webkit check
-# *******************************
-
-WEBKITGTK_REQUIRED=2.8.1
-
-AC_ARG_ENABLE([webkitgtk],
- [AS_HELP_STRING([--enable-webkitgtk],
- [Enable webkit support])],
- [],
- [enable_webkitgtk=yes])
-
-if test x$enable_webkitgtk = xyes; then
- PKG_CHECK_MODULES([WEBKIT], [webkit2gtk-4.0 >= $WEBKITGTK_REQUIRED],
- [HAVE_WEBKITGTK="yes"],[HAVE_WEBKITGTK="no"])
- AC_SUBST([WEBKIT_CFLAGS])
- AC_SUBST([WEBKIT_LIBS])
- if test "x$HAVE_WEBKITGTK" = "xyes"; then
- AC_DEFINE([HAVE_WEBKITGTK], [1], [webkitgtk is available on this machine])
- fi
-fi
-
-
-# *******************************
-# Internationalization
-# *******************************
-AM_GNU_GETTEXT_VERSION([0.19.4])
-AM_GNU_GETTEXT([external])
-
-GETTEXT_PACKAGE=zenity
-AC_SUBST([GETTEXT_PACKAGE])
-AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext domain])
-
-# *******************************
-# User manual
-# *******************************
-YELP_HELP_INIT
-
-# *******************************
-
-AC_SUBST([AM_CPPFLAGS])
-AC_SUBST([AM_CFLAGS])
-AC_SUBST([AM_LDFLAGS])
-
-# *******************************
-
-AC_CONFIG_FILES([
-Makefile
-po/Makefile.in
-src/Makefile
-src/gdialog
-data/Makefile
-help/Makefile
-])
-
-AC_OUTPUT
diff --git a/data/Makefile.am b/data/Makefile.am
deleted file mode 100644
index cc18511..0000000
--- a/data/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-clothesdir = $(datadir)/zenity/clothes
-clothes_DATA = \
- monk.png \
- gnome-tshirt.png \
- sunglasses.png \
- surfboard.png \
- hawaii-shirt.png
-
-imagesdir = $(datadir)/zenity
-images_DATA = \
- zenity.png \
- zenity-calendar.png \
- zenity-list.png \
- zenity-file.png \
- zenity-progress.png \
- zenity-text.png \
- zenity-scale.png \
- zenity-entry.png \
- zenity-notification.png
-
-man_MANS = zenity.1
-
-EXTRA_DIST = $(images_DATA) $(clothes_DATA) $(man_MANS)
diff --git a/data/gnome-tshirt.png b/data/gnome-tshirt.png
deleted file mode 100644
index 424ec61..0000000
--- a/data/gnome-tshirt.png
+++ /dev/null
Binary files differ
diff --git a/data/hawaii-shirt.png b/data/hawaii-shirt.png
deleted file mode 100644
index db4184c..0000000
--- a/data/hawaii-shirt.png
+++ /dev/null
Binary files differ
diff --git a/data/meson.build b/data/meson.build
new file mode 100644
index 0000000..c85889e
--- /dev/null
+++ b/data/meson.build
@@ -0,0 +1 @@
+install_man('zenity.1')
diff --git a/data/monk.png b/data/monk.png
deleted file mode 100644
index 0c515dd..0000000
--- a/data/monk.png
+++ /dev/null
Binary files differ
diff --git a/data/sunglasses.png b/data/sunglasses.png
deleted file mode 100644
index c303684..0000000
--- a/data/sunglasses.png
+++ /dev/null
Binary files differ
diff --git a/data/surfboard.png b/data/surfboard.png
deleted file mode 100644
index 572d9de..0000000
--- a/data/surfboard.png
+++ /dev/null
Binary files differ
diff --git a/data/zenity-calendar.png b/data/zenity-calendar.png
deleted file mode 100644
index 873528a..0000000
--- a/data/zenity-calendar.png
+++ /dev/null
Binary files differ
diff --git a/data/zenity-entry.png b/data/zenity-entry.png
deleted file mode 100644
index 3621ea3..0000000
--- a/data/zenity-entry.png
+++ /dev/null
Binary files differ
diff --git a/data/zenity-file.png b/data/zenity-file.png
deleted file mode 100644
index bac6392..0000000
--- a/data/zenity-file.png
+++ /dev/null
Binary files differ
diff --git a/data/zenity-list.png b/data/zenity-list.png
deleted file mode 100644
index 5a593b7..0000000
--- a/data/zenity-list.png
+++ /dev/null
Binary files differ
diff --git a/data/zenity-notification.png b/data/zenity-notification.png
deleted file mode 100644
index 6b44ef9..0000000
--- a/data/zenity-notification.png
+++ /dev/null
Binary files differ
diff --git a/data/zenity-progress.png b/data/zenity-progress.png
deleted file mode 100644
index b789e02..0000000
--- a/data/zenity-progress.png
+++ /dev/null
Binary files differ
diff --git a/data/zenity-scale.png b/data/zenity-scale.png
deleted file mode 100644
index 8526c31..0000000
--- a/data/zenity-scale.png
+++ /dev/null
Binary files differ
diff --git a/data/zenity-text.png b/data/zenity-text.png
deleted file mode 100644
index 0756992..0000000
--- a/data/zenity-text.png
+++ /dev/null
Binary files differ
diff --git a/data/zenity.1 b/data/zenity.1
index 06a1aba..465b580 100644
--- a/data/zenity.1
+++ b/data/zenity.1
@@ -76,9 +76,6 @@ General options
.B \-\-title=TITLE
Set the dialog title
.TP
-.B \-\-window-icon=ICONPATH
-Set the window icon with the path to an image. Alternatively, one of the four stock icons can be used: 'error', 'info', 'question' or 'warning'
-.TP
.B \-\-width=WIDTH
Set the dialog width
.TP
@@ -211,7 +208,7 @@ Notification options
Set the notification text
.TP
.B \-\-listen
-Listen for commands on stdin. Commands include 'message', 'tooltip', 'icon', and 'visible' separated by a colon. For example, 'message: Hello world', 'visible: false', or 'icon: /path/to/icon'. The icon command also accepts the four stock icon: 'error', 'info', 'question', and 'warning'
+Listen for commands on stdin. Commands include 'message', 'tooltip', 'icon', and 'visible' separated by a colon. For example, 'message: Hello world', or 'visible: false'.
.PP
Progress options
@@ -400,7 +397,7 @@ find . \-name '*.h' | zenity \-\-list \-\-title "Search Results" \-\-text "Findi
.PP
Show a notification in the message tray
.IP
-zenity \-\-notification \-\-window-icon=update.png \-\-text "System update necessary!"
+zenity \-\-notification \-\-icon=update.png \-\-text "System update necessary!"
.PP
Display a weekly shopping list in a check list dialog with \fIApples\fP and \fIOranges\fP pre selected
.IP
diff --git a/help/C/l10n.txt b/help/C/l10n.txt
index f03a73f..f03a73f 100755..100644
--- a/help/C/l10n.txt
+++ b/help/C/l10n.txt
diff --git a/help/C/notification.page b/help/C/notification.page
index f7ff3c9..37a0d98 100644
--- a/help/C/notification.page
+++ b/help/C/notification.page
@@ -15,6 +15,10 @@
<p>Specifies the text that is displayed in the notification area.</p>
</item>
<item>
+ <title><cmd>--icon</cmd>=<var>text</var></title>
+ <p>Set the notification icon using a string containing either a filename, or a string conforming to the FreeDesktop.org Icon Naming Specification.</p>
+ </item>
+ <item>
<title><cmd>--listen</cmd>=icon: '<var>text</var>', message: '<var>text</var>', tooltip: '<var>text</var>', visible: '<var>text</var>',</title>
<p>Listens for commands at standard input. At least one command must be specified. Commands are comma separated. A command must be followed by a colon and a value. </p>
<note style="tip">
@@ -27,8 +31,8 @@
<code>
#!/bin/sh
- zenity --notification\
- --window-icon="info" \
+ zenity --notification \
+ --icon="dialog-information" \
--text="There are system updates necessary!"
</code>
diff --git a/help/C/usage.page b/help/C/usage.page
index 8aa88cc..c219eed 100644
--- a/help/C/usage.page
+++ b/help/C/usage.page
@@ -121,14 +121,6 @@
</item>
<item>
- <title><cmd>--window-icon</cmd>=<var>icon_path</var></title>
- <p>Specifies the icon that is displayed in the window frame of the dialog. There are
- 4 stock icons also available by providing the following keywords - 'info', 'warning', 'question' and
- 'error'.
- </p>
- </item>
-
- <item>
<title><cmd>--width</cmd>=<var>width</var></title>
<p>Specifies the width of the dialog.</p>
</item>
diff --git a/help/ChangeLog b/help/ChangeLog.pre-git
index e8b8ee5..e8b8ee5 100644
--- a/help/ChangeLog
+++ b/help/ChangeLog.pre-git
diff --git a/help/LINGUAS b/help/LINGUAS
new file mode 100644
index 0000000..9940fa3
--- /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/Makefile.am b/help/Makefile.am
deleted file mode 100644
index d790472..0000000
--- a/help/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-@YELP_HELP_RULES@
-
-HELP_ID = zenity
-
-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
-
-HELP_FILES = \
- 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_LINGUAS = 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 0000000..cd09412
--- /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
index 3c9c59a..3c9c59a 100644
--- a/data/zenity.png
+++ b/icons/hicolor/48x48/apps/zenity.png
Binary files differ
diff --git a/icons/meson.build b/icons/meson.build
new file mode 100644
index 0000000..11fe0f6
--- /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
new file mode 100644
index 0000000..26dad82
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,109 @@
+project('zenity', 'c',
+ version: '4.alpha.1',
+ meson_version: '>=0.53.0',
+ license: 'LGPL-2.1-or-later'
+)
+
+version_arr = meson.project_version().split('.')
+zenity_version_major = version_arr[0].to_int()
+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_datadir = join_paths(zenity_prefix, get_option('datadir'))
+zenity_localedir = join_paths(zenity_prefix, get_option('localedir'))
+zenity_iconsdir = join_paths(zenity_datadir, 'icons')
+
+zenity_root_dir = include_directories('.')
+zenity_po_dir = join_paths(meson.source_root(), 'po')
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+cc = meson.get_compiler('c')
+
+zenity_conf = configuration_data()
+zenity_conf.set_quoted('PACKAGE_NAME', meson.project_name())
+zenity_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
+zenity_conf.set_quoted('PACKAGE_STRING',
+ '@0@ @1@'.format(meson.project_name(), meson.project_version()))
+zenity_conf.set_quoted('PACKAGE_DATADIR', zenity_datadir)
+zenity_conf.set_quoted('PACKAGE_LIBDIR', zenity_libdir)
+zenity_conf.set_quoted('PACKAGE_LOCALE_DIR', zenity_localedir)
+
+zenity_conf.set('VERSION', 'PACKAGE_VERSION')
+zenity_conf.set('GETTEXT_PACKAGE', 'PACKAGE_NAME')
+zenity_conf.set('LOCALEDIR', 'PACKAGE_LOCALE_DIR')
+
+zenity_conf.set('DEBUG', get_option('debug'))
+
+check_headers = [
+ 'sys/types.h',
+ 'unistd.h',
+ 'langinfo.h',
+ 'locale.h'
+]
+
+foreach h : check_headers
+ cc.has_header(h, required: true)
+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')
+ 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')
+# 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
+)
+
+# 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')
+
+summary({'libnotify': get_option('libnotify'),
+ 'gdialog script': perl.found(),
+ }, section: 'Configuration')
+
+subdir('src')
+subdir('data')
+subdir('icons')
+subdir('po')
+subdir('help')
+
+meson.add_install_script('meson_post_install.py')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..d976e86
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,6 @@
+option('libnotify', type : 'boolean', value : true,
+ description : 'enable libnotify for desktop notification support')
+
+#TODO
+#option('webkitgtk', type : 'boolean', value : true,
+# description : 'enable webkitgtk support')
diff --git a/meson_post_install.py b/meson_post_install.py
new file mode 100644
index 0000000..2654e49
--- /dev/null
+++ b/meson_post_install.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import os
+import subprocess
+
+prefix = os.environ.get('MESON_INSTALL_PREFIX', '/usr/local')
+datadir = os.path.join(prefix, 'share')
+
+# Packaging tools define DESTDIR and this isn't needed for them
+if 'DESTDIR' not in os.environ:
+ print('Updating icon cache...')
+ icon_cache_dir = os.path.join(datadir, 'icons', 'hicolor')
+ if not os.path.exists(icon_cache_dir):
+ os.makedirs(icon_cache_dir)
+ subprocess.call(['gtk-update-icon-cache', '-qtf', icon_cache_dir])
diff --git a/po/ChangeLog b/po/ChangeLog.pre-git
index 56dd74a..56dd74a 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog.pre-git
diff --git a/po/Makevars b/po/Makevars
deleted file mode 100644
index ac406bb..0000000
--- a/po/Makevars
+++ /dev/null
@@ -1,78 +0,0 @@
-# Makefile variables for PO directory in any package using GNU gettext.
-
-# Usually the message domain is the same as the package name.
-DOMAIN = $(PACKAGE)
-
-# These two variables depend on the location of this directory.
-subdir = po
-top_builddir = ..
-
-# These options get passed to xgettext.
-XGETTEXT_OPTIONS = --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --add-comments
-
-# This is the copyright holder that gets inserted into the header of the
-# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
-# package. (Note that the msgstr strings, extracted from the package's
-# sources, belong to the copyright holder of the package.) Translators are
-# expected to transfer the copyright for their translations to this person
-# or entity, or to disclaim their copyright. The empty string stands for
-# the public domain; in this case the translators are expected to disclaim
-# their copyright.
-COPYRIGHT_HOLDER = Zenity authors
-
-# This tells whether or not to prepend "GNU " prefix to the package
-# name that gets inserted into the header of the $(DOMAIN).pot file.
-# Possible values are "yes", "no", or empty. If it is empty, try to
-# detect it automatically by scanning the files in $(top_srcdir) for
-# "GNU packagename" string.
-PACKAGE_GNU = no
-
-# This is the email address or URL to which the translators shall report
-# bugs in the untranslated strings:
-# - Strings which are not entire sentences, see the maintainer guidelines
-# in the GNU gettext documentation, section 'Preparing Strings'.
-# - Strings which use unclear terms or require additional context to be
-# understood.
-# - Strings which make invalid assumptions about notation of date, time or
-# money.
-# - Pluralisation problems.
-# - Incorrect English spelling.
-# - Incorrect formatting.
-# It can be your email address, or a mailing list address where translators
-# can write to without being subscribed, or the URL of a web page through
-# which the translators can contact you.
-MSGID_BUGS_ADDRESS = https://gitlab.gnome.org/GNOME/zenity/issues
-
-# This is the list of locale categories, beyond LC_MESSAGES, for which the
-# message catalogs shall be used. It is usually empty.
-EXTRA_LOCALE_CATEGORIES =
-
-# This tells whether the $(DOMAIN).pot file contains messages with an 'msgctxt'
-# context. Possible values are "yes" and "no". Set this to yes if the
-# package uses functions taking also a message context, like pgettext(), or
-# if in $(XGETTEXT_OPTIONS) you define keywords with a context argument.
-USE_MSGCTXT = yes
-
-# These options get passed to msgmerge.
-# Useful options are in particular:
-# --previous to keep previous msgids of translated messages,
-# --quiet to reduce the verbosity.
-MSGMERGE_OPTIONS =
-
-# These options get passed to msginit.
-# If you want to disable line wrapping when writing PO files, add
-# --no-wrap to MSGMERGE_OPTIONS, XGETTEXT_OPTIONS, and
-# MSGINIT_OPTIONS.
-MSGINIT_OPTIONS =
-
-# This tells whether or not to regenerate a PO file when $(DOMAIN).pot
-# has changed. Possible values are "yes" and "no". Set this to no if
-# the POT file is checked in the repository and the version control
-# program ignores timestamps.
-PO_DEPENDS_ON_POT = no
-
-# This tells whether or not to forcibly update $(DOMAIN).pot and
-# regenerate PO files on "make dist". Possible values are "yes" and
-# "no". Set this to no if the POT file and PO files are maintained
-# externally.
-DIST_DEPENDS_ON_UPDATE_PO = no
diff --git a/po/POTFILES.in b/po/POTFILES
index 3488a95..3488a95 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES
diff --git a/po/POTFILES.skip b/po/POTFILES.skip
deleted file mode 100644
index 0fb3682..0000000
--- a/po/POTFILES.skip
+++ /dev/null
@@ -1,2 +0,0 @@
-# List of source files that should *not* be translated.
-# Please keep this file sorted alphabetically.
diff --git a/po/en_CA.po b/po/en_CA.po
index 825ade2..9ba2411 100644
--- a/po/en_CA.po
+++ b/po/en_CA.po
@@ -1,351 +1,336 @@
# English/Canada translation of zenity.
# Copyright (C) 2004-2005 Adam Weinberger and the GNOME Foundation
+# Copyright © 2021 Logan Rathbone
# This file is distributed under the same licence as the zenity package.
-# Adam Weinberger <adamw@gnome.org>, 2004, 2005.
-#
-#
+#
msgid ""
msgstr ""
"Project-Id-Version: zenity\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-08-15 18:03-0400\n"
+"POT-Creation-Date: 2021-02-15 15:49-0500\n"
"PO-Revision-Date: 2005-07-03 13:39-0400\n"
-"Last-Translator: Adam Weinberger <adamw@gnome.org>\n"
+"Last-Translator: Logan Rathbone <poprocks@gmail.com>\n"
"Language-Team: Canadian English <adamw@gnome.org>\n"
"Language: en_CA\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../src/about.c:65
+#: src/about.c:54
msgid ""
"This program is free software; you can redistribute it and/or modify it "
-"under the terms of the GNU General Public License as published by the Free "
-"Software Foundation; either version 2 of the License, or (at your option) "
-"any later version.\n"
+"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.\n"
msgstr ""
"This program is free software; you can redistribute it and/or modify it "
-"under the terms of the GNU General Public Licence as published by the Free "
-"Software Foundation; either version 2 of the Licence, or (at your option) "
-"any later version.\n"
+"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.\n"
-#: ../src/about.c:69
+#: src/about.c:59
msgid ""
"This program 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 General Public License for "
-"more details.\n"
+"FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License "
+"for more details.\n"
msgstr ""
"This program 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 General Public Licence for "
-"more details.\n"
+"FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License "
+"for more details.\n"
-#: ../src/about.c:73
+#: src/about.c:63
msgid ""
-"You should have received a copy of the GNU General Public License along with "
-"this program; if not, write to the Free Software Foundation, Inc., 51 "
-"Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA."
+"You should have received a copy of the GNU Lesser General Public License "
+"along with this program; if not, write to the Free Software Foundation, "
+"Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA."
msgstr ""
-"You should have received a copy of the GNU General Public Licence along with "
-"this program; if not, write to the Free Software Foundation, Inc., 51 "
-"Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA."
+"You should have received a copy of the GNU Lesser General Public License "
+"along with this program; if not, write to the Free Software Foundation, "
+"Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA."
-#: ../src/about.c:264
-msgid "translator-credits"
-msgstr ""
-"Maintainer: Adam Weinberger <adamw@gnome.org>\n"
-"Alexander Winston <alexander.winston@comcast.net>"
-
-#: ../src/about.c:276
+#: src/about.c:88
msgid "Display dialog boxes from shell scripts"
msgstr "Display dialogue boxes from shell scripts"
-#: ../src/main.c:94
+#: src/fileselection.c:57 src/zenity.ui:65 src/zenity.ui:129 src/zenity.ui:203
+#: src/zenity.ui:265 src/zenity.ui:322 src/zenity.ui:405 src/zenity.ui:458
+#: src/zenity.ui:521 src/zenity.ui:625 src/zenity.ui:679 src/zenity.ui:740
+msgid "_OK"
+msgstr "_OK"
+
+#: src/fileselection.c:58 src/zenity.ui:59 src/zenity.ui:123 src/zenity.ui:197
+#: src/zenity.ui:259 src/zenity.ui:399 src/zenity.ui:515 src/zenity.ui:619
+#: src/zenity.ui:746
+msgid "_Cancel"
+msgstr "_Cancel"
+
+#: src/main.c:121
#, c-format
msgid "You must specify a dialog type. See 'zenity --help' for details\n"
msgstr "You must specify a dialogue type. See 'zenity --help' for details\n"
-#: ../src/notification.c:139
-#, c-format
-msgid "could not parse command from stdin\n"
-msgstr "Could not parse command from stdin\n"
+#: src/msg.c:42
+msgid "_No"
+msgstr "_No"
-#: ../src/notification.c:252 ../src/notification.c:269
-msgid "Zenity notification"
-msgstr "Zenity notification"
+#: src/msg.c:44
+msgid "_Yes"
+msgstr "_Yes"
-#: ../src/scale.c:56
-#, c-format
-msgid "Maximum value must be greater than minimum value.\n"
-msgstr "Maximum value must be greater than minimum value.\n"
+#: src/notification.c:55
+msgid "Could not parse message\n"
+msgstr "Could not parse message\n"
-#: ../src/scale.c:63
+#: src/notification.c:142
#, c-format
-msgid "Value out of range.\n"
-msgstr "Value out of range.\n"
+msgid ""
+"Invalid value for a boolean typed hint.\n"
+"Supported values are 'true' or 'false'.\n"
+msgstr ""
+"Invalid value for a boolean typed hint.\n"
+"Supported values are 'true' or 'false'.\n"
-#: ../src/tree.c:320
+#. (iibiiay)
+#: src/notification.c:163
#, c-format
-msgid "No column titles specified for List dialog.\n"
-msgstr "No column titles specified for List dialogue.\n"
+msgid "Unsupported hint. Skipping.\n"
+msgstr "Unsupported hint. Skipping.\n"
-#: ../src/tree.c:326
+#. unknown hints
+#: src/notification.c:186
#, c-format
-msgid "You should use only one List dialog type.\n"
-msgstr "You should use only one List dialogue type.\n"
-
-#: ../src/zenity.glade.h:1
-msgid "Add a new entry"
-msgstr "Add a new entry"
+msgid "Unknown hint name. Skipping.\n"
+msgstr "Unknown hint name. Skipping.\n"
-#: ../src/zenity.glade.h:2
-msgid "Adjust the scale value"
-msgstr "Adjust the scale value"
-
-#: ../src/zenity.glade.h:3
-msgid "All updates are complete."
-msgstr "All updates are complete."
-
-#: ../src/zenity.glade.h:4
-msgid "An error has occurred."
-msgstr "An error has occurred."
-
-#: ../src/zenity.glade.h:5
-msgid "Are you sure you want to proceed?"
-msgstr "Are you sure you want to proceed?"
-
-#: ../src/zenity.glade.h:6
-msgid "C_alendar:"
-msgstr "C_alendar:"
-
-#: ../src/zenity.glade.h:7
-msgid "Calendar selection"
-msgstr "Calendar selection"
-
-#: ../src/zenity.glade.h:8
-msgid "Error"
-msgstr "Error"
-
-#: ../src/zenity.glade.h:9
-msgid "Information"
-msgstr "Information"
-
-#: ../src/zenity.glade.h:10
-msgid "Progress"
-msgstr "Progress"
-
-#: ../src/zenity.glade.h:11
-msgid "Question"
-msgstr "Question"
-
-#: ../src/zenity.glade.h:12
-msgid "Running..."
-msgstr "Running..."
-
-#: ../src/zenity.glade.h:13
-msgid "Select a date from below."
-msgstr "Select a date from below."
-
-#: ../src/zenity.glade.h:14
-msgid "Select a file"
-msgstr "Select a file"
-
-#: ../src/zenity.glade.h:15
-msgid "Select items from the list"
-msgstr "Select items from the list"
-
-#: ../src/zenity.glade.h:16
-msgid "Select items from the list below."
-msgstr "Select items from the list below."
-
-#: ../src/zenity.glade.h:17
-msgid "Text View"
-msgstr "Text View"
-
-#: ../src/zenity.glade.h:18
-msgid "Warning"
-msgstr "Warning"
+#: src/notification.c:247
+#, c-format
+msgid "Could not parse command from stdin\n"
+msgstr "Could not parse command from stdin\n"
-#: ../src/zenity.glade.h:19
-msgid "_Enter new text:"
-msgstr "_Enter new text:"
+#: src/notification.c:374
+msgid "Zenity notification"
+msgstr "Zenity notification"
-#: ../src/option.c:117
+#: src/option.c:166
msgid "Set the dialog title"
msgstr "Set the dialogue title"
-#: ../src/option.c:118
+#: src/option.c:167
msgid "TITLE"
msgstr "TITLE"
-#: ../src/option.c:126
-msgid "Set the window icon"
-msgstr "Set the window icon"
-
-#: ../src/option.c:127
-msgid "ICONPATH"
-msgstr "ICONPATH"
-
-#: ../src/option.c:135
+#: src/option.c:173
msgid "Set the width"
msgstr "Set the width"
-#: ../src/option.c:136
+#: src/option.c:174
msgid "WIDTH"
msgstr "WIDTH"
-#: ../src/option.c:144
+#: src/option.c:180
msgid "Set the height"
msgstr "Set the height"
-#: ../src/option.c:145
+#: src/option.c:181
msgid "HEIGHT"
msgstr "HEIGHT"
-#: ../src/option.c:153
+#: src/option.c:187
msgid "Set dialog timeout in seconds"
msgstr "Set dialogue timeout in seconds"
-#: ../src/option.c:168
+#. Timeout for closing the dialog
+#: src/option.c:189
+msgid "TIMEOUT"
+msgstr "TIMEOUT"
+
+#: src/option.c:195
+msgid "Set the label of the OK button"
+msgstr "Set the label of the OK button"
+
+#: src/option.c:196 src/option.c:203 src/option.c:210 src/option.c:234
+#: src/option.c:279 src/option.c:286 src/option.c:310 src/option.c:357
+#: src/option.c:459 src/option.c:557 src/option.c:578 src/option.c:597
+#: src/option.c:658 src/option.c:733 src/option.c:740 src/option.c:790
+#: src/option.c:837 src/option.c:969
+msgid "TEXT"
+msgstr "TEXT"
+
+#: src/option.c:202
+msgid "Set the label of the Cancel button"
+msgstr "Set the label of the Cancel button"
+
+#: src/option.c:209
+msgid "Add an extra button"
+msgstr "Add an extra button"
+
+#: src/option.c:216
+msgid "Set the modal hint"
+msgstr "Set the modal hint"
+
+#: src/option.c:226
msgid "Display calendar dialog"
msgstr "Display calendar dialogue"
-#: ../src/option.c:177 ../src/option.c:237 ../src/option.c:280
-#: ../src/option.c:313 ../src/option.c:415 ../src/option.c:544
-#: ../src/option.c:606 ../src/option.c:672 ../src/option.c:705
+#: src/option.c:233 src/option.c:278 src/option.c:309 src/option.c:356
+#: src/option.c:458 src/option.c:596 src/option.c:657 src/option.c:789
+#: src/option.c:836 src/option.c:968
msgid "Set the dialog text"
msgstr "Set the dialogue text"
-#: ../src/option.c:178 ../src/option.c:238 ../src/option.c:247
-#: ../src/option.c:256 ../src/option.c:281 ../src/option.c:314
-#: ../src/option.c:416 ../src/option.c:512 ../src/option.c:545
-#: ../src/option.c:607 ../src/option.c:673 ../src/option.c:706
-msgid "TEXT"
-msgstr "TEXT"
-
-#: ../src/option.c:186
+#: src/option.c:240
msgid "Set the calendar day"
msgstr "Set the calendar day"
-#: ../src/option.c:187
+#: src/option.c:241
msgid "DAY"
msgstr "DAY"
-#: ../src/option.c:195
+#: src/option.c:247
msgid "Set the calendar month"
msgstr "Set the calendar month"
-#: ../src/option.c:196
+#: src/option.c:248
msgid "MONTH"
msgstr "MONTH"
-#: ../src/option.c:204
+#: src/option.c:254
msgid "Set the calendar year"
msgstr "Set the calendar year"
-#: ../src/option.c:205
+#: src/option.c:255
msgid "YEAR"
msgstr "YEAR"
-#: ../src/option.c:213
+#: src/option.c:261 src/option.c:982
msgid "Set the format for the returned date"
msgstr "Set the format for the returned date"
-#: ../src/option.c:214
+#: src/option.c:262 src/option.c:983
msgid "PATTERN"
msgstr "PATTERN"
-#: ../src/option.c:228
+#: src/option.c:271
msgid "Display text entry dialog"
msgstr "Display text entry dialogue"
-#: ../src/option.c:246
+#: src/option.c:285
msgid "Set the entry text"
msgstr "Set the entry text"
-#: ../src/option.c:255
+#: src/option.c:292
msgid "Hide the entry text"
msgstr "Hide the entry text"
-#: ../src/option.c:271
+#: src/option.c:302
msgid "Display error dialog"
msgstr "Display error dialogue"
-#: ../src/option.c:289 ../src/option.c:322 ../src/option.c:615
-#: ../src/option.c:681
+#: src/option.c:316 src/option.c:363 src/option.c:664 src/option.c:796
+msgid "Set the dialog icon"
+msgstr "Set the dialog icon"
+
+#: src/option.c:317 src/option.c:364 src/option.c:665 src/option.c:797
+msgid "ICON-NAME"
+msgstr "ICON-NAME"
+
+#: src/option.c:323 src/option.c:370 src/option.c:671 src/option.c:803
msgid "Do not enable text wrapping"
msgstr "Do not enable text wrapping"
-#: ../src/option.c:304
+#: src/option.c:330 src/option.c:377 src/option.c:678 src/option.c:810
+msgid "Do not enable Pango markup"
+msgstr "Do not enable Pango markup"
+
+#: src/option.c:337 src/option.c:384 src/option.c:692 src/option.c:817
+msgid ""
+"Enable ellipsizing in the dialog text. This fixes the high window size with "
+"long texts"
+msgstr ""
+"Enable ellipsizing in the dialog text. This fixes the high window size with "
+"long texts"
+
+#: src/option.c:349
msgid "Display info dialog"
msgstr "Display info dialogue"
-#: ../src/option.c:337
+#: src/option.c:396
msgid "Display file selection dialog"
msgstr "Display file selection dialogue"
-#: ../src/option.c:346
+#: src/option.c:403
msgid "Set the filename"
msgstr "Set the filename"
-#: ../src/option.c:347 ../src/option.c:640
+#: src/option.c:404 src/option.c:719
msgid "FILENAME"
msgstr "FILENAME"
-#: ../src/option.c:355
+#: src/option.c:410
msgid "Allow multiple files to be selected"
msgstr "Allow multiple files to be selected"
-#: ../src/option.c:364
+#: src/option.c:417
msgid "Activate directory-only selection"
msgstr "Activate directory-only selection"
-#: ../src/option.c:373
+#: src/option.c:424
msgid "Activate save mode"
msgstr "Activate save mode"
-#: ../src/option.c:382 ../src/option.c:451
+#: src/option.c:431 src/option.c:493 src/option.c:975
msgid "Set output separator character"
msgstr "Set output separator character"
-#: ../src/option.c:383 ../src/option.c:452
+#: src/option.c:432 src/option.c:494 src/option.c:976
msgid "SEPARATOR"
msgstr "SEPARATOR"
-#: ../src/option.c:391
-msgid "Confirm file selection if filename already exists"
-msgstr "Confirm file selection if filename already exists"
+#: src/option.c:438
+msgid "Set a filename filter"
+msgstr "Set a filename filter"
+
+#. Help for file-filter argument (name and patterns for file
+#. selection)
+#: src/option.c:441
+msgid "NAME | PATTERN1 PATTERN2 ..."
+msgstr "NAME | PATTERN1 PATTERN2 ..."
-#: ../src/option.c:406
+#: src/option.c:451
msgid "Display list dialog"
msgstr "Display list dialogue"
-#: ../src/option.c:424
+#: src/option.c:465
msgid "Set the column header"
msgstr "Set the column header"
-#: ../src/option.c:425
+#: src/option.c:466
msgid "COLUMN"
msgstr "COLUMN"
-#: ../src/option.c:433
-msgid "Use check boxes for first column"
-msgstr "Use check boxes for first column"
+#: src/option.c:472
+msgid "Use check boxes for the first column"
+msgstr "Use check boxes for the first column"
+
+#: src/option.c:479
+msgid "Use radio buttons for the first column"
+msgstr "Use radio buttons for the first column"
-#: ../src/option.c:442
-msgid "Use radio buttons for first column"
-msgstr "Use radio buttons for first column"
+#: src/option.c:486
+msgid "Use an image for the first column"
+msgstr "Use an image for the first column"
-#: ../src/option.c:460
+#: src/option.c:500
msgid "Allow multiple rows to be selected"
msgstr "Allow multiple rows to be selected"
-#: ../src/option.c:469 ../src/option.c:648
+#: src/option.c:507 src/option.c:725
msgid "Allow changes to text"
msgstr "Allow changes to text"
-#: ../src/option.c:478
+#: src/option.c:514
msgid ""
"Print a specific column (Default is 1. 'ALL' can be used to print all "
"columns)"
@@ -353,234 +338,535 @@ msgstr ""
"Print a specific column (Default is 1. 'ALL' can be used to print all "
"columns)"
-#: ../src/option.c:479 ../src/option.c:488
+#. Column index number to print out on a list dialog
+#: src/option.c:517 src/option.c:524
msgid "NUMBER"
msgstr "NUMBER"
-#: ../src/option.c:487
+#: src/option.c:523
msgid "Hide a specific column"
msgstr "Hide a specific column"
-#: ../src/option.c:502
+#: src/option.c:530
+msgid "Hide the column headers"
+msgstr "Hide the column headers"
+
+#: src/option.c:537
+msgid ""
+"Change list default search function searching for text in the middle, not on "
+"the beginning"
+msgstr ""
+"Change list default search function searching for text in the middle, not on "
+"the beginning"
+
+#: src/option.c:549
msgid "Display notification"
msgstr "Display notification"
-#: ../src/option.c:511
+#: src/option.c:556
msgid "Set the notification text"
msgstr "Set the notification text"
-#: ../src/option.c:520
+#: src/option.c:563
+msgid "Set the notification icon"
+msgstr "Set the notification icon"
+
+#: src/option.c:564
+msgid "ICONPATH"
+msgstr "ICONPATH"
+
+#: src/option.c:570
msgid "Listen for commands on stdin"
msgstr "Listen for commands on stdin"
-#: ../src/option.c:535
+#: src/option.c:577
+msgid "Set the notification hints"
+msgstr "Set the notification hints"
+
+#: src/option.c:589
msgid "Display progress indication dialog"
msgstr "Display progress indication dialogue"
-#: ../src/option.c:553
+#: src/option.c:603
msgid "Set initial percentage"
msgstr "Set initial percentage"
-#: ../src/option.c:554
+#: src/option.c:604
msgid "PERCENTAGE"
msgstr "PERCENTAGE"
-#: ../src/option.c:562
+#: src/option.c:610
msgid "Pulsate progress bar"
msgstr "Pulsate progress bar"
-#: ../src/option.c:572
+#: src/option.c:618
#, no-c-format
msgid "Dismiss the dialog when 100% has been reached"
msgstr "Dismiss the dialogue when 100% has been reached"
-#: ../src/option.c:582
+#: src/option.c:625
+msgid "Kill parent process if Cancel button is pressed"
+msgstr "Kill parent process if Cancel button is pressed"
+
+#: src/option.c:632
+msgid "Hide Cancel button"
+msgstr "Hide Cancel button"
+
+#: src/option.c:640
#, no-c-format
-msgid "Kill parent process if cancel button is pressed"
-msgstr "Kill parent process if cancel button is pressed"
+msgid "Estimate when progress will reach 100%"
+msgstr "Estimate when progress will reach 100%"
-#: ../src/option.c:597
+#: src/option.c:650
msgid "Display question dialog"
msgstr "Display question dialogue"
-#: ../src/option.c:630
+#: src/option.c:685
+msgid "Give Cancel button focus by default"
+msgstr "Give Cancel button focus by default"
+
+#: src/option.c:701
+msgid "Suppress OK and Cancel buttons"
+msgstr "Suppress OK and Cancel buttons"
+
+#: src/option.c:711
msgid "Display text information dialog"
msgstr "Display text information dialogue"
-#: ../src/option.c:639
+#: src/option.c:718
msgid "Open file"
msgstr "Open file"
-#: ../src/option.c:663
+#: src/option.c:732
+msgid "Set the text font"
+msgstr "Set the text font"
+
+#: src/option.c:739
+msgid "Enable an I read and agree checkbox"
+msgstr "Enable an I read and agree checkbox"
+
+#: src/option.c:747
+msgid "Enable HTML support"
+msgstr "Enable HTML support"
+
+#: src/option.c:754
+msgid ""
+"Do not enable user interaction with the WebView. Only works if you use --"
+"html option"
+msgstr ""
+"Do not enable user interaction with the WebView. Only works if you use --"
+"html option"
+
+#: src/option.c:762
+msgid "Set an URL instead of a file. Only works if you use --html option"
+msgstr "Set an URL instead of a file. Only works if you use --html option"
+
+#: src/option.c:764
+msgid "URL"
+msgstr "URL"
+
+#: src/option.c:771
+msgid "Auto scroll the text to the end. Only when text is captured from stdin"
+msgstr "Auto scroll the text to the end. Only when text is captured from stdin"
+
+#: src/option.c:782
msgid "Display warning dialog"
msgstr "Display warning dialogue"
-#: ../src/option.c:696
+#: src/option.c:829
msgid "Display scale dialog"
msgstr "Display scale dialogue"
-#: ../src/option.c:714
+#: src/option.c:843
msgid "Set initial value"
msgstr "Set initial value"
-#: ../src/option.c:715 ../src/option.c:724 ../src/option.c:733
-#: ../src/option.c:742
+#: src/option.c:844 src/option.c:851 src/option.c:858 src/option.c:865
+#: src/option.c:1017
msgid "VALUE"
msgstr "VALUE"
-#: ../src/option.c:723
+#: src/option.c:850
msgid "Set minimum value"
msgstr "Set minimum value"
-#: ../src/option.c:732
+#: src/option.c:857
msgid "Set maximum value"
msgstr "Set maximum value"
-#: ../src/option.c:741
+#: src/option.c:864
msgid "Set step size"
msgstr "Set step size"
-#: ../src/option.c:750
+#: src/option.c:871
msgid "Print partial values"
msgstr "Print partial values"
-#: ../src/option.c:759
+#: src/option.c:878
msgid "Hide value"
msgstr "Hide value"
-#: ../src/option.c:774
+#: src/option.c:888
+msgid "Display forms dialog"
+msgstr "Display forms dialogue"
+
+#: src/option.c:895
+msgid "Add a new Entry in forms dialog"
+msgstr "Add a new Entry in forms dialogue"
+
+#: src/option.c:896 src/option.c:903
+msgid "Field name"
+msgstr "Field name"
+
+#: src/option.c:902
+msgid "Add a new Password Entry in forms dialog"
+msgstr "Add a new Password Entry in forms dialogue"
+
+#: src/option.c:909
+msgid "Add a new Calendar in forms dialog"
+msgstr "Add a new Calendar in forms dialogue"
+
+#: src/option.c:910
+msgid "Calendar field name"
+msgstr "Calendar field name"
+
+#: src/option.c:916
+msgid "Add a new List in forms dialog"
+msgstr "Add a new List in forms dialog"
+
+#: src/option.c:917
+msgid "List field and header name"
+msgstr "List field and header name"
+
+#: src/option.c:923
+msgid "List of values for List"
+msgstr "List of values for List"
+
+#: src/option.c:924 src/option.c:931 src/option.c:945
+msgid "List of values separated by |"
+msgstr "List of values separated by |"
+
+#: src/option.c:930
+msgid "List of values for columns"
+msgstr "List of values for columns"
+
+#: src/option.c:937
+msgid "Add a new combo box in forms dialog"
+msgstr "Add a new combo box in forms dialogue"
+
+#: src/option.c:938
+msgid "Combo box field name"
+msgstr "Combo box field name"
+
+#: src/option.c:944
+msgid "List of values for combo box"
+msgstr "List of values for combo box"
+
+#: src/option.c:961
+msgid "Show the columns header"
+msgstr "Show the columns header"
+
+#: src/option.c:992
+msgid "Display password dialog"
+msgstr "Display password dialogue"
+
+#: src/option.c:999
+msgid "Display the username option"
+msgstr "Display the username option"
+
+#: src/option.c:1009
+msgid "Display color selection dialog"
+msgstr "Display colour selection dialog"
+
+#: src/option.c:1016
+msgid "Set the color"
+msgstr "Set the colour"
+
+#: src/option.c:1023
+msgid "Show the palette"
+msgstr "Show the palette"
+
+#: src/option.c:1033
msgid "About zenity"
msgstr "About zenity"
-#: ../src/option.c:783
+#: src/option.c:1040
msgid "Print version"
msgstr "Print version"
-#: ../src/option.c:1425
+#: src/option.c:2007
msgid "General options"
msgstr "General options"
-#: ../src/option.c:1426
+#: src/option.c:2008
msgid "Show general options"
msgstr "Show general options"
-#: ../src/option.c:1436
+#: src/option.c:2020
msgid "Calendar options"
msgstr "Calendar options"
-#: ../src/option.c:1437
+#: src/option.c:2021
msgid "Show calendar options"
msgstr "Show calendar options"
-#: ../src/option.c:1447
+#: src/option.c:2033
msgid "Text entry options"
msgstr "Text entry options"
-#: ../src/option.c:1448
+#: src/option.c:2034
msgid "Show text entry options"
msgstr "Show text entry options"
-#: ../src/option.c:1458
+#: src/option.c:2046
msgid "Error options"
msgstr "Error options"
-#: ../src/option.c:1459
+#: src/option.c:2046
msgid "Show error options"
msgstr "Show error options"
-#: ../src/option.c:1469
+#: src/option.c:2056
msgid "Info options"
msgstr "Info options"
-#: ../src/option.c:1470
+#: src/option.c:2056
msgid "Show info options"
msgstr "Show info options"
-#: ../src/option.c:1480
+#: src/option.c:2066
msgid "File selection options"
msgstr "File selection options"
-#: ../src/option.c:1481
+#: src/option.c:2067
msgid "Show file selection options"
msgstr "Show file selection options"
-#: ../src/option.c:1491
+#: src/option.c:2079
msgid "List options"
msgstr "List options"
-#: ../src/option.c:1492
+#: src/option.c:2079
msgid "Show list options"
msgstr "Show list options"
-#: ../src/option.c:1502
+#: src/option.c:2090
msgid "Notification icon options"
msgstr "Notification icon options"
-#: ../src/option.c:1503
+#: src/option.c:2091
msgid "Show notification icon options"
msgstr "Show notification icon options"
-#: ../src/option.c:1513
+#: src/option.c:2105
msgid "Progress options"
msgstr "Progress options"
-#: ../src/option.c:1514
+#: src/option.c:2106
msgid "Show progress options"
msgstr "Show progress options"
-#: ../src/option.c:1524
+#: src/option.c:2118
msgid "Question options"
msgstr "Question options"
-#: ../src/option.c:1525
+#: src/option.c:2119
msgid "Show question options"
msgstr "Show question options"
-#: ../src/option.c:1535
+#: src/option.c:2131
msgid "Warning options"
msgstr "Warning options"
-#: ../src/option.c:1536
+#: src/option.c:2132
msgid "Show warning options"
msgstr "Show warning options"
-#: ../src/option.c:1546
+#: src/option.c:2144
msgid "Scale options"
msgstr "Scale options"
-#: ../src/option.c:1547
+#: src/option.c:2144
msgid "Show scale options"
msgstr "Show scale options"
-#: ../src/option.c:1557
+#: src/option.c:2154
msgid "Text information options"
msgstr "Text information options"
-#: ../src/option.c:1558
+#: src/option.c:2155
msgid "Show text information options"
msgstr "Show text information options"
-#: ../src/option.c:1568
+#: src/option.c:2167
+msgid "Color selection options"
+msgstr "Colour selection options"
+
+#: src/option.c:2168
+msgid "Show color selection options"
+msgstr "Show colour selection options"
+
+#: src/option.c:2180
+msgid "Password dialog options"
+msgstr "Password dialogue options"
+
+#: src/option.c:2181
+msgid "Show password dialog options"
+msgstr "Show password dialogue options"
+
+#: src/option.c:2193
+msgid "Forms dialog options"
+msgstr "Forms dialogue options"
+
+#: src/option.c:2194
+msgid "Show forms dialog options"
+msgstr "Show forms dialogue options"
+
+#: src/option.c:2206
msgid "Miscellaneous options"
msgstr "Miscellaneous options"
-#: ../src/option.c:1569
+#: src/option.c:2207
msgid "Show miscellaneous options"
msgstr "Show miscellaneous options"
-#: ../src/option.c:1594
+#: src/option.c:2230
#, c-format
msgid ""
"This option is not available. Please see --help for all possible usages.\n"
msgstr ""
"This option is not available. Please see --help for all possible usages.\n"
-#: ../src/option.c:1598
+#: src/option.c:2236
#, c-format
msgid "--%s is not supported for this dialog\n"
msgstr "--%s is not supported for this dialogue\n"
-#: ../src/option.c:1602
+#: src/option.c:2241
#, c-format
msgid "Two or more dialog options specified\n"
msgstr "Two or more dialogue options specified\n"
+
+#: src/password.c:96
+msgid "Type your username and password"
+msgstr "Type your username and password"
+
+#. Add the username label and entry and increment the row for the
+#. * password entry so it will be added below the username.
+#.
+#: src/password.c:101
+msgid "Username:"
+msgstr "Username:"
+
+#: src/password.c:116
+msgid "Password:"
+msgstr "Password:"
+
+#: src/progress.c:116
+#, c-format
+msgid "Time remaining: %lu:%02lu:%02lu"
+msgstr "Time remaining: %lu:%02lu:%02lu"
+
+#: src/scale.c:66
+#, c-format
+msgid "Maximum value must be greater than minimum value.\n"
+msgstr "Maximum value must be greater than minimum value.\n"
+
+#: src/scale.c:74
+#, c-format
+msgid "Value out of range.\n"
+msgstr "Value out of range.\n"
+
+#: src/tree.c:405
+#, c-format
+msgid "No column titles specified for List dialog.\n"
+msgstr "No column titles specified for List dialogue.\n"
+
+#: src/tree.c:412
+#, c-format
+msgid "You should use only one List dialog type.\n"
+msgstr "You should use only one List dialogue type.\n"
+
+#: src/zenity.ui:16 src/zenity.ui:31
+msgid "Adjust the scale value"
+msgstr "Adjust the scale value"
+
+#: src/zenity.ui:74
+msgid "Text View"
+msgstr "Text View"
+
+#: src/zenity.ui:137
+msgid "Calendar selection"
+msgstr "Calendar selection"
+
+#: src/zenity.ui:156
+msgid "Select a date from below."
+msgstr "Select a date from below."
+
+#: src/zenity.ui:167
+msgid "C_alendar:"
+msgstr "C_alendar:"
+
+#: src/zenity.ui:172
+msgid "Calendar"
+msgstr "Calendar"
+
+#: src/zenity.ui:211
+msgid "Add a new entry"
+msgstr "Add a new entry"
+
+#: src/zenity.ui:234
+msgid "_Enter new text:"
+msgstr "_Enter new text:"
+
+#: src/zenity.ui:273
+msgid "Error"
+msgstr "Error"
+
+#: src/zenity.ui:301
+msgid "An error has occurred."
+msgstr "An error has occurred."
+
+#: src/zenity.ui:378
+msgid "Forms dialog"
+msgstr "Forms dialogue"
+
+#: src/zenity.ui:413
+msgid "Information"
+msgstr "Information"
+
+#: src/zenity.ui:438
+msgid "All updates are complete."
+msgstr "All updates are complete."
+
+#: src/zenity.ui:466
+msgid "Progress"
+msgstr "Progress"
+
+#: src/zenity.ui:481
+msgid "Running..."
+msgstr "Running..."
+
+#: src/zenity.ui:530
+msgid "Question"
+msgstr "Question"
+
+#: src/zenity.ui:553 src/zenity.ui:660
+msgid "Are you sure you want to proceed?"
+msgstr "Are you sure you want to proceed?"
+
+#: src/zenity.ui:573
+msgid "Select items from the list"
+msgstr "Select items from the list"
+
+#: src/zenity.ui:588
+msgid "Select items from the list below."
+msgstr "Select items from the list below."
+
+#: src/zenity.ui:633 src/zenity.ui:693
+msgid "Warning"
+msgstr "Warning"
+
+#: src/zenity.ui:716
+msgid "Type your password"
+msgstr "Type your password"
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..66362aa
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,4 @@
+i18n.gettext(
+ meson.project_name(),
+ preset: 'glib'
+)
diff --git a/src/Makefile.am b/src/Makefile.am
deleted file mode 100644
index bcdd205..0000000
--- a/src/Makefile.am
+++ /dev/null
@@ -1,57 +0,0 @@
-bin_PROGRAMS = zenity
-
-bin_SCRIPTS = gdialog
-
-zenity_SOURCES = \
- about.c \
- calendar.c \
- entry.c \
- fileselection.c \
- main.c \
- msg.c \
- notification.c \
- option.c \
- option.h \
- progress.c \
- scale.c \
- text.c \
- tree.c \
- color.c \
- password.c \
- util.c \
- util.h \
- forms.c \
- zenity.h
-
-zenity_CPPFLAGS = \
- -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DZENITY_DATADIR=\""$(pkgdatadir)"\" \
- $(AM_CPPFLAGS)
-
-zenity_CFLAGS = \
- $(ZENITY_CFLAGS) \
- $(LIBNOTIFY_CFLAGS) \
- $(WEBKIT_CFLAGS) \
- $(WARN_CFLAGS) \
- $(AM_CFLAGS)
-
-zenity_LDFLAGS = \
- $(AM_LDFLAGS)
-
-zenity_LDADD = \
- $(ZENITY_LIBS) \
- $(LIBNOTIFY_LIBS) \
- $(WEBKIT_LIBS)
-
-uidir = $(datadir)/zenity
-
-ui_DATA = \
- zenity.ui
-
-DISTCLEANFILES= \
- gdialog
-
-EXTRA_DIST = \
- $(ui_DATA) \
- gdialog \
- gdialog.in
diff --git a/src/about.c b/src/about.c
index 627aa1e..cac56c8 100644
--- a/src/about.c
+++ b/src/about.c
@@ -1,12 +1,15 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* about.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
- * Copyright (C) 2001 CodeFactory AB
- * Copyright (C) 2001, 2002 Anders Carlsson
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2001 CodeFactory AB
+ * Copyright © 2001, 2002 Anders Carlsson
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
@@ -15,7 +18,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
+ * 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.
@@ -24,26 +27,19 @@
* Anders Carlsson <andersca@gnu.org>
*/
-#include "config.h"
#include "util.h"
#include "zenity.h"
-#include <gdk/gdkkeysyms.h>
-#include <string.h>
-#define GTK_RESPONSE_CREDITS 0
-#define ZENITY_HELP_PATH ZENITY_DATADIR "/help/"
-#define ZENITY_CLOTHES_PATH ZENITY_DATADIR "/clothes/"
+#include <string.h>
-#define ZENITY_CANVAS_X 400.0
-#define ZENITY_CANVAS_Y 280.0
+#include <config.h>
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};
@@ -54,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 "
@@ -72,258 +66,56 @@ static const char *license[] = {
"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA "
"02110-1301, USA.")};
-#if 0
-static gint
-zenity_move_clothes_event (GnomeCanvasItem *item,
- GdkEvent *event,
- gpointer data)
-{
- static double x, y;
- double new_x, new_y;
- static int dragging;
- double item_x, item_y;
-
- /* set item_[xy] to the event x,y position in the parent's
- * item-relative coordinates
- */
-
- item_x = event->button.x;
- item_y = event->button.y;
- gnome_canvas_item_w2i (item->parent, &item_x, &item_y);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- x = item_x;
- y = item_y;
- gnome_canvas_item_ungrab (item, event->button.time);
- gnome_canvas_item_raise_to_top (item);
- dragging = TRUE;
- break;
-
- case GDK_MOTION_NOTIFY:
- if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) {
- new_x = item_x;
- new_y = item_y;
-
- gnome_canvas_item_move (item, new_x - x, new_y - y);
- x = new_x;
- y = new_y;
- }
- break;
-
- case GDK_BUTTON_RELEASE:
- gnome_canvas_item_ungrab (item, event->button.time);
- dragging = FALSE;
- break;
-
- default:
- break;
- }
-
- return FALSE;
-}
-
-typedef struct
-{
- const gchar *filename;
- gdouble x, y;
-} MonkClothes;
-
-static const MonkClothes monk_clothes[] = {
- {"gnome-tshirt.png", 30.0, 20.0},
- {"sunglasses.png", ZENITY_CANVAS_X - 100.0 , ZENITY_CANVAS_Y - 150.0 },
- {"surfboard.png", 30.0, ZENITY_CANVAS_Y - 200.0},
- {"hawaii-shirt.png", ZENITY_CANVAS_X - 50.0, 20.0}
-};
-
-static void
-zenity_create_clothes (GtkWidget *canvas_board)
-{
- GdkPixbuf *pixbuf;
- GnomeCanvasItem *canvas_item;
- gchar *pixbuf_path;
- size_t i;
-
- for (i = 0; i < G_N_ELEMENTS (monk_clothes); i++) {
- pixbuf_path = g_strconcat (ZENITY_CLOTHES_PATH, monk_clothes[i].filename, NULL);
- pixbuf = gdk_pixbuf_new_from_file (pixbuf_path, NULL);
-
- canvas_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (canvas_board)->root),
- GNOME_TYPE_CANVAS_PIXBUF,
- "x", monk_clothes[i].x,
- "y", monk_clothes[i].y,
- "pixbuf", pixbuf,
- "anchor", GTK_ANCHOR_NW,
- NULL);
- g_signal_connect (G_OBJECT (canvas_item), "event",
- G_CALLBACK (zenity_move_clothes_event), NULL);
- }
-}
-
-static GtkWidget *
-zenity_create_monk (void)
-{
- GtkWidget *canvas_board;
- GnomeCanvasItem *canvas_item;
- GdkPixbuf *pixbuf;
- GdkColor color = { 0, 0xffff, 0xffff, 0xffff };
-
- canvas_board = gnome_canvas_new ();
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas_board), 0, 0,
- ZENITY_CANVAS_X, ZENITY_CANVAS_Y);
-
- gtk_widget_set_size_request (canvas_board, ZENITY_CANVAS_X, ZENITY_CANVAS_Y);
-
- gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (canvas_board)),
- &color, FALSE, TRUE);
-
- gtk_widget_modify_bg (GTK_WIDGET (canvas_board), GTK_STATE_NORMAL, &color);
-
- pixbuf = gdk_pixbuf_new_from_file (ZENITY_CLOTHES_PATH "monk.png", NULL);
-
- canvas_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (canvas_board)->root),
- GNOME_TYPE_CANVAS_PIXBUF,
- "x", (ZENITY_CANVAS_X / 2.0)/2.0 + 10.0,
- "y", (ZENITY_CANVAS_Y / 2.0)/2.0 - 50.0,
- "pixbuf", pixbuf,
- "anchor", GTK_ANCHOR_NW,
- NULL);
-
- zenity_create_clothes (canvas_board);
-
- return canvas_board;
-}
-
-static GtkWidget *
-zenity_create_boutique (void)
-{
- GtkWidget *window;
- GtkWidget *canvas;
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- zenity_util_set_window_icon (window, NULL, ZENITY_IMAGE_FULLPATH ("zenity.png"));
- canvas = zenity_create_monk ();
- gtk_container_add (GTK_CONTAINER (window), canvas);
-
- return window;
-}
-
-static gboolean
-zenity_zen_wisdom (GtkDialog *dialog, GdkEventKey *event, gpointer user_data)
-{
- static gint string_count;
-
- if (string_count >= 3)
- return FALSE;
-
- switch (event->keyval) {
- case GDK_N:
- case GDK_n:
- if (string_count == 2) {
- GtkWidget *window;
- window = zenity_create_boutique ();
- gtk_widget_show_all (window);
- string_count++;
- } else {
- string_count = 0;
- }
- break;
- case GDK_Z:
- case GDK_z:
- if (string_count == 0)
- string_count++;
- else
- string_count = 0;
- break;
- case GDK_E:
- case GDK_e:
- if (string_count == 1)
- string_count++;
- else
- string_count = 0;
- break;
- default:
- string_count = 0;
- }
-
- return FALSE;
-}
-#endif
-
void
-zenity_about (ZenityData *data) {
- GdkPixbuf *logo;
+zenity_about (ZenityData *data)
+{
char *license_trans;
- translators = _ ("translator-credits");
- logo =
- gdk_pixbuf_new_from_file (ZENITY_IMAGE_FULLPATH ("zenity.png"), NULL);
-
license_trans = g_strconcat (
- _ (license[0]), "\n", _ (license[1]), "\n", _ (license[2]), "\n", NULL);
+ _(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,
"copyright",
- "Copyright \xc2\xa9 2003 Sun Microsystems",
+ "Copyright \xc2\xa9 2003 Sun Microsystems\n"
+ "Copyright \xc2\xa9 2021 Logan Rathbone\n",
"comments",
- _ ("Display dialog boxes from shell scripts"),
+ _("Display dialog boxes from shell scripts"),
"authors",
authors,
"documenters",
documenters,
- "translator-credits",
- translators,
"website",
- "http://live.gnome.org/Zenity",
- "logo",
- logo,
+ "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);
-
-#if 0
- g_signal_connect (G_OBJECT (dialog), "key_press_event",
- G_CALLBACK (zenity_zen_wisdom), NULL);
-#endif
+ g_signal_connect (dialog, "close-request",
+ G_CALLBACK(zenity_about_close_cb), data);
- zenity_util_show_dialog (dialog, data->attach);
- gtk_main ();
+ 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;
- 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;
- }
-
- gtk_main_quit ();
+ 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 9aaf927..07696ab 100644
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -1,19 +1,22 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* calendar.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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.
@@ -21,21 +24,23 @@
* Authors: Glynn Foster <glynn.foster@sun.com>
*/
-#include "config.h"
#include "util.h"
#include "zenity.h"
+
#include <time.h>
+#include <config.h>
+
static GtkWidget *calendar;
static ZenityCalendarData *zen_cal_data;
-static void zenity_calendar_dialog_response (
- GtkWidget *widget, int response, gpointer data);
-static void zenity_calendar_double_click (GtkCalendar *calendar, gpointer data);
+static void zenity_calendar_dialog_response (GtkWidget *widget,
+ int response, gpointer data);
void
-zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data) {
+zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data)
+{
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *button;
@@ -50,26 +55,21 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data) {
return;
}
- gtk_builder_connect_signals (builder, NULL);
-
- dialog =
- GTK_WIDGET (gtk_builder_get_object (builder, "zenity_calendar_dialog"));
+ dialog = GTK_WIDGET (gtk_builder_get_object (builder,
+ "zenity_calendar_dialog"));
- g_signal_connect (G_OBJECT (dialog),
- "response",
- G_CALLBACK (zenity_calendar_dialog_response),
- data);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK(zenity_calendar_dialog_response), 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), data->width, data->height);
+ gtk_window_set_default_size (GTK_WINDOW(dialog),
+ data->width, data->height);
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
@@ -77,24 +77,28 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data) {
text = gtk_builder_get_object (builder, "zenity_calendar_text");
if (cal_data->dialog_text)
- gtk_label_set_markup (
- GTK_LABEL (text), g_strcompress (cal_data->dialog_text));
+ gtk_label_set_markup (GTK_LABEL(text),
+ g_strcompress (cal_data->dialog_text));
- calendar = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_calendar"));
+ calendar = GTK_WIDGET(gtk_builder_get_object (builder, "zenity_calendar"));
if (cal_data->month > 0 || cal_data->year > 0)
- gtk_calendar_select_month (
- GTK_CALENDAR (calendar), cal_data->month - 1, cal_data->year);
- if (cal_data->day > 0)
- gtk_calendar_select_day (GTK_CALENDAR (calendar), cal_data->day);
+ {
+ g_object_set (calendar,
+ "month", cal_data->month - 1,
+ "year", cal_data->year,
+ NULL);
+ }
- g_signal_connect (calendar,
- "day-selected-double-click",
- G_CALLBACK (zenity_calendar_double_click),
- data);
+ if (cal_data->day > 0)
+ {
+ g_object_set (calendar,
+ "day", cal_data->day - 1,
+ NULL);
+ }
gtk_label_set_mnemonic_widget (GTK_LABEL (text), calendar);
- zenity_util_show_dialog (dialog, data->attach);
+ zenity_util_show_dialog (dialog);
if (data->timeout_delay > 0) {
g_timeout_add_seconds (data->timeout_delay,
@@ -102,54 +106,62 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data) {
dialog);
}
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ 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);
}
}
if (data->ok_label) {
- button = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_calendar_ok_button"));
+ button = GTK_WIDGET (gtk_builder_get_object (builder,
+ "zenity_calendar_ok_button"));
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
}
if (data->cancel_label) {
- button = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_calendar_cancel_button"));
+ button = GTK_WIDGET (gtk_builder_get_object (builder,
+ "zenity_calendar_cancel_button"));
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
}
g_object_unref (builder);
- gtk_main ();
+ zenity_util_gapp_main (GTK_WINDOW(dialog));
}
+
static void
-zenity_calendar_dialog_output (void) {
- guint day, month, year;
- gchar time_string[128];
- GDate *date = NULL;
-
- gtk_calendar_get_date (GTK_CALENDAR (calendar), &day, &month, &year);
- date = g_date_new_dmy (year, month + 1, day);
- g_date_strftime (time_string, 127, zen_cal_data->date_format, date);
+zenity_calendar_dialog_output (void)
+{
+ int day, month, year;
+ char *time_string;
+ GDateTime *date;
+
+ g_object_get (calendar,
+ "day", &day,
+ "month", &month,
+ "year", &year,
+ NULL);
+
+ date = g_date_time_new_local (year, month + 1, day + 1,
+ 0, 0, 0);
+
+ time_string = g_date_time_format (date, zen_cal_data->date_format);
g_print ("%s\n", time_string);
- if (date != NULL)
- g_date_free (date);
+ g_date_time_unref (date);
+ g_free (time_string);
}
static void
-zenity_calendar_dialog_response (
- GtkWidget *widget, int response, gpointer data) {
- ZenityData *zen_data;
-
- zen_data = data;
+zenity_calendar_dialog_response (GtkWidget *widget, int response,
+ gpointer data)
+{
+ ZenityData *zen_data = data;
- switch (response) {
+ switch (response)
+ {
case GTK_RESPONSE_OK:
zenity_calendar_dialog_output ();
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
@@ -166,15 +178,10 @@ zenity_calendar_dialog_response (
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label))
printf ("%s\n", zen_data->extra_label[response]);
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- gtk_main_quit ();
-}
-
-static void
-zenity_calendar_double_click (GtkCalendar *cal, gpointer data) {
- zenity_calendar_dialog_response (NULL, GTK_RESPONSE_OK, data);
+ zenity_util_gapp_quit (GTK_WINDOW(gtk_widget_get_native (widget)));
}
diff --git a/src/color.c b/src/color.c
index 9ef233e..4289407 100644
--- a/src/color.c
+++ b/src/color.c
@@ -1,19 +1,22 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* color.c
*
- * Copyright (C) 2010 Berislav Kovacki
+ * Copyright © 2010 Berislav Kovacki
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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.
@@ -29,13 +32,13 @@
static ZenityData *zen_data;
-static void zenity_colorselection_dialog_response (
- GtkWidget *widget, int response, gpointer data);
+static void zenity_colorselection_dialog_response (GtkWidget *widget,
+ int response, gpointer data);
void
-zenity_colorselection (ZenityData *data, ZenityColorData *color_data) {
+zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
+{
GtkWidget *dialog;
- GtkWidget *button;
GdkRGBA color;
zen_data = data;
@@ -47,55 +50,44 @@ zenity_colorselection (ZenityData *data, ZenityColorData *color_data) {
G_CALLBACK (zenity_colorselection_dialog_response),
color_data);
- if (color_data->color) {
- if (gdk_rgba_parse (&color, color_data->color)) {
- gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &color);
- }
+ if (color_data->color &&
+ gdk_rgba_parse (&color, color_data->color))
+ {
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER(dialog), &color);
}
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ 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);
}
}
- 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));
- }
-
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
g_object_set (dialog, "show-editor", !color_data->show_palette, NULL);
- zenity_util_show_dialog (dialog, data->attach);
+ zenity_util_show_dialog (dialog);
if (data->timeout_delay > 0) {
g_timeout_add_seconds (data->timeout_delay,
(GSourceFunc) zenity_util_timeout_handle,
dialog);
}
-
- gtk_main ();
+ zenity_util_gapp_main (GTK_WINDOW(dialog));
}
static void
-zenity_colorselection_dialog_response (
- GtkWidget *widget, int response, gpointer data) {
+zenity_colorselection_dialog_response (GtkWidget *widget,
+ int response, gpointer data)
+{
GdkRGBA color;
- switch (response) {
+ switch (response)
+ {
case GTK_RESPONSE_OK:
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color);
@@ -108,11 +100,10 @@ zenity_colorselection_dialog_response (
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label))
printf ("%s\n", zen_data->extra_label[response]);
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
-
- gtk_main_quit ();
+ zenity_util_gapp_quit (GTK_WINDOW(widget));
}
diff --git a/src/entry.c b/src/entry.c
index bf3db71..f116069 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -1,19 +1,22 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* entry.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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.
@@ -21,34 +24,35 @@
* Authors: Glynn Foster <glynn.foster@sun.com>
*/
-#include "config.h"
-
#include "util.h"
#include "zenity.h"
-static void zenity_entry_dialog_response (
- GtkWidget *widget, int response, gpointer data);
+#include <config.h>
+
+static void zenity_entry_dialog_response (GtkWidget *widget,
+ int response, gpointer data);
static GtkWidget *entry;
-static gint n_entries = 0;
+static int n_entries = 0;
static void
-zenity_entry_fill_entries (GSList **entries, const gchar **args) {
- gint i = 0;
-
- while (args[i] != NULL) {
- *entries = g_slist_append (*entries, (gchar *) args[i]);
- i++;
+zenity_entry_fill_entries (GSList **entries, const char **args)
+{
+ for (int i = 0; args[i] != NULL; ++i)
+ {
+ *entries = g_slist_append (*entries, (char *)args[i]);
}
}
static void
-zenity_entry_combo_activate_default (GtkEntry *entry, gpointer window) {
- gtk_window_activate_default (GTK_WINDOW (window));
+zenity_entry_combo_activate_default (GtkEntry *entry, gpointer window)
+{
+ g_signal_emit_by_name (window, "activate-default");
}
void
-zenity_entry (ZenityData *data, ZenityEntryData *entry_data) {
+zenity_entry (ZenityData *data, ZenityEntryData *entry_data)
+{
GtkBuilder *builder = NULL;
GtkWidget *dialog;
GtkWidget *button;
@@ -59,60 +63,60 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data) {
builder = zenity_util_load_ui_file ("zenity_entry_dialog", NULL);
- if (builder == NULL) {
+ if (builder == NULL)
+ {
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
return;
}
- gtk_builder_connect_signals (builder, NULL);
-
- dialog =
- GTK_WIDGET (gtk_builder_get_object (builder, "zenity_entry_dialog"));
+ dialog = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_entry_dialog"));
- g_signal_connect (G_OBJECT (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);
+ 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), data->width, data->height);
+ gtk_window_set_default_size (GTK_WINDOW (dialog),
+ data->width, data->height);
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ 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);
}
}
- 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);
+ 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);
}
- 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);
+ 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);
}
text = gtk_builder_get_object (builder, "zenity_entry_text");
- if (entry_data->dialog_text)
- gtk_label_set_text_with_mnemonic (
- GTK_LABEL (text), g_strcompress (entry_data->dialog_text));
+ if (entry_data->dialog_text) {
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (text),
+ g_strcompress (entry_data->dialog_text));
+ }
vbox = gtk_builder_get_object (builder, "vbox4");
@@ -120,72 +124,92 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data) {
n_entries = g_slist_length (entries);
- if (n_entries > 1) {
+ if (n_entries > 1)
+ {
+ GtkWidget *child;
+
entry = gtk_combo_box_text_new_with_entry ();
+ child = gtk_combo_box_get_child (GTK_COMBO_BOX(entry));
- for (tmp = entries; tmp; tmp = tmp->next) {
- gtk_combo_box_text_append_text (
- GTK_COMBO_BOX_TEXT (entry), tmp->data);
+ for (tmp = entries; tmp; tmp = tmp->next)
+ {
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(entry),
+ tmp->data);
}
- if (entry_data->entry_text) {
- gtk_combo_box_text_prepend_text (
- GTK_COMBO_BOX_TEXT (entry), entry_data->entry_text);
- gtk_combo_box_set_active (GTK_COMBO_BOX (entry), 0);
+ if (entry_data->entry_text)
+ {
+ gtk_combo_box_text_prepend_text (GTK_COMBO_BOX_TEXT(entry),
+ entry_data->entry_text);
+ gtk_combo_box_set_active (GTK_COMBO_BOX(entry), 0);
}
- g_signal_connect (gtk_bin_get_child (GTK_BIN (entry)),
- "activate",
+ g_signal_connect (child, "activate",
G_CALLBACK (zenity_entry_combo_activate_default),
GTK_WINDOW (dialog));
- } else {
+ }
+ else
+ {
+ GtkEntryBuffer *buffer;
+
entry = gtk_entry_new ();
+ buffer = gtk_entry_get_buffer (GTK_ENTRY(entry));
- gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
+ gtk_entry_set_activates_default (GTK_ENTRY(entry), TRUE);
- if (entry_data->entry_text)
- gtk_entry_set_text (GTK_ENTRY (entry), entry_data->entry_text);
+ if (entry_data->entry_text) {
+ gtk_entry_buffer_set_text (buffer, entry_data->entry_text, -1);
+ }
- if (entry_data->hide_text)
- g_object_set (G_OBJECT (entry), "visibility", FALSE, NULL);
+ if (entry_data->hide_text) {
+ gtk_entry_set_visibility (GTK_ENTRY(entry), FALSE);
+ }
}
- gtk_widget_show (entry);
-
- gtk_box_pack_end (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
+ gtk_box_append (GTK_BOX(vbox), entry);
gtk_label_set_mnemonic_widget (GTK_LABEL (text), entry);
g_object_unref (builder);
- zenity_util_show_dialog (dialog, data->attach);
+ zenity_util_show_dialog (dialog);
if (data->timeout_delay > 0) {
g_timeout_add_seconds (data->timeout_delay,
(GSourceFunc) zenity_util_timeout_handle,
dialog);
}
-
- gtk_main ();
+ zenity_util_gapp_main (GTK_WINDOW(dialog));
}
static void
-zenity_entry_dialog_output (void) {
- const gchar *text;
+zenity_entry_dialog_output (void)
+{
+ const char *text;
+
if (n_entries > 1)
- text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (entry));
+ {
+ text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT(entry));
+ }
else
- text = gtk_entry_get_text (GTK_ENTRY (entry));
+ {
+ GtkEntryBuffer *buffer;
+
+ buffer = gtk_entry_get_buffer (GTK_ENTRY(entry));
+ text = gtk_entry_buffer_get_text (buffer);
+ }
if (text != NULL)
g_print ("%s\n", text);
}
static void
-zenity_entry_dialog_response (GtkWidget *widget, int response, gpointer data) {
+zenity_entry_dialog_response (GtkWidget *widget, int response, gpointer data)
+{
ZenityData *zen_data = data;
- switch (response) {
+ switch (response)
+ {
case GTK_RESPONSE_OK:
zenity_entry_dialog_output ();
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
@@ -202,10 +226,10 @@ zenity_entry_dialog_response (GtkWidget *widget, int response, gpointer data) {
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label))
printf ("%s\n", zen_data->extra_label[response]);
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- gtk_main_quit ();
+ zenity_util_gapp_quit (GTK_WINDOW(widget));
}
diff --git a/src/fileselection.c b/src/fileselection.c
index 465f08a..0020b23 100644
--- a/src/fileselection.c
+++ b/src/fileselection.c
@@ -1,142 +1,123 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* fileselection.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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.
*
- * Authors: Glynn Foster <glynn.foster@sun.com>
+ * Original Author: Glynn Foster <glynn.foster@sun.com>
*/
-#include "config.h"
-
#include "util.h"
#include "zenity.h"
+
#include <string.h>
+#include <config.h>
+
static ZenityData *zen_data;
-static void zenity_fileselection_dialog_response (
- gpointer obj, int response, gpointer data);
+static void zenity_fileselection_dialog_response (GtkDialog *dialog,
+ int response, gpointer data);
void
-zenity_fileselection (ZenityData *data, ZenityFileData *file_data) {
- gchar *dir;
- gchar *basename;
+zenity_fileselection (ZenityData *data, ZenityFileData *file_data)
+{
GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
-#if GTK_CHECK_VERSION(3, 20, 0)
GtkFileChooserNative *dialog;
-#else
- GtkWidget *dialog;
-#endif
zen_data = data;
if (file_data->directory) {
- if (file_data->save)
- action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
- else
- action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
- } else {
- if (file_data->save)
- action = GTK_FILE_CHOOSER_ACTION_SAVE;
+ action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
+ }
+ else if (file_data->save) {
+ action = GTK_FILE_CHOOSER_ACTION_SAVE;
}
-#if GTK_CHECK_VERSION(3, 20, 0)
dialog = gtk_file_chooser_native_new (data->dialog_title,
- NULL, /* TODO: Get parent from xid */
+ NULL, /* parent */
action,
- _ ("_OK"),
- _ ("_Cancel"));
+ _("_OK"),
+ _("_Cancel"));
if (data->modal)
- gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
+ gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG(dialog), TRUE);
if (data->extra_label)
g_warning ("Cannot add extra labels to GtkFileChooserNative");
-#else
- dialog = gtk_file_chooser_dialog_new (NULL,
- NULL,
- action,
- _ ("_Cancel"),
- GTK_RESPONSE_CANCEL,
- _ ("_OK"),
- GTK_RESPONSE_ACCEPT,
- NULL);
- if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK(zenity_fileselection_dialog_response), file_data);
- if (data->modal)
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ if (file_data->uri)
+ {
+ if (g_path_is_absolute (file_data->uri) == TRUE)
+ {
+ char *dir = g_path_get_dirname (file_data->uri);
+ GFile *dir_gfile = g_file_new_for_path (dir);
- zenity_util_set_window_icon (
- dialog, data->window_icon, ZENITY_IMAGE_FULLPATH ("zenity-file.png"));
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(dialog),
+ dir_gfile,
+ NULL); /* GError */
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ g_free (dir);
+ g_object_unref (dir_gfile);
}
- }
-#endif
- gtk_file_chooser_set_do_overwrite_confirmation (
- GTK_FILE_CHOOSER (dialog), file_data->confirm_overwrite);
+ if (file_data->uri[strlen (file_data->uri) - 1] != '/')
+ {
+ if (file_data->save)
+ {
+ char *basename = g_path_get_basename (file_data->uri);
- g_signal_connect (G_OBJECT (dialog),
- "response",
- G_CALLBACK (zenity_fileselection_dialog_response),
- file_data);
+ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog),
+ basename);
- if (file_data->uri) {
- dir = g_path_get_dirname (file_data->uri);
+ g_free (basename);
+ }
+ else
+ {
+ GFile *file = g_file_new_for_uri (file_data->uri);
- if (g_path_is_absolute (file_data->uri) == TRUE)
- gtk_file_chooser_set_current_folder (
- GTK_FILE_CHOOSER (dialog), dir);
+ gtk_file_chooser_set_file (GTK_FILE_CHOOSER(dialog),
+ file,
+ NULL); /* GError */
- if (file_data->uri[strlen (file_data->uri) - 1] != '/') {
- basename = g_path_get_basename (file_data->uri);
- if (file_data->save)
- gtk_file_chooser_set_current_name (
- GTK_FILE_CHOOSER (dialog), basename);
- else
- (void) gtk_file_chooser_set_filename (
- GTK_FILE_CHOOSER (dialog), file_data->uri);
- g_free (basename);
+ g_object_unref (file);
+ }
}
- g_free (dir);
}
if (file_data->multi)
- gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
+ gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER(dialog), TRUE);
- if (file_data->filter) {
+ if (file_data->filter)
+ {
/* Filter format: Executables | *.exe *.bat *.com */
- gint filter_i;
-
- for (filter_i = 0; file_data->filter[filter_i]; filter_i++) {
+ for (int filter_i = 0; file_data->filter[filter_i]; filter_i++)
+ {
GtkFileFilter *filter = gtk_file_filter_new ();
- gchar *filter_str = file_data->filter[filter_i];
- gchar **pattern, **patterns;
- gchar *name = NULL;
- gint i;
+ char *filter_str = file_data->filter[filter_i];
+ char **pattern, **patterns;
+ char *name = NULL;
+ int i;
/* Set name */
for (i = 0; filter_str[i] != '\0'; i++)
@@ -170,15 +151,10 @@ zenity_fileselection (ZenityData *data, ZenityFileData *file_data) {
g_strfreev (patterns);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(dialog), filter);
}
}
-
-#if GTK_CHECK_VERSION(3, 20, 0)
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
-#else
- zenity_util_show_dialog (dialog, data->attach);
-#endif
if (data->timeout_delay > 0) {
g_timeout_add_seconds (data->timeout_delay,
@@ -186,33 +162,46 @@ zenity_fileselection (ZenityData *data, ZenityFileData *file_data) {
dialog);
}
- gtk_main ();
+ /* Since a native dialog is not a GtkWindow, we can't use our handy
+ * util function.
+ */
+ gtk_native_dialog_show (GTK_NATIVE_DIALOG(dialog));
+
+ zenity_util_gapp_main (NULL);
}
static void
-zenity_fileselection_dialog_output (
- GtkFileChooser *chooser, ZenityFileData *file_data) {
- GSList *selections, *iter;
- selections = gtk_file_chooser_get_filenames (chooser);
- for (iter = selections; iter != NULL; iter = iter->next) {
- g_print ("%s",
- g_filename_to_utf8 ((gchar *) iter->data, -1, NULL, NULL, NULL));
- g_free (iter->data);
- if (iter->next != NULL)
+zenity_fileselection_dialog_output (GtkFileChooser *chooser,
+ ZenityFileData *file_data)
+{
+ GListModel *model = gtk_file_chooser_get_files (chooser);
+ guint items = g_list_model_get_n_items (model);
+
+ for (guint i = 0; i < items; ++i)
+ {
+ GFile *file = g_list_model_get_item (model, i);
+
+ g_print ("%s", g_file_get_path (file));
+
+ if (i != items - 1)
g_print ("%s", file_data->separator);
+
+ g_object_unref (file);
}
g_print ("\n");
- g_slist_free (selections);
+
+ g_object_unref (model);
}
static void
-zenity_fileselection_dialog_response (
- gpointer obj, int response, gpointer data) {
+zenity_fileselection_dialog_response (GtkDialog *dialog,
+ int response, gpointer data)
+{
ZenityFileData *file_data = data;
+ GtkFileChooser *chooser = GTK_FILE_CHOOSER (dialog);
- GtkFileChooser *chooser = GTK_FILE_CHOOSER (obj);
-
- switch (response) {
+ switch (response)
+ {
case GTK_RESPONSE_ACCEPT:
zenity_fileselection_dialog_output (chooser, file_data);
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
@@ -229,10 +218,11 @@ zenity_fileselection_dialog_response (
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label)) {
printf ("%s\n", zen_data->extra_label[response]);
+ }
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- gtk_main_quit ();
+ zenity_util_gapp_quit (NULL);
}
diff --git a/src/forms.c b/src/forms.c
index 15df718..86b8499 100644
--- a/src/forms.c
+++ b/src/forms.c
@@ -1,47 +1,55 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* forms.c
*
- * Copyright (C) 2010 Arx Cruz
+ * Copyright © 2010 Arx Cruz
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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., 121 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
- * Authors: Arx Cruz <arxcruz@gnome.org>
+ * Original Author: Arx Cruz <arxcruz@gnome.org>
*/
-#include "config.h"
#include "util.h"
#include "zenity.h"
+
#include <string.h>
+#include <config.h>
+
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,
+ int response, gpointer data);
static void
zenity_forms_dialog_get_selected (GtkTreeModel *model, GtkTreePath *path_buf,
- GtkTreeIter *iter, GtkTreeView *tree_view) {
- gint n_columns = 0;
- gint i = 0;
- GValue value = {
- 0,
- };
+ GtkTreeIter *iter, gpointer data)
+{
+ int n_columns = 0;
+ GValue value = G_VALUE_INIT;
+ GtkTreeView *tree_view = GTK_TREE_VIEW(data);
+
+ g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));
n_columns = gtk_tree_model_get_n_columns (model);
- for (i = 0; i < n_columns; i++) {
+
+ for (int i = 0; i < n_columns; ++i)
+ {
gtk_tree_model_get_value (model, iter, i, &value);
selected = g_slist_append (selected, g_value_dup_string (&value));
g_value_unset (&value);
@@ -49,26 +57,32 @@ zenity_forms_dialog_get_selected (GtkTreeModel *model, GtkTreePath *path_buf,
}
static GtkWidget *
-zenity_forms_create_and_fill_combo (
- ZenityFormsData *forms_data, int combo_number) {
+zenity_forms_create_and_fill_combo (ZenityFormsData *forms_data,
+ int combo_number)
+{
GtkListStore *list_store;
GtkWidget *combo_box;
GtkCellRenderer *renderer;
- gchar *combo_values;
list_store = gtk_list_store_new (1, G_TYPE_STRING);
- if (forms_data->combo_values) {
- combo_values =
+ if (forms_data->combo_values)
+ {
+ char *combo_values =
g_slist_nth_data (forms_data->combo_values, combo_number);
- if (combo_values) {
- gchar **row_values = g_strsplit_set (combo_values, "|", -1);
- if (row_values) {
- gint i = 0;
+
+ if (combo_values)
+ {
+ char **row_values = g_strsplit_set (combo_values, "|", -1);
+
+ if (row_values)
+ {
+ int i = 0;
GtkTreeIter iter;
- gchar *row = row_values[i];
+ char *row = row_values[i];
- while (row != NULL) {
+ while (row != NULL)
+ {
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter, 0, row, -1);
row = row_values[++i];
@@ -79,65 +93,81 @@ zenity_forms_create_and_fill_combo (
}
}
- combo_box = gtk_combo_box_new_with_model (GTK_TREE_MODEL (list_store));
- g_object_unref (G_OBJECT (list_store));
+ combo_box = gtk_combo_box_new_with_model (GTK_TREE_MODEL(list_store));
+ g_object_unref (list_store);
renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
- gtk_cell_layout_set_attributes (
- GTK_CELL_LAYOUT (combo_box), renderer, "text", 0, NULL);
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(combo_box),
+ renderer,
+ TRUE); /* gboolean expand */
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT(combo_box), renderer,
+ "text", 0,
+ NULL);
return combo_box;
}
static GtkWidget *
-zenity_forms_create_and_fill_list (
- ZenityFormsData *forms_data, int list_number, gchar *header) {
+zenity_forms_create_and_fill_list (ZenityFormsData *forms_data,
+ int list_number, char *header)
+{
GtkListStore *list_store;
GtkWidget *tree_view;
GtkWidget *scrolled_window;
- GtkCellRenderer *renderer;
- GtkTreeViewColumn *column;
GType *column_types = NULL;
- gchar *list_values;
- gchar *column_values;
- gint i = 0;
+ int i = 0;
/* If no column names available, default is one */
- gint n_columns = 1;
- gint column_index = 0;
+ int n_columns = 1;
+ int column_index = 0;
tree_view = gtk_tree_view_new ();
- if (forms_data->column_values) {
- int columns_values_count =
- g_slist_length (forms_data->column_values);
+ if (forms_data->column_values)
+ {
+ char *column_values;
+ int columns_values_count = g_slist_length (forms_data->column_values);
int column_number = 0;
+
if (list_number < columns_values_count) {
column_number = list_number;
}
- column_values =
- g_slist_nth_data (forms_data->column_values, column_number);
- if (column_values) {
- gchar **values = g_strsplit_set (column_values, "|", -1);
- if (values) {
+ column_values = g_slist_nth_data (forms_data->column_values,
+ column_number);
+
+ if (column_values)
+ {
+ char **values = g_strsplit_set (column_values, "|", -1);
+
+ if (values)
+ {
n_columns = g_strv_length (values);
column_types = g_new (GType, n_columns);
+
for (i = 0; i < n_columns; i++)
column_types[i] = G_TYPE_STRING;
- for (i = 0; i < n_columns; i++) {
- gchar *column_name = values[i];
+ for (i = 0; i < n_columns; i++)
+ {
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ char *column_name = values[i];
+
renderer = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes (
- column_name, renderer, "text", column_index, NULL);
- gtk_tree_view_append_column (
- GTK_TREE_VIEW (tree_view), column);
+ column =
+ gtk_tree_view_column_new_with_attributes (column_name,
+ renderer,
+ "text", column_index,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
+ column);
column_index++;
}
}
- } else {
+ }
+ else
+ {
/* If no values available, add one with string type*/
column_types = g_new (GType, n_columns);
column_types[0] = G_TYPE_STRING;
@@ -148,18 +178,26 @@ zenity_forms_create_and_fill_list (
gtk_list_store_set_column_types (list_store, n_columns, column_types);
- if (forms_data->list_values) {
- list_values = g_slist_nth_data (forms_data->list_values, list_number);
- if (list_values) {
- gchar **row_values = g_strsplit_set (list_values, "|", -1);
- if (row_values) {
+ if (forms_data->list_values)
+ {
+ char *list_values =
+ g_slist_nth_data (forms_data->list_values, list_number);
+
+ if (list_values)
+ {
+ char **row_values = g_strsplit_set (list_values, "|", -1);
+
+ if (row_values)
+ {
GtkTreeIter iter;
- gchar *row = row_values[0];
- gint position = -1;
+ char *row = row_values[0];
+ int position = -1;
i = 0;
- while (row != NULL) {
- if (position >= n_columns || position == -1) {
+ while (row != NULL)
+ {
+ if (position >= n_columns || position == -1)
+ {
position = 0;
gtk_list_store_append (list_store, &iter);
}
@@ -173,31 +211,29 @@ zenity_forms_create_and_fill_list (
}
}
- gtk_tree_view_set_model (
- GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (list_store));
- g_object_unref (list_store);
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- // gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW
- // (scrolled_window),
- // GTK_WIDGET (tree_view));
- gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (tree_view));
- gtk_widget_set_size_request (GTK_WIDGET (scrolled_window), -1, 100);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view),
+ GTK_TREE_MODEL (list_store));
gtk_tree_view_set_headers_visible (
GTK_TREE_VIEW (tree_view), forms_data->show_header);
+ g_object_unref (list_store);
+
+ scrolled_window = gtk_scrolled_window_new ();
+ gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW(scrolled_window),
+ tree_view);
+ gtk_widget_set_size_request (scrolled_window, -1, 100);
return scrolled_window;
}
void
-zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data) {
+zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data)
+{
GtkBuilder *builder = NULL;
GtkWidget *dialog;
GtkWidget *grid;
GtkWidget *text;
GtkWidget *button;
- GSList *tmp;
-
int list_count = 0;
int combo_count = 0;
int i = 0;
@@ -211,29 +247,26 @@ zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data) {
return;
}
- gtk_builder_connect_signals (builder, NULL);
-
- dialog =
- GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_dialog"));
+ dialog = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_forms_dialog"));
- g_signal_connect (G_OBJECT (dialog),
- "response",
- G_CALLBACK (zenity_forms_dialog_response),
- forms_data);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (zenity_forms_dialog_response), forms_data);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
-
- if (data->width > -1 || data->height > -1)
- gtk_window_set_default_size (
- GTK_WINDOW (dialog), data->width, data->height);
-
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
+
+ if (data->width > -1 || data->height > -1) {
+ gtk_window_set_default_size (GTK_WINDOW(dialog),
+ data->width, data->height);
+ }
+
+ 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);
}
}
@@ -257,37 +290,48 @@ zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data) {
grid = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_grid"));
- for (tmp = forms_data->list; tmp; tmp = tmp->next) {
- ZenityFormsValue *zenity_value = (ZenityFormsValue *) tmp->data;
+ i = 0;
+ for (GSList *tmp = forms_data->list;
+ tmp != NULL;
+ tmp = tmp->next)
+ {
+ ZenityFormsValue *zenity_value = tmp->data;
GtkWidget *label;
label = gtk_label_new (zenity_value->option_value);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_grid_attach (GTK_GRID (grid), label, 0, i, 1, 1);
- switch (zenity_value->type) {
+ switch (zenity_value->type)
+ {
case ZENITY_FORMS_ENTRY:
zenity_value->forms_widget = gtk_entry_new ();
break;
+
case ZENITY_FORMS_PASSWORD:
zenity_value->forms_widget = gtk_entry_new ();
- gtk_entry_set_visibility (
- GTK_ENTRY (zenity_value->forms_widget), FALSE);
+ gtk_entry_set_visibility (GTK_ENTRY(zenity_value->forms_widget),
+ FALSE);
break;
+
case ZENITY_FORMS_CALENDAR:
zenity_value->forms_widget = gtk_calendar_new ();
break;
+
case ZENITY_FORMS_LIST:
- zenity_value->forms_widget = zenity_forms_create_and_fill_list (
- forms_data, list_count, zenity_value->option_value);
+ zenity_value->forms_widget =
+ zenity_forms_create_and_fill_list (forms_data,
+ list_count, zenity_value->option_value);
list_count++;
break;
+
case ZENITY_FORMS_COMBO:
zenity_value->forms_widget =
- zenity_forms_create_and_fill_combo (
- forms_data, combo_count);
+ zenity_forms_create_and_fill_combo (forms_data,
+ combo_count);
combo_count++;
break;
+
default:
zenity_value->forms_widget = gtk_entry_new ();
break;
@@ -300,90 +344,104 @@ zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data) {
1,
1);
- i++;
+ ++i;
}
- gtk_widget_show_all (GTK_WIDGET (dialog));
+ zenity_util_show_dialog (dialog);
g_object_unref (builder);
- if (data->timeout_delay > 0) {
+ if (data->timeout_delay > 0)
+ {
g_timeout_add_seconds (data->timeout_delay,
(GSourceFunc) zenity_util_timeout_handle,
dialog);
}
-
- gtk_main ();
+ zenity_util_gapp_main (GTK_WINDOW(dialog));
}
static void
-zenity_forms_dialog_output (ZenityFormsData *forms_data) {
+zenity_forms_dialog_output (ZenityFormsData *forms_data)
+{
GSList *tmp, *tmp2;
guint day, year, month;
GDate *date = NULL;
- gchar time_string[128];
- gchar *combo_value = NULL;
+ char time_string[128];
+ char *combo_value = NULL;
GtkTreeSelection *selection;
GtkListStore *list_store;
GtkTreeIter iter;
- for (tmp = forms_data->list; tmp; tmp = tmp->next) {
- ZenityFormsValue *zenity_value = (ZenityFormsValue *) tmp->data;
- switch (zenity_value->type) {
+ for (tmp = forms_data->list; tmp; tmp = tmp->next)
+ {
+ ZenityFormsValue *zenity_value = tmp->data;
+
+ switch (zenity_value->type)
+ {
case ZENITY_FORMS_PASSWORD:
case ZENITY_FORMS_ENTRY:
g_print ("%s",
- gtk_entry_get_text (
- GTK_ENTRY (zenity_value->forms_widget)));
+ gtk_entry_buffer_get_text (gtk_entry_get_buffer
+ (GTK_ENTRY(zenity_value->forms_widget))));
break;
+
case ZENITY_FORMS_LIST:
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (
- gtk_bin_get_child (GTK_BIN (zenity_value->forms_widget))));
+ selection =
+ gtk_tree_view_get_selection
+ (GTK_TREE_VIEW(gtk_scrolled_window_get_child
+ (GTK_SCROLLED_WINDOW(zenity_value->forms_widget))));
+
gtk_tree_selection_selected_foreach (selection,
- (GtkTreeSelectionForeachFunc)
- zenity_forms_dialog_get_selected,
- GTK_TREE_VIEW (gtk_bin_get_child (
- GTK_BIN (zenity_value->forms_widget))));
+ zenity_forms_dialog_get_selected,
+ GTK_TREE_VIEW(gtk_scrolled_window_get_child
+ (GTK_SCROLLED_WINDOW(zenity_value->forms_widget))));
- for (tmp2 = selected; tmp2; tmp2 = tmp2->next) {
+ for (tmp2 = selected; tmp2; tmp2 = tmp2->next)
+ {
if (tmp->next != NULL) {
- g_print ("%s,", (gchar *) tmp2->data);
+ g_print ("%s,", (char *)tmp2->data);
} else
- g_print ("%s", (gchar *) tmp2->data);
+ g_print ("%s", (char *)tmp2->data);
}
- g_slist_foreach (selected, (GFunc) g_free, NULL);
- selected = NULL;
-
+ g_slist_free_full (g_steal_pointer (&selected), g_free);
break;
+
case ZENITY_FORMS_CALENDAR:
- gtk_calendar_get_date (
- GTK_CALENDAR (zenity_value->forms_widget),
- &day,
- &month,
- &year);
+ g_object_get (zenity_value->forms_widget,
+ "day", &day,
+ "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);
+ g_date_strftime (time_string,
+ 127, forms_data->date_format, date);
g_print ("%s", time_string);
break;
+
case ZENITY_FORMS_COMBO:
- if (gtk_combo_box_get_active_iter (
- GTK_COMBO_BOX (zenity_value->forms_widget), &iter)) {
- list_store = GTK_LIST_STORE (gtk_combo_box_get_model (
- GTK_COMBO_BOX (zenity_value->forms_widget)));
- gtk_tree_model_get (GTK_TREE_MODEL (list_store),
+ if (gtk_combo_box_get_active_iter
+ (GTK_COMBO_BOX(zenity_value->forms_widget), &iter))
+ {
+ list_store =
+ GTK_LIST_STORE(gtk_combo_box_get_model
+ (GTK_COMBO_BOX(zenity_value->forms_widget)));
+
+ gtk_tree_model_get (GTK_TREE_MODEL(list_store),
&iter,
0,
&combo_value,
-1);
+
g_object_unref (G_OBJECT (list_store));
g_print ("%s", combo_value);
g_free (combo_value);
- } else
+ }
+ else
g_print (" ");
break;
+
}
if (tmp->next != NULL)
g_print ("%s", forms_data->separator);
@@ -392,10 +450,12 @@ zenity_forms_dialog_output (ZenityFormsData *forms_data) {
}
static void
-zenity_forms_dialog_response (GtkWidget *widget, int response, gpointer data) {
- ZenityFormsData *forms_data = (ZenityFormsData *) data;
+zenity_forms_dialog_response (GtkWidget *widget, int response, gpointer data)
+{
+ ZenityFormsData *forms_data = data;
- switch (response) {
+ switch (response)
+ {
case GTK_RESPONSE_OK:
zenity_forms_dialog_output (forms_data);
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
@@ -412,11 +472,10 @@ zenity_forms_dialog_response (GtkWidget *widget, int response, gpointer data) {
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label))
printf ("%s\n", zen_data->extra_label[response]);
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
-
- gtk_main_quit ();
+ zenity_util_gapp_quit (GTK_WINDOW(widget));
}
diff --git a/src/main.c b/src/main.c
index 7f0c2db..01545be 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,120 +1,168 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* main.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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.
*
- * Authors: Glynn Foster <glynn.foster@sun.com>
+ * Original Author: Glynn Foster <glynn.foster@sun.com>
*/
-#include <config.h>
-
#include "option.h"
#include "zenity.h"
-#include <glib.h>
#include <gtk/gtk.h>
-#include <langinfo.h>
-#include <stdlib.h>
-#ifdef HAVE_LOCALE_H
#include <locale.h>
-#endif
-
-gint
-main (gint argc, gchar **argv) {
- ZenityParsingOptions *results;
- gint retval;
+#include <stdlib.h>
-#ifdef HAVE_LOCALE_H
- setlocale (LC_ALL, "");
-#endif
+#include <config.h>
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
+typedef struct {
+ int argc;
+ char **argv;
+} ZenityArgs;
- gtk_init (&argc, &argv);
+static void
+command_line_cb (GtkApplication *app,
+ GApplicationCommandLine *command_line,
+ gpointer user_data)
+{
+ ZenityArgs *args = user_data;
+ ZenityParsingOptions *results;
- results = zenity_option_parse (argc, argv);
+ results = zenity_option_parse (args->argc, args->argv);
- switch (results->mode) {
+ switch (results->mode)
+ {
case MODE_CALENDAR:
zenity_calendar (results->data, results->calendar_data);
break;
+
case MODE_ENTRY:
- results->entry_data->data = (const gchar **) argv + 1;
+ /* allow for a series of tokens (or even a bash array!) to be
+ * passed as arguments so as to auto-populate the entry with
+ * a list of options as a combo-box.
+ */
+ results->entry_data->data = (const char **) args->argv + 1;
zenity_entry (results->data, results->entry_data);
break;
+
case MODE_ERROR:
case MODE_QUESTION:
case MODE_WARNING:
case MODE_INFO:
zenity_msg (results->data, results->msg_data);
break;
+
case MODE_SCALE:
zenity_scale (results->data, results->scale_data);
break;
+
case MODE_FILE:
zenity_fileselection (results->data, results->file_data);
break;
+
case MODE_LIST:
- results->tree_data->data = (const gchar **) argv + 1;
+ results->tree_data->data = (const char **) args->argv + 1;
zenity_tree (results->data, results->tree_data);
break;
+
#ifdef HAVE_LIBNOTIFY
case MODE_NOTIFICATION:
zenity_notification (results->data, results->notification_data);
break;
#endif
+
case MODE_PROGRESS:
zenity_progress (results->data, results->progress_data);
break;
+
case MODE_TEXTINFO:
zenity_text (results->data, results->text_data);
break;
+
case MODE_COLOR:
zenity_colorselection (results->data, results->color_data);
break;
+
case MODE_PASSWORD:
zenity_password_dialog (results->data, results->password_data);
break;
+
case MODE_ABOUT:
zenity_about (results->data);
break;
+
case MODE_FORMS:
zenity_forms_dialog (results->data, results->forms_data);
break;
+
case MODE_VERSION:
g_print ("%s\n", VERSION);
break;
+
case MODE_LAST:
g_printerr (_ ("You must specify a dialog type. See 'zenity "
"--help' for details\n"));
zenity_option_free ();
exit (-1);
+
default:
g_assert_not_reached ();
zenity_option_free ();
exit (-1);
}
- retval = results->data->exit_code;
-
zenity_option_free ();
+ g_free (args);
+
+ g_application_command_line_set_exit_status (command_line,
+ results->data->exit_code);
+}
+
+int
+main (int argc, char *argv[])
+{
+ ZenityArgs *args;
+ GtkApplication *app;
+ int status;
+
+ /* boilerplate i18n stuff */
+ setlocale (LC_ALL, "");
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+ /* </i18n> */
+
+ args = g_new (ZenityArgs, 1);
+ args->argc = argc;
+ args->argv = argv;
+
+ 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);
- exit (retval);
+ return status;
}
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 0000000..1d3cd82
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,53 @@
+# for i in `ls *.c`; do echo " '${i}',"; done
+zenity_sources = [
+ 'about.c',
+ 'calendar.c',
+ 'color.c',
+ 'entry.c',
+ 'fileselection.c',
+ 'forms.c',
+ 'main.c',
+ 'msg.c',
+ 'notification.c',
+ 'option.c',
+ 'password.c',
+ 'progress.c',
+ 'scale.c',
+ 'text.c',
+ 'tree.c',
+ 'util.c'
+]
+
+zenity_deps = [
+ gtk_dep,
+ libnotify
+]
+
+zenity_res = gnome.compile_resources(
+ 'zenity-resources',
+ 'zenity.gresource.xml',
+ c_name: 'zenity'
+)
+
+zenity_c_args = [
+ '-DG_LOG_DOMAIN="Zenity"'
+]
+
+zenity = executable(
+ meson.project_name(),
+ zenity_sources + zenity_res,
+ include_directories: zenity_root_dir,
+ dependencies: zenity_deps,
+ 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 496fe18..5b8e7a9 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -1,7 +1,10 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* msg.c
*
* Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright © 2021 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -21,26 +24,27 @@
* Authors: Glynn Foster <glynn.foster@sun.com>
*/
-#include "config.h"
+#include <config.h>
#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) {
+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);
+ 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);
+ 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);
@@ -51,8 +55,10 @@ zenity_msg_construct_question_dialog (
}
}
+/* FIXME - Is this still necessary with gtk4? */
static void
-zenity_label_widget_clipboard_selection (GtkWidget *widget) {
+zenity_label_widget_clipboard_selection (GtkWidget *widget)
+{
/* Workaround hotfix for suspected toolkit issue:
since focus change of the dialog's focussed widget (text)
somehow currently chooses to destroy
@@ -76,14 +82,16 @@ zenity_label_widget_clipboard_selection (GtkWidget *widget) {
}
void
-zenity_msg (ZenityData *data, ZenityMsgData *msg_data) {
+zenity_msg (ZenityData *data, ZenityMsgData *msg_data)
+{
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *ok_button;
GObject *text;
GObject *image;
- switch (msg_data->mode) {
+ switch (msg_data->mode)
+ {
case ZENITY_MSG_WARNING:
builder = zenity_util_load_ui_file ("zenity_warning_dialog", NULL);
dialog = GTK_WIDGET (
@@ -97,8 +105,8 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) {
case ZENITY_MSG_QUESTION:
case ZENITY_MSG_SWITCH:
builder = zenity_util_load_ui_file ("zenity_question_dialog", NULL);
- dialog = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_question_dialog"));
+ 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;
@@ -106,22 +114,22 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) {
case ZENITY_MSG_ERROR:
builder = zenity_util_load_ui_file ("zenity_error_dialog", NULL);
- dialog = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_error_dialog"));
+ 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"));
+ 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);
- dialog = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_info_dialog"));
+ 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"));
+ ok_button = GTK_WIDGET (gtk_builder_get_object (builder,
+ "zenity_info_ok_button"));
break;
default:
@@ -134,12 +142,12 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) {
break;
}
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ 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);
}
}
@@ -153,8 +161,6 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) {
G_CALLBACK (zenity_msg_dialog_response),
data);
- gtk_builder_connect_signals (builder, NULL);
-
if (data->dialog_title)
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
@@ -164,75 +170,77 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) {
}
}
- switch (msg_data->mode) {
+ 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:
break;
}
+ if (data->width > -1 || data->height > -1) {
+ gtk_window_set_default_size (GTK_WINDOW(dialog),
+ data->width, data->height);
+ }
- if (data->width > -1 || data->height > -1)
- gtk_window_set_default_size (
- GTK_WINDOW (dialog), data->width, data->height);
-
- if (data->width > -1)
+ if (data->width > -1) {
gtk_widget_set_size_request (GTK_WIDGET (text), data->width, -1);
+ }
else if (!msg_data->ellipsize && !msg_data->no_wrap) {
- // the magic number 60 is picked from gtk+/gtk/ui/gtkmessagedialog.ui
- // however, 60 would increase the distance between the icon and the
- // text,
- // decreasing to 10 fix it.
- gtk_label_set_width_chars (GTK_LABEL (text), 10);
- gtk_label_set_max_width_chars (GTK_LABEL (text), 10);
+ /* the magic number 60 is picked from gtk+/gtk/ui/gtkmessagedialog.ui
+ */
+ gtk_label_set_max_width_chars (GTK_LABEL(text), 60);
}
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- if (msg_data->dialog_text) {
- if (msg_data->no_markup)
+ if (msg_data->dialog_text)
+ {
+ if (msg_data->no_markup) {
gtk_label_set_text (GTK_LABEL (text), msg_data->dialog_text);
- else
- gtk_label_set_markup (
- GTK_LABEL (text), g_strcompress (msg_data->dialog_text));
+ }
+ else {
+ gtk_label_set_markup (GTK_LABEL (text),
+ g_strcompress (msg_data->dialog_text));
+ }
zenity_label_widget_clipboard_selection (GTK_WIDGET (text));
}
if (msg_data->ellipsize)
- gtk_label_set_ellipsize (GTK_LABEL (text), PANGO_ALIGN_RIGHT);
+ gtk_label_set_ellipsize (GTK_LABEL (text), PANGO_ELLIPSIZE_END);
if (msg_data->dialog_icon)
gtk_image_set_from_icon_name (
- GTK_IMAGE (image), msg_data->dialog_icon, GTK_ICON_SIZE_DIALOG);
+ GTK_IMAGE (image), msg_data->dialog_icon);
if (msg_data->no_wrap)
- gtk_label_set_line_wrap (GTK_LABEL (text), FALSE);
+ gtk_label_set_wrap (GTK_LABEL(text), FALSE);
- zenity_util_show_dialog (dialog, data->attach);
+ zenity_util_show_dialog (dialog);
if (data->timeout_delay > 0) {
g_timeout_add_seconds (data->timeout_delay,
@@ -242,14 +250,15 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) {
g_object_unref (builder);
- gtk_main ();
+ zenity_util_gapp_main (GTK_WINDOW(dialog));
}
static void
zenity_msg_dialog_response (GtkWidget *widget, int response, gpointer data) {
ZenityData *zen_data = data;
- switch (response) {
+ switch (response)
+ {
case GTK_RESPONSE_OK:
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
break;
@@ -260,10 +269,10 @@ zenity_msg_dialog_response (GtkWidget *widget, int response, gpointer data) {
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label))
printf ("%s\n", zen_data->extra_label[response]);
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- gtk_main_quit ();
+ zenity_util_gapp_quit (GTK_WINDOW(widget));
}
diff --git a/src/notification.c b/src/notification.c
index eb0e79e..a813c1e 100644
--- a/src/notification.c
+++ b/src/notification.c
@@ -1,8 +1,11 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* notification.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
- * Copyright (C) 2006 Christian Persch
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2006 Christian Persch
+ * Copyright © 2021 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -19,7 +22,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
- * Authors: Glynn Foster <glynn.foster@sun.com>
+ * Original Author: Glynn Foster <glynn.foster@sun.com>
*/
#include <config.h>
@@ -41,12 +44,14 @@ static char *icon_file;
static GHashTable *notification_hints;
static NotifyNotification *
-zenity_notification_new (gchar *message, gchar *icon_file) {
+zenity_notification_new (char *message, char *icon_file)
+{
NotifyNotification *notif;
- gchar **text;
+ char **text;
text = g_strsplit (g_strcompress (message), "\n", 2);
- if (*text == NULL) {
+ if (*text == NULL)
+ {
g_printerr (_ ("Could not parse message\n"));
return NULL;
}
@@ -54,36 +59,41 @@ zenity_notification_new (gchar *message, gchar *icon_file) {
notif = notify_notification_new (text[0], /* title */
text[1], /* summary */
icon_file);
+
g_strfreev (text);
+
return notif;
}
static void
-on_notification_default_action (
- NotifyNotification *n, const char *action, void *user_data) {
- ZenityData *zen_data;
+on_notification_default_action (NotifyNotification *n,
+ const char *action, void *user_data)
+{
+ ZenityData *zen_data = user_data;
- zen_data = (ZenityData *) user_data;
notify_notification_close (n, NULL);
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
- gtk_main_quit ();
+ zenity_util_gapp_quit (NULL);
}
static GHashTable *
-zenity_notification_parse_hints_array (gchar **hints) {
+zenity_notification_parse_hints_array (char **hints)
+{
GHashTable *result;
- gchar **pair;
+ char **pair;
int i;
result = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- for (i = 0; i < g_strv_length (hints); i++) {
+ for (i = 0; i < (int)g_strv_length (hints); i++)
+ {
pair = g_strsplit (hints[i], ":", 2);
g_hash_table_replace (result, g_strdup (pair[0]), g_strdup (pair[1]));
g_strfreev (pair);
}
+
if (g_hash_table_size (result) == 0) {
g_hash_table_unref (result);
return NULL;
@@ -93,36 +103,36 @@ zenity_notification_parse_hints_array (gchar **hints) {
}
static GHashTable *
-zenity_notification_parse_hints (gchar *hints) {
+zenity_notification_parse_hints (char *hints)
+{
GHashTable *result;
- gchar **hint_array;
+ char **hint_array;
hint_array = g_strsplit (g_strcompress (hints), "\n", MAX_HINTS);
result = zenity_notification_parse_hints_array (hint_array);
g_strfreev (hint_array);
+
return result;
}
static void
-zenity_notification_set_hint (
- gpointer key, gpointer value, gpointer user_data) {
- NotifyNotification *notification;
- gchar *hint_name;
- GVariant *hint_value;
+zenity_notification_set_hint (gpointer key, gpointer value,
+ gpointer user_data)
+{
+ NotifyNotification *notification = user_data;
+ char *hint_name = key;
+ char *string_value = value;
- gchar *string_value;
+ GVariant *hint_value;
gboolean boolean_value;
gint32 int_value;
guchar byte_value;
- hint_name = (gchar *) key;
- string_value = (gchar *) value;
- notification = (NotifyNotification *) user_data;
-
if ((g_ascii_strcasecmp ("action-icons", hint_name) == 0) ||
(g_ascii_strcasecmp ("resident", hint_name) == 0) ||
(g_ascii_strcasecmp ("suppress-sound", hint_name) == 0) ||
- (g_ascii_strcasecmp ("transient", hint_name) == 0)) {
+ (g_ascii_strcasecmp ("transient", hint_name) == 0))
+ {
/* boolean hints */
if (g_ascii_strcasecmp ("true", string_value) == 0) {
boolean_value = TRUE;
@@ -134,36 +144,46 @@ zenity_notification_set_hint (
return;
}
hint_value = g_variant_new_boolean (boolean_value);
- } else if ((g_ascii_strcasecmp ("category", hint_name) == 0) ||
+ }
+ else if ((g_ascii_strcasecmp ("category", hint_name) == 0) ||
(g_ascii_strcasecmp ("desktop-entry", hint_name) == 0) ||
(g_ascii_strcasecmp ("image-path", hint_name) == 0) ||
(g_ascii_strcasecmp ("image_path", hint_name) == 0) ||
(g_ascii_strcasecmp ("sound-file", hint_name) == 0) ||
- (g_ascii_strcasecmp ("sound-name", hint_name) == 0)) {
+ (g_ascii_strcasecmp ("sound-name", hint_name) == 0))
+ {
/* string hints */
hint_value = g_variant_new_string (string_value);
- } else if ((g_ascii_strcasecmp ("image-data", hint_name) == 0) ||
+ }
+ else if ((g_ascii_strcasecmp ("image-data", hint_name) == 0) ||
(g_ascii_strcasecmp ("image_data", hint_name) == 0) ||
- (g_ascii_strcasecmp ("icon-data", hint_name) == 0)) {
+ (g_ascii_strcasecmp ("icon-data", hint_name) == 0))
+ {
/* (iibiiay) */
g_printerr (_ ("Unsupported hint. Skipping.\n"));
return;
- } else if ((g_ascii_strcasecmp ("x", hint_name) == 0) ||
- (g_ascii_strcasecmp ("y", hint_name) == 0)) {
+ }
+ else if ((g_ascii_strcasecmp ("x", hint_name) == 0) ||
+ (g_ascii_strcasecmp ("y", hint_name) == 0))
+ {
/* int hints */
if (string_value == NULL)
string_value = "";
int_value = (gint32) g_ascii_strtoll (string_value, NULL, 0);
hint_value = g_variant_new_int32 (int_value);
- } else if ((g_ascii_strcasecmp ("urgency", hint_name) == 0)) {
+ }
+ else if ((g_ascii_strcasecmp ("urgency", hint_name) == 0))
+ {
/* byte hints */
if (string_value == NULL)
string_value = "";
byte_value = (guchar) g_ascii_strtoll (string_value, NULL, 0);
hint_value = g_variant_new_byte (byte_value);
- } else {
+ }
+ else
+ {
/* unknown hints */
- g_printerr (_ ("Unknown hint name. Skipping.\n"));
+ g_printerr (_("Unknown hint name. Skipping.\n"));
return;
}
@@ -171,41 +191,49 @@ zenity_notification_set_hint (
}
static void
-zenity_notification_set_hints (
- NotifyNotification *notification, GHashTable *hints) {
- if (hints == NULL) {
+zenity_notification_set_hints (NotifyNotification *notification,
+ GHashTable *hints)
+{
+ if (hints == NULL)
return;
- }
g_hash_table_foreach (hints, zenity_notification_set_hint, notification);
}
static gboolean
-zenity_notification_handle_stdin (
- GIOChannel *channel, GIOCondition condition, gpointer user_data) {
- if ((condition & G_IO_IN) != 0) {
+zenity_notification_handle_stdin (GIOChannel *channel, GIOCondition condition,
+ gpointer user_data)
+{
+ if ((condition & G_IO_IN) != 0)
+ {
GString *string;
GError *error = NULL;
- string = g_string_new (NULL);
while (channel->is_readable == FALSE)
;
+
+ string = g_string_new (NULL);
+
do {
- gint status;
- gchar *command, *value, *colon;
+ int status;
+ char *command, *value, *colon;
do {
- status = g_io_channel_read_line_string (
- channel, string, NULL, &error);
- while (gdk_events_pending ())
- gtk_main_iteration ();
+ status = g_io_channel_read_line_string (channel, string,
+ NULL, &error);
+
+ while (g_main_context_pending (NULL)) {
+ g_main_context_iteration (NULL, FALSE);
+ }
} while (status == G_IO_STATUS_AGAIN);
- if (status != G_IO_STATUS_NORMAL) {
+ if (status != G_IO_STATUS_NORMAL)
+ {
if (error) {
- g_warning ("zenity_notification_handle_stdin () : %s",
- error->message);
+ g_warning ("%s: %s",
+ __func__,
+ error->message);
g_error_free (error);
error = NULL;
}
@@ -214,10 +242,12 @@ zenity_notification_handle_stdin (
zenity_util_strip_newline (string->str);
colon = strchr (string->str, ':');
- if (colon == NULL) {
- g_printerr (_ ("Could not parse command from stdin\n"));
+ if (colon == NULL)
+ {
+ g_printerr (_("Could not parse command from stdin\n"));
continue;
}
+
/* split off the command and value */
command = g_strstrip (g_strndup (string->str, colon - string->str));
@@ -225,19 +255,27 @@ zenity_notification_handle_stdin (
while (*value && g_ascii_isspace (*value))
value++;
- if (!g_ascii_strcasecmp (command, "icon")) {
+ if (! g_ascii_strcasecmp (command, "icon"))
+ {
g_free (icon_file);
icon_file = g_strdup (value);
- } else if (!g_ascii_strcasecmp (command, "hints")) {
+ }
+ else if (!g_ascii_strcasecmp (command, "hints"))
+ {
if (notification_hints != NULL) {
g_hash_table_unref (notification_hints);
}
notification_hints = zenity_notification_parse_hints (value);
- } else if (!g_ascii_strcasecmp (command, "message")) {
+ }
+ else if (!g_ascii_strcasecmp (command, "message"))
+ {
/* display a notification bubble */
- if (!g_utf8_validate (value, -1, NULL)) {
+ if (! g_utf8_validate (value, -1, NULL))
+ {
g_warning ("Invalid UTF-8 in input!");
- } else {
+ }
+ else
+ {
NotifyNotification *notif;
error = NULL;
@@ -257,37 +295,51 @@ zenity_notification_handle_stdin (
g_object_unref (notif);
}
- } else if (!g_ascii_strcasecmp (command, "tooltip")) {
- if (!g_utf8_validate (value, -1, NULL)) {
+ }
+ else if (! g_ascii_strcasecmp (command, "tooltip"))
+ {
+ if (! g_utf8_validate (value, -1, NULL))
+ {
g_warning ("Invalid UTF-8 in input!");
- } else {
- NotifyNotification *notif;
- notif = zenity_notification_new (value, icon_file);
+ }
+ else
+ {
+ NotifyNotification *notif =
+ zenity_notification_new (value, icon_file);
+
if (notif == NULL)
continue;
zenity_notification_set_hints (notif, notification_hints);
notify_notification_show (notif, &error);
- if (error) {
- g_warning (
- "Error showing notification: %s", error->message);
+ if (error)
+ {
+ g_warning ("Error showing notification: %s",
+ error->message);
g_error_free (error);
+
error = NULL;
}
}
- } else if (!g_ascii_strcasecmp (command, "visible")) {
+ }
+ else if (!g_ascii_strcasecmp (command, "visible"))
+ {
- } else {
+ }
+ else
+ {
g_warning ("Unknown command '%s'", command);
}
g_free (command);
} while (g_io_channel_get_buffer_condition (channel) == G_IO_IN);
+
g_string_free (string, TRUE);
}
- if ((condition & G_IO_HUP) != 0) {
+ if ((condition & G_IO_HUP) != 0)
+ {
g_io_channel_shutdown (channel, TRUE, NULL);
return FALSE;
}
@@ -296,19 +348,23 @@ zenity_notification_handle_stdin (
}
static void
-zenity_notification_listen_on_stdin (ZenityData *data) {
+zenity_notification_listen_on_stdin (ZenityData *data)
+{
GIOChannel *channel;
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_notification_handle_stdin, data);
+ g_io_add_watch (channel,
+ G_IO_IN | G_IO_HUP,
+ zenity_notification_handle_stdin,
+ data);
}
void
-zenity_notification (
- ZenityData *data, ZenityNotificationData *notification_data) {
+zenity_notification (ZenityData *data,
+ ZenityNotificationData *notification_data)
+{
GError *error;
NotifyNotification *notification;
GHashTable *notification_hints;
@@ -318,20 +374,23 @@ zenity_notification (
notify_init (_ ("Zenity notification"));
}
- if (notification_data->listen) {
+ if (notification_data->listen)
+ {
zenity_notification_listen_on_stdin (data);
- gtk_main ();
- } else {
- if (notification_data->notification_text == NULL) {
+
+ zenity_util_gapp_main (NULL);
+ }
+ else
+ {
+ if (notification_data->notification_text == NULL)
exit (1);
- }
- notification = zenity_notification_new (
- notification_data->notification_text, data->window_icon);
+ notification =
+ zenity_notification_new (notification_data->notification_text,
+ notification_data->icon);
- if (notification == NULL) {
+ if (notification == NULL)
exit (1);
- }
/* if we aren't listening for changes, then close on default action */
notify_notification_add_action (notification,
@@ -342,16 +401,20 @@ zenity_notification (
NULL);
/* set the notification hints for the displayed notification */
- if (notification_data->notification_hints != NULL) {
+ if (notification_data->notification_hints != NULL)
+ {
notification_hints = zenity_notification_parse_hints_array (
notification_data->notification_hints);
+
zenity_notification_set_hints (notification, notification_hints);
+
g_hash_table_unref (notification_hints);
}
/* Show icon and wait */
error = NULL;
- if (!notify_notification_show (notification, &error)) {
+ if (! notify_notification_show (notification, &error))
+ {
if (error != NULL) {
g_warning ("Error showing notification: %s", error->message);
g_error_free (error);
@@ -364,7 +427,8 @@ zenity_notification (
g_timeout_add_seconds (data->timeout_delay,
(GSourceFunc) zenity_util_timeout_handle,
NULL);
- gtk_main ();
+
+ zenity_util_gapp_main (NULL);
}
}
diff --git a/src/option.c b/src/option.c
index 61df34d..087c15e 100644
--- a/src/option.c
+++ b/src/option.c
@@ -1,3 +1,5 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* option.h
*
@@ -22,32 +24,32 @@
* Lucas Rocha <lucasr@im.ufba.br>
*/
-#include "config.h"
-
#include "option.h"
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <locale.h>
+#include <langinfo.h>
+
+#include <config.h>
/* General Options */
-static gchar *zenity_general_dialog_title;
-static gchar *zenity_general_window_icon;
+static char *zenity_general_dialog_title;
static int zenity_general_width;
static int zenity_general_height;
-static gchar *zenity_general_dialog_text;
-static gchar *zenity_general_dialog_icon;
-static gchar *zenity_general_separator;
+static char *zenity_general_dialog_text;
+static char *zenity_general_dialog_icon;
+static char *zenity_general_separator;
static gboolean zenity_general_multiple;
static gboolean zenity_general_editable;
-static gchar *zenity_general_uri;
+static char *zenity_general_uri;
static gboolean zenity_general_dialog_no_wrap;
static gboolean zenity_general_dialog_no_markup;
-static gint zenity_general_timeout_delay;
-static gchar *zenity_general_ok_button;
-static gchar *zenity_general_cancel_button;
-static gchar **zenity_general_extra_buttons;
+static int zenity_general_timeout_delay;
+static char *zenity_general_ok_button;
+static char *zenity_general_cancel_button;
+static char **zenity_general_extra_buttons;
static gboolean zenity_general_modal;
-static guintptr zenity_general_attach;
static gboolean zenity_general_dialog_ellipsize;
/* Calendar Dialog Options */
@@ -55,11 +57,11 @@ static gboolean zenity_calendar_active;
static int zenity_calendar_day;
static int zenity_calendar_month;
static int zenity_calendar_year;
-static gchar *zenity_calendar_date_format;
+static char *zenity_calendar_date_format;
/* Entry Dialog Options */
static gboolean zenity_entry_active;
-static gchar *zenity_entry_entry_text;
+static char *zenity_entry_entry_text;
static gboolean zenity_entry_hide_text;
/* Error Dialog Options */
@@ -72,16 +74,15 @@ static gboolean zenity_info_active;
static gboolean zenity_file_active;
static gboolean zenity_file_directory;
static gboolean zenity_file_save;
-static gboolean zenity_file_confirm_overwrite;
-static gchar **zenity_file_filter;
+static char **zenity_file_filter;
/* List Dialog Options */
static gboolean zenity_list_active;
-static gchar **zenity_list_columns;
+static char **zenity_list_columns;
static gboolean zenity_list_checklist;
static gboolean zenity_list_radiolist;
-static gchar *zenity_list_print_column;
-static gchar *zenity_list_hide_column;
+static char *zenity_list_print_column;
+static char *zenity_list_hide_column;
static gboolean zenity_list_hide_header;
static gboolean zenity_list_imagelist;
static gboolean zenity_list_mid_search;
@@ -90,7 +91,8 @@ static gboolean zenity_list_mid_search;
/* Notification Dialog Options */
static gboolean zenity_notification_active;
static gboolean zenity_notification_listen;
-static gchar **zenity_notification_hints;
+static char *zenity_notification_icon;
+static char **zenity_notification_hints;
#endif
/* Progress Dialog Options */
@@ -109,14 +111,14 @@ static gboolean zenity_question_switch;
/* Text Dialog Options */
static gboolean zenity_text_active;
-static gchar *zenity_text_font;
-static gchar *zenity_text_checkbox;
+static char *zenity_text_font;
+static char *zenity_text_checkbox;
static gboolean zenity_text_auto_scroll;
#ifdef HAVE_WEBKITGTK
static gboolean zenity_text_enable_html;
static gboolean zenity_text_no_interaction;
-static gchar *zenity_text_url;
+static char *zenity_text_url;
#endif
/* Warning Dialog Options */
@@ -124,16 +126,16 @@ static gboolean zenity_warning_active;
/* Scale Dialog Options */
static gboolean zenity_scale_active;
-static gint zenity_scale_value;
-static gint zenity_scale_min_value;
-static gint zenity_scale_max_value;
-static gint zenity_scale_step;
+static int zenity_scale_value;
+static int zenity_scale_min_value;
+static int zenity_scale_max_value;
+static int zenity_scale_step;
static gboolean zenity_scale_print_partial;
static gboolean zenity_scale_hide_value;
/* Color Selection Dialog Options */
static gboolean zenity_colorsel_active;
-static gchar *zenity_colorsel_color;
+static char *zenity_colorsel_color;
static gboolean zenity_colorsel_show_palette;
/* Password Dialog Options */
@@ -143,251 +145,247 @@ static gboolean zenity_password_show_username;
/* Forms Dialog Options */
static gboolean zenity_forms_active;
static gboolean zenity_forms_show_header;
-static gchar *zenity_forms_date_format;
-// static gchar *zenity_forms_hide_column;
-static gchar **zenity_forms_list_values;
-static gchar **zenity_forms_column_values;
-static gchar **zenity_forms_combo_values;
+static char *zenity_forms_date_format;
+static char **zenity_forms_list_values;
+static char **zenity_forms_column_values;
+static char **zenity_forms_combo_values;
/* Miscelaneus Options */
static gboolean zenity_misc_about;
static gboolean zenity_misc_version;
-static gboolean zenity_forms_callback (const gchar *option_name,
- const gchar *value, gpointer data, GError **error);
-
-static GOptionEntry general_options[] = {{"title",
- '\0',
- 0,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_title,
- N_ ("Set the dialog title"),
- N_ ("TITLE")},
- {"window-icon",
- '\0',
- 0,
- G_OPTION_ARG_FILENAME,
- &zenity_general_window_icon,
- N_ ("Set the window icon"),
- N_ ("ICONPATH")},
- {"width",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_general_width,
- N_ ("Set the width"),
- N_ ("WIDTH")},
- {"height",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_general_height,
- N_ ("Set the height"),
- N_ ("HEIGHT")},
- {"timeout",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_general_timeout_delay,
- N_ ("Set dialog timeout in seconds"),
- /* Timeout for closing the dialog */
- N_ ("TIMEOUT")},
- {"ok-label",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_ok_button,
- N_ ("Set the label of the OK button"),
- N_ ("TEXT")},
- {"cancel-label",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_cancel_button,
- N_ ("Set the label of the Cancel button"),
- N_ ("TEXT")},
- {"extra-button",
- '\0',
- 0,
- G_OPTION_ARG_STRING_ARRAY,
- &zenity_general_extra_buttons,
- N_ ("Add an extra button"),
- N_ ("TEXT")},
- {"modal",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_modal,
- N_ ("Set the modal hint"),
- NULL},
- {"attach",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_INT,
- &zenity_general_attach,
- N_ ("Set the parent window to attach to"),
- N_ ("WINDOW")},
- {NULL}};
-
-static GOptionEntry calendar_options[] = {{"calendar",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_calendar_active,
- N_ ("Display calendar dialog"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the dialog text"),
- N_ ("TEXT")},
- {"day",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_calendar_day,
- N_ ("Set the calendar day"),
- N_ ("DAY")},
- {"month",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_calendar_month,
- N_ ("Set the calendar month"),
- N_ ("MONTH")},
- {"year",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_calendar_year,
- N_ ("Set the calendar year"),
- N_ ("YEAR")},
- {"date-format",
- '\0',
- 0,
- G_OPTION_ARG_STRING,
- &zenity_calendar_date_format,
- N_ ("Set the format for the returned date"),
- N_ ("PATTERN")},
- {NULL}};
+static gboolean zenity_forms_callback (const char *option_name,
+ const char *value, gpointer data, GError **error);
+
+static GOptionEntry general_options[] =
+ {{"title",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_title,
+ N_ ("Set the dialog title"),
+ N_ ("TITLE")},
+ {"width",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_general_width,
+ N_ ("Set the width"),
+ N_ ("WIDTH")},
+ {"height",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_general_height,
+ N_ ("Set the height"),
+ N_ ("HEIGHT")},
+ {"timeout",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_general_timeout_delay,
+ N_ ("Set dialog timeout in seconds"),
+ /* Timeout for closing the dialog */
+ N_ ("TIMEOUT")},
+ {"ok-label",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_ok_button,
+ N_ ("Set the label of the OK button"),
+ N_ ("TEXT")},
+ {"cancel-label",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_cancel_button,
+ N_ ("Set the label of the Cancel button"),
+ N_ ("TEXT")},
+ {"extra-button",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING_ARRAY,
+ &zenity_general_extra_buttons,
+ N_ ("Add an extra button"),
+ N_ ("TEXT")},
+ {"modal",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_modal,
+ N_ ("Set the modal hint"),
+ NULL},
+ {NULL}};
-static GOptionEntry entry_options[] = {{"entry",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_entry_active,
- N_ ("Display text entry dialog"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the dialog text"),
- N_ ("TEXT")},
- {"entry-text",
- '\0',
- 0,
- G_OPTION_ARG_STRING,
- &zenity_entry_entry_text,
- N_ ("Set the entry text"),
- N_ ("TEXT")},
- {"hide-text",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_entry_hide_text,
- N_ ("Hide the entry text"),
- NULL},
- {NULL}};
+static GOptionEntry calendar_options[] =
+ {{"calendar",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_calendar_active,
+ N_ ("Display calendar dialog"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the dialog text"),
+ N_ ("TEXT")},
+ {"day",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_calendar_day,
+ N_ ("Set the calendar day"),
+ N_ ("DAY")},
+ {"month",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_calendar_month,
+ N_ ("Set the calendar month"),
+ N_ ("MONTH")},
+ {"year",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_calendar_year,
+ N_ ("Set the calendar year"),
+ N_ ("YEAR")},
+ {"date-format",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING,
+ &zenity_calendar_date_format,
+ N_ ("Set the format for the returned date"),
+ N_ ("PATTERN")},
+ {NULL}};
-static GOptionEntry error_options[] = {{"error",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_error_active,
- N_ ("Display error dialog"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the dialog text"),
- N_ ("TEXT")},
- {"icon-name",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_icon,
- N_ ("Set the dialog icon"),
- N_ ("ICON-NAME")},
- {"no-wrap",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_no_wrap,
- N_ ("Do not enable text wrapping"),
- NULL},
- {"no-markup",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_no_markup,
- N_ ("Do not enable Pango markup")},
- {"ellipsize",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_ellipsize,
- N_ ("Enable ellipsizing in the dialog text. This fixes the high window "
- "size with long texts")},
- {NULL}};
+static GOptionEntry entry_options[] =
+ {{"entry",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_entry_active,
+ N_ ("Display text entry dialog"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the dialog text"),
+ N_ ("TEXT")},
+ {"entry-text",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING,
+ &zenity_entry_entry_text,
+ N_ ("Set the entry text"),
+ N_ ("TEXT")},
+ {"hide-text",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_entry_hide_text,
+ N_ ("Hide the entry text"),
+ NULL},
+ {NULL}};
-static GOptionEntry info_options[] = {{"info",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_info_active,
- N_ ("Display info dialog"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the dialog text"),
- N_ ("TEXT")},
- {"icon-name",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_icon,
- N_ ("Set the dialog icon"),
- N_ ("ICON-NAME")},
- {"no-wrap",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_no_wrap,
- N_ ("Do not enable text wrapping"),
- NULL},
- {"no-markup",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_no_markup,
- N_ ("Do not enable Pango markup")},
- {"ellipsize",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_ellipsize,
- N_ ("Enable ellipsizing in the dialog text. This fixes the high window "
- "size with long texts")},
- {NULL}};
+static GOptionEntry error_options[] =
+ {{"error",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_error_active,
+ N_ ("Display error dialog"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the dialog text"),
+ N_ ("TEXT")},
+ {"icon-name",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_icon,
+ N_ ("Set the dialog icon"),
+ N_ ("ICON-NAME")},
+ {"no-wrap",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_no_wrap,
+ N_ ("Do not enable text wrapping"),
+ NULL},
+ {"no-markup",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_no_markup,
+ N_ ("Do not enable Pango markup"),
+ NULL},
+ {"ellipsize",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_ellipsize,
+ N_ ("Enable ellipsizing in the dialog text. "
+ "This fixes the high window "
+ "size with long texts"),
+ NULL},
+ {NULL}};
+
+static GOptionEntry info_options[] =
+ {{"info",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_info_active,
+ N_ ("Display info dialog"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the dialog text"),
+ N_ ("TEXT")},
+ {"icon-name",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_icon,
+ N_ ("Set the dialog icon"),
+ N_ ("ICON-NAME")},
+ {"no-wrap",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_no_wrap,
+ N_ ("Do not enable text wrapping"),
+ NULL},
+ {"no-markup",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_no_markup,
+ N_ ("Do not enable Pango markup"),
+ NULL},
+ {"ellipsize",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_ellipsize,
+ N_ ("Enable ellipsizing in the dialog text. "
+ "This fixes the high window "
+ "size with long texts"),
+ NULL},
+ {NULL}};
static GOptionEntry file_selection_options[] =
{{"file-selection",
@@ -432,15 +430,7 @@ static GOptionEntry file_selection_options[] =
&zenity_general_separator,
N_ ("Set output separator character"),
N_ ("SEPARATOR")},
- {"confirm-overwrite",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_file_confirm_overwrite,
- N_ ("Confirm file selection if filename already exists"),
- NULL},
- {
- "file-filter",
+ {"file-filter",
'\0',
0,
G_OPTION_ARG_STRING_ARRAY,
@@ -452,255 +442,268 @@ static GOptionEntry file_selection_options[] =
},
{NULL}};
-static GOptionEntry list_options[] = {{"list",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_list_active,
- N_ ("Display list dialog"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the dialog text"),
- N_ ("TEXT")},
- {"column",
- '\0',
- 0,
- G_OPTION_ARG_STRING_ARRAY,
- &zenity_list_columns,
- N_ ("Set the column header"),
- N_ ("COLUMN")},
- {"checklist",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_list_checklist,
- N_ ("Use check boxes for the first column"),
- NULL},
- {"radiolist",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_list_radiolist,
- N_ ("Use radio buttons for the first column"),
- NULL},
- {"imagelist",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_list_imagelist,
- N_ ("Use an image for the first column"),
- NULL},
- {"separator",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_separator,
- N_ ("Set output separator character"),
- N_ ("SEPARATOR")},
- {"multiple",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_multiple,
- N_ ("Allow multiple rows to be selected"),
- NULL},
- {"editable",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_editable,
- N_ ("Allow changes to text"),
- NULL},
- {"print-column",
- '\0',
- 0,
- G_OPTION_ARG_STRING,
- &zenity_list_print_column,
- N_ ("Print a specific column (Default is 1. 'ALL' can be used to print "
- "all columns)"),
- /* Column index number to print out on a list dialog */
- N_ ("NUMBER")},
- {"hide-column",
- '\0',
- 0,
- G_OPTION_ARG_STRING,
- &zenity_list_hide_column,
- N_ ("Hide a specific column"),
- N_ ("NUMBER")},
- {"hide-header",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_list_hide_header,
- N_ ("Hide the column headers"),
- NULL},
- {"mid-search",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_list_mid_search,
- N_ ("Change list default search function searching for text in the "
- "middle, not on the beginning"),
- NULL},
- {NULL}};
+static GOptionEntry list_options[] =
+ {{"list",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_list_active,
+ N_ ("Display list dialog"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the dialog text"),
+ N_ ("TEXT")},
+ {"column",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING_ARRAY,
+ &zenity_list_columns,
+ N_ ("Set the column header"),
+ N_ ("COLUMN")},
+ {"checklist",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_list_checklist,
+ N_ ("Use check boxes for the first column"),
+ NULL},
+ {"radiolist",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_list_radiolist,
+ N_ ("Use radio buttons for the first column"),
+ NULL},
+ {"imagelist",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_list_imagelist,
+ N_ ("Use an image for the first column"),
+ NULL},
+ {"separator",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_separator,
+ N_ ("Set output separator character"),
+ N_ ("SEPARATOR")},
+ {"multiple",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_multiple,
+ N_ ("Allow multiple rows to be selected"),
+ NULL},
+ {"editable",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_editable,
+ N_ ("Allow changes to text"),
+ NULL},
+ {"print-column",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING,
+ &zenity_list_print_column,
+ N_ ("Print a specific column (Default is 1. "
+ "'ALL' can be used to print all columns)"),
+ /* Column index number to print out on a list dialog */
+ N_ ("NUMBER")},
+ {"hide-column",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING,
+ &zenity_list_hide_column,
+ N_ ("Hide a specific column"),
+ N_ ("NUMBER")},
+ {"hide-header",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_list_hide_header,
+ N_ ("Hide the column headers"),
+ NULL},
+ {"mid-search",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_list_mid_search,
+ N_ ("Change list default search function searching for text in the "
+ "middle, not on the beginning"),
+ NULL},
+ {NULL}};
#ifdef HAVE_LIBNOTIFY
-static GOptionEntry notification_options[] = {{"notification",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_notification_active,
- N_ ("Display notification"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the notification text"),
- N_ ("TEXT")},
- {"listen",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_notification_listen,
- N_ ("Listen for commands on stdin"),
- NULL},
- {"hint",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING_ARRAY,
- &zenity_notification_hints,
- N_ ("Set the notification hints"),
- N_ ("TEXT")},
- {NULL}};
+static GOptionEntry notification_options[] =
+ {{"notification",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_notification_active,
+ N_ ("Display notification"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the notification text"),
+ N_ ("TEXT")},
+ {"icon",
+ '\0',
+ 0,
+ G_OPTION_ARG_FILENAME,
+ &zenity_notification_icon,
+ N_ ("Set the notification icon"),
+ N_ ("ICONPATH")},
+ {"listen",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_notification_listen,
+ N_ ("Listen for commands on stdin"),
+ NULL},
+ {"hint",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING_ARRAY,
+ &zenity_notification_hints,
+ N_ ("Set the notification hints"),
+ N_ ("TEXT")},
+ {NULL}};
#endif
-static GOptionEntry progress_options[] = {
- {"progress",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_progress_active,
- N_ ("Display progress indication dialog"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the dialog text"),
- N_ ("TEXT")},
- {"percentage",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_progress_percentage,
- N_ ("Set initial percentage"),
- N_ ("PERCENTAGE")},
- {"pulsate",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_progress_pulsate,
- N_ ("Pulsate progress bar"),
- NULL},
- {"auto-close",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_progress_auto_close,
- /* xgettext: no-c-format */
- N_ ("Dismiss the dialog when 100% has been reached"),
- NULL},
- {"auto-kill",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_progress_auto_kill,
- N_ ("Kill parent process if Cancel button is pressed"),
- NULL},
- {"no-cancel",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_progress_no_cancel,
- N_ ("Hide Cancel button"),
- NULL},
- {"time-remaining",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_progress_time_remaining,
- /* xgettext: no-c-format */
- N_ ("Estimate when progress will reach 100%"),
- NULL},
- {NULL}};
-
-static GOptionEntry question_options[] = {{"question",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_question_active,
- N_ ("Display question dialog"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the dialog text"),
- N_ ("TEXT")},
- {"icon-name",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_icon,
- N_ ("Set the dialog icon"),
- N_ ("ICON-NAME")},
- {"no-wrap",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_no_wrap,
- N_ ("Do not enable text wrapping"),
- NULL},
- {"no-markup",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_no_markup,
- N_ ("Do not enable Pango markup")},
- {"default-cancel",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_question_default_cancel,
- N_ ("Give Cancel button focus by default"),
- NULL},
- {"ellipsize",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_ellipsize,
- N_ ("Enable ellipsizing in the dialog text. This fixes the high window "
- "size with long texts")},
- {"switch",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_question_switch,
- N_ ("Suppress OK and Cancel buttons"),
- NULL},
- {NULL}};
+static GOptionEntry progress_options[] =
+ {{"progress",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_progress_active,
+ N_ ("Display progress indication dialog"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the dialog text"),
+ N_ ("TEXT")},
+ {"percentage",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_progress_percentage,
+ N_ ("Set initial percentage"),
+ N_ ("PERCENTAGE")},
+ {"pulsate",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_progress_pulsate,
+ N_ ("Pulsate progress bar"),
+ NULL},
+ {"auto-close",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_progress_auto_close,
+ /* xgettext: no-c-format */
+ N_ ("Dismiss the dialog when 100% has been reached"),
+ NULL},
+ {"auto-kill",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_progress_auto_kill,
+ N_ ("Kill parent process if Cancel button is pressed"),
+ NULL},
+ {"no-cancel",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_progress_no_cancel,
+ N_ ("Hide Cancel button"),
+ NULL},
+ {"time-remaining",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_progress_time_remaining,
+ /* xgettext: no-c-format */
+ N_ ("Estimate when progress will reach 100%"),
+ NULL},
+ {NULL}};
-static GOptionEntry text_options[] = {
- {"text-info",
+static GOptionEntry question_options[] =
+ {{"question",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_question_active,
+ N_ ("Display question dialog"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the dialog text"),
+ N_ ("TEXT")},
+ {"icon-name",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_icon,
+ N_ ("Set the dialog icon"),
+ N_ ("ICON-NAME")},
+ {"no-wrap",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_no_wrap,
+ N_ ("Do not enable text wrapping"),
+ NULL},
+ {"no-markup",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_no_markup,
+ N_ ("Do not enable Pango markup"),
+ NULL},
+ {"default-cancel",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_question_default_cancel,
+ N_ ("Give Cancel button focus by default"),
+ NULL},
+ {"ellipsize",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_ellipsize,
+ N_ ("Enable ellipsizing in the dialog text. "
+ "This fixes the high window "
+ "size with long texts"),
+ NULL},
+ {"switch",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_question_switch,
+ N_ ("Suppress OK and Cancel buttons"),
+ NULL},
+ {NULL}};
+
+static GOptionEntry text_options[] =
+ {{"text-info",
'\0',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_NONE,
@@ -770,212 +773,218 @@ static GOptionEntry text_options[] = {
NULL},
{NULL}};
-static GOptionEntry warning_options[] = {{"warning",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_warning_active,
- N_ ("Display warning dialog"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the dialog text"),
- N_ ("TEXT")},
- {"icon-name",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_icon,
- N_ ("Set the dialog icon"),
- N_ ("ICON-NAME")},
- {"no-wrap",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_no_wrap,
- N_ ("Do not enable text wrapping"),
- NULL},
- {"no-markup",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_no_markup,
- N_ ("Do not enable Pango markup")},
- {"ellipsize",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_NONE,
- &zenity_general_dialog_ellipsize,
- N_ ("Enable ellipsizing in the dialog text. This fixes the high window "
- "size with long texts")},
- {NULL}};
-
-static GOptionEntry scale_options[] = {{"scale",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_scale_active,
- N_ ("Display scale dialog"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the dialog text"),
- N_ ("TEXT")},
- {"value",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_scale_value,
- N_ ("Set initial value"),
- N_ ("VALUE")},
- {"min-value",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_scale_min_value,
- N_ ("Set minimum value"),
- N_ ("VALUE")},
- {"max-value",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_scale_max_value,
- N_ ("Set maximum value"),
- N_ ("VALUE")},
- {"step",
- '\0',
- 0,
- G_OPTION_ARG_INT,
- &zenity_scale_step,
- N_ ("Set step size"),
- N_ ("VALUE")},
- {"print-partial",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_scale_print_partial,
- N_ ("Print partial values"),
- NULL},
- {"hide-value",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_scale_hide_value,
- N_ ("Hide value"),
- NULL},
- {NULL}};
+static GOptionEntry warning_options[] =
+ {{"warning",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_warning_active,
+ N_ ("Display warning dialog"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the dialog text"),
+ N_ ("TEXT")},
+ {"icon-name",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_icon,
+ N_ ("Set the dialog icon"),
+ N_ ("ICON-NAME")},
+ {"no-wrap",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_no_wrap,
+ N_ ("Do not enable text wrapping"),
+ NULL},
+ {"no-markup",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_no_markup,
+ N_ ("Do not enable Pango markup"),
+ NULL},
+ {"ellipsize",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_dialog_ellipsize,
+ N_ ("Enable ellipsizing in the dialog text. "
+ "This fixes the high window "
+ "size with long texts"),
+ NULL},
+ {NULL}};
+
+static GOptionEntry scale_options[] =
+ {{"scale",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_scale_active,
+ N_ ("Display scale dialog"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the dialog text"),
+ N_ ("TEXT")},
+ {"value",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_scale_value,
+ N_ ("Set initial value"),
+ N_ ("VALUE")},
+ {"min-value",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_scale_min_value,
+ N_ ("Set minimum value"),
+ N_ ("VALUE")},
+ {"max-value",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_scale_max_value,
+ N_ ("Set maximum value"),
+ N_ ("VALUE")},
+ {"step",
+ '\0',
+ 0,
+ G_OPTION_ARG_INT,
+ &zenity_scale_step,
+ N_ ("Set step size"),
+ N_ ("VALUE")},
+ {"print-partial",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_scale_print_partial,
+ N_ ("Print partial values"),
+ NULL},
+ {"hide-value",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_scale_hide_value,
+ N_ ("Hide value"),
+ NULL},
+ {NULL}};
-static GOptionEntry forms_dialog_options[] = {{"forms",
- '\0',
- G_OPTION_FLAG_IN_MAIN,
- G_OPTION_ARG_NONE,
- &zenity_forms_active,
- N_ ("Display forms dialog"),
- NULL},
- {"add-entry",
- '\0',
- 0,
- G_OPTION_ARG_CALLBACK,
- zenity_forms_callback,
- N_ ("Add a new Entry in forms dialog"),
- N_ ("Field name")},
- {"add-password",
- '\0',
- 0,
- G_OPTION_ARG_CALLBACK,
- zenity_forms_callback,
- N_ ("Add a new Password Entry in forms dialog"),
- N_ ("Field name")},
- {"add-calendar",
- '\0',
- 0,
- G_OPTION_ARG_CALLBACK,
- zenity_forms_callback,
- N_ ("Add a new Calendar in forms dialog"),
- N_ ("Calendar field name")},
- {"add-list",
- '\0',
- 0,
- G_OPTION_ARG_CALLBACK,
- zenity_forms_callback,
- N_ ("Add a new List in forms dialog"),
- N_ ("List field and header name")},
- {"list-values",
- '\0',
- 0,
- G_OPTION_ARG_STRING_ARRAY,
- &zenity_forms_list_values,
- N_ ("List of values for List"),
- N_ ("List of values separated by |")},
- {"column-values",
- '\0',
- 0,
- G_OPTION_ARG_STRING_ARRAY,
- &zenity_forms_column_values,
- N_ ("List of values for columns"),
- N_ ("List of values separated by |")},
- {"add-combo",
- '\0',
- 0,
- G_OPTION_ARG_CALLBACK,
- zenity_forms_callback,
- N_ ("Add a new combo box in forms dialog"),
- N_ ("Combo box field name")},
- {"combo-values",
- '\0',
- 0,
- G_OPTION_ARG_STRING_ARRAY,
- &zenity_forms_combo_values,
- N_ ("List of values for combo box"),
- N_ ("List of values separated by |")},
- /* TODO: Implement how to hide specifc column
- {
- "hide-column",
- '\0',
- 0,
- G_OPTION_ARG_STRING,
- &zenity_forms_hide_column,
- N_("Hide a specific column"),
- N_("NUMBER")
- },*/
- {"show-header",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_forms_show_header,
- N_ ("Show the columns header"),
- NULL},
- {"text",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_dialog_text,
- N_ ("Set the dialog text"),
- N_ ("TEXT")},
- {"separator",
- '\0',
- G_OPTION_FLAG_NOALIAS,
- G_OPTION_ARG_STRING,
- &zenity_general_separator,
- N_ ("Set output separator character"),
- N_ ("SEPARATOR")},
- {"date-format",
- '\0',
- 0,
- G_OPTION_ARG_STRING,
- &zenity_forms_date_format,
- N_ ("Set the format for the returned date"),
- N_ ("PATTERN")},
- {NULL}};
+static GOptionEntry forms_dialog_options[] =
+ {{"forms",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_forms_active,
+ N_ ("Display forms dialog"),
+ NULL},
+ {"add-entry",
+ '\0',
+ 0,
+ G_OPTION_ARG_CALLBACK,
+ zenity_forms_callback,
+ N_ ("Add a new Entry in forms dialog"),
+ N_ ("Field name")},
+ {"add-password",
+ '\0',
+ 0,
+ G_OPTION_ARG_CALLBACK,
+ zenity_forms_callback,
+ N_ ("Add a new Password Entry in forms dialog"),
+ N_ ("Field name")},
+ {"add-calendar",
+ '\0',
+ 0,
+ G_OPTION_ARG_CALLBACK,
+ zenity_forms_callback,
+ N_ ("Add a new Calendar in forms dialog"),
+ N_ ("Calendar field name")},
+ {"add-list",
+ '\0',
+ 0,
+ G_OPTION_ARG_CALLBACK,
+ zenity_forms_callback,
+ N_ ("Add a new List in forms dialog"),
+ N_ ("List field and header name")},
+ {"list-values",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING_ARRAY,
+ &zenity_forms_list_values,
+ N_ ("List of values for List"),
+ N_ ("List of values separated by |")},
+ {"column-values",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING_ARRAY,
+ &zenity_forms_column_values,
+ N_ ("List of values for columns"),
+ N_ ("List of values separated by |")},
+ {"add-combo",
+ '\0',
+ 0,
+ G_OPTION_ARG_CALLBACK,
+ zenity_forms_callback,
+ N_ ("Add a new combo box in forms dialog"),
+ N_ ("Combo box field name")},
+ {"combo-values",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING_ARRAY,
+ &zenity_forms_combo_values,
+ N_ ("List of values for combo box"),
+ N_ ("List of values separated by |")},
+ /* TODO: Implement how to hide specifc column
+ {
+ "hide-column",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING,
+ &zenity_forms_hide_column,
+ N_("Hide a specific column"),
+ N_("NUMBER")
+ },*/
+ {"show-header",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_forms_show_header,
+ N_ ("Show the columns header"),
+ NULL},
+ {"text",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_dialog_text,
+ N_ ("Set the dialog text"),
+ N_ ("TEXT")},
+ {"separator",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_general_separator,
+ N_ ("Set output separator character"),
+ N_ ("SEPARATOR")},
+ {"date-format",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING,
+ &zenity_forms_date_format,
+ N_ ("Set the format for the returned date"),
+ N_ ("PATTERN")},
+ {NULL}};
-static GOptionEntry password_dialog_options[] = {
- {"password",
+static GOptionEntry password_dialog_options[] =
+ {{"password",
'\0',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_NONE,
@@ -991,8 +1000,8 @@ static GOptionEntry password_dialog_options[] = {
NULL},
{NULL}};
-static GOptionEntry color_selection_options[] = {
- {"color-selection",
+static GOptionEntry color_selection_options[] =
+ {{"color-selection",
'\0',
G_OPTION_FLAG_IN_MAIN,
G_OPTION_ARG_NONE,
@@ -1015,28 +1024,29 @@ static GOptionEntry color_selection_options[] = {
NULL},
{NULL}};
-static GOptionEntry miscellaneous_options[] = {{"about",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_misc_about,
- N_ ("About zenity"),
- NULL},
- {"version",
- '\0',
- 0,
- G_OPTION_ARG_NONE,
- &zenity_misc_version,
- N_ ("Print version"),
- NULL},
- {NULL}};
+static GOptionEntry miscellaneous_options[] =
+ {{"about",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_misc_about,
+ N_ ("About zenity"),
+ NULL},
+ {"version",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_misc_version,
+ N_ ("Print version"),
+ NULL},
+ {NULL}};
static ZenityParsingOptions *results;
static GOptionContext *ctx;
static void
-zenity_option_init (void) {
-
+zenity_option_init (void)
+{
results = g_new0 (ZenityParsingOptions, 1);
/* Initialize the various dialog structures */
@@ -1059,11 +1069,10 @@ zenity_option_init (void) {
}
void
-zenity_option_free (void) {
+zenity_option_free (void)
+{
if (zenity_general_dialog_title)
g_free (zenity_general_dialog_title);
- if (zenity_general_window_icon)
- g_free (zenity_general_window_icon);
if (zenity_general_dialog_text)
g_free (zenity_general_dialog_text);
if (zenity_general_uri)
@@ -1087,8 +1096,6 @@ zenity_option_free (void) {
g_strfreev (zenity_forms_combo_values);
if (zenity_forms_column_values)
g_strfreev (zenity_forms_column_values);
- // if (zenity_forms_hide_column)
- // g_free (zenity_forms_hide_column);
if (zenity_entry_entry_text)
g_free (zenity_entry_entry_text);
@@ -1105,6 +1112,8 @@ zenity_option_free (void) {
#ifdef HAVE_LIBNOTIFY
if (zenity_notification_hints)
g_strfreev (zenity_notification_hints);
+ if (zenity_notification_icon)
+ g_free (zenity_notification_icon);
#endif
if (zenity_text_font)
@@ -1119,8 +1128,10 @@ zenity_option_free (void) {
}
static void
-zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode) {
- if (is_active == TRUE) {
+zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode)
+{
+ if (is_active == TRUE)
+ {
if (results->mode == MODE_LAST)
results->mode = mode;
else
@@ -1128,21 +1139,22 @@ zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode) {
}
}
-static gchar *
-zenity_option_get_name (GOptionEntry *entries, gpointer arg_data) {
- int i;
-
- for (i = 1; entries[i].long_name != NULL; i++) {
+static char *
+zenity_option_get_name (GOptionEntry *entries, gpointer arg_data)
+{
+ for (int i = 1; entries[i].long_name != NULL; i++)
+ {
if (entries[i].arg_data == arg_data)
- return (gchar *) entries[i].long_name;
+ return (char *)entries[i].long_name;
}
return NULL;
}
/* Forms callback */
static gboolean
-zenity_forms_callback (const gchar *option_name, const gchar *value,
- gpointer data, GError **error) {
+zenity_forms_callback (const char *option_name, const char *value,
+ gpointer data, GError **error)
+{
ZenityFormsValue *forms_value = g_new0 (ZenityFormsValue, 1);
forms_value->option_value = g_strdup (value);
@@ -1167,7 +1179,8 @@ zenity_forms_callback (const gchar *option_name, const gchar *value,
/* Error callback */
static void
zenity_option_error_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_error (NULL, ERROR_SYNTAX);
}
@@ -1175,9 +1188,9 @@ zenity_option_error_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_general_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_general_dialog_title = NULL;
- zenity_general_window_icon = NULL;
zenity_general_width = -1;
zenity_general_height = -1;
zenity_general_dialog_text = NULL;
@@ -1192,14 +1205,14 @@ zenity_general_pre_callback (GOptionContext *context, GOptionGroup *group,
zenity_general_dialog_no_markup = FALSE;
zenity_general_timeout_delay = -1;
zenity_general_modal = FALSE;
- zenity_general_attach = 0;
return TRUE;
}
static gboolean
zenity_calendar_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_calendar_active = FALSE;
zenity_calendar_date_format = NULL;
zenity_calendar_day = -1;
@@ -1211,7 +1224,8 @@ zenity_calendar_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_entry_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_entry_active = FALSE;
zenity_entry_entry_text = NULL;
zenity_entry_hide_text = FALSE;
@@ -1221,7 +1235,8 @@ zenity_entry_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_error_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_error_active = FALSE;
return TRUE;
@@ -1229,7 +1244,8 @@ zenity_error_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_info_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_info_active = FALSE;
return TRUE;
@@ -1237,11 +1253,11 @@ zenity_info_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_file_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_file_active = FALSE;
zenity_file_directory = FALSE;
zenity_file_save = FALSE;
- zenity_file_confirm_overwrite = FALSE;
zenity_file_filter = NULL;
return TRUE;
@@ -1249,7 +1265,8 @@ zenity_file_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_list_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_list_active = FALSE;
zenity_list_columns = NULL;
zenity_list_checklist = FALSE;
@@ -1266,9 +1283,11 @@ zenity_list_pre_callback (GOptionContext *context, GOptionGroup *group,
#ifdef HAVE_LIBNOTIFY
static gboolean
zenity_notification_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_notification_active = FALSE;
zenity_notification_listen = FALSE;
+ zenity_notification_icon = NULL;
return TRUE;
}
@@ -1276,7 +1295,8 @@ zenity_notification_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_progress_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_progress_active = FALSE;
zenity_progress_percentage = 0;
zenity_progress_pulsate = FALSE;
@@ -1284,21 +1304,25 @@ zenity_progress_pre_callback (GOptionContext *context, GOptionGroup *group,
zenity_progress_auto_kill = FALSE;
zenity_progress_no_cancel = FALSE;
zenity_progress_time_remaining = FALSE;
+
return TRUE;
}
static gboolean
zenity_question_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_question_active = FALSE;
zenity_question_default_cancel = FALSE;
zenity_question_switch = FALSE;
+
return TRUE;
}
static gboolean
zenity_text_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_text_active = FALSE;
zenity_text_font = NULL;
zenity_text_checkbox = NULL;
@@ -1308,12 +1332,14 @@ zenity_text_pre_callback (GOptionContext *context, GOptionGroup *group,
zenity_text_no_interaction = FALSE;
zenity_text_url = NULL;
#endif
+
return TRUE;
}
static gboolean
zenity_warning_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_warning_active = FALSE;
return TRUE;
@@ -1321,7 +1347,8 @@ zenity_warning_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_scale_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_scale_active = FALSE;
zenity_scale_value = 0;
zenity_scale_min_value = 0;
@@ -1335,7 +1362,8 @@ zenity_scale_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_color_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_colorsel_active = FALSE;
zenity_colorsel_color = NULL;
zenity_colorsel_show_palette = FALSE;
@@ -1345,7 +1373,8 @@ zenity_color_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_password_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_password_active = FALSE;
zenity_password_show_username = FALSE;
@@ -1354,17 +1383,19 @@ zenity_password_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_forms_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_forms_active = FALSE;
zenity_forms_show_header = FALSE;
zenity_forms_date_format = NULL;
- // zenity_forms_hide_column = NULL;
+
return TRUE;
}
static gboolean
zenity_misc_pre_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_misc_about = FALSE;
zenity_misc_version = FALSE;
@@ -1376,9 +1407,9 @@ zenity_misc_pre_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_general_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
results->data->dialog_title = zenity_general_dialog_title;
- results->data->window_icon = zenity_general_window_icon;
results->data->width = zenity_general_width;
results->data->height = zenity_general_height;
results->data->timeout_delay = zenity_general_timeout_delay;
@@ -1386,17 +1417,18 @@ zenity_general_post_callback (GOptionContext *context, GOptionGroup *group,
results->data->cancel_label = zenity_general_cancel_button;
results->data->extra_label = zenity_general_extra_buttons;
results->data->modal = zenity_general_modal;
- results->data->attach = zenity_general_attach;
return TRUE;
}
static gboolean
zenity_calendar_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_calendar_active, MODE_CALENDAR);
- if (results->mode == MODE_CALENDAR) {
+ if (results->mode == MODE_CALENDAR)
+ {
struct tm *t;
time_t current_time;
@@ -1415,67 +1447,79 @@ zenity_calendar_post_callback (GOptionContext *context, GOptionGroup *group,
results->calendar_data->month = zenity_calendar_month;
results->calendar_data->year = zenity_calendar_year;
- if (zenity_calendar_date_format)
+ if (zenity_calendar_date_format) {
results->calendar_data->date_format = zenity_calendar_date_format;
- else
+ } else {
results->calendar_data->date_format =
g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL);
-
- } else {
- if (zenity_calendar_day > -1)
- zenity_option_error (
- zenity_option_get_name (calendar_options, &zenity_calendar_day),
+ }
+ }
+ else
+ {
+ if (zenity_calendar_day > -1) {
+ zenity_option_error (zenity_option_get_name (calendar_options,
+ &zenity_calendar_day),
ERROR_SUPPORT);
+ }
- if (zenity_calendar_month > -1)
- zenity_option_error (zenity_option_get_name (
- calendar_options, &zenity_calendar_month),
+ if (zenity_calendar_month > -1) {
+ zenity_option_error (zenity_option_get_name (calendar_options,
+ &zenity_calendar_month),
ERROR_SUPPORT);
+ }
- if (zenity_calendar_year > -1)
- zenity_option_error (zenity_option_get_name (
- calendar_options, &zenity_calendar_year),
+ if (zenity_calendar_year > -1) {
+ zenity_option_error (zenity_option_get_name (calendar_options,
+ &zenity_calendar_year),
ERROR_SUPPORT);
+ }
- if (zenity_calendar_date_format)
+ if (zenity_calendar_date_format) {
zenity_option_error (zenity_option_get_name (calendar_options,
- &zenity_calendar_date_format),
+ &zenity_calendar_date_format),
ERROR_SUPPORT);
+ }
}
-
return TRUE;
}
static gboolean
zenity_entry_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_entry_active, MODE_ENTRY);
- if (results->mode == MODE_ENTRY) {
+ if (results->mode == MODE_ENTRY)
+ {
results->entry_data->dialog_text = zenity_general_dialog_text;
results->entry_data->entry_text = zenity_entry_entry_text;
results->entry_data->hide_text = zenity_entry_hide_text;
- } else {
- if (zenity_entry_entry_text)
- zenity_option_error (zenity_option_get_name (
- entry_options, &zenity_entry_entry_text),
+ }
+ else
+ {
+ if (zenity_entry_entry_text) {
+ zenity_option_error (zenity_option_get_name (entry_options,
+ &zenity_entry_entry_text),
ERROR_SUPPORT);
+ }
- if (zenity_entry_hide_text)
- zenity_option_error (
- zenity_option_get_name (entry_options, &zenity_entry_hide_text),
+ if (zenity_entry_hide_text) {
+ zenity_option_error (zenity_option_get_name (entry_options,
+ &zenity_entry_hide_text),
ERROR_SUPPORT);
+ }
}
-
return TRUE;
}
static gboolean
zenity_error_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_error_active, MODE_ERROR);
- if (results->mode == MODE_ERROR) {
+ if (results->mode == MODE_ERROR)
+ {
results->msg_data->dialog_text = zenity_general_dialog_text;
results->msg_data->dialog_icon = zenity_general_dialog_icon;
results->msg_data->mode = ZENITY_MSG_ERROR;
@@ -1489,10 +1533,12 @@ zenity_error_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_info_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_info_active, MODE_INFO);
- if (results->mode == MODE_INFO) {
+ if (results->mode == MODE_INFO)
+ {
results->msg_data->dialog_text = zenity_general_dialog_text;
results->msg_data->dialog_icon = zenity_general_dialog_icon;
results->msg_data->mode = ZENITY_MSG_INFO;
@@ -1506,51 +1552,61 @@ zenity_info_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_file_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_file_active, MODE_FILE);
- if (results->mode == MODE_FILE) {
+ if (results->mode == MODE_FILE)
+ {
results->file_data->uri = zenity_general_uri;
results->file_data->multi = zenity_general_multiple;
results->file_data->directory = zenity_file_directory;
results->file_data->save = zenity_file_save;
- results->file_data->confirm_overwrite = zenity_file_confirm_overwrite;
results->file_data->separator = zenity_general_separator;
results->file_data->filter = zenity_file_filter;
- } else {
- if (zenity_file_directory)
+ }
+ else
+ {
+ if (zenity_file_directory) {
zenity_option_error (zenity_option_get_name (file_selection_options,
- &zenity_file_directory),
+ &zenity_file_directory),
ERROR_SUPPORT);
+ }
- if (zenity_file_save)
- zenity_option_error (zenity_option_get_name (
- file_selection_options, &zenity_file_save),
+ if (zenity_file_save) {
+ zenity_option_error (zenity_option_get_name (file_selection_options,
+ &zenity_file_save),
ERROR_SUPPORT);
+ }
- if (zenity_file_filter)
+ if (zenity_file_filter) {
zenity_option_error (zenity_option_get_name (file_selection_options,
- &zenity_file_filter),
+ &zenity_file_filter),
ERROR_SUPPORT);
+ }
}
-
return TRUE;
}
static gboolean
zenity_list_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
int i = 0;
- gchar *column;
+ char *column;
zenity_option_set_dialog_mode (zenity_list_active, MODE_LIST);
- if (results->mode == MODE_LIST) {
+ if (results->mode == MODE_LIST)
+ {
results->tree_data->dialog_text = zenity_general_dialog_text;
- if (zenity_list_columns) {
+ if (zenity_list_columns)
+ {
column = zenity_list_columns[0];
- while (column != NULL) {
+
+ while (column != NULL)
+ {
results->tree_data->columns =
g_slist_append (results->tree_data->columns, column);
column = zenity_list_columns[++i];
@@ -1567,7 +1623,9 @@ zenity_list_post_callback (GOptionContext *context, GOptionGroup *group,
results->tree_data->hide_header = zenity_list_hide_header;
results->tree_data->separator = zenity_general_separator;
results->tree_data->mid_search = zenity_list_mid_search;
- } else {
+ }
+ else
+ {
if (zenity_list_columns)
zenity_option_error (
zenity_option_get_name (list_options, &zenity_list_columns),
@@ -1607,39 +1665,45 @@ zenity_list_post_callback (GOptionContext *context, GOptionGroup *group,
zenity_option_get_name (list_options, &zenity_list_mid_search),
ERROR_SUPPORT);
}
-
return TRUE;
}
#ifdef HAVE_LIBNOTIFY
static gboolean
zenity_notification_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
- zenity_option_set_dialog_mode (
- zenity_notification_active, MODE_NOTIFICATION);
+ gpointer data, GError **error)
+{
+ zenity_option_set_dialog_mode (zenity_notification_active,
+ MODE_NOTIFICATION);
- if (results->mode == MODE_NOTIFICATION) {
+ if (results->mode == MODE_NOTIFICATION)
+ {
results->notification_data->notification_text =
zenity_general_dialog_text;
results->notification_data->listen = zenity_notification_listen;
+ results->notification_data->icon = zenity_notification_icon;
results->notification_data->notification_hints =
zenity_notification_hints;
- } else {
- if (zenity_notification_listen)
+ }
+ else
+ {
+ if (zenity_notification_listen) {
zenity_option_error (zenity_option_get_name (notification_options,
- &zenity_notification_listen),
+ &zenity_notification_listen),
ERROR_SUPPORT);
+ }
}
-
return TRUE;
}
#endif
static gboolean
zenity_progress_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_progress_active, MODE_PROGRESS);
- if (results->mode == MODE_PROGRESS) {
+ if (results->mode == MODE_PROGRESS)
+ {
results->progress_data->dialog_text = zenity_general_dialog_text;
results->progress_data->pulsate = zenity_progress_pulsate;
results->progress_data->autoclose = zenity_progress_auto_close;
@@ -1647,46 +1711,56 @@ zenity_progress_post_callback (GOptionContext *context, GOptionGroup *group,
results->progress_data->percentage = zenity_progress_percentage;
results->progress_data->no_cancel = zenity_progress_no_cancel;
results->progress_data->time_remaining = zenity_progress_time_remaining;
- } else {
- if (zenity_progress_pulsate)
+ }
+ else
+ {
+ if (zenity_progress_pulsate) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_pulsate),
+ &zenity_progress_pulsate),
ERROR_SUPPORT);
+ }
- if (zenity_progress_percentage)
+ if (zenity_progress_percentage) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_percentage),
+ &zenity_progress_percentage),
ERROR_SUPPORT);
+ }
- if (zenity_progress_auto_close)
+ if (zenity_progress_auto_close) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_auto_close),
+ &zenity_progress_auto_close),
ERROR_SUPPORT);
+ }
- if (zenity_progress_auto_kill)
+ if (zenity_progress_auto_kill) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_auto_kill),
+ &zenity_progress_auto_kill),
ERROR_SUPPORT);
+ }
- if (zenity_progress_no_cancel)
+ if (zenity_progress_no_cancel) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_no_cancel),
+ &zenity_progress_no_cancel),
ERROR_SUPPORT);
+ }
- if (zenity_progress_time_remaining)
+ if (zenity_progress_time_remaining) {
zenity_option_error (zenity_option_get_name (progress_options,
- &zenity_progress_time_remaining),
+ &zenity_progress_time_remaining),
ERROR_SUPPORT);
+ }
}
-
return TRUE;
}
static gboolean
zenity_question_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_question_active, MODE_QUESTION);
- if (results->mode == MODE_QUESTION) {
+
+ if (results->mode == MODE_QUESTION)
+ {
results->msg_data->dialog_text = zenity_general_dialog_text;
results->msg_data->dialog_icon = zenity_general_dialog_icon;
if (zenity_question_switch)
@@ -1698,20 +1772,24 @@ zenity_question_post_callback (GOptionContext *context, GOptionGroup *group,
results->msg_data->ellipsize = zenity_general_dialog_ellipsize;
results->msg_data->default_cancel = zenity_question_default_cancel;
}
- if (zenity_question_switch && zenity_general_extra_buttons == NULL)
- zenity_option_error (
- zenity_option_get_name (question_options, &zenity_question_switch),
- ERROR_SYNTAX);
+ if (zenity_question_switch && zenity_general_extra_buttons == NULL)
+ {
+ zenity_option_error (zenity_option_get_name (question_options,
+ &zenity_question_switch),
+ ERROR_SYNTAX);
+ }
return TRUE;
}
static gboolean
zenity_text_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_text_active, MODE_TEXTINFO);
- if (results->mode == MODE_TEXTINFO) {
+ if (results->mode == MODE_TEXTINFO)
+ {
results->text_data->uri = zenity_general_uri;
results->text_data->editable = zenity_general_editable;
results->text_data->no_wrap = zenity_general_dialog_no_wrap;
@@ -1723,16 +1801,20 @@ zenity_text_post_callback (GOptionContext *context, GOptionGroup *group,
results->text_data->no_interaction = zenity_text_no_interaction;
results->text_data->url = zenity_text_url;
#endif
- } else {
- if (zenity_text_font)
- zenity_option_error (
- zenity_option_get_name (text_options, &zenity_text_font),
- ERROR_SUPPORT);
+ }
+ else
+ {
+ if (zenity_text_font) {
+ zenity_option_error (zenity_option_get_name (text_options,
+ &zenity_text_font),
+ ERROR_SUPPORT);
+ }
#ifdef HAVE_WEBKITGTK
- if (zenity_text_enable_html)
- zenity_option_error (
- zenity_option_get_name (text_options, &zenity_text_enable_html),
+ if (zenity_text_enable_html) {
+ zenity_option_error (zenity_option_get_name (text_options,
+ &zenity_text_enable_html),
ERROR_SUPPORT);
+ }
#endif
}
return TRUE;
@@ -1740,10 +1822,12 @@ zenity_text_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_warning_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_warning_active, MODE_WARNING);
- if (results->mode == MODE_WARNING) {
+ if (results->mode == MODE_WARNING)
+ {
results->msg_data->dialog_text = zenity_general_dialog_text;
results->msg_data->dialog_icon = zenity_general_dialog_icon;
results->msg_data->mode = ZENITY_MSG_WARNING;
@@ -1757,10 +1841,12 @@ zenity_warning_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_scale_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_scale_active, MODE_SCALE);
- if (results->mode == MODE_SCALE) {
+ if (results->mode == MODE_SCALE)
+ {
results->scale_data->dialog_text = zenity_general_dialog_text;
results->scale_data->value = zenity_scale_value;
results->scale_data->min_value = zenity_scale_min_value;
@@ -1775,40 +1861,47 @@ zenity_scale_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_color_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_colorsel_active, MODE_COLOR);
- if (results->mode == MODE_COLOR) {
+ if (results->mode == MODE_COLOR)
+ {
results->color_data->color = zenity_colorsel_color;
results->color_data->show_palette = zenity_colorsel_show_palette;
- } else {
- if (zenity_colorsel_color)
- zenity_option_error (
- zenity_option_get_name (
- color_selection_options, &zenity_colorsel_color),
- ERROR_SUPPORT);
-
- if (zenity_colorsel_show_palette)
- zenity_option_error (
- zenity_option_get_name (
- color_selection_options, &zenity_colorsel_show_palette),
- ERROR_SUPPORT);
}
+ else
+ {
+ if (zenity_colorsel_color) {
+ zenity_option_error
+ (zenity_option_get_name (color_selection_options,
+ &zenity_colorsel_color),
+ ERROR_SUPPORT);
+ }
+ if (zenity_colorsel_show_palette) {
+ zenity_option_error
+ (zenity_option_get_name (color_selection_options,
+ &zenity_colorsel_show_palette),
+ ERROR_SUPPORT);
+ }
+ }
return TRUE;
}
static gboolean
zenity_forms_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
- gchar *values;
+ gpointer data, GError **error)
+{
+ char *values;
int i = 0;
zenity_option_set_dialog_mode (zenity_forms_active, MODE_FORMS);
- if (results->mode == MODE_FORMS) {
+
+ if (results->mode == MODE_FORMS)
+ {
results->forms_data->dialog_text = zenity_general_dialog_text;
results->forms_data->separator = zenity_general_separator;
- // results->forms_data->hide_column = zenity_forms_hide_column;
results->forms_data->show_header = zenity_forms_show_header;
if (zenity_forms_list_values) {
@@ -1845,7 +1938,9 @@ zenity_forms_post_callback (GOptionContext *context, GOptionGroup *group,
else
results->forms_data->date_format =
g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL);
- } else {
+ }
+ else
+ {
if (zenity_forms_date_format)
zenity_option_error (zenity_option_get_name (forms_dialog_options,
&zenity_forms_date_format),
@@ -1854,10 +1949,6 @@ zenity_forms_post_callback (GOptionContext *context, GOptionGroup *group,
zenity_option_error (zenity_option_get_name (forms_dialog_options,
&zenity_forms_list_values),
ERROR_SUPPORT);
- // if (zenity_forms_hide_column)
- // zenity_option_error (zenity_option_get_name
- // (forms_dialog_options, &zenity_forms_hide_column),
- // ERROR_SUPPORT);
if (zenity_forms_column_values)
zenity_option_error (zenity_option_get_name (forms_dialog_options,
&zenity_forms_column_values),
@@ -1877,24 +1968,26 @@ zenity_forms_post_callback (GOptionContext *context, GOptionGroup *group,
static gboolean
zenity_password_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_password_active, MODE_PASSWORD);
+
if (results->mode == MODE_PASSWORD) {
results->password_data->username = zenity_password_show_username;
} else {
if (zenity_password_show_username)
- zenity_option_error (
- zenity_option_get_name (
- password_dialog_options, &zenity_password_show_username),
- ERROR_SUPPORT);
+ zenity_option_error
+ (zenity_option_get_name (password_dialog_options,
+ &zenity_password_show_username),
+ ERROR_SUPPORT);
}
-
return TRUE;
}
static gboolean
zenity_misc_post_callback (GOptionContext *context, GOptionGroup *group,
- gpointer data, GError **error) {
+ gpointer data, GError **error)
+{
zenity_option_set_dialog_mode (zenity_misc_about, MODE_ABOUT);
zenity_option_set_dialog_mode (zenity_misc_version, MODE_VERSION);
@@ -1902,7 +1995,8 @@ zenity_misc_post_callback (GOptionContext *context, GOptionGroup *group,
}
static GOptionContext *
-zenity_create_context (void) {
+zenity_create_context (void)
+{
GOptionContext *tmp_ctx;
GOptionGroup *a_group;
@@ -1915,8 +2009,8 @@ zenity_create_context (void) {
NULL,
NULL);
g_option_group_add_entries (a_group, general_options);
- g_option_group_set_parse_hooks (
- a_group, zenity_general_pre_callback, zenity_general_post_callback);
+ g_option_group_set_parse_hooks (a_group,
+ zenity_general_pre_callback, zenity_general_post_callback);
g_option_group_set_error_hook (a_group, zenity_option_error_callback);
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group (tmp_ctx, a_group);
@@ -1928,8 +2022,8 @@ zenity_create_context (void) {
NULL,
NULL);
g_option_group_add_entries (a_group, calendar_options);
- g_option_group_set_parse_hooks (
- a_group, zenity_calendar_pre_callback, zenity_calendar_post_callback);
+ g_option_group_set_parse_hooks (a_group,
+ zenity_calendar_pre_callback, zenity_calendar_post_callback);
g_option_group_set_error_hook (a_group, zenity_option_error_callback);
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group (tmp_ctx, a_group);
@@ -1941,15 +2035,15 @@ zenity_create_context (void) {
NULL,
NULL);
g_option_group_add_entries (a_group, entry_options);
- g_option_group_set_parse_hooks (
- a_group, zenity_entry_pre_callback, zenity_entry_post_callback);
+ g_option_group_set_parse_hooks (a_group,
+ zenity_entry_pre_callback, zenity_entry_post_callback);
g_option_group_set_error_hook (a_group, zenity_option_error_callback);
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group (tmp_ctx, a_group);
/* Adds error option entries */
- a_group = g_option_group_new (
- "error", N_ ("Error options"), N_ ("Show error options"), NULL, NULL);
+ a_group = g_option_group_new ("error",
+ N_ ("Error options"), N_ ("Show error options"), NULL, NULL);
g_option_group_add_entries (a_group, error_options);
g_option_group_set_parse_hooks (
a_group, zenity_error_pre_callback, zenity_error_post_callback);
@@ -1958,8 +2052,8 @@ zenity_create_context (void) {
g_option_context_add_group (tmp_ctx, a_group);
/* Adds info option entries */
- a_group = g_option_group_new (
- "info", N_ ("Info options"), N_ ("Show info options"), NULL, NULL);
+ a_group = g_option_group_new ("info",
+ N_ ("Info options"), N_ ("Show info options"), NULL, NULL);
g_option_group_add_entries (a_group, info_options);
g_option_group_set_parse_hooks (
a_group, zenity_info_pre_callback, zenity_info_post_callback);
@@ -2026,8 +2120,8 @@ zenity_create_context (void) {
NULL,
NULL);
g_option_group_add_entries (a_group, question_options);
- g_option_group_set_parse_hooks (
- a_group, zenity_question_pre_callback, zenity_question_post_callback);
+ g_option_group_set_parse_hooks (a_group,
+ zenity_question_pre_callback, zenity_question_post_callback);
g_option_group_set_error_hook (a_group, zenity_option_error_callback);
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group (tmp_ctx, a_group);
@@ -2039,15 +2133,15 @@ zenity_create_context (void) {
NULL,
NULL);
g_option_group_add_entries (a_group, warning_options);
- g_option_group_set_parse_hooks (
- a_group, zenity_warning_pre_callback, zenity_warning_post_callback);
+ g_option_group_set_parse_hooks (a_group,
+ zenity_warning_pre_callback, zenity_warning_post_callback);
g_option_group_set_error_hook (a_group, zenity_option_error_callback);
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group (tmp_ctx, a_group);
/* Adds scale option entries */
- a_group = g_option_group_new (
- "scale", N_ ("Scale options"), N_ ("Show scale options"), NULL, NULL);
+ a_group = g_option_group_new ("scale",
+ N_ ("Scale options"), N_ ("Show scale options"), NULL, NULL);
g_option_group_add_entries (a_group, scale_options);
g_option_group_set_parse_hooks (
a_group, zenity_scale_pre_callback, zenity_scale_post_callback);
@@ -2075,8 +2169,8 @@ zenity_create_context (void) {
NULL,
NULL);
g_option_group_add_entries (a_group, color_selection_options);
- g_option_group_set_parse_hooks (
- a_group, zenity_color_pre_callback, zenity_color_post_callback);
+ g_option_group_set_parse_hooks (a_group,
+ zenity_color_pre_callback, zenity_color_post_callback);
g_option_group_set_error_hook (a_group, zenity_option_error_callback);
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group (tmp_ctx, a_group);
@@ -2088,8 +2182,8 @@ zenity_create_context (void) {
NULL,
NULL);
g_option_group_add_entries (a_group, password_dialog_options);
- g_option_group_set_parse_hooks (
- a_group, zenity_password_pre_callback, zenity_password_post_callback);
+ g_option_group_set_parse_hooks (a_group,
+ zenity_password_pre_callback, zenity_password_post_callback);
g_option_group_set_error_hook (a_group, zenity_option_error_callback);
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group (tmp_ctx, a_group);
@@ -2101,8 +2195,8 @@ zenity_create_context (void) {
NULL,
NULL);
g_option_group_add_entries (a_group, forms_dialog_options);
- g_option_group_set_parse_hooks (
- a_group, zenity_forms_pre_callback, zenity_forms_post_callback);
+ g_option_group_set_parse_hooks (a_group,
+ zenity_forms_pre_callback, zenity_forms_post_callback);
g_option_group_set_error_hook (a_group, zenity_option_error_callback);
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group (tmp_ctx, a_group);
@@ -2114,17 +2208,12 @@ zenity_create_context (void) {
NULL,
NULL);
g_option_group_add_entries (a_group, miscellaneous_options);
- g_option_group_set_parse_hooks (
- a_group, zenity_misc_pre_callback, zenity_misc_post_callback);
+ g_option_group_set_parse_hooks (a_group,
+ zenity_misc_pre_callback, zenity_misc_post_callback);
g_option_group_set_error_hook (a_group, zenity_option_error_callback);
g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
g_option_context_add_group (tmp_ctx, a_group);
- /* Adds gtk option entries */
- a_group = gtk_get_option_group (TRUE);
- g_option_group_set_translation_domain (a_group, GETTEXT_PACKAGE);
- g_option_context_add_group (tmp_ctx, a_group);
-
/* Enable help options */
g_option_context_set_help_enabled (tmp_ctx, TRUE);
g_option_context_set_ignore_unknown_options (tmp_ctx, FALSE);
@@ -2133,28 +2222,34 @@ zenity_create_context (void) {
}
void
-zenity_option_error (gchar *string, ZenityError error) {
- switch (error) {
+zenity_option_error (char *string, ZenityError error)
+{
+ switch (error)
+ {
case ERROR_SYNTAX:
g_printerr (_ ("This option is not available. Please see --help "
"for all possible usages.\n"));
zenity_option_free ();
exit (-1);
+
case ERROR_SUPPORT:
g_printerr (_ ("--%s is not supported for this dialog\n"), string);
zenity_option_free ();
exit (-1);
+
case ERROR_DIALOG:
g_printerr (_ ("Two or more dialog options specified\n"));
zenity_option_free ();
exit (-1);
+
default:
return;
}
}
ZenityParsingOptions *
-zenity_option_parse (gint argc, gchar **argv) {
+zenity_option_parse (int argc, char **argv)
+{
GError *error = NULL;
zenity_option_init ();
diff --git a/src/option.h b/src/option.h
index b495e0e..475f9ae 100644
--- a/src/option.h
+++ b/src/option.h
@@ -1,7 +1,8 @@
/*
* option.h
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2021 Logan Rathbone
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -24,11 +25,9 @@
#define OPTION_H
#include "zenity.h"
+
#include <glib.h>
-#include <langinfo.h>
-#ifdef HAVE_LOCALE_H
-#include <locale.h>
-#endif
+#include <config.h>
typedef enum {
MODE_CALENDAR,
@@ -80,9 +79,9 @@ typedef struct {
ZenityFormsData *forms_data;
} ZenityParsingOptions;
-void zenity_option_error (gchar *string, ZenityError error);
+void zenity_option_error (char *string, ZenityError error);
-ZenityParsingOptions *zenity_option_parse (gint argc, gchar **argv);
+ZenityParsingOptions *zenity_option_parse (int argc, char **argv);
void zenity_option_free (void);
diff --git a/src/password.c b/src/password.c
index a5490d3..172fe4f 100644
--- a/src/password.c
+++ b/src/password.c
@@ -1,19 +1,22 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* password.c
*
- * Copyright (C) 2010 Arx Cruz
+ * Copyright © 2010 Arx Cruz
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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., 121 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
@@ -21,140 +24,155 @@
* Authors: Arx Cruz <arxcruz@gmail.com>
*/
-#include "config.h"
#include "util.h"
#include "zenity.h"
+
#include <string.h>
+#include <config.h>
+
static ZenityData *zen_data;
-static void zenity_password_dialog_response (
- GtkWidget *widget, int response, gpointer data);
+static void zenity_password_dialog_response (GtkWidget *widget,
+ int response, gpointer data);
void
-zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data) {
+zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data)
+{
+ GtkBuilder *builder;
GtkWidget *dialog;
- GtkWidget *image;
- GtkWidget *hbox;
- GtkWidget *vbox_labels;
- GtkWidget *vbox_entries;
+ GtkWidget *button;
+ GtkWidget *grid;
GtkWidget *label;
+ int pass_row = 0;
+ /* Set global */
zen_data = data;
- dialog = gtk_dialog_new ();
+ builder = zenity_util_load_ui_file ("zenity_password_dialog", NULL);
+
+ if (builder == NULL)
+ {
+ data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
+ return;
+ }
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ dialog = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_password_dialog"));
+
+ 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);
}
}
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- data->cancel_label != NULL ? data->cancel_label : _ ("_Cancel"),
- GTK_RESPONSE_CANCEL);
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- data->ok_label != NULL ? data->ok_label : _ ("_OK"),
- GTK_RESPONSE_OK);
+ 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);
+ }
- image =
- gtk_image_new_from_icon_name ("dialog-password", GTK_ICON_SIZE_DIALOG);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 12);
+ 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);
+ }
- /* Checks if username has been passed as a parameter */
- gchar *title_text = _ ("Type your password");
+ grid = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_password_grid"));
+ /* Checks if username has been passed as a parameter */
if (password_data->username)
- title_text = _ ("Type your username and password");
-
- label = gtk_label_new (title_text);
-
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 12);
- gtk_box_pack_start (
- GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
- hbox,
- FALSE,
- TRUE,
- 5);
-
- vbox_labels = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
- vbox_entries = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
- gtk_box_pack_start (
- GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
- hbox,
- FALSE,
- TRUE,
- 5);
-
- gtk_box_pack_start (GTK_BOX (hbox), vbox_labels, FALSE, TRUE, 12);
- gtk_box_pack_start (GTK_BOX (hbox), vbox_entries, TRUE, TRUE, 12);
-
- if (password_data->username) {
- label = gtk_label_new (_ ("Username:"));
- gtk_box_pack_start (GTK_BOX (vbox_labels), label, TRUE, FALSE, 12);
+ {
+ /* Change the password label to ask for both username and password */
+ label = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_password_title"));
+ gtk_label_set_text (GTK_LABEL(label),
+ _("Type your username and password"));
+
+ /* Add the username label and entry and increment the row for the
+ * password entry so it will be added below the username.
+ */
+ label = gtk_label_new (_("Username:"));
+ gtk_grid_attach (GTK_GRID(grid), label,
+ 0, /* col */
+ 0, /* row */
+ 1, 1); /* width/height by cell. */
+
password_data->entry_username = gtk_entry_new ();
- gtk_box_pack_start (GTK_BOX (vbox_entries),
- password_data->entry_username,
- TRUE,
- TRUE,
- 12);
+ gtk_grid_attach (GTK_GRID(grid), password_data->entry_username,
+ 1,
+ 0,
+ 1, 1);
+
+ ++pass_row;
}
- label = gtk_label_new (_ ("Password:"));
- gtk_box_pack_start (GTK_BOX (vbox_labels), label, TRUE, FALSE, 12);
+ label = gtk_label_new (_("Password:"));
+ gtk_grid_attach (GTK_GRID(grid), label,
+ 0, /* col */
+ pass_row, /* row */
+ 1, 1); /* width/height by cell. */
+
password_data->entry_password = gtk_entry_new ();
- gtk_entry_set_visibility (GTK_ENTRY (password_data->entry_password), FALSE);
- gtk_entry_set_activates_default (
- GTK_ENTRY (password_data->entry_password), TRUE);
- gtk_box_pack_start (
- GTK_BOX (vbox_entries), password_data->entry_password, TRUE, TRUE, 12);
+ gtk_entry_set_visibility (GTK_ENTRY(password_data->entry_password), FALSE);
+ gtk_entry_set_input_purpose (GTK_ENTRY(password_data->entry_password),
+ GTK_INPUT_PURPOSE_PASSWORD);
+ gtk_entry_set_activates_default (GTK_ENTRY(password_data->entry_password),
+ TRUE);
+ gtk_grid_attach (GTK_GRID(grid), password_data->entry_password,
+ 1,
+ pass_row,
+ 1, 1);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
+ gtk_window_set_title (GTK_WINDOW(dialog), data->dialog_title);
if (data->modal)
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);
- g_signal_connect (G_OBJECT (dialog),
- "response",
- G_CALLBACK (zenity_password_dialog_response),
- password_data);
- gtk_widget_show_all (
- GTK_WIDGET (gtk_dialog_get_content_area (GTK_DIALOG (dialog))));
- zenity_util_show_dialog (dialog, data->attach);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK(zenity_password_dialog_response), password_data);
- if (data->timeout_delay > 0) {
+ zenity_util_show_dialog (dialog);
+
+ if (data->timeout_delay > 0)
+ {
g_timeout_add_seconds (data->timeout_delay,
(GSourceFunc) zenity_util_timeout_handle,
dialog);
}
- gtk_main ();
+ zenity_util_gapp_main (GTK_WINDOW(dialog));
}
static void
-zenity_password_dialog_response (
- GtkWidget *widget, int response, gpointer data) {
- ZenityPasswordData *password_data = (ZenityPasswordData *) data;
- switch (response) {
+zenity_password_dialog_response (GtkWidget *widget, int response,
+ gpointer data)
+{
+ ZenityPasswordData *password_data = data;
+ GtkEntryBuffer *user_buff, *pass_buff;
+
+ 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:
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
- if (password_data->username)
+ if (password_data->username) {
g_print ("%s|%s\n",
- gtk_entry_get_text (
- GTK_ENTRY (password_data->entry_username)),
- gtk_entry_get_text (
- GTK_ENTRY (password_data->entry_password)));
- else
+ gtk_entry_buffer_get_text (user_buff),
+ gtk_entry_buffer_get_text (pass_buff));
+ }
+ else {
g_print ("%s\n",
- gtk_entry_get_text (
- GTK_ENTRY (password_data->entry_password)));
+ gtk_entry_buffer_get_text (pass_buff));
+ }
break;
case GTK_RESPONSE_CANCEL:
@@ -163,11 +181,10 @@ zenity_password_dialog_response (
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label))
printf ("%s\n", zen_data->extra_label[response]);
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
-
- gtk_main_quit ();
+ zenity_util_gapp_quit (GTK_WINDOW(widget));
}
diff --git a/src/progress.c b/src/progress.c
index 00bb8aa..06e54e0 100644
--- a/src/progress.c
+++ b/src/progress.c
@@ -1,30 +1,33 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* progress.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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.
*
- * Authors: Glynn Foster <glynn.foster@sun.com>
+ * Original Author: Glynn Foster <glynn.foster@sun.com>
*/
-#include "config.h"
#include "util.h"
#include "zenity.h"
+
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -33,11 +36,13 @@
#include <time.h>
#include <unistd.h>
+#include <config.h>
+
static GtkBuilder *builder;
static ZenityData *zen_data;
static GIOChannel *channel;
-static gint pulsate_timeout = -1;
+static int pulsate_timeout = -1;
static gboolean autokill;
static gboolean no_cancel;
static gboolean auto_close;
@@ -45,17 +50,20 @@ 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,
+ int response, gpointer data);
static gboolean
-zenity_progress_pulsate_progress_bar (gpointer user_data) {
+zenity_progress_pulsate_progress_bar (gpointer user_data)
+{
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (user_data));
+
return TRUE;
}
static void
-zenity_progress_pulsate_stop (void) {
+zenity_progress_pulsate_stop (void)
+{
if (pulsate_timeout > 0) {
g_source_remove (pulsate_timeout);
pulsate_timeout = -1;
@@ -63,34 +71,40 @@ zenity_progress_pulsate_stop (void) {
}
static void
-zenity_progress_pulsate_start (GObject *progress_bar) {
+zenity_progress_pulsate_start (GObject *progress_bar)
+{
if (pulsate_timeout == -1) {
- pulsate_timeout = g_timeout_add (
- 100, zenity_progress_pulsate_progress_bar, progress_bar);
+ pulsate_timeout = g_timeout_add (100,
+ zenity_progress_pulsate_progress_bar, progress_bar);
}
}
static void
-zenity_progress_update_time_remaining (ZenityProgressData *progress_data) {
+zenity_progress_update_time_remaining (ZenityProgressData *progress_data)
+{
static GObject *progress_time = NULL;
static time_t start_time = (time_t) (-1);
float percentage = progress_data->percentage;
if (progress_time == NULL)
- progress_time =
- gtk_builder_get_object (builder, "zenity_progress_time");
+ progress_time = gtk_builder_get_object (builder,
+ "zenity_progress_time");
+
if (start_time == (time_t) (-1) || percentage <= 0.0 ||
- percentage >= 100.0) {
+ percentage >= 100.0)
+ {
start_time = time (NULL);
gtk_label_set_text (GTK_LABEL (progress_time), "");
- } else {
+ }
+ else
+ {
time_t current_time = time (NULL);
time_t elapsed_time = current_time - start_time;
time_t total_time =
(time_t) (100.0 * elapsed_time / progress_data->percentage);
time_t remaining_time = total_time - elapsed_time;
gulong hours, minutes, seconds;
- gchar *remaining_message;
+ char *remaining_message;
seconds = (gulong) (remaining_time % 60);
remaining_time /= 60;
@@ -98,26 +112,35 @@ zenity_progress_update_time_remaining (ZenityProgressData *progress_data) {
remaining_time /= 60;
hours = (gulong) remaining_time;
- remaining_message = g_strdup_printf (
- _ ("Time remaining: %lu:%02lu:%02lu"), hours, minutes, seconds);
+ remaining_message =
+ g_strdup_printf (_("Time remaining: %lu:%02lu:%02lu"),
+ hours, minutes, seconds);
gtk_label_set_text (GTK_LABEL (progress_time), remaining_message);
+
g_free (remaining_message);
}
}
static float
-stof(const char* s) {
+stof (const char *s)
+{
float rez = 0, fact = 1;
+
if (*s == '-') {
s++;
fact = -1;
}
- for (int point_seen = 0; *s; s++) {
+
+ for (int point_seen = 0; *s; s++)
+ {
+ int d;
+
if (*s == '.' || *s == ',') {
point_seen = 1;
continue;
}
- int d = *s - '0';
+
+ d = *s - '0';
if (d >= 0 && d <= 9) {
if (point_seen) fact /= 10.0f;
rez = rez * 10.0f + (float)d;
@@ -127,24 +150,26 @@ stof(const char* s) {
}
static gboolean
-zenity_progress_handle_stdin (
- GIOChannel *channel, GIOCondition condition, gpointer data) {
+zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition,
+ gpointer data)
+{
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 = (ZenityProgressData *) data;
+ 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) {
- GString *string;
+ if ((condition & G_IO_IN) != 0)
+ {
+ GString *string = g_string_new (NULL);
GError *error = NULL;
- string = g_string_new (NULL);
-
while (channel->is_readable != TRUE)
;
do {
@@ -152,23 +177,25 @@ zenity_progress_handle_stdin (
status = g_io_channel_read_line_string (
channel, string, NULL, &error);
- while (gtk_events_pending ())
- gtk_main_iteration ();
-
+ while (g_main_context_pending (NULL)) {
+ g_main_context_iteration (NULL, FALSE);
+ }
} while (status == G_IO_STATUS_AGAIN);
- if (status != G_IO_STATUS_NORMAL) {
+ if (status != G_IO_STATUS_NORMAL)
+ {
if (error) {
- g_warning (
- "zenity_progress_handle_stdin () : %s", error->message);
+ g_warning ("%s: %s",
+ __func__, error->message);
g_error_free (error);
error = NULL;
}
continue;
}
- if (!g_ascii_strncasecmp (string->str, "#", 1)) {
- gchar *match;
+ if (! g_ascii_strncasecmp (string->str, "#", 1))
+ {
+ char *match;
/* We have a comment, so let's try to change the label */
match = g_strstr_len (string->str, strlen (string->str), "#");
@@ -176,8 +203,10 @@ zenity_progress_handle_stdin (
gtk_label_set_text (GTK_LABEL (progress_label),
g_strcompress (g_strchomp (g_strchug (match))));
- } else if (g_str_has_prefix (string->str, "pulsate")) {
- gchar *colon, *command, *value;
+ }
+ else if (g_str_has_prefix (string->str, "pulsate"))
+ {
+ char *colon, *command, *value;
zenity_util_strip_newline (string->str);
@@ -194,45 +223,50 @@ zenity_progress_handle_stdin (
while (*value && g_ascii_isspace (*value))
value++;
- if (!g_ascii_strcasecmp (value, "false")) {
+ if (! g_ascii_strcasecmp (value, "false"))
+ {
zenity_progress_pulsate_stop ();
- gtk_progress_bar_set_fraction (
- GTK_PROGRESS_BAR (progress_bar),
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress_bar),
progress_data->percentage / 100.0);
- } else {
+ }
+ else {
zenity_progress_pulsate_start (progress_bar);
}
g_free (command);
- } else {
-
- if (!g_ascii_isdigit (*(string->str)))
+ }
+ else
+ {
+ if (! g_ascii_isdigit (*(string->str)))
continue;
/* Now try to convert the thing to a number */
percentage = CLAMP (stof (string->str), 0, 100);
- gtk_progress_bar_set_fraction (
- GTK_PROGRESS_BAR (progress_bar), percentage / 100.0);
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress_bar),
+ percentage / 100.0);
progress_data->percentage = percentage;
if (progress_data->time_remaining == TRUE)
zenity_progress_update_time_remaining (progress_data);
- if (percentage == 100) {
+ if (percentage == 100)
+ {
GObject *button;
- button = gtk_builder_get_object (
- builder, "zenity_progress_ok_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));
- if (progress_data->autoclose) {
+ if (progress_data->autoclose)
+ {
zen_data->exit_code =
zenity_util_return_exit_code (ZENITY_OK);
- gtk_main_quit ();
+
+ zenity_util_gapp_quit (parent);
}
}
}
@@ -243,30 +277,31 @@ zenity_progress_handle_stdin (
g_string_free (string, TRUE);
}
- if ((condition & G_IO_IN) != G_IO_IN || status == G_IO_STATUS_EOF) {
+ if ((condition & G_IO_IN) != G_IO_IN || status == G_IO_STATUS_EOF)
+ {
/* 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"));
+ button = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_progress_ok_button"));
gtk_widget_set_sensitive (button, TRUE);
gtk_widget_grab_focus (button);
- button = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_progress_cancel_button"));
+ 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 ();
g_object_unref (builder);
- if (progress_data->autoclose) {
+ if (progress_data->autoclose)
+ {
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
- gtk_main_quit ();
+ zenity_util_gapp_quit (parent);
}
g_io_channel_shutdown (channel, TRUE, NULL);
@@ -276,7 +311,8 @@ zenity_progress_handle_stdin (
}
static void
-zenity_progress_read_info (ZenityProgressData *progress_data) {
+zenity_progress_read_info (ZenityProgressData *progress_data)
+{
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);
@@ -287,21 +323,18 @@ zenity_progress_read_info (ZenityProgressData *progress_data) {
/* We need to check the pulsate state here, because, the g_io_add_watch
doesn't call the zenity_progress_handle_stdin function if there's no
input. This fix the Bug 567663 */
- if (progress_data->pulsate) {
+ if (progress_data->pulsate)
+ {
GObject *progress_bar =
gtk_builder_get_object (builder, "zenity_progress_bar");
+
zenity_progress_pulsate_start (progress_bar);
}
}
-static void
-zenity_text_size_allocate (
- GtkWidget *widget, GtkAllocation *allocation, gpointer data) {
- gtk_widget_set_size_request (widget, allocation->width / 2, -1);
-}
-
void
-zenity_progress (ZenityData *data, ZenityProgressData *progress_data) {
+zenity_progress (ZenityData *data, ZenityProgressData *progress_data)
+{
GtkWidget *dialog;
GtkWidget *button;
GObject *text;
@@ -316,75 +349,76 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data) {
return;
}
- gtk_builder_connect_signals (builder, NULL);
-
text = gtk_builder_get_object (builder, "zenity_progress_text");
- dialog =
- GTK_WIDGET (gtk_builder_get_object (builder, "zenity_progress_dialog"));
+ dialog = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_progress_dialog"));
progress_bar = gtk_builder_get_object (builder, "zenity_progress_bar");
- g_signal_connect (G_OBJECT (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);
+ 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), data->width, data->height);
-
- if (data->width > -1) {
- gtk_widget_set_size_request (GTK_WIDGET (text), data->width, -1);
- } else {
- g_signal_connect_after (G_OBJECT (text),
- "size-allocate",
- G_CALLBACK (zenity_text_size_allocate),
- data);
- g_signal_connect_after (G_OBJECT (progress_bar),
- "size-allocate",
- G_CALLBACK (zenity_text_size_allocate),
- data);
+ gtk_window_set_default_size (GTK_WINDOW(dialog),
+ data->width, data->height);
+
+ if (data->width > -1)
+ {
+ gtk_widget_set_size_request (GTK_WIDGET(text), data->width, -1);
}
+#if 0
+ else
+ {
+ g_signal_connect_after (text, "size-allocate",
+ G_CALLBACK(zenity_text_size_allocate), data);
+
+ g_signal_connect_after (progress_bar, "size-allocate",
+ G_CALLBACK(zenity_text_size_allocate), data);
+ }
+#endif
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ 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);
}
}
- 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)
+ {
+ button = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_progress_ok_button"));
+ gtk_button_set_label (GTK_BUTTON(button), data->ok_label);
}
- 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);
+ 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);
}
- if (progress_data->dialog_text)
- gtk_label_set_markup (
- GTK_LABEL (text), g_strcompress (progress_data->dialog_text));
+ if (progress_data->dialog_text) {
+ gtk_label_set_markup (GTK_LABEL(text),
+ g_strcompress (progress_data->dialog_text));
+ }
- if (progress_data->percentage > -1)
- gtk_progress_bar_set_fraction (
- GTK_PROGRESS_BAR (progress_bar), progress_data->percentage / 100.0);
+ if (progress_data->percentage > -1) {
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress_bar),
+ progress_data->percentage / 100.0);
+ }
autokill = progress_data->autokill;
@@ -396,39 +430,39 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data) {
gtk_builder_get_object (builder, "zenity_progress_cancel_button");
if (no_cancel) {
- gtk_widget_hide (GTK_WIDGET (cancel_button));
- gtk_window_set_deletable (GTK_WINDOW (dialog), FALSE);
+ gtk_widget_hide (GTK_WIDGET(cancel_button));
+ gtk_window_set_deletable (GTK_WINDOW(dialog), FALSE);
}
if (no_cancel && auto_close)
- gtk_widget_hide (GTK_WIDGET (ok_button));
+ gtk_widget_hide (GTK_WIDGET(ok_button));
- zenity_util_show_dialog (dialog, data->attach);
+ zenity_util_show_dialog (dialog);
zenity_progress_read_info (progress_data);
- if (data->timeout_delay > 0) {
+ if (data->timeout_delay > 0)
+ {
g_timeout_add_seconds (data->timeout_delay,
(GSourceFunc) zenity_util_timeout_handle,
NULL);
}
-
- gtk_main ();
+ zenity_util_gapp_main (GTK_WINDOW(dialog));
}
static void
-zenity_progress_dialog_response (
- GtkWidget *widget, int response, gpointer data) {
- switch (response) {
+zenity_progress_dialog_response (GtkWidget *widget, int response,
+ gpointer data)
+{
+ switch (response)
+ {
case GTK_RESPONSE_OK:
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
break;
case GTK_RESPONSE_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. See bug #310824.
- But we want to give people the option to choose this behavior.
- -- Monday 27, March 2006
+ * user the ability to choose the action to be taken. But we want
+ * to give people the option to choose this behavior.
*/
if (autokill) {
kill (getppid (), 1);
@@ -439,12 +473,15 @@ zenity_progress_dialog_response (
case ZENITY_TIMEOUT:
zenity_util_exit_code_with_data (ZENITY_TIMEOUT, zen_data);
break;
+
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label))
+ {
printf ("%s\n", zen_data->extra_label[response]);
+ }
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- gtk_main_quit ();
+ zenity_util_gapp_quit (GTK_WINDOW(widget));
}
diff --git a/src/scale.c b/src/scale.c
index 7e6686b..62714a5 100644
--- a/src/scale.c
+++ b/src/scale.c
@@ -1,39 +1,44 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* scale.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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.
*
- * Authors: Lucas Rocha <lucasr@gnome.org>
+ * Original Author: Lucas Rocha <lucasr@gnome.org>
*/
-#include "config.h"
#include "util.h"
#include "zenity.h"
+#include <config.h>
+
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, int response,
+ gpointer data);
void
-zenity_scale (ZenityData *data, ZenityScaleData *scale_data) {
+zenity_scale (ZenityData *data, ZenityScaleData *scale_data)
+{
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *button;
@@ -53,81 +58,83 @@ 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 (G_OBJECT (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) {
- g_printerr (_ ("Maximum value must be greater than minimum value.\n"));
+ if (scale_data->min_value >= scale_data->max_value)
+ {
+ g_printerr (_("Maximum value must be greater than minimum value.\n"));
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
return;
}
if (scale_data->value < scale_data->min_value ||
- scale_data->value > scale_data->max_value) {
+ scale_data->value > scale_data->max_value)
+ {
g_printerr (_ ("Value out of range.\n"));
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
return;
}
- gtk_builder_connect_signals (builder, NULL);
-
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), data->width, data->height);
+ if (data->width > -1 || data->height > -1) {
+ gtk_window_set_default_size (GTK_WINDOW(dialog),
+ data->width, data->height);
+ }
if (data->modal)
- gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
-
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);
+
+ 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);
}
}
if (data->ok_label) {
- button = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_scale_ok_button"));
+ button = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_scale_ok_button"));
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
}
- if (data->cancel_label) {
- button = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_scale_cancel_button"));
+ 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);
}
- if (scale_data->dialog_text)
- gtk_label_set_markup (
- GTK_LABEL (text), g_strcompress (scale_data->dialog_text));
+ if (scale_data->dialog_text) {
+ gtk_label_set_markup (GTK_LABEL (text),
+ g_strcompress (scale_data->dialog_text));
+ }
- gtk_range_set_range (
- GTK_RANGE (scale), scale_data->min_value, scale_data->max_value);
+ gtk_range_set_range (GTK_RANGE (scale),
+ scale_data->min_value, scale_data->max_value);
gtk_range_set_value (GTK_RANGE (scale), scale_data->value);
gtk_range_set_increments (GTK_RANGE (scale), scale_data->step, 0);
if (scale_data->print_partial)
- g_signal_connect (G_OBJECT (scale),
- "value-changed",
- G_CALLBACK (zenity_scale_value_changed),
- data);
+ {
+ g_signal_connect (scale, "value-changed",
+ G_CALLBACK(zenity_scale_value_changed), data);
+ }
if (scale_data->hide_value)
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
- zenity_util_show_dialog (dialog, data->attach);
+ zenity_util_show_dialog (dialog);
- if (data->timeout_delay > 0) {
+ if (data->timeout_delay > 0)
+ {
g_timeout_add_seconds (data->timeout_delay,
(GSourceFunc) zenity_util_timeout_handle,
dialog);
@@ -135,19 +142,22 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data) {
g_object_unref (builder);
- gtk_main ();
+ zenity_util_gapp_main (GTK_WINDOW(dialog));
}
static void
-zenity_scale_value_changed (GtkWidget *widget, gpointer data) {
- g_print ("%.0f\n", gtk_range_get_value (GTK_RANGE (widget)));
+zenity_scale_value_changed (GtkWidget *widget, gpointer data)
+{
+ g_print ("%.0f\n", gtk_range_get_value (GTK_RANGE(widget)));
}
static void
-zenity_scale_dialog_response (GtkWidget *widget, int response, gpointer data) {
+zenity_scale_dialog_response (GtkWidget *widget, int response, gpointer data)
+{
ZenityData *zen_data = data;
- switch (response) {
+ switch (response)
+ {
case GTK_RESPONSE_OK:
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
g_print ("%.0f\n", gtk_range_get_value (GTK_RANGE (scale)));
@@ -164,10 +174,13 @@ zenity_scale_dialog_response (GtkWidget *widget, int response, gpointer data) {
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label))
+ {
printf ("%s\n", zen_data->extra_label[response]);
+ }
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
- gtk_main_quit ();
+
+ zenity_util_gapp_quit (GTK_WINDOW(widget));
}
diff --git a/src/text.c b/src/text.c
index ffe7b35..09c8c43 100644
--- a/src/text.c
+++ b/src/text.c
@@ -1,42 +1,48 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* text.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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.
*
- * Authors: Glynn Foster <glynn.foster@sun.com>
+ * Original Author: Glynn Foster <glynn.foster@sun.com>
*/
-#include "config.h"
#include "util.h"
#include "zenity.h"
+
#include <gio/gio.h>
#ifdef HAVE_WEBKITGTK
#include <webkit2/webkit2.h>
#endif
+#include <config.h>
+
static ZenityTextData *zen_text_data;
-static void zenity_text_dialog_response (
- GtkWidget *widget, int response, gpointer data);
+static void zenity_text_dialog_response (GtkWidget *widget, int response,
+ gpointer data);
static void zenity_text_toggle_button (GtkToggleButton *button, gpointer data);
+// TODO - I don't think gtk4 support for webkit is fully "there" yet.
#ifdef HAVE_WEBKITGTK
static void
zenity_configure_webkit (WebKitWebView *web_view) {
@@ -146,21 +152,24 @@ zenity_text_webview_load_changed (
}
}
-#endif
+#endif /* HAVE_WEBKITGTK */
static gboolean
-zenity_text_handle_stdin (
- GIOChannel *channel, GIOCondition condition, gpointer data) {
+zenity_text_handle_stdin (GIOChannel *channel, GIOCondition condition,
+ gpointer data)
+{
+#define BUF_SIZE 1024
static GtkTextBuffer *buffer;
static GtkTextView *text_view;
- gchar buf[1024];
+ char buf[BUF_SIZE];
gsize len;
text_view = GTK_TEXT_VIEW (data);
buffer = gtk_text_view_get_buffer (text_view);
- if ((condition & G_IO_IN) || (condition & (G_IO_IN | G_IO_HUP))) {
+ if ((condition & G_IO_IN) || (condition & (G_IO_IN | G_IO_HUP)))
+ {
GError *error = NULL;
gint status;
@@ -168,31 +177,36 @@ zenity_text_handle_stdin (
;
do {
- status = g_io_channel_read_chars (channel, buf, 1024, &len, &error);
-
- while (gtk_events_pending ())
- gtk_main_iteration ();
+ status = g_io_channel_read_chars (channel, buf, BUF_SIZE,
+ &len, &error);
+ while (g_main_context_pending (NULL)) {
+ g_main_context_iteration (NULL, FALSE);
+ }
} while (status == G_IO_STATUS_AGAIN);
- if (status != G_IO_STATUS_NORMAL) {
+ if (status != G_IO_STATUS_NORMAL)
+ {
if (error) {
- g_warning ("zenity_text_handle_stdin () : %s", error->message);
+ g_warning ("%s: %s",
+ __func__, error->message);
g_error_free (error);
error = NULL;
}
return FALSE;
}
- if (len > 0) {
+ if (len > 0)
+ {
GtkTextIter end;
- gchar *utftext;
+ char *utftext;
gsize localelen;
gsize utflen;
gtk_text_buffer_get_end_iter (buffer, &end);
- if (!g_utf8_validate (buf, len, NULL)) {
+ if (! g_utf8_validate (buf, len, NULL))
+ {
utftext = g_convert_with_fallback (buf,
len,
"UTF-8",
@@ -203,35 +217,42 @@ zenity_text_handle_stdin (
NULL);
gtk_text_buffer_insert (buffer, &end, utftext, utflen);
g_free (utftext);
- } else {
+ }
+ else
+ {
gtk_text_buffer_insert (buffer, &end, buf, len);
}
- if (zen_text_data->auto_scroll) {
- GtkTextMark *mark = NULL;
- mark = gtk_text_buffer_get_insert (buffer);
+
+ if (zen_text_data->auto_scroll)
+ {
+ GtkTextMark *mark = gtk_text_buffer_get_insert (buffer);
+
if (mark != NULL)
- gtk_text_view_scroll_to_mark (
- text_view, mark, 0.0, FALSE, 0, 0);
+ {
+ gtk_text_view_scroll_to_mark (text_view, mark,
+ 0.0, FALSE, 0, 0);
+ }
}
}
}
-
return TRUE;
}
static void
-zenity_text_fill_entries_from_stdin (GtkTextView *text_view) {
+zenity_text_fill_entries_from_stdin (GtkTextView *text_view)
+{
GIOChannel *channel;
channel = g_io_channel_unix_new (0);
g_io_channel_set_encoding (channel, "UTF-8", NULL);
g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL);
- g_io_add_watch (
- channel, G_IO_IN | G_IO_HUP, zenity_text_handle_stdin, text_view);
+ g_io_add_watch (channel,
+ G_IO_IN | G_IO_HUP, zenity_text_handle_stdin, text_view);
}
void
-zenity_text (ZenityData *data, ZenityTextData *text_data) {
+zenity_text (ZenityData *data, ZenityTextData *text_data)
+{
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *ok_button;
@@ -247,6 +268,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) {
GtkTextIter start_iter, end_iter;
gchar *content;
#endif
+
zen_text_data = text_data;
builder =
zenity_util_load_ui_file ("zenity_text_dialog", "textbuffer1", NULL);
@@ -256,28 +278,24 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) {
return;
}
- gtk_builder_connect_signals (builder, NULL);
-
- dialog =
- GTK_WIDGET (gtk_builder_get_object (builder, "zenity_text_dialog"));
+ 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"));
+ 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"));
- g_signal_connect (G_OBJECT (dialog),
- "response",
- G_CALLBACK (zenity_text_dialog_response),
- data);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK(zenity_text_dialog_response), data);
if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW (dialog), 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);
@@ -289,10 +307,24 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) {
if (text_data->no_wrap)
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_NONE);
- if (text_data->font) {
- PangoFontDescription *fontDesc =
- pango_font_description_from_string (text_data->font);
- gtk_widget_override_font (GTK_WIDGET (text_view), fontDesc);
+ if (text_data->font)
+ {
+ PangoFontDescription *desc;
+ GtkStyleContext *context;
+ GtkCssProvider *provider;
+ char *css_str;
+
+ desc = pango_font_description_from_string (text_data->font);
+ css_str = zenity_util_pango_font_description_to_css (desc);
+
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (provider, css_str, -1);
+ g_free (css_str);
+
+ context = gtk_widget_get_style_context (GTK_WIDGET(text_view));
+ gtk_style_context_add_provider (context,
+ GTK_STYLE_PROVIDER(provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
if (text_data->uri)
@@ -303,12 +335,12 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) {
if (text_data->editable)
zen_text_data->buffer = text_buffer;
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ 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);
}
}
@@ -325,21 +357,23 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) {
gtk_widget_set_sensitive (GTK_WIDGET (ok_button), FALSE);
gtk_button_set_label (GTK_BUTTON (checkbox), text_data->checkbox);
- g_signal_connect (G_OBJECT (checkbox),
- "toggled",
- G_CALLBACK (zenity_text_toggle_button),
- ok_button);
+ g_signal_connect (checkbox, "toggled",
+ G_CALLBACK(zenity_text_toggle_button), ok_button);
}
if (data->width > -1 || data->height > -1)
- gtk_window_set_default_size (
- GTK_WINDOW (dialog), data->width, data->height);
- else
+ {
+ gtk_window_set_default_size (GTK_WINDOW (dialog),
+ data->width, data->height);
+ }
+ else {
gtk_window_set_default_size (GTK_WINDOW (dialog), 300, 400);
+ }
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 ();
@@ -387,46 +421,53 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) {
gtk_container_add (GTK_CONTAINER (scrolled_window), web_kit);
gtk_widget_show (GTK_WIDGET (web_kit));
}
-#endif
+#endif /* HAVE_WEBKITGTK */
- zenity_util_show_dialog (dialog, data->attach);
+ zenity_util_show_dialog (dialog);
g_object_unref (builder);
- if (data->timeout_delay > 0) {
+ if (data->timeout_delay > 0)
+ {
g_timeout_add_seconds (data->timeout_delay,
(GSourceFunc) zenity_util_timeout_handle,
dialog);
}
-
- gtk_main ();
+ zenity_util_gapp_main (GTK_WINDOW(dialog));
}
static void
-zenity_text_toggle_button (GtkToggleButton *button, gpointer data) {
- GtkWidget *ok_button = (GtkWidget *) data;
- gtk_widget_set_sensitive (
- GTK_WIDGET (ok_button), gtk_toggle_button_get_active (button));
+zenity_text_toggle_button (GtkToggleButton *button, gpointer data)
+{
+ GtkWidget *ok_button = GTK_WIDGET(data);
+
+ gtk_widget_set_sensitive (ok_button,
+ gtk_toggle_button_get_active (button));
}
static void
-zenity_text_dialog_output (ZenityData *zen_data) {
- if (zen_text_data->editable) {
+zenity_text_dialog_output (ZenityData *zen_data)
+{
+ if (zen_text_data->editable)
+ {
GtkTextIter start, end;
- gchar *text;
+ char *text;
+
gtk_text_buffer_get_bounds (zen_text_data->buffer, &start, &end);
- text =
- gtk_text_buffer_get_text (zen_text_data->buffer, &start, &end, 0);
+ text = gtk_text_buffer_get_text (zen_text_data->buffer,
+ &start, &end, 0);
g_print ("%s", text);
g_free (text);
}
}
static void
-zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data) {
+zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data)
+{
ZenityData *zen_data = data;
- switch (response) {
+ switch (response)
+ {
case GTK_RESPONSE_CLOSE:
zenity_text_dialog_output (zen_data);
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
@@ -439,10 +480,12 @@ zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data) {
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label))
+ {
printf ("%s\n", zen_data->extra_label[response]);
+ }
zenity_util_exit_code_with_data (ZENITY_ESC, zen_data);
break;
}
- gtk_main_quit ();
+ zenity_util_gapp_quit (GTK_WINDOW(widget));
}
diff --git a/src/tree.c b/src/tree.c
index d94ce7e..5f99583 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -1,70 +1,76 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* tree.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * Copyright © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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.
*
- * Authors: Glynn Foster <glynn.foster@sun.com>
+ * Original Authors: Glynn Foster <glynn.foster@sun.com>
* Jonathan Blanford <jrb@redhat.com>
* Kristian Rietveld <kris@gtk.org>
*/
-#include "config.h"
#include "util.h"
#include "zenity.h"
+
#include <stdlib.h>
#include <string.h>
-#define MAX_ELEMENTS_BEFORE_SCROLLING 5
+#include <config.h>
+
#define PRINT_HIDE_COLUMN_SEPARATOR ","
static GtkBuilder *builder;
+static GtkTreeView *tree_view;
static GSList *selected;
-static gchar *separator;
+static char *separator;
static gboolean print_all_columns = FALSE;
-static gint *print_columns = NULL;
-static gint *hide_columns = NULL;
+static int *print_columns = NULL;
+static int *hide_columns = NULL;
static GIOChannel *channel;
-static int *zenity_tree_extract_column_indexes (char *indexes, gint n_columns);
-static gboolean zenity_tree_column_is_hidden (gint column_index);
-static void zenity_tree_dialog_response (
- GtkWidget *widget, int response, gpointer data);
+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_row_activated (GtkTreeView *tree_view,
GtkTreePath *tree_path, GtkTreeViewColumn *tree_col, gpointer data);
static gboolean
-zenity_tree_dialog_untoggle (
- GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) {
- GValue toggle_value = {
- 0,
- };
+zenity_tree_dialog_untoggle (GtkTreeModel *model, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer data)
+{
+ GValue toggle_value = G_VALUE_INIT;
gtk_tree_model_get_value (model, iter, 0, &toggle_value);
if (g_value_get_boolean (&toggle_value))
gtk_list_store_set (GTK_LIST_STORE (model), iter, 0, FALSE, -1);
+
return FALSE;
}
static void
-zenity_tree_toggled_callback (
- GtkCellRendererToggle *cell, gchar *path_string, gpointer data) {
+zenity_tree_toggled_callback (GtkCellRendererToggle *cell, char *path_string,
+ gpointer data)
+{
GtkTreeModel *model;
GtkTreeIter iter;
GtkTreePath *path;
@@ -73,11 +79,10 @@ zenity_tree_toggled_callback (
model = GTK_TREE_MODEL (data);
/* Because this is a radio list, we should untoggle the previous toggle so
- * that
- * we only have one selection at any given time
+ * that we only have one selection at any given time
*/
-
- if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (model), "radio")) == 1) {
+ if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (model), "radio")) == 1)
+ {
gtk_tree_model_foreach (model, zenity_tree_dialog_untoggle, NULL);
}
@@ -93,27 +98,31 @@ zenity_tree_toggled_callback (
static void
zenity_load_pixbuf (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
- GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) {
+ GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
+{
static GHashTable *pixbuf_cache = NULL;
GError *error = NULL;
GdkPixbuf *pixbuf;
- gchar *str;
+ char *str;
gtk_tree_model_get (tree_model, iter, 0, &str, -1);
- if (!str)
+ if (! str)
return;
- if (!pixbuf_cache) {
+ if (! pixbuf_cache)
+ {
pixbuf_cache = g_hash_table_new (g_str_hash, g_str_equal);
g_assert (pixbuf_cache);
}
pixbuf = g_hash_table_lookup (pixbuf_cache, str);
- if (!pixbuf) {
+ if (! pixbuf)
+ {
pixbuf = gdk_pixbuf_new_from_file (str, &error);
- if (!pixbuf)
+
+ if (! pixbuf)
g_warning ("Failed to load '%s'", str);
g_hash_table_insert (pixbuf_cache, g_strdup (str), pixbuf);
@@ -126,20 +135,22 @@ zenity_load_pixbuf (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
}
static gboolean
-zenity_tree_handle_stdin (
- GIOChannel *channel, GIOCondition condition, gpointer data) {
- static GtkTreeView *tree_view;
+zenity_tree_handle_stdin (GIOChannel *channel, GIOCondition condition,
+ gpointer data)
+{
GtkTreeModel *model;
static GtkTreeIter iter;
- static gint column_count = 0;
- static gint row_count = 0;
- static gint n_columns;
+ static int column_count = 0;
+ static int row_count = 0;
+ static int n_columns;
static gboolean editable;
static gboolean toggles;
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 =
@@ -149,12 +160,14 @@ zenity_tree_handle_stdin (
model = gtk_tree_view_get_model (tree_view);
- if (first_time) {
+ if (first_time)
+ {
first_time = FALSE;
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
}
- if ((condition & G_IO_IN) == G_IO_IN) {
+ if ((condition & G_IO_IN) == G_IO_IN)
+ {
GString *string;
GError *error = NULL;
@@ -165,47 +178,56 @@ zenity_tree_handle_stdin (
;
do {
do {
- if (g_io_channel_get_flags (channel) & G_IO_FLAG_IS_READABLE)
- status = g_io_channel_read_line_string (
- channel, string, NULL, &error);
- else
+ if (g_io_channel_get_flags (channel) & G_IO_FLAG_IS_READABLE) {
+ status = g_io_channel_read_line_string (channel,
+ string, NULL, &error);
+ } else {
return FALSE;
+ }
- while (gtk_events_pending ())
- gtk_main_iteration ();
-
- // TODO: Find a better way to avoid 100% cpu utilization
+ while (g_main_context_pending (NULL)) {
+ g_main_context_iteration (NULL, FALSE);
+ }
+ /* FIXME: Find a better way to avoid 100% cpu utilization */
g_usleep (10000);
} while (status == G_IO_STATUS_AGAIN);
- if (status != G_IO_STATUS_NORMAL) {
+ 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;
}
continue;
}
- if (column_count == n_columns) {
+ if (column_count == n_columns)
+ {
/* We're starting a new row */
column_count = 0;
row_count++;
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
}
- if (toggles && column_count == 0) {
+ if (toggles && column_count == 0)
+ {
if (strcmp (g_ascii_strdown (
zenity_util_strip_newline (string->str), -1),
"true") == 0)
- gtk_list_store_set (
- GTK_LIST_STORE (model), &iter, column_count, TRUE, -1);
- else
+ {
+ gtk_list_store_set (GTK_LIST_STORE(model),
+ &iter, column_count, TRUE, -1);
+ }
+ else {
gtk_list_store_set (
GTK_LIST_STORE (model), &iter, column_count, FALSE, -1);
- } else {
+ }
+ }
+ else
+ {
gtk_list_store_set (GTK_LIST_STORE (model),
&iter,
column_count,
@@ -214,35 +236,21 @@ zenity_tree_handle_stdin (
}
if (editable) {
- gtk_list_store_set (
- GTK_LIST_STORE (model), &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);
+ gtk_list_store_set (GTK_LIST_STORE(model),
+ &iter, n_columns, TRUE, -1);
}
column_count++;
} while ((g_io_channel_get_buffer_condition (channel) & G_IO_IN) ==
G_IO_IN &&
- status != G_IO_STATUS_EOF);
+ status != G_IO_STATUS_EOF); /* !do while */
+
g_string_free (string, TRUE);
}
- if ((condition & G_IO_IN) != G_IO_IN || status == G_IO_STATUS_EOF) {
+ if ((condition & G_IO_IN) != G_IO_IN || status == G_IO_STATUS_EOF)
+ {
g_io_channel_shutdown (channel, TRUE, NULL);
return FALSE;
}
@@ -250,8 +258,13 @@ zenity_tree_handle_stdin (
}
static void
-zenity_tree_fill_entries_from_stdin (GtkTreeView *tree_view, gint n_columns,
- gboolean toggles, gboolean editable) {
+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 (
@@ -262,16 +275,21 @@ 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 gchar **args,
- gint n_columns, gboolean toggles, gboolean editable) {
+zenity_tree_fill_entries (GtkTreeView *loc_tv, const char **args,
+ int n_columns, gboolean toggles, gboolean editable)
+{
GtkTreeModel *model;
GtkTreeIter iter;
- gint i = 0;
+ 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);
@@ -279,7 +297,7 @@ zenity_tree_fill_entries (GtkTreeView *tree_view, const gchar **args,
G_OBJECT (tree_view), "n_columns", GINT_TO_POINTER (n_columns));
while (args[i] != NULL) {
- gint j;
+ int j;
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
@@ -298,45 +316,34 @@ zenity_tree_fill_entries (GtkTreeView *tree_view, const gchar **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;
}
}
static gboolean
-zenity_mid_search_func (GtkTreeModel *model, gint column, const gchar *key,
- GtkTreeIter *iter, gpointer search_data) {
- gchar *iter_string = NULL;
+zenity_mid_search_func (GtkTreeModel *model, int column, const char *key,
+ GtkTreeIter *iter, gpointer search_data)
+{
+ char *iter_string = NULL;
+
gtk_tree_model_get (model, iter, column, &iter_string, -1);
+
return !(g_strrstr (g_utf8_strdown (iter_string, -1),
g_utf8_strdown (key, -1)) != NULL);
}
static void
zenity_cell_edited_callback (GtkCellRendererText *cell,
- const gchar *path_string, const gchar *new_text, gpointer data) {
+ const char *path_string, const char *new_text, gpointer data)
+{
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
- gint column;
+ int column;
model = GTK_TREE_MODEL (data);
path = gtk_tree_path_new_from_string (path_string);
@@ -350,17 +357,17 @@ zenity_cell_edited_callback (GtkCellRendererText *cell,
}
void
-zenity_tree (ZenityData *data, ZenityTreeData *tree_data) {
+zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
+{
GtkWidget *dialog;
GtkWidget *button;
- GObject *tree_view;
GObject *text;
GtkTreeViewColumn *column;
GtkListStore *model;
GType *column_types;
GSList *tmp;
gboolean first_column = FALSE;
- gint i, column_index, n_columns;
+ int i, column_index, n_columns;
builder = zenity_util_load_ui_file ("zenity_tree_dialog", NULL);
@@ -373,43 +380,45 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) {
n_columns = g_slist_length (tree_data->columns);
- if (tree_data->print_column) {
+ if (tree_data->print_column)
+ {
if (strcmp (g_ascii_strdown (tree_data->print_column, -1), "all") == 0)
print_all_columns = TRUE;
else
print_columns = zenity_tree_extract_column_indexes (
tree_data->print_column, n_columns);
- } else {
+ }
+ else
+ {
print_columns = g_new (gint, 2);
print_columns[0] = (tree_data->radiobox || tree_data->checkbox ? 2 : 1);
print_columns[1] = 0;
}
- if (tree_data->hide_column)
- hide_columns = zenity_tree_extract_column_indexes (
- tree_data->hide_column, n_columns);
+ if (tree_data->hide_column) {
+ hide_columns =
+ zenity_tree_extract_column_indexes (tree_data->hide_column,
+ n_columns);
+ }
if (n_columns == 0) {
- g_printerr (_ ("No column titles specified for List dialog.\n"));
+ g_printerr (_("No column titles specified for List dialog.\n"));
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
return;
}
- if (tree_data->checkbox + tree_data->radiobox + tree_data->imagebox > 1) {
+ if (tree_data->checkbox + tree_data->radiobox + tree_data->imagebox > 1)
+ {
g_printerr (_ ("You should use only one List dialog type.\n"));
data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
return;
}
- gtk_builder_connect_signals (builder, NULL);
+ dialog = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_tree_dialog"));
- dialog =
- GTK_WIDGET (gtk_builder_get_object (builder, "zenity_tree_dialog"));
-
- g_signal_connect (G_OBJECT (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,47 +426,50 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) {
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- if (data->extra_label) {
- gint i = 0;
- while (data->extra_label[i] != NULL) {
- gtk_dialog_add_button (
- GTK_DIALOG (dialog), data->extra_label[i], i);
- i++;
+ 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);
}
}
if (data->ok_label) {
- button = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_tree_ok_button"));
+ button = GTK_WIDGET(gtk_builder_get_object (builder,
+ "zenity_tree_ok_button"));
gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
}
if (data->cancel_label) {
- button = GTK_WIDGET (
- gtk_builder_get_object (builder, "zenity_tree_cancel_button"));
+ button = GTK_WIDGET (gtk_builder_get_object (builder,
+ "zenity_tree_cancel_button"));
gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
}
text = gtk_builder_get_object (builder, "zenity_tree_text");
if (tree_data->dialog_text)
- gtk_label_set_markup (
- GTK_LABEL (text), g_strcompress (tree_data->dialog_text));
+ 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);
+ 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))
- g_signal_connect (tree_view,
- "row-activated",
- G_CALLBACK (zenity_tree_row_activated),
- data);
+ {
+ g_signal_connect (tree_view, "row-activated",
+ G_CALLBACK (zenity_tree_row_activated), data);
+ }
/* Create an empty list store */
model = g_object_new (GTK_TYPE_LIST_STORE, NULL);
@@ -467,7 +479,8 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) {
else
column_types = g_new (GType, n_columns);
- for (i = 0; i < n_columns; i++) {
+ for (i = 0; i < n_columns; i++)
+ {
/* Have the limitation that the radioboxes and checkboxes are in the
* first column */
if (i == 0 && (tree_data->checkbox || tree_data->radiobox))
@@ -484,27 +497,34 @@ 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->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
+ }
+ 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);
+ }
column_index = 0;
- for (tmp = tree_data->columns; tmp; tmp = tmp->next) {
- if (!first_column) {
- if (tree_data->checkbox || tree_data->radiobox) {
+ for (tmp = tree_data->columns; tmp; tmp = tmp->next)
+ {
+ if (! first_column)
+ {
+ if (tree_data->checkbox || tree_data->radiobox)
+ {
GtkCellRenderer *cell_renderer;
cell_renderer = gtk_cell_renderer_toggle_new ();
@@ -523,22 +543,28 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) {
column = gtk_tree_view_column_new_with_attributes (
tmp->data, cell_renderer, "active", column_index, NULL);
- } else if (tree_data->imagebox) {
+ }
+ else if (tree_data->imagebox)
+ {
GtkCellRenderer *cell_renderer =
gtk_cell_renderer_pixbuf_new ();
+
column = gtk_tree_view_column_new_with_attributes (
tmp->data, cell_renderer, NULL);
gtk_tree_view_column_set_cell_data_func (
column, cell_renderer, zenity_load_pixbuf, NULL, NULL);
- } else {
- if (tree_data->editable) {
+ }
+ else
+ {
+ if (tree_data->editable)
+ {
GtkCellRenderer *cell_renderer;
cell_renderer = gtk_cell_renderer_text_new ();
- g_signal_connect (G_OBJECT (cell_renderer),
- "edited",
+ 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",
GINT_TO_POINTER (column_index));
@@ -551,7 +577,9 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) {
"editable",
n_columns,
NULL);
- } else {
+ }
+ else
+ {
column =
gtk_tree_view_column_new_with_attributes (tmp->data,
gtk_cell_renderer_text_new (),
@@ -567,15 +595,18 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) {
gtk_tree_view_column_set_visible (column, FALSE);
first_column = TRUE;
- } else {
- if (tree_data->editable) {
+ }
+ else
+ {
+ if (tree_data->editable)
+ {
GtkCellRenderer *cell_renderer;
cell_renderer = gtk_cell_renderer_text_new ();
- g_signal_connect (G_OBJECT (cell_renderer),
- "edited",
+ 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",
GINT_TO_POINTER (column_index));
@@ -587,7 +618,9 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) {
"editable",
n_columns,
NULL);
- } else {
+ }
+ else
+ {
column = gtk_tree_view_column_new_with_attributes (tmp->data,
gtk_cell_renderer_text_new (),
"text",
@@ -602,46 +635,53 @@ 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),
+ if (tree_data->radiobox || tree_data->checkbox)
+ {
+ if (tree_data->data && *tree_data->data) {
+ 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),
+ }
+ else {
+ zenity_tree_fill_entries_from_stdin (tree_view,
n_columns,
TRUE,
tree_data->editable);
- } else {
- if (tree_data->data && *tree_data->data)
- zenity_tree_fill_entries (GTK_TREE_VIEW (tree_view),
+ }
+ }
+ else
+ {
+ if (tree_data->data && *tree_data->data) {
+ 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),
+ } else {
+ zenity_tree_fill_entries_from_stdin (tree_view,
n_columns,
FALSE,
tree_data->editable);
+ }
}
- zenity_util_show_dialog (dialog, data->attach);
+ zenity_util_show_dialog (dialog);
- if (tree_data->mid_search)
- gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (tree_view),
+ if (tree_data->mid_search) {
+ gtk_tree_view_set_search_equal_func (tree_view,
(GtkTreeViewSearchEqualFunc) zenity_mid_search_func,
model,
NULL);
+ }
if (data->timeout_delay > 0) {
g_timeout_add_seconds (data->timeout_delay,
@@ -649,24 +689,25 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) {
dialog);
}
- gtk_main ();
-
g_object_unref (builder);
+
+ zenity_util_gapp_main (GTK_WINDOW(dialog));
}
static void
zenity_tree_dialog_get_selected (GtkTreeModel *model, GtkTreePath *path_buf,
- GtkTreeIter *iter, GtkTreeView *tree_view) {
- GValue value = {
- 0,
- };
- gint n_columns, i;
+ GtkTreeIter *iter, gpointer user_data)
+{
+ GValue value = G_VALUE_INIT;
+ int n_columns, i;
n_columns =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tree_view), "n_columns"));
- if (print_all_columns) {
- for (i = 0; i < n_columns; i++) {
+ if (print_all_columns)
+ {
+ for (i = 0; i < n_columns; i++)
+ {
gtk_tree_model_get_value (model, iter, i, &value);
selected = g_slist_append (selected, g_value_dup_string (&value));
@@ -675,34 +716,35 @@ zenity_tree_dialog_get_selected (GtkTreeModel *model, GtkTreePath *path_buf,
return;
}
- for (i = 0; print_columns[i] != 0; i++) {
+ for (i = 0; print_columns[i] != 0; i++)
+ {
gtk_tree_model_get_value (model, iter, print_columns[i] - 1, &value);
-
selected = g_slist_append (selected, g_value_dup_string (&value));
+
g_value_unset (&value);
}
}
static gboolean
zenity_tree_dialog_toggle_get_selected (GtkTreeModel *model, GtkTreePath *path,
- GtkTreeIter *iter, GtkTreeView *tree_view) {
- GValue toggle_value = {
- 0,
- };
- gint n_columns, i;
+ GtkTreeIter *iter, gpointer user_data)
+{
+ GValue toggle_value = G_VALUE_INIT;
+ int n_columns, i;
n_columns =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tree_view), "n_columns"));
gtk_tree_model_get_value (model, iter, 0, &toggle_value);
- if (g_value_get_boolean (&toggle_value)) {
- GValue value = {
- 0,
- };
+ if (g_value_get_boolean (&toggle_value))
+ {
+ GValue value = G_VALUE_INIT;
- if (print_all_columns) {
- for (i = 1; i < n_columns; i++) {
+ if (print_all_columns)
+ {
+ for (i = 1; i < n_columns; i++)
+ {
gtk_tree_model_get_value (model, iter, i, &value);
selected =
@@ -713,7 +755,8 @@ zenity_tree_dialog_toggle_get_selected (GtkTreeModel *model, GtkTreePath *path,
return FALSE;
}
- for (i = 0; print_columns[i] != 0; i++) {
+ for (i = 0; print_columns[i] != 0; i++)
+ {
gtk_tree_model_get_value (
model, iter, print_columns[i] - 1, &value);
@@ -721,53 +764,58 @@ zenity_tree_dialog_toggle_get_selected (GtkTreeModel *model, GtkTreePath *path,
g_value_unset (&value);
}
}
-
g_value_unset (&toggle_value);
return FALSE;
}
static void
-zenity_tree_dialog_output (void) {
- GObject *tree_view;
+zenity_tree_dialog_output (void)
+{
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));
- else {
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+ NULL);
+ }
+ else
+ {
+ 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);
}
- GSList *tmp;
- for (tmp = selected; tmp; tmp = tmp->next) {
+ for (GSList *tmp = selected; tmp != NULL; tmp = tmp->next)
+ {
if (tmp->next != NULL) {
- g_print ("%s%s", (gchar *) tmp->data, separator);
- } else
- g_print ("%s\n", (gchar *) tmp->data);
+ g_print ("%s%s", (char *)tmp->data, separator);
+ } else {
+ g_print ("%s\n", (char *)tmp->data);
+ }
}
g_free (print_columns);
g_free (hide_columns);
g_free (separator);
- g_slist_foreach (selected, (GFunc) g_free, NULL);
- selected = NULL;
+ g_slist_free_full (g_steal_pointer (&selected), g_free);
}
static void
-zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data) {
+zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data)
+{
ZenityData *zen_data = data;
- switch (response) {
+ switch (response)
+ {
case GTK_RESPONSE_OK:
zenity_tree_dialog_output ();
zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
@@ -784,57 +832,75 @@ zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data) {
default:
if (zen_data->extra_label &&
- response < g_strv_length (zen_data->extra_label))
+ response < (int)g_strv_length (zen_data->extra_label))
+ {
printf ("%s\n", zen_data->extra_label[response]);
+ }
zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
break;
}
if (channel != NULL &&
g_io_channel_get_flags (channel) & G_IO_FLAG_IS_READABLE)
+ {
g_io_channel_shutdown (channel, TRUE, NULL);
+ }
- gtk_main_quit ();
+ zenity_util_gapp_quit (GTK_WINDOW(widget));
}
static void
-zenity_tree_row_activated (GtkTreeView *tree_view, GtkTreePath *tree_path,
- GtkTreeViewColumn *tree_col, gpointer data) {
+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);
- gtk_main_quit ();
+
+ parent = GTK_WINDOW(gtk_widget_get_native (GTK_WIDGET(tree_view)));
+
+ zenity_util_gapp_quit (parent);
}
static gboolean
-zenity_tree_column_is_hidden (gint column_index) {
- gint i;
-
+zenity_tree_column_is_hidden (int column_index)
+{
if (hide_columns != NULL)
- for (i = 0; hide_columns[i] != 0; i++)
+ {
+ for (int i = 0; hide_columns[i] != 0; i++)
+ {
if (hide_columns[i] == column_index)
return TRUE;
-
+ }
+ }
return FALSE;
}
-static gint *
-zenity_tree_extract_column_indexes (char *indexes, int n_columns) {
+static int *
+zenity_tree_extract_column_indexes (char *indexes, int n_columns)
+{
char **tmp;
- gint *result;
- gint i, j, index;
+ int *result;
+ int i, j, index;
tmp = g_strsplit (indexes, PRINT_HIDE_COLUMN_SEPARATOR, 0);
- result = g_new (gint, 1);
+ result = g_new (int, 1);
- for (j = i = 0; tmp[i] != NULL; i++) {
+ for (j = i = 0; tmp[i] != NULL; i++)
+ {
index = atoi (tmp[i]);
- if (index > 0 && index <= n_columns) {
+ if (index > 0 && index <= n_columns)
+ {
result[j] = index;
j++;
- result = g_renew (gint, result, j + 1);
+ result = g_renew (int, result, j + 1);
}
}
result[j] = 0;
diff --git a/src/util.c b/src/util.c
index 2887fd9..f126840 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1,22 +1,25 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
/*
* util.c
*
- * Copyright (C) 2002 Sun Microsystems, Inc.
- * (C) 1999, 2000 Red Hat Inc.
- * (C) 1998 James Henstridge
- * (C) 1995-2002 Free Software Foundation
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * © 1999, 2000 Red Hat Inc.
+ * © 1998 James Henstridge
+ * © 1995-2002 Free Software Foundation
+ * © 2021 Logan Rathbone
*
* 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.
*
* 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
+ * 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.
@@ -39,10 +42,6 @@
#include <stdlib.h>
#include <string.h>
-#ifdef GDK_WINDOWING_X11
-#include <gdk/gdkx.h>
-#endif
-
#define ZENITY_OK_DEFAULT 0
#define ZENITY_CANCEL_DEFAULT 1
#define ZENITY_ESC_DEFAULT 1
@@ -50,14 +49,15 @@
#define ZENITY_EXTRA_DEFAULT 127
GtkBuilder *
-zenity_util_load_ui_file (const gchar *root_widget, ...) {
+zenity_util_load_ui_file (const char *root_widget, ...)
+{
va_list args;
- gchar *arg = NULL;
+ char *arg = NULL;
GPtrArray *ptrarray;
GtkBuilder *builder = gtk_builder_new ();
GError *error = NULL;
- gchar **objects;
- guint result = 0;
+ char **objects;
+ gboolean result = FALSE;
gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
@@ -68,43 +68,44 @@ zenity_util_load_ui_file (const gchar *root_widget, ...) {
va_start (args, root_widget);
- arg = va_arg (args, gchar *);
+ arg = va_arg (args, char *);
while (arg) {
g_ptr_array_add (ptrarray, g_strdup (arg));
- arg = va_arg (args, gchar *);
+ arg = va_arg (args, char *);
}
va_end (args);
/* Enforce terminating NULL */
g_ptr_array_add (ptrarray, NULL);
- objects = (gchar **) g_ptr_array_free (ptrarray, FALSE);
-
- if (g_file_test (ZENITY_UI_FILE_RELATIVEPATH, G_FILE_TEST_EXISTS)) {
- /* Try current dir, for debugging */
- result = gtk_builder_add_objects_from_file (
- builder, ZENITY_UI_FILE_RELATIVEPATH, objects, NULL);
- }
+ objects = (char **)g_ptr_array_free (ptrarray, FALSE);
- if (result == 0)
- result = gtk_builder_add_objects_from_file (
- builder, ZENITY_UI_FILE_FULLPATH, objects, &error);
+ result = gtk_builder_add_objects_from_resource (builder,
+ ZENITY_UI_RESOURCE_PATH,
+ (const char **)objects,
+ &error);
g_strfreev (objects);
- if (result == 0) {
- g_warning ("Could not load ui file %s: %s",
- ZENITY_UI_FILE_FULLPATH,
- error->message);
+ if (! result) {
+ g_error ("Could not load ui resource %s: %s",
+ ZENITY_UI_RESOURCE_PATH,
+ error->message);
+ }
+
+ /* This should never happen, but if an unexpected error is logged, print
+ * it for debugging purposes. */
+ if (error) {
+ g_debug ("%s: Error generated: %s",
+ __func__, error->message);
g_error_free (error);
- g_object_unref (builder);
- return NULL;
}
return builder;
}
-gchar *
-zenity_util_strip_newline (gchar *string) {
+
+char *
+zenity_util_strip_newline (char *string) {
gsize len;
g_return_val_if_fail (string != NULL, NULL);
@@ -121,11 +122,11 @@ zenity_util_strip_newline (gchar *string) {
}
gboolean
-zenity_util_fill_file_buffer (GtkTextBuffer *buffer, const gchar *filename) {
+zenity_util_fill_file_buffer (GtkTextBuffer *buffer, const char *filename) {
GtkTextIter iter, end;
FILE *f;
- gchar buf[2048];
- gint remaining = 0;
+ char buf[2048];
+ int remaining = 0;
if (filename == NULL)
return FALSE;
@@ -140,7 +141,7 @@ zenity_util_fill_file_buffer (GtkTextBuffer *buffer, const gchar *filename) {
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
while (!feof (f)) {
- gint count;
+ int count;
const char *leftover;
int to_read = 2047 - remaining;
@@ -153,7 +154,7 @@ zenity_util_fill_file_buffer (GtkTextBuffer *buffer, const gchar *filename) {
gtk_text_buffer_insert (buffer, &iter, buf, leftover - buf);
remaining = (buf + remaining + count) - leftover;
- memmove (buf, leftover, remaining);
+ memmove(buf, leftover, remaining);
if (remaining > 6 || count < to_read)
break;
@@ -177,66 +178,9 @@ zenity_util_fill_file_buffer (GtkTextBuffer *buffer, const gchar *filename) {
return TRUE;
}
-const gchar *
-zenity_util_icon_name_from_filename (const gchar *filename) {
- if (!filename || !filename[0])
- return "dialog-warning"; /* default */
-
- if (!g_ascii_strcasecmp (filename, "warning"))
- return "dialog-warning";
- if (!g_ascii_strcasecmp (filename, "info"))
- return "dialog-information";
- if (!g_ascii_strcasecmp (filename, "question"))
- return "dialog-question";
- if (!g_ascii_strcasecmp (filename, "error"))
- return "dialog-error";
- return NULL;
-}
-
-void
-zenity_util_set_window_icon_from_file (
- GtkWidget *widget, const gchar *filename) {
- GdkPixbuf *pixbuf;
- const gchar *icon_name;
-
- icon_name = zenity_util_icon_name_from_filename (filename);
- if (icon_name) {
- gtk_window_set_icon_name (GTK_WINDOW (widget), icon_name);
- } else {
- pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
- gtk_window_set_icon (GTK_WINDOW (widget), pixbuf);
- g_object_unref (pixbuf);
- }
-}
-
-void
-zenity_util_set_window_icon (
- GtkWidget *widget, const gchar *filename, const gchar *default_file) {
- GdkPixbuf *pixbuf;
-
- if (filename != NULL) {
- zenity_util_set_window_icon_from_file (widget, filename);
- } else {
- pixbuf = gdk_pixbuf_new_from_file (default_file, NULL);
- if (pixbuf != NULL) {
- gtk_window_set_icon (GTK_WINDOW (widget), pixbuf);
- g_object_unref (pixbuf);
- }
- }
-}
-
-void
-zenity_util_set_window_icon_from_icon_name (
- GtkWidget *widget, const gchar *filename, const gchar *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);
-}
-
void
zenity_util_show_help (GError **error) {
- gchar *tmp;
+ char *tmp;
tmp = g_find_program_in_path ("yelp");
if (tmp) {
@@ -245,11 +189,11 @@ zenity_util_show_help (GError **error) {
}
}
-gint
+int
zenity_util_return_exit_code (ZenityExitCode value) {
- const gchar *env_var = NULL;
- gint retval;
+ const char *env_var = NULL;
+ int retval;
switch (value) {
@@ -311,108 +255,187 @@ zenity_util_return_exit_code (ZenityExitCode value) {
}
void
-zenity_util_exit_code_with_data (ZenityExitCode value, ZenityData *zen_data) {
+zenity_util_exit_code_with_data (ZenityExitCode value, ZenityData *zen_data)
+{
zen_data->exit_code = zenity_util_return_exit_code (value);
}
-#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;
- GdkDisplay *display;
- display = gdk_display_get_default ();
- gdk_x11_display_error_trap_push (display);
- ret = XGetWindowAttributes (
- GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), wid, &attrs);
- if (gdk_x11_display_error_trap_pop (display) != 0 || ret == 0) {
- return None;
- }
- return wid;
+/* 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!
+ */
+char *
+zenity_util_pango_font_description_to_css (PangoFontDescription *desc)
+{
+ GString *s;
+ PangoFontMask set;
+
+ s = g_string_new ("* { ");
+
+ set = pango_font_description_get_set_fields (desc);
+ if (set & PANGO_FONT_MASK_FAMILY)
+ {
+ g_string_append (s, "font-family: ");
+ g_string_append (s, pango_font_description_get_family (desc));
+ g_string_append (s, "; ");
+ }
+ if (set & PANGO_FONT_MASK_STYLE)
+ {
+ switch (pango_font_description_get_style (desc))
+ {
+ case PANGO_STYLE_NORMAL:
+ g_string_append (s, "font-style: normal; ");
+ break;
+ case PANGO_STYLE_OBLIQUE:
+ g_string_append (s, "font-style: oblique; ");
+ break;
+ case PANGO_STYLE_ITALIC:
+ g_string_append (s, "font-style: italic; ");
+ break;
}
}
- 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;
+ if (set & PANGO_FONT_MASK_VARIANT)
+ {
+ switch (pango_font_description_get_variant (desc))
+ {
+ case PANGO_VARIANT_NORMAL:
+ g_string_append (s, "font-variant: normal; ");
+ break;
+ case PANGO_VARIANT_SMALL_CAPS:
+ g_string_append (s, "font-variant: small-caps; ");
+ break;
+ }
}
- 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);
+ if (set & PANGO_FONT_MASK_WEIGHT)
+ {
+ switch (pango_font_description_get_weight (desc))
+ {
+ case PANGO_WEIGHT_THIN:
+ g_string_append (s, "font-weight: 100; ");
+ break;
+ case PANGO_WEIGHT_ULTRALIGHT:
+ g_string_append (s, "font-weight: 200; ");
+ break;
+ case PANGO_WEIGHT_LIGHT:
+ case PANGO_WEIGHT_SEMILIGHT:
+ g_string_append (s, "font-weight: 300; ");
+ break;
+ case PANGO_WEIGHT_BOOK:
+ case PANGO_WEIGHT_NORMAL:
+ g_string_append (s, "font-weight: 400; ");
+ break;
+ case PANGO_WEIGHT_MEDIUM:
+ g_string_append (s, "font-weight: 500; ");
+ break;
+ case PANGO_WEIGHT_SEMIBOLD:
+ g_string_append (s, "font-weight: 600; ");
+ break;
+ case PANGO_WEIGHT_BOLD:
+ g_string_append (s, "font-weight: 700; ");
+ break;
+ case PANGO_WEIGHT_ULTRABOLD:
+ g_string_append (s, "font-weight: 800; ");
+ break;
+ case PANGO_WEIGHT_HEAVY:
+ case PANGO_WEIGHT_ULTRAHEAVY:
+ g_string_append (s, "font-weight: 900; ");
+ break;
+ }
}
-}
+ if (set & PANGO_FONT_MASK_STRETCH)
+ {
+ switch (pango_font_description_get_stretch (desc))
+ {
+ case PANGO_STRETCH_ULTRA_CONDENSED:
+ g_string_append (s, "font-stretch: ultra-condensed; ");
+ break;
+ case PANGO_STRETCH_EXTRA_CONDENSED:
+ g_string_append (s, "font-stretch: extra-condensed; ");
+ break;
+ case PANGO_STRETCH_CONDENSED:
+ g_string_append (s, "font-stretch: condensed; ");
+ break;
+ case PANGO_STRETCH_SEMI_CONDENSED:
+ g_string_append (s, "font-stretch: semi-condensed; ");
+ break;
+ case PANGO_STRETCH_NORMAL:
+ g_string_append (s, "font-stretch: normal; ");
+ break;
+ case PANGO_STRETCH_SEMI_EXPANDED:
+ g_string_append (s, "font-stretch: semi-expanded; ");
+ break;
+ case PANGO_STRETCH_EXPANDED:
+ g_string_append (s, "font-stretch: expanded; ");
+ break;
+ case PANGO_STRETCH_EXTRA_EXPANDED:
+ g_string_append (s, "font-stretch: extra-expanded; ");
+ break;
+ case PANGO_STRETCH_ULTRA_EXPANDED:
+ g_string_append (s, "font-stretch: ultra-expanded; ");
+ break;
+ }
+ }
+ if (set & PANGO_FONT_MASK_SIZE)
+ {
+ g_string_append_printf (s, "font-size: %dpt; ",
+ pango_font_description_get_size (desc) / PANGO_SCALE);
+ }
+
+ g_string_append (s, "}");
-#endif /* GDK_WINDOWING_X11 */
+ return g_string_free (s, FALSE);
+}
void
-zenity_util_show_dialog (GtkWidget *dialog, guintptr parent) {
- gtk_widget_realize (dialog);
-#ifdef GDK_WINDOWING_X11
- if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
- g_assert (gtk_widget_get_window (dialog));
- zenity_util_make_transient (gtk_widget_get_window (dialog), parent);
- }
-#endif
+zenity_util_show_dialog (GtkWidget *dialog)
+{
gtk_widget_show (dialog);
}
gboolean
-zenity_util_timeout_handle (gpointer data) {
+zenity_util_timeout_handle (gpointer data)
+{
GtkDialog *dialog = GTK_DIALOG (data);
- if (dialog != NULL)
+
+ if (dialog != NULL) {
gtk_dialog_response (dialog, ZENITY_TIMEOUT);
+ }
else {
- gtk_main_quit ();
+ zenity_util_gapp_quit (GTK_WINDOW(dialog));
exit (ZENITY_TIMEOUT);
}
return FALSE;
}
+
+void
+zenity_util_gapp_main (GtkWindow *window)
+{
+ GApplication *app = g_application_get_default ();
+
+ if (window)
+ {
+ /* As this behaves quite differently if a window is provided vs. not,
+ * let's ensure any window passed is valid.
+ */
+ g_assert (GTK_IS_WINDOW (window));
+
+ gtk_application_add_window (GTK_APPLICATION(app), window);
+ }
+ else {
+ g_application_hold (g_application_get_default ());
+ }
+}
+
+void
+zenity_util_gapp_quit (GtkWindow *window)
+{
+ if (window)
+ {
+ g_assert (GTK_IS_WINDOW (window));
+ gtk_window_set_application (window, NULL);
+ }
+ else {
+ g_application_release (g_application_get_default ());
+ }
+}
diff --git a/src/util.h b/src/util.h
index 3e5391b..0442caf 100644
--- a/src/util.h
+++ b/src/util.h
@@ -1,3 +1,38 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
+/*
+ * util.h
+ *
+ * Copyright © 2002 Sun Microsystems, Inc.
+ * © 1999, 2000 Red Hat Inc.
+ * © 1998 James Henstridge
+ * © 1995-2002 Free Software Foundation
+ * © 2021 Logan Rathbone
+ *
+ * This library is free software; you can redistribute it and/or
+ * 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.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * 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.
+ *
+ * Original Authors of util.c (inferring they were the authors of
+ * this file as well):
+ *
+ * Glynn Foster <glynn.foster@sun.com>
+ * Havoc Pennington <hp@redhat.com>
+ * James Henstridge <james@daa.com.au>
+ * Tom Tromey <tromey@redhat.com>
+ */
+
#ifndef UTIL_H
#define UTIL_H
@@ -6,29 +41,23 @@
G_BEGIN_DECLS
-#define ZENITY_UI_FILE_FULLPATH ZENITY_DATADIR "/zenity.ui"
-#define ZENITY_UI_FILE_RELATIVEPATH "./zenity.ui"
-
-#define ZENITY_IMAGE_FULLPATH(filename) (ZENITY_DATADIR "/" filename)
-
-GtkBuilder *zenity_util_load_ui_file (
- const gchar *widget_root, ...) G_GNUC_NULL_TERMINATED;
-gchar *zenity_util_strip_newline (gchar *string);
-gboolean zenity_util_fill_file_buffer (
- GtkTextBuffer *buffer, const gchar *filename);
-const gchar *zenity_util_icon_name_from_filename (const gchar *filename);
-void zenity_util_set_window_icon (
- GtkWidget *widget, const gchar *filename, const gchar *default_file);
-void zenity_util_set_window_icon_from_icon_name (
- GtkWidget *widget, const gchar *filename, const gchar *default_icon_name);
-void zenity_util_set_window_icon_from_file (
- GtkWidget *widget, const gchar *filename);
+#define ZENITY_UI_RESOURCE_PATH "/org/gnome/Zenity/zenity.ui"
+
+#define ZENITY_IMAGE_FULLPATH(filename) (PACKAGE_DATADIR "/" filename)
+
+GtkBuilder *zenity_util_load_ui_file (const char *widget_root,
+ ...) G_GNUC_NULL_TERMINATED;
+char *zenity_util_strip_newline (char *string);
+gboolean zenity_util_fill_file_buffer (GtkTextBuffer *buffer,
+ const char *filename);
void zenity_util_show_help (GError **error);
-gint zenity_util_return_exit_code (ZenityExitCode value);
+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, guintptr parent);
-
+void zenity_util_show_dialog (GtkWidget *widget);
gboolean zenity_util_timeout_handle (gpointer data);
+char *zenity_util_pango_font_description_to_css (PangoFontDescription *desc);
+void zenity_util_gapp_main (GtkWindow *window);
+void zenity_util_gapp_quit (GtkWindow *window);
G_END_DECLS
diff --git a/src/zenity.gresource.xml b/src/zenity.gresource.xml
new file mode 100644
index 0000000..68efa13
--- /dev/null
+++ b/src/zenity.gresource.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- vim:ts=4 sw=4
+-->
+<!--
+ Copyright © 2021 Logan Rathbone <poprocks@gmail.com>
+
+ Zenity is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ Zenity 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with Zenity; see the file COPYING.
+ If not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+-->
+
+<gresources>
+ <gresource prefix="/org/gnome/Zenity">
+ <file preprocess="xml-stripblanks" compressed="true">zenity.ui</file>
+ </gresource>
+</gresources>
diff --git a/src/zenity.h b/src/zenity.h
index b86a264..8eb8553 100644
--- a/src/zenity.h
+++ b/src/zenity.h
@@ -1,40 +1,25 @@
+/* vim: colorcolumn=80 ts=4 sw=4
+ */
#ifndef ZENITY_H
#define ZENITY_H
#include <gtk/gtk.h>
+#include <glib/gi18n.h>
-G_BEGIN_DECLS
+#include <config.h>
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(String) dgettext (GETTEXT_PACKAGE, String)
-#ifdef gettext_noop
-#define N_(String) gettext_noop (String)
-#else
-#define N_(String) (String)
-#endif
-#else /* NLS is disabled */
-#define _(String) (String)
-#define N_(String) (String)
-#define textdomain(String) (String)
-#define gettext(String) (String)
-#define dgettext(Domain, String) (String)
-#define dcgettext(Domain, String, Type) (String)
-#define bindtextdomain(Domain, Directory) (Domain)
-#endif
+G_BEGIN_DECLS
typedef struct {
- gchar *dialog_title;
- gchar *window_icon;
- gchar *ok_label;
- gchar *cancel_label;
- gchar **extra_label;
- gint width;
- gint height;
- gint exit_code;
- gint timeout_delay;
+ char *dialog_title;
+ char *ok_label;
+ char *cancel_label;
+ char **extra_label;
+ int width;
+ int height;
+ int exit_code;
+ int timeout_delay;
gboolean modal;
- guintptr attach;
} ZenityData;
typedef enum {
@@ -47,11 +32,11 @@ typedef enum {
} ZenityExitCode;
typedef struct {
- gchar *dialog_text;
- gint day;
- gint month;
- gint year;
- gchar *date_format;
+ char *dialog_text;
+ int day;
+ int month;
+ int year;
+ char *date_format;
} ZenityCalendarData;
typedef enum {
@@ -63,8 +48,8 @@ typedef enum {
} MsgMode;
typedef struct {
- gchar *dialog_text;
- gchar *dialog_icon;
+ char *dialog_text;
+ char *dialog_icon;
MsgMode mode;
gboolean no_wrap;
gboolean no_markup;
@@ -73,35 +58,34 @@ typedef struct {
} ZenityMsgData;
typedef struct {
- gchar *dialog_text;
- gint value;
- gint min_value;
- gint max_value;
- gint step;
+ char *dialog_text;
+ int value;
+ int min_value;
+ int max_value;
+ int step;
gboolean print_partial;
gboolean hide_value;
} ZenityScaleData;
typedef struct {
- gchar *uri;
+ char *uri;
gboolean multi;
gboolean directory;
gboolean save;
- gboolean confirm_overwrite;
- gchar *separator;
- gchar **filter;
+ char *separator;
+ char **filter;
} ZenityFileData;
typedef struct {
- gchar *dialog_text;
- gchar *entry_text;
+ char *dialog_text;
+ char *entry_text;
gboolean hide_text;
- const gchar **data;
+ const char **data;
} ZenityEntryData;
typedef struct {
- gchar *dialog_text;
- gchar *entry_text;
+ char *dialog_text;
+ char *entry_text;
gboolean pulsate;
gboolean autoclose;
gboolean autokill;
@@ -111,46 +95,47 @@ typedef struct {
} ZenityProgressData;
typedef struct {
- gchar *uri;
+ char *uri;
gboolean editable;
gboolean no_wrap;
gboolean auto_scroll;
- gchar *font;
+ char *font;
GtkTextBuffer *buffer;
- gchar *checkbox;
+ char *checkbox;
#ifdef HAVE_WEBKITGTK
gboolean html;
gboolean no_interaction;
- gchar *url;
+ char *url;
#endif
} ZenityTextData;
typedef struct {
- gchar *dialog_text;
+ char *dialog_text;
GSList *columns;
gboolean checkbox;
gboolean radiobox;
gboolean hide_header;
gboolean imagebox;
- gchar *separator;
+ char *separator;
gboolean multi;
gboolean editable;
gboolean mid_search;
- gchar *print_column;
- gchar *hide_column;
- const gchar **data;
+ char *print_column;
+ char *hide_column;
+ const char **data;
} ZenityTreeData;
#ifdef HAVE_LIBNOTIFY
typedef struct {
- gchar *notification_text;
+ char *notification_text;
gboolean listen;
- gchar **notification_hints;
+ char *icon;
+ char **notification_hints;
} ZenityNotificationData;
#endif
typedef struct {
- gchar *color;
+ char *color;
gboolean show_palette;
} ZenityColorData;
@@ -160,10 +145,9 @@ typedef struct {
GSList *list_values;
GSList *column_values;
GSList *combo_values;
- gchar *dialog_text;
- gchar *separator;
- gchar *date_format;
- // gchar *hide_column;
+ char *dialog_text;
+ char *separator;
+ char *date_format;
gboolean show_header;
} ZenityFormsData;
@@ -176,14 +160,14 @@ typedef enum {
} ZenityFormsType;
typedef struct {
- gchar *option_value;
+ char *option_value;
ZenityFormsType type;
GtkWidget *forms_widget;
} ZenityFormsValue;
typedef struct {
gboolean username;
- gchar *password;
+ char *password;
GtkWidget *entry_username;
GtkWidget *entry_password;
} ZenityPasswordData;
@@ -196,8 +180,8 @@ void zenity_progress (ZenityData *data, ZenityProgressData *progress_data);
void zenity_text (ZenityData *data, ZenityTextData *text_data);
void zenity_tree (ZenityData *data, ZenityTreeData *tree_data);
#ifdef HAVE_LIBNOTIFY
-void zenity_notification (
- ZenityData *data, ZenityNotificationData *notification_data);
+void zenity_notification (ZenityData *data,
+ ZenityNotificationData *notification_data);
#endif
void zenity_colorselection (
diff --git a/src/zenity.ui b/src/zenity.ui
index 1359442..82513a4 100644
--- a/src/zenity.ui
+++ b/src/zenity.ui
@@ -1,1150 +1,757 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+
+<!-- vim: ts=2 sw=2
+-->
+
<interface>
- <requires lib="gtk+" version="3.0"/>
- <object class="GtkAdjustment" id="adjustment1">
- <property name="upper">100</property>
- <property name="step_increment">1</property>
- <property name="page_increment">1</property>
- </object>
- <object class="GtkDialog" id="zenity_scale_dialog">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Adjust the scale value</property>
- <property name="default_width">300</property>
- <property name="default_height">100</property>
- <property name="type_hint">dialog</property>
- <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox11">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area11">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="zenity_scale_cancel_button">
- <property name="label" translatable="yes">Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="zenity_scale_ok_button">
- <property name="label" translatable="yes">OK</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="vbox13">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="zenity_scale_text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="ypad">4</property>
- <property name="label" translatable="yes">Adjust the scale value</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkScale" id="zenity_scale_hscale">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="adjustment">adjustment1</property>
- <property name="digits">0</property>
- <property name="value_pos">right</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_scale_cancel_button</action-widget>
- <action-widget response="-5">zenity_scale_ok_button</action-widget>
- </action-widgets>
- </object>
- <object class="GtkTextBuffer" id="textbuffer1"/>
- <object class="GtkDialog" id="zenity_text_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Text View</property>
- <property name="window_position">center</property>
- <property name="default_width">300</property>
- <property name="default_height">200</property>
- <property name="type_hint">dialog</property>
- <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">2</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="zenity_text_cancel_button">
- <property name="label" translatable="yes">Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="zenity_text_close_button">
- <property name="label" translatable="yes">OK</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">True</property>
- <property name="image_position">right</property>
- <accelerator key="Return" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="vbox5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkScrolledWindow" id="zenity_text_scrolled_window">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">etched-in</property>
- <child>
- <object class="GtkTextView" id="zenity_text_view">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="pixels_above_lines">2</property>
- <property name="pixels_below_lines">2</property>
- <property name="editable">False</property>
- <property name="wrap_mode">word</property>
- <property name="left_margin">2</property>
- <property name="right_margin">2</property>
- <property name="buffer">textbuffer1</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="zenity_text_checkbox">
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="xalign">0.5</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_text_cancel_button</action-widget>
- <action-widget response="-7">zenity_text_close_button</action-widget>
- </action-widgets>
- </object>
- <object class="GtkDialog" id="zenity_calendar_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Calendar selection</property>
- <property name="window_position">center</property>
- <property name="type_hint">dialog</property>
- <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">2</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="zenity_calendar_cancel_button">
- <property name="label" translatable="yes">Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="zenity_calendar_ok_button">
- <property name="label" translatable="yes">OK</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="vbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkBox" id="vbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="zenity_calendar_text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Select a date from below.</property>
- <property name="wrap">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_calendar_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">C_alendar:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">zenity_calendar</property>
- <property name="xalign">0</property>
- <accessibility>
- <relation type="label-for" target="zenity_calendar"/>
- </accessibility>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCalendar" id="zenity_calendar">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_calendar_cancel_button</action-widget>
- <action-widget response="-5">zenity_calendar_ok_button</action-widget>
- </action-widgets>
- </object>
- <object class="GtkDialog" id="zenity_entry_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Add a new entry</property>
- <property name="window_position">center</property>
- <property name="type_hint">dialog</property>
- <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">2</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="zenity_entry_cancel_button">
- <property name="label" translatable="yes">Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="zenity_entry_ok_button">
- <property name="label" translatable="yes">OK</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="vbox3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">6</property>
- <child>
- <object class="GtkBox" id="vbox4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="zenity_entry_text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Enter new text:</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_entry_cancel_button</action-widget>
- <action-widget response="-5">zenity_entry_ok_button</action-widget>
- </action-widgets>
- </object>
- <object class="GtkDialog" id="zenity_error_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Error</property>
- <property name="window_position">center</property>
- <property name="type_hint">dialog</property>
- <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox7">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">14</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area7">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="zenity_error_ok_button">
- <property name="label" translatable="yes">OK</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="vbox8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">6</property>
- <child>
- <object class="GtkBox" id="hbox3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage" id="zenity_error_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="yalign">0</property>
- <property name="icon_name">dialog-error</property>
- <property name="icon_size">6</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_error_text">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">An error has occurred.</property>
- <property name="wrap">True</property>
- <property name="selectable">True</property>
- <property name="yalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-5">zenity_error_ok_button</action-widget>
- </action-widgets>
- </object>
- <object class="GtkDialog" id="zenity_forms_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="window_position">center</property>
- <property name="type_hint">normal</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">2</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area12">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="zenity_forms_cancel_button">
- <property name="label" translatable="yes">Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="zenity_forms_ok_button">
- <property name="label" translatable="yes">OK</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <child>
- <object class="GtkGrid" id="zenity_forms_grid">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">12</property>
- <property name="margin_right">6</property>
- <property name="margin_top">12</property>
- <property name="margin_bottom">6</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">10</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="zenity_forms_text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Forms dialog</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_forms_cancel_button</action-widget>
- <action-widget response="-5">zenity_forms_ok_button</action-widget>
- </action-widgets>
- </object>
- <object class="GtkDialog" id="zenity_info_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Information</property>
- <property name="window_position">center</property>
- <property name="type_hint">dialog</property>
- <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox9">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">14</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="zenity_info_ok_button">
- <property name="label" translatable="yes">OK</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="hbox4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage" id="zenity_info_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="yalign">0</property>
- <property name="icon_name">dialog-information</property>
- <property name="icon_size">6</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_info_text">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">All updates are complete.</property>
- <property name="wrap">True</property>
- <property name="selectable">True</property>
- <property name="yalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-5">zenity_info_ok_button</action-widget>
- </action-widgets>
- </object>
- <object class="GtkDialog" id="zenity_progress_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Progress</property>
- <property name="window_position">center</property>
- <property name="type_hint">dialog</property>
- <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">2</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area6">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="zenity_progress_cancel_button">
- <property name="label" translatable="yes">Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="zenity_progress_ok_button">
- <property name="label" translatable="yes">OK</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="vbox7">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="zenity_progress_text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Running...</property>
- <property name="wrap">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkProgressBar" id="zenity_progress_bar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="pulse_step">0.10000000149</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_progress_time">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_progress_cancel_button</action-widget>
- <action-widget response="-5">zenity_progress_ok_button</action-widget>
- </action-widgets>
- </object>
- <object class="GtkDialog" id="zenity_question_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Question</property>
- <property name="window_position">center</property>
- <property name="type_hint">dialog</property>
- <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">14</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="zenity_question_button_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="hbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage" id="zenity_question_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="icon_name">dialog-question</property>
- <property name="icon_size">6</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_question_text">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Are you sure you want to proceed?</property>
- <property name="wrap">True</property>
- <property name="selectable">True</property>
- <property name="yalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <object class="GtkDialog" id="zenity_tree_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Select items from the list</property>
- <property name="window_position">center</property>
- <property name="default_width">300</property>
- <property name="default_height">196</property>
- <property name="type_hint">dialog</property>
- <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area8">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="zenity_tree_cancel_button">
- <property name="label" translatable="yes">Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="zenity_tree_ok_button">
- <property name="label" translatable="yes">OK</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="vbox10">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="zenity_tree_text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Select items from the list below.</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkScrolledWindow" id="zenity_tree_window">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
- <property name="expand">True</property>
- <child>
- <object class="GtkTreeView" id="zenity_tree_view">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection1"/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-6">zenity_tree_cancel_button</action-widget>
- <action-widget response="-5">zenity_tree_ok_button</action-widget>
- </action-widgets>
- </object>
- <object class="GtkDialog" id="zenity_warning_dialog">
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Warning</property>
- <property name="window_position">center</property>
- <property name="type_hint">dialog</property>
- <signal name="destroy" handler="gtk_main_quit" swapped="no"/>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">14</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="zenity_warning_ok_button">
- <property name="label" translatable="yes">OK</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkImage" id="zenity_warning_image">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="icon_name">dialog-warning</property>
- <property name="icon_size">6</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="zenity_warning_text">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Are you sure you want to proceed?</property>
- <property name="wrap">True</property>
- <property name="selectable">True</property>
- <property name="yalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="-5">zenity_warning_ok_button</action-widget>
- </action-widgets>
- </object>
+ <requires lib="gtk" version="4.0"/>
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">1</property>
+ </object>
+ <object class="GtkDialog" id="zenity_scale_dialog">
+ <property name="visible">1</property>
+ <property name="can_focus">0</property>
+ <property name="title" translatable="yes">Adjust the scale value</property>
+ <property name="default_width">300</property>
+ <property name="default_height">100</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox11">
+ <property name="can_focus">0</property>
+ <child>
+ <object class="GtkBox" id="vbox13">
+ <property name="can_focus">0</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="zenity_scale_text">
+ <property name="valign">center</property>
+ <property name="can_focus">0</property>
+ <property name="label" translatable="yes">Adjust the scale value</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkScale" id="zenity_scale_hscale">
+ <property name="hexpand">true</property>
+ <property name="draw-value">1</property>
+ <property name="adjustment">adjustment1</property>
+ <property name="digits">0</property>
+ <property name="value_pos">right</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">zenity_scale_cancel_button</action-widget>
+ <action-widget response="-5" default="true">zenity_scale_ok_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="dialog-action_area11">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_scale_cancel_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="zenity_scale_ok_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkTextBuffer" id="textbuffer1"/>
+ <object class="GtkDialog" id="zenity_text_dialog">
+ <property name="can_focus">0</property>
+ <property name="title" translatable="yes">Text View</property>
+ <property name="default_width">300</property>
+ <property name="default_height">200</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox5">
+ <property name="can_focus">0</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkBox" id="vbox5">
+ <property name="hexpand">1</property>
+ <property name="can_focus">0</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="zenity_text_scrolled_window">
+ <property name="vexpand">1</property>
+ <property name="child">
+ <object class="GtkTextView" id="zenity_text_view">
+ <property name="pixels_above_lines">2</property>
+ <property name="pixels_below_lines">2</property>
+ <property name="editable">0</property>
+ <property name="wrap_mode">word</property>
+ <property name="left_margin">2</property>
+ <property name="right_margin">2</property>
+ <property name="buffer">textbuffer1</property>
+ </object>
+ </property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="zenity_text_checkbox">
+ <property name="valign">center</property>
+ <property name="visible">0</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">zenity_text_cancel_button</action-widget>
+ <action-widget response="-7" default="true">zenity_text_close_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="dialog-action_area5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_text_cancel_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="zenity_text_close_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkDialog" id="zenity_calendar_dialog">
+ <property name="can_focus">0</property>
+ <property name="title" translatable="yes">Calendar selection</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox2">
+ <property name="can_focus">0</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkBox" id="vbox1">
+ <property name="can_focus">0</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkBox" id="vbox2">
+ <property name="vexpand">1</property>
+ <property name="can_focus">0</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="zenity_calendar_text">
+ <property name="halign">center</property>
+ <property name="can_focus">0</property>
+ <property name="label" translatable="yes">Select a date from below.</property>
+ <property name="wrap">1</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="zenity_calendar_label">
+ <property name="valign">center</property>
+ <property name="can_focus">0</property>
+ <property name="label" translatable="yes">C_alendar:</property>
+ <property name="use_underline">1</property>
+ <property name="mnemonic_widget">zenity_calendar</property>
+ <property name="xalign">0</property>
+ <accessibility>
+ <property name="label" translatable="yes">Calendar</property>
+ <relation name="labelled-by">zenity_calendar</relation>
+ </accessibility>
+ </object>
+ </child>
+ <child>
+ <object class="GtkCalendar" id="zenity_calendar">
+ <property name="valign">center</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">zenity_calendar_cancel_button</action-widget>
+ <action-widget response="-5" default="true">zenity_calendar_ok_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_calendar_cancel_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="zenity_calendar_ok_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkDialog" id="zenity_entry_dialog">
+ <property name="can_focus">0</property>
+ <property name="title" translatable="yes">Add a new entry</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox4">
+ <property name="can_focus">0</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
+ <object class="GtkBox" id="vbox3">
+ <property name="can_focus">0</property>
+ <child>
+ <object class="GtkBox" id="vbox4">
+ <property name="hexpand">1</property>
+ <property name="can_focus">0</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="zenity_entry_text">
+ <property name="valign">center</property>
+ <property name="can_focus">0</property>
+ <property name="label" translatable="yes">_Enter new text:</property>
+ <property name="use_underline">1</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">zenity_entry_cancel_button</action-widget>
+ <action-widget response="-5" default="true">zenity_entry_ok_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="dialog-action_area4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_entry_cancel_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="zenity_entry_ok_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkDialog" id="zenity_error_dialog">
+ <property name="can_focus">0</property>
+ <property name="title" translatable="yes">Error</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox7">
+ <property name="can_focus">0</property>
+ <property name="spacing">14</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
+ <object class="GtkBox" id="vbox8">
+ <property name="can_focus">0</property>
+ <child>
+ <object class="GtkBox" id="hbox3">
+ <property name="hexpand">1</property>
+ <property name="can_focus">0</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="zenity_error_image">
+ <property name="halign">center</property>
+ <property name="can_focus">0</property>
+ <property name="icon_name">dialog-error</property>
+ <property name="icon_size">large</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="zenity_error_text">
+ <property name="halign">center</property>
+ <property name="label" translatable="yes">An error has occurred.</property>
+ <property name="wrap">1</property>
+ <property name="selectable">1</property>
+ <property name="yalign">0</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-5" default="true">zenity_error_ok_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="dialog-action_area7">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_error_ok_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkDialog" id="zenity_forms_dialog">
+ <property name="can_focus">0</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox12">
+ <property name="can_focus">0</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="can_focus">0</property>
+ <property name="child">
+ <object class="GtkGrid" id="zenity_forms_grid">
+ <property name="can_focus">0</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">6</property>
+ <property name="margin_top">12</property>
+ <property name="margin_bottom">6</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">10</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </property>
+ <child type="label">
+ <object class="GtkLabel" id="zenity_forms_text">
+ <property name="can_focus">0</property>
+ <property name="label" translatable="yes">Forms dialog</property>
+ <attributes>
+ <attribute name="weight" value="bold"></attribute>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">zenity_forms_cancel_button</action-widget>
+ <action-widget response="-5" default="true">zenity_forms_ok_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="dialog-action_area12">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_forms_cancel_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="zenity_forms_ok_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkDialog" id="zenity_info_dialog">
+ <property name="can_focus">0</property>
+ <property name="title" translatable="yes">Information</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox9">
+ <property name="can_focus">0</property>
+ <property name="spacing">14</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+
+ <child>
+ <object class="GtkBox" id="hbox4">
+ <property name="can_focus">0</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="zenity_info_image">
+ <property name="halign">center</property>
+ <property name="can_focus">0</property>
+ <property name="icon_name">dialog-information</property>
+ <property name="icon_size">large</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="zenity_info_text">
+ <property name="halign">center</property>
+ <property name="label" translatable="yes">All updates are complete.</property>
+ <property name="wrap">1</property>
+ <property name="selectable">1</property>
+ <property name="yalign">0</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-5" default="true">zenity_info_ok_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="dialog-action_area3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_info_ok_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkDialog" id="zenity_progress_dialog">
+ <property name="can_focus">0</property>
+ <property name="title" translatable="yes">Progress</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox6">
+ <property name="can_focus">0</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkBox" id="vbox7">
+ <property name="halign">center</property>
+ <property name="can_focus">0</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="zenity_progress_text">
+ <property name="valign">center</property>
+ <property name="can_focus">0</property>
+ <property name="label" translatable="yes">Running...</property>
+ <property name="wrap">1</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkProgressBar" id="zenity_progress_bar">
+ <property name="valign">center</property>
+ <property name="can_focus">0</property>
+ <property name="pulse_step">0.10000000149</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="zenity_progress_time">
+ <property name="valign">center</property>
+ <property name="can_focus">0</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">zenity_progress_cancel_button</action-widget>
+ <action-widget response="-5" default="true">zenity_progress_ok_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="dialog-action_area6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_progress_cancel_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="zenity_progress_ok_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ <property name="sensitive">0</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkDialog" id="zenity_question_dialog">
+ <property name="can_focus">0</property>
+ <property name="title" translatable="yes">Question</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox3">
+ <property name="can_focus">0</property>
+ <property name="spacing">14</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
+ <object class="GtkBox" id="hbox1">
+ <property name="can_focus">0</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="zenity_question_image">
+ <property name="can_focus">0</property>
+ <property name="icon_name">dialog-question</property>
+ <property name="icon_size">large</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="zenity_question_text">
+ <property name="halign">center</property>
+ <property name="label" translatable="yes">Are you sure you want to proceed?</property>
+ <property name="wrap">1</property>
+ <property name="selectable">1</property>
+ <property name="yalign">0</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="zenity_question_button_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ </child>
+ </object>
+ <object class="GtkDialog" id="zenity_tree_dialog">
+ <property name="can_focus">0</property>
+ <property name="title" translatable="yes">Select items from the list</property>
+ <property name="default_width">300</property>
+ <property name="default_height">196</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox8">
+ <property name="can_focus">0</property>
+ <child>
+ <object class="GtkBox" id="vbox10">
+ <property name="can_focus">0</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="zenity_tree_text">
+ <property name="valign">center</property>
+ <property name="can_focus">0</property>
+ <property name="label" translatable="yes">Select items from the list below.</property>
+ <property name="xalign">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="zenity_tree_window">
+ <property name="hexpand">1</property>
+ <property name="vexpand">1</property>
+ <property name="child">
+ <object class="GtkTreeView" id="zenity_tree_view">
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
+ </object>
+ </property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">zenity_tree_cancel_button</action-widget>
+ <action-widget response="-5" default="true">zenity_tree_ok_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="dialog-action_area8">
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_tree_cancel_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="zenity_tree_ok_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <object class="GtkDialog" id="zenity_warning_dialog">
+ <property name="can_focus">0</property>
+ <property name="title" translatable="yes">Warning</property>
+ <property name="resizable">false</property>
+
+ <child internal-child="content_area">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">0</property>
+ <property name="spacing">14</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
+ <object class="GtkBox" id="hbox2">
+ <property name="can_focus">0</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="zenity_warning_image">
+ <property name="can_focus">0</property>
+ <property name="icon_name">dialog-warning</property>
+ <property name="icon_size">large</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="zenity_warning_text">
+ <property name="halign">center</property>
+ <property name="vexpand">true</property>
+ <property name="hexpand">true</property>
+ <property name="label" translatable="yes">Are you sure you want to proceed?</property>
+ <property name="wrap">1</property>
+ <property name="selectable">1</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-5" default="true">zenity_warning_ok_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_warning_ok_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+
+
+
+
+
+
+
+ <object class="GtkDialog" id="zenity_password_dialog">
+ <property name="title" translatable="yes">Warning</property>
+ <property name="resizable">false</property>
+
+ <child internal-child="content_area">
+ <object class="GtkBox"> <!-- vbox -->
+ <property name="orientation">vertical</property>
+ <property name="spacing">14</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="margin-top">12</property>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="zenity_password_image">
+ <property name="icon_name">dialog-password</property>
+ <property name="icon_size">large</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="zenity_password_title">
+ <property name="label" translatable="yes">Type your password</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkGrid" id="zenity_password_grid">
+ <property name="column-spacing">12</property>
+ <property name="row-spacing">6</property>
+ </object>
+ </child>
+ </object> <!-- !vbox -->
+ </child>
+ <action-widgets>
+ <action-widget response="ok" default="true">zenity_password_ok_button</action-widget>
+ <action-widget response="cancel">zenity_password_cancel_button</action-widget>
+ </action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="zenity_password_ok_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_OK</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="zenity_password_cancel_button">
+ <property name="use-underline">true</property>
+ <property name="label" translatable="yes">_Cancel</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+
+
+
+
+
</interface>