summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Bicha <jbicha@debian.org>2017-12-16 13:06:02 -0500
committerJeremy Bicha <jbicha@debian.org>2017-12-16 13:06:02 -0500
commitf821adc6c1844f3dbd59a5c51bb68fb80f295aa0 (patch)
tree28ff6652502c6adc1b661e0eb4dd3a8adbf60404 /src
parentInitial upstream branch (diff)
parentRelease: Prepare for 3.26.0 (diff)
downloadzenity-f821adc6c1844f3dbd59a5c51bb68fb80f295aa0.tar.gz
zenity-f821adc6c1844f3dbd59a5c51bb68fb80f295aa0.tar.bz2
zenity-f821adc6c1844f3dbd59a5c51bb68fb80f295aa0.zip
New upstream version 3.26.0
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am57
-rw-r--r--src/Makefile.in1018
-rw-r--r--src/about.c329
-rw-r--r--src/calendar.c180
-rw-r--r--src/color.c118
-rw-r--r--src/entry.c211
-rw-r--r--src/fileselection.c238
-rw-r--r--src/forms.c411
-rw-r--r--src/gdialog353
-rwxr-xr-xsrc/gdialog.in353
-rw-r--r--src/main.c120
-rw-r--r--src/msg.c269
-rw-r--r--src/notification.c371
-rw-r--r--src/option.c2229
-rw-r--r--src/option.h89
-rw-r--r--src/password.c173
-rw-r--r--src/progress.c429
-rw-r--r--src/scale.c173
-rw-r--r--src/text.c448
-rw-r--r--src/tree.c845
-rw-r--r--src/util.c417
-rw-r--r--src/util.h35
-rw-r--r--src/zenity.h213
-rw-r--r--src/zenity.ui1150
24 files changed, 10229 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 00000000..bcdd2056
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,57 @@
+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/Makefile.in b/src/Makefile.in
new file mode 100644
index 00000000..b457fd9a
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,1018 @@
+# Makefile.in generated by automake 1.15.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2017 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = zenity$(EXEEXT)
+subdir = src
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
+ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/nls.m4 \
+ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = gdialog
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(uidir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_zenity_OBJECTS = zenity-about.$(OBJEXT) zenity-calendar.$(OBJEXT) \
+ zenity-entry.$(OBJEXT) zenity-fileselection.$(OBJEXT) \
+ zenity-main.$(OBJEXT) zenity-msg.$(OBJEXT) \
+ zenity-notification.$(OBJEXT) zenity-option.$(OBJEXT) \
+ zenity-progress.$(OBJEXT) zenity-scale.$(OBJEXT) \
+ zenity-text.$(OBJEXT) zenity-tree.$(OBJEXT) \
+ zenity-color.$(OBJEXT) zenity-password.$(OBJEXT) \
+ zenity-util.$(OBJEXT) zenity-forms.$(OBJEXT)
+zenity_OBJECTS = $(am_zenity_OBJECTS)
+am__DEPENDENCIES_1 =
+zenity_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+zenity_LINK = $(CCLD) $(zenity_CFLAGS) $(CFLAGS) $(zenity_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+SCRIPTS = $(bin_SCRIPTS)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(zenity_SOURCES)
+DIST_SOURCES = $(zenity_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DATA = $(ui_DATA)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/gdialog.in \
+ $(top_srcdir)/depcomp
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CFLAGS = @AM_CFLAGS@
+AM_CPPFLAGS = @AM_CPPFLAGS@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_LDFLAGS = @AM_LDFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GREP = @GREP@
+HELP_DIR = @HELP_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+ITSTOOL = @ITSTOOL@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@
+LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POSUB = @POSUB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+WEBKIT_CFLAGS = @WEBKIT_CFLAGS@
+WEBKIT_LIBS = @WEBKIT_LIBS@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+XMLLINT = @XMLLINT@
+X_CFLAGS = @X_CFLAGS@
+X_LIBS = @X_LIBS@
+YELP_LC_DIST = @YELP_LC_DIST@
+YELP_LC_MEDIA_LINKS = @YELP_LC_MEDIA_LINKS@
+ZENITY_CFLAGS = @ZENITY_CFLAGS@
+ZENITY_LIBS = @ZENITY_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+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
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+gdialog: $(top_builddir)/config.status $(srcdir)/gdialog.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+zenity$(EXEEXT): $(zenity_OBJECTS) $(zenity_DEPENDENCIES) $(EXTRA_zenity_DEPENDENCIES)
+ @rm -f zenity$(EXEEXT)
+ $(AM_V_CCLD)$(zenity_LINK) $(zenity_OBJECTS) $(zenity_LDADD) $(LIBS)
+install-binSCRIPTS: $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-about.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-calendar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-color.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-entry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-fileselection.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-forms.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-msg.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-notification.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-option.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-password.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-progress.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-scale.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-text.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-tree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zenity-util.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+zenity-about.o: about.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-about.o -MD -MP -MF $(DEPDIR)/zenity-about.Tpo -c -o zenity-about.o `test -f 'about.c' || echo '$(srcdir)/'`about.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-about.Tpo $(DEPDIR)/zenity-about.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='about.c' object='zenity-about.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-about.o `test -f 'about.c' || echo '$(srcdir)/'`about.c
+
+zenity-about.obj: about.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-about.obj -MD -MP -MF $(DEPDIR)/zenity-about.Tpo -c -o zenity-about.obj `if test -f 'about.c'; then $(CYGPATH_W) 'about.c'; else $(CYGPATH_W) '$(srcdir)/about.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-about.Tpo $(DEPDIR)/zenity-about.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='about.c' object='zenity-about.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-about.obj `if test -f 'about.c'; then $(CYGPATH_W) 'about.c'; else $(CYGPATH_W) '$(srcdir)/about.c'; fi`
+
+zenity-calendar.o: calendar.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-calendar.o -MD -MP -MF $(DEPDIR)/zenity-calendar.Tpo -c -o zenity-calendar.o `test -f 'calendar.c' || echo '$(srcdir)/'`calendar.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-calendar.Tpo $(DEPDIR)/zenity-calendar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='calendar.c' object='zenity-calendar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-calendar.o `test -f 'calendar.c' || echo '$(srcdir)/'`calendar.c
+
+zenity-calendar.obj: calendar.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-calendar.obj -MD -MP -MF $(DEPDIR)/zenity-calendar.Tpo -c -o zenity-calendar.obj `if test -f 'calendar.c'; then $(CYGPATH_W) 'calendar.c'; else $(CYGPATH_W) '$(srcdir)/calendar.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-calendar.Tpo $(DEPDIR)/zenity-calendar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='calendar.c' object='zenity-calendar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-calendar.obj `if test -f 'calendar.c'; then $(CYGPATH_W) 'calendar.c'; else $(CYGPATH_W) '$(srcdir)/calendar.c'; fi`
+
+zenity-entry.o: entry.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-entry.o -MD -MP -MF $(DEPDIR)/zenity-entry.Tpo -c -o zenity-entry.o `test -f 'entry.c' || echo '$(srcdir)/'`entry.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-entry.Tpo $(DEPDIR)/zenity-entry.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='entry.c' object='zenity-entry.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-entry.o `test -f 'entry.c' || echo '$(srcdir)/'`entry.c
+
+zenity-entry.obj: entry.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-entry.obj -MD -MP -MF $(DEPDIR)/zenity-entry.Tpo -c -o zenity-entry.obj `if test -f 'entry.c'; then $(CYGPATH_W) 'entry.c'; else $(CYGPATH_W) '$(srcdir)/entry.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-entry.Tpo $(DEPDIR)/zenity-entry.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='entry.c' object='zenity-entry.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-entry.obj `if test -f 'entry.c'; then $(CYGPATH_W) 'entry.c'; else $(CYGPATH_W) '$(srcdir)/entry.c'; fi`
+
+zenity-fileselection.o: fileselection.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-fileselection.o -MD -MP -MF $(DEPDIR)/zenity-fileselection.Tpo -c -o zenity-fileselection.o `test -f 'fileselection.c' || echo '$(srcdir)/'`fileselection.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-fileselection.Tpo $(DEPDIR)/zenity-fileselection.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fileselection.c' object='zenity-fileselection.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-fileselection.o `test -f 'fileselection.c' || echo '$(srcdir)/'`fileselection.c
+
+zenity-fileselection.obj: fileselection.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-fileselection.obj -MD -MP -MF $(DEPDIR)/zenity-fileselection.Tpo -c -o zenity-fileselection.obj `if test -f 'fileselection.c'; then $(CYGPATH_W) 'fileselection.c'; else $(CYGPATH_W) '$(srcdir)/fileselection.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-fileselection.Tpo $(DEPDIR)/zenity-fileselection.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='fileselection.c' object='zenity-fileselection.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-fileselection.obj `if test -f 'fileselection.c'; then $(CYGPATH_W) 'fileselection.c'; else $(CYGPATH_W) '$(srcdir)/fileselection.c'; fi`
+
+zenity-main.o: main.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-main.o -MD -MP -MF $(DEPDIR)/zenity-main.Tpo -c -o zenity-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-main.Tpo $(DEPDIR)/zenity-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main.c' object='zenity-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
+
+zenity-main.obj: main.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-main.obj -MD -MP -MF $(DEPDIR)/zenity-main.Tpo -c -o zenity-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-main.Tpo $(DEPDIR)/zenity-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='main.c' object='zenity-main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`
+
+zenity-msg.o: msg.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-msg.o -MD -MP -MF $(DEPDIR)/zenity-msg.Tpo -c -o zenity-msg.o `test -f 'msg.c' || echo '$(srcdir)/'`msg.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-msg.Tpo $(DEPDIR)/zenity-msg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msg.c' object='zenity-msg.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-msg.o `test -f 'msg.c' || echo '$(srcdir)/'`msg.c
+
+zenity-msg.obj: msg.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-msg.obj -MD -MP -MF $(DEPDIR)/zenity-msg.Tpo -c -o zenity-msg.obj `if test -f 'msg.c'; then $(CYGPATH_W) 'msg.c'; else $(CYGPATH_W) '$(srcdir)/msg.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-msg.Tpo $(DEPDIR)/zenity-msg.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='msg.c' object='zenity-msg.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-msg.obj `if test -f 'msg.c'; then $(CYGPATH_W) 'msg.c'; else $(CYGPATH_W) '$(srcdir)/msg.c'; fi`
+
+zenity-notification.o: notification.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-notification.o -MD -MP -MF $(DEPDIR)/zenity-notification.Tpo -c -o zenity-notification.o `test -f 'notification.c' || echo '$(srcdir)/'`notification.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-notification.Tpo $(DEPDIR)/zenity-notification.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='notification.c' object='zenity-notification.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-notification.o `test -f 'notification.c' || echo '$(srcdir)/'`notification.c
+
+zenity-notification.obj: notification.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-notification.obj -MD -MP -MF $(DEPDIR)/zenity-notification.Tpo -c -o zenity-notification.obj `if test -f 'notification.c'; then $(CYGPATH_W) 'notification.c'; else $(CYGPATH_W) '$(srcdir)/notification.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-notification.Tpo $(DEPDIR)/zenity-notification.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='notification.c' object='zenity-notification.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-notification.obj `if test -f 'notification.c'; then $(CYGPATH_W) 'notification.c'; else $(CYGPATH_W) '$(srcdir)/notification.c'; fi`
+
+zenity-option.o: option.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-option.o -MD -MP -MF $(DEPDIR)/zenity-option.Tpo -c -o zenity-option.o `test -f 'option.c' || echo '$(srcdir)/'`option.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-option.Tpo $(DEPDIR)/zenity-option.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='option.c' object='zenity-option.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-option.o `test -f 'option.c' || echo '$(srcdir)/'`option.c
+
+zenity-option.obj: option.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-option.obj -MD -MP -MF $(DEPDIR)/zenity-option.Tpo -c -o zenity-option.obj `if test -f 'option.c'; then $(CYGPATH_W) 'option.c'; else $(CYGPATH_W) '$(srcdir)/option.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-option.Tpo $(DEPDIR)/zenity-option.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='option.c' object='zenity-option.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-option.obj `if test -f 'option.c'; then $(CYGPATH_W) 'option.c'; else $(CYGPATH_W) '$(srcdir)/option.c'; fi`
+
+zenity-progress.o: progress.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-progress.o -MD -MP -MF $(DEPDIR)/zenity-progress.Tpo -c -o zenity-progress.o `test -f 'progress.c' || echo '$(srcdir)/'`progress.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-progress.Tpo $(DEPDIR)/zenity-progress.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='progress.c' object='zenity-progress.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-progress.o `test -f 'progress.c' || echo '$(srcdir)/'`progress.c
+
+zenity-progress.obj: progress.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-progress.obj -MD -MP -MF $(DEPDIR)/zenity-progress.Tpo -c -o zenity-progress.obj `if test -f 'progress.c'; then $(CYGPATH_W) 'progress.c'; else $(CYGPATH_W) '$(srcdir)/progress.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-progress.Tpo $(DEPDIR)/zenity-progress.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='progress.c' object='zenity-progress.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-progress.obj `if test -f 'progress.c'; then $(CYGPATH_W) 'progress.c'; else $(CYGPATH_W) '$(srcdir)/progress.c'; fi`
+
+zenity-scale.o: scale.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-scale.o -MD -MP -MF $(DEPDIR)/zenity-scale.Tpo -c -o zenity-scale.o `test -f 'scale.c' || echo '$(srcdir)/'`scale.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-scale.Tpo $(DEPDIR)/zenity-scale.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scale.c' object='zenity-scale.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-scale.o `test -f 'scale.c' || echo '$(srcdir)/'`scale.c
+
+zenity-scale.obj: scale.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-scale.obj -MD -MP -MF $(DEPDIR)/zenity-scale.Tpo -c -o zenity-scale.obj `if test -f 'scale.c'; then $(CYGPATH_W) 'scale.c'; else $(CYGPATH_W) '$(srcdir)/scale.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-scale.Tpo $(DEPDIR)/zenity-scale.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scale.c' object='zenity-scale.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-scale.obj `if test -f 'scale.c'; then $(CYGPATH_W) 'scale.c'; else $(CYGPATH_W) '$(srcdir)/scale.c'; fi`
+
+zenity-text.o: text.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-text.o -MD -MP -MF $(DEPDIR)/zenity-text.Tpo -c -o zenity-text.o `test -f 'text.c' || echo '$(srcdir)/'`text.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-text.Tpo $(DEPDIR)/zenity-text.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='text.c' object='zenity-text.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-text.o `test -f 'text.c' || echo '$(srcdir)/'`text.c
+
+zenity-text.obj: text.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-text.obj -MD -MP -MF $(DEPDIR)/zenity-text.Tpo -c -o zenity-text.obj `if test -f 'text.c'; then $(CYGPATH_W) 'text.c'; else $(CYGPATH_W) '$(srcdir)/text.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-text.Tpo $(DEPDIR)/zenity-text.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='text.c' object='zenity-text.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-text.obj `if test -f 'text.c'; then $(CYGPATH_W) 'text.c'; else $(CYGPATH_W) '$(srcdir)/text.c'; fi`
+
+zenity-tree.o: tree.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-tree.o -MD -MP -MF $(DEPDIR)/zenity-tree.Tpo -c -o zenity-tree.o `test -f 'tree.c' || echo '$(srcdir)/'`tree.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-tree.Tpo $(DEPDIR)/zenity-tree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tree.c' object='zenity-tree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-tree.o `test -f 'tree.c' || echo '$(srcdir)/'`tree.c
+
+zenity-tree.obj: tree.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-tree.obj -MD -MP -MF $(DEPDIR)/zenity-tree.Tpo -c -o zenity-tree.obj `if test -f 'tree.c'; then $(CYGPATH_W) 'tree.c'; else $(CYGPATH_W) '$(srcdir)/tree.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-tree.Tpo $(DEPDIR)/zenity-tree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tree.c' object='zenity-tree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-tree.obj `if test -f 'tree.c'; then $(CYGPATH_W) 'tree.c'; else $(CYGPATH_W) '$(srcdir)/tree.c'; fi`
+
+zenity-color.o: color.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-color.o -MD -MP -MF $(DEPDIR)/zenity-color.Tpo -c -o zenity-color.o `test -f 'color.c' || echo '$(srcdir)/'`color.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-color.Tpo $(DEPDIR)/zenity-color.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='color.c' object='zenity-color.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-color.o `test -f 'color.c' || echo '$(srcdir)/'`color.c
+
+zenity-color.obj: color.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-color.obj -MD -MP -MF $(DEPDIR)/zenity-color.Tpo -c -o zenity-color.obj `if test -f 'color.c'; then $(CYGPATH_W) 'color.c'; else $(CYGPATH_W) '$(srcdir)/color.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-color.Tpo $(DEPDIR)/zenity-color.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='color.c' object='zenity-color.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-color.obj `if test -f 'color.c'; then $(CYGPATH_W) 'color.c'; else $(CYGPATH_W) '$(srcdir)/color.c'; fi`
+
+zenity-password.o: password.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-password.o -MD -MP -MF $(DEPDIR)/zenity-password.Tpo -c -o zenity-password.o `test -f 'password.c' || echo '$(srcdir)/'`password.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-password.Tpo $(DEPDIR)/zenity-password.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='password.c' object='zenity-password.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-password.o `test -f 'password.c' || echo '$(srcdir)/'`password.c
+
+zenity-password.obj: password.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-password.obj -MD -MP -MF $(DEPDIR)/zenity-password.Tpo -c -o zenity-password.obj `if test -f 'password.c'; then $(CYGPATH_W) 'password.c'; else $(CYGPATH_W) '$(srcdir)/password.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-password.Tpo $(DEPDIR)/zenity-password.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='password.c' object='zenity-password.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-password.obj `if test -f 'password.c'; then $(CYGPATH_W) 'password.c'; else $(CYGPATH_W) '$(srcdir)/password.c'; fi`
+
+zenity-util.o: util.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-util.o -MD -MP -MF $(DEPDIR)/zenity-util.Tpo -c -o zenity-util.o `test -f 'util.c' || echo '$(srcdir)/'`util.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-util.Tpo $(DEPDIR)/zenity-util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util.c' object='zenity-util.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-util.o `test -f 'util.c' || echo '$(srcdir)/'`util.c
+
+zenity-util.obj: util.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-util.obj -MD -MP -MF $(DEPDIR)/zenity-util.Tpo -c -o zenity-util.obj `if test -f 'util.c'; then $(CYGPATH_W) 'util.c'; else $(CYGPATH_W) '$(srcdir)/util.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-util.Tpo $(DEPDIR)/zenity-util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='util.c' object='zenity-util.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-util.obj `if test -f 'util.c'; then $(CYGPATH_W) 'util.c'; else $(CYGPATH_W) '$(srcdir)/util.c'; fi`
+
+zenity-forms.o: forms.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-forms.o -MD -MP -MF $(DEPDIR)/zenity-forms.Tpo -c -o zenity-forms.o `test -f 'forms.c' || echo '$(srcdir)/'`forms.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-forms.Tpo $(DEPDIR)/zenity-forms.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='forms.c' object='zenity-forms.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-forms.o `test -f 'forms.c' || echo '$(srcdir)/'`forms.c
+
+zenity-forms.obj: forms.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -MT zenity-forms.obj -MD -MP -MF $(DEPDIR)/zenity-forms.Tpo -c -o zenity-forms.obj `if test -f 'forms.c'; then $(CYGPATH_W) 'forms.c'; else $(CYGPATH_W) '$(srcdir)/forms.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/zenity-forms.Tpo $(DEPDIR)/zenity-forms.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='forms.c' object='zenity-forms.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(zenity_CPPFLAGS) $(CPPFLAGS) $(zenity_CFLAGS) $(CFLAGS) -c -o zenity-forms.obj `if test -f 'forms.c'; then $(CYGPATH_W) 'forms.c'; else $(CYGPATH_W) '$(srcdir)/forms.c'; fi`
+install-uiDATA: $(ui_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(ui_DATA)'; test -n "$(uidir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(uidir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(uidir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(uidir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(uidir)" || exit $$?; \
+ done
+
+uninstall-uiDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(ui_DATA)'; test -n "$(uidir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(uidir)'; $(am__uninstall_files_from_dir)
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(uidir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-uiDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-binSCRIPTS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
+ uninstall-uiDATA
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+ clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \
+ distclean distclean-compile distclean-generic distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-binPROGRAMS install-binSCRIPTS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip install-uiDATA \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-binSCRIPTS \
+ uninstall-uiDATA
+
+.PRECIOUS: Makefile
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/about.c b/src/about.c
new file mode 100644
index 00000000..627aa1ea
--- /dev/null
+++ b/src/about.c
@@ -0,0 +1,329 @@
+/*
+ * about.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright (C) 2001 CodeFactory AB
+ * Copyright (C) 2001, 2002 Anders Carlsson
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Glynn Foster <glynn.foster@sun.com>
+ * 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/"
+
+#define ZENITY_CANVAS_X 400.0
+#define ZENITY_CANVAS_Y 280.0
+
+static GtkWidget *dialog;
+
+static void zenity_about_dialog_response (
+ GtkWidget *widget, int response, gpointer data);
+
+/* Sync with the people in the THANKS file */
+static const gchar *const authors[] = {"Glynn Foster <glynn foster sun com>",
+ "Lucas Rocha <lucasr gnome org>",
+ "Mike Newman <mikegtn gnome org>",
+ NULL};
+
+static const char *documenters[] = {"Glynn Foster <glynn.foster@sun.com>",
+ "Lucas Rocha <lucasr@gnome.org>",
+ "Java Desktop System Documentation Team",
+ "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 "
+ "published by "
+ "the Free Software Foundation; either version 2 of the License, or "
+ "(at your option) any later version.\n"),
+ N_ ("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 Lesser General Public License for more details.\n"),
+ N_ ("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.")};
+
+#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;
+ 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);
+
+ dialog = gtk_about_dialog_new ();
+
+ g_object_set (G_OBJECT (dialog),
+ "name",
+ "Zenity",
+ "version",
+ VERSION,
+ "copyright",
+ "Copyright \xc2\xa9 2003 Sun Microsystems",
+ "comments",
+ _ ("Display dialog boxes from shell scripts"),
+ "authors",
+ authors,
+ "documenters",
+ documenters,
+ "translator-credits",
+ translators,
+ "website",
+ "http://live.gnome.org/Zenity",
+ "logo",
+ logo,
+ "wrap-license",
+ TRUE,
+ "license",
+ license_trans,
+ 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
+
+ zenity_util_show_dialog (dialog, data->attach);
+ gtk_main ();
+}
+
+static void
+zenity_about_dialog_response (GtkWidget *widget, int response, 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 ();
+}
diff --git a/src/calendar.c b/src/calendar.c
new file mode 100644
index 00000000..9aaf927f
--- /dev/null
+++ b/src/calendar.c
@@ -0,0 +1,180 @@
+/*
+ * calendar.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Glynn Foster <glynn.foster@sun.com>
+ */
+
+#include "config.h"
+
+#include "util.h"
+#include "zenity.h"
+#include <time.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);
+
+void
+zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data) {
+ GtkBuilder *builder;
+ GtkWidget *dialog;
+ GtkWidget *button;
+ GObject *text;
+
+ zen_cal_data = cal_data;
+
+ builder = zenity_util_load_ui_file ("zenity_calendar_dialog", 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_calendar_dialog"));
+
+ g_signal_connect (G_OBJECT (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"));
+
+ 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);
+
+ 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));
+
+ 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_signal_connect (calendar,
+ "day-selected-double-click",
+ G_CALLBACK (zenity_calendar_double_click),
+ data);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (text), calendar);
+ zenity_util_show_dialog (dialog, data->attach);
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ 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->ok_label) {
+ button = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_calendar_ok_button"));
+ gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
+ }
+
+ if (data->cancel_label) {
+ 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 ();
+}
+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);
+ g_print ("%s\n", time_string);
+
+ if (date != NULL)
+ g_date_free (date);
+}
+
+static void
+zenity_calendar_dialog_response (
+ GtkWidget *widget, int response, gpointer data) {
+ ZenityData *zen_data;
+
+ zen_data = data;
+
+ switch (response) {
+ case GTK_RESPONSE_OK:
+ zenity_calendar_dialog_output ();
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
+ case ZENITY_TIMEOUT:
+ zenity_calendar_dialog_output ();
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_TIMEOUT);
+ break;
+
+ default:
+ if (zen_data->extra_label &&
+ response < 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);
+}
diff --git a/src/color.c b/src/color.c
new file mode 100644
index 00000000..9ef233eb
--- /dev/null
+++ b/src/color.c
@@ -0,0 +1,118 @@
+/*
+ * color.c
+ *
+ * Copyright (C) 2010 Berislav Kovacki
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Berislav Kovacki <pantokrator@pantokrator.net>
+ */
+
+#include "config.h"
+
+#include "util.h"
+#include "zenity.h"
+#include <string.h>
+
+static ZenityData *zen_data;
+
+static void zenity_colorselection_dialog_response (
+ GtkWidget *widget, int response, gpointer data);
+
+void
+zenity_colorselection (ZenityData *data, ZenityColorData *color_data) {
+ GtkWidget *dialog;
+ GtkWidget *button;
+ GdkRGBA color;
+
+ zen_data = data;
+
+ dialog = gtk_color_chooser_dialog_new (data->dialog_title, NULL);
+
+ g_signal_connect (G_OBJECT (dialog),
+ "response",
+ G_CALLBACK (zenity_colorselection_dialog_response),
+ color_data);
+
+ if (color_data->color) {
+ if (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->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);
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ dialog);
+ }
+
+ gtk_main ();
+}
+
+static void
+zenity_colorselection_dialog_response (
+ GtkWidget *widget, int response, gpointer data) {
+ GdkRGBA color;
+
+ 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);
+ g_print ("%s\n", gdk_rgba_to_string (&color));
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
+ default:
+ if (zen_data->extra_label &&
+ response < 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 ();
+}
diff --git a/src/entry.c b/src/entry.c
new file mode 100644
index 00000000..bf3db713
--- /dev/null
+++ b/src/entry.c
@@ -0,0 +1,211 @@
+/*
+ * entry.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * 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);
+
+static GtkWidget *entry;
+static gint 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++;
+ }
+}
+
+static void
+zenity_entry_combo_activate_default (GtkEntry *entry, gpointer window) {
+ gtk_window_activate_default (GTK_WINDOW (window));
+}
+
+void
+zenity_entry (ZenityData *data, ZenityEntryData *entry_data) {
+ GtkBuilder *builder = NULL;
+ GtkWidget *dialog;
+ GtkWidget *button;
+ GObject *text;
+ GSList *entries = NULL;
+ GSList *tmp;
+ GObject *vbox;
+
+ builder = zenity_util_load_ui_file ("zenity_entry_dialog", NULL);
+
+ 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"));
+
+ g_signal_connect (G_OBJECT (dialog),
+ "response",
+ G_CALLBACK (zenity_entry_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-entry.png"));
+
+ 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++;
+ }
+ }
+
+ 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);
+ }
+
+ 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));
+
+ vbox = gtk_builder_get_object (builder, "vbox4");
+
+ zenity_entry_fill_entries (&entries, entry_data->data);
+
+ n_entries = g_slist_length (entries);
+
+ if (n_entries > 1) {
+ entry = gtk_combo_box_text_new_with_entry ();
+
+ 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);
+ }
+
+ g_signal_connect (gtk_bin_get_child (GTK_BIN (entry)),
+ "activate",
+ G_CALLBACK (zenity_entry_combo_activate_default),
+ GTK_WINDOW (dialog));
+ } else {
+ entry = gtk_entry_new ();
+
+ 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->hide_text)
+ g_object_set (G_OBJECT (entry), "visibility", FALSE, NULL);
+ }
+
+ gtk_widget_show (entry);
+
+ gtk_box_pack_end (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (text), entry);
+
+ g_object_unref (builder);
+
+ zenity_util_show_dialog (dialog, data->attach);
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ dialog);
+ }
+
+ gtk_main ();
+}
+
+static void
+zenity_entry_dialog_output (void) {
+ const gchar *text;
+ if (n_entries > 1)
+ text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (entry));
+ else
+ text = gtk_entry_get_text (GTK_ENTRY (entry));
+
+ if (text != NULL)
+ g_print ("%s\n", text);
+}
+
+static void
+zenity_entry_dialog_response (GtkWidget *widget, int response, gpointer data) {
+ ZenityData *zen_data = data;
+
+ switch (response) {
+ case GTK_RESPONSE_OK:
+ zenity_entry_dialog_output ();
+ zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
+ case ZENITY_TIMEOUT:
+ zenity_entry_dialog_output ();
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_TIMEOUT);
+ break;
+
+ default:
+ if (zen_data->extra_label &&
+ response < 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 ();
+}
diff --git a/src/fileselection.c b/src/fileselection.c
new file mode 100644
index 00000000..465f08ae
--- /dev/null
+++ b/src/fileselection.c
@@ -0,0 +1,238 @@
+/*
+ * fileselection.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Glynn Foster <glynn.foster@sun.com>
+ */
+
+#include "config.h"
+
+#include "util.h"
+#include "zenity.h"
+#include <string.h>
+
+static ZenityData *zen_data;
+
+static void zenity_fileselection_dialog_response (
+ gpointer obj, int response, gpointer data);
+
+void
+zenity_fileselection (ZenityData *data, ZenityFileData *file_data) {
+ gchar *dir;
+ gchar *basename;
+ 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;
+ }
+
+#if GTK_CHECK_VERSION(3, 20, 0)
+ dialog = gtk_file_chooser_native_new (data->dialog_title,
+ NULL, /* TODO: Get parent from xid */
+ action,
+ _ ("_OK"),
+ _ ("_Cancel"));
+
+ if (data->modal)
+ 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);
+
+ if (data->modal)
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+
+ zenity_util_set_window_icon (
+ dialog, data->window_icon, ZENITY_IMAGE_FULLPATH ("zenity-file.png"));
+
+ 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++;
+ }
+ }
+#endif
+
+ gtk_file_chooser_set_do_overwrite_confirmation (
+ GTK_FILE_CHOOSER (dialog), file_data->confirm_overwrite);
+
+ g_signal_connect (G_OBJECT (dialog),
+ "response",
+ G_CALLBACK (zenity_fileselection_dialog_response),
+ file_data);
+
+ if (file_data->uri) {
+ dir = g_path_get_dirname (file_data->uri);
+
+ if (g_path_is_absolute (file_data->uri) == TRUE)
+ gtk_file_chooser_set_current_folder (
+ GTK_FILE_CHOOSER (dialog), dir);
+
+ 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_free (dir);
+ }
+
+ if (file_data->multi)
+ gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
+
+ if (file_data->filter) {
+ /* Filter format: Executables | *.exe *.bat *.com */
+ gint filter_i;
+
+ for (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;
+
+ /* Set name */
+ for (i = 0; filter_str[i] != '\0'; i++)
+ if (filter_str[i] == '|')
+ break;
+
+ if (filter_str[i] == '|') {
+ name = g_strndup (filter_str, i);
+ g_strstrip (name);
+ }
+
+ if (name) {
+ gtk_file_filter_set_name (filter, name);
+
+ /* Point i to the right position for split */
+ for (++i; filter_str[i] == ' '; i++)
+ ;
+ } else {
+ gtk_file_filter_set_name (filter, filter_str);
+ i = 0;
+ }
+
+ /* Get patterns */
+ patterns = g_strsplit_set (filter_str + i, " ", -1);
+
+ for (pattern = patterns; *pattern; pattern++)
+ gtk_file_filter_add_pattern (filter, *pattern);
+
+ if (name)
+ g_free (name);
+
+ g_strfreev (patterns);
+
+ 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,
+ (GSourceFunc) zenity_util_timeout_handle,
+ dialog);
+ }
+
+ gtk_main ();
+}
+
+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)
+ g_print ("%s", file_data->separator);
+ }
+ g_print ("\n");
+ g_slist_free (selections);
+}
+
+static void
+zenity_fileselection_dialog_response (
+ gpointer obj, int response, gpointer data) {
+ ZenityFileData *file_data = data;
+
+ GtkFileChooser *chooser = GTK_FILE_CHOOSER (obj);
+
+ switch (response) {
+ case GTK_RESPONSE_ACCEPT:
+ zenity_fileselection_dialog_output (chooser, file_data);
+ zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
+ case ZENITY_TIMEOUT:
+ zenity_fileselection_dialog_output (chooser, file_data);
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_TIMEOUT);
+ break;
+
+ default:
+ if (zen_data->extra_label &&
+ response < 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 ();
+}
diff --git a/src/forms.c b/src/forms.c
new file mode 100644
index 00000000..4e6fca5d
--- /dev/null
+++ b/src/forms.c
@@ -0,0 +1,411 @@
+/*
+ * forms.c
+ *
+ * Copyright (C) 2010 Arx Cruz
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 121 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Arx Cruz <arxcruz@gnome.org>
+ */
+
+#include "config.h"
+#include "util.h"
+#include "zenity.h"
+#include <string.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_get_selected (GtkTreeModel *model, GtkTreePath *path_buf,
+ GtkTreeIter *iter, GtkTreeView *tree_view) {
+ gint n_columns = 0;
+ gint i = 0;
+ GValue value = {
+ 0,
+ };
+
+ n_columns = gtk_tree_model_get_n_columns (model);
+ 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));
+ g_value_unset (&value);
+ }
+}
+
+static GtkWidget *
+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 =
+ 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;
+ GtkTreeIter iter;
+ gchar *row = row_values[i];
+
+ while (row != NULL) {
+ gtk_list_store_append (list_store, &iter);
+ gtk_list_store_set (list_store, &iter, 0, row, -1);
+ row = row_values[++i];
+ }
+ g_strfreev (row_values);
+ }
+ g_free (combo_values);
+ }
+ }
+
+ combo_box = gtk_combo_box_new_with_model (GTK_TREE_MODEL (list_store));
+ g_object_unref (G_OBJECT (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);
+
+ return combo_box;
+}
+
+static GtkWidget *
+zenity_forms_create_and_fill_list (
+ ZenityFormsData *forms_data, int list_number, gchar *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;
+ /* If no column names available, default is one */
+ gint n_columns = 1;
+ gint column_index = 0;
+
+ tree_view = gtk_tree_view_new ();
+
+ if (forms_data->column_values) {
+ column_values =
+ g_slist_nth_data (forms_data->column_values, list_number);
+ if (column_values) {
+ gchar **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];
+ 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_index++;
+ }
+ }
+ }
+ }
+
+ list_store = g_object_new (GTK_TYPE_LIST_STORE, NULL);
+
+ 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) {
+ GtkTreeIter iter;
+ gchar *row = row_values[0];
+ gint position = -1;
+ i = 0;
+
+ while (row != NULL) {
+ if (position >= n_columns || position == -1) {
+ position = 0;
+ gtk_list_store_append (list_store, &iter);
+ }
+ gtk_list_store_set (list_store, &iter, position, row, -1);
+ position++;
+ row = row_values[++i];
+ }
+ g_strfreev (row_values);
+ }
+ g_free (list_values);
+ }
+ }
+
+ 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_headers_visible (
+ GTK_TREE_VIEW (tree_view), forms_data->show_header);
+
+ return scrolled_window;
+}
+
+void
+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;
+
+ zen_data = data;
+
+ builder = zenity_util_load_ui_file ("zenity_forms_dialog", 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_forms_dialog"));
+
+ g_signal_connect (G_OBJECT (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++;
+ }
+ }
+
+ if (data->ok_label) {
+ button = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_forms_ok_button"));
+ gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
+ }
+
+ if (data->cancel_label) {
+ button = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_forms_cancel_button"));
+ gtk_button_set_label (GTK_BUTTON (button), data->cancel_label);
+ }
+
+ text = GTK_WIDGET (gtk_builder_get_object (builder, "zenity_forms_text"));
+
+ if (forms_data->dialog_text)
+ gtk_label_set_markup (
+ GTK_LABEL (text), g_strcompress (forms_data->dialog_text));
+
+ 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;
+ 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) {
+ 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);
+ 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);
+ list_count++;
+ break;
+ case ZENITY_FORMS_COMBO:
+ zenity_value->forms_widget =
+ zenity_forms_create_and_fill_combo (
+ forms_data, combo_count);
+ combo_count++;
+ break;
+ default:
+ zenity_value->forms_widget = gtk_entry_new ();
+ break;
+ }
+
+ gtk_grid_attach_next_to (GTK_GRID (grid),
+ GTK_WIDGET (zenity_value->forms_widget),
+ label,
+ GTK_POS_RIGHT,
+ 1,
+ 1);
+
+ i++;
+ }
+
+ gtk_widget_show_all (GTK_WIDGET (dialog));
+
+ g_object_unref (builder);
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ dialog);
+ }
+
+ gtk_main ();
+}
+
+static void
+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;
+ 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) {
+ case ZENITY_FORMS_PASSWORD:
+ case ZENITY_FORMS_ENTRY:
+ g_print ("%s",
+ gtk_entry_get_text (
+ 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))));
+ 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))));
+
+ for (tmp2 = selected; tmp2; tmp2 = tmp2->next) {
+ if (tmp->next != NULL) {
+ g_print ("%s,", (gchar *) tmp2->data);
+ } else
+ g_print ("%s", (gchar *) tmp2->data);
+ }
+
+ g_slist_foreach (selected, (GFunc) g_free, NULL);
+ selected = NULL;
+
+ break;
+ case ZENITY_FORMS_CALENDAR:
+ gtk_calendar_get_date (
+ GTK_CALENDAR (zenity_value->forms_widget),
+ &day,
+ &month,
+ &year);
+ date = g_date_new_dmy (year, month + 1, day);
+ 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),
+ &iter,
+ 0,
+ &combo_value,
+ -1);
+ g_object_unref (G_OBJECT (list_store));
+
+ g_print ("%s", combo_value);
+ g_free (combo_value);
+ } else
+ g_print (" ");
+ break;
+ }
+ if (tmp->next != NULL)
+ g_print ("%s", forms_data->separator);
+ }
+ g_print ("\n");
+}
+
+static void
+zenity_forms_dialog_response (GtkWidget *widget, int response, gpointer data) {
+ ZenityFormsData *forms_data = (ZenityFormsData *) data;
+
+ switch (response) {
+ case GTK_RESPONSE_OK:
+ zenity_forms_dialog_output (forms_data);
+ zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
+ case ZENITY_TIMEOUT:
+ zenity_forms_dialog_output (forms_data);
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_TIMEOUT);
+ break;
+
+ default:
+ if (zen_data->extra_label &&
+ response < 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 ();
+}
diff --git a/src/gdialog b/src/gdialog
new file mode 100644
index 00000000..4e2da777
--- /dev/null
+++ b/src/gdialog
@@ -0,0 +1,353 @@
+#!/usr/bin/perl
+
+# gdialog -> zenity conversion wrapper
+#
+# by Mike Newman <mikegtn@gnome.org>
+#
+# This is all, of course, horrible - but it should translate
+# most commond gdialog types to zenity equivalents. It will mostly drop
+# the pointless and unused (even by gdialog!) size arguments
+# but hopefully will translate all the others.
+#
+# For testing purposes, I've used a couple of the nautilus scripts
+# available at http://g-scripts.sourceforge.net - what is sometimes
+# unclear is what is a gdialog/zenity translation problem, and what is
+# a problem with the original script
+
+my @command = ("zenity"); # the command line we build up to execute
+my $element = ""; # current bit of command line
+my $argn = 0; # counter for walking args
+my $args = $#ARGV + 1; # total number of command line arguments
+my $separator = 0; # set if --separate-output is in use
+
+
+# Additon by: Kevin C. Krinke (kck) <kckrinke@opendoorsoftware.com>
+#
+# gdialog itself supports both the X-Windows interface as well as a console
+# interface. Here's a fix to use regular dialog when appropriate.
+# This should probably be a more advanced test of some sort, but I don't know
+# of any other easy way of detecting and X-Windows environment. If someone does
+# know better, please let me know. So for now this works: "no DISPLAY; no X".
+
+unless (defined $ENV{'DISPLAY'} && length($ENV{'DISPLAY'})) {
+
+ # reset the command string
+
+ @command = ();
+
+ # examine all the available/default paths
+
+ my $PATHS = ($ENV{'PATH'}||'/bin:/usr/bin:/usr/local/bin:/opt/bin');
+
+ BIN: foreach my $PATH (split(/\:/,$PATHS)) {
+
+ if (-x $PATH."/gdialog.real") {
+
+ # Some GNU/Linux distributions divert binaries when
+ # other packages are installed. If this exists, chances
+ # are it's the real gdialog and not the Zenity wrapper.
+ # gdialog has full support for the Console medium and
+ # as such is the preference over using the "regular"
+ # dialog interface.
+
+ @command = ($PATH."/gdialog.real");
+ last BIN;
+
+ } elsif (-x $PATH."/dialog") {
+
+ # change the command and skip ahead!
+
+ @command = ($PATH."/dialog");
+ last BIN;
+
+ }
+
+
+ }
+
+ unless (@command) {
+
+ # we didn't find the dialog binary, exit(254) with a message
+ # to STDERR.
+
+ print STDERR "missing DISPLAY and a console dialog could".
+ " not be found.\n";
+
+ # exit code 254 is used because 255, 1, 2, 3 are used by Zenity
+ # and cDialog. This error, is a very _bad_ error so it's semi-
+ # non-standard at 254.
+
+ exit(254);
+
+ }
+
+ # all is well if we've made it this far
+
+ # so join the arguments double-quoting things so that proper shell
+ # notation is saved.
+
+ push @command, @ARGV;
+
+ # and fork the process
+
+ exec(@command);
+
+}
+
+# Got DISPLAY, has X continue as normal...
+# End Addtition by: KCK
+
+# this just loads the current arg into $element
+
+sub get_arg () {
+ $element = $ARGV[$argn];
+}
+
+# walk the command line
+
+ARG: while ($argn < $args) {
+
+ get_arg;
+
+# Informational stuff
+
+ if ($element eq "--help" || $element eq "--about") {
+ print ( "gdialog is a compatibility wrapper around zenity, " .
+ "provided to hopefully\nallow older scripts to run. " .
+ "If you are reading this message, you should\n" .
+ "probably be using zenity directly\n\n" .
+ "type: 'zenity --help' or 'man zenity' for more information\n");
+ exit (1);
+ }
+
+# Section 1 : Args which gdialog expects BEFORE box options
+# --clear, --backtitle have no obvious effect - ignored
+
+ if ($element eq "--title") {
+
+ # --title argument is almost analogous in gdialog and
+ # zenity - so pass it almost entirely as is
+
+ $argn++;
+ get_arg;
+ push @command, "--title=$element";
+
+ # keep processing args
+ $argn++;
+ next ARG;
+ }
+
+ if ($element eq "--separate-output") {
+
+ # set the flag to pring list output line by line
+ $separator = 1;
+
+ # keep processing args
+ $argn++;
+ next ARG;
+ }
+
+# Section 2 : Box Options and subsequent args
+
+ if ($element eq "--msgbox" || $element eq "--infobox") {
+
+ # This bit is common to almost all of the dialogs
+ # the arg following the dialog type in gdialog is usually
+ # equivalent to zenity's --text arg.
+
+ $argn++;
+ get_arg;
+ push @command, "--info", "--text=$element";
+
+ # this also happens a lot - gdialog accepted size args
+ # for dialog compatability - which it pretty much ignored
+ # and we will do the same
+
+ $argn+=2;
+ last ARG;
+ }
+
+ if ($element eq "--yesno") {
+
+ # this will silently ignore the gdialog option to set
+ # the default button in question dialogs - which is
+ # highly hig-norant anyway!
+
+ $argn++;
+ get_arg;
+ push @command, "--question", "--text=$element";
+ last ARG;
+ }
+
+ if ($element eq "--inputbox") {
+ $argn++;
+ get_arg;
+ push @command, "--entry", "--text=$element";
+
+ # ignore size elements and maybe there is some
+ # default text to initialize the entry with?
+
+ $argn+=3;
+ get_arg;
+ push @command, "--entry-text=$element";
+ last ARG;
+ }
+
+ if ($element eq "--textbox") {
+ push @command, "--text-info";
+
+ # the arg immediately following the dialog type in
+ # gdialog is the filename, so pass this to zenity
+
+ $argn++;
+ get_arg;
+ push @command, "--filename=$element";
+
+ # width and height matter for this one, so get them
+ # and apply the same multipliers as used in gdialog
+
+ $argn++;
+ get_arg;
+ $element = $element * 7;
+ push @command, "--height=$element";
+ $argn++;
+ get_arg;
+ $element = $element * 8;
+ push @command, "--width=$element";
+ last ARG;
+ }
+
+ if ($element eq "--checklist" || $element eq "--radiolist") {
+ $list=$element;
+ $argn++;
+ get_arg;
+
+ # Conveniently, zenity and gdialog use the same names
+ # for list types, so pass this to zenity intact along with
+ # an untitled column for the check or radio buttons
+ # and the 'text' arg as a second column header
+
+ push @command, "--list", $list, "--column=''", "--column=''", "--column", $element;
+
+ # should output be line by line?
+ if ($separator) {
+ push @command, "--separator=\n";
+ }
+
+ # Skip to the first 'item' arg of the list content
+ # bypassing height, width and list-height
+ # from here args run [tag] [item] [status] ...
+
+ $argn += 4;
+
+ # Loop over the remainder of the commandline
+ # discarding the 'status' args of each item
+ # and using the 'item' for display in our second column
+ # also pass a fake NULL argument since zenity can't set
+ # the status of a row like gdialog can
+
+ while ($argn < $args) {
+ get_arg;
+ push @command, "NULL", $element;
+ $argn += 1;
+ get_arg;
+ push @command, $element;
+ $argn += 2;
+ }
+ last ARG;
+ }
+
+ if ($element eq "--menu") {
+ $list=$element;
+ $argn++;
+ get_arg;
+
+ # a gdialog --menu is just a two column zenity --list
+ # Leave the first column blank (not provided)
+ # Use the 'text' arg as a second column header
+ # FIXME: or should it be the dialog text, or both?
+
+ push @command, "--list", "--column", "", "--column", $element;
+
+ # Skip to the first 'item' arg of the list content
+ # after using height, width and bypassing list-height
+ # from here args run [tag] [item] ...
+
+ $argn += 1;
+
+ get_arg;
+ # Height and width in characters to be displayed, so adjust
+ # cdialog uses 6 height for non-list, zenity uses ~24 pixels
+ # per list entry (default font), and 103 pixels for non-list
+ # This appears to be almost exact
+ $element = $element*24 - 35;
+ push @command, "--height", $element;
+
+ $argn += 1;
+ get_arg;
+ # cdialog uses 6 width for non-list, zenity uses ~7 pixels
+ # per character (default font), and 22 pixels for non-list
+ # This is not exact, but close enough
+ $element = $element*7 - 20;
+ push @command, "--width", $element;
+
+ $argn += 2;
+
+ # Loop over the remainder of the commandline
+ # keeping 'tag' args of each item (required to return)
+ # and using the 'item' for display in our second column
+
+ while ($argn < $args) {
+ get_arg;
+ push @command, $element;
+ $argn += 1;
+ }
+ last ARG;
+ }
+
+ if ($element eq "--gauge") {
+ $argn++;
+ get_arg;
+ push @command, "--progress", "--text=$element";
+
+ # discard the size args as usually, and see if
+ # a percentage value was supplied to initialize the
+ # dialog
+
+ $argn += 3;
+ get_arg;
+ if ($element) {
+ push @command, "--percentage=$element";
+ }
+ last ARG;
+ }
+
+ $argn++;
+}
+
+# save STDOUT and STDERR
+open(ORG_STDOUT, ">&STDOUT");
+open(ORG_STDERR, ">&STDERR");
+
+# redirect STDERR to /dev/null (GTK messages ie:
+# (zenity:637): Gtk-WARNING **: Unable to locate theme engine in module_path: "mist",)
+open(STDERR, ">/dev/null");
+
+# redirect STDOUT to STDERR (gdialog direct output to STDERR by default)
+open(STDOUT, ">&ORG_STDERR");
+
+# execute the constructed zenity command line
+
+# perl doc: The return value of system() is the exit status of the
+#program as returned by the wait() call. To get the actual exit value
+# divide by 256.
+
+my $return = system(@command)/256;
+
+# restore STDOUT and STDERR
+open(STDOUT, ">&ORG_STDOUT");
+open(STDERR, ">&ORG_STDERR");
+close(ORG_STDOUT);
+close(ORG_STDERR);
+
+exit $return;
diff --git a/src/gdialog.in b/src/gdialog.in
new file mode 100755
index 00000000..2fc46336
--- /dev/null
+++ b/src/gdialog.in
@@ -0,0 +1,353 @@
+#!@PERL@
+
+# gdialog -> zenity conversion wrapper
+#
+# by Mike Newman <mikegtn@gnome.org>
+#
+# This is all, of course, horrible - but it should translate
+# most commond gdialog types to zenity equivalents. It will mostly drop
+# the pointless and unused (even by gdialog!) size arguments
+# but hopefully will translate all the others.
+#
+# For testing purposes, I've used a couple of the nautilus scripts
+# available at http://g-scripts.sourceforge.net - what is sometimes
+# unclear is what is a gdialog/zenity translation problem, and what is
+# a problem with the original script
+
+my @command = ("zenity"); # the command line we build up to execute
+my $element = ""; # current bit of command line
+my $argn = 0; # counter for walking args
+my $args = $#ARGV + 1; # total number of command line arguments
+my $separator = 0; # set if --separate-output is in use
+
+
+# Additon by: Kevin C. Krinke (kck) <kckrinke@opendoorsoftware.com>
+#
+# gdialog itself supports both the X-Windows interface as well as a console
+# interface. Here's a fix to use regular dialog when appropriate.
+# This should probably be a more advanced test of some sort, but I don't know
+# of any other easy way of detecting and X-Windows environment. If someone does
+# know better, please let me know. So for now this works: "no DISPLAY; no X".
+
+unless (defined $ENV{'DISPLAY'} && length($ENV{'DISPLAY'})) {
+
+ # reset the command string
+
+ @command = ();
+
+ # examine all the available/default paths
+
+ my $PATHS = ($ENV{'PATH'}||'/bin:/usr/bin:/usr/local/bin:/opt/bin');
+
+ BIN: foreach my $PATH (split(/\:/,$PATHS)) {
+
+ if (-x $PATH."/gdialog.real") {
+
+ # Some GNU/Linux distributions divert binaries when
+ # other packages are installed. If this exists, chances
+ # are it's the real gdialog and not the Zenity wrapper.
+ # gdialog has full support for the Console medium and
+ # as such is the preference over using the "regular"
+ # dialog interface.
+
+ @command = ($PATH."/gdialog.real");
+ last BIN;
+
+ } elsif (-x $PATH."/dialog") {
+
+ # change the command and skip ahead!
+
+ @command = ($PATH."/dialog");
+ last BIN;
+
+ }
+
+
+ }
+
+ unless (@command) {
+
+ # we didn't find the dialog binary, exit(254) with a message
+ # to STDERR.
+
+ print STDERR "missing DISPLAY and a console dialog could".
+ " not be found.\n";
+
+ # exit code 254 is used because 255, 1, 2, 3 are used by Zenity
+ # and cDialog. This error, is a very _bad_ error so it's semi-
+ # non-standard at 254.
+
+ exit(254);
+
+ }
+
+ # all is well if we've made it this far
+
+ # so join the arguments double-quoting things so that proper shell
+ # notation is saved.
+
+ push @command, @ARGV;
+
+ # and fork the process
+
+ exec(@command);
+
+}
+
+# Got DISPLAY, has X continue as normal...
+# End Addtition by: KCK
+
+# this just loads the current arg into $element
+
+sub get_arg () {
+ $element = $ARGV[$argn];
+}
+
+# walk the command line
+
+ARG: while ($argn < $args) {
+
+ get_arg;
+
+# Informational stuff
+
+ if ($element eq "--help" || $element eq "--about") {
+ print ( "gdialog is a compatibility wrapper around zenity, " .
+ "provided to hopefully\nallow older scripts to run. " .
+ "If you are reading this message, you should\n" .
+ "probably be using zenity directly\n\n" .
+ "type: 'zenity --help' or 'man zenity' for more information\n");
+ exit (1);
+ }
+
+# Section 1 : Args which gdialog expects BEFORE box options
+# --clear, --backtitle have no obvious effect - ignored
+
+ if ($element eq "--title") {
+
+ # --title argument is almost analogous in gdialog and
+ # zenity - so pass it almost entirely as is
+
+ $argn++;
+ get_arg;
+ push @command, "--title=$element";
+
+ # keep processing args
+ $argn++;
+ next ARG;
+ }
+
+ if ($element eq "--separate-output") {
+
+ # set the flag to pring list output line by line
+ $separator = 1;
+
+ # keep processing args
+ $argn++;
+ next ARG;
+ }
+
+# Section 2 : Box Options and subsequent args
+
+ if ($element eq "--msgbox" || $element eq "--infobox") {
+
+ # This bit is common to almost all of the dialogs
+ # the arg following the dialog type in gdialog is usually
+ # equivalent to zenity's --text arg.
+
+ $argn++;
+ get_arg;
+ push @command, "--info", "--text=$element";
+
+ # this also happens a lot - gdialog accepted size args
+ # for dialog compatability - which it pretty much ignored
+ # and we will do the same
+
+ $argn+=2;
+ last ARG;
+ }
+
+ if ($element eq "--yesno") {
+
+ # this will silently ignore the gdialog option to set
+ # the default button in question dialogs - which is
+ # highly hig-norant anyway!
+
+ $argn++;
+ get_arg;
+ push @command, "--question", "--text=$element";
+ last ARG;
+ }
+
+ if ($element eq "--inputbox") {
+ $argn++;
+ get_arg;
+ push @command, "--entry", "--text=$element";
+
+ # ignore size elements and maybe there is some
+ # default text to initialize the entry with?
+
+ $argn+=3;
+ get_arg;
+ push @command, "--entry-text=$element";
+ last ARG;
+ }
+
+ if ($element eq "--textbox") {
+ push @command, "--text-info";
+
+ # the arg immediately following the dialog type in
+ # gdialog is the filename, so pass this to zenity
+
+ $argn++;
+ get_arg;
+ push @command, "--filename=$element";
+
+ # width and height matter for this one, so get them
+ # and apply the same multipliers as used in gdialog
+
+ $argn++;
+ get_arg;
+ $element = $element * 7;
+ push @command, "--height=$element";
+ $argn++;
+ get_arg;
+ $element = $element * 8;
+ push @command, "--width=$element";
+ last ARG;
+ }
+
+ if ($element eq "--checklist" || $element eq "--radiolist") {
+ $list=$element;
+ $argn++;
+ get_arg;
+
+ # Conveniently, zenity and gdialog use the same names
+ # for list types, so pass this to zenity intact along with
+ # an untitled column for the check or radio buttons
+ # and the 'text' arg as a second column header
+
+ push @command, "--list", $list, "--column=''", "--column=''", "--column", $element;
+
+ # should output be line by line?
+ if ($separator) {
+ push @command, "--separator=\n";
+ }
+
+ # Skip to the first 'item' arg of the list content
+ # bypassing height, width and list-height
+ # from here args run [tag] [item] [status] ...
+
+ $argn += 4;
+
+ # Loop over the remainder of the commandline
+ # discarding the 'status' args of each item
+ # and using the 'item' for display in our second column
+ # also pass a fake NULL argument since zenity can't set
+ # the status of a row like gdialog can
+
+ while ($argn < $args) {
+ get_arg;
+ push @command, "NULL", $element;
+ $argn += 1;
+ get_arg;
+ push @command, $element;
+ $argn += 2;
+ }
+ last ARG;
+ }
+
+ if ($element eq "--menu") {
+ $list=$element;
+ $argn++;
+ get_arg;
+
+ # a gdialog --menu is just a two column zenity --list
+ # Leave the first column blank (not provided)
+ # Use the 'text' arg as a second column header
+ # FIXME: or should it be the dialog text, or both?
+
+ push @command, "--list", "--column", "", "--column", $element;
+
+ # Skip to the first 'item' arg of the list content
+ # after using height, width and bypassing list-height
+ # from here args run [tag] [item] ...
+
+ $argn += 1;
+
+ get_arg;
+ # Height and width in characters to be displayed, so adjust
+ # cdialog uses 6 height for non-list, zenity uses ~24 pixels
+ # per list entry (default font), and 103 pixels for non-list
+ # This appears to be almost exact
+ $element = $element*24 - 35;
+ push @command, "--height", $element;
+
+ $argn += 1;
+ get_arg;
+ # cdialog uses 6 width for non-list, zenity uses ~7 pixels
+ # per character (default font), and 22 pixels for non-list
+ # This is not exact, but close enough
+ $element = $element*7 - 20;
+ push @command, "--width", $element;
+
+ $argn += 2;
+
+ # Loop over the remainder of the commandline
+ # keeping 'tag' args of each item (required to return)
+ # and using the 'item' for display in our second column
+
+ while ($argn < $args) {
+ get_arg;
+ push @command, $element;
+ $argn += 1;
+ }
+ last ARG;
+ }
+
+ if ($element eq "--gauge") {
+ $argn++;
+ get_arg;
+ push @command, "--progress", "--text=$element";
+
+ # discard the size args as usually, and see if
+ # a percentage value was supplied to initialize the
+ # dialog
+
+ $argn += 3;
+ get_arg;
+ if ($element) {
+ push @command, "--percentage=$element";
+ }
+ last ARG;
+ }
+
+ $argn++;
+}
+
+# save STDOUT and STDERR
+open(ORG_STDOUT, ">&STDOUT");
+open(ORG_STDERR, ">&STDERR");
+
+# redirect STDERR to /dev/null (GTK messages ie:
+# (zenity:637): Gtk-WARNING **: Unable to locate theme engine in module_path: "mist",)
+open(STDERR, ">/dev/null");
+
+# redirect STDOUT to STDERR (gdialog direct output to STDERR by default)
+open(STDOUT, ">&ORG_STDERR");
+
+# execute the constructed zenity command line
+
+# perl doc: The return value of system() is the exit status of the
+#program as returned by the wait() call. To get the actual exit value
+# divide by 256.
+
+my $return = system(@command)/256;
+
+# restore STDOUT and STDERR
+open(STDOUT, ">&ORG_STDOUT");
+open(STDERR, ">&ORG_STDERR");
+close(ORG_STDOUT);
+close(ORG_STDERR);
+
+exit $return;
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 00000000..7f0c2db7
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,120 @@
+/*
+ * main.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: 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;
+
+#ifdef HAVE_LOCALE_H
+ setlocale (LC_ALL, "");
+#endif
+
+ bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ gtk_init (&argc, &argv);
+
+ results = zenity_option_parse (argc, argv);
+
+ 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;
+ 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;
+ 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 ();
+
+ exit (retval);
+}
diff --git a/src/msg.c b/src/msg.c
new file mode 100644
index 00000000..ca14d867
--- /dev/null
+++ b/src/msg.c
@@ -0,0 +1,269 @@
+/*
+ * msg.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Glynn Foster <glynn.foster@sun.com>
+ */
+
+#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) {
+
+ GtkWidget *cancel_button, *ok_button;
+
+ cancel_button = gtk_dialog_add_button (
+ GTK_DIALOG (dialog), _ ("_No"), GTK_RESPONSE_CANCEL);
+ ok_button = gtk_dialog_add_button (
+ GTK_DIALOG (dialog), _ ("_Yes"), GTK_RESPONSE_OK);
+
+ gtk_widget_grab_focus (
+ msg_data->default_cancel ? cancel_button : ok_button);
+
+ if (data->cancel_label) {
+ gtk_button_set_label (GTK_BUTTON (cancel_button), data->cancel_label);
+ }
+
+ if (data->ok_label) {
+ gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
+ }
+}
+
+static void
+zenity_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
+ a pre-existing (read: foreign, user-initiated) X11 primary selection
+ (via gtk_label_select_region() -> ...
+ -> gtk_clipboard_set_contents()/gtk_clipboard_clear()),
+ we need to ensure
+ that the widget does have its gtk-label-select-on-focus property off,
+ in order to avoid having the label become selected automatically
+ and thereby having pre-existing clipboard content nullified.
+ Side note: this selection issue only applies to widgets
+ which have both
+ <property name="can_focus">True</property>
+ <property name="selectable">True</property>
+ .
+ */
+ g_object_set (gtk_widget_get_settings (widget),
+ "gtk-label-select-on-focus",
+ FALSE,
+ NULL);
+}
+
+void
+zenity_msg (ZenityData *data, ZenityMsgData *msg_data) {
+ GtkBuilder *builder;
+ GtkWidget *dialog;
+ GtkWidget *ok_button;
+ GObject *text;
+ GObject *image;
+
+ switch (msg_data->mode) {
+ case ZENITY_MSG_WARNING:
+ builder = zenity_util_load_ui_file ("zenity_warning_dialog", NULL);
+ dialog = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_warning_dialog"));
+ text = gtk_builder_get_object (builder, "zenity_warning_text");
+ image = gtk_builder_get_object (builder, "zenity_warning_image");
+ ok_button = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_warning_ok_button"));
+ break;
+
+ case ZENITY_MSG_QUESTION:
+ case ZENITY_MSG_SWITCH:
+ builder = zenity_util_load_ui_file ("zenity_question_dialog", NULL);
+ dialog = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_question_dialog"));
+ text = gtk_builder_get_object (builder, "zenity_question_text");
+ image = gtk_builder_get_object (builder, "zenity_question_image");
+ ok_button = NULL;
+ break;
+
+ case ZENITY_MSG_ERROR:
+ builder = zenity_util_load_ui_file ("zenity_error_dialog", NULL);
+ dialog = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_error_dialog"));
+ text = gtk_builder_get_object (builder, "zenity_error_text");
+ image = gtk_builder_get_object (builder, "zenity_error_image");
+ ok_button = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_error_ok_button"));
+ break;
+
+ case ZENITY_MSG_INFO:
+ builder = zenity_util_load_ui_file ("zenity_info_dialog", NULL);
+ dialog = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_info_dialog"));
+ text = gtk_builder_get_object (builder, "zenity_info_text");
+ image = gtk_builder_get_object (builder, "zenity_info_image");
+ ok_button = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_info_ok_button"));
+ break;
+
+ default:
+ builder = NULL;
+ dialog = NULL;
+ text = NULL;
+ image = NULL;
+ ok_button = NULL;
+ g_assert_not_reached ();
+ 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 (builder == NULL) {
+ data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
+ return;
+ }
+
+ g_signal_connect (G_OBJECT (dialog),
+ "response",
+ 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);
+
+ if (ok_button) {
+ if (data->ok_label) {
+ gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
+ }
+ }
+
+ switch (msg_data->mode) {
+ case ZENITY_MSG_WARNING:
+ zenity_util_set_window_icon_from_icon_name (
+ dialog, data->window_icon, "dialog-warning");
+ break;
+
+ case ZENITY_MSG_QUESTION:
+ zenity_util_set_window_icon_from_icon_name (
+ dialog, data->window_icon, "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");
+ break;
+
+ case ZENITY_MSG_ERROR:
+ zenity_util_set_window_icon_from_icon_name (
+ dialog, data->window_icon, "dialog-error");
+ break;
+
+ case ZENITY_MSG_INFO:
+ zenity_util_set_window_icon_from_icon_name (
+ dialog, data->window_icon, "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)
+ 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 (text, 10);
+ gtk_label_set_max_width_chars (text, 10);
+ }
+
+ if (data->modal)
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+
+ 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));
+ zenity_label_widget_clipboard_selection (GTK_WIDGET (text));
+ }
+
+ if (msg_data->ellipsize)
+ gtk_label_set_ellipsize (GTK_LABEL (text), PANGO_ALIGN_RIGHT);
+
+ if (msg_data->dialog_icon)
+ gtk_image_set_from_icon_name (
+ GTK_IMAGE (image), msg_data->dialog_icon, GTK_ICON_SIZE_DIALOG);
+
+ if (msg_data->no_wrap)
+ gtk_label_set_line_wrap (GTK_LABEL (text), FALSE);
+
+ zenity_util_show_dialog (dialog, data->attach);
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ NULL);
+ }
+
+ g_object_unref (builder);
+
+ gtk_main ();
+}
+
+static void
+zenity_msg_dialog_response (GtkWidget *widget, int response, gpointer data) {
+ ZenityData *zen_data = data;
+
+ switch (response) {
+ case GTK_RESPONSE_OK:
+ zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
+ default:
+ if (zen_data->extra_label &&
+ response < 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 ();
+}
diff --git a/src/notification.c b/src/notification.c
new file mode 100644
index 00000000..eb0e79eb
--- /dev/null
+++ b/src/notification.c
@@ -0,0 +1,371 @@
+/*
+ * notification.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ * Copyright (C) 2006 Christian Persch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Glynn Foster <glynn.foster@sun.com>
+ */
+
+#include <config.h>
+
+#include <gtk/gtk.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#ifdef HAVE_LIBNOTIFY
+#include <libnotify/notify.h>
+
+#include "util.h"
+#include "zenity.h"
+
+#define MAX_HINTS 16
+
+static char *icon_file;
+static GHashTable *notification_hints;
+
+static NotifyNotification *
+zenity_notification_new (gchar *message, gchar *icon_file) {
+ NotifyNotification *notif;
+ gchar **text;
+
+ text = g_strsplit (g_strcompress (message), "\n", 2);
+ if (*text == NULL) {
+ g_printerr (_ ("Could not parse message\n"));
+ return NULL;
+ }
+
+ 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;
+
+ zen_data = (ZenityData *) user_data;
+ notify_notification_close (n, NULL);
+
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
+
+ gtk_main_quit ();
+}
+
+static GHashTable *
+zenity_notification_parse_hints_array (gchar **hints) {
+ GHashTable *result;
+ gchar **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++) {
+ 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;
+ } else {
+ return result;
+ }
+}
+
+static GHashTable *
+zenity_notification_parse_hints (gchar *hints) {
+ GHashTable *result;
+ gchar **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;
+
+ gchar *string_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)) {
+ /* boolean hints */
+ if (g_ascii_strcasecmp ("true", string_value) == 0) {
+ boolean_value = TRUE;
+ } else if (g_ascii_strcasecmp ("false", string_value) == 0) {
+ boolean_value = FALSE;
+ } else {
+ g_printerr (_ ("Invalid value for a boolean typed hint.\nSupported "
+ "values are 'true' or 'false'.\n"));
+ return;
+ }
+ hint_value = g_variant_new_boolean (boolean_value);
+ } 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)) {
+ /* string hints */
+ hint_value = g_variant_new_string (string_value);
+ } 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)) {
+ /* (iibiiay) */
+ g_printerr (_ ("Unsupported hint. Skipping.\n"));
+ return;
+ } 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)) {
+ /* 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 {
+ /* unknown hints */
+ g_printerr (_ ("Unknown hint name. Skipping.\n"));
+ return;
+ }
+
+ notify_notification_set_hint (notification, hint_name, hint_value);
+}
+
+static void
+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) {
+ GString *string;
+ GError *error = NULL;
+
+ string = g_string_new (NULL);
+ while (channel->is_readable == FALSE)
+ ;
+ do {
+ gint status;
+ gchar *command, *value, *colon;
+
+ do {
+ status = g_io_channel_read_line_string (
+ channel, string, NULL, &error);
+ while (gdk_events_pending ())
+ gtk_main_iteration ();
+
+ } while (status == G_IO_STATUS_AGAIN);
+
+ if (status != G_IO_STATUS_NORMAL) {
+ if (error) {
+ g_warning ("zenity_notification_handle_stdin () : %s",
+ error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+ continue;
+ }
+
+ zenity_util_strip_newline (string->str);
+ colon = strchr (string->str, ':');
+ 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));
+
+ value = colon + 1;
+ while (*value && g_ascii_isspace (*value))
+ value++;
+
+ if (!g_ascii_strcasecmp (command, "icon")) {
+ g_free (icon_file);
+ icon_file = g_strdup (value);
+ } 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")) {
+ /* display a notification bubble */
+ if (!g_utf8_validate (value, -1, NULL)) {
+ g_warning ("Invalid UTF-8 in input!");
+ } else {
+ NotifyNotification *notif;
+ error = NULL;
+
+ 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);
+ g_error_free (error);
+ error = NULL;
+ }
+
+ g_object_unref (notif);
+ }
+ } 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);
+ 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);
+ g_error_free (error);
+ error = NULL;
+ }
+ }
+ } else if (!g_ascii_strcasecmp (command, "visible")) {
+
+ } 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) {
+ g_io_channel_shutdown (channel, TRUE, NULL);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+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);
+}
+
+void
+zenity_notification (
+ ZenityData *data, ZenityNotificationData *notification_data) {
+ GError *error;
+ NotifyNotification *notification;
+ GHashTable *notification_hints;
+
+ /* create the notification widget */
+ if (!notify_is_initted ()) {
+ notify_init (_ ("Zenity notification"));
+ }
+
+ if (notification_data->listen) {
+ zenity_notification_listen_on_stdin (data);
+ gtk_main ();
+ } else {
+ if (notification_data->notification_text == NULL) {
+ exit (1);
+ }
+
+ notification = zenity_notification_new (
+ notification_data->notification_text, data->window_icon);
+
+ if (notification == NULL) {
+ exit (1);
+ }
+
+ /* if we aren't listening for changes, then close on default action */
+ notify_notification_add_action (notification,
+ "default",
+ "Do Default Action",
+ (NotifyActionCallback) on_notification_default_action,
+ data,
+ NULL);
+
+ /* set the notification hints for the displayed notification */
+ 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 (error != NULL) {
+ g_warning ("Error showing notification: %s", error->message);
+ g_error_free (error);
+ }
+ exit (1);
+ }
+ }
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ NULL);
+ gtk_main ();
+ }
+}
+
+#endif
diff --git a/src/option.c b/src/option.c
new file mode 100644
index 00000000..61df34d3
--- /dev/null
+++ b/src/option.c
@@ -0,0 +1,2229 @@
+/*
+ * option.h
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Glynn Foster <glynn.foster@sun.com>
+ * Lucas Rocha <lucasr@im.ufba.br>
+ */
+
+#include "config.h"
+
+#include "option.h"
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+/* General Options */
+static gchar *zenity_general_dialog_title;
+static gchar *zenity_general_window_icon;
+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 gboolean zenity_general_multiple;
+static gboolean zenity_general_editable;
+static gchar *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 gboolean zenity_general_modal;
+static guintptr zenity_general_attach;
+static gboolean zenity_general_dialog_ellipsize;
+
+/* Calendar Dialog Options */
+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;
+
+/* Entry Dialog Options */
+static gboolean zenity_entry_active;
+static gchar *zenity_entry_entry_text;
+static gboolean zenity_entry_hide_text;
+
+/* Error Dialog Options */
+static gboolean zenity_error_active;
+
+/* Info Dialog Options */
+static gboolean zenity_info_active;
+
+/* File Selection Dialog Options */
+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;
+
+/* List Dialog Options */
+static gboolean zenity_list_active;
+static gchar **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 gboolean zenity_list_hide_header;
+static gboolean zenity_list_imagelist;
+static gboolean zenity_list_mid_search;
+
+#ifdef HAVE_LIBNOTIFY
+/* Notification Dialog Options */
+static gboolean zenity_notification_active;
+static gboolean zenity_notification_listen;
+static gchar **zenity_notification_hints;
+#endif
+
+/* Progress Dialog Options */
+static gboolean zenity_progress_active;
+static int zenity_progress_percentage;
+static gboolean zenity_progress_pulsate;
+static gboolean zenity_progress_auto_close;
+static gboolean zenity_progress_auto_kill;
+static gboolean zenity_progress_no_cancel;
+static gboolean zenity_progress_time_remaining;
+
+/* Question Dialog Options */
+static gboolean zenity_question_active;
+static gboolean zenity_question_default_cancel;
+static gboolean zenity_question_switch;
+
+/* Text Dialog Options */
+static gboolean zenity_text_active;
+static gchar *zenity_text_font;
+static gchar *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;
+#endif
+
+/* Warning Dialog Options */
+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 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 gboolean zenity_colorsel_show_palette;
+
+/* Password Dialog Options */
+static gboolean zenity_password_active;
+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;
+
+/* 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 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 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 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 file_selection_options[] =
+ {{"file-selection",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_file_active,
+ N_ ("Display file selection dialog"),
+ NULL},
+ {"filename",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_FILENAME,
+ &zenity_general_uri,
+ N_ ("Set the filename"),
+ N_ ("FILENAME")},
+ {"multiple",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_multiple,
+ N_ ("Allow multiple files to be selected"),
+ NULL},
+ {"directory",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_file_directory,
+ N_ ("Activate directory-only selection"),
+ NULL},
+ {"save",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_file_save,
+ N_ ("Activate save mode"),
+ NULL},
+ {"separator",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &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",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING_ARRAY,
+ &zenity_file_filter,
+ N_ ("Set a filename filter"),
+ /* Help for file-filter argument (name and patterns for file
+ selection) */
+ N_ ("NAME | PATTERN1 PATTERN2 ..."),
+ },
+ {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}};
+
+#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 text_options[] = {
+ {"text-info",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_text_active,
+ N_ ("Display text information dialog"),
+ NULL},
+ {"filename",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_FILENAME,
+ &zenity_general_uri,
+ N_ ("Open file"),
+ N_ ("FILENAME")},
+ {"editable",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_general_editable,
+ N_ ("Allow changes to text"),
+ NULL},
+ {"font",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING,
+ &zenity_text_font,
+ N_ ("Set the text font"),
+ N_ ("TEXT")},
+ {"checkbox",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_text_checkbox,
+ N_ ("Enable an I read and agree checkbox"),
+ N_ ("TEXT")},
+#ifdef HAVE_WEBKITGTK
+ {"html",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_text_enable_html,
+ N_ ("Enable HTML support"),
+ NULL},
+ {"no-interaction",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_text_no_interaction,
+ N_ ("Do not enable user interaction with the WebView. Only works if "
+ "you use --html option"),
+ NULL},
+ {"url",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_STRING,
+ &zenity_text_url,
+ N_ ("Set an URL instead of a file. Only works if you use --html "
+ "option"),
+ N_ ("URL")},
+#endif
+ {"auto-scroll",
+ '\0',
+ G_OPTION_FLAG_NOALIAS,
+ G_OPTION_ARG_NONE,
+ &zenity_text_auto_scroll,
+ N_ ("Auto scroll the text to the end. Only when text is captured from "
+ "stdin"),
+ 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 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",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_password_active,
+ N_ ("Display password dialog"),
+ NULL},
+ {"username",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_password_show_username,
+ N_ ("Display the username option"),
+ NULL},
+ {NULL}};
+
+static GOptionEntry color_selection_options[] = {
+ {"color-selection",
+ '\0',
+ G_OPTION_FLAG_IN_MAIN,
+ G_OPTION_ARG_NONE,
+ &zenity_colorsel_active,
+ N_ ("Display color selection dialog"),
+ NULL},
+ {"color",
+ '\0',
+ 0,
+ G_OPTION_ARG_STRING,
+ &zenity_colorsel_color,
+ N_ ("Set the color"),
+ N_ ("VALUE")},
+ {"show-palette",
+ '\0',
+ 0,
+ G_OPTION_ARG_NONE,
+ &zenity_colorsel_show_palette,
+ N_ ("Show the palette"),
+ 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) {
+
+ results = g_new0 (ZenityParsingOptions, 1);
+
+ /* Initialize the various dialog structures */
+ results->mode = MODE_LAST;
+ results->data = g_new0 (ZenityData, 1);
+ results->calendar_data = g_new0 (ZenityCalendarData, 1);
+ results->msg_data = g_new0 (ZenityMsgData, 1);
+ results->scale_data = g_new0 (ZenityScaleData, 1);
+ results->file_data = g_new0 (ZenityFileData, 1);
+ results->entry_data = g_new0 (ZenityEntryData, 1);
+ results->progress_data = g_new0 (ZenityProgressData, 1);
+ results->text_data = g_new0 (ZenityTextData, 1);
+ results->tree_data = g_new0 (ZenityTreeData, 1);
+#ifdef HAVE_LIBNOTIFY
+ results->notification_data = g_new0 (ZenityNotificationData, 1);
+#endif
+ results->color_data = g_new0 (ZenityColorData, 1);
+ results->password_data = g_new0 (ZenityPasswordData, 1);
+ results->forms_data = g_new0 (ZenityFormsData, 1);
+}
+
+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)
+ g_free (zenity_general_uri);
+ g_free (zenity_general_separator);
+ if (zenity_general_ok_button)
+ g_free (zenity_general_ok_button);
+ if (zenity_general_cancel_button)
+ g_free (zenity_general_cancel_button);
+ if (zenity_general_extra_buttons)
+ g_strfreev (zenity_general_extra_buttons);
+
+ if (zenity_calendar_date_format)
+ g_free (zenity_calendar_date_format);
+
+ if (zenity_forms_date_format)
+ g_free (zenity_forms_date_format);
+ if (zenity_forms_list_values)
+ g_strfreev (zenity_forms_list_values);
+ if (zenity_forms_combo_values)
+ 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);
+
+ if (zenity_file_filter)
+ g_strfreev (zenity_file_filter);
+
+ if (zenity_list_columns)
+ g_strfreev (zenity_list_columns);
+ if (zenity_list_print_column)
+ g_free (zenity_list_print_column);
+ if (zenity_list_hide_column)
+ g_free (zenity_list_hide_column);
+
+#ifdef HAVE_LIBNOTIFY
+ if (zenity_notification_hints)
+ g_strfreev (zenity_notification_hints);
+#endif
+
+ if (zenity_text_font)
+ g_free (zenity_text_font);
+ if (zenity_text_checkbox)
+ g_free (zenity_text_checkbox);
+
+ if (zenity_colorsel_color)
+ g_free (zenity_colorsel_color);
+
+ g_option_context_free (ctx);
+}
+
+static void
+zenity_option_set_dialog_mode (gboolean is_active, ZenityDialogMode mode) {
+ if (is_active == TRUE) {
+ if (results->mode == MODE_LAST)
+ results->mode = mode;
+ else
+ zenity_option_error (NULL, ERROR_DIALOG);
+ }
+}
+
+static gchar *
+zenity_option_get_name (GOptionEntry *entries, gpointer arg_data) {
+ int i;
+
+ for (i = 1; entries[i].long_name != NULL; i++) {
+ if (entries[i].arg_data == arg_data)
+ return (gchar *) entries[i].long_name;
+ }
+ return NULL;
+}
+
+/* Forms callback */
+static gboolean
+zenity_forms_callback (const gchar *option_name, const gchar *value,
+ gpointer data, GError **error) {
+ ZenityFormsValue *forms_value = g_new0 (ZenityFormsValue, 1);
+
+ forms_value->option_value = g_strdup (value);
+
+ if (g_strcmp0 (option_name, "--add-entry") == 0)
+ forms_value->type = ZENITY_FORMS_ENTRY;
+ else if (g_strcmp0 (option_name, "--add-calendar") == 0)
+ forms_value->type = ZENITY_FORMS_CALENDAR;
+ else if (g_strcmp0 (option_name, "--add-password") == 0)
+ forms_value->type = ZENITY_FORMS_PASSWORD;
+ else if (g_strcmp0 (option_name, "--add-list") == 0)
+ forms_value->type = ZENITY_FORMS_LIST;
+ else if (g_strcmp0 (option_name, "--add-combo") == 0)
+ forms_value->type = ZENITY_FORMS_COMBO;
+
+ results->forms_data->list =
+ g_slist_append (results->forms_data->list, forms_value);
+
+ return TRUE;
+}
+
+/* Error callback */
+static void
+zenity_option_error_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_error (NULL, ERROR_SYNTAX);
+}
+
+/* Pre parse callbacks set the default option values */
+
+static gboolean
+zenity_general_pre_callback (GOptionContext *context, GOptionGroup *group,
+ 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;
+ zenity_general_separator = g_strdup ("|");
+ zenity_general_multiple = FALSE;
+ zenity_general_editable = FALSE;
+ zenity_general_uri = NULL;
+ zenity_general_ok_button = NULL;
+ zenity_general_cancel_button = NULL;
+ zenity_general_extra_buttons = NULL;
+ zenity_general_dialog_no_wrap = FALSE;
+ 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) {
+ zenity_calendar_active = FALSE;
+ zenity_calendar_date_format = NULL;
+ zenity_calendar_day = -1;
+ zenity_calendar_month = -1;
+ zenity_calendar_year = -1;
+
+ return TRUE;
+}
+
+static gboolean
+zenity_entry_pre_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_entry_active = FALSE;
+ zenity_entry_entry_text = NULL;
+ zenity_entry_hide_text = FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+zenity_error_pre_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_error_active = FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+zenity_info_pre_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_info_active = FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+zenity_file_pre_callback (GOptionContext *context, GOptionGroup *group,
+ 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;
+}
+
+static gboolean
+zenity_list_pre_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_list_active = FALSE;
+ zenity_list_columns = NULL;
+ zenity_list_checklist = FALSE;
+ zenity_list_radiolist = FALSE;
+ zenity_list_imagelist = FALSE;
+ zenity_list_hide_header = FALSE;
+ zenity_list_print_column = NULL;
+ zenity_list_hide_column = NULL;
+ zenity_list_mid_search = FALSE;
+
+ return TRUE;
+}
+
+#ifdef HAVE_LIBNOTIFY
+static gboolean
+zenity_notification_pre_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_notification_active = FALSE;
+ zenity_notification_listen = FALSE;
+
+ return TRUE;
+}
+#endif
+
+static gboolean
+zenity_progress_pre_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_progress_active = FALSE;
+ zenity_progress_percentage = 0;
+ zenity_progress_pulsate = FALSE;
+ zenity_progress_auto_close = FALSE;
+ 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) {
+ 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) {
+ zenity_text_active = FALSE;
+ zenity_text_font = NULL;
+ zenity_text_checkbox = NULL;
+ zenity_text_auto_scroll = FALSE;
+#ifdef HAVE_WEBKITGTK
+ zenity_text_enable_html = FALSE;
+ 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) {
+ zenity_warning_active = FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+zenity_scale_pre_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_scale_active = FALSE;
+ zenity_scale_value = 0;
+ zenity_scale_min_value = 0;
+ zenity_scale_max_value = 100;
+ zenity_scale_step = 1;
+ zenity_scale_print_partial = FALSE;
+ zenity_scale_hide_value = FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+zenity_color_pre_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_colorsel_active = FALSE;
+ zenity_colorsel_color = NULL;
+ zenity_colorsel_show_palette = FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+zenity_password_pre_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_password_active = FALSE;
+ zenity_password_show_username = FALSE;
+
+ return TRUE;
+}
+
+static gboolean
+zenity_forms_pre_callback (GOptionContext *context, GOptionGroup *group,
+ 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) {
+ zenity_misc_about = FALSE;
+ zenity_misc_version = FALSE;
+
+ return TRUE;
+}
+
+/* Post parse callbacks assign the option values to
+ parsing result and makes some post condition tests */
+
+static gboolean
+zenity_general_post_callback (GOptionContext *context, GOptionGroup *group,
+ 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;
+ results->data->ok_label = zenity_general_ok_button;
+ 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) {
+ zenity_option_set_dialog_mode (zenity_calendar_active, MODE_CALENDAR);
+
+ if (results->mode == MODE_CALENDAR) {
+ struct tm *t;
+ time_t current_time;
+
+ time (&current_time);
+ t = localtime (&current_time);
+
+ if (zenity_calendar_day < 0)
+ zenity_calendar_day = t->tm_mday;
+ if (zenity_calendar_month < 0)
+ zenity_calendar_month = t->tm_mon + 1;
+ if (zenity_calendar_year < 0)
+ zenity_calendar_year = t->tm_year + 1900;
+
+ results->calendar_data->dialog_text = zenity_general_dialog_text;
+ results->calendar_data->day = zenity_calendar_day;
+ results->calendar_data->month = zenity_calendar_month;
+ results->calendar_data->year = zenity_calendar_year;
+
+ if (zenity_calendar_date_format)
+ results->calendar_data->date_format = zenity_calendar_date_format;
+ 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),
+ ERROR_SUPPORT);
+
+ 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),
+ ERROR_SUPPORT);
+
+ if (zenity_calendar_date_format)
+ zenity_option_error (zenity_option_get_name (calendar_options,
+ &zenity_calendar_date_format),
+ ERROR_SUPPORT);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+zenity_entry_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_set_dialog_mode (zenity_entry_active, 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),
+ ERROR_SUPPORT);
+
+ 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) {
+ zenity_option_set_dialog_mode (zenity_error_active, 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;
+ results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
+ results->msg_data->no_markup = zenity_general_dialog_no_markup;
+ results->msg_data->ellipsize = zenity_general_dialog_ellipsize;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+zenity_info_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_set_dialog_mode (zenity_info_active, 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;
+ results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
+ results->msg_data->no_markup = zenity_general_dialog_no_markup;
+ results->msg_data->ellipsize = zenity_general_dialog_ellipsize;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+zenity_file_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_set_dialog_mode (zenity_file_active, 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)
+ zenity_option_error (zenity_option_get_name (file_selection_options,
+ &zenity_file_directory),
+ ERROR_SUPPORT);
+
+ if (zenity_file_save)
+ zenity_option_error (zenity_option_get_name (
+ file_selection_options, &zenity_file_save),
+ ERROR_SUPPORT);
+
+ if (zenity_file_filter)
+ zenity_option_error (zenity_option_get_name (file_selection_options,
+ &zenity_file_filter),
+ ERROR_SUPPORT);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+zenity_list_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ int i = 0;
+ gchar *column;
+
+ zenity_option_set_dialog_mode (zenity_list_active, MODE_LIST);
+
+ if (results->mode == MODE_LIST) {
+ results->tree_data->dialog_text = zenity_general_dialog_text;
+
+ if (zenity_list_columns) {
+ column = zenity_list_columns[0];
+ while (column != NULL) {
+ results->tree_data->columns =
+ g_slist_append (results->tree_data->columns, column);
+ column = zenity_list_columns[++i];
+ }
+ }
+
+ results->tree_data->checkbox = zenity_list_checklist;
+ results->tree_data->radiobox = zenity_list_radiolist;
+ results->tree_data->imagebox = zenity_list_imagelist;
+ results->tree_data->multi = zenity_general_multiple;
+ results->tree_data->editable = zenity_general_editable;
+ results->tree_data->print_column = zenity_list_print_column;
+ results->tree_data->hide_column = zenity_list_hide_column;
+ 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 {
+ if (zenity_list_columns)
+ zenity_option_error (
+ zenity_option_get_name (list_options, &zenity_list_columns),
+ ERROR_SUPPORT);
+
+ if (zenity_list_checklist)
+ zenity_option_error (
+ zenity_option_get_name (list_options, &zenity_list_checklist),
+ ERROR_SUPPORT);
+
+ if (zenity_list_radiolist)
+ zenity_option_error (
+ zenity_option_get_name (list_options, &zenity_list_radiolist),
+ ERROR_SUPPORT);
+
+ if (zenity_list_imagelist)
+ zenity_option_error (
+ zenity_option_get_name (list_options, &zenity_list_imagelist),
+ ERROR_SUPPORT);
+
+ if (zenity_list_print_column)
+ zenity_option_error (zenity_option_get_name (
+ list_options, &zenity_list_print_column),
+ ERROR_SUPPORT);
+
+ if (zenity_list_hide_column)
+ zenity_option_error (
+ zenity_option_get_name (list_options, &zenity_list_hide_column),
+ ERROR_SUPPORT);
+
+ if (zenity_list_hide_header)
+ zenity_option_error (
+ zenity_option_get_name (list_options, &zenity_list_hide_header),
+ ERROR_SUPPORT);
+ if (zenity_list_mid_search)
+ zenity_option_error (
+ 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);
+
+ if (results->mode == MODE_NOTIFICATION) {
+ results->notification_data->notification_text =
+ zenity_general_dialog_text;
+ results->notification_data->listen = zenity_notification_listen;
+ results->notification_data->notification_hints =
+ zenity_notification_hints;
+ } else {
+ if (zenity_notification_listen)
+ zenity_option_error (zenity_option_get_name (notification_options,
+ &zenity_notification_listen),
+ ERROR_SUPPORT);
+ }
+
+ return TRUE;
+}
+#endif
+
+static gboolean
+zenity_progress_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_set_dialog_mode (zenity_progress_active, 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;
+ results->progress_data->autokill = zenity_progress_auto_kill;
+ 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)
+ zenity_option_error (zenity_option_get_name (progress_options,
+ &zenity_progress_pulsate),
+ ERROR_SUPPORT);
+
+ if (zenity_progress_percentage)
+ zenity_option_error (zenity_option_get_name (progress_options,
+ &zenity_progress_percentage),
+ ERROR_SUPPORT);
+
+ if (zenity_progress_auto_close)
+ zenity_option_error (zenity_option_get_name (progress_options,
+ &zenity_progress_auto_close),
+ ERROR_SUPPORT);
+
+ if (zenity_progress_auto_kill)
+ zenity_option_error (zenity_option_get_name (progress_options,
+ &zenity_progress_auto_kill),
+ ERROR_SUPPORT);
+
+ if (zenity_progress_no_cancel)
+ zenity_option_error (zenity_option_get_name (progress_options,
+ &zenity_progress_no_cancel),
+ ERROR_SUPPORT);
+
+ if (zenity_progress_time_remaining)
+ zenity_option_error (zenity_option_get_name (progress_options,
+ &zenity_progress_time_remaining),
+ ERROR_SUPPORT);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+zenity_question_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_set_dialog_mode (zenity_question_active, 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)
+ results->msg_data->mode = ZENITY_MSG_SWITCH;
+ else
+ results->msg_data->mode = ZENITY_MSG_QUESTION;
+ results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
+ results->msg_data->no_markup = zenity_general_dialog_no_markup;
+ 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);
+
+ return TRUE;
+}
+
+static gboolean
+zenity_text_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_set_dialog_mode (zenity_text_active, 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;
+ results->text_data->font = zenity_text_font;
+ results->text_data->checkbox = zenity_text_checkbox;
+ results->text_data->auto_scroll = zenity_text_auto_scroll;
+#ifdef HAVE_WEBKITGTK
+ results->text_data->html = zenity_text_enable_html;
+ 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);
+#ifdef HAVE_WEBKITGTK
+ if (zenity_text_enable_html)
+ zenity_option_error (
+ zenity_option_get_name (text_options, &zenity_text_enable_html),
+ ERROR_SUPPORT);
+#endif
+ }
+ return TRUE;
+}
+
+static gboolean
+zenity_warning_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_set_dialog_mode (zenity_warning_active, 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;
+ results->msg_data->no_wrap = zenity_general_dialog_no_wrap;
+ results->msg_data->no_markup = zenity_general_dialog_no_markup;
+ results->msg_data->ellipsize = zenity_general_dialog_ellipsize;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+zenity_scale_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_set_dialog_mode (zenity_scale_active, 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;
+ results->scale_data->max_value = zenity_scale_max_value;
+ results->scale_data->step = zenity_scale_step;
+ results->scale_data->print_partial = zenity_scale_print_partial;
+ results->scale_data->hide_value = zenity_scale_hide_value;
+ }
+
+ return TRUE;
+}
+
+static gboolean
+zenity_color_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_set_dialog_mode (zenity_colorsel_active, 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);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+zenity_forms_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ gchar *values;
+ int i = 0;
+
+ zenity_option_set_dialog_mode (zenity_forms_active, 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) {
+ values = zenity_forms_list_values[0];
+ while (values != NULL) {
+ results->forms_data->list_values =
+ g_slist_append (results->forms_data->list_values, values);
+ values = zenity_forms_list_values[++i];
+ }
+ }
+ if (zenity_forms_column_values) {
+ i = 0;
+ values = zenity_forms_column_values[0];
+ while (values != NULL) {
+ results->forms_data->column_values =
+ g_slist_append (results->forms_data->column_values, values);
+ values = zenity_forms_list_values[++i];
+ }
+ } else
+ results->forms_data->column_values =
+ g_slist_append (NULL, "column");
+
+ if (zenity_forms_combo_values) {
+ i = 0;
+ values = zenity_forms_combo_values[0];
+ while (values != NULL) {
+ results->forms_data->combo_values =
+ g_slist_append (results->forms_data->combo_values, values);
+ values = zenity_forms_combo_values[++i];
+ }
+ }
+ if (zenity_forms_date_format)
+ results->forms_data->date_format = zenity_forms_date_format;
+ else
+ results->forms_data->date_format =
+ g_locale_to_utf8 (nl_langinfo (D_FMT), -1, NULL, NULL, NULL);
+ } else {
+ if (zenity_forms_date_format)
+ zenity_option_error (zenity_option_get_name (forms_dialog_options,
+ &zenity_forms_date_format),
+ ERROR_SUPPORT);
+ if (zenity_forms_list_values)
+ 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),
+ ERROR_SUPPORT);
+ if (zenity_forms_combo_values)
+ zenity_option_error (zenity_option_get_name (forms_dialog_options,
+ &zenity_forms_combo_values),
+ ERROR_SUPPORT);
+ if (zenity_forms_show_header)
+ zenity_option_error (zenity_option_get_name (forms_dialog_options,
+ &zenity_forms_show_header),
+ ERROR_SUPPORT);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+zenity_password_post_callback (GOptionContext *context, GOptionGroup *group,
+ 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);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+zenity_misc_post_callback (GOptionContext *context, GOptionGroup *group,
+ gpointer data, GError **error) {
+ zenity_option_set_dialog_mode (zenity_misc_about, MODE_ABOUT);
+ zenity_option_set_dialog_mode (zenity_misc_version, MODE_VERSION);
+
+ return TRUE;
+}
+
+static GOptionContext *
+zenity_create_context (void) {
+ GOptionContext *tmp_ctx;
+ GOptionGroup *a_group;
+
+ tmp_ctx = g_option_context_new (NULL);
+
+ /* Adds general option entries */
+ a_group = g_option_group_new ("general",
+ N_ ("General options"),
+ N_ ("Show general options"),
+ 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_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 calendar option entries */
+ a_group = g_option_group_new ("calendar",
+ N_ ("Calendar options"),
+ N_ ("Show calendar options"),
+ 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_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 entry option entries */
+ a_group = g_option_group_new ("entry",
+ N_ ("Text entry options"),
+ N_ ("Show text entry options"),
+ 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_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);
+ 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);
+ 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 info option entries */
+ 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);
+ 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 file selection option entries */
+ a_group = g_option_group_new ("file-selection",
+ N_ ("File selection options"),
+ N_ ("Show file selection options"),
+ NULL,
+ NULL);
+ g_option_group_add_entries (a_group, file_selection_options);
+ g_option_group_set_parse_hooks (
+ a_group, zenity_file_pre_callback, zenity_file_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 list option entries */
+ a_group = g_option_group_new (
+ "list", N_ ("List options"), N_ ("Show list options"), NULL, NULL);
+ g_option_group_add_entries (a_group, list_options);
+ g_option_group_set_parse_hooks (
+ a_group, zenity_list_pre_callback, zenity_list_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);
+
+#ifdef HAVE_LIBNOTIFY
+ /* Adds notification option entries */
+ a_group = g_option_group_new ("notification",
+ N_ ("Notification icon options"),
+ N_ ("Show notification icon options"),
+ NULL,
+ NULL);
+ g_option_group_add_entries (a_group, notification_options);
+ g_option_group_set_parse_hooks (a_group,
+ zenity_notification_pre_callback,
+ zenity_notification_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);
+#endif
+
+ /* Adds progress option entries */
+ a_group = g_option_group_new ("progress",
+ N_ ("Progress options"),
+ N_ ("Show progress options"),
+ NULL,
+ NULL);
+ g_option_group_add_entries (a_group, progress_options);
+ g_option_group_set_parse_hooks (
+ a_group, zenity_progress_pre_callback, zenity_progress_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 question option entries */
+ a_group = g_option_group_new ("question",
+ N_ ("Question options"),
+ N_ ("Show question options"),
+ 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_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 warning option entries */
+ a_group = g_option_group_new ("warning",
+ N_ ("Warning options"),
+ N_ ("Show warning options"),
+ 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_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);
+ 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);
+ 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 text option entries */
+ a_group = g_option_group_new ("text-info",
+ N_ ("Text information options"),
+ N_ ("Show text information options"),
+ NULL,
+ NULL);
+ g_option_group_add_entries (a_group, text_options);
+ g_option_group_set_parse_hooks (
+ a_group, zenity_text_pre_callback, zenity_text_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 color selection option entries */
+ a_group = g_option_group_new ("color-selection",
+ N_ ("Color selection options"),
+ N_ ("Show color selection options"),
+ 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_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 password dialog option entries */
+ a_group = g_option_group_new ("password",
+ N_ ("Password dialog options"),
+ N_ ("Show password dialog options"),
+ 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_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 forms dialog option entries */
+ a_group = g_option_group_new ("forms",
+ N_ ("Forms dialog options"),
+ N_ ("Show forms dialog options"),
+ 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_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 misc option entries */
+ a_group = g_option_group_new ("misc",
+ N_ ("Miscellaneous options"),
+ N_ ("Show miscellaneous options"),
+ 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_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);
+
+ return tmp_ctx;
+}
+
+void
+zenity_option_error (gchar *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) {
+ GError *error = NULL;
+
+ zenity_option_init ();
+
+ ctx = zenity_create_context ();
+
+ g_option_context_parse (ctx, &argc, &argv, &error);
+
+ /* Some option pointer a shared among more than one group and don't
+ have their post condition tested. This test is done here. */
+
+ if (zenity_general_dialog_text)
+ if (results->mode == MODE_ABOUT || results->mode == MODE_VERSION)
+ zenity_option_error (zenity_option_get_name (calendar_options,
+ &zenity_general_dialog_text),
+ ERROR_SUPPORT);
+
+ if (strcmp (zenity_general_separator, "|") != 0)
+ if (results->mode != MODE_LIST && results->mode != MODE_FILE &&
+ results->mode != MODE_FORMS)
+ zenity_option_error (zenity_option_get_name (
+ list_options, &zenity_general_separator),
+ ERROR_SUPPORT);
+
+ if (zenity_general_multiple)
+ if (results->mode != MODE_FILE && results->mode != MODE_LIST)
+ zenity_option_error (
+ zenity_option_get_name (list_options, &zenity_general_multiple),
+ ERROR_SUPPORT);
+
+ if (zenity_general_editable)
+ if (results->mode != MODE_TEXTINFO && results->mode != MODE_LIST)
+ zenity_option_error (
+ zenity_option_get_name (list_options, &zenity_general_editable),
+ ERROR_SUPPORT);
+
+ if (zenity_general_uri)
+ if (results->mode != MODE_FILE && results->mode != MODE_TEXTINFO)
+ zenity_option_error (
+ zenity_option_get_name (text_options, &zenity_general_uri),
+ ERROR_SUPPORT);
+
+ if (zenity_general_ok_button)
+ if (results->mode == MODE_FILE)
+ zenity_option_error (zenity_option_get_name (general_options,
+ &zenity_general_ok_button),
+ ERROR_SUPPORT);
+
+ if (zenity_general_cancel_button)
+ if (results->mode == MODE_FILE || results->mode == MODE_ERROR ||
+ results->mode == MODE_WARNING || results->mode == MODE_INFO)
+ zenity_option_error (zenity_option_get_name (general_options,
+ &zenity_general_cancel_button),
+ ERROR_SUPPORT);
+
+ if (zenity_general_dialog_no_wrap)
+ if (results->mode != MODE_INFO && results->mode != MODE_ERROR &&
+ results->mode != MODE_QUESTION && results->mode != MODE_WARNING &&
+ results->mode != MODE_TEXTINFO)
+ zenity_option_error (zenity_option_get_name (text_options,
+ &zenity_general_dialog_no_wrap),
+ ERROR_SUPPORT);
+
+ if (zenity_general_dialog_ellipsize)
+ if (results->mode != MODE_INFO && results->mode != MODE_ERROR &&
+ results->mode != MODE_QUESTION && results->mode != MODE_WARNING)
+ zenity_option_error (zenity_option_get_name (text_options,
+ &zenity_general_dialog_ellipsize),
+ ERROR_SUPPORT);
+
+ return results;
+}
diff --git a/src/option.h b/src/option.h
new file mode 100644
index 00000000..b495e0e7
--- /dev/null
+++ b/src/option.h
@@ -0,0 +1,89 @@
+/*
+ * option.h
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Glynn Foster <glynn.foster@sun.com>
+ * Lucas Rocha <lucasr@im.ufba.br>
+ */
+
+#ifndef OPTION_H
+#define OPTION_H
+
+#include "zenity.h"
+#include <glib.h>
+#include <langinfo.h>
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+typedef enum {
+ MODE_CALENDAR,
+ MODE_ENTRY,
+ MODE_ERROR,
+ MODE_FILE,
+ MODE_LIST,
+ MODE_PROGRESS,
+ MODE_QUESTION,
+ MODE_TEXTINFO,
+ MODE_WARNING,
+ MODE_SCALE,
+ MODE_INFO,
+#ifdef HAVE_LIBNOTIFY
+ MODE_NOTIFICATION,
+#endif
+ MODE_COLOR,
+ MODE_PASSWORD,
+ MODE_FORMS,
+ MODE_ABOUT,
+ MODE_VERSION,
+ MODE_LAST
+} ZenityDialogMode;
+
+typedef enum {
+ ERROR_SYNTAX,
+ ERROR_SUPPORT,
+ ERROR_DIALOG,
+ ERROR_LAST
+} ZenityError;
+
+typedef struct {
+ ZenityDialogMode mode;
+ ZenityData *data;
+
+ ZenityCalendarData *calendar_data;
+ ZenityMsgData *msg_data;
+ ZenityScaleData *scale_data;
+ ZenityFileData *file_data;
+ ZenityEntryData *entry_data;
+ ZenityProgressData *progress_data;
+ ZenityTextData *text_data;
+ ZenityTreeData *tree_data;
+#ifdef HAVE_LIBNOTIFY
+ ZenityNotificationData *notification_data;
+#endif
+ ZenityColorData *color_data;
+ ZenityPasswordData *password_data;
+ ZenityFormsData *forms_data;
+} ZenityParsingOptions;
+
+void zenity_option_error (gchar *string, ZenityError error);
+
+ZenityParsingOptions *zenity_option_parse (gint argc, gchar **argv);
+
+void zenity_option_free (void);
+
+#endif /* OPTION_H */
diff --git a/src/password.c b/src/password.c
new file mode 100644
index 00000000..44a2a204
--- /dev/null
+++ b/src/password.c
@@ -0,0 +1,173 @@
+/*
+ * password.c
+ *
+ * Copyright (C) 2010 Arx Cruz
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 121 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Arx Cruz <arxcruz@gmail.com>
+ */
+
+#include "config.h"
+#include "util.h"
+#include "zenity.h"
+#include <string.h>
+
+static ZenityData *zen_data;
+
+static void zenity_password_dialog_response (
+ GtkWidget *widget, int response, gpointer data);
+
+void
+zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data) {
+ GtkWidget *dialog;
+ GtkWidget *image;
+ GtkWidget *hbox;
+ GtkWidget *vbox_labels;
+ GtkWidget *vbox_entries;
+ GtkWidget *label;
+
+ zen_data = data;
+
+ dialog = gtk_dialog_new ();
+
+ 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_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);
+
+ 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);
+
+ /* Checks if username has been passed as a parameter */
+ gchar *title_text = N_ ("Type your password");
+
+ if (password_data->username)
+ title_text = N_ ("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);
+ password_data->entry_username = gtk_entry_new ();
+ gtk_box_pack_start (GTK_BOX (vbox_entries),
+ password_data->entry_username,
+ TRUE,
+ TRUE,
+ 12);
+ }
+
+ label = gtk_label_new (_ ("Password:"));
+ gtk_box_pack_start (GTK_BOX (vbox_labels), label, TRUE, FALSE, 12);
+ 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);
+
+ if (data->dialog_title)
+ gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
+
+ if (data->modal)
+ 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);
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ dialog);
+ }
+ gtk_main ();
+}
+
+static void
+zenity_password_dialog_response (
+ GtkWidget *widget, int response, gpointer data) {
+ ZenityPasswordData *password_data = (ZenityPasswordData *) data;
+ switch (response) {
+ case GTK_RESPONSE_OK:
+ zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
+ 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
+ g_print ("%s\n",
+ gtk_entry_get_text (
+ GTK_ENTRY (password_data->entry_password)));
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
+ default:
+ if (zen_data->extra_label &&
+ response < 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 ();
+}
diff --git a/src/progress.c b/src/progress.c
new file mode 100644
index 00000000..1a5a68fd
--- /dev/null
+++ b/src/progress.c
@@ -0,0 +1,429 @@
+/*
+ * progress.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Glynn Foster <glynn.foster@sun.com>
+ */
+
+#include "config.h"
+
+#include "util.h"
+#include "zenity.h"
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <time.h>
+#include <unistd.h>
+
+static GtkBuilder *builder;
+static ZenityData *zen_data;
+static GIOChannel *channel;
+
+static gint pulsate_timeout = -1;
+static gboolean autokill;
+static gboolean no_cancel;
+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 gboolean
+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) {
+ if (pulsate_timeout > 0) {
+ g_source_remove (pulsate_timeout);
+ pulsate_timeout = -1;
+ }
+}
+
+static void
+zenity_progress_pulsate_start (GObject *progress_bar) {
+ if (pulsate_timeout == -1) {
+ pulsate_timeout = g_timeout_add (
+ 100, zenity_progress_pulsate_progress_bar, progress_bar);
+ }
+}
+
+static void
+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");
+ if (start_time == (time_t) (-1) || percentage <= 0.0 ||
+ percentage >= 100.0) {
+ start_time = time (NULL);
+ gtk_label_set_text (GTK_LABEL (progress_time), "");
+ } 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;
+
+ seconds = (gulong) (remaining_time % 60);
+ remaining_time /= 60;
+ minutes = (gulong) (remaining_time % 60);
+ remaining_time /= 60;
+ hours = (gulong) remaining_time;
+
+ 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 gboolean
+zenity_progress_handle_stdin (
+ GIOChannel *channel, GIOCondition condition, gpointer data) {
+ static ZenityProgressData *progress_data;
+ static GObject *progress_bar;
+ static GObject *progress_label;
+ float percentage = 0.0;
+ GIOStatus status = G_IO_STATUS_NORMAL;
+
+ progress_data = (ZenityProgressData *) data;
+ progress_bar = gtk_builder_get_object (builder, "zenity_progress_bar");
+ progress_label = gtk_builder_get_object (builder, "zenity_progress_text");
+
+ if ((condition & G_IO_IN) != 0) {
+ GString *string;
+ GError *error = NULL;
+
+ string = g_string_new (NULL);
+
+ while (channel->is_readable != TRUE)
+ ;
+ do {
+ do {
+ status = g_io_channel_read_line_string (
+ channel, string, NULL, &error);
+
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+
+ } while (status == G_IO_STATUS_AGAIN);
+
+ if (status != G_IO_STATUS_NORMAL) {
+ if (error) {
+ g_warning (
+ "zenity_progress_handle_stdin () : %s", error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+ continue;
+ }
+
+ if (!g_ascii_strncasecmp (string->str, "#", 1)) {
+ gchar *match;
+
+ /* We have a comment, so let's try to change the label */
+ match = g_strstr_len (string->str, strlen (string->str), "#");
+ match++;
+ 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;
+
+ zenity_util_strip_newline (string->str);
+
+ colon = strchr (string->str, ':');
+ if (colon == NULL) {
+ continue;
+ }
+
+ /* split off the command and value */
+ command =
+ g_strstrip (g_strndup (string->str, colon - string->str));
+
+ value = colon + 1;
+ while (*value && g_ascii_isspace (*value))
+ value++;
+
+ if (!g_ascii_strcasecmp (value, "false")) {
+ zenity_progress_pulsate_stop ();
+
+ gtk_progress_bar_set_fraction (
+ GTK_PROGRESS_BAR (progress_bar),
+ progress_data->percentage / 100.0);
+ } else {
+ zenity_progress_pulsate_start (progress_bar);
+ }
+
+ g_free (command);
+ } else {
+
+ if (!g_ascii_isdigit (*(string->str)))
+ continue;
+
+ /* Now try to convert the thing to a number */
+ percentage = CLAMP (atoi (string->str), 0, 100);
+
+ 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) {
+ GObject *button;
+
+ button = gtk_builder_get_object (
+ builder, "zenity_progress_ok_button");
+ gtk_widget_set_sensitive (GTK_WIDGET (button), TRUE);
+ gtk_widget_grab_focus (GTK_WIDGET (button));
+
+ if (progress_data->autoclose) {
+ zen_data->exit_code =
+ zenity_util_return_exit_code (ZENITY_OK);
+ gtk_main_quit ();
+ }
+ }
+ }
+
+ } while ((g_io_channel_get_buffer_condition (channel) & G_IO_IN) ==
+ G_IO_IN &&
+ status != G_IO_STATUS_EOF);
+ g_string_free (string, TRUE);
+ }
+
+ 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"));
+ gtk_widget_set_sensitive (button, TRUE);
+ gtk_widget_grab_focus (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) {
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
+ gtk_main_quit ();
+ }
+
+ g_io_channel_shutdown (channel, TRUE, NULL);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void
+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);
+ g_io_add_watch (channel,
+ G_IO_IN | G_IO_HUP,
+ zenity_progress_handle_stdin,
+ 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) {
+ 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) {
+ GtkWidget *dialog;
+ GtkWidget *button;
+ GObject *text;
+ GObject *progress_bar;
+ GObject *cancel_button, *ok_button;
+
+ zen_data = data;
+ builder = zenity_util_load_ui_file ("zenity_progress_dialog", NULL);
+
+ if (builder == NULL) {
+ data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
+ 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"));
+
+ progress_bar = gtk_builder_get_object (builder, "zenity_progress_bar");
+
+ g_signal_connect (G_OBJECT (dialog),
+ "response",
+ G_CALLBACK (zenity_progress_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-progress.png"));
+
+ 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);
+ }
+
+ 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->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 (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);
+
+ autokill = progress_data->autokill;
+
+ auto_close = progress_data->autoclose;
+ ok_button = gtk_builder_get_object (builder, "zenity_progress_ok_button");
+
+ no_cancel = progress_data->no_cancel;
+ cancel_button =
+ gtk_builder_get_object (builder, "zenity_progress_cancel_button");
+
+ if (no_cancel) {
+ gtk_widget_hide (GTK_WIDGET (cancel_button));
+ gtk_window_set_deletable (GTK_WINDOW (dialog), FALSE);
+ }
+
+ if (no_cancel && auto_close)
+ gtk_widget_hide (GTK_WIDGET (ok_button));
+
+ zenity_util_show_dialog (dialog, data->attach);
+ zenity_progress_read_info (progress_data);
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ NULL);
+ }
+
+ gtk_main ();
+}
+
+static void
+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
+ */
+ if (autokill) {
+ kill (getppid (), 1);
+ }
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
+ 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))
+ printf ("%s\n", zen_data->extra_label[response]);
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
+ break;
+ }
+ gtk_main_quit ();
+}
diff --git a/src/scale.c b/src/scale.c
new file mode 100644
index 00000000..7e6686b3
--- /dev/null
+++ b/src/scale.c
@@ -0,0 +1,173 @@
+/*
+ * scale.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Lucas Rocha <lucasr@gnome.org>
+ */
+
+#include "config.h"
+
+#include "util.h"
+#include "zenity.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);
+
+void
+zenity_scale (ZenityData *data, ZenityScaleData *scale_data) {
+ GtkBuilder *builder;
+ GtkWidget *dialog;
+ GtkWidget *button;
+ GObject *text;
+
+ builder =
+ zenity_util_load_ui_file ("zenity_scale_dialog", "adjustment1", NULL);
+
+ if (builder == NULL) {
+ data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
+ return;
+ }
+
+ dialog =
+ GTK_WIDGET (gtk_builder_get_object (builder, "zenity_scale_dialog"));
+ scale =
+ 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);
+
+ 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) {
+ 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"));
+
+ 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++;
+ }
+ }
+
+ if (data->ok_label) {
+ button = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_scale_ok_button"));
+ gtk_button_set_label (GTK_BUTTON (button), data->ok_label);
+ }
+
+ if (data->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));
+
+ 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);
+
+ if (scale_data->hide_value)
+ gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
+
+ zenity_util_show_dialog (dialog, data->attach);
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ dialog);
+ }
+
+ g_object_unref (builder);
+
+ gtk_main ();
+}
+
+static void
+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) {
+ ZenityData *zen_data = data;
+
+ 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)));
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
+ case ZENITY_TIMEOUT:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_TIMEOUT);
+ g_print ("%.0f\n", gtk_range_get_value (GTK_RANGE (scale)));
+ break;
+
+ default:
+ if (zen_data->extra_label &&
+ response < 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 ();
+}
diff --git a/src/text.c b/src/text.c
new file mode 100644
index 00000000..ffe7b35e
--- /dev/null
+++ b/src/text.c
@@ -0,0 +1,448 @@
+/*
+ * text.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: 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
+
+static ZenityTextData *zen_text_data;
+
+static void zenity_text_dialog_response (
+ GtkWidget *widget, int response, gpointer data);
+static void zenity_text_toggle_button (GtkToggleButton *button, gpointer data);
+
+#ifdef HAVE_WEBKITGTK
+static void
+zenity_configure_webkit (WebKitWebView *web_view) {
+ WebKitSettings *settings;
+ settings = webkit_web_view_get_settings (web_view);
+ g_object_set (G_OBJECT (settings), "auto-load-images", TRUE, NULL);
+ /*
+ Stick to the defaults
+ "cursive-font-family" gchar* : Read / Write /
+ Construct
+ "default-encoding" gchar* : Read / Write /
+ Construct
+ "default-font-family" gchar* : Read / Write /
+ Construct
+ "default-font-size" gint : Read / Write /
+ Construct
+ "default-monospace-font-size" gint : Read / Write /
+ Construct
+ "editing-behavior" WebKitEditingBehavior : Read / Write /
+ Construct
+ */
+ g_object_set (G_OBJECT (settings), "enable-caret-browsing", FALSE, NULL);
+ g_object_set (G_OBJECT (settings), "enable-developer-extras", FALSE, NULL);
+ g_object_set (G_OBJECT (settings), "enable-fullscreen", FALSE, NULL);
+ g_object_set (G_OBJECT (settings), "enable-html5-database", FALSE, NULL);
+ g_object_set (
+ G_OBJECT (settings), "enable-html5-local-storage", FALSE, NULL);
+ g_object_set (G_OBJECT (settings), "enable-java", FALSE, NULL);
+ g_object_set (G_OBJECT (settings), "enable-javascript", FALSE, NULL);
+ g_object_set (G_OBJECT (settings),
+ "enable-offline-web-application-cache",
+ FALSE,
+ NULL);
+ g_object_set (G_OBJECT (settings), "enable-page-cache", FALSE, NULL);
+ g_object_set (G_OBJECT (settings), "enable-plugins", FALSE, NULL);
+ g_object_set (G_OBJECT (settings), "enable-private-browsing", TRUE, NULL);
+ /*
+ Stick to defaults
+ "enforce-96-dpi" gboolean : Read / Write /
+ Construct
+ "fantasy-font-family" gchar* : Read / Write /
+ Construct
+ */
+ /*
+ Stick to defaults
+ "minimum-font-size" gint : Read / Write /
+ Construct
+ "minimum-logical-font-size" gint : Read / Write /
+ Construct
+ "monospace-font-family" gchar* : Read / Write /
+ Construct
+ "print-backgrounds" gboolean : Read / Write /
+ Construct
+ "resizable-text-areas" gboolean : Read / Write /
+ Construct
+ "sans-serif-font-family" gchar* : Read / Write /
+ Construct
+ "serif-font-family" gchar* : Read / Write /
+ Construct
+ "spell-checking-languages" gchar* : Read / Write /
+ Construct
+ */
+ g_object_set (G_OBJECT (settings), "enable-tabs-to-links", FALSE, NULL);
+ g_object_set (G_OBJECT (settings),
+ "user-agent",
+ "Zenity with WebKit (KHTML, like Gecko) support",
+ NULL);
+ /*
+ Stick to defaults
+ "user-stylesheet-uri" gchar* : Read / Write /
+ Construct
+ "zoom-step" gfloat : Read / Write /
+ Construct
+ */
+}
+
+static gboolean
+zenity_text_webview_decision_request (WebKitWebView *web_view,
+ WebKitPolicyDecision *decision, WebKitPolicyDecisionType type) {
+ if (type == WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION) {
+ WebKitNavigationPolicyDecision *navigation_decision =
+ WEBKIT_NAVIGATION_POLICY_DECISION (decision);
+ WebKitNavigationAction *navigation_action =
+ webkit_navigation_policy_decision_get_navigation_action (
+ navigation_decision);
+ webkit_policy_decision_ignore (decision);
+ if (!zen_text_data->no_interaction &&
+ webkit_navigation_action_get_navigation_type (navigation_action) ==
+ WEBKIT_NAVIGATION_TYPE_LINK_CLICKED) {
+ WebKitURIRequest *request =
+ webkit_navigation_action_get_request (navigation_action);
+ g_app_info_launch_default_for_uri (
+ webkit_uri_request_get_uri (request), NULL, NULL);
+ }
+ }
+ return TRUE;
+}
+
+static void
+zenity_text_webview_load_changed (
+ WebKitWebView *webkitwebview, WebKitLoadEvent event, gpointer user_data) {
+ if (event == WEBKIT_LOAD_FINISHED) {
+ g_signal_connect (G_OBJECT (webkitwebview),
+ "decide-policy",
+ G_CALLBACK (zenity_text_webview_decision_request),
+ NULL);
+ }
+}
+
+#endif
+
+static gboolean
+zenity_text_handle_stdin (
+ GIOChannel *channel, GIOCondition condition, gpointer data) {
+ static GtkTextBuffer *buffer;
+ static GtkTextView *text_view;
+ gchar buf[1024];
+
+ 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))) {
+ GError *error = NULL;
+ gint status;
+
+ while (channel->is_readable != TRUE)
+ ;
+
+ do {
+ status = g_io_channel_read_chars (channel, buf, 1024, &len, &error);
+
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+
+ } while (status == G_IO_STATUS_AGAIN);
+
+ if (status != G_IO_STATUS_NORMAL) {
+ if (error) {
+ g_warning ("zenity_text_handle_stdin () : %s", error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+ return FALSE;
+ }
+
+ if (len > 0) {
+ GtkTextIter end;
+ gchar *utftext;
+ gsize localelen;
+ gsize utflen;
+
+ gtk_text_buffer_get_end_iter (buffer, &end);
+
+ if (!g_utf8_validate (buf, len, NULL)) {
+ utftext = g_convert_with_fallback (buf,
+ len,
+ "UTF-8",
+ "ISO-8859-1",
+ NULL,
+ &localelen,
+ &utflen,
+ NULL);
+ gtk_text_buffer_insert (buffer, &end, utftext, utflen);
+ g_free (utftext);
+ } 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 (mark != NULL)
+ 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) {
+ 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);
+}
+
+void
+zenity_text (ZenityData *data, ZenityTextData *text_data) {
+ GtkBuilder *builder;
+ GtkWidget *dialog;
+ GtkWidget *ok_button;
+ GtkWidget *checkbox;
+ GtkWidget *cancel_button;
+
+ GObject *text_view;
+ GtkTextBuffer *text_buffer;
+
+#ifdef HAVE_WEBKITGTK
+ GtkWidget *web_kit;
+ GtkWidget *scrolled_window;
+ GtkTextIter start_iter, end_iter;
+ gchar *content;
+#endif
+ zen_text_data = text_data;
+ builder =
+ zenity_util_load_ui_file ("zenity_text_dialog", "textbuffer1", 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_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"));
+
+ g_signal_connect (G_OBJECT (dialog),
+ "response",
+ G_CALLBACK (zenity_text_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-text.png"));
+
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
+
+ text_buffer = gtk_text_buffer_new (NULL);
+ text_view = gtk_builder_get_object (builder, "zenity_text_view");
+ gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), text_buffer);
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), text_data->editable);
+
+ 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->uri)
+ zenity_util_fill_file_buffer (text_buffer, text_data->uri);
+ else
+ zenity_text_fill_entries_from_stdin (GTK_TEXT_VIEW (text_view));
+
+ 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->ok_label) {
+ gtk_button_set_label (GTK_BUTTON (ok_button), data->ok_label);
+ }
+
+ if (data->cancel_label) {
+ gtk_button_set_label (GTK_BUTTON (cancel_button), data->cancel_label);
+ }
+
+ if (text_data->checkbox) {
+ gtk_widget_set_visible (GTK_WIDGET (checkbox), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (ok_button), FALSE);
+ gtk_button_set_label (GTK_BUTTON (checkbox), text_data->checkbox);
+
+ g_signal_connect (G_OBJECT (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), 300, 400);
+
+ if (data->modal)
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+
+#ifdef HAVE_WEBKITGTK
+ if (text_data->html) {
+ web_kit = webkit_web_view_new ();
+ scrolled_window = GTK_WIDGET (
+ gtk_builder_get_object (builder, "zenity_text_scrolled_window"));
+
+ zenity_configure_webkit (WEBKIT_WEB_VIEW (web_kit));
+
+ if (text_data->url) {
+ if (!(g_str_has_prefix (text_data->url, "http://") ||
+ g_str_has_prefix (text_data->url, "https://")))
+ text_data->url = g_strdup_printf ("http://%s", text_data->url);
+
+ webkit_web_view_load_uri (
+ WEBKIT_WEB_VIEW (web_kit), text_data->url);
+ } else {
+ gchar *cwd;
+ gchar *dirname;
+ gchar *dirname_uri;
+ dirname = text_data->uri ? g_path_get_dirname (text_data->uri)
+ : g_strdup ("/");
+ cwd = g_get_current_dir ();
+ dirname_uri = g_strconcat ("file://", cwd, "/", dirname, "/", NULL);
+ g_free (cwd);
+ g_free (dirname);
+ gtk_text_buffer_get_start_iter (text_buffer, &start_iter);
+ gtk_text_buffer_get_end_iter (text_buffer, &end_iter);
+ content = gtk_text_buffer_get_text (
+ text_buffer, &start_iter, &end_iter, TRUE);
+ webkit_web_view_load_html (
+ WEBKIT_WEB_VIEW (web_kit), content, dirname_uri);
+ g_free (dirname_uri);
+ g_free (content);
+ }
+
+ // We don't want user to click on links and navigate to another page.
+ // So, when the page finishes loading, we take handle of the requests.
+
+ g_signal_connect (G_OBJECT (web_kit),
+ "load-changed",
+ G_CALLBACK (zenity_text_webview_load_changed),
+ NULL);
+
+ gtk_widget_destroy (GTK_WIDGET (text_view));
+ gtk_container_add (GTK_CONTAINER (scrolled_window), web_kit);
+ gtk_widget_show (GTK_WIDGET (web_kit));
+ }
+#endif
+
+ zenity_util_show_dialog (dialog, data->attach);
+
+ g_object_unref (builder);
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ dialog);
+ }
+
+ gtk_main ();
+}
+
+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));
+}
+
+static void
+zenity_text_dialog_output (ZenityData *zen_data) {
+ if (zen_text_data->editable) {
+ GtkTextIter start, end;
+ gchar *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);
+ g_print ("%s", text);
+ g_free (text);
+ }
+}
+
+static void
+zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data) {
+ ZenityData *zen_data = data;
+
+ switch (response) {
+ case GTK_RESPONSE_CLOSE:
+ zenity_text_dialog_output (zen_data);
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
+ break;
+
+ case ZENITY_TIMEOUT:
+ zenity_text_dialog_output (zen_data);
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_TIMEOUT);
+ break;
+
+ default:
+ if (zen_data->extra_label &&
+ response < 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 ();
+}
diff --git a/src/tree.c b/src/tree.c
new file mode 100644
index 00000000..d94ce7e8
--- /dev/null
+++ b/src/tree.c
@@ -0,0 +1,845 @@
+/*
+ * tree.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * 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
+#define PRINT_HIDE_COLUMN_SEPARATOR ","
+
+static GtkBuilder *builder;
+static GSList *selected;
+static gchar *separator;
+static gboolean print_all_columns = FALSE;
+static gint *print_columns = NULL;
+static gint *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 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,
+ };
+
+ 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) {
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ gboolean value;
+
+ 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
+ */
+
+ if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (model), "radio")) == 1) {
+ gtk_tree_model_foreach (model, zenity_tree_dialog_untoggle, NULL);
+ }
+
+ path = gtk_tree_path_new_from_string (path_string);
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter, 0, &value, -1);
+
+ value = !value;
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, value, -1);
+
+ gtk_tree_path_free (path);
+}
+
+static void
+zenity_load_pixbuf (GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
+ GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) {
+ static GHashTable *pixbuf_cache = NULL;
+ GError *error = NULL;
+ GdkPixbuf *pixbuf;
+ gchar *str;
+
+ gtk_tree_model_get (tree_model, iter, 0, &str, -1);
+
+ if (!str)
+ return;
+
+ 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) {
+ pixbuf = gdk_pixbuf_new_from_file (str, &error);
+ if (!pixbuf)
+ g_warning ("Failed to load '%s'", str);
+
+ g_hash_table_insert (pixbuf_cache, g_strdup (str), pixbuf);
+ }
+
+ if (pixbuf)
+ g_object_set (cell, "pixbuf", pixbuf, NULL);
+
+ g_free (str);
+}
+
+static gboolean
+zenity_tree_handle_stdin (
+ GIOChannel *channel, GIOCondition condition, gpointer data) {
+ static GtkTreeView *tree_view;
+ GtkTreeModel *model;
+ static GtkTreeIter iter;
+ static gint column_count = 0;
+ static gint row_count = 0;
+ static gint 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);
+ n_columns =
+ GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tree_view), "n_columns"));
+ editable =
+ GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tree_view), "editable"));
+ toggles =
+ GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tree_view), "toggles"));
+
+ model = gtk_tree_view_get_model (tree_view);
+
+ if (first_time) {
+ first_time = FALSE;
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ }
+
+ if ((condition & G_IO_IN) == G_IO_IN) {
+ GString *string;
+ GError *error = NULL;
+
+ string = g_string_new (NULL);
+
+ while ((g_io_channel_get_flags (channel) & G_IO_FLAG_IS_READABLE) !=
+ G_IO_FLAG_IS_READABLE)
+ ;
+ 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
+ return FALSE;
+
+ while (gtk_events_pending ())
+ gtk_main_iteration ();
+
+ // TODO: 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 (error) {
+ g_warning (
+ "zenity_tree_handle_stdin () : %s", error->message);
+ g_error_free (error);
+ error = NULL;
+ }
+ continue;
+ }
+
+ 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 (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, FALSE, -1);
+ } else {
+ gtk_list_store_set (GTK_LIST_STORE (model),
+ &iter,
+ column_count,
+ zenity_util_strip_newline (string->str),
+ -1);
+ }
+
+ 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);
+ }
+
+ column_count++;
+
+ } while ((g_io_channel_get_buffer_condition (channel) & G_IO_IN) ==
+ G_IO_IN &&
+ status != G_IO_STATUS_EOF);
+ g_string_free (string, TRUE);
+ }
+
+ if ((condition & G_IO_IN) != G_IO_IN || status == G_IO_STATUS_EOF) {
+ g_io_channel_shutdown (channel, TRUE, NULL);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static void
+zenity_tree_fill_entries_from_stdin (GtkTreeView *tree_view, gint n_columns,
+ gboolean toggles, gboolean editable) {
+ g_object_set_data (
+ G_OBJECT (tree_view), "n_columns", GINT_TO_POINTER (n_columns));
+ g_object_set_data (
+ G_OBJECT (tree_view), "toggles", GINT_TO_POINTER (toggles));
+ g_object_set_data (
+ G_OBJECT (tree_view), "editable", GINT_TO_POINTER (editable));
+
+ 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);
+}
+
+static void
+zenity_tree_fill_entries (GtkTreeView *tree_view, const gchar **args,
+ gint n_columns, gboolean toggles, gboolean editable) {
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gint i = 0;
+
+ model = gtk_tree_view_get_model (tree_view);
+
+ g_object_set_data (
+ G_OBJECT (tree_view), "n_columns", GINT_TO_POINTER (n_columns));
+
+ while (args[i] != NULL) {
+ gint j;
+
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+
+ for (j = 0; j < n_columns; j++) {
+
+ if (toggles && j == 0) {
+ if (strcmp (g_ascii_strdown ((gchar *) args[i + j], -1),
+ "true") == 0)
+ gtk_list_store_set (
+ GTK_LIST_STORE (model), &iter, j, TRUE, -1);
+ else
+ gtk_list_store_set (
+ GTK_LIST_STORE (model), &iter, j, FALSE, -1);
+ } else
+ gtk_list_store_set (
+ 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);
+ }
+
+ 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;
+ 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) {
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ gint column;
+
+ model = GTK_TREE_MODEL (data);
+ path = gtk_tree_path_new_from_string (path_string);
+
+ column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
+ gtk_tree_model_get_iter (model, &iter, path);
+
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, column, new_text, -1);
+
+ gtk_tree_path_free (path);
+}
+
+void
+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;
+
+ builder = zenity_util_load_ui_file ("zenity_tree_dialog", NULL);
+
+ if (builder == NULL) {
+ data->exit_code = zenity_util_return_exit_code (ZENITY_ERROR);
+ return;
+ }
+
+ separator = g_strcompress (tree_data->separator);
+
+ n_columns = g_slist_length (tree_data->columns);
+
+ 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 {
+ 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 (n_columns == 0) {
+ 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) {
+ 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"));
+
+ g_signal_connect (G_OBJECT (dialog),
+ "response",
+ G_CALLBACK (zenity_tree_dialog_response),
+ data);
+
+ if (data->dialog_title)
+ gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
+
+ 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->ok_label) {
+ 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"));
+ 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));
+
+ zenity_util_set_window_icon (
+ dialog, data->window_icon, ZENITY_IMAGE_FULLPATH ("zenity-list.png"));
+
+ 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");
+
+ if (!(tree_data->radiobox || tree_data->checkbox))
+ 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);
+
+ if (tree_data->editable)
+ column_types = g_new (GType, n_columns + 1);
+ else
+ column_types = g_new (GType, n_columns);
+
+ 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))
+ column_types[i] = G_TYPE_BOOLEAN;
+ else
+ column_types[i] = G_TYPE_STRING;
+ }
+
+ if (tree_data->editable)
+ column_types[n_columns] = G_TYPE_BOOLEAN;
+
+ if (tree_data->editable)
+ gtk_list_store_set_column_types (model, n_columns + 1, column_types);
+ 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));
+
+ 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_SELECTION_MULTIPLE);
+ else
+ gtk_tree_selection_set_mode (
+ gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
+ GTK_SELECTION_SINGLE);
+ } else
+ gtk_tree_selection_set_mode (
+ gtk_tree_view_get_selection (GTK_TREE_VIEW (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) {
+ GtkCellRenderer *cell_renderer;
+
+ cell_renderer = gtk_cell_renderer_toggle_new ();
+
+ if (tree_data->radiobox) {
+ g_object_set (
+ G_OBJECT (cell_renderer), "radio", TRUE, NULL);
+ g_object_set_data (
+ G_OBJECT (model), "radio", GINT_TO_POINTER (1));
+ }
+
+ g_signal_connect (cell_renderer,
+ "toggled",
+ G_CALLBACK (zenity_tree_toggled_callback),
+ model);
+
+ column = gtk_tree_view_column_new_with_attributes (
+ tmp->data, cell_renderer, "active", column_index, NULL);
+ } 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) {
+ GtkCellRenderer *cell_renderer;
+
+ cell_renderer = gtk_cell_renderer_text_new ();
+ g_signal_connect (G_OBJECT (cell_renderer),
+ "edited",
+ G_CALLBACK (zenity_cell_edited_callback),
+ gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)));
+ g_object_set_data (G_OBJECT (cell_renderer),
+ "column",
+ GINT_TO_POINTER (column_index));
+
+ column =
+ gtk_tree_view_column_new_with_attributes (tmp->data,
+ cell_renderer,
+ "text",
+ column_index,
+ "editable",
+ n_columns,
+ NULL);
+ } else {
+ column =
+ gtk_tree_view_column_new_with_attributes (tmp->data,
+ gtk_cell_renderer_text_new (),
+ "text",
+ column_index,
+ NULL);
+ }
+
+ gtk_tree_view_column_set_sort_column_id (column, column_index);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ }
+ if (zenity_tree_column_is_hidden (1))
+ gtk_tree_view_column_set_visible (column, FALSE);
+
+ first_column = TRUE;
+ } else {
+ if (tree_data->editable) {
+ GtkCellRenderer *cell_renderer;
+
+ cell_renderer = gtk_cell_renderer_text_new ();
+ g_signal_connect (G_OBJECT (cell_renderer),
+ "edited",
+ G_CALLBACK (zenity_cell_edited_callback),
+ gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view)));
+ g_object_set_data (G_OBJECT (cell_renderer),
+ "column",
+ GINT_TO_POINTER (column_index));
+
+ column = gtk_tree_view_column_new_with_attributes (tmp->data,
+ cell_renderer,
+ "text",
+ column_index,
+ "editable",
+ n_columns,
+ NULL);
+ } else {
+ column = gtk_tree_view_column_new_with_attributes (tmp->data,
+ gtk_cell_renderer_text_new (),
+ "text",
+ column_index,
+ NULL);
+ }
+
+ gtk_tree_view_column_set_sort_column_id (column, column_index);
+ gtk_tree_view_column_set_resizable (column, TRUE);
+
+ if (zenity_tree_column_is_hidden (column_index + 1))
+ gtk_tree_view_column_set_visible (column, FALSE);
+ }
+
+ gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
+ column_index++;
+ }
+
+ if (tree_data->hide_header)
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (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),
+ tree_data->data,
+ n_columns,
+ TRUE,
+ tree_data->editable);
+ else
+ zenity_tree_fill_entries_from_stdin (GTK_TREE_VIEW (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),
+ tree_data->data,
+ n_columns,
+ FALSE,
+ tree_data->editable);
+ else
+ zenity_tree_fill_entries_from_stdin (GTK_TREE_VIEW (tree_view),
+ n_columns,
+ FALSE,
+ tree_data->editable);
+ }
+
+ zenity_util_show_dialog (dialog, data->attach);
+
+ if (tree_data->mid_search)
+ gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (tree_view),
+ (GtkTreeViewSearchEqualFunc) zenity_mid_search_func,
+ model,
+ NULL);
+
+ if (data->timeout_delay > 0) {
+ g_timeout_add_seconds (data->timeout_delay,
+ (GSourceFunc) zenity_util_timeout_handle,
+ dialog);
+ }
+
+ gtk_main ();
+
+ g_object_unref (builder);
+}
+
+static void
+zenity_tree_dialog_get_selected (GtkTreeModel *model, GtkTreePath *path_buf,
+ GtkTreeIter *iter, GtkTreeView *tree_view) {
+ GValue value = {
+ 0,
+ };
+ gint 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++) {
+ gtk_tree_model_get_value (model, iter, i, &value);
+
+ selected = g_slist_append (selected, g_value_dup_string (&value));
+ g_value_unset (&value);
+ }
+ return;
+ }
+
+ 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;
+
+ 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 (print_all_columns) {
+ for (i = 1; 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);
+ }
+ g_value_unset (&toggle_value);
+ return FALSE;
+ }
+
+ 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);
+ }
+ }
+
+ g_value_unset (&toggle_value);
+
+ return FALSE;
+}
+
+static void
+zenity_tree_dialog_output (void) {
+ GObject *tree_view;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+
+ tree_view = gtk_builder_get_object (builder, "zenity_tree_view");
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
+
+ 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));
+ gtk_tree_selection_selected_foreach (selection,
+ (GtkTreeSelectionForeachFunc) zenity_tree_dialog_get_selected,
+ GTK_TREE_VIEW (tree_view));
+ }
+
+ GSList *tmp;
+
+ for (tmp = selected; tmp; tmp = tmp->next) {
+ if (tmp->next != NULL) {
+ g_print ("%s%s", (gchar *) tmp->data, separator);
+ } else
+ g_print ("%s\n", (gchar *) tmp->data);
+ }
+
+ g_free (print_columns);
+ g_free (hide_columns);
+ g_free (separator);
+ g_slist_foreach (selected, (GFunc) g_free, NULL);
+ selected = NULL;
+}
+
+static void
+zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data) {
+ ZenityData *zen_data = data;
+
+ switch (response) {
+ case GTK_RESPONSE_OK:
+ zenity_tree_dialog_output ();
+ zenity_util_exit_code_with_data (ZENITY_OK, zen_data);
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_CANCEL);
+ break;
+
+ case ZENITY_TIMEOUT:
+ zenity_tree_dialog_output ();
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_TIMEOUT);
+ break;
+
+ default:
+ if (zen_data->extra_label &&
+ response < 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 ();
+}
+
+static void
+zenity_tree_row_activated (GtkTreeView *tree_view, GtkTreePath *tree_path,
+ GtkTreeViewColumn *tree_col, gpointer data) {
+ ZenityData *zen_data = data;
+
+ zenity_tree_dialog_output ();
+ zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
+ gtk_main_quit ();
+}
+
+static gboolean
+zenity_tree_column_is_hidden (gint column_index) {
+ gint i;
+
+ if (hide_columns != NULL)
+ for (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) {
+ char **tmp;
+ gint *result;
+ gint i, j, index;
+
+ tmp = g_strsplit (indexes, PRINT_HIDE_COLUMN_SEPARATOR, 0);
+
+ result = g_new (gint, 1);
+
+ for (j = i = 0; tmp[i] != NULL; i++) {
+ index = atoi (tmp[i]);
+
+ if (index > 0 && index <= n_columns) {
+ result[j] = index;
+ j++;
+ result = g_renew (gint, result, j + 1);
+ }
+ }
+ result[j] = 0;
+
+ g_strfreev (tmp);
+
+ return result;
+}
diff --git a/src/util.c b/src/util.c
new file mode 100644
index 00000000..0c101866
--- /dev/null
+++ b/src/util.c
@@ -0,0 +1,417 @@
+/*
+ * util.c
+ *
+ * Copyright (C) 2002 Sun Microsystems, Inc.
+ * (C) 1999, 2000 Red Hat Inc.
+ * (C) 1998 James Henstridge
+ * (C) 1995-2002 Free Software Foundation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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.
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * Authors: Glynn Foster <glynn.foster@sun.com>
+ * Havoc Pennington <hp@redhat.com>
+ * James Henstridge <james@daa.com.au>
+ * Tom Tromey <tromey@redhat.com>
+ */
+
+#include "config.h"
+
+#include "config.h"
+#include "util.h"
+#include "zenity.h"
+#include <errno.h>
+#include <locale.h>
+#include <stdarg.h>
+#include <stdio.h>
+#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
+#define ZENITY_ERROR_DEFAULT -1
+#define ZENITY_EXTRA_DEFAULT 127
+
+GtkBuilder *
+zenity_util_load_ui_file (const gchar *root_widget, ...) {
+ va_list args;
+ gchar *arg = NULL;
+ GPtrArray *ptrarray;
+ GtkBuilder *builder = gtk_builder_new ();
+ GError *error = NULL;
+ gchar **objects;
+ guint result = 0;
+
+ gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
+
+ /* We have at least the root_widget and a NULL */
+ ptrarray = g_ptr_array_sized_new (2);
+
+ g_ptr_array_add (ptrarray, g_strdup (root_widget));
+
+ va_start (args, root_widget);
+
+ arg = va_arg (args, gchar *);
+
+ while (arg) {
+ g_ptr_array_add (ptrarray, g_strdup (arg));
+ arg = va_arg (args, gchar *);
+ }
+ 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);
+ }
+
+ if (result == 0)
+ result = gtk_builder_add_objects_from_file (
+ builder, ZENITY_UI_FILE_FULLPATH, objects, &error);
+
+ g_strfreev (objects);
+
+ if (result == 0) {
+ g_warning ("Could not load ui file %s: %s",
+ ZENITY_UI_FILE_FULLPATH,
+ error->message);
+ g_error_free (error);
+ g_object_unref (builder);
+ return NULL;
+ }
+
+ return builder;
+}
+gchar *
+zenity_util_strip_newline (gchar *string) {
+ gsize len;
+
+ g_return_val_if_fail (string != NULL, NULL);
+
+ len = strlen (string);
+ while (len--) {
+ if (string[len] == '\n')
+ string[len] = '\0';
+ else
+ break;
+ }
+
+ return string;
+}
+
+gboolean
+zenity_util_fill_file_buffer (GtkTextBuffer *buffer, const gchar *filename) {
+ GtkTextIter iter, end;
+ FILE *f;
+ gchar buf[2048];
+ gint remaining = 0;
+
+ if (filename == NULL)
+ return FALSE;
+
+ f = fopen (filename, "r");
+
+ if (f == NULL) {
+ g_warning ("Cannot open file '%s': %s", filename, g_strerror (errno));
+ return FALSE;
+ }
+
+ gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
+
+ while (!feof (f)) {
+ gint count;
+ const char *leftover;
+ int to_read = 2047 - remaining;
+
+ count = fread (buf + remaining, 1, to_read, f);
+ buf[count + remaining] = '\0';
+
+ g_utf8_validate (buf, count + remaining, &leftover);
+
+ g_assert (g_utf8_validate (buf, leftover - buf, NULL));
+ gtk_text_buffer_insert (buffer, &iter, buf, leftover - buf);
+
+ remaining = (buf + remaining + count) - leftover;
+ g_memmove (buf, leftover, remaining);
+
+ if (remaining > 6 || count < to_read)
+ break;
+ }
+
+ if (remaining) {
+ g_warning (
+ "Invalid UTF-8 data encountered reading file '%s'", filename);
+ return FALSE;
+ }
+
+ /* We had a newline in the buffer to begin with. (The buffer always contains
+ * a newline, so we delete to the end of the buffer to clean up.
+ */
+
+ gtk_text_buffer_get_end_iter (buffer, &end);
+ gtk_text_buffer_delete (buffer, &iter, &end);
+
+ gtk_text_buffer_set_modified (buffer, FALSE);
+
+ 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;
+ tmp = g_find_program_in_path ("yelp");
+
+ if (tmp) {
+ g_free (tmp);
+ g_spawn_command_line_async ("yelp help:zenity", error);
+ }
+}
+
+gint
+zenity_util_return_exit_code (ZenityExitCode value) {
+
+ const gchar *env_var = NULL;
+ gint retval;
+
+ switch (value) {
+
+ case ZENITY_OK:
+ env_var = g_getenv ("ZENITY_OK");
+ if (!env_var)
+ env_var = g_getenv ("DIALOG_OK");
+ if (!env_var)
+ retval = ZENITY_OK_DEFAULT;
+ break;
+
+ case ZENITY_CANCEL:
+ env_var = g_getenv ("ZENITY_CANCEL");
+ if (!env_var)
+ env_var = g_getenv ("DIALOG_CANCEL");
+ if (!env_var)
+ retval = ZENITY_CANCEL_DEFAULT;
+ break;
+
+ case ZENITY_ESC:
+ env_var = g_getenv ("ZENITY_ESC");
+ if (!env_var)
+ env_var = g_getenv ("DIALOG_ESC");
+ if (!env_var)
+ retval = ZENITY_ESC_DEFAULT;
+ break;
+
+ case ZENITY_EXTRA:
+ env_var = g_getenv ("ZENITY_EXTRA");
+ if (!env_var)
+ env_var = g_getenv ("DIALOG_EXTRA");
+ if (!env_var)
+ retval = ZENITY_EXTRA_DEFAULT;
+ break;
+
+ case ZENITY_ERROR:
+ env_var = g_getenv ("ZENITY_ERROR");
+ if (!env_var)
+ env_var = g_getenv ("DIALOG_ERROR");
+ if (!env_var)
+ retval = ZENITY_ERROR_DEFAULT;
+ break;
+
+ case ZENITY_TIMEOUT:
+ env_var = g_getenv ("ZENITY_TIMEOUT");
+ if (!env_var)
+ env_var = g_getenv ("DIALOG_TIMEOUT");
+ if (!env_var)
+ retval = ZENITY_TIMEOUT;
+ break;
+
+ default:
+ retval = 1;
+ }
+
+ if (env_var)
+ retval = atoi (env_var);
+ return retval;
+}
+
+void
+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;
+ gdk_error_trap_push ();
+ ret = XGetWindowAttributes (
+ GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), wid, &attrs);
+ gdk_flush ();
+ if (gdk_error_trap_pop () != 0 || ret == 0) {
+ return None;
+ }
+ return wid;
+ }
+ }
+ return None;
+}
+
+static void
+transient_x_free (void *ptr) {
+ if (ptr)
+ XFree (ptr);
+}
+
+static gboolean
+transient_is_toplevel (Window wid) {
+ XTextProperty prop;
+ Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+ if (!XGetWMName (dpy, wid, &prop))
+ return FALSE;
+ transient_x_free (prop.value);
+ return !!prop.value;
+}
+
+/*
+ * GNOME Terminal doesn't give us its toplevel window, but the WM needs a
+ * toplevel XID for proper stacking. Other terminals work fine without this
+ * magic. We can't use GDK here since "xterm" is a foreign window.
+ */
+
+static Window
+transient_get_xterm_toplevel (void) {
+ Window xterm = transient_get_xterm ();
+ Display *dpy = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
+ while (xterm != None && !transient_is_toplevel (xterm)) {
+ Window root, parent, *children;
+ unsigned nchildren;
+ XQueryTree (dpy, xterm, &root, &parent, &children, &nchildren);
+ transient_x_free (children);
+ if (parent == root)
+ xterm = None;
+ else
+ xterm = parent;
+ }
+ return xterm;
+}
+
+static void
+zenity_util_make_transient (GdkWindow *window, Window parent) {
+ Window parent_window = parent;
+ if (parent_window == 0)
+ parent_window = transient_get_xterm_toplevel ();
+ if (parent_window != None) {
+ XSetTransientForHint (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+ GDK_WINDOW_XID (window),
+ parent_window);
+ }
+}
+
+#endif /* GDK_WINDOWING_X11 */
+
+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
+ gtk_widget_show (dialog);
+}
+
+gboolean
+zenity_util_timeout_handle (gpointer data) {
+ GtkDialog *dialog = GTK_DIALOG (data);
+ if (dialog != NULL)
+ gtk_dialog_response (dialog, ZENITY_TIMEOUT);
+ else {
+ gtk_main_quit ();
+ exit (ZENITY_TIMEOUT);
+ }
+ return FALSE;
+}
diff --git a/src/util.h b/src/util.h
new file mode 100644
index 00000000..3e5391b2
--- /dev/null
+++ b/src/util.h
@@ -0,0 +1,35 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+#include "zenity.h"
+#include <gtk/gtk.h>
+
+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);
+void zenity_util_show_help (GError **error);
+gint 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);
+
+gboolean zenity_util_timeout_handle (gpointer data);
+
+G_END_DECLS
+
+#endif /* UTIL_H */
diff --git a/src/zenity.h b/src/zenity.h
new file mode 100644
index 00000000..b86a264d
--- /dev/null
+++ b/src/zenity.h
@@ -0,0 +1,213 @@
+#ifndef ZENITY_H
+#define ZENITY_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#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
+
+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;
+ gboolean modal;
+ guintptr attach;
+} ZenityData;
+
+typedef enum {
+ ZENITY_OK,
+ ZENITY_CANCEL,
+ ZENITY_ESC,
+ ZENITY_ERROR,
+ ZENITY_EXTRA,
+ ZENITY_TIMEOUT
+} ZenityExitCode;
+
+typedef struct {
+ gchar *dialog_text;
+ gint day;
+ gint month;
+ gint year;
+ gchar *date_format;
+} ZenityCalendarData;
+
+typedef enum {
+ ZENITY_MSG_WARNING,
+ ZENITY_MSG_QUESTION,
+ ZENITY_MSG_SWITCH,
+ ZENITY_MSG_ERROR,
+ ZENITY_MSG_INFO
+} MsgMode;
+
+typedef struct {
+ gchar *dialog_text;
+ gchar *dialog_icon;
+ MsgMode mode;
+ gboolean no_wrap;
+ gboolean no_markup;
+ gboolean default_cancel;
+ gboolean ellipsize;
+} ZenityMsgData;
+
+typedef struct {
+ gchar *dialog_text;
+ gint value;
+ gint min_value;
+ gint max_value;
+ gint step;
+ gboolean print_partial;
+ gboolean hide_value;
+} ZenityScaleData;
+
+typedef struct {
+ gchar *uri;
+ gboolean multi;
+ gboolean directory;
+ gboolean save;
+ gboolean confirm_overwrite;
+ gchar *separator;
+ gchar **filter;
+} ZenityFileData;
+
+typedef struct {
+ gchar *dialog_text;
+ gchar *entry_text;
+ gboolean hide_text;
+ const gchar **data;
+} ZenityEntryData;
+
+typedef struct {
+ gchar *dialog_text;
+ gchar *entry_text;
+ gboolean pulsate;
+ gboolean autoclose;
+ gboolean autokill;
+ gdouble percentage;
+ gboolean no_cancel;
+ gboolean time_remaining;
+} ZenityProgressData;
+
+typedef struct {
+ gchar *uri;
+ gboolean editable;
+ gboolean no_wrap;
+ gboolean auto_scroll;
+ gchar *font;
+ GtkTextBuffer *buffer;
+ gchar *checkbox;
+#ifdef HAVE_WEBKITGTK
+ gboolean html;
+ gboolean no_interaction;
+ gchar *url;
+#endif
+} ZenityTextData;
+
+typedef struct {
+ gchar *dialog_text;
+ GSList *columns;
+ gboolean checkbox;
+ gboolean radiobox;
+ gboolean hide_header;
+ gboolean imagebox;
+ gchar *separator;
+ gboolean multi;
+ gboolean editable;
+ gboolean mid_search;
+ gchar *print_column;
+ gchar *hide_column;
+ const gchar **data;
+} ZenityTreeData;
+
+#ifdef HAVE_LIBNOTIFY
+typedef struct {
+ gchar *notification_text;
+ gboolean listen;
+ gchar **notification_hints;
+} ZenityNotificationData;
+#endif
+
+typedef struct {
+ gchar *color;
+ gboolean show_palette;
+} ZenityColorData;
+
+typedef struct {
+ GSList *list;
+ GSList *list_widgets;
+ GSList *list_values;
+ GSList *column_values;
+ GSList *combo_values;
+ gchar *dialog_text;
+ gchar *separator;
+ gchar *date_format;
+ // gchar *hide_column;
+ gboolean show_header;
+} ZenityFormsData;
+
+typedef enum {
+ ZENITY_FORMS_ENTRY,
+ ZENITY_FORMS_PASSWORD,
+ ZENITY_FORMS_CALENDAR,
+ ZENITY_FORMS_LIST,
+ ZENITY_FORMS_COMBO
+} ZenityFormsType;
+
+typedef struct {
+ gchar *option_value;
+ ZenityFormsType type;
+ GtkWidget *forms_widget;
+} ZenityFormsValue;
+
+typedef struct {
+ gboolean username;
+ gchar *password;
+ GtkWidget *entry_username;
+ GtkWidget *entry_password;
+} ZenityPasswordData;
+
+void zenity_calendar (ZenityData *data, ZenityCalendarData *calendar_data);
+void zenity_msg (ZenityData *data, ZenityMsgData *msg_data);
+void zenity_fileselection (ZenityData *data, ZenityFileData *file_data);
+void zenity_entry (ZenityData *data, ZenityEntryData *entry_data);
+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);
+#endif
+
+void zenity_colorselection (
+ ZenityData *data, ZenityColorData *notification_data);
+void zenity_scale (ZenityData *data, ZenityScaleData *scale_data);
+void zenity_about (ZenityData *data);
+
+void zenity_password_dialog (
+ ZenityData *data, ZenityPasswordData *password_data);
+void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data);
+G_END_DECLS
+
+#endif /* ZENITY_H */
diff --git a/src/zenity.ui b/src/zenity.ui
new file mode 100644
index 00000000..13594422
--- /dev/null
+++ b/src/zenity.ui
@@ -0,0 +1,1150 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<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>
+</interface>
bgstack15