Author: rpmcruz
Date: Fri Jan 18 12:58:22 2008
New Revision: 43731
URL: http://svn.opensuse.org/viewcvs/yast?rev=43731&view=rev
Log:
10.3 fixes.
Added:
trunk/gtk/10_3/src/.cvsignore
trunk/gtk/10_3/src/Makefile
trunk/gtk/10_3/src/Makefile.am
trunk/gtk/10_3/src/Makefile.in
trunk/gtk/10_3/src/Y2CCGtk.cc
trunk/gtk/10_3/src/YGBarGraph.cc
trunk/gtk/10_3/src/YGComboBox.cc
trunk/gtk/10_3/src/YGDialog.cc
trunk/gtk/10_3/src/YGDialog.h
trunk/gtk/10_3/src/YGDumbTab.cc
trunk/gtk/10_3/src/YGFrame.cc
trunk/gtk/10_3/src/YGImage.cc
trunk/gtk/10_3/src/YGIntField.cc
trunk/gtk/10_3/src/YGLabel.cc
trunk/gtk/10_3/src/YGLayout.cc
trunk/gtk/10_3/src/YGMenuButton.cc
trunk/gtk/10_3/src/YGMultiLineEdit.cc
trunk/gtk/10_3/src/YGPackageSelector.cc
trunk/gtk/10_3/src/YGProgressBar.cc
trunk/gtk/10_3/src/YGPushButton.cc
trunk/gtk/10_3/src/YGRadioButton.cc
trunk/gtk/10_3/src/YGTable.cc
trunk/gtk/10_3/src/YGTextEntry.cc
trunk/gtk/10_3/src/YGTime.cc
trunk/gtk/10_3/src/YGTree.cc
trunk/gtk/10_3/src/YGUI.cc
trunk/gtk/10_3/src/YGUI.h
trunk/gtk/10_3/src/YGUtils.cc
trunk/gtk/10_3/src/YGUtils.h
trunk/gtk/10_3/src/YGWidget.cc
trunk/gtk/10_3/src/YGWidget.h
trunk/gtk/10_3/src/YGWizard.cc
trunk/gtk/10_3/src/YGi18n.h
trunk/gtk/10_3/src/dummy (with props)
trunk/gtk/10_3/src/dummy.cc
trunk/gtk/10_3/src/icons/
trunk/gtk/10_3/src/icons/pkg-available-locked.xpm
trunk/gtk/10_3/src/icons/pkg-available.xpm
trunk/gtk/10_3/src/icons/pkg-install-auto.xpm
trunk/gtk/10_3/src/icons/pkg-install.xpm
trunk/gtk/10_3/src/icons/pkg-installed-locked.xpm
trunk/gtk/10_3/src/icons/pkg-installed-upgradable-locked.xpm
trunk/gtk/10_3/src/icons/pkg-installed-upgradable.xpm
trunk/gtk/10_3/src/icons/pkg-installed.xpm
trunk/gtk/10_3/src/icons/pkg-list-mode.xpm
trunk/gtk/10_3/src/icons/pkg-locked.xpm
trunk/gtk/10_3/src/icons/pkg-remove-auto.xpm
trunk/gtk/10_3/src/icons/pkg-remove.xpm
trunk/gtk/10_3/src/icons/pkg-tiles-mode.xpm
trunk/gtk/10_3/src/icons/pkg-unlocked.xpm
trunk/gtk/10_3/src/mng-loader.c
trunk/gtk/10_3/src/mng-loader.h
trunk/gtk/10_3/src/pkg-selector-help.h
trunk/gtk/10_3/src/test.cc
trunk/gtk/10_3/src/ygdkmngloader.c
trunk/gtk/10_3/src/ygdkmngloader.h
trunk/gtk/10_3/src/ygtkbargraph.c
trunk/gtk/10_3/src/ygtkbargraph.h
trunk/gtk/10_3/src/ygtkfieldentry.c
trunk/gtk/10_3/src/ygtkfieldentry.h
trunk/gtk/10_3/src/ygtkfindentry.c
trunk/gtk/10_3/src/ygtkfindentry.h
trunk/gtk/10_3/src/ygtkhtmlwrap.c
trunk/gtk/10_3/src/ygtkhtmlwrap.h
trunk/gtk/10_3/src/ygtkimage.c
trunk/gtk/10_3/src/ygtkimage.h
trunk/gtk/10_3/src/ygtkmenubutton.c
trunk/gtk/10_3/src/ygtkmenubutton.h
trunk/gtk/10_3/src/ygtkratiobox.c
trunk/gtk/10_3/src/ygtkratiobox.h
trunk/gtk/10_3/src/ygtkrichtext.c
trunk/gtk/10_3/src/ygtkrichtext.h
trunk/gtk/10_3/src/ygtkscrolledwindow.c
trunk/gtk/10_3/src/ygtkscrolledwindow.h
trunk/gtk/10_3/src/ygtksteps.c
trunk/gtk/10_3/src/ygtksteps.h
trunk/gtk/10_3/src/ygtktogglebutton.c
trunk/gtk/10_3/src/ygtktogglebutton.h
trunk/gtk/10_3/src/ygtkwizard.c
trunk/gtk/10_3/src/ygtkwizard.h
trunk/gtk/10_3/src/ygtkzyppwrapper.cc
trunk/gtk/10_3/src/ygtkzyppwrapper.h
trunk/gtk/10_3/src/yzyppwrapper.cc
trunk/gtk/10_3/src/yzyppwrapper.h
Added: trunk/gtk/10_3/src/.cvsignore
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/.cvsignore?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/.cvsignore (added)
+++ trunk/gtk/10_3/src/.cvsignore Fri Jan 18 12:58:22 2008
@@ -0,0 +1,7 @@
+Makefile.in
+Makefile
+*.lo
+*.la
+.libs
+.deps
+dummy
Added: trunk/gtk/10_3/src/Makefile
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/Makefile?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/Makefile (added)
+++ trunk/gtk/10_3/src/Makefile Fri Jan 18 12:58:22 2008
@@ -0,0 +1,777 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# src/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006 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.
+
+
+
+
+
+
+pkgdatadir = $(datadir)/yast2-gtk
+pkglibdir = $(libdir)/yast2-gtk
+pkgincludedir = $(includedir)/yast2-gtk
+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 = i686-suse-linux-gnu
+host_triplet = i686-suse-linux-gnu
+target_triplet = i686-suse-linux-gnu
+noinst_PROGRAMS = dummy$(EXEEXT)
+check_PROGRAMS = test$(EXEEXT)
+subdir = src
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+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 = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(plugindir)"
+pluginLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(plugin_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libpy2gtk_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libpy2gtk_la_OBJECTS = Y2CCGtk.lo YGUtils.lo YGUI.lo YGDialog.lo \
+ YGLayout.lo YGWidget.lo YGLabel.lo YGPushButton.lo \
+ YGProgressBar.lo YGTextEntry.lo YGMultiLineEdit.lo \
+ YGIntField.lo YGRadioButton.lo YGImage.lo YGFrame.lo \
+ YGComboBox.lo YGTable.lo YGTree.lo YGMenuButton.lo \
+ YGBarGraph.lo YGDumbTab.lo YGWizard.lo YGTime.lo \
+ YGPackageSelector.lo ygtkratiobox.lo ygtkbargraph.lo \
+ ygtksteps.lo ygtkfieldentry.lo ygtkmenubutton.lo ygtkwizard.lo \
+ ygtkfindentry.lo ygdkmngloader.lo ygtkimage.lo ygtkhtmlwrap.lo \
+ ygtkrichtext.lo yzyppwrapper.lo ygtkzyppwrapper.lo \
+ ygtkscrolledwindow.lo ygtktogglebutton.lo
+libpy2gtk_la_OBJECTS = $(am_libpy2gtk_la_OBJECTS)
+libpy2gtk_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(libpy2gtk_la_LDFLAGS) $(LDFLAGS) -o $@
+PROGRAMS = $(noinst_PROGRAMS)
+am_dummy_OBJECTS = dummy.$(OBJEXT)
+dummy_OBJECTS = $(am_dummy_OBJECTS)
+dummy_DEPENDENCIES = libpy2gtk.la
+am_test_OBJECTS = test.$(OBJEXT)
+test_OBJECTS = $(am_test_OBJECTS)
+test_DEPENDENCIES = $(top_builddir)/src/$(plugin_LTLIBRARIES)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libpy2gtk_la_SOURCES) $(dummy_SOURCES) $(test_SOURCES)
+DIST_SOURCES = $(libpy2gtk_la_SOURCES) $(dummy_SOURCES) \
+ $(test_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/rick2/Documents/yast/gtk/10_3/missing --run aclocal-1.10
+AGENT_LIBADD = -L$(libdir) -lscr
+ALLOCA =
+AMTAR = ${SHELL} /home/rick2/Documents/yast/gtk/10_3/missing --run tar
+AR = ar
+AUTOCONF = ${SHELL} /home/rick2/Documents/yast/gtk/10_3/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/rick2/Documents/yast/gtk/10_3/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/rick2/Documents/yast/gtk/10_3/missing --run automake-1.10
+AWK = gawk
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -g -O2 -Wall -Wformat=2 -Wmissing-prototypes
+CPP = gcc -E
+CPPFLAGS =
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2 -Wall -Wformat=2
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /usr/bin/grep -E
+EXEEXT =
+F77 =
+FFLAGS =
+GREP = /usr/bin/grep
+GTK_CFLAGS = -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12
+GTK_LIBS = -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgmodule-2.0 -ldl -lgthread-2.0 -lrt -lgobject-2.0 -lglib-2.0
+INSTALL = /usr/bin/install -c -p
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+LDFLAGS =
+LIBOBJS =
+LIBS =
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+LTLIBOBJS =
+MAINTAINER = Ricardo Cruz Michael Meeks
+MAKEINFO = ${SHELL} /home/rick2/Documents/yast/gtk/10_3/missing --run makeinfo
+MKDIR_P = /bin/mkdir -p
+OBJEXT = o
+PACKAGE = yast2-gtk
+PACKAGE_BUGREPORT = http://bugs.opensuse.org/
+PACKAGE_NAME = yast2-gtk
+PACKAGE_STRING = yast2-gtk 2.15.9
+PACKAGE_TARNAME = yast2-gtk
+PACKAGE_VERSION = 2.15.9
+PATH_SEPARATOR = :
+PKG_CONFIG = /usr/bin/pkg-config
+PKG_CONFIG_PATH =
+PYUI_LIBS = -lpy2UI
+RANLIB = ranlib
+RPMNAME = yast2-gtk
+SED = /usr/bin/sed
+SET_MAKE =
+SHELL = /bin/sh
+STRIP = strip
+STYLESHEET_CSS = /usr/share/YaST2/data/docbook/css/yast2docs.css
+STYLESHEET_HTML = /usr/share/YaST2/data/docbook/stylesheets/customize-html.xsl
+STYLESHEET_PDF = /usr/share/YaST2/data/docbook/stylesheets/customize-fo.xsl
+STYLESHEET_YCPDOC = /usr/share/YaST2/data/docbook/stylesheets/ycpdoc.xsl
+STYLESHEET_YDOC = /usr/share/YaST2/data/docbook/stylesheets/ydoc.xsl
+VERSION = 2.15.9
+XGETTEXT = /usr/bin/xgettext
+Y2DEVTOOLS_PREFIX = /usr
+YDOXYGEN = /usr/lib/YaST2/bin/ydoxygen
+ZYPP_CFLAGS =
+ZYPP_LIBS = -lzypp
+abs_builddir = /home/rick2/Documents/yast/gtk/10_3/src
+abs_srcdir = /home/rick2/Documents/yast/gtk/10_3/src
+abs_top_builddir = /home/rick2/Documents/yast/gtk/10_3
+abs_top_srcdir = /home/rick2/Documents/yast/gtk/10_3
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_F77 =
+agentdir = ${prefix}/lib/YaST2/servers_non_y2
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = tar --format=ustar -chf - "$$tardir"
+am__untar = tar -xf -
+bindir = ${exec_prefix}/bin
+build = i686-suse-linux-gnu
+build_alias =
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = suse
+builddir = .
+clientdir = ${prefix}/share/YaST2/clients
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+desktopdir = ${prefix}/share/applications/YaST2
+docdir = ${prefix}/share/doc/packages/yast2-gtk
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+execcompdir = ${prefix}/lib/YaST2
+fillupdir = /var/adm/fillup-templates
+host = i686-suse-linux-gnu
+host_alias =
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = suse
+htmldir = ${docdir}
+imagedir = ${prefix}/share/YaST2/images
+includedir = ${prefix}/include/YaST2
+infodir = ${datarootdir}/info
+install_sh = $(SHELL) /home/rick2/Documents/yast/gtk/10_3/install-sh
+libdir = /usr/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${prefix}/share/YaST2/locale
+localstatedir = ${prefix}/var
+mandir = ${prefix}/share/man
+mkdir_p = /bin/mkdir -p
+moduledir = ${prefix}/share/YaST2/modules
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+pkgconfigdatadir = ${datadir}/pkgconfig
+pkgconfigdir = ${libdir}/pkgconfig
+plugindir = ${libdir}/YaST2/plugin
+potdir = ${docdir}/pot
+prefix = /usr
+program_transform_name = s,x,x,
+psdir = ${docdir}
+sbindir = ${exec_prefix}/sbin
+schemadir = ${prefix}/share/YaST2/schema
+scrconfdir = ${prefix}/share/YaST2/scrconf
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target = i686-suse-linux-gnu
+target_alias =
+target_cpu = i686
+target_os = linux-gnu
+target_vendor = suse
+themedir = ${prefix}/share/YaST2/theme
+top_builddir = ..
+top_srcdir = ..
+yast2dir = ${prefix}/share/YaST2
+ybindir = ${prefix}/lib/YaST2/bin
+ydatadir = ${prefix}/share/YaST2/data
+yncludedir = ${prefix}/share/YaST2/include
+ystartupdir = ${prefix}/lib/YaST2
+AM_CFLAGS = $(GTK_CFLAGS) \
+ -DTHEMEDIR=\"${themedir}/current\"
+
+AM_CXXFLAGS = $(GTK_CFLAGS) \
+ -DY2LOG=\"ui-gtk\" \
+ -DTHEMEDIR=\"${themedir}/current\"
+
+noinst_HEADERS = $(wildcard *.h)
+
+# plugin, libtool forces 'lib' prefix
+plugin_LTLIBRARIES = libpy2gtk.la
+libpy2gtk_la_LDFLAGS = -version-info 2:0
+libpy2gtk_la_LIBADD = -L$(plugindir) $(PYUI_LIBS) -L$(libdir) -lycp -ly2 \
+ $(GTK_LIBS) $(ZYPP_LIBS) $(GTKHTML_LIBS)
+
+libpy2gtk_la_SOURCES = \
+ Y2CCGtk.cc \
+ YGUtils.cc \
+ YGUI.cc \
+ YGDialog.cc \
+ YGLayout.cc \
+ YGWidget.cc \
+ YGLabel.cc \
+ YGPushButton.cc \
+ YGProgressBar.cc \
+ YGTextEntry.cc \
+ YGMultiLineEdit.cc \
+ YGIntField.cc \
+ YGRadioButton.cc \
+ YGImage.cc \
+ YGFrame.cc \
+ YGComboBox.cc \
+ YGTable.cc \
+ YGTree.cc \
+ YGMenuButton.cc \
+ YGBarGraph.cc \
+ YGDumbTab.cc \
+ YGWizard.cc \
+ YGTime.cc \
+ YGPackageSelector.cc \
+ ygtkratiobox.c \
+ ygtkbargraph.c \
+ ygtksteps.c \
+ ygtkfieldentry.c \
+ ygtkmenubutton.c \
+ ygtkwizard.c \
+ ygtkfindentry.c \
+ ygdkmngloader.c \
+ ygtkimage.c \
+ ygtkhtmlwrap.c \
+ ygtkrichtext.c \
+ yzyppwrapper.cc \
+ ygtkzyppwrapper.cc \
+ ygtkscrolledwindow.c \
+ ygtktogglebutton.c
+
+# should only append ygtkrichtext.c if USE_GTKHTML is set
+dummy_SOURCES = dummy.cc
+dummy_LDADD = libpy2gtk.la
+TESTS = $(check_PROGRAMS)
+test_SOURCES = test.cc
+test_LDADD = $(top_builddir)/src/$(plugin_LTLIBRARIES)
+INCLUDES = -I$(srcdir)/include -I$(includedir) -I$(includedir)/yui $(ZYPP_CFLAGS)
+EXTRA_DIST = \
+ icons/pkg-available-locked.xpm \
+ icons/pkg-installed-upgradable.xpm \
+ icons/pkg-remove-auto.xpm \
+ icons/pkg-available.xpm \
+ icons/pkg-installed.xpm \
+ icons/pkg-remove.xpm \
+ icons/pkg-install-auto.xpm \
+ icons/pkg-install.xpm \
+ icons/pkg-tiles-mode.xpm \
+ icons/pkg-installed-locked.xpm \
+ icons/pkg-list-mode.xpm \
+ icons/pkg-unlocked.xpm \
+ icons/pkg-installed-upgradable-locked.xpm \
+ icons/pkg-locked.xpm \
+ pkg-selector-help.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cc .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: 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: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
+ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-pluginLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \
+ done
+
+clean-pluginLTLIBRARIES:
+ -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libpy2gtk.la: $(libpy2gtk_la_OBJECTS) $(libpy2gtk_la_DEPENDENCIES)
+ $(libpy2gtk_la_LINK) -rpath $(plugindir) $(libpy2gtk_la_OBJECTS) $(libpy2gtk_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+dummy$(EXEEXT): $(dummy_OBJECTS) $(dummy_DEPENDENCIES)
+ @rm -f dummy$(EXEEXT)
+ $(CXXLINK) $(dummy_OBJECTS) $(dummy_LDADD) $(LIBS)
+test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES)
+ @rm -f test$(EXEEXT)
+ $(CXXLINK) $(test_OBJECTS) $(test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/Y2CCGtk.Plo
+include ./$(DEPDIR)/YGBarGraph.Plo
+include ./$(DEPDIR)/YGComboBox.Plo
+include ./$(DEPDIR)/YGDialog.Plo
+include ./$(DEPDIR)/YGDumbTab.Plo
+include ./$(DEPDIR)/YGFrame.Plo
+include ./$(DEPDIR)/YGImage.Plo
+include ./$(DEPDIR)/YGIntField.Plo
+include ./$(DEPDIR)/YGLabel.Plo
+include ./$(DEPDIR)/YGLayout.Plo
+include ./$(DEPDIR)/YGMenuButton.Plo
+include ./$(DEPDIR)/YGMultiLineEdit.Plo
+include ./$(DEPDIR)/YGPackageSelector.Plo
+include ./$(DEPDIR)/YGProgressBar.Plo
+include ./$(DEPDIR)/YGPushButton.Plo
+include ./$(DEPDIR)/YGRadioButton.Plo
+include ./$(DEPDIR)/YGTable.Plo
+include ./$(DEPDIR)/YGTextEntry.Plo
+include ./$(DEPDIR)/YGTime.Plo
+include ./$(DEPDIR)/YGTree.Plo
+include ./$(DEPDIR)/YGUI.Plo
+include ./$(DEPDIR)/YGUtils.Plo
+include ./$(DEPDIR)/YGWidget.Plo
+include ./$(DEPDIR)/YGWizard.Plo
+include ./$(DEPDIR)/dummy.Po
+include ./$(DEPDIR)/test.Po
+include ./$(DEPDIR)/ygdkmngloader.Plo
+include ./$(DEPDIR)/ygtkbargraph.Plo
+include ./$(DEPDIR)/ygtkfieldentry.Plo
+include ./$(DEPDIR)/ygtkfindentry.Plo
+include ./$(DEPDIR)/ygtkhtmlwrap.Plo
+include ./$(DEPDIR)/ygtkimage.Plo
+include ./$(DEPDIR)/ygtkmenubutton.Plo
+include ./$(DEPDIR)/ygtkratiobox.Plo
+include ./$(DEPDIR)/ygtkrichtext.Plo
+include ./$(DEPDIR)/ygtkscrolledwindow.Plo
+include ./$(DEPDIR)/ygtksteps.Plo
+include ./$(DEPDIR)/ygtktogglebutton.Plo
+include ./$(DEPDIR)/ygtkwizard.Plo
+include ./$(DEPDIR)/ygtkzyppwrapper.Plo
+include ./$(DEPDIR)/yzyppwrapper.Plo
+
+.c.o:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+# source='$<' object='$@' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LTCOMPILE) -c -o $@ $<
+
+.cc.o:
+ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+# $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+# $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+# source='$<' object='$@' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \
+# $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+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 $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(plugindir)"; 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:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+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-checkPROGRAMS clean-generic clean-libtool \
+ clean-noinstPROGRAMS clean-pluginLTLIBRARIES 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
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+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
+
+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 \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool \
+ clean-noinstPROGRAMS clean-pluginLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am 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-pluginLTLIBRARIES \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-pluginLTLIBRARIES
+
+# 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:
Added: trunk/gtk/10_3/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/Makefile.am?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/Makefile.am (added)
+++ trunk/gtk/10_3/src/Makefile.am Fri Jan 18 12:58:22 2008
@@ -0,0 +1,87 @@
+AM_CFLAGS = $(GTK_CFLAGS) \
+ -DTHEMEDIR=\"${themedir}/current\"
+AM_CXXFLAGS = $(GTK_CFLAGS) \
+ -DY2LOG=\"ui-gtk\" \
+ -DTHEMEDIR=\"${themedir}/current\"
+
+noinst_HEADERS = $(wildcard *.h)
+
+# test linkage for missing symbols etc.
+noinst_PROGRAMS = dummy
+
+# plugin, libtool forces 'lib' prefix
+plugin_LTLIBRARIES = libpy2gtk.la
+
+libpy2gtk_la_LDFLAGS = -version-info 2:0
+libpy2gtk_la_LIBADD = -L$(plugindir) $(PYUI_LIBS) -L$(libdir) -lycp -ly2 \
+ $(GTK_LIBS) $(ZYPP_LIBS) $(GTKHTML_LIBS)
+libpy2gtk_la_SOURCES = \
+ Y2CCGtk.cc \
+ YGUtils.cc \
+ YGUI.cc \
+ YGDialog.cc \
+ YGLayout.cc \
+ YGWidget.cc \
+ YGLabel.cc \
+ YGPushButton.cc \
+ YGProgressBar.cc \
+ YGTextEntry.cc \
+ YGMultiLineEdit.cc \
+ YGIntField.cc \
+ YGRadioButton.cc \
+ YGImage.cc \
+ YGFrame.cc \
+ YGComboBox.cc \
+ YGTable.cc \
+ YGTree.cc \
+ YGMenuButton.cc \
+ YGBarGraph.cc \
+ YGDumbTab.cc \
+ YGWizard.cc \
+ YGTime.cc \
+ YGPackageSelector.cc \
+ ygtkratiobox.c \
+ ygtkbargraph.c \
+ ygtksteps.c \
+ ygtkfieldentry.c \
+ ygtkmenubutton.c \
+ ygtkwizard.c \
+ ygtkfindentry.c \
+ ygdkmngloader.c \
+ ygtkimage.c \
+ ygtkhtmlwrap.c \
+ ygtkrichtext.c \
+ yzyppwrapper.cc \
+ ygtkzyppwrapper.cc \
+ ygtkscrolledwindow.c \
+ ygtktogglebutton.c
+# should only append ygtkrichtext.c if USE_GTKHTML is set
+
+dummy_SOURCES = dummy.cc
+dummy_LDADD = libpy2gtk.la
+
+check_PROGRAMS = test
+TESTS = $(check_PROGRAMS)
+
+test_SOURCES = test.cc
+test_LDADD = $(top_builddir)/src/$(plugin_LTLIBRARIES)
+
+INCLUDES = -I$(srcdir)/include -I$(includedir) -I$(includedir)/yui $(ZYPP_CFLAGS)
+
+EXTRA_DIST = \
+ icons/pkg-available-locked.xpm \
+ icons/pkg-installed-upgradable.xpm \
+ icons/pkg-remove-auto.xpm \
+ icons/pkg-available.xpm \
+ icons/pkg-installed.xpm \
+ icons/pkg-remove.xpm \
+ icons/pkg-install-auto.xpm \
+ icons/pkg-install.xpm \
+ icons/pkg-tiles-mode.xpm \
+ icons/pkg-installed-locked.xpm \
+ icons/pkg-list-mode.xpm \
+ icons/pkg-unlocked.xpm \
+ icons/pkg-installed-upgradable-locked.xpm \
+ icons/pkg-locked.xpm \
+ pkg-selector-help.h
+
Added: trunk/gtk/10_3/src/Makefile.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/Makefile.in?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/Makefile.in (added)
+++ trunk/gtk/10_3/src/Makefile.in Fri Jan 18 12:58:22 2008
@@ -0,0 +1,777 @@
+# Makefile.in generated by automake 1.10 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006 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@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@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@
+target_triplet = @target@
+noinst_PROGRAMS = dummy$(EXEEXT)
+check_PROGRAMS = test$(EXEEXT)
+subdir = src
+DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+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 = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(plugindir)"
+pluginLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(plugin_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libpy2gtk_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_libpy2gtk_la_OBJECTS = Y2CCGtk.lo YGUtils.lo YGUI.lo YGDialog.lo \
+ YGLayout.lo YGWidget.lo YGLabel.lo YGPushButton.lo \
+ YGProgressBar.lo YGTextEntry.lo YGMultiLineEdit.lo \
+ YGIntField.lo YGRadioButton.lo YGImage.lo YGFrame.lo \
+ YGComboBox.lo YGTable.lo YGTree.lo YGMenuButton.lo \
+ YGBarGraph.lo YGDumbTab.lo YGWizard.lo YGTime.lo \
+ YGPackageSelector.lo ygtkratiobox.lo ygtkbargraph.lo \
+ ygtksteps.lo ygtkfieldentry.lo ygtkmenubutton.lo ygtkwizard.lo \
+ ygtkfindentry.lo ygdkmngloader.lo ygtkimage.lo ygtkhtmlwrap.lo \
+ ygtkrichtext.lo yzyppwrapper.lo ygtkzyppwrapper.lo \
+ ygtkscrolledwindow.lo ygtktogglebutton.lo
+libpy2gtk_la_OBJECTS = $(am_libpy2gtk_la_OBJECTS)
+libpy2gtk_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(libpy2gtk_la_LDFLAGS) $(LDFLAGS) -o $@
+PROGRAMS = $(noinst_PROGRAMS)
+am_dummy_OBJECTS = dummy.$(OBJEXT)
+dummy_OBJECTS = $(am_dummy_OBJECTS)
+dummy_DEPENDENCIES = libpy2gtk.la
+am_test_OBJECTS = test.$(OBJEXT)
+test_OBJECTS = $(am_test_OBJECTS)
+test_DEPENDENCIES = $(top_builddir)/src/$(plugin_LTLIBRARIES)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libpy2gtk_la_SOURCES) $(dummy_SOURCES) $(test_SOURCES)
+DIST_SOURCES = $(libpy2gtk_la_SOURCES) $(dummy_SOURCES) \
+ $(test_SOURCES)
+HEADERS = $(noinst_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AGENT_LIBADD = @AGENT_LIBADD@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINTAINER = @MAINTAINER@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+PYUI_LIBS = @PYUI_LIBS@
+RANLIB = @RANLIB@
+RPMNAME = @RPMNAME@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+STYLESHEET_CSS = @STYLESHEET_CSS@
+STYLESHEET_HTML = @STYLESHEET_HTML@
+STYLESHEET_PDF = @STYLESHEET_PDF@
+STYLESHEET_YCPDOC = @STYLESHEET_YCPDOC@
+STYLESHEET_YDOC = @STYLESHEET_YDOC@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+Y2DEVTOOLS_PREFIX = @Y2DEVTOOLS_PREFIX@
+YDOXYGEN = @YDOXYGEN@
+ZYPP_CFLAGS = @ZYPP_CFLAGS@
+ZYPP_LIBS = @ZYPP_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@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+agentdir = @agentdir@
+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@
+clientdir = @clientdir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+desktopdir = @desktopdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+execcompdir = @execcompdir@
+fillupdir = @fillupdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+imagedir = @imagedir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+moduledir = @moduledir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgconfigdatadir = @pkgconfigdatadir@
+pkgconfigdir = @pkgconfigdir@
+plugindir = @plugindir@
+potdir = @potdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+schemadir = @schemadir@
+scrconfdir = @scrconfdir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+themedir = @themedir@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+yast2dir = @yast2dir@
+ybindir = @ybindir@
+ydatadir = @ydatadir@
+yncludedir = @yncludedir@
+ystartupdir = @ystartupdir@
+AM_CFLAGS = $(GTK_CFLAGS) \
+ -DTHEMEDIR=\"${themedir}/current\"
+
+AM_CXXFLAGS = $(GTK_CFLAGS) \
+ -DY2LOG=\"ui-gtk\" \
+ -DTHEMEDIR=\"${themedir}/current\"
+
+noinst_HEADERS = $(wildcard *.h)
+
+# plugin, libtool forces 'lib' prefix
+plugin_LTLIBRARIES = libpy2gtk.la
+libpy2gtk_la_LDFLAGS = -version-info 2:0
+libpy2gtk_la_LIBADD = -L$(plugindir) $(PYUI_LIBS) -L$(libdir) -lycp -ly2 \
+ $(GTK_LIBS) $(ZYPP_LIBS) $(GTKHTML_LIBS)
+
+libpy2gtk_la_SOURCES = \
+ Y2CCGtk.cc \
+ YGUtils.cc \
+ YGUI.cc \
+ YGDialog.cc \
+ YGLayout.cc \
+ YGWidget.cc \
+ YGLabel.cc \
+ YGPushButton.cc \
+ YGProgressBar.cc \
+ YGTextEntry.cc \
+ YGMultiLineEdit.cc \
+ YGIntField.cc \
+ YGRadioButton.cc \
+ YGImage.cc \
+ YGFrame.cc \
+ YGComboBox.cc \
+ YGTable.cc \
+ YGTree.cc \
+ YGMenuButton.cc \
+ YGBarGraph.cc \
+ YGDumbTab.cc \
+ YGWizard.cc \
+ YGTime.cc \
+ YGPackageSelector.cc \
+ ygtkratiobox.c \
+ ygtkbargraph.c \
+ ygtksteps.c \
+ ygtkfieldentry.c \
+ ygtkmenubutton.c \
+ ygtkwizard.c \
+ ygtkfindentry.c \
+ ygdkmngloader.c \
+ ygtkimage.c \
+ ygtkhtmlwrap.c \
+ ygtkrichtext.c \
+ yzyppwrapper.cc \
+ ygtkzyppwrapper.cc \
+ ygtkscrolledwindow.c \
+ ygtktogglebutton.c
+
+# should only append ygtkrichtext.c if USE_GTKHTML is set
+dummy_SOURCES = dummy.cc
+dummy_LDADD = libpy2gtk.la
+TESTS = $(check_PROGRAMS)
+test_SOURCES = test.cc
+test_LDADD = $(top_builddir)/src/$(plugin_LTLIBRARIES)
+INCLUDES = -I$(srcdir)/include -I$(includedir) -I$(includedir)/yui $(ZYPP_CFLAGS)
+EXTRA_DIST = \
+ icons/pkg-available-locked.xpm \
+ icons/pkg-installed-upgradable.xpm \
+ icons/pkg-remove-auto.xpm \
+ icons/pkg-available.xpm \
+ icons/pkg-installed.xpm \
+ icons/pkg-remove.xpm \
+ icons/pkg-install-auto.xpm \
+ icons/pkg-install.xpm \
+ icons/pkg-tiles-mode.xpm \
+ icons/pkg-installed-locked.xpm \
+ icons/pkg-list-mode.xpm \
+ icons/pkg-unlocked.xpm \
+ icons/pkg-installed-upgradable-locked.xpm \
+ icons/pkg-locked.xpm \
+ pkg-selector-help.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cc .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/Makefile
+.PRECIOUS: 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: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
+ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(plugindir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(pluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(plugindir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-pluginLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$p"; \
+ done
+
+clean-pluginLTLIBRARIES:
+ -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libpy2gtk.la: $(libpy2gtk_la_OBJECTS) $(libpy2gtk_la_DEPENDENCIES)
+ $(libpy2gtk_la_LINK) -rpath $(plugindir) $(libpy2gtk_la_OBJECTS) $(libpy2gtk_la_LIBADD) $(LIBS)
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+dummy$(EXEEXT): $(dummy_OBJECTS) $(dummy_DEPENDENCIES)
+ @rm -f dummy$(EXEEXT)
+ $(CXXLINK) $(dummy_OBJECTS) $(dummy_LDADD) $(LIBS)
+test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES)
+ @rm -f test$(EXEEXT)
+ $(CXXLINK) $(test_OBJECTS) $(test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Y2CCGtk.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGBarGraph.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGComboBox.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGDialog.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGDumbTab.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGFrame.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGImage.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGIntField.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGLabel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGLayout.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGMenuButton.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGMultiLineEdit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGPackageSelector.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGProgressBar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGPushButton.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGRadioButton.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGTable.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGTextEntry.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGTime.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGTree.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGUI.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGUtils.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGWidget.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YGWizard.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygdkmngloader.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkbargraph.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkfieldentry.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkfindentry.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkhtmlwrap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkimage.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkmenubutton.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkratiobox.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkrichtext.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkscrolledwindow.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtksteps.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtktogglebutton.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkwizard.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ygtkzyppwrapper.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/yzyppwrapper.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+.cc.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+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 $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(plugindir)"; 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:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+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-checkPROGRAMS clean-generic clean-libtool \
+ clean-noinstPROGRAMS clean-pluginLTLIBRARIES 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
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+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
+
+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 \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool \
+ clean-noinstPROGRAMS clean-pluginLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am 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-pluginLTLIBRARIES \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-pluginLTLIBRARIES
+
+# 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:
Added: trunk/gtk/10_3/src/Y2CCGtk.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/Y2CCGtk.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/Y2CCGtk.cc (added)
+++ trunk/gtk/10_3/src/Y2CCGtk.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,68 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include
+
+#if YAST2_VERSION >= 2015006
+// New UI plugin work
+# include
+# define NEW_UI_PLUGIN
+# define Y2CCUI_INIT
+#else
+# define Y2CCUI Y2ComponentCreator
+# define Y2CCUI_INIT Y2ComponentBroker::BUILTIN
+#endif
+
+class YGUIComponent : public YUIComponent
+{
+public:
+
+ YGUIComponent() : YUIComponent() {}
+
+ virtual string name() const { return "gtk"; }
+
+ virtual YUI *createUI (int argc, char **argv,
+ bool with_threads, const char * macro_file)
+ {
+#ifdef IMPL_DEBUG
+ fprintf (stderr, "Create a gtk+ UI: %d '%s' !\n", with_threads, macro_file);
+#endif
+ return new YGUI (argc, argv, with_threads, macro_file);
+ }
+};
+
+class Y2CCGtk : public Y2CCUI
+{
+public:
+ Y2CCGtk () : Y2CCUI (Y2CCUI_INIT) { };
+
+ bool isServerCreator () const { return true; };
+
+ Y2Component *create (const char * name) const
+ {
+ y2milestone( "Creating %s component", name );
+ if (!strcmp (name, "gtk") ) {
+#ifdef NEW_UI_PLUGIN
+ Y2Component* ret = YUIComponent::uiComponent ();
+ if (!ret || ret->name () != name) {
+ y2debug ("UI component is %s, creating %s", ret? ret->name().c_str() : "NULL", name);
+ ret = new YGUIComponent();
+ }
+ return ret;
+#else
+ return new YGUIComponent();
+#endif
+ }
+ else
+ return 0;
+ }
+};
+
+// Singleton plugin registration instance.
+Y2CCGtk g_y2ccgtk;
+
+
Added: trunk/gtk/10_3/src/YGBarGraph.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGBarGraph.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGBarGraph.cc (added)
+++ trunk/gtk/10_3/src/YGBarGraph.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,193 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGWidget.h"
+#include "ygtkbargraph.h"
+
+#include "YBarGraph.h"
+
+class YGBarGraph : public YBarGraph, public YGWidget
+{
+public:
+ YGBarGraph (const YWidgetOpt &opt, YGWidget *parent)
+ : YBarGraph (opt)
+ , YGWidget (this, parent, true, YGTK_TYPE_BAR_GRAPH, NULL)
+ { }
+
+ // YBarGraph
+ virtual void doUpdate()
+ {
+ ygtk_bar_graph_create_entries (YGTK_BAR_GRAPH (getWidget()), segments());
+ for (int i = 0; i < segments(); i++)
+ ygtk_bar_graph_setup_entry (YGTK_BAR_GRAPH (getWidget()), i,
+ label(i).c_str(), value(i));
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createBarGraph (YWidget *parent, YWidgetOpt &opt)
+{
+ return new YGBarGraph (opt, YGWidget::get (parent));
+}
+
+#include "YPartitionSplitter.h"
+
+class YGPartitionSplitter : public YPartitionSplitter, public YGWidget
+{
+public:
+ YGtkBarGraph *m_barGraph;
+ bool m_showDelta;
+ GtkWidget *m_scale, *m_free_spin, *m_new_spin;
+ string m_freeLabel, m_newPartLabel;
+
+ YGPartitionSplitter (const YWidgetOpt &opt, YGWidget *parent,
+ int _usedSize, int _totalFreeSize, int _newPartSize,
+ int _minNewPartSize, int _minFreeSize,
+ const YCPString &usedLabel, const YCPString &freeLabel,
+ const YCPString &newPartLabel, const YCPString &freeFieldLabel,
+ const YCPString &newPartFieldLabel)
+ : YPartitionSplitter (opt, _usedSize, _totalFreeSize, _newPartSize,
+ _minNewPartSize, _minFreeSize, usedLabel,
+ freeLabel, newPartLabel, freeFieldLabel,
+ newPartFieldLabel)
+ , YGWidget (this, parent, true, GTK_TYPE_VBOX, NULL)
+ {
+ /* Bar graph widget */
+ GtkWidget *graph = ygtk_bar_graph_new();
+ m_barGraph = YGTK_BAR_GRAPH (graph);
+ ygtk_bar_graph_create_entries (m_barGraph, 3);
+ ygtk_bar_graph_setup_entry (m_barGraph, 0, usedLabel->value_cstr(),
+ usedSize());
+ m_freeLabel = freeLabel->value();
+ m_newPartLabel = newPartLabel->value();
+ // the others are setup-ed on SetValue()
+
+ /* Labels over the slider */
+ GtkWidget *labels_box, *free_label, *new_part_label;
+ labels_box = gtk_hbox_new (FALSE, 0);
+ free_label = gtk_label_new (freeFieldLabel->value_cstr());
+ new_part_label = gtk_label_new (newPartFieldLabel->value_cstr());
+ gtk_box_pack_start (GTK_BOX (labels_box), free_label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (labels_box), new_part_label, FALSE, FALSE, 0);
+
+ /* Slider and the spinners */
+ m_showDelta = opt.countShowDelta.value();
+
+ GtkWidget *slider_box = gtk_hbox_new (FALSE, 0);
+ m_scale = gtk_hscale_new_with_range (minFreeSize(), maxFreeSize(), 1);
+ gtk_scale_set_draw_value (GTK_SCALE (m_scale), FALSE);
+ m_free_spin = gtk_spin_button_new_with_range
+ (minFreeSize(), maxFreeSize(), 1);
+ m_new_spin = gtk_spin_button_new_with_range
+ (minNewPartSize(), maxNewPartSize(), 1);
+
+ gtk_box_pack_start (GTK_BOX (slider_box), m_free_spin, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (slider_box), m_scale, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (slider_box), m_new_spin, FALSE, FALSE, 0);
+
+ g_signal_connect (G_OBJECT (m_scale), "value-changed",
+ G_CALLBACK (scale_changed_cb), this);
+ g_signal_connect (G_OBJECT (m_free_spin), "value-changed",
+ G_CALLBACK (free_spin_changed_cb), this);
+ g_signal_connect (G_OBJECT (m_new_spin), "value-changed",
+ G_CALLBACK (new_spin_changed_cb), this);
+
+ /* Main layout */
+ gtk_box_pack_start (GTK_BOX (getWidget()), graph, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (getWidget()), labels_box, FALSE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (getWidget()), slider_box, FALSE, TRUE, 2);
+
+ setValue (newPartSize()); // initialization
+ gtk_widget_show_all (getWidget());
+ }
+
+ // YPartitionSplitter
+ virtual void setValue (int newValue)
+ {
+ IMPL
+ YPartitionSplitter::setValue (newValue);
+
+ ygtk_bar_graph_setup_entry (m_barGraph, 1, m_freeLabel.c_str(),
+ remainingFreeSize());
+ ygtk_bar_graph_setup_entry (m_barGraph, 2, m_newPartLabel.c_str(),
+ newPartSize());
+
+ // block connections
+ g_signal_handlers_block_by_func (m_scale,
+ (gpointer) scale_changed_cb, this);
+ g_signal_handlers_block_by_func (m_free_spin,
+ (gpointer) free_spin_changed_cb, this);
+ g_signal_handlers_block_by_func (m_new_spin,
+ (gpointer) new_spin_changed_cb, this);
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_free_spin),
+ remainingFreeSize());
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_new_spin),
+ newPartSize());
+ gtk_range_set_value (GTK_RANGE (m_scale), remainingFreeSize());
+
+ // unblock connections
+ g_signal_handlers_unblock_by_func (m_scale,
+ (gpointer) scale_changed_cb, this);
+ g_signal_handlers_unblock_by_func (m_free_spin,
+ (gpointer) free_spin_changed_cb, this);
+ g_signal_handlers_unblock_by_func (m_new_spin,
+ (gpointer) new_spin_changed_cb, this);
+ }
+
+ static void scale_changed_cb (GtkRange *range, YGPartitionSplitter *pThis)
+ {
+ IMPL
+ int newFreeSize = (int) gtk_range_get_value (range);
+ int newPartSize = pThis->totalFreeSize() - newFreeSize;
+ if (pThis->m_showDelta)
+ newPartSize += pThis->usedSize();
+
+ pThis->setValue (newPartSize);
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ static void free_spin_changed_cb (GtkSpinButton *spin, YGPartitionSplitter *pThis)
+ {
+ IMPL
+ int newFreeSize = gtk_spin_button_get_value_as_int (spin);
+ int newPartSize = pThis->totalFreeSize() - newFreeSize;
+ if (pThis->m_showDelta)
+ newPartSize += pThis->usedSize();
+
+ pThis->setValue (newPartSize);
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ static void new_spin_changed_cb (GtkSpinButton *spin, YGPartitionSplitter *pThis)
+ {
+ IMPL
+ if (pThis->m_showDelta)
+ pThis->setValue (pThis->remainingFreeSize() - pThis->totalFreeSize());
+ else
+ pThis->setValue (gtk_spin_button_get_value_as_int (spin));
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createPartitionSplitter (YWidget *parent, YWidgetOpt &opt,
+ int usedSize, int totalFreeSize, int newPartSize,
+ int minNewPartSize, int minFreeSize,
+ const YCPString &usedLabel,const YCPString &freeLabel,
+ const YCPString &newPartLabel,
+ const YCPString &freeFieldLabel,
+ const YCPString &newPartFieldLabel)
+{
+ return new YGPartitionSplitter (opt, YGWidget::get (parent), usedSize,
+ totalFreeSize, newPartSize, minNewPartSize, minFreeSize, usedLabel,
+ freeLabel, newPartLabel, freeFieldLabel, newPartFieldLabel);
+}
Added: trunk/gtk/10_3/src/YGComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGComboBox.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGComboBox.cc (added)
+++ trunk/gtk/10_3/src/YGComboBox.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,157 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGUtils.h"
+#include "YComboBox.h"
+#include "YGWidget.h"
+
+class YGComboBox : public YComboBox, public YGLabeledWidget
+{
+bool m_showingIcons;
+
+ public:
+ YGComboBox (const YWidgetOpt &opt, YGWidget *parent, YCPString label)
+ : YComboBox (opt, label)
+ , YGLabeledWidget (this, parent, label, YD_HORIZ, true,
+ opt.isEditable.value() ? GTK_TYPE_COMBO_BOX_ENTRY : GTK_TYPE_COMBO_BOX, NULL)
+ {
+ // pixbufs will be enabled if icons are provided
+ m_showingIcons = false;
+
+ GtkListStore *store = gtk_list_store_new (2, G_TYPE_STRING, GDK_TYPE_PIXBUF);
+ gtk_combo_box_set_model (GTK_COMBO_BOX (getWidget()), GTK_TREE_MODEL (store));
+ g_object_unref (store);
+
+ if(opt.isEditable.value()) {
+ gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (getWidget()), 0);
+ }
+ else {
+ GtkCellRenderer* cell = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (getWidget()), cell, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (getWidget()), cell,
+ "text", 0, NULL);
+ }
+
+ g_signal_connect (G_OBJECT (getWidget()), "changed",
+ G_CALLBACK (selected_changed_cb), this);
+ }
+
+ GtkComboBox *getComboBox() const
+ {
+ return GTK_COMBO_BOX ((const_cast(this)->getWidget()));
+ }
+
+ GtkEntry *getEntry()
+ {
+ if (!GTK_IS_COMBO_BOX_ENTRY (getWidget())) {
+ y2error ("YGComboBox: trying to edit read-only combo box");
+ return NULL;
+ }
+
+ GtkWidget *entry = gtk_bin_get_child (GTK_BIN (getWidget()));
+ if (!GTK_IS_ENTRY (entry)) {
+ g_error ("YGComboBox: GtkComboBoxEntry doesn't have a GtkEntry as child");
+ return NULL;
+ }
+
+ return GTK_ENTRY (entry);
+ }
+
+ virtual void itemAdded (const YCPString &string, int index, bool selected)
+ {
+ GtkListStore *store = GTK_LIST_STORE (gtk_combo_box_get_model (getComboBox()));
+ GtkTreeIter iter;
+ gtk_list_store_insert (store, &iter, index);
+ gtk_list_store_set (store, &iter, 0, string->value_cstr(), -1);
+
+ if(hasIcons() && !m_showingIcons) {
+ GtkCellRenderer* cell = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (getWidget()), cell, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (getWidget()), cell,
+ "pixbuf", 1, NULL);
+ m_showingIcons = true;
+ }
+
+ if (hasIcons() && !itemIcon (index)->value().empty()) {
+ std::string path = itemIcon (index)->value();
+ if (path[0] != '/')
+ path = ICON_DIR + path;
+
+ GdkPixbuf *pixbuf;
+ GError *error = 0;
+ pixbuf = gdk_pixbuf_new_from_file (path.c_str(), &error);
+ if (!pixbuf)
+ y2warning ("YGComboBox: Could not load icon: %s.\n"
+ "Because %s", path.c_str(), error->message);
+ gtk_list_store_set (store, &iter, 1, pixbuf, -1);
+ }
+
+ if (selected || index == 0)
+ setCurrentItem (index);
+ }
+
+ virtual void setValue (const YCPString &value)
+ {
+ IMPL
+ gtk_entry_set_text (getEntry(), value->value_cstr());
+ }
+
+ virtual YCPString getValue() const
+ {
+ return YCPString (gtk_combo_box_get_active_text (getComboBox()));
+ }
+
+ virtual int getCurrentItem() const
+ {
+ return gtk_combo_box_get_active (getComboBox());
+ }
+
+ virtual void setCurrentItem (int index)
+ {
+ g_signal_handlers_block_by_func (getWidget(), (gpointer) selected_changed_cb, this);
+ gtk_combo_box_set_active (GTK_COMBO_BOX(getWidget()), index);
+ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) selected_changed_cb, this);
+ }
+
+ virtual void setInputMaxLength (const YCPInteger &numberOfChars)
+ {
+ gtk_entry_set_width_chars (getEntry(), numberOfChars->asInteger()->value());
+ }
+
+ // Events notifications
+ static void selected_changed_cb (GtkComboBox *widget, YGComboBox *pThis)
+ {
+ /* selected_changed_cb() is called when a new item was selected or the user has
+ typed some text on a writable ComboBox. text_changed is true for the later and
+ false for the former. */
+ bool text_changed = GTK_IS_COMBO_BOX_ENTRY (widget)
+ && pThis->getCurrentItem() == -1;
+
+ if (text_changed) {
+ g_signal_handlers_block_by_func (pThis->getWidget(), (gpointer)
+ selected_changed_cb, pThis);
+ YGUtils::filterText (GTK_EDITABLE (pThis->getEntry()), 0, -1,
+ pThis->getValidChars()->value_cstr());
+ g_signal_handlers_unblock_by_func (pThis->getWidget(), (gpointer)
+ selected_changed_cb, pThis);
+
+ pThis->emitEvent (YEvent::ValueChanged, true, true);
+ }
+ else
+ pThis->emitEvent (YEvent::SelectionChanged, true, true);
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YComboBox)
+};
+
+YWidget *
+YGUI::createComboBox (YWidget *parent, YWidgetOpt & opt,
+ const YCPString & label)
+{
+ return new YGComboBox (opt, YGWidget::get (parent), label);
+}
Added: trunk/gtk/10_3/src/YGDialog.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGDialog.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGDialog.cc (added)
+++ trunk/gtk/10_3/src/YGDialog.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,379 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGDialog.h"
+#include
+#include // easter
+
+/* In the main dialog case (when opt.hasDefaultSize is set), it doesn't
+ necessarly have a window of its own. If there is already a main window, it
+ should replace its content -- and when closed, the previous dialog restored.
+
+ Therefore, we have a YGDialog (the YDialog implementation), and a YGWindow
+ that does the windowing work and has a YWidget has its children, which can
+ be a YGDialog and is swap-able.
+*/
+
+class YGWindow;
+static YGWindow *main_window = NULL;
+
+YGWindow::~YGWindow()
+{
+ IMPL
+ setChild (NULL);
+ gtk_widget_destroy (m_widget);
+ g_object_unref (G_OBJECT (m_widget));
+}
+
+void YGWindow::setChild (YWidget *new_child)
+{
+ IMPL
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (m_widget));
+ if (child)
+ gtk_container_remove (GTK_CONTAINER (m_widget), child);
+ if (new_child) {
+ child = YGWidget::get (new_child)->getLayout();
+ gtk_container_add (GTK_CONTAINER (m_widget), child);
+ }
+ m_child = new_child;
+}
+
+void YGWindow::ref (YGWindow *window)
+{
+ window->m_refcount++;
+}
+void YGWindow::unref (YGWindow *window)
+{
+ if (--window->m_refcount == 0) {
+ bool is_main_window = (window == main_window);
+ delete window;
+ if (is_main_window)
+ main_window = NULL;
+ }
+}
+
+static gboolean draw_border_cb (GtkWidget *widget, GdkEventExpose *event,
+ YGWindow *pThis)
+{
+ IMPL
+ // to avoid background from overlapping, we emit the expose to the containee
+ // ourselves
+ gtk_container_propagate_expose (GTK_CONTAINER (widget),
+ gtk_bin_get_child (GTK_BIN (widget)),
+ event);
+
+ GtkAllocation *alloc = &widget->allocation;
+ gtk_draw_shadow (gtk_widget_get_style (widget), widget->window,
+ GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT,
+ alloc->x, alloc->y, alloc->width, alloc->height);
+ return TRUE;
+}
+
+static gboolean expode_window_timeout_cb (gpointer data)
+{
+ GtkWindow *window = YGUI::ui()->currentWindow();
+ if (!window)
+ return FALSE;
+ srand (time (NULL));
+ gint x, y;
+ gtk_window_get_position (window, &x, &y);
+#if 0
+ // OVAL MOVE
+ for (int i = 180; i < 360+180; i++) {
+ gtk_window_move (window, x+(int)(sin((i*G_PI)/180)*50),
+ y+(int)(cos((i*G_PI)/180)*50)+50);
+ while (gtk_events_pending())
+ gtk_main_iteration();
+ usleep (25);
+ }
+#else
+ // EXPLOSION
+ for (int i = 0; i < 40; i++) {
+ gtk_window_move (window, x+(int)((((float)(rand())/RAND_MAX)*40)-20),
+ y+(int)((((float)(rand())/RAND_MAX)*40)-20));
+ while (gtk_events_pending())
+ gtk_main_iteration();
+ usleep (200);
+ }
+#endif
+ gtk_window_move (window, x, y);
+ return TRUE;
+}
+
+gboolean YGWindow::close_window_cb (GtkWidget *widget, GdkEvent *event,
+ YGWindow *pThis)
+{
+ IMPL
+ // never let GTK+ destroy the window! just inform YCP, and let it
+ // do its thing.
+ pThis->closeWindow();
+ return TRUE;
+}
+
+void YGWindow::closeWindow()
+{
+ if (!m_canClose || m_canClose (m_canCloseData))
+ YGUI::ui()->sendEvent (new YCancelEvent());
+}
+
+static gboolean key_pressed_cb (GtkWidget *widget, GdkEventKey *event,
+ YGWindow *pThis)
+{
+ IMPL
+ // if not main dialog, close it on escape
+ if (event->keyval == GDK_Escape &&
+ /* not main window */ main_window != pThis)
+ {
+ pThis->closeWindow();
+ return TRUE;
+
+ }
+
+ if (event->state & GDK_SHIFT_MASK) {
+ switch (event->keyval) {
+ case GDK_F8:
+ YGUI::ui()->askSaveLogs();
+ return TRUE;
+ default:
+ break;
+ }
+ }
+ if ((event->state & GDK_CONTROL_MASK) && (event->state & GDK_SHIFT_MASK)
+ && (event->state & GDK_MOD1_MASK)) {
+ y2milestone ("Caught YaST2 magic key combination");
+ switch (event->keyval) {
+ case GDK_S:
+ YGUI::ui()->makeScreenShot("");
+ return TRUE;
+ case GDK_M:
+ YGUI::ui()->toggleRecordMacro();
+ return TRUE;
+ case GDK_P:
+ YGUI::ui()->askPlayMacro();
+ return TRUE;
+ case GDK_D:
+ YGUI::ui()->sendEvent (new YDebugEvent());
+ return TRUE;
+ case GDK_X:
+ y2milestone ("Starting xterm");
+ system ("/usr/bin/xterm &");
+ return TRUE;
+ case GDK_T:
+ dumpYastTree (pThis->getChild());
+ return TRUE;
+ case GDK_H:
+ dumpYastHtml (pThis->getChild());
+ return TRUE;
+ case GDK_E: // easter egg
+ static guint explode_timeout = 0;
+ if (explode_timeout == 0)
+ explode_timeout = g_timeout_add (10000,
+ expode_window_timeout_cb, NULL);
+ else {
+ g_source_remove (explode_timeout);
+ explode_timeout = 0;
+ }
+ return TRUE;
+ default:
+ break;
+ }
+ }
+ return FALSE;
+}
+
+YGWindow::YGWindow (bool main_window)
+{
+ m_widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ g_object_ref (G_OBJECT (m_widget));
+ gtk_object_sink (GTK_OBJECT (m_widget));
+
+ m_refcount = 0;
+ if (main_window)
+ ::main_window = this;
+ m_child = NULL;
+ m_canClose = NULL;
+
+ {
+ GtkWindow *parent = YGUI::ui()->currentWindow();
+ GtkWindow *window = GTK_WINDOW (m_widget);
+
+ if (parent) {
+ // if there is a parent, this would be a dialog
+ gtk_window_set_title (window, "");
+ gtk_window_set_modal (window, TRUE);
+ gtk_window_set_transient_for (window, parent);
+ gtk_window_set_type_hint (window, GDK_WINDOW_TYPE_HINT_DIALOG);
+ //gtk_window_set_focus_on_map (window, FALSE);
+ }
+ else {
+ gtk_window_set_title (window, "YaST");
+ if (YGUI::ui()->unsetBorder())
+ gtk_window_set_decorated (window, FALSE);
+ }
+
+ if (main_window) {
+ int w = YGUI::ui()->getDefaultSize (YD_HORIZ),
+ h = YGUI::ui()->getDefaultSize (YD_VERT);
+ gtk_window_set_default_size (window, w, h);
+ }
+
+ gtk_window_set_role (window, "yast-gtk");
+ if (!YGUI::ui()->hasWM())
+ g_signal_connect (G_OBJECT (m_widget), "expose-event",
+ G_CALLBACK (draw_border_cb), this);
+ }
+
+ g_signal_connect (G_OBJECT (m_widget), "delete-event",
+ G_CALLBACK (close_window_cb), this);
+ g_signal_connect_after (G_OBJECT (m_widget), "key-press-event",
+ G_CALLBACK (key_pressed_cb), this);
+}
+
+void YGWindow::setCloseCallback (YGWindowCloseFn canClose, void *canCloseData)
+{
+ m_canClose = canClose;
+ m_canCloseData = canCloseData;
+}
+
+void YGWindow::unsetCloseCallback()
+{
+ m_canClose = NULL;
+}
+
+YGDialog::YGDialog (YWidgetOpt &opt)
+ : YDialog (opt),
+ YGWidget (this, NULL, FALSE, GTK_TYPE_HBOX, NULL)
+{
+ setBorder (0);
+ m_padding = 0;
+ m_containee = gtk_event_box_new();
+ if (hasDefaultSize() && main_window)
+ m_window = main_window;
+ else
+ m_window = new YGWindow (hasDefaultSize());
+ YGWindow::ref (m_window);
+
+ if (hasWarnColor() || hasInfoColor()) {
+ // emulate a warning / info dialog
+ GtkWidget *icon = gtk_image_new_from_stock
+ (hasWarnColor() ? GTK_STOCK_DIALOG_WARNING : GTK_STOCK_DIALOG_INFO,
+ GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0);
+ gtk_misc_set_padding (GTK_MISC (icon), 0, 12);
+
+ gtk_box_pack_start (GTK_BOX (getWidget()), icon, FALSE, FALSE, 12);
+ gtk_box_pack_start (GTK_BOX (getWidget()), m_containee, TRUE, TRUE, 0);
+
+ GtkRequisition req;
+ gtk_widget_size_request (icon, &req);
+ m_padding = req.width + 24;
+ }
+ else
+ gtk_box_pack_start (GTK_BOX (getWidget()), m_containee, TRUE, TRUE, 0);
+ gtk_widget_show_all (getWidget());
+
+ // NOTE: we need to add this containter to the window right here, else
+ // weird stuff happens (like if we set a pango font description to a
+ // GtkLabel, size request would output the size without that description
+ // set...)
+ m_window->setChild (this);
+}
+
+YGDialog::~YGDialog()
+{
+ YGWindow::unref (m_window);
+}
+
+void YGDialog::showWindow()
+{
+ IMPL
+ m_window->setChild (this);
+ gtk_widget_show (m_window->getWidget());
+ YGUI::ui()->busyCursor();
+}
+
+void YGDialog::hideWindow()
+{
+ IMPL
+ m_window->setChild (NULL);
+ gtk_widget_hide (m_window->getWidget());
+}
+
+YDialog *
+YGUI::createDialog (YWidgetOpt &opt)
+{
+ IMPL
+ return new YGDialog (opt);
+}
+
+static list dialogs_stack;
+
+void
+YGUI::showDialog (YDialog *_dialog)
+{
+ IMPL
+ YGDialog *dialog = static_cast (_dialog);
+ if (dialog->hasDefaultSize())
+ dialogs_stack.push_back (dialog);
+ dialog->showWindow();
+}
+
+void
+YGUI::closeDialog (YDialog *_dialog)
+{
+ IMPL
+ YGDialog *dialog = static_cast (_dialog);
+ if (dialog->hasDefaultSize()) {
+ dialogs_stack.pop_back();
+ if (!dialogs_stack.empty()) {
+ YGDialog *old_dialog = dialogs_stack.back();
+ old_dialog->showWindow();
+ }
+ else
+ dialog->hideWindow();
+ }
+ else
+ dialog->hideWindow();
+}
+
+GtkWindow *
+YGUI::currentWindow()
+{
+ YDialog *ydialog = YGUI::ui()->currentDialog();
+ if (ydialog)
+ return static_cast(ydialog)->getWindow();
+ else
+ return NULL;
+}
+
+YGDialog *
+YGUI::currentYGDialog()
+{
+ YDialog *ydialog = YGUI::ui()->currentDialog();
+ if (ydialog)
+ return static_cast(ydialog);
+ else
+ return NULL;
+}
+
+void YGDialog::busyCursor()
+{
+ // NOTE: GdkDisplay won't change for new dialogs, so we don't
+ // have to synchronize between them or something.
+ static GdkCursor *cursor = NULL;
+ if (!cursor) {
+ GdkDisplay *display = gtk_widget_get_display (m_window->getWidget());
+ cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
+ }
+ gdk_window_set_cursor (m_window->getWidget()->window, cursor);
+}
+
+void YGDialog::normalCursor()
+{
+ gdk_window_set_cursor (m_window->getWidget()->window, NULL);
+}
+
Added: trunk/gtk/10_3/src/YGDialog.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGDialog.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGDialog.h (added)
+++ trunk/gtk/10_3/src/YGDialog.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,70 @@
+#ifndef YGDIALOG_H
+#define YGDIALOG_H
+
+#include "YGWidget.h"
+#include "YDialog.h"
+
+typedef bool (*YGWindowCloseFn) (void *closure);
+
+class YGWindow
+{
+ GtkWidget *m_widget;
+ int m_refcount;
+ // we keep a pointer of the child just for debugging
+ // (ie. dump yast tree)
+ YWidget *m_child;
+ YGWindowCloseFn m_canClose;
+ void *m_canCloseData;
+
+private:
+ static gboolean close_window_cb (GtkWidget *widget, GdkEvent *event,
+ YGWindow *pThis);
+public:
+ YGWindow (bool main_window);
+ ~YGWindow();
+ void setChild (YWidget *new_child);
+ static void ref (YGWindow *window);
+ static void unref (YGWindow *window);
+
+ void normalCursor();
+ void busyCursor();
+
+ void setCloseCallback (YGWindowCloseFn canClose, void *canCloseData);
+ void unsetCloseCallback();
+ void closeWindow();
+
+ // Y(G)Widget-like methods
+ GtkWidget *getWidget() { return m_widget; }
+ YWidget *getChild() { return m_child; }
+};
+
+class YGDialog : public YDialog, public YGWidget
+{
+ int m_padding;
+ GtkWidget *m_containee;
+
+ YGWindow *m_window;
+
+public:
+ YGDialog (YWidgetOpt &opt);
+ virtual ~YGDialog();
+ void showWindow();
+ void hideWindow();
+ GtkWindow *getWindow() { return GTK_WINDOW (m_window->getWidget()); }
+
+ void setCloseCallback (YGWindowCloseFn closeCallback, void *closeData)
+ { m_window->setCloseCallback (closeCallback, closeData); }
+ void unsetCloseCallback()
+ { m_window->unsetCloseCallback(); }
+
+ void normalCursor();
+ void busyCursor();
+
+ YGWIDGET_IMPL_COMMON
+
+ YGWIDGET_IMPL_CHILD_ADDED (m_containee)
+ YGWIDGET_IMPL_CHILD_REMOVED (m_containee)
+};
+
+#endif // YGDIALOG_H
+
Added: trunk/gtk/10_3/src/YGDumbTab.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGDumbTab.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGDumbTab.cc (added)
+++ trunk/gtk/10_3/src/YGDumbTab.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,118 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGWidget.h"
+#include "YGUtils.h"
+#include "YDumbTab.h"
+
+#include "ygtkratiobox.h"
+
+class YGDumbTab : public YDumbTab, public YGWidget
+{
+ GtkWidget *m_containee;
+ GtkWidget *m_last_tab;
+ vector m_tab_widgets;
+
+public:
+ YGDumbTab (const YWidgetOpt &opt, YGWidget *parent)
+ : YDumbTab (opt),
+ YGWidget (this, parent, true, GTK_TYPE_NOTEBOOK, NULL)
+ {
+ IMPL
+ m_containee = gtk_event_box_new();
+ gtk_widget_show (m_containee);
+ g_object_ref (G_OBJECT (m_containee));
+ gtk_object_sink (GTK_OBJECT (m_containee));
+
+ m_last_tab = 0;
+ // GTK+ keeps the notebook size set to the biggset page. We can't
+ // do this since this is dynamic, but at least don't let the notebook
+ // reduce its size.
+ ygtk_adj_size_set_only_expand (YGTK_ADJ_SIZE (m_adj_size), TRUE);
+
+ g_signal_connect (G_OBJECT (getWidget()), "switch-page",
+ G_CALLBACK (changed_tab_cb), this);
+ }
+
+ ~YGDumbTab()
+ {
+ IMPL
+ gtk_widget_destroy (m_containee);
+ g_object_unref (G_OBJECT (m_containee));
+ }
+
+ virtual void addTab (const YCPString &label_text)
+ {
+ IMPL
+ // the tab label
+ string str = YGUtils::mapKBAccel (label_text->value_cstr());
+ GtkWidget *label = gtk_label_new (str.c_str());
+ gtk_widget_show (label);
+
+ GtkNotebook *notebook = GTK_NOTEBOOK (getWidget());
+ g_signal_handlers_block_by_func (notebook, (gpointer) changed_tab_cb, this);
+
+ GtkWidget *empty = gtk_event_box_new();
+ gtk_widget_show (empty);
+
+ gtk_notebook_append_page (notebook, empty, label);
+ m_tab_widgets.push_back (empty);
+
+ if (!m_last_tab)
+ change_tab (0);
+
+ g_signal_handlers_unblock_by_func (notebook, (gpointer) changed_tab_cb, this);
+ }
+
+ // to re-use the same widget in all tabs (m_fixed), we will remove and
+ // add to the tabs' child as tabs are changed
+ void change_tab (int tab_nb)
+ {
+ if (m_last_tab)
+ gtk_container_remove (GTK_CONTAINER (m_last_tab), m_containee);
+
+ GtkWidget *tab = m_tab_widgets [tab_nb];
+ gtk_container_add (GTK_CONTAINER (tab), m_containee);
+ m_last_tab = tab;
+ }
+
+ virtual int getSelectedTabIndex()
+ {
+ IMPL
+ return gtk_notebook_get_current_page (GTK_NOTEBOOK (getWidget()));
+ }
+
+ virtual void setSelectedTab (int index)
+ {
+ IMPL
+ change_tab (index);
+
+ g_signal_handlers_block_by_func (getWidget(), (gpointer) changed_tab_cb, this);
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (getWidget()), index);
+ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) changed_tab_cb, this);
+ }
+
+ static void changed_tab_cb (GtkNotebook *notebook, GtkNotebookPage *page,
+ gint tab_nb, YGDumbTab *pThis)
+ {
+ YCPValue id = pThis->_tabs[tab_nb].id();
+ YGUI::ui()->sendEvent (new YMenuEvent (id));
+
+ pThis->change_tab (tab_nb);
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGWIDGET_IMPL_CHILD_ADDED (m_containee)
+ YGWIDGET_IMPL_CHILD_REMOVED (m_containee)
+};
+
+YWidget *
+YGUI::createDumbTab (YWidget *parent, YWidgetOpt &opt)
+{
+ IMPL
+ return new YGDumbTab (opt, YGWidget::get (parent));
+}
Added: trunk/gtk/10_3/src/YGFrame.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGFrame.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGFrame.cc (added)
+++ trunk/gtk/10_3/src/YGFrame.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,171 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include "YGUI.h"
+#include "YGWidget.h"
+#include "YGUtils.h"
+
+// Instead of traditional looking frames, we use Gnome convention for the
+// frame's look. That is: don't draw a frame, use bold header and pad the child.
+#define CHILD_INDENTATION 15
+
+class YGBaseFrame : public YGWidget
+{
+protected:
+// a GtkAlignment to set some indentation on the child
+GtkWidget *m_containee;
+
+public:
+ YGBaseFrame (YWidget *y_widget, YGWidget *parent)
+ : YGWidget (y_widget, parent, true, GTK_TYPE_FRAME,
+ "shadow-type", GTK_SHADOW_NONE, NULL)
+ {
+ IMPL
+ m_containee = gtk_alignment_new (0, 0, 1, 1);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (m_containee), 0, 0, 15, 0);
+ gtk_widget_show (m_containee);
+ gtk_container_add (GTK_CONTAINER (getWidget()), m_containee);
+ }
+ virtual ~YGBaseFrame() {}
+};
+
+#include "YFrame.h"
+
+class YGFrame : public YFrame, public YGBaseFrame
+{
+public:
+ YGFrame (const YWidgetOpt &opt, YGWidget *parent, const YCPString &label)
+ : YFrame (opt, label),
+ YGBaseFrame (this, parent)
+ {
+ GtkWidget *label_widget = gtk_label_new ("");
+ YGUtils::setWidgetFont (GTK_WIDGET (label_widget), PANGO_WEIGHT_BOLD,
+ PANGO_SCALE_MEDIUM);
+ gtk_widget_show (label_widget);
+ gtk_frame_set_label_widget (GTK_FRAME (getWidget()), label_widget);
+ setLabel (label);
+ }
+
+ virtual ~YGFrame() {}
+
+ // YFrame
+ virtual void setLabel (const YCPString &_str)
+ {
+ IMPL
+ /* Get rid of mnemonics; make no sense here. */
+ const char *_cstr = _str->value_cstr();
+ size_t _clen = strlen (_cstr);
+
+ string str;
+ str.reserve (_clen);
+ for (size_t i = 0; i < _clen; i++)
+ if (_cstr[i] != '&')
+ str += _cstr[i];
+
+ GtkWidget *label = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
+ gtk_label_set_text (GTK_LABEL (label), str.c_str());
+
+ YFrame::setLabel (_str);
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGWIDGET_IMPL_CHILD_ADDED (m_containee)
+ YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
+};
+
+YContainerWidget *
+YGUI::createFrame (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label)
+{
+ IMPL
+ return new YGFrame (opt, YGWidget::get (parent), label);
+}
+
+#if YAST2_YGUI_CHECKBOX_FRAME
+#include "YCheckBoxFrame.h"
+
+class YGCheckBoxFrame : public YCheckBoxFrame, public YGBaseFrame
+{
+public:
+ YGCheckBoxFrame (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString &label, bool checked)
+ : YCheckBoxFrame (opt, label),
+ YGBaseFrame (this, parent)
+ {
+ IMPL
+ GtkWidget *button = gtk_check_button_new_with_mnemonic("");
+ YGUtils::setWidgetFont (GTK_WIDGET (button), PANGO_WEIGHT_BOLD,
+ PANGO_SCALE_MEDIUM);
+ gtk_widget_show_all (button);
+ gtk_frame_set_label_widget (GTK_FRAME (getWidget()), button);
+
+ setLabel (label);
+ setValue (checked);
+ g_signal_connect (G_OBJECT (button), "toggled",
+ G_CALLBACK (toggled_cb), this);
+ }
+ virtual ~YGCheckBoxFrame() {}
+
+ // YCheckBoxFrame
+ virtual void setLabel (const YCPString &_str)
+ {
+ GtkWidget *button = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
+ GtkLabel *label = GTK_LABEL (GTK_BIN (button)->child);
+
+ string str (YGUtils::mapKBAccel (_str->value_cstr()));
+ gtk_label_set_text_with_mnemonic (label, str.c_str());
+ YCheckBoxFrame::setLabel (_str);
+ }
+
+ bool getValue()
+ {
+ GtkWidget *button = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ }
+
+ void setValue (bool newValue)
+ {
+ GtkWidget *button = gtk_frame_get_label_widget (GTK_FRAME (getWidget()));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), newValue);
+ }
+
+ virtual void setEnabling (bool enabled)
+ {
+ GtkWidget *frame = getWidget();
+ if (enabled)
+ {
+ gtk_widget_set_sensitive (frame, TRUE);
+ handleChildrenEnablement (getValue());
+ }
+ else
+ {
+ setChildrenEnabling( false );
+ gtk_widget_set_sensitive (frame, FALSE);
+ }
+ }
+
+ YGWIDGET_IMPL_CHILD_ADDED (m_containee)
+ YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
+
+private:
+ static void toggled_cb (GtkWidget *widget, YGCheckBoxFrame *pThis)
+ {
+ pThis->setEnabling (true);
+ if (pThis->getNotify())
+ YGUI::ui()->sendEvent (new YWidgetEvent (pThis, YEvent::ValueChanged));
+ }
+};
+
+YContainerWidget *
+YGUI::createCheckBoxFrame (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, bool checked)
+{
+ IMPL
+ return new YGCheckBoxFrame (opt, YGWidget::get (parent), label, checked);
+}
+
+#else
+# warning "Not compiling CheckBoxFrame..."
+#endif /*YAST2_YGUI_CHECKBOX_FRAME*/
Added: trunk/gtk/10_3/src/YGImage.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGImage.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGImage.cc (added)
+++ trunk/gtk/10_3/src/YGImage.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,78 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include "ygdkmngloader.h"
+#include
+#include
+#include "YGUI.h"
+#include "YGWidget.h"
+#include "YImage.h"
+#include "ygtkimage.h"
+
+class YGImage : public YImage, public YGWidget
+{
+ void setProps (const YWidgetOpt &opt, const YCPString &alt_text)
+ {
+ bool scale = opt.scaleToFit.value(), tile = opt.tiled.value();
+ YGtkImageAlign align = CENTER_IMAGE_ALIGN;
+ if (tile)
+ align = TILE_IMAGE_ALIGN;
+ if (scale)
+ align = SCALE_IMAGE_ALIGN;
+ if (scale && tile)
+ y2warning ("YImage can't be scaled and tiled at the same time");
+ ygtk_image_set_props (YGTK_IMAGE (getWidget()), align, alt_text->value_cstr());
+
+ bool zeroWidth = opt.zeroWidth.value(), zeroHeight = opt.zeroHeight.value();
+ if (zeroWidth || scale || tile)
+ setStretchable (YD_HORIZ, true);
+ if (zeroHeight || scale || tile)
+ setStretchable (YD_VERT, true);
+ gtk_widget_set_size_request (getWidget(), zeroWidth ? 1 : -1, zeroHeight ? 1 : -1);
+ }
+
+public:
+ YGImage (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString &filename_str, const YCPString &text)
+ : YImage (opt),
+ YGWidget (this, parent, true, YGTK_TYPE_IMAGE, NULL)
+ {
+ IMPL
+ setProps (opt, text);
+ const char *filename = filename_str->value_cstr();
+ bool animated = opt.animated.value();
+ ygtk_image_set_from_file (YGTK_IMAGE (getWidget()), filename, animated);
+ }
+
+ YGImage (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPByteblock &byteblock, const YCPString &text)
+ : YImage (opt),
+ YGWidget (this, parent, true, YGTK_TYPE_IMAGE, NULL)
+ {
+ IMPL
+ setProps (opt, text);
+ const guint8 *data = byteblock->value();
+ long data_size = byteblock->size();
+ bool animated = opt.animated.value();
+ ygtk_image_set_from_data (YGTK_IMAGE (getWidget()), data, data_size, animated);
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createImage (YWidget *parent, YWidgetOpt &opt,
+ YCPByteblock image_data, YCPString default_text)
+{
+ IMPL
+ return new YGImage (opt, YGWidget::get (parent), image_data, default_text);
+}
+
+YWidget *
+YGUI::createImage (YWidget *parent, YWidgetOpt &opt,
+ YCPString file_name, YCPString default_text)
+{
+ IMPL
+ return new YGImage (opt, YGWidget::get (parent), file_name, default_text);
+}
Added: trunk/gtk/10_3/src/YGIntField.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGIntField.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGIntField.cc (added)
+++ trunk/gtk/10_3/src/YGIntField.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,152 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGUtils.h"
+#include "YGWidget.h"
+
+#define SLIDER_NICESIZE_IN_CHARS 15
+
+class YGSpinBox : public YGLabeledWidget
+{
+ GtkWidget *m_spiner, *m_slider;
+
+public:
+ YGSpinBox (YWidget *y_widget, YGWidget *parent,
+ const YWidgetOpt &opt, const YCPString &label,
+ int minValue, int maxValue, int initialValue,
+ bool show_slider)
+ : YGLabeledWidget (y_widget, parent, label, YD_HORIZ, true,
+ GTK_TYPE_HBOX, NULL)
+ {
+ m_spiner = gtk_spin_button_new_with_range (minValue, maxValue, 1);
+
+ if (show_slider) {
+ m_slider = gtk_hscale_new_with_range (minValue, maxValue, 1);
+ if (maxValue - minValue < 20)
+ // GtkScale by default uses a step of 10 -- use a lower for low values
+ gtk_range_set_increments (GTK_RANGE (m_slider), 1, 2);
+ gtk_scale_set_draw_value (GTK_SCALE (m_slider), TRUE);
+ YGLabeledWidget::setBuddy (m_slider);
+ gtk_widget_set_size_request (m_slider,
+ YGUtils::getCharsWidth (m_slider, SLIDER_NICESIZE_IN_CHARS), -1);
+
+ gtk_box_pack_start (GTK_BOX (getWidget()), m_slider, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (getWidget()), m_spiner, FALSE, FALSE, 5);
+ gtk_widget_show (m_slider);
+ }
+ else {
+ m_slider = NULL;
+ YGLabeledWidget::setBuddy (m_spiner);
+
+ gtk_container_add (GTK_CONTAINER (getWidget()), m_spiner);
+ }
+ gtk_widget_show (m_spiner);
+
+ doSetValue (initialValue);
+ g_signal_connect (G_OBJECT (m_spiner), "value-changed",
+ G_CALLBACK (spiner_changed_cb), this);
+ if (m_slider)
+ g_signal_connect (G_OBJECT (m_slider), "value-changed",
+ G_CALLBACK (slider_changed_cb), this);
+ }
+
+ GtkSpinButton *getSpiner()
+ { return GTK_SPIN_BUTTON (m_spiner); }
+
+ bool useSlider()
+ { return m_slider != NULL; }
+ GtkHScale *getSlider()
+ { return GTK_HSCALE (m_slider); }
+
+ virtual void reportValue (int newValue) {}
+
+ void doSetValue (int newValue)
+ {
+ gtk_spin_button_set_value (getSpiner(), newValue);
+ if (useSlider())
+ gtk_range_set_value (GTK_RANGE (getSlider()), newValue);
+ }
+
+ // Events callbacks
+ static void spiner_changed_cb (GtkSpinButton *widget, YGSpinBox *pThis)
+ {
+ int newValue = gtk_spin_button_get_value_as_int (pThis->getSpiner());
+ pThis->reportValue (newValue);
+ if (pThis->useSlider())
+ gtk_range_set_value (GTK_RANGE (pThis->getSlider()), newValue);
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ static void slider_changed_cb (GtkRange *range, YGSpinBox *pThis)
+ {
+ int value = (int) gtk_range_get_value (range);
+ gtk_spin_button_set_value (pThis->getSpiner(), value);
+ pThis->reportValue (value);
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+};
+
+#define YGSPIN_BOX_IMPL_SET_VALUE_CHAIN(ParentClass) \
+ virtual void reportValue (int newValue) { \
+ ParentClass::setValue (newValue); \
+ } \
+ virtual void setValue (int newValue) { \
+ doSetValue (newValue); \
+ reportValue (newValue); \
+ }
+
+#include "YIntField.h"
+
+class YGIntField : public YIntField, public YGSpinBox
+{
+public:
+ YGIntField (const YWidgetOpt &opt, YGWidget *parent, const YCPString &label,
+ int minValue, int maxValue, int initialValue)
+ : YIntField (opt, label, minValue, maxValue, initialValue)
+ , YGSpinBox (this, parent, opt, label, minValue, maxValue, initialValue, false)
+ { }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YIntField)
+ YGSPIN_BOX_IMPL_SET_VALUE_CHAIN (YIntField)
+};
+
+YWidget *
+YGUI::createIntField (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label,
+ int minValue, int maxValue, int initialValue)
+{
+ IMPL
+ return new YGIntField (opt, YGWidget::get (parent), label,
+ minValue, maxValue, initialValue);
+}
+
+#include "YSlider.h"
+
+class YGSlider : public YSlider, public YGSpinBox
+{
+public:
+ YGSlider (const YWidgetOpt &opt, YGWidget *parent, const YCPString &label,
+ int minValue, int maxValue, int initialValue)
+ : YSlider (opt, label, minValue, maxValue, initialValue)
+ , YGSpinBox (this, parent, opt, label, minValue, maxValue, initialValue, true)
+ { }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YSlider)
+ YGSPIN_BOX_IMPL_SET_VALUE_CHAIN (YSlider)
+};
+
+YWidget *
+YGUI::createSlider (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label,
+ int minValue, int maxValue, int initialValue)
+{
+ IMPL
+ return new YGSlider (opt, YGWidget::get (parent), label,
+ minValue, maxValue, initialValue);
+}
Added: trunk/gtk/10_3/src/YGLabel.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGLabel.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGLabel.cc (added)
+++ trunk/gtk/10_3/src/YGLabel.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,97 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGUtils.h"
+#include "YGWidget.h"
+
+#include "YLabel.h"
+
+class YGLabel : public YLabel, public YGWidget
+{
+public:
+ YGLabel (const YWidgetOpt &opt, YGWidget *parent, YCPString text)
+ : YLabel (opt, text),
+ YGWidget (this, parent, true, GTK_TYPE_LABEL, NULL)
+ {
+ IMPL
+ gtk_misc_set_alignment (GTK_MISC (getWidget()), 0.0, 0.5);
+ if (opt.isOutputField.value())
+ gtk_label_set_selectable (GTK_LABEL (getWidget()), TRUE);
+
+ if (opt.boldFont.value())
+ YGUtils::setWidgetFont (getWidget(), PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
+ if (opt.isHeading.value())
+ YGUtils::setWidgetFont (getWidget(), PANGO_WEIGHT_ULTRABOLD, PANGO_SCALE_XX_LARGE);
+ setLabel (text);
+ }
+
+ virtual void setLabel (const YCPString &label)
+ {
+ gtk_label_set_label (GTK_LABEL (getWidget()), label->value_cstr());
+ YLabel::setLabel (label);
+
+ // Some YCP progs have no labeled labels cluttering the layout
+ label->value().empty() ? gtk_widget_hide (getWidget())
+ : gtk_widget_show (getWidget());
+ }
+
+ // YWidget
+ virtual bool doSetKeyboardFocus()
+ { return false; }
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createLabel (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &text)
+{
+ return new YGLabel (opt, YGWidget::get (parent), text);
+}
+
+#include "YColoredLabel.h"
+#include "ygtkbargraph.h"
+
+class YGColoredLabel : public YColoredLabel, public YGWidget
+{
+public:
+ YGColoredLabel (const YWidgetOpt &opt, YGWidget *parent, YCPString text,
+ const YColor &fgColor, const YColor &bgColor, int margin)
+ : YColoredLabel (opt, text),
+ YGWidget (this, parent, true, YGTK_TYPE_COLORED_LABEL, NULL)
+ {
+ IMPL
+ gtk_misc_set_alignment (GTK_MISC (getWidget()), 0.0, 0.5);
+ gtk_misc_set_padding (GTK_MISC (getWidget()), margin, margin);
+
+ if (opt.boldFont.value())
+ YGUtils::setWidgetFont (getWidget(), PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
+ if (opt.isHeading.value())
+ YGUtils::setWidgetFont (getWidget(), PANGO_WEIGHT_ULTRABOLD, PANGO_SCALE_XX_LARGE);
+ setLabel (text);
+
+ YGtkColoredLabel *color_label = YGTK_COLORED_LABEL (getWidget());
+ ygtk_colored_label_set_shadow_type (color_label, GTK_SHADOW_OUT);
+ ygtk_colored_label_set_foreground (color_label, fgColor.red, fgColor.green, fgColor.blue);
+ ygtk_colored_label_set_background (color_label, bgColor.red, bgColor.green, bgColor.blue);
+ }
+
+ virtual void setLabel (const YCPString &label)
+ {
+ gtk_label_set_label (GTK_LABEL (getWidget()), label->value_cstr());
+ YColoredLabel::setLabel (label);
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createColoredLabel (YWidget *parent, YWidgetOpt &opt, YCPString label,
+ YColor fgColor, YColor bgColor, int margin)
+{
+ return new YGColoredLabel (opt, YGWidget::get (parent), label,
+ fgColor, bgColor, margin);
+}
Added: trunk/gtk/10_3/src/YGLayout.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGLayout.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGLayout.cc (added)
+++ trunk/gtk/10_3/src/YGLayout.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,371 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGWidget.h"
+#include "YGUtils.h"
+
+#include "YSplit.h"
+#include "ygtkratiobox.h"
+#include "YSpacing.h"
+
+// GtkBox-like container (actually, more like our YGtkRatioBox)
+class YGSplit : public YSplit, public YGWidget
+{
+ // This group is meant to set all YGLabeledWidget with horizontal label
+ // to share the same width (if they belong to the same YSplit), so they
+ // look right
+ GtkSizeGroup *m_labels_group;
+
+public:
+ YGSplit (const YWidgetOpt &opt, YGWidget *parent, YUIDimension dim)
+ : YSplit (opt, dim),
+ YGWidget (this, parent, true,
+ dim == YD_HORIZ ? YGTK_TYPE_RATIO_HBOX
+ : YGTK_TYPE_RATIO_VBOX, NULL)
+ {
+ setBorder (0);
+ m_labels_group = NULL;
+ }
+
+ ~YGSplit()
+ {
+ if (m_labels_group)
+ g_object_unref (G_OBJECT (m_labels_group));
+ }
+
+ virtual void childAdded (YWidget *ychild)
+ {
+ IMPL
+ YGWidget *ygchild = YGWidget::get (ychild);
+
+ gtk_container_add (GTK_CONTAINER (getWidget()), ygchild->getLayout());
+ sync_stretchable (ychild);
+
+ // set labels of YGLabeledWidgets to the same width
+ // we have to do quite some work due to over-clutter on YCP progs
+ while (ychild) {
+ if (ychild->isContainer()) {
+ // try to see if there is a YGLabeledWidget at start
+ // (and ignore YSpacings)
+ YContainerWidget *container = (YContainerWidget *) ychild;
+ if (container->numChildren())
+ for (int i = 0; i < container->numChildren(); i++) {
+ ychild = container->child (i);
+ if (!dynamic_cast (ychild))
+ break;
+ }
+ else // no kids
+ break;
+ }
+ else {
+ ygchild = YGWidget::get (ychild);
+ YGLabeledWidget *labeled_child = dynamic_cast (ygchild);
+ if (labeled_child && labeled_child->orientation() == YD_HORIZ) {
+ if (!m_labels_group)
+ m_labels_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ gtk_size_group_add_widget (m_labels_group,
+ labeled_child->getLabelWidget());
+ }
+ break;
+ }
+ }
+ }
+ YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
+
+ virtual void sync_stretchable (YWidget *ychild)
+ {
+ IMPL
+ YGtkRatioBox *box = YGTK_RATIO_BOX (getWidget());
+ YGWidget *child = YGWidget::get (ychild);
+
+ YUIDimension dim = dimension();
+ bool horiz_fill = child->isStretchable (YD_HORIZ)
+ || ychild->hasWeight (YD_HORIZ);
+ bool vert_fill = child->isStretchable (YD_VERT)
+ || ychild->hasWeight (YD_VERT);
+
+ ygtk_ratio_box_set_child_packing (box, child->getLayout(), ychild->weight (dim),
+ horiz_fill, vert_fill, 0);
+ ygtk_ratio_box_set_child_expand (box, child->getLayout(),
+ child->isStretchable (dim),
+ ychild->isLayoutStretch (dim));
+ YGWidget::sync_stretchable();
+ }
+
+ virtual void moveChild (YWidget *, long, long) {} // ignore
+};
+
+YContainerWidget *
+YGUI::createSplit (YWidget *parent, YWidgetOpt &opt, YUIDimension dimension)
+{
+ IMPL
+ return new YGSplit (opt, YGWidget::get (parent), dimension);
+}
+
+#include "YAlignment.h"
+
+class YGAlignment : public YAlignment, public YGWidget
+{
+ GdkPixbuf *m_background_pixbuf;
+
+public:
+ YGAlignment (const YWidgetOpt &opt, YGWidget *parent,
+ YAlignmentType halign, YAlignmentType valign)
+ : YAlignment (opt, halign, valign),
+ YGWidget (this, parent, true, GTK_TYPE_ALIGNMENT, NULL)
+ {
+ setBorder (0);
+ m_background_pixbuf = 0;
+ }
+
+ virtual ~YGAlignment()
+ {
+ if (m_background_pixbuf)
+ g_object_unref (G_OBJECT (m_background_pixbuf));
+ }
+
+ virtual void childAdded (YWidget *ychild)
+ {
+ YGWidget *child = YGWidget::get (ychild);
+ gtk_container_add (GTK_CONTAINER (getWidget()), child->getLayout());
+
+ /* The padding is used for stuff like making YCP progs nicer for
+ yast-qt wizard, so it hurts us -- it's disabled. */
+ //child->setPadding (topMargin(), bottomMargin(),
+ // leftMargin(), rightMargin());
+ setMinSize (minWidth(), minHeight());
+
+ sync_stretchable (ychild); // alignment will be set here
+ }
+ YGWIDGET_IMPL_CHILD_REMOVED (m_widget)
+
+ virtual void sync_stretchable (YWidget *child)
+ {
+ IMPL
+ setAlignment (align [YD_HORIZ], align [YD_VERT]);
+ YGWidget::sync_stretchable (m_y_widget);
+ }
+
+ void setAlignment (YAlignmentType halign, YAlignmentType valign)
+ {
+ // special case (which YAlignment.cc also uses); let stretchable
+ // children stretch if opt.stretch is set (exploitable by the wizard)
+ GValue hstretch, vstretch;
+ hstretch = YGUtils::floatToGValue (0);
+ if (_stretch [YD_HORIZ] && YGWidget::get (child (0))->isStretchable (YD_HORIZ))
+ hstretch = YGUtils::floatToGValue (1);
+ vstretch = YGUtils::floatToGValue (0);
+ if (_stretch [YD_VERT] && YGWidget::get (child (0))->isStretchable (YD_VERT))
+ vstretch = YGUtils::floatToGValue (1);
+
+ if (halign != YAlignUnchanged) {
+ GValue xalign = YGUtils::floatToGValue (yToGtkAlign (halign));
+ g_object_set_property (G_OBJECT (getWidget()), "xalign", &xalign);
+ g_object_set_property (G_OBJECT (getWidget()), "xscale", &hstretch);
+ }
+ if (valign != YAlignUnchanged) {
+ GValue yalign = YGUtils::floatToGValue (yToGtkAlign (valign));
+ g_object_set_property (G_OBJECT (getWidget()), "yalign", &yalign);
+ g_object_set_property (G_OBJECT (getWidget()), "yscale", &vstretch);
+ }
+ }
+
+ void setPadding (int top, int bottom, int left, int right)
+ {
+ gtk_alignment_set_padding (GTK_ALIGNMENT (getWidget()),
+ top, bottom, left, right);
+ }
+
+ virtual void setBackgroundPixmap (string filename)
+ {
+ // YAlignment will prepend a path to the image
+ YAlignment::setBackgroundPixmap (filename);
+ filename = YAlignment::backgroundPixmap();
+
+ if (m_background_pixbuf)
+ g_object_unref (G_OBJECT (m_background_pixbuf));
+
+ if (filename.empty()) {
+ m_background_pixbuf = 0;
+ g_signal_handlers_disconnect_by_func (G_OBJECT (getWidget()),
+ (void*) expose_event_cb, this);
+ }
+ else {
+ GError *error = 0;
+ m_background_pixbuf = gdk_pixbuf_new_from_file (filename.c_str(), &error);
+ if (!m_background_pixbuf)
+ g_warning ("Setting YAlignment background - couldn't load image '%s' - %s",
+ filename.c_str(), error->message);
+ else
+ g_signal_connect (G_OBJECT (getWidget()), "expose-event",
+ G_CALLBACK (expose_event_cb), this);
+ }
+ }
+
+ static gboolean expose_event_cb (GtkWidget *widget, GdkEventExpose *event,
+ YGAlignment *pThis)
+ {
+ GtkAllocation *alloc = &widget->allocation;
+ cairo_t *cr = gdk_cairo_create (widget->window);
+
+ gdk_cairo_set_source_pixbuf (cr, pThis->m_background_pixbuf, 0, 0);
+ cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+
+ cairo_rectangle (cr, alloc->x, alloc->y, alloc->width, alloc->height);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
+
+ gtk_container_propagate_expose (GTK_CONTAINER (widget),
+ GTK_BIN (widget)->child, event);
+ return TRUE;
+ }
+
+ virtual void moveChild (YWidget *, long, long) {}; // ignore
+
+ virtual string getDebugLabel() const
+ {
+ struct inner {
+ static const char *alignLabel (YAlignmentType align)
+ {
+ switch (align) {
+ case YAlignUnchanged:
+ return "unchanged";
+ case YAlignBegin:
+ return "begin";
+ case YAlignEnd:
+ return "end";
+ case YAlignCenter:
+ return "center";
+ }
+ return ""; /*not run*/
+ }
+ };
+
+ string str;
+ str += inner::alignLabel (align [YD_HORIZ]);
+ str += " x ";
+ str += inner::alignLabel (align [YD_VERT]);
+ return str;
+ }
+
+private:
+ // helper -- converts YWidget YAlignmentType to Gtk's align float
+ static float yToGtkAlign (YAlignmentType align)
+ {
+ switch (align) {
+ case YAlignBegin: return 0.0;
+ default:
+ case YAlignCenter: return 0.5;
+ case YAlignEnd: return 1.0;
+ }
+ }
+};
+
+YContainerWidget *
+YGUI::createAlignment (YWidget *parent, YWidgetOpt &opt,
+ YAlignmentType halign, YAlignmentType valign)
+{
+ IMPL
+ return new YGAlignment (opt, YGWidget::get (parent), halign, valign);
+}
+
+#include "YEmpty.h"
+
+// Just an empty space.
+class YGEmpty : public YEmpty, public YGWidget
+{
+public:
+ YGEmpty (const YWidgetOpt &opt, YGWidget *parent)
+ : YEmpty (opt),
+ YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
+ {
+ setBorder (0);
+ }
+};
+
+YWidget *
+YGUI::createEmpty (YWidget *parent, YWidgetOpt &opt)
+{
+ IMPL
+ return new YGEmpty (opt, YGWidget::get (parent));
+}
+
+#include "YSpacing.h"
+
+// Empty space, with a fixed size.
+class YGSpacing : public YSpacing, public YGWidget
+{
+public:
+ YGSpacing (const YWidgetOpt &opt, YGWidget *parent,
+ float size, bool horizontal, bool vertical)
+ : YSpacing (opt, size, horizontal, vertical),
+ YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
+ {
+ setBorder (0);
+ gtk_widget_set_size_request (getWidget(), width(), height());
+ }
+};
+
+YWidget *
+YGUI::createSpacing (YWidget *parent, YWidgetOpt & opt, float size,
+ bool horiz, bool vert)
+{
+ IMPL
+ return new YGSpacing (opt, YGWidget::get (parent), size, horiz, vert);
+}
+
+#include "YReplacePoint.h"
+
+// an empty space that will get replaced
+class YGReplacePoint : public YReplacePoint, public YGWidget
+{
+public:
+ YGReplacePoint (const YWidgetOpt &opt, YGWidget *parent)
+ : YReplacePoint (opt),
+ YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
+ {
+ setBorder (0);
+ }
+
+ YGWIDGET_IMPL_CHILD_ADDED (getWidget())
+ YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
+};
+
+YContainerWidget *
+YGUI::createReplacePoint( YWidget *parent, YWidgetOpt & opt )
+{
+ IMPL
+ return new YGReplacePoint (opt, YGWidget::get (parent));
+}
+
+#include "YSquash.h"
+
+// A-like YAlignment, YSquash messes around child settings.
+// In this case, it can remove the stretchable attribute.
+class YGSquash : public YSquash, public YGWidget
+{
+public:
+ YGSquash (const YWidgetOpt &opt, YGWidget *parent,
+ bool hsquash, bool vsquash)
+ : YSquash (opt, hsquash, vsquash),
+ YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
+ {
+ setBorder (0);
+ }
+
+ YGWIDGET_IMPL_CHILD_ADDED (getWidget())
+ YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
+};
+
+YContainerWidget *
+YGUI::createSquash (YWidget *parent, YWidgetOpt &opt,
+ bool hsquash, bool vsquash)
+{
+ IMPL
+ return new YGSquash (opt, YGWidget::get (parent), hsquash, vsquash);
+}
Added: trunk/gtk/10_3/src/YGMenuButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGMenuButton.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGMenuButton.cc (added)
+++ trunk/gtk/10_3/src/YGMenuButton.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,79 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGUtils.h"
+#include "YGWidget.h"
+#include "YMenuButton.h"
+#include "ygtkmenubutton.h"
+
+class YGMenuButton : public YMenuButton, public YGWidget
+{
+public:
+ YGMenuButton (const YWidgetOpt &opt,
+ YGWidget *parent,
+ YCPString label)
+ : YMenuButton (opt, label),
+ YGWidget (this, parent, true, YGTK_TYPE_MENU_BUTTON, NULL)
+ {
+ IMPL
+ setLabel (label);
+ }
+
+ virtual ~YGMenuButton() {}
+
+ // YMenuButton
+ virtual void setLabel (const YCPString &label)
+ {
+ IMPL
+ string str = YGUtils::mapKBAccel (label->value_cstr());
+ ygtk_menu_button_set_label (YGTK_MENU_BUTTON (getWidget()), str.c_str());
+ YMenuButton::setLabel (label);
+ }
+
+ // YMenuButton
+ virtual void createMenu()
+ {
+ GtkWidget *menu = doCreateMenu (getToplevelMenu()->itemList());
+ gtk_widget_show_all (menu);
+ ygtk_menu_button_set_popup (YGTK_MENU_BUTTON (getWidget()), menu);
+ }
+
+ static GtkWidget* doCreateMenu (YMenuItemList &items)
+ {
+ GtkWidget *menu = gtk_menu_new();
+ for (YMenuItemListIterator it = items.begin(); it != items.end(); it++) {
+ GtkWidget *entry;
+ string str = YGUtils::mapKBAccel ((*it)->getLabel()->value_cstr());
+ entry = gtk_menu_item_new_with_mnemonic (str.c_str());
+
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), entry);
+
+ if ((*it)->hasChildren())
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (entry),
+ doCreateMenu ((*it)->itemList()));
+ else
+ g_signal_connect (G_OBJECT (entry), "activate",
+ G_CALLBACK (selected_item_cb), *it);
+ }
+
+ return menu;
+ }
+
+ static void selected_item_cb (GtkMenuItem *menuitem, YMenuItem *yitem)
+ {
+ YGUI::ui()->sendEvent (new YMenuEvent (yitem->getId()));
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createMenuButton (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label)
+{
+ return new YGMenuButton (opt, YGWidget::get (parent), label);
+}
Added: trunk/gtk/10_3/src/YGMultiLineEdit.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGMultiLineEdit.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGMultiLineEdit.cc (added)
+++ trunk/gtk/10_3/src/YGMultiLineEdit.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,390 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include <string>
+#include "YGUtils.h"
+#include "YGWidget.h"
+
+class YGTextView : public YGScrolledWidget
+{
+int maxChars;
+
+public:
+ YGTextView (YWidget *y_widget, YGWidget *parent, const YWidgetOpt &opt,
+ const YCPString &label, const YCPString &text, bool editable)
+ : YGScrolledWidget (y_widget, parent, label, YD_VERT, true,
+ GTK_TYPE_TEXT_VIEW, "wrap-mode", GTK_WRAP_WORD, NULL)
+ {
+ IMPL
+ if (!opt.isShrinkable.value())
+ setMinSizeInChars (20, 10);
+ setPolicy (GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+
+ maxChars = -1;
+ setText (text);
+
+ if (!editable)
+ {
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (getWidget()), FALSE);
+ gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (getWidget()), FALSE);
+ }
+
+ g_signal_connect (G_OBJECT (getBuffer()), "changed",
+ G_CALLBACK (text_changed_cb), this);
+ }
+
+ GtkTextBuffer* getBuffer()
+ { return gtk_text_view_get_buffer (GTK_TEXT_VIEW (getWidget())); }
+
+ int getCharsNb()
+ {
+ IMPL
+ return gtk_text_buffer_get_char_count (getBuffer());
+ }
+
+ void setCharsNb (int max_chars)
+ {
+ IMPL
+ maxChars = max_chars;
+ if (maxChars != -1 && getCharsNb() > maxChars)
+ truncateText (maxChars);
+ }
+
+ void truncateText(int pos)
+ {
+ IMPL
+ GtkTextIter start_it, end_it;
+ gtk_text_buffer_get_iter_at_offset (getBuffer(), &start_it, pos);
+ gtk_text_buffer_get_end_iter (getBuffer(), &end_it);
+
+ g_signal_handlers_block_by_func (getWidget(), (gpointer) text_changed_cb, this);
+ gtk_text_buffer_delete (getBuffer(), &start_it, &end_it);
+ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) text_changed_cb, this);
+ }
+
+ void setText (const YCPString &text)
+ {
+ IMPL
+ gtk_text_buffer_set_text (getBuffer(), text->value_cstr(), -1);
+ }
+
+ YCPString getText()
+ {
+ IMPL
+ GtkTextIter start_it, end_it;
+ gtk_text_buffer_get_bounds (getBuffer(), &start_it, &end_it);
+
+ gchar* text = gtk_text_buffer_get_text (getBuffer(), &start_it, &end_it, FALSE);
+ YCPString str (text);
+ g_free (text);
+ return str;
+ }
+
+ void scrollToBottom()
+ {
+ YGUtils::scrollTextViewDown (GTK_TEXT_VIEW (getWidget()));
+ }
+
+ // Event callbacks
+ static void text_changed_cb (GtkTextBuffer *buffer, YGTextView *pThis)
+ {
+ if (pThis->maxChars != -1 && pThis->getCharsNb() > pThis->maxChars) {
+ pThis->truncateText (pThis->maxChars);
+ gdk_beep();
+ }
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+};
+
+#include "YMultiLineEdit.h"
+
+class YGMultiLineEdit : public YMultiLineEdit, public YGTextView
+{
+public:
+ YGMultiLineEdit (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString &label, const YCPString &text)
+ : YMultiLineEdit (opt, label)
+ , YGTextView (this, parent, opt, label, text, true)
+ { }
+
+ // YMultiLineEdit
+ virtual void setText (const YCPString &text)
+ { YGTextView::setText (text); }
+
+ virtual YCPString text()
+ { return YGTextView::getText(); }
+
+ virtual void setInputMaxLength (const YCPInteger &numberOfChars)
+ { YGTextView::setCharsNb (numberOfChars->asInteger()->value()); }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YMultiLineEdit)
+};
+
+YWidget *
+YGUI::createMultiLineEdit (YWidget *parent, YWidgetOpt & opt,
+ const YCPString & label, const YCPString & text)
+{
+ return new YGMultiLineEdit (opt, YGWidget::get (parent), label, text);
+}
+
+#include "YLogView.h"
+
+class YGLogView : public YLogView, public YGTextView
+{
+public:
+ YGLogView (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString &label, int visibleLines, int maxLines)
+ : YLogView (opt, label, visibleLines, maxLines)
+ , YGTextView (this, parent, opt, label, YCPString(""), false)
+ {
+ setMinSizeInChars (0, visibleLines);
+ }
+
+ // YLogView
+ virtual void setLogText (const YCPString &text)
+ {
+ setText (text);
+ scrollToBottom();
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YLogView)
+};
+
+YWidget *
+YGUI::createLogView (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, int visibleLines,
+ int maxLines)
+{
+ return new YGLogView (opt, YGWidget::get (parent),
+ label, visibleLines, maxLines);
+}
+
+#include "YRichText.h"
+
+class YGPlainText : public YRichText, public YGTextView
+{
+bool m_autoScrollDown;
+
+public:
+ YGPlainText(const YWidgetOpt &opt, YGWidget *parent, const YCPString &text)
+ : YRichText (opt, text)
+ , YGTextView (this, parent, opt, YCPString(""), text, false)
+ {
+ IMPL
+ m_autoScrollDown = opt.autoScrollDown.value();
+ }
+
+ // YRichText
+ virtual void setText (const YCPString &text)
+ {
+ IMPL
+ YGTextView::setText (text);
+ if (m_autoScrollDown)
+ scrollToBottom();
+ YRichText::setText (text);
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+#include "ygtkhtmlwrap.h"
+
+class YGRichText : public YRichText, public YGScrolledWidget
+{
+bool m_autoScrollDown;
+
+public:
+ YGRichText(const YWidgetOpt &opt, YGWidget *parent, const YCPString &text)
+ : YRichText (opt, text)
+ , YGScrolledWidget (this, parent, true, ygtk_html_wrap_get_type(), NULL)
+ {
+ IMPL
+ if (!opt.isShrinkable.value())
+ setMinSizeInChars (20, 8);
+ m_autoScrollDown = opt.autoScrollDown.value();
+
+ ygtk_html_wrap_init (getWidget());
+ ygtk_html_wrap_connect_link_clicked (getWidget(), G_CALLBACK (link_clicked_cb), this);
+
+ setText (text);
+ }
+
+ // YRichText
+ virtual void setText (const YCPString &_text)
+ {
+ IMPL
+ string text (_text->value());
+ YGUtils::replace (text, "&product;", 9, YUI::ui()->productName().c_str());
+
+ ygtk_html_wrap_set_text (getWidget(), text.c_str());
+ if (m_autoScrollDown)
+ ygtk_html_wrap_scroll (getWidget(), FALSE);
+ YRichText::setText (_text);
+ }
+
+ static void link_clicked_cb (GtkWidget *widget, const char *url, YGRichText *pThis)
+ {
+ YGUI::ui()->sendEvent (new YMenuEvent (YCPString (url)));
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createRichText (YWidget *parent, YWidgetOpt &opt, const YCPString &text)
+{
+ if (opt.plainTextMode.value())
+ return new YGPlainText (opt, YGWidget::get (parent), text);
+ else
+ return new YGRichText (opt, YGWidget::get (parent), text);
+}
+
+#if 0
+/* Wrote this code, in order to allow the user to print a package license.
+ But they are written in HTML, so that was too much for me. Anyway, might
+ be needed in the future -- it prints text okay. Maybe we could adapt it to
+ YGtkRichText, so that it just iterates through its tags (its a GtkTextView
+ afterall), rather than doing html parsing. ugh. Maybe we could somehow re-use
+ GtkTextView GtkLayouts...*/
+
+typedef struct {
+ gchar *title, *text;
+ PangoLayout *title_layout, *text_layout;
+ gint cur_line;
+} PrintData;
+
+
+static void free_print_data_cb (gpointer _data, GClosure *closure)
+{
+ PrintData *data = _data;
+fprintf (stderr, "freeing print data '%s'\n", data->title);
+ g_free (data->title);
+ g_free (data->text);
+ if (data->title_layout)
+ g_object_unref (G_OBJECT (data->title_layout));
+ if (data->text_layout)
+ g_object_unref (G_OBJECT (data->text_layout));
+ g_free (data);
+}
+
+static void print_begin_cb (GtkPrintOperation *print, GtkPrintContext *context, PrintData *data)
+{
+ int width = gtk_print_context_get_width (context);
+ int height = gtk_print_context_get_height (context);
+
+ PangoFontDescription *desc;
+ desc = pango_font_description_from_string ("Sans 12");
+
+ data->text_layout = gtk_print_context_create_pango_layout (context);
+ pango_layout_set_font_description (data->text_layout, desc);
+ pango_layout_set_width (data->text_layout, width * PANGO_SCALE);
+ pango_layout_set_text (data->text_layout, data->text, -1);
+
+ data->title_layout = gtk_print_context_create_pango_layout (context);
+ pango_layout_set_font_description (data->title_layout, desc);
+ pango_layout_set_width (data->title_layout, width * PANGO_SCALE);
+ pango_layout_set_text (data->title_layout, data->title, -1);
+
+ pango_font_description_free (desc);
+
+ int title_height, text_height;
+ pango_layout_get_pixel_size (data->title_layout, NULL, &title_height);
+ title_height += 10;
+ pango_layout_get_pixel_size (data->text_layout, NULL, &text_height);
+
+ int pages_nb, page_height = height - title_height;
+ pages_nb = text_height / page_height;
+ if (text_height % page_height != 0)
+ pages_nb++;
+ data->cur_line = 0;
+fprintf (stderr, "print begin: will use %d pages\n", pages_nb);
+ gtk_print_operation_set_n_pages (print, pages_nb);
+}
+
+static void print_draw_page_cb (GtkPrintOperation *print, GtkPrintContext *context,
+ gint page_nb, PrintData *data)
+{
+ int title_height;
+ pango_layout_get_pixel_size (data->title_layout, NULL, &title_height);
+ title_height += 10;
+
+ cairo_t *cr = gtk_print_context_get_cairo_context (context);
+ cairo_set_source_rgb (cr, 0, 0, 0);
+
+ cairo_move_to (cr, 6, 3);
+ pango_cairo_show_layout (cr, data->title_layout);
+
+ cairo_move_to (cr, 0, title_height-4);
+ cairo_line_to (cr, gtk_print_context_get_width (context), title_height-4);
+ cairo_stroke (cr);
+
+ int y = title_height, page_height = 0;
+ for (;; data->cur_line++) {
+fprintf (stderr, "printing line: %d\n", data->cur_line);
+ PangoLayoutLine *line = pango_layout_get_line_readonly (data->text_layout,
+ data->cur_line);
+ if (!line)
+{
+fprintf (stderr, "no more lines\n");
+ break;
+}
+ PangoRectangle rect;
+ pango_layout_line_get_pixel_extents (line, NULL, &rect);
+fprintf (stderr, "paragraph rect: %d x %d , %d x %d\n", rect.x, rect.y, rect.width, rect.height);
+ page_height += rect.height;
+ if (page_height >= gtk_print_context_get_height (context))
+{
+fprintf (stderr, "end of page: %f x %d\n", gtk_print_context_get_height (context), page_height);
+ break;
+}
+
+ cairo_move_to (cr, rect.x, y + rect.height);
+ pango_cairo_show_layout_line (cr, line);
+ y += rect.height;
+ }
+}
+
+void ygtk_html_print_text (GtkWindow *parent_window, const gchar *title, const gchar *text)
+{
+ PrintData *data = g_new (PrintData, 1);
+ data->title = g_strdup (title);
+ data->text = g_strdup (text);
+ data->title_layout = data->text_layout = NULL;
+
+ GtkPrintOperation *print = gtk_print_operation_new();
+
+ static GtkPrintSettings *print_settings = NULL;
+ if (print_settings)
+ gtk_print_operation_set_print_settings (print, print_settings);
+
+ g_signal_connect (G_OBJECT (print), "begin-print", G_CALLBACK (print_begin_cb), data);
+ g_signal_connect_data (G_OBJECT (print), "draw-page", G_CALLBACK (print_draw_page_cb),
+ data, free_print_data_cb, 0);
+
+ GError *error;
+ GtkPrintOperationResult res;
+ res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
+ parent_window, &error);
+ if (res == GTK_PRINT_OPERATION_RESULT_ERROR) {
+ GtkWidget *dialog;
+ dialog = gtk_message_dialog_new (parent_window, GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "<b>Print error</b>\n%s", error->message);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ g_error_free (error);
+ }
+ if (res == GTK_PRINT_OPERATION_RESULT_APPLY) {
+ if (print_settings)
+ g_object_unref (print_settings);
+ print_settings = g_object_ref (gtk_print_operation_get_print_settings (print));
+ }
+}
+#endif
+
Added: trunk/gtk/10_3/src/YGPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGPackageSelector.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGPackageSelector.cc (added)
+++ trunk/gtk/10_3/src/YGPackageSelector.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,1902 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+
+#include "YGUI.h"
+#include "YGUtils.h"
+#include "YGi18n.h"
+#include "YGDialog.h"
+
+#include "ygtkwizard.h"
+#include "ygtkfindentry.h"
+#include "ygtkscrolledwindow.h"
+#include "ygtktogglebutton.h"
+#include "ygtkhtmlwrap.h"
+#include "ygtkzyppwrapper.h"
+
+// utilities
+static GtkWidget *createImageFromXPM (const char **xpm)
+{
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (xpm);
+ GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_widget_show (image);
+ g_object_unref (pixbuf);
+ return image;
+}
+
+#define FILEMANAGER_EXEC "/usr/bin/nautilus -n --no-desktop"
+inline void FILEMANAGER_LAUNCH (const char *path)
+{ system ((std::string (FILEMANAGER_EXEC) + " " + path + " &").c_str()); }
+
+static void busyCursor()
+{
+ YGUI::ui()->busyCursor();
+ // so that the cursor is actually set...
+ while (g_main_context_iteration (NULL, FALSE)) ;
+}
+static void normalCursor()
+{ YGUI::ui()->normalCursor(); }
+
+#include "icons/pkg-list-mode.xpm"
+#include "icons/pkg-tiles-mode.xpm"
+
+class PackagesView
+{
+public:
+ struct Listener {
+ virtual void packagesSelected (const std::list &selection) = 0;
+ };
+ void setListener (Listener *listener)
+ { m_listener = listener; }
+
+private:
+Listener *m_listener;
+
+ void packagesSelected (const std::list &selection)
+ {
+ if (m_listener) {
+ busyCursor();
+ m_listener->packagesSelected (selection);
+ normalCursor();
+ }
+ }
+
+ struct View {
+ PackagesView *m_parent;
+ GtkWidget *m_widget;
+ View (PackagesView *parent) : m_parent (parent)
+ {}
+ virtual void setModel (GtkTreeModel *model) = 0;
+
+ void selectedPaths (GtkTreeModel *model, GList *paths)
+ {
+ std::list packages;
+ for (GList *i = paths; i; i = i->next) {
+ Ypp::Package *package;
+ GtkTreePath *path = (GtkTreePath *) i->data;
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter, YGtkZyppModel::PTR_COLUMN, &package, -1);
+ gtk_tree_path_free (path);
+
+ packages.push_back (package);
+ }
+ g_list_free (paths);
+ m_parent->packagesSelected (packages);
+ }
+ };
+ struct ListView : public View
+ {
+ ListView (PackagesView *parent)
+ : View (parent)
+ {
+ GtkTreeView *view = GTK_TREE_VIEW (m_widget = gtk_tree_view_new());
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (view), YGtkZyppModel::NAME_COLUMN);
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ renderer = gtk_cell_renderer_pixbuf_new();
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "pixbuf", YGtkZyppModel::ICON_COLUMN, NULL);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width (column, 38);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ renderer = gtk_cell_renderer_text_new();
+ g_object_set (G_OBJECT (renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "markup", YGtkZyppModel::NAME_DESCRIPTION_COLUMN, NULL);
+ gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_FIXED);
+ gtk_tree_view_column_set_fixed_width (column, 50 /* it will expand */);
+ gtk_tree_view_column_set_expand (column, TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (view), TRUE);
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
+ g_signal_connect (G_OBJECT (selection), "changed",
+ G_CALLBACK (packages_selected_cb), this);
+ gtk_widget_show (m_widget);
+ }
+
+ virtual void setModel (GtkTreeModel *model)
+ {
+ gtk_tree_view_set_model (GTK_TREE_VIEW (m_widget), model);
+ if (GTK_WIDGET_REALIZED (m_widget))
+ gtk_tree_view_scroll_to_point (GTK_TREE_VIEW (m_widget), 0, 0);
+ }
+
+ static void packages_selected_cb (GtkTreeSelection *selection, View *pThis)
+ {
+ GtkTreeModel *model;
+ GList *paths = gtk_tree_selection_get_selected_rows (selection, &model);
+ pThis->selectedPaths (model, paths);
+ }
+ };
+ struct IconView : public View
+ {
+ IconView (PackagesView *parent)
+ : View (parent)
+ {
+ GtkIconView *view = GTK_ICON_VIEW (m_widget = gtk_icon_view_new());
+ gtk_icon_view_set_text_column (view, YGtkZyppModel::NAME_COLUMN);
+ gtk_icon_view_set_pixbuf_column (view, YGtkZyppModel::ICON_COLUMN);
+ gtk_icon_view_set_selection_mode (view, GTK_SELECTION_MULTIPLE);
+ g_signal_connect (G_OBJECT (m_widget), "selection-changed",
+ G_CALLBACK (packages_selected_cb), this);
+ gtk_widget_show (m_widget);
+ }
+
+ virtual void setModel (GtkTreeModel *model)
+ {
+ gtk_icon_view_set_model (GTK_ICON_VIEW (m_widget), model);
+ if (GTK_WIDGET_REALIZED (m_widget)) {
+ GtkTreePath *path = gtk_tree_path_new_first();
+ gtk_icon_view_scroll_to_path (GTK_ICON_VIEW (m_widget),
+ path, FALSE, 0, 0);
+ gtk_tree_path_free (path);
+ }
+ }
+
+ static void packages_selected_cb (GtkIconView *view, View *pThis)
+ {
+ GtkTreeModel *model = gtk_icon_view_get_model (view);
+ GList *paths = gtk_icon_view_get_selected_items (view);
+ pThis->selectedPaths (model, paths);
+ }
+ };
+
+GtkWidget *m_bin;
+GtkTreeModel *m_model;
+View *m_view;
+
+public:
+ GtkWidget *getWidget()
+ { return m_bin; }
+
+ PackagesView() : m_listener (NULL), m_model (NULL), m_view (NULL)
+ {
+ GtkWidget *buttons = gtk_vbox_new (FALSE, 0), *button;
+ button = create_toggle_button (pkg_list_mode_xpm, "List view", NULL);
+ gtk_box_pack_start (GTK_BOX (buttons), button, FALSE, TRUE, 0);
+ button = create_toggle_button (pkg_tiles_mode_xpm, "Tiles view", button);
+ gtk_box_pack_start (GTK_BOX (buttons), button, FALSE, TRUE, 0);
+ gtk_widget_show_all (buttons);
+
+ m_bin = ygtk_scrolled_window_new();
+ ygtk_scrolled_window_set_corner_widget (YGTK_SCROLLED_WINDOW (m_bin), buttons);
+ setMode (LIST_MODE);
+ }
+
+ ~PackagesView()
+ {
+ if (m_model)
+ g_object_unref (G_OBJECT (m_model));
+ delete m_view;
+ }
+
+ enum ViewMode {
+ LIST_MODE, ICON_MODE
+ };
+ void setMode (ViewMode mode)
+ {
+ if (GTK_WIDGET_REALIZED (m_bin))
+ busyCursor();
+
+ if (m_view)
+ gtk_container_remove (GTK_CONTAINER (m_bin), m_view->m_widget);
+ delete m_view;
+ if (mode == LIST_MODE)
+ m_view = new ListView (this);
+ else
+ m_view = new IconView (this);
+ gtk_container_add (GTK_CONTAINER (m_bin), m_view->m_widget);
+ if (m_model)
+ m_view->setModel (m_model);
+
+ packagesSelected (std::list ());
+ normalCursor();
+ }
+
+ void setQuery (Ypp::Query *query)
+ {
+ if (GTK_WIDGET_REALIZED (m_bin))
+ busyCursor();
+
+ if (m_model)
+ g_object_unref (G_OBJECT (m_model));
+
+ YGtkZyppModel *zmodel = ygtk_zypp_model_new (query);
+ m_model = GTK_TREE_MODEL (zmodel);
+ if (m_view) {
+ m_view->setModel (m_model);
+ packagesSelected (std::list ());
+ }
+ normalCursor();
+ }
+
+private:
+ GtkWidget *create_toggle_button (const char **xpm, const char *tooltip, GtkWidget *member)
+ {
+ GSList *group = NULL;
+ if (member)
+ group = ygtk_toggle_button_get_group (YGTK_TOGGLE_BUTTON (member));
+ GtkWidget *button = ygtk_toggle_button_new (group);
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+ gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
+ if (!member)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+
+ // make it tiny
+ GtkRcStyle *rcstyle = gtk_rc_style_new();
+ rcstyle->xthickness = rcstyle->ythickness = 0;
+ gtk_widget_modify_style (button, rcstyle);
+ gtk_rc_style_unref (rcstyle),
+
+ gtk_widget_set_tooltip_text (button, tooltip);
+ g_signal_connect (G_OBJECT (button), "toggle-changed",
+ G_CALLBACK (mode_toggled_cb), this);
+
+ GtkWidget *image = createImageFromXPM (xpm);
+ gtk_container_add (GTK_CONTAINER (button), image);
+ return button;
+ }
+
+ static void mode_toggled_cb (GtkToggleButton *toggle, gint nb, PackagesView *pThis)
+ {
+ ViewMode mode = (nb == 0) ? LIST_MODE : ICON_MODE;
+ pThis->setMode (mode);
+ }
+};
+
+class ChangesPane : public Ypp::Pool::Listener
+{
+ struct Entry {
+ GtkWidget *m_box, *m_label, *m_button;
+ GtkWidget *getWidget() { return m_box; }
+
+ Entry (Ypp::Package *package)
+ {
+ m_label = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (m_label), 0, 0.5);
+ gtk_label_set_ellipsize (GTK_LABEL (m_label), PANGO_ELLIPSIZE_END);
+ m_button = gtk_button_new();
+ gtk_widget_set_tooltip_text (m_button, _("Undo"));
+ GtkWidget *undo_image = gtk_image_new_from_stock (GTK_STOCK_UNDO, GTK_ICON_SIZE_MENU);
+ gtk_button_set_image (GTK_BUTTON (m_button), undo_image);
+ m_box = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (m_box), m_label, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_box), m_button, FALSE, FALSE, 0);
+ gtk_widget_set_size_request (m_box, 140, -1);
+ gtk_widget_show_all (m_box);
+ modified (package);
+ g_signal_connect (G_OBJECT (m_label), "style-set",
+ G_CALLBACK (style_set_cb), NULL);
+ g_signal_connect (G_OBJECT (m_button), "clicked",
+ G_CALLBACK (undo_clicked_cb), package);
+ }
+
+ void modified (Ypp::Package *package)
+ {
+ std::string text;
+ if (package->toInstall()) {
+ if (package->isInstalled())
+ text = "upgrade";
+ else {
+ if (package->type() == Ypp::Package::PATCH_TYPE)
+ text = "patch";
+ else
+ text = "install";
+ }
+ }
+ else
+ text = "remove";
+ text += " " + package->name();
+ if (package->isAuto()) {
+ text = "\t" + text;
+ gtk_widget_hide (m_button);
+ }
+ else
+ gtk_widget_show (m_button);
+ gtk_label_set_text (GTK_LABEL (m_label), text.c_str());
+ }
+
+ static void undo_clicked_cb (GtkButton *button, Ypp::Package *package)
+ {
+ package->undo();
+ }
+
+ static void style_set_cb (GtkWidget *widget, GtkStyle *prev_style)
+ {
+ static bool set_style = false;
+ if (set_style)
+ return;
+ set_style = true;
+ GdkColor *color = &widget->style->fg [GTK_STATE_SELECTED];
+ gtk_widget_modify_fg (widget, GTK_STATE_NORMAL, color);
+ set_style = false;
+ }
+ };
+
+GtkWidget *m_box, *m_entries_box, *m_container;
+Ypp::Pool *m_pool;
+GList *m_entries;
+
+public:
+ GtkWidget *getWidget()
+ { return m_box; }
+
+ ChangesPane (bool update_mode)
+ : m_container (NULL), m_entries (NULL)
+ {
+ GtkWidget *heading = gtk_label_new (_("Changes:"));
+ YGUtils::setWidgetFont (heading, PANGO_WEIGHT_ULTRABOLD, PANGO_SCALE_LARGE);
+ gtk_misc_set_alignment (GTK_MISC (heading), 0, 0.5);
+ g_signal_connect (G_OBJECT (heading), "style-set",
+ G_CALLBACK (Entry::style_set_cb), NULL);
+ m_entries_box = gtk_vbox_new (FALSE, 4);
+
+ GtkWidget *port = gtk_viewport_new (NULL, NULL);
+ gtk_viewport_set_shadow_type (GTK_VIEWPORT (port), GTK_SHADOW_NONE);
+ gtk_container_add (GTK_CONTAINER (port), m_entries_box);
+
+ GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (scroll), port);
+
+ GtkWidget *vbox = gtk_vbox_new (FALSE, 6);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
+ gtk_box_pack_start (GTK_BOX (vbox), heading, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
+
+ m_box = gtk_event_box_new();
+ gtk_container_add (GTK_CONTAINER (m_box), vbox);
+ g_signal_connect_after (G_OBJECT (m_box), "style-set",
+ G_CALLBACK (style_set_cb), NULL);
+ g_signal_connect_after (G_OBJECT (scroll), "style-set",
+ G_CALLBACK (style_set_cb), NULL);
+ g_signal_connect_after (G_OBJECT (port), "style-set",
+ G_CALLBACK (style_set_cb), NULL);
+
+ Ypp::Query *query = new Ypp::Query();
+ query->setIsModified (true);
+ if (update_mode) {
+ query->addType (Ypp::Package::PATCH_TYPE);
+ m_pool = new Ypp::Pool (query);
+ }
+ else
+ m_pool = new Ypp::Pool (query, true);
+ // initialize list -- there could already be packages modified
+ for (Ypp::Pool::Iter it = m_pool->getFirst(); it; it = m_pool->getNext (it))
+ ChangesPane::entryInserted (it, m_pool->get (it));
+ m_pool->setListener (this);
+ }
+
+ ~ChangesPane()
+ {
+ delete m_pool;
+ for (GList *i = m_entries; i; i = i->next)
+ delete (Entry *) i->data;
+ g_list_free (m_entries);
+ }
+
+ void setContainer (GtkWidget *container)
+ {
+ m_container = container;
+ if (!m_entries)
+ gtk_widget_hide (m_container);
+ // ugly: signal modified for all entries to allow them to hide undo buttons
+ GList *i;
+ Ypp::Pool::Iter it;
+ for (it = m_pool->getFirst(), i = m_entries; it && i;
+ it = m_pool->getNext (it), i = i->next)
+ ((Entry *) i->data)->modified (m_pool->get (it));
+ }
+
+ virtual void entryInserted (Ypp::Pool::Iter iter, Ypp::Package *package)
+ {
+ Entry *entry = new Entry (package);
+ gtk_box_pack_start (GTK_BOX (m_entries_box), entry->getWidget(), FALSE, TRUE, 0);
+ int index = m_pool->getIndex (iter);
+ m_entries = g_list_insert (m_entries, entry, index);
+ if (m_container)
+ gtk_widget_show (m_container);
+ }
+
+ virtual void entryDeleted (Ypp::Pool::Iter iter, Ypp::Package *package)
+ {
+ int index = m_pool->getIndex (iter);
+ GList *i = g_list_nth (m_entries, index);
+ Entry *entry = (Entry *) i->data;
+ gtk_container_remove (GTK_CONTAINER (m_entries_box), entry->getWidget());
+ delete entry;
+ m_entries = g_list_delete_link (m_entries, i);
+ if (!m_entries)
+ gtk_widget_hide (m_container);
+ }
+
+ virtual void entryChanged (Ypp::Pool::Iter iter, Ypp::Package *package)
+ {
+ int index = m_pool->getIndex (iter);
+ Entry *entry = (Entry *) g_list_nth_data (m_entries, index);
+ entry->modified (package);
+ }
+
+ static void style_set_cb (GtkWidget *widget, GtkStyle *prev_style)
+ {
+ static bool set_style = false;
+ if (set_style)
+ return;
+ set_style = true;
+ GdkColor *color = &widget->style->bg [GTK_STATE_SELECTED];
+ gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
+ set_style = false;
+ }
+};
+
+// Maps icons to top package groups
+struct CategoriesIconMap {
+ const char *category, *icon;
+};
+static const CategoriesIconMap catIconMap[] = {
+ { "Amusements", "package_games" },
+ { "Games", "package_games" },
+ { "Development", "package_development" },
+ { "Libraries", "package_development" },
+ { "Documentation", "package_documentation" },
+ { "Hardware", "package_settings_peripherals" },
+ { "Applications", "package_applications" },
+ { "Productivity", "package_applications" },
+ { "System", "package_system" },
+ { "X11", "package_system" },
+ { "Multimedia", "package_multimedia" },
+ { "Video", "package_multimedia" },
+ { "Office", "package_office_documentviewer" },
+};
+#define CAT_SIZE (sizeof (catIconMap)/sizeof (CategoriesIconMap))
+
+#include "icons/pkg-installed.xpm"
+#include "icons/pkg-installed-upgradable.xpm"
+#include "icons/pkg-available.xpm"
+
+class Filters
+{
+ class Collections
+ {
+ struct View
+ {
+ virtual GtkWidget *getWidget() = 0;
+ virtual void writeQuery (Ypp::Query *query) = 0;
+
+ Filters *m_filters;
+ View (Filters *filters)
+ : m_filters (filters)
+ {}
+ };
+
+ struct Categories : public View
+ {
+ GtkWidget *m_scroll, *m_view;
+ public:
+ virtual GtkWidget *getWidget()
+ { return m_scroll; }
+
+ Categories (Filters *filters, Ypp::Package::Type type)
+ : View (filters)
+ {
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+
+ m_view = gtk_tree_view_new();
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (m_view), FALSE);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (m_view), 0);
+ renderer = gtk_cell_renderer_pixbuf_new();
+ column = gtk_tree_view_column_new_with_attributes ("",
+ renderer, "pixbuf", 2, NULL);
+ gtk_tree_view_column_set_expand (column, FALSE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (m_view), column);
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes ("",
+ renderer, "text", 0, NULL);
+ gtk_tree_view_column_set_expand (column, TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (m_view), column);
+ if (type == Ypp::Package::PATCH_TYPE)
+ gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (m_view), FALSE);
+ else
+ gtk_tree_view_set_expander_column (GTK_TREE_VIEW (m_view), column);
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (m_view));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+ g_signal_connect (G_OBJECT (selection), "changed",
+ G_CALLBACK (selection_cb), this);
+
+ m_scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (m_scroll),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (m_scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_widget_set_size_request (m_scroll, -1, 200);
+ gtk_container_add (GTK_CONTAINER (m_scroll), m_view);
+
+ build (type);
+ }
+
+ void build (Ypp::Package::Type type)
+ {
+ GtkTreeModel *model = NULL;
+
+ struct inner {
+ static void populate (GtkTreeStore *store, GtkTreeIter *parent,
+ Ypp::Node *category)
+ {
+ if (!category)
+ return;
+ GtkTreeIter iter;
+ gtk_tree_store_append (store, &iter, parent);
+ const std::string &name = category->name;
+ gtk_tree_store_set (store, &iter, 0, name.c_str(), 1, category, -1);
+ if (!parent) {
+ const gchar *icon = 0;
+ for (unsigned int i = 0; i < CAT_SIZE; i++)
+ if (name == catIconMap[i].category) {
+ icon = catIconMap[i].icon;
+ break;
+ }
+ if (icon) {
+ GtkIconTheme *icons = gtk_icon_theme_get_default();
+ GdkPixbuf *pixbuf;
+ pixbuf = gtk_icon_theme_load_icon (icons, icon, 22,
+ GtkIconLookupFlags (0), NULL);
+ gtk_tree_store_set (store, &iter, 2, pixbuf, -1);
+ }
+ }
+ populate (store, &iter, category->child());
+ populate (store, parent, category->next());
+ }
+ };
+
+ GtkTreeStore *store = gtk_tree_store_new (3, G_TYPE_STRING, G_TYPE_POINTER,
+ GDK_TYPE_PIXBUF);
+ model = GTK_TREE_MODEL (store);
+
+ GtkTreeIter iter;
+ gtk_tree_store_append (store, &iter, NULL);
+ gtk_tree_store_set (store, &iter, 0, _("All"), 1, NULL, -1);
+
+ inner::populate (store, NULL, Ypp::get()->getFirstCategory (type));
+
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (m_view));
+ g_signal_handlers_block_by_func (selection, (gpointer) selection_cb, this);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (m_view), model);
+ if (model) {
+ g_object_unref (G_OBJECT (model));
+
+ /* we use gtk_tree_view_set_cursor(), rather than gtk_tree_selection_select_iter()
+ because that one is buggy in that when the user first interacts with the treeview,
+ a change signal is sent, even if he was just expanding one node... */
+ GtkTreePath *path = gtk_tree_path_new_first();
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (m_view), path, NULL, FALSE);
+ gtk_tree_path_free (path);
+ }
+
+ g_signal_handlers_unblock_by_func (selection, (gpointer) selection_cb, this);
+ }
+
+ Ypp::Node *getActive()
+ {
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (m_view));
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ Ypp::Node *category = 0;
+ if (gtk_tree_selection_get_selected (selection, &model, &iter))
+ gtk_tree_model_get (model, &iter, 1, &category, -1);
+ return category;
+ }
+
+ static void selection_cb (GtkTreeSelection *selection, View *pThis)
+ {
+ pThis->m_filters->signalChanged();
+ }
+
+ virtual void writeQuery (Ypp::Query *query)
+ {
+ Ypp::Node *node = getActive();
+ if (node)
+ query->addCategory (node);
+ }
+ };
+
+ struct Pool : public View, public PackagesView::Listener
+ {
+ PackagesView *m_view;
+ GtkWidget *m_box, *m_buttons_box;
+ public:
+ virtual GtkWidget *getWidget()
+ { return m_box; }
+
+ Pool (Filters *filters, Ypp::Package::Type type)
+ : View (filters)
+ {
+ m_view = new PackagesView();
+ Ypp::Query *query = new Ypp::Query();
+ query->addType (type);
+ m_view->setQuery (query);
+ m_view->setListener (this);
+
+ m_buttons_box = gtk_hbox_new (TRUE, 2);
+ GtkWidget *image, *button;
+ button = gtk_button_new_with_label (_("Install All"));
+ image = gtk_image_new_from_stock (GTK_STOCK_SAVE, GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (install_cb), this);
+ gtk_box_pack_start (GTK_BOX (m_buttons_box), button, TRUE, TRUE, 0);
+ button = gtk_button_new_with_label (_("Remove All"));
+ image = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (remove_cb), this);
+ gtk_box_pack_start (GTK_BOX (m_buttons_box), button, TRUE, TRUE, 0);
+ gtk_widget_set_sensitive (m_buttons_box, FALSE);
+
+ m_box = gtk_vbox_new (FALSE, 4);
+ gtk_box_pack_start (GTK_BOX (m_box), m_view->getWidget(), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_box), m_buttons_box, FALSE, TRUE, 0);
+ }
+
+ std::list m_selected;
+
+ virtual void packagesSelected (const std::list &selection)
+ {
+ gtk_widget_set_sensitive (m_buttons_box, !selection.empty());
+ m_selected = selection;
+ m_filters->signalChanged();
+ }
+
+ virtual void writeQuery (Ypp::Query *query)
+ {
+ for (std::list ::const_iterator it = m_selected.begin();
+ it != m_selected.end(); it++)
+ query->addCollection (*it);
+ }
+
+ void doAll (bool install /*or remove*/)
+ {
+ // we just need to mark the collections themselves
+ for (std::list ::iterator it = m_selected.begin();
+ it != m_selected.end(); it++)
+ install ? (*it)->install(0) : (*it)->remove();
+ }
+
+ static void install_cb (GtkButton *button, Pool *pThis)
+ { pThis->doAll (true); }
+ static void remove_cb (GtkButton *button, Pool *pThis)
+ { pThis->doAll (false); }
+ };
+
+ View *m_view;
+ GtkWidget *m_bin;
+ Filters *m_filters;
+
+ public:
+ Collections (Filters *filters)
+ : m_view (NULL), m_filters (filters)
+ {
+ m_bin = gtk_event_box_new();
+ }
+
+ ~Collections()
+ {
+ delete m_view;
+ }
+
+ GtkWidget *getWidget()
+ { return m_bin; }
+
+ void setType (Ypp::Package::Type type)
+ {
+ if (m_view)
+ gtk_container_remove (GTK_CONTAINER (m_bin), m_view->getWidget());
+ delete m_view;
+
+ switch (type)
+ {
+ case Ypp::Package::PACKAGE_TYPE:
+ case Ypp::Package::PATCH_TYPE:
+ m_view = new Categories (m_filters, type);
+ break;
+ case Ypp::Package::PATTERN_TYPE:
+ case Ypp::Package::LANGUAGE_TYPE:
+ m_view = new Pool (m_filters, type);
+ break;
+ default:
+ m_view = NULL;
+ break;
+ }
+
+ if (m_view) {
+ gtk_widget_show_all (m_view->getWidget());
+ gtk_container_add (GTK_CONTAINER (m_bin), m_view->getWidget());
+ }
+ }
+
+ void writeQuery (Ypp::Query *query)
+ {
+ if (m_view)
+ m_view->writeQuery (query);
+ }
+ };
+
+ class StatusButtons
+ {
+ public:
+ enum Status { AVAILABLE, UPGRADE, INSTALLED, ALL };
+
+ private:
+ GtkWidget *m_box;
+ Filters *m_filters;
+ Status m_selected;
+ bool m_updateMode;
+
+ public:
+ GtkWidget *getWidget()
+ { return m_box; }
+
+ StatusButtons (Filters *filters, bool updateMode)
+ : m_filters (filters), m_selected (AVAILABLE), m_updateMode (updateMode)
+ {
+ m_box = gtk_hbox_new (FALSE, 6);
+
+ GtkWidget *button;
+ GSList *group;
+ button = createButton ("Available", pkg_available_xpm, NULL);
+ group = ygtk_toggle_button_get_group (YGTK_TOGGLE_BUTTON (button));
+ gtk_box_pack_start (GTK_BOX (m_box), button, TRUE, TRUE, 0);
+ if (!updateMode) {
+ button = createButton ("Upgrades", pkg_installed_upgradable_xpm, group);
+ gtk_box_pack_start (GTK_BOX (m_box), button, TRUE, TRUE, 0);
+ }
+ button = createButton ("Installed", pkg_installed_xpm, group);
+ gtk_box_pack_start (GTK_BOX (m_box), button, TRUE, TRUE, 0);
+ button = createButton ("All", 0, group);
+ gtk_box_pack_start (GTK_BOX (m_box), button, FALSE, TRUE, 0);
+ }
+
+ Status getActive()
+ {
+ return m_selected;
+ }
+
+ GtkWidget *createButton (const char *label, const char **xpm, GSList *group)
+ {
+ GtkWidget *button = ygtk_toggle_button_new (group);
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
+ if (xpm)
+ gtk_box_pack_start (GTK_BOX (hbox), createImageFromXPM (xpm), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (label), TRUE, TRUE, 0);
+ gtk_container_add (GTK_CONTAINER (button), hbox);
+ if (!group)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+ g_signal_connect (G_OBJECT (button), "toggle-changed",
+ G_CALLBACK (status_toggled_cb), this);
+ return button;
+ }
+
+ static void status_toggled_cb (GtkToggleButton *toggle, gint nb, StatusButtons *pThis)
+ {
+ pThis->m_selected = (Status) nb;
+ if (pThis->m_updateMode && nb >= 1)
+ pThis->m_selected = (Status) (nb+1);
+ pThis->m_filters->signalChanged();
+ }
+ };
+
+public:
+ struct Listener {
+ virtual void doQuery (Ypp::Query *query) = 0;
+ };
+ void setListener (Listener *listener)
+ { m_listener = listener; signalChanged(); }
+
+private:
+ Collections *m_collection;
+ StatusButtons *m_statuses;
+ GtkWidget *m_name, *m_repos, *m_type;
+ Listener *m_listener;
+ guint timeout_id;
+ int m_selectedType;
+ bool m_updateMode;
+
+public:
+ GtkWidget *getCollectionWidget() { return m_collection->getWidget(); }
+ GtkWidget *getStatusesWidget() { return m_statuses->getWidget(); }
+ GtkWidget *getNameWidget() { return m_name; }
+ GtkWidget *getReposWidget() { return m_repos; }
+ GtkWidget *getTypeWidget() { return m_type; }
+
+ Filters (bool update_mode)
+ : m_listener (NULL), timeout_id (0), m_selectedType (-1), m_updateMode (update_mode)
+ {
+ m_collection = new Collections (this);
+ m_statuses = new StatusButtons (this, update_mode);
+
+ m_name = ygtk_find_entry_new();
+ gtk_widget_set_tooltip_markup (m_name,
+ _("<b>Package search:</b> Use spaces to separate your keywords. They "
+ "will be matched against RPM <i>name</i>, <i>summary</i> and "
+ "<i>provides</i> attributes.\n(e.g.: \"yast dhcp\" will return yast's "
+ "dhcpd tool)"));
+ g_signal_connect (G_OBJECT (m_name), "changed",
+ G_CALLBACK (entry_changed_cb), this);
+
+ m_repos = gtk_combo_box_new_text();
+ gtk_widget_set_tooltip_markup (m_repos,
+ _("<b>Package repositories:</b> Limits the query to one repository.\n"
+ "Repositories may be added or managed through YaST control center."));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_repos), _("All Repositories"));
+ for (int i = 0; Ypp::get()->getRepository (i); i++) {
+ const Ypp::Repository *repo = Ypp::get()->getRepository (i);
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_repos), repo->name.c_str());
+ }
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_repos), 0);
+ g_signal_connect (G_OBJECT (m_repos), "changed",
+ G_CALLBACK (combo_changed_cb), this);
+
+ m_type = gtk_combo_box_new_text();
+ if (update_mode)
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Patches"));
+ else {
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Categories"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Patterns"));
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_type), _("Languages"));
+ }
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_type), 0);
+ g_signal_connect_after (G_OBJECT (m_type), "changed",
+ G_CALLBACK (combo_changed_cb), this);
+ }
+
+ ~Filters()
+ {
+ if (timeout_id)
+ g_source_remove (timeout_id);
+ }
+
+public:
+ int selectedRepo()
+ {
+ int repo = gtk_combo_box_get_active (GTK_COMBO_BOX (m_repos))-1;
+ return repo;
+ }
+
+private:
+ static void entry_changed_cb (GtkEditable *editable, Filters *pThis)
+ { pThis->signalChangedDelay(); }
+ static void combo_changed_cb (GtkComboBox *combo, Filters *pThis)
+ { pThis->signalChanged(); }
+
+ void signalChanged()
+ {
+ if (!m_listener) return;
+
+ Ypp::Package::Type type;
+ if (m_updateMode)
+ type = Ypp::Package::PATCH_TYPE;
+ else
+ type = (Ypp::Package::Type) gtk_combo_box_get_active (GTK_COMBO_BOX (m_type));
+
+ // adjust interface
+ if (type != m_selectedType) {
+ m_collection->setType (type);
+ m_selectedType = type;
+ }
+
+ // create query
+ Ypp::Query *query = new Ypp::Query();
+ if (type == Ypp::Package::PATCH_TYPE)
+ query->addType (Ypp::Package::PATCH_TYPE);
+ else
+ query->addType (Ypp::Package::PACKAGE_TYPE);
+
+ const char *name = gtk_entry_get_text (GTK_ENTRY (m_name));
+ if (*name)
+ query->addNames (name, ' ');
+
+ switch (m_statuses->getActive())
+ {
+ case StatusButtons::AVAILABLE:
+ if (m_updateMode)
+ // special pane for patches upgrades makes little sense, so
+ // we instead list them together with availables
+ query->setHasUpgrade (true);
+ query->setIsInstalled (false);
+ break;
+ case StatusButtons::UPGRADE:
+ query->setHasUpgrade (true);
+ break;
+ case StatusButtons::INSTALLED:
+ query->setIsInstalled (true);
+ break;
+ case StatusButtons::ALL:
+ break;
+ }
+
+ m_collection->writeQuery (query);
+
+ if (selectedRepo() >= 0)
+ query->addRepository (selectedRepo());
+
+ m_listener->doQuery (query);
+ }
+
+ void signalChangedDelay()
+ {
+ struct inner {
+ static gboolean timeout_cb (gpointer data)
+ {
+ Filters *pThis = (Filters *) data;
+ pThis->timeout_id = 0;
+ pThis->signalChanged();
+ return FALSE;
+ }
+ };
+ if (timeout_id) g_source_remove (timeout_id);
+ timeout_id = g_timeout_add (250, inner::timeout_cb, this);
+ }
+};
+
+#include "icons/pkg-locked.xpm"
+#include "icons/pkg-unlocked.xpm"
+
+class PackageControl
+{
+GtkWidget *m_widget, *m_install_button, *m_remove_button, *m_installed_version,
+ *m_available_versions, *m_undo_button, *m_lock_button, *m_locked_image,
+ *m_unlocked_image, *m_package_image;
+
+public:
+std::list m_packages; // we keep a copy to test against modified...
+Filters *m_filters; // used to filter repo versions...
+
+ GtkWidget *getWidget()
+ { return m_widget; }
+
+ PackageControl (Filters *filters)
+ : m_filters (filters)
+ {
+ // installed
+ m_install_button = createButton ("", GTK_STOCK_SAVE);
+ g_signal_connect (G_OBJECT (m_install_button), "clicked",
+ G_CALLBACK (install_clicked_cb), this);
+
+ m_installed_version = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (m_installed_version), 0, 0.5);
+
+ // available
+ m_remove_button = createButton (_("_Remove"), GTK_STOCK_DELETE);
+ g_signal_connect (G_OBJECT (m_remove_button), "clicked",
+ G_CALLBACK (remove_clicked_cb), this);
+
+ m_available_versions = gtk_combo_box_new_text();
+ g_signal_connect (G_OBJECT (m_available_versions), "changed",
+ G_CALLBACK (version_changed_cb), this);
+
+ // lock
+ m_lock_button = gtk_toggle_button_new();
+ gtk_widget_set_tooltip_markup (m_lock_button,
+ _("<b>Package lock:</b> prevents the package status from being modified by "
+ "the solver (that is, it won't honour dependencies or collections ties.)"));
+ g_signal_connect (G_OBJECT (m_lock_button), "toggled",
+ G_CALLBACK (locked_toggled_cb), this);
+ m_locked_image = createImageFromXPM (pkg_locked_xpm);
+ m_unlocked_image = createImageFromXPM (pkg_unlocked_xpm);
+ g_object_ref_sink (G_OBJECT (m_locked_image));
+ g_object_ref_sink (G_OBJECT (m_unlocked_image));
+
+ m_package_image = gtk_image_new();
+
+ m_undo_button = gtk_button_new_from_stock (GTK_STOCK_UNDO);
+ g_signal_connect (G_OBJECT (m_undo_button), "clicked",
+ G_CALLBACK (undo_clicked_cb), this);
+
+ // layout
+ GtkWidget *table;
+ table = gtk_table_new (3, 2, FALSE);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 6);
+ gtk_table_set_col_spacings (GTK_TABLE (table), 6);
+ // versions
+ gtk_table_attach (GTK_TABLE (table), m_installed_version, 1, 2, 0, 1,
+ GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), m_available_versions, 1, 2, 1, 2,
+ GTK_FILL, GTK_FILL, 0, 0);
+ // buttons
+ gtk_table_attach (GTK_TABLE (table), m_remove_button, 2, 3, 0, 1,
+ GTK_FILL, GtkAttachOptions (0), 0, 0);
+ gtk_table_attach (GTK_TABLE (table), m_install_button, 2, 3, 1, 2,
+ GTK_FILL, GtkAttachOptions (0), 0, 0);
+ // labels
+ GtkWidget *label;
+ label = gtk_label_new (_("Installed: "));
+ YGUtils::setWidgetFont (label, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+ label = gtk_label_new (_("Available: "));
+ YGUtils::setWidgetFont (label, PANGO_WEIGHT_BOLD, PANGO_SCALE_MEDIUM);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
+
+ GtkWidget *lock_align = gtk_alignment_new (0.5, 0.5, 0, 0);
+ gtk_container_add (GTK_CONTAINER (lock_align), m_lock_button);
+
+ GtkWidget *undo_align = gtk_alignment_new (0.5, 0.5, 0, 0);
+ gtk_container_add (GTK_CONTAINER (undo_align), m_undo_button);
+
+ GtkWidget *hbox = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), undo_align, FALSE, TRUE, 12);
+ gtk_box_pack_start (GTK_BOX (hbox), lock_align, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new(""), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), m_package_image, FALSE, TRUE, 0);
+
+ m_widget = gtk_alignment_new (0, 0.5, 1, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (m_widget), 6);
+ gtk_container_add (GTK_CONTAINER (m_widget), hbox);
+ }
+
+ ~PackageControl()
+ {
+ gtk_widget_destroy (m_locked_image);
+ g_object_unref (G_OBJECT (m_locked_image));
+ gtk_widget_destroy (m_unlocked_image);
+ g_object_unref (G_OBJECT (m_unlocked_image));
+ }
+
+ void setPackages (const std::list &packages)
+ {
+ m_packages = packages;
+ if (packages.empty())
+ return;
+ Ypp::Package *single_package = packages.size() == 1 ? packages.front() : NULL;
+
+ bool allInstalled = true, allNotInstalled = true, allUpgradable = true,
+ allModified = true, allLocked = true, allUnlocked = true;
+ for (std::list ::const_iterator it = packages.begin();
+ it != packages.end(); it++) {
+ if (!(*it)->isInstalled()) {
+ allInstalled = false;
+ allUpgradable = false;
+ }
+ else {
+ allNotInstalled = false;
+ const Ypp::Package::Version *version = (*it)->getAvailableVersion(0);
+ if (!version || version->cmp <= 0)
+ allUpgradable = false;
+ }
+ if ((*it)->isModified()) {
+ // if modified, can't be locked or unlocked
+ allLocked = allUnlocked = false;
+ }
+ else
+ allModified = false;
+ if ((*it)->isLocked())
+ allUnlocked = false;
+ else
+ allLocked = false;
+ }
+
+ if (allInstalled) {
+ gtk_widget_show (m_remove_button);
+ if (single_package)
+ gtk_label_set_text (GTK_LABEL (m_installed_version),
+ single_package->getInstalledVersion()->number.c_str());
+ else
+ gtk_label_set_text (GTK_LABEL (m_installed_version), "(several)");
+ }
+ else {
+ gtk_widget_hide (m_remove_button);
+ gtk_label_set_text (GTK_LABEL (m_installed_version), "--");
+ }
+
+ GtkTreeModel *model = gtk_combo_box_get_model (
+ GTK_COMBO_BOX (m_available_versions));
+ gtk_list_store_clear (GTK_LIST_STORE (model));
+ gtk_widget_set_sensitive (m_available_versions, FALSE);
+ gtk_widget_show (m_install_button);
+ if (single_package) {
+ if (single_package->getAvailableVersion (0)) {
+ gtk_widget_set_sensitive (m_available_versions, TRUE);
+ gtk_widget_show (m_install_button);
+ int selectedRepo = m_filters->selectedRepo();
+ for (int i = 0; single_package->getAvailableVersion (i); i++) {
+ const Ypp::Package::Version *version = single_package->getAvailableVersion (i);
+ if (selectedRepo >= 0 && version->repo != selectedRepo)
+ continue;
+ string text = version->number + "\n";
+ text += "(" + Ypp::get()->getRepository (version->repo)->name + ")";
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_available_versions), text.c_str());
+ }
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_available_versions), 0);
+ }
+ else
+ gtk_widget_hide (m_install_button);
+ }
+ else {
+ if (allUpgradable) {
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_available_versions), "(upgrades)");
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_available_versions), 0);
+ gtk_button_set_label (GTK_BUTTON (m_install_button), _("Upgrade"));
+ }
+ else if (allNotInstalled) {
+ gtk_combo_box_append_text (GTK_COMBO_BOX (m_available_versions), "(several)");
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_available_versions), 0);
+ gtk_button_set_label (GTK_BUTTON (m_install_button), _("Install"));
+ }
+ else
+ gtk_widget_hide (m_install_button);
+ }
+
+ // is locked
+ if (allLocked || allUnlocked) {
+ gtk_widget_show (m_lock_button);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_lock_button), allLocked);
+ gtk_button_set_image (GTK_BUTTON (m_lock_button),
+ allLocked ? m_locked_image : m_unlocked_image);
+ gtk_widget_set_sensitive (m_install_button, !allLocked);
+ gtk_widget_set_sensitive (m_remove_button, !allLocked);
+ }
+ else {
+ gtk_widget_hide (m_lock_button);
+ gtk_widget_set_sensitive (m_install_button, TRUE);
+ gtk_widget_set_sensitive (m_remove_button, TRUE);
+ }
+
+ if (allModified)
+ gtk_widget_show (m_undo_button);
+ else
+ gtk_widget_hide (m_undo_button);
+
+ gtk_image_clear (GTK_IMAGE (m_package_image));
+ if (single_package) {
+ GtkIconTheme *icons = gtk_icon_theme_get_default();
+ GdkPixbuf *pixbuf = gtk_icon_theme_load_icon (icons,
+ single_package->name().c_str(), 32, GtkIconLookupFlags (0), NULL);
+ if (pixbuf) {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (m_package_image), pixbuf);
+ g_object_unref (G_OBJECT (pixbuf));
+ }
+ }
+ }
+
+private:
+ static void install_clicked_cb (GtkButton *button, PackageControl *pThis)
+ {
+ busyCursor();
+ Ypp::get()->startTransactions();
+ for (std::list ::iterator it = pThis->m_packages.begin();
+ it != pThis->m_packages.end(); it++) {
+ int version;
+ if (GTK_WIDGET_VISIBLE (pThis->m_available_versions))
+ version = gtk_combo_box_get_active (GTK_COMBO_BOX (
+ pThis->m_available_versions));
+ else
+ version = 0; // i.e. most recent (on multi-packages)
+ (*it)->install (version);
+ }
+ Ypp::get()->finishTransactions();
+ normalCursor();
+ }
+
+ static void remove_clicked_cb (GtkButton *button, PackageControl *pThis)
+ {
+ busyCursor();
+ Ypp::get()->startTransactions();
+ for (std::list ::iterator it = pThis->m_packages.begin();
+ it != pThis->m_packages.end(); it++)
+ (*it)->remove();
+ Ypp::get()->finishTransactions();
+ normalCursor();
+ }
+
+ static void locked_toggled_cb (GtkToggleButton *button, PackageControl *pThis)
+ {
+ bool lock = gtk_toggle_button_get_active (button);
+ busyCursor();
+ Ypp::get()->startTransactions();
+ for (std::list ::iterator it = pThis->m_packages.begin();
+ it != pThis->m_packages.end(); it++)
+ (*it)->lock (lock);
+ Ypp::get()->finishTransactions();
+ normalCursor();
+ }
+
+ static void undo_clicked_cb (GtkButton *button, PackageControl *pThis)
+ {
+ busyCursor();
+ Ypp::get()->startTransactions();
+ for (std::list ::iterator it = pThis->m_packages.begin();
+ it != pThis->m_packages.end(); it++)
+ (*it)->undo();
+ Ypp::get()->finishTransactions();
+ normalCursor();
+ }
+
+ static void version_changed_cb (GtkComboBox *combo, PackageControl *pThis)
+ {
+ if (pThis->m_packages.size() == 1) {
+ Ypp::Package *package = pThis->m_packages.front();
+ int nb = gtk_combo_box_get_active (GTK_COMBO_BOX (pThis->m_available_versions));
+ if (nb == -1) return;
+
+ const Ypp::Package::Version *version;
+ version = package->getAvailableVersion (nb);
+ g_assert (version != NULL);
+
+ const char *installLabel = _("Install");
+ if (package->isInstalled()) {
+ if (version->cmp > 0)
+ installLabel = _("Upgrade");
+ else if (version->cmp == 0)
+ installLabel = _("Re-install");
+ else //if (version->cmp < 0)
+ installLabel = _("Downgrade");
+ }
+ gtk_button_set_label (GTK_BUTTON (pThis->m_install_button), installLabel);
+ }
+ }
+
+ // utility
+ static GtkWidget *createButton (const char *label_str, const gchar *stock_id)
+ {
+ GtkWidget *button, *image;
+ button = gtk_button_new_with_mnemonic (label_str);
+ if (stock_id) {
+ image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ }
+ return button;
+ }
+};
+
+class PackageDetails
+{
+GtkWidget *m_widget, *m_description, *m_filelist, *m_changelog, *m_authors;
+PackageControl *m_control;
+
+public:
+ GtkWidget *getWidget()
+ { return m_widget; }
+
+ PackageDetails (Filters *filters, bool update_mode)
+ {
+ m_control = new PackageControl (filters);
+ m_widget = gtk_notebook_new();
+ gtk_notebook_set_tab_pos (GTK_NOTEBOOK (m_widget), GTK_POS_BOTTOM);
+ addPage (_("Status"), m_control->getWidget());
+ addPage (_("Description"), createHtmlWidget (&m_description));
+ if (update_mode)
+ m_filelist = m_changelog = m_authors = NULL;
+ else {
+ addPage (_("File List"), createHtmlWidget (&m_filelist));
+ addPage (_("ChangeLog"), createHtmlWidget (&m_changelog));
+ addPage (_("Authors"), createHtmlWidget (&m_authors));
+ ygtk_html_wrap_connect_link_clicked (m_filelist,
+ G_CALLBACK (path_pressed_cb), NULL);
+ }
+ }
+
+ void setPackages (std::list packages)
+ {
+ if (packages.empty()) {
+ gtk_widget_hide (m_widget);
+ }
+ else {
+ gtk_widget_show (m_widget);
+ m_control->setPackages (packages);
+ Ypp::Package *package = packages.front();
+ if (package) {
+ setText (m_description, package->description(), false);
+ setText (m_filelist, package->filelist(), true);
+ setText (m_changelog, package->changelog(), true);
+ setText (m_authors, package->authors(), false);
+ if (!GTK_WIDGET_VISIBLE (m_widget)) {
+ gtk_notebook_set_current_page (GTK_NOTEBOOK (m_widget), 0);
+ gtk_widget_show (m_widget);
+ }
+ }
+ }
+ }
+
+ void packageModified (Ypp::Package *package)
+ {
+ // GTK+ doesn't fire selection change when a selected row changes, so we need
+ // to re-load PackageControl in that occasions.
+ std::list ::iterator it;
+ for (it = m_control->m_packages.begin(); it != m_control->m_packages.end(); it++)
+ if (*it == package)
+ break;
+ if (it != m_control->m_packages.end())
+ m_control->setPackages (m_control->m_packages);
+ }
+
+private:
+ static void path_pressed_cb (GtkWidget *text, const gchar *link)
+ { FILEMANAGER_LAUNCH (link); }
+
+ // utilities:
+ static GtkWidget *createHtmlWidget (GtkWidget **html_widget)
+ {
+ *html_widget = ygtk_html_wrap_new();
+ GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (scroll), *html_widget);
+ return scroll;
+ }
+
+ void addPage (const char *title, GtkWidget *content)
+ {
+ gtk_notebook_append_page (GTK_NOTEBOOK (m_widget), content, gtk_label_new (title));
+ }
+
+ void setText (GtkWidget *rtext, const std::string &text, bool only_availables)
+ {
+ if (!rtext) return;
+ const char *str = text.c_str();
+ if (text.empty()) {
+ if (only_availables)
+ str = _("<i>(only available for installed packages)</i>");
+ else
+ str = "--";
+ }
+ ygtk_html_wrap_set_text (rtext, str);
+ ygtk_html_wrap_scroll (rtext, TRUE);
+ }
+};
+
+#if 0
+class DiskView : public Ypp::Disk::Listener
+{
+GtkWidget *m_widget;
+bool m_hasWarn;
+GtkTreeModel *m_model;
+
+public:
+ GtkWidget *getWidget()
+ { return m_widget; }
+
+ DiskView()
+ : m_hasWarn (false)
+ {
+ m_model = GTK_TREE_MODEL (gtk_list_store_new (
+ // 0 - mount point, 1 - usage percent, 2 - usage string
+ 3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING));
+ m_widget = createCombo (m_model);
+ g_object_unref (G_OBJECT (m_model));
+
+ Ypp::get()->getDisk()->setListener (this);
+ update();
+ }
+
+private:
+ #define MIN_FREE_MB_WARN (80*1024)
+ virtual void update()
+ {
+ GtkListStore *store = GTK_LIST_STORE (m_model);
+ gtk_list_store_clear (store);
+
+ int warn_part = -1;
+ Ypp::Disk *disk = Ypp::get()->getDisk();
+ for (int i = 0; disk->getPartition (i); i++) {
+ const Ypp::Disk::Partition *part = disk->getPartition (i);
+ long usage = (part->used * 100) / (part->total + 1);
+ std::string usage_str = part->used_str + " (of " + part->total_str + ")";
+ GtkTreeIter iter;
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter, 0, part->path.c_str(), 1, usage,
+ 2, usage_str.c_str(), -1);
+ if (warn_part < 0 && (part->total > 1024 && part->total - part->used < MIN_FREE_MB_WARN))
+ warn_part = i;
+ }
+ if (warn_part >= 0) {
+ warn();
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_widget), warn_part);
+ }
+ else
+ gtk_combo_box_set_active (GTK_COMBO_BOX (m_widget), 0);
+ }
+
+ void warn()
+ {
+ if (m_hasWarn) return;
+ m_hasWarn = true;
+
+ GtkWidget *dialog, *view;
+ dialog = gtk_message_dialog_new (YGDialog::currentWindow(),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK, _("Disk Almost Full !"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "One of the partitions is reaching its limit of capacity. You may "
+ "have to remove packages if you wish to install some.");
+
+ view = createView (m_model);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), view);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+
+ // utilities
+#if 1
+ static GtkWidget *createView (GtkTreeModel *model)
+ {
+ GtkWidget *view = gtk_tree_view_new_with_model (model), *scroll;
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)),
+ GTK_SELECTION_NONE);
+
+ GtkTreeViewColumn *column;
+ column = gtk_tree_view_column_new_with_attributes (_("Mount Point"),
+ gtk_cell_renderer_text_new(), "text", 0, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ column = gtk_tree_view_column_new_with_attributes (_("Usage"),
+ gtk_cell_renderer_progress_new(), "value", 1, "text", 2, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+
+ scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+ gtk_container_add (GTK_CONTAINER (scroll), view);
+ gtk_widget_show_all (scroll);
+ return scroll;
+ }
+#endif
+ static GtkWidget *createCombo (GtkTreeModel *model)
+ {
+ GtkWidget *combo = gtk_combo_box_new_with_model (model);
+ GtkCellRenderer *renderer;
+ renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo),
+ renderer, "text", 0, NULL);
+ // let's put all columns to the same width, to make it look like a table
+ g_object_set (G_OBJECT (renderer), "width-chars", 14, NULL);
+ renderer = gtk_cell_renderer_progress_new();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo),
+ renderer, "value", 1, "text", 2, NULL);
+ return combo;
+ }
+};
+#else
+// disabled
+struct DiskView
+{
+GtkWidget *m_empty;
+GtkWidget *getWidget() { return m_empty; }
+DiskView() { m_empty = gtk_event_box_new(); }
+};
+#endif
+
+class PackageSelector : public Filters::Listener, public PackagesView::Listener
+{
+PackagesView *m_packages;
+Filters *m_filters;
+PackageDetails *m_details;
+DiskView *m_disk;
+GtkWidget *m_box;
+ChangesPane *m_changes;
+
+public:
+ GtkWidget *getWidget()
+ { return m_box; }
+
+ PackageSelector (bool update_mode)
+ {
+ m_packages = new PackagesView();
+ m_filters = new Filters (update_mode);
+ m_details = new PackageDetails (m_filters, update_mode);
+ m_disk = new DiskView();
+ m_changes = new ChangesPane (update_mode);
+ m_packages->setListener (this);
+ m_filters->setListener (this);
+
+ GtkWidget *filter_box = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (filter_box), gtk_label_new (_("Filters:")), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (filter_box), m_filters->getNameWidget(), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (filter_box), m_filters->getReposWidget(), FALSE, TRUE, 0);
+
+ GtkWidget *categories_box = gtk_vbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (categories_box), m_filters->getCollectionWidget(),
+ TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (categories_box), m_filters->getTypeWidget(), FALSE, TRUE, 0);
+
+ GtkWidget *packages_box = gtk_hpaned_new();
+ gtk_paned_pack1 (GTK_PANED (packages_box), categories_box, TRUE, TRUE);
+ gtk_paned_pack2 (GTK_PANED (packages_box), m_packages->getWidget(), TRUE, FALSE);
+ gtk_paned_set_position (GTK_PANED (packages_box), 180);
+
+ GtkWidget *details_box = gtk_vpaned_new();
+ gtk_paned_pack1 (GTK_PANED (details_box), packages_box, TRUE, FALSE);
+ gtk_paned_pack2 (GTK_PANED (details_box), m_details->getWidget(), TRUE, FALSE);
+ gtk_paned_set_position (GTK_PANED (details_box), 30000 /* minimal size */);
+
+ GtkWidget *vbox = gtk_vbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (vbox), m_filters->getStatusesWidget(), FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), filter_box, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), details_box, TRUE, TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
+
+ GtkWidget *changes_box = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (changes_box), m_changes->getWidget(), TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (changes_box), m_disk->getWidget(), FALSE, TRUE, 0);
+
+ m_box = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (m_box), vbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_box), changes_box, FALSE, TRUE, 0);
+
+ gtk_widget_show_all (m_box);
+ m_changes->setContainer (changes_box);
+ m_details->setPackages (std::list ());
+ }
+
+ ~PackageSelector()
+ {
+ delete m_packages;
+ delete m_details;
+ delete m_filters;
+ delete m_disk;
+ delete m_changes;
+ }
+
+ virtual void doQuery (Ypp::Query *query)
+ {
+ m_packages->setQuery (query);
+ }
+
+ virtual void packagesSelected (const std::list &packages)
+ {
+ m_details->setPackages (packages);
+ }
+
+ void packageModified (Ypp::Package *package)
+ {
+ m_details->packageModified (package);
+ }
+};
+
+#include "YPackageSelector.h"
+#include "pkg-selector-help.h"
+
+class YGPackageSelector : public YPackageSelector, public YGWidget, public Ypp::Interface
+{
+PackageSelector *m_package_selector;
+
+public:
+ YGPackageSelector (YGWidget *parent, YWidgetOpt &opt)
+ : YPackageSelector (opt),
+ YGWidget (this, parent, true, YGTK_TYPE_WIZARD, NULL)
+ {
+ setBorder (0);
+ YGTK_WIZARD (getWidget())->child_border_width = 0;
+ bool updateMode = opt.youMode.value();
+
+ YGDialog *dialog = YGUI::ui()->currentYGDialog();
+ dialog->setCloseCallback (confirm_cb, this);
+
+ GtkWindow *window = YGUI::ui()->currentWindow();
+ gtk_window_resize (window,
+ MAX (700, GTK_WIDGET (window)->allocation.width),
+ MAX (680, GTK_WIDGET (window)->allocation.height));
+
+ YGtkWizard *wizard = YGTK_WIZARD (getWidget());
+ ygtk_wizard_set_header_icon (wizard, window,
+ THEMEDIR "/icons/22x22/apps/yast-software.png");
+ ygtk_wizard_set_header_text (wizard, window,
+ updateMode ? _("Patch Selector") : _("Package Selector"));
+ ygtk_wizard_set_help_text (wizard, updateMode ? patch_help : pkg_help);
+
+ ygtk_wizard_set_abort_button_label (wizard, _("_Cancel"));
+ ygtk_wizard_set_abort_button_str_id (wizard, "cancel");
+ ygtk_wizard_set_back_button_label (wizard, "");
+ ygtk_wizard_set_next_button_label (wizard, _("_Apply"));
+ ygtk_wizard_set_next_button_str_id (wizard, "accept");
+ g_signal_connect (G_OBJECT (getWidget()), "action-triggered",
+ G_CALLBACK (wizard_action_cb), this);
+
+ m_package_selector = new PackageSelector (updateMode);
+ gtk_container_add (GTK_CONTAINER (wizard), m_package_selector->getWidget());
+
+ Ypp::get()->setInterface (this);
+ }
+
+ virtual ~YGPackageSelector()
+ {
+ delete m_package_selector;
+ ygtk_zypp_model_finish();
+ }
+
+protected:
+ static void wizard_action_cb (YGtkWizard *wizard, gpointer id,
+ gint id_type, YGPackageSelector *pThis)
+ {
+ IMPL
+ const gchar *action = (gchar *) id;
+
+ if (!strcmp (action, "accept")) {
+ y2milestone ("Closing PackageSelector with 'accept'");
+ YGUI::ui()->sendEvent (new YMenuEvent (YCPSymbol ("accept")));
+ }
+ else if (!strcmp (action, "cancel")) {
+ y2milestone ("Closing PackageSelector with 'cancel'");
+ if (pThis->confirmExit())
+ YGUI::ui()->sendEvent (new YCancelEvent());
+ }
+ }
+
+ bool confirmExit()
+ {
+ if (!Ypp::get()->isModified())
+ return true;
+
+ GtkWidget *dialog;
+ dialog = gtk_message_dialog_new
+ (YGUI::ui()->currentWindow(),
+ GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE, _("Changes not saved!"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ _("Quit anyway?"));
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
+ GTK_STOCK_QUIT, GTK_RESPONSE_YES, NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
+
+ bool ok = gtk_dialog_run (GTK_DIALOG (dialog)) ==
+ GTK_RESPONSE_YES;
+ gtk_widget_destroy (dialog);
+ return ok;
+ }
+ static bool confirm_cb (void *pThis)
+ { return ((YGPackageSelector *)pThis)->confirmExit(); }
+
+ virtual bool acceptLicense (Ypp::Package *package, const std::string &license)
+ {
+ std::string title = package->name() + _(" License Agreement");
+ GtkWidget *dialog = gtk_dialog_new_with_buttons (title.c_str(),
+ YGUI::ui()->currentWindow(), GTK_DIALOG_NO_SEPARATOR,
+ _("_Reject"), GTK_RESPONSE_REJECT, _("_Accept"), GTK_RESPONSE_ACCEPT, NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+
+ GtkWidget *license_view, *license_window;
+
+ license_view = ygtk_html_wrap_new();
+ ygtk_html_wrap_set_text (license_view, license.c_str());
+
+ license_window = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (license_window),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type
+ (GTK_SCROLLED_WINDOW (license_window), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (license_window), license_view);
+
+ GtkBox *vbox = GTK_BOX (GTK_DIALOG(dialog)->vbox);
+ gtk_box_pack_start (vbox, license_window, TRUE, TRUE, 6);
+
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 400);
+ gtk_widget_show_all (dialog);
+
+ gint ret = gtk_dialog_run (GTK_DIALOG (dialog));
+ bool confirmed = (ret == GTK_RESPONSE_ACCEPT);
+
+ gtk_widget_destroy (dialog);
+ return confirmed;
+ }
+
+ virtual bool resolveProblems (std::list problems)
+ {
+ // we can't use ordinary radio buttons, as gtk+ enforces that in a group
+ // one must be selected...
+
+ enum ColumnAlias {
+ SHOW_TOGGLE_COL, ACTIVE_TOGGLE_COL, TEXT_COL, WEIGHT_TEXT_COL,
+ APPLY_PTR_COL, TOOLTIP_TEXT_COL
+ };
+
+ struct inner {
+ static void solution_toggled (GtkTreeModel *model, GtkTreePath *path)
+ {
+ GtkTreeStore *store = GTK_TREE_STORE (model);
+ GtkTreeIter iter, parent;
+
+ gboolean enabled;
+ bool *apply;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_model_get (model, &iter, ACTIVE_TOGGLE_COL, &enabled,
+ APPLY_PTR_COL, &apply, -1);
+
+ // disable all the other radios on the group, setting current
+ gtk_tree_model_get_iter (model, &iter, path);
+ if (gtk_tree_model_iter_parent (model, &parent, &iter)) {
+ gtk_tree_model_iter_children (model, &iter, &parent);
+ do {
+ gtk_tree_store_set (store, &iter, ACTIVE_TOGGLE_COL, FALSE, -1);
+ bool *apply;
+ gtk_tree_model_get (model, &iter, APPLY_PTR_COL, &apply, -1);
+ *apply = false;
+ } while (gtk_tree_model_iter_next (model, &iter));
+ }
+
+ enabled = !enabled;
+ if (apply)
+ *apply = enabled;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_store_set (store, &iter, ACTIVE_TOGGLE_COL, enabled, -1);
+ }
+ static void cursor_changed_cb (GtkTreeView *view, GtkTreeModel *model)
+ {
+ GtkTreePath *path;
+ gtk_tree_view_get_cursor (view, &path, NULL);
+ solution_toggled (model, path);
+ gtk_tree_path_free (path);
+ }
+ static gboolean query_tooltip_cb (GtkWidget *view, gint x, gint y,
+ gboolean keyboard_mode, GtkTooltip *tooltip, gpointer data)
+ {
+ GtkTreeModel *model;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ if (gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (view),
+ &x, &y, keyboard_mode, &model, &path, &iter)) {
+ gchar *tooltip_str;
+ gtk_tree_model_get (model, &iter, TOOLTIP_TEXT_COL,
+ &tooltip_str, -1);
+ gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (view), tooltip, path);
+ gtk_tree_path_free (path);
+ if (tooltip_str) {
+ gtk_tooltip_set_text (tooltip, tooltip_str);
+ g_free (tooltip_str);
+ return TRUE;
+ }
+ }
+ return FALSE;
+ }
+ static void truncate (std::string &str, unsigned int size)
+ {
+ if (str.size() > size) {
+ str.erase (size-3);
+ str += "...";
+ }
+ }
+ };
+
+ // model
+ GtkTreeStore *store = gtk_tree_store_new (6, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
+ G_TYPE_STRING, G_TYPE_INT, G_TYPE_POINTER, G_TYPE_STRING);
+ for (std::list ::iterator it = problems.begin();
+ it != problems.end(); it++) {
+ inner::truncate ((*it)->details, 800);
+ GtkTreeIter problem_iter;
+ gtk_tree_store_append (store, &problem_iter, NULL);
+ gtk_tree_store_set (store, &problem_iter, SHOW_TOGGLE_COL, FALSE,
+ TEXT_COL, (*it)->description.c_str(),
+ WEIGHT_TEXT_COL, PANGO_WEIGHT_BOLD, APPLY_PTR_COL, NULL,
+ TOOLTIP_TEXT_COL, (*it)->details.c_str(), -1);
+
+ for (int i = 0; (*it)->getSolution (i); i++) {
+ Ypp::Problem::Solution *solution = (*it)->getSolution (i);
+ inner::truncate (solution->details, 800);
+ GtkTreeIter solution_iter;
+ const gchar *tooltip_text = solution->details.c_str();
+ if (solution->details.empty())
+ tooltip_text = NULL;
+ gtk_tree_store_append (store, &solution_iter, &problem_iter);
+ gtk_tree_store_set (store, &solution_iter, SHOW_TOGGLE_COL, TRUE,
+ ACTIVE_TOGGLE_COL, FALSE, TEXT_COL, solution->description.c_str(),
+ APPLY_PTR_COL, &solution->apply,
+ TOOLTIP_TEXT_COL, tooltip_text, -1);
+ }
+ }
+
+ // interface
+ GtkWidget *dialog = gtk_message_dialog_new (YGUI::ui()->currentWindow(),
+ GtkDialogFlags (0), GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
+ _("There are some conflicts on the transaction that must be "
+ "solved manually."));
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_APPLY, GTK_RESPONSE_APPLY, NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY);
+
+ GtkWidget *view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+ g_object_unref (G_OBJECT (store));
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (view)), GTK_SELECTION_NONE);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (view), TEXT_COL);
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
+ renderer = gtk_cell_renderer_toggle_new();
+ gtk_cell_renderer_toggle_set_radio (
+ GTK_CELL_RENDERER_TOGGLE (renderer), TRUE);
+ // we should not connect the actual toggle button, as we toggle on row press
+ g_signal_connect (G_OBJECT (view), "cursor-changed",
+ G_CALLBACK (inner::cursor_changed_cb), store);
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "visible", SHOW_TOGGLE_COL, "active", ACTIVE_TOGGLE_COL, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ renderer = gtk_cell_renderer_text_new();
+ g_object_set (G_OBJECT (renderer), "wrap-width", 400, NULL);
+ column = gtk_tree_view_column_new_with_attributes ("", renderer,
+ "text", TEXT_COL, "weight", WEIGHT_TEXT_COL, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
+ gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
+ gtk_widget_set_has_tooltip (view, TRUE);
+ g_signal_connect (G_OBJECT (view), "query-tooltip",
+ G_CALLBACK (inner::query_tooltip_cb), store);
+
+ GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
+ GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (scroll), view);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scroll);
+
+ gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), -1, 480);
+ gtk_widget_show_all (dialog);
+
+ bool apply = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_APPLY);
+ gtk_widget_destroy (dialog);
+ return apply;
+ }
+
+ virtual void packageModified (Ypp::Package *package)
+ {
+ m_package_selector->packageModified (package);
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget*
+YGUI::createPackageSelector (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &floppyDevice)
+{
+ return new YGPackageSelector (YGWidget::get (parent), opt);
+}
+
+YWidget *
+YGUI::createPkgSpecial (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &subwidget)
+{
+ // same as Qt's
+ y2error ("The GTK+ UI does not support PkgSpecial subwidgets!");
+ return 0;
+}
+
Added: trunk/gtk/10_3/src/YGProgressBar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGProgressBar.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGProgressBar.cc (added)
+++ trunk/gtk/10_3/src/YGProgressBar.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,177 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGWidget.h"
+
+#include "YProgressBar.h"
+
+class YGProgressBar : public YProgressBar, public YGLabeledWidget
+{
+ bool m_pulse;
+public:
+ YGProgressBar (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString& label,
+ const YCPInteger& maxprogress, const YCPInteger& progress)
+ : YProgressBar (opt, label, maxprogress, progress)
+ , YGLabeledWidget (this, parent, label, YD_VERT, true,
+ GTK_TYPE_PROGRESS_BAR, NULL)
+ {
+ m_pulse = maxprogress->value() <= 0;
+ }
+ // NOTE: its label widget is positionated at the vertical, because its label
+ // may change often and so will its size, which will look odd (we may want
+ // to make the label widget to only grow).
+
+ virtual ~YGProgressBar() {}
+
+ // YProgressBar
+ virtual void setProgress (const YCPInteger& newProgress)
+ {
+ IMPL
+ if (m_pulse)
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (getWidget()));
+ else {
+ float fraction = (float) newProgress->value() / maxProgress->value();
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (getWidget()), fraction);
+ }
+ YProgressBar::setProgress (newProgress);
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YProgressBar)
+};
+
+YWidget *
+YGUI::createProgressBar (YWidget* parent, YWidgetOpt& opt,
+ const YCPString& label, const YCPInteger& maxprogress,
+ const YCPInteger& progress)
+{
+ IMPL;
+ return new YGProgressBar (opt, YGWidget::get (parent),
+ label, maxprogress, progress);
+}
+
+#include "YDownloadProgress.h"
+
+class YGDownloadProgress : public YDownloadProgress, public YGLabeledWidget
+{
+ guint timeout_id;
+
+public:
+ YGDownloadProgress (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString& label, const YCPString &filename,
+ int expectedSize)
+ : YDownloadProgress (opt, label, filename, expectedSize)
+ , YGLabeledWidget (this, parent, label, YD_HORIZ, true,
+ GTK_TYPE_PROGRESS_BAR, NULL)
+ {
+ timeout_id = g_timeout_add (250, timeout_cb, this);
+ }
+
+ virtual ~YGDownloadProgress()
+ {
+ g_source_remove (timeout_id);
+ }
+
+ virtual void setExpectedSize (int expectedSize)
+ {
+ YDownloadProgress::setExpectedSize (expectedSize);
+ timeout_cb(this); // force an update
+ }
+
+ static gboolean timeout_cb (void *pData)
+ {
+ YGDownloadProgress *pThis = (YGDownloadProgress*) pData;
+ float fraction = (float) pThis->currentFileSize() / pThis->expectedSize();
+ if (fraction > 1) fraction = 1;
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (pThis->getWidget()), fraction);
+ return TRUE;
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YDownloadProgress)
+};
+
+YWidget *
+YGUI::createDownloadProgress (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, const YCPString &filename,
+ int expectedSize)
+{
+ IMPL
+ return new YGDownloadProgress (opt, YGWidget::get (parent),
+ label, filename, expectedSize);
+}
+
+#include "ygtkratiobox.h"
+#include "YMultiProgressMeter.h"
+
+class YGMultiProgressMeter : public YMultiProgressMeter, public YGWidget
+{
+public:
+ YGMultiProgressMeter (const YWidgetOpt &opt, YGWidget *parent,
+ bool horizontal, const YCPList &maxValues)
+ : YMultiProgressMeter (opt, horizontal, maxValues)
+ , YGWidget (this, parent, true,
+ horizontal ? YGTK_TYPE_RATIO_HBOX : YGTK_TYPE_RATIO_VBOX, NULL)
+ {
+// ygtk_ratio_box_set_homogeneous (YGTK_RATIO_BOX (getWidget()), TRUE);
+ ygtk_ratio_box_set_spacing (YGTK_RATIO_BOX (getWidget()), 2);
+ for (int s = 0; s < segments(); s++) {
+ GtkWidget* bar = gtk_progress_bar_new();
+ gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (bar),
+ horizontal ? GTK_PROGRESS_LEFT_TO_RIGHT : GTK_PROGRESS_BOTTOM_TO_TOP);
+ // Progress bars would ask for too much size with weight...
+ const int min_size = 5;
+ if (horizontal)
+ gtk_widget_set_size_request (bar, min_size, -1);
+ else
+ gtk_widget_set_size_request (bar, -1, min_size);
+ ygtk_ratio_box_pack (YGTK_RATIO_BOX (getWidget()), bar,
+ getSegmentWeight (s), TRUE, TRUE, 0);
+ }
+
+ ygtk_adj_size_set_max (YGTK_ADJ_SIZE (m_adj_size), horizontal ? 200 : 0,
+ horizontal ? 0 : 200);
+ gtk_widget_show_all (getWidget());
+ }
+
+ virtual void doUpdate()
+ {
+ GList* children = gtk_container_get_children (GTK_CONTAINER (getWidget()));
+ int s = 0;
+ for (GList *i = children; i && s < segments(); i = i->next, s++) {
+ GtkProgressBar *bar = GTK_PROGRESS_BAR (i->data);
+ gtk_progress_bar_set_fraction (bar, getSegmentValue (s));
+ }
+ g_list_free (children);
+ }
+
+ int getSegmentWeight (int n)
+ {
+ if (vertical())
+ n = (segments() - n) - 1;
+ return maxValue (n);
+ }
+ float getSegmentValue (int n)
+ {
+ if (vertical())
+ n = (segments() - n) - 1;
+ if (currentValue (n) == -1)
+ return 0;
+ return 1.0 - (((float) currentValue (n)) / maxValue (n));
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createMultiProgressMeter (YWidget *parent, YWidgetOpt &opt,
+ bool horizontal, const YCPList &maxValues)
+{
+ return new YGMultiProgressMeter (opt, YGWidget::get (parent),
+ horizontal, maxValues);
+}
Added: trunk/gtk/10_3/src/YGPushButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGPushButton.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGPushButton.cc (added)
+++ trunk/gtk/10_3/src/YGPushButton.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,77 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YPushButton.h"
+#include "YGUtils.h"
+#include "YGWidget.h"
+
+class YGPushButton : public YPushButton, public YGWidget
+{
+public:
+ YGPushButton (const YWidgetOpt &opt, YGWidget *parent, YCPString label)
+ : YPushButton (opt, label),
+ YGWidget (this, parent, true, GTK_TYPE_BUTTON, "can-default", TRUE, NULL)
+ {
+ IMPL
+ if (!opt.isShrinkable.value())
+ setMinSizeInChars (10, 0);
+
+ gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE);
+ setLabel (label);
+
+ g_signal_connect (G_OBJECT (getWidget ()), "clicked",
+ G_CALLBACK (clicked_cb), this);
+ if (opt.isDefaultButton.value())
+ g_signal_connect (G_OBJECT (getWidget ()), "realize",
+ G_CALLBACK (set_default_cb), this);
+ }
+
+ // YPushButton
+ virtual void setLabel (const YCPString &label)
+ {
+ IMPL
+ string str = YGUtils::mapKBAccel (label->value_cstr());
+ gtk_button_set_label (GTK_BUTTON (getWidget()), str.c_str());
+ YGUtils::setStockIcon (getWidget(), str);
+ YPushButton::setLabel (label);
+ }
+
+ virtual void setIcon (const YCPString &icon_name)
+ {
+ IMPL
+ string path = icon_name->value();
+ if (path[0] != '/')
+ path = ICON_DIR + path;
+
+ GError *error = 0;
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (path.c_str(), &error);
+ if (pixbuf) {
+ GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_button_set_image (GTK_BUTTON (getWidget()), image);
+ g_object_unref (G_OBJECT (pixbuf));
+ }
+ else
+ y2warning ("YGPushButton: Couldn't load icon image: %s.\n"
+ "Reason: %s", path.c_str(), error->message);
+ }
+
+ static void set_default_cb (GtkButton *button, YGPushButton *pThis)
+ { gtk_widget_grab_default (GTK_WIDGET (button)); }
+
+ static void clicked_cb (GtkButton *button, YGPushButton *pThis)
+ { pThis->emitEvent (YEvent::Activated, false); }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createPushButton (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label)
+{
+ return new YGPushButton (opt, YGWidget::get (parent), label);
+}
+
Added: trunk/gtk/10_3/src/YGRadioButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGRadioButton.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGRadioButton.cc (added)
+++ trunk/gtk/10_3/src/YGRadioButton.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,243 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YEvent.h"
+#include "YGUtils.h"
+#include "YGWidget.h"
+
+// Sub-class GtkRadioButton to get a widget that renders like
+// a radio-button, but behaves like a check/toggle-button.
+static GType getCheckRadioButtonType()
+{
+ static GType type = 0;
+
+ if (type)
+ return type;
+
+ static const GTypeInfo info = {
+ sizeof (GtkRadioButtonClass), NULL, NULL,
+ NULL, NULL, NULL,
+ sizeof (GtkRadioButton), 0, NULL
+ };
+ type = g_type_register_static (GTK_TYPE_RADIO_BUTTON, "YGRadioButton",
+ &info, GTypeFlags(0));
+ // save a class_init function
+ GtkButtonClass *klass_new = GTK_BUTTON_CLASS (g_type_class_ref (type));
+ GtkButtonClass *klass_sane =
+ GTK_BUTTON_CLASS (g_type_class_ref (GTK_TYPE_TOGGLE_BUTTON));
+ klass_new->clicked = klass_sane->clicked;
+ return type;
+}
+
+#include "YRadioButtonGroup.h"
+#include "YRadioButton.h"
+
+class YGRadioButton : public YRadioButton, public YGWidget
+{
+ bool m_isBold;
+
+public:
+
+ YGRadioButton (const YWidgetOpt &opt,
+ YGWidget *parent,
+ YCPString label,
+ YRadioButtonGroup *rbg,
+ bool checked)
+ : YRadioButton (opt, label, rbg),
+ YGWidget (this, parent, true, getCheckRadioButtonType(), NULL)
+ {
+ IMPL
+ setBorder (0);
+ setValue (YCPBoolean (checked));
+
+ m_isBold = opt.boldFont.value();
+ gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE);
+ setLabel (label);
+
+ g_signal_connect (G_OBJECT (getWidget()), "toggled",
+ G_CALLBACK (toggled_cb), this);
+ }
+
+ // YRadioButton
+ virtual void setLabel (const YCPString &text)
+ {
+ // NOTE: we can't just set a gtk_widget_modify() at the initialization
+ // because each gtk_button_set_label() creates a new label
+ IMPL
+ string str = YGUtils::mapKBAccel(text->value_cstr());
+ if (m_isBold)
+ str = "<b>" + str + "</b>";
+ gtk_button_set_label (GTK_BUTTON (getWidget()), str.c_str());
+ YRadioButton::setLabel (text);
+
+ GtkWidget *label = gtk_bin_get_child (GTK_BIN (getWidget()));
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ }
+
+ virtual void setValue (const YCPBoolean &checked)
+ {
+ IMPL
+ g_signal_handlers_block_by_func (getWidget(), (gpointer) toggled_cb, this);
+
+ if (checked->value())
+ buttonGroup()->uncheckOtherButtons (this);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (getWidget()),
+ checked->value());
+
+ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) toggled_cb, this);
+ }
+
+ virtual YCPBoolean getValue()
+ {
+ IMPL
+ return YCPBoolean (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (getWidget())));
+ }
+
+ // YWidget
+ YGWIDGET_IMPL_COMMON
+
+ // callbacks
+ static void toggled_cb (GtkButton *button, YGRadioButton *pThis)
+ {
+ IMPL
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
+ pThis->buttonGroup()->uncheckOtherButtons (pThis);
+ else {
+ g_signal_handlers_block_by_func (button, (gpointer) toggled_cb, pThis);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+ g_signal_handlers_unblock_by_func (button, (gpointer) toggled_cb, pThis);
+ }
+
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+};
+
+YWidget *
+YGUI::createRadioButton (YWidget *parent, YWidgetOpt &opt,
+ YRadioButtonGroup *rbg, const YCPString &label,
+ bool checked)
+{
+ IMPL;
+ return new YGRadioButton (opt, YGWidget::get (parent), label, rbg, checked);
+}
+
+// YRadioButtonGroup
+
+class YGRadioButtonGroup : public YRadioButtonGroup, public YGWidget
+{
+public:
+ YGRadioButtonGroup(const YWidgetOpt &opt,
+ YGWidget *parent)
+ : YRadioButtonGroup (opt),
+ YGWidget (this, parent, true, GTK_TYPE_EVENT_BOX, NULL)
+ { }
+
+ YGWIDGET_IMPL_COMMON
+ YGWIDGET_IMPL_CHILD_ADDED (m_widget)
+ YGWIDGET_IMPL_CHILD_REMOVED (m_widget)
+};
+
+YContainerWidget *
+YGUI::createRadioButtonGroup (YWidget *parent, YWidgetOpt &opt)
+{
+ IMPL;
+ return new YGRadioButtonGroup (opt, YGWidget::get (parent));
+}
+
+#include "YCheckBox.h"
+
+class YGCheckBox : public YCheckBox, public YGWidget
+{
+ bool m_isBold;
+
+public:
+ YGCheckBox(const YWidgetOpt &opt,
+ YGWidget *parent,
+ const YCPString &label_str,
+ bool checked)
+ : YCheckBox (opt, label_str),
+ YGWidget (this, parent, true, GTK_TYPE_CHECK_BUTTON, NULL)
+ {
+ IMPL
+ setBorder (0);
+ m_isBold = opt.boldFont.value();
+
+ gtk_button_set_use_underline (GTK_BUTTON (getWidget()), TRUE);
+ setLabel (label_str);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (getWidget()), checked);
+
+ g_signal_connect (G_OBJECT (getWidget ()), "toggled",
+ G_CALLBACK (toggled_cb), this);
+ }
+
+ // YCheckButton
+ virtual void setLabel (const YCPString &text)
+ {
+ IMPL
+ string str = YGUtils::mapKBAccel(text->value_cstr());
+ if (m_isBold)
+ str = "<b>" + str + "</b>";
+ gtk_button_set_label (GTK_BUTTON (getWidget()), str.c_str());
+ YCheckBox::setLabel (text);
+
+ GtkWidget *label = gtk_bin_get_child (GTK_BIN (getWidget()));
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ }
+
+ virtual void setValue (const YCPValue &val)
+ {
+ IMPL;
+ GtkToggleButton *button = GTK_TOGGLE_BUTTON (getWidget());
+
+ g_signal_handlers_block_by_func (getWidget(), (gpointer) toggled_cb, this);
+
+ if (val->isBoolean()) {
+ gtk_toggle_button_set_inconsistent (button, FALSE);
+ gtk_toggle_button_set_active (button, val->asBoolean()->value());
+ }
+ else
+ gtk_toggle_button_set_inconsistent (button, TRUE);
+
+ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) toggled_cb, this);
+ }
+
+ virtual YCPValue getValue()
+ {
+ IMPL;
+
+ GtkToggleButton *button = GTK_TOGGLE_BUTTON (getWidget());
+
+ if (gtk_toggle_button_get_inconsistent (button))
+ return YCPVoid();
+ else
+ return YCPBoolean (gtk_toggle_button_get_active (button));
+ }
+
+ static void toggled_cb (GtkBox *box, YGCheckBox *pThis)
+ {
+ IMPL
+ GtkToggleButton *button = GTK_TOGGLE_BUTTON (box);
+ if (gtk_toggle_button_get_inconsistent (button)) {
+ gtk_toggle_button_set_inconsistent (button, false);
+ pThis->setValue (YCPBoolean (true));
+ }
+
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createCheckBox (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label,
+ bool checked)
+{
+ IMPL;
+ return new YGCheckBox (opt, YGWidget::get (parent), label, checked);
+}
Added: trunk/gtk/10_3/src/YGTable.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGTable.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGTable.cc (added)
+++ trunk/gtk/10_3/src/YGTable.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,523 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGUtils.h"
+#include "YGWidget.h"
+
+/* A generic widget for table related widgets. */
+class YGTableView : public YGScrolledWidget
+{
+protected:
+ int m_colsNb;
+
+public:
+ YGTableView (YWidget *y_widget, YGWidget *parent,
+ const YWidgetOpt &opt, YCPString label)
+ : YGScrolledWidget (y_widget, parent, label, YD_VERT, true,
+ GTK_TYPE_TREE_VIEW, NULL)
+ {
+ IMPL
+ m_colsNb = 0;
+
+ /* Yast tools expect the user to be unable to un-select the row. They
+ generally don't check to see if the returned value is -1. So, just
+ disallow un-selection. */
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (getWidget())), GTK_SELECTION_BROWSE);
+
+ // let the derivates do the event hooks. They have subtile differences.
+ }
+
+ void initModel (const vector <GType> &types, bool show_headers)
+ {
+ IMPL
+ // turn vector into an array; last column dedicated to the row id
+ m_colsNb = types.size();
+ GType types_array [m_colsNb+1];
+ for (unsigned int i = 0; i < types.size(); i++)
+ types_array [i] = types[i];
+ types_array[m_colsNb] = G_TYPE_INT;
+
+ GtkListStore *list = gtk_list_store_newv (m_colsNb+1, types_array);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (getWidget()), GTK_TREE_MODEL (list));
+ g_object_unref (G_OBJECT (list));
+
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (getWidget()), show_headers);
+ }
+
+ void insertColumn (int col_nb, string header, GType type)
+ {
+ IMPL
+ GtkTreeViewColumn *column = 0;
+
+ // The allignment of the column items
+ gfloat xalign = 0.0;
+ if (header.length()) {
+ if (header[0] == 'R')
+ xalign = 1.0;
+ else if (header[0] == 'C')
+ xalign = 0.5;
+ // else if (header[0] == 'L')
+ header = header.substr(1);
+ }
+
+ if (type == G_TYPE_STRING) {
+ GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
+ g_object_set (renderer, "xalign", xalign, NULL);
+ // set the last column, the expandable one, as wrapable
+ if (col_nb == m_colsNb-1 && col_nb >= 3)
+ g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ column = gtk_tree_view_column_new_with_attributes (header.c_str(),
+ renderer, "text", col_nb, NULL);
+ }
+ else if (type == G_TYPE_BOOLEAN) { // toggle button
+ GtkCellRenderer *renderer = gtk_cell_renderer_toggle_new();
+ g_object_set_data (G_OBJECT (renderer), "column", GINT_TO_POINTER (col_nb));
+ g_object_set (renderer, "xalign", xalign, NULL);
+ column = gtk_tree_view_column_new_with_attributes (header.c_str(),
+ renderer, "active", col_nb, NULL);
+
+ g_signal_connect (G_OBJECT (renderer), "toggled",
+ G_CALLBACK (toggled_cb), this);
+ }
+ else if (type == GDK_TYPE_PIXBUF) {
+ GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
+ g_object_set (renderer, "xalign", xalign, NULL);
+ column = gtk_tree_view_column_new_with_attributes (header.c_str(),
+ renderer, "pixbuf", col_nb, NULL);
+ }
+ else
+ g_error ("YGTable: no support for column of given type");
+
+ gtk_tree_view_column_set_resizable (column, TRUE);
+ gtk_tree_view_insert_column (GTK_TREE_VIEW (getWidget()), column, col_nb);
+ }
+
+ void setSearchCol (int col)
+ {
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (getWidget()), col);
+ }
+
+protected:
+ inline GtkListStore *getStore()
+ { return GTK_LIST_STORE (getModel()); }
+ inline GtkTreeModel *getModel()
+ { return gtk_tree_view_get_model (GTK_TREE_VIEW (getWidget())); }
+
+protected:
+ /* NOTE: gtk_list_store_insert() doesn't necessarly put the row in the
+ requested position. For instance, if the number of rows is smaller than
+ the one requested, it just appends it. So, we must translate YCP rows
+ numbering to the ones we set. We'll call YCP rows as ids.
+ Besides, if we do sorting, paths will get changed. */
+
+ bool getRowOf (GtkTreeIter *iter, int id) {
+ if (!gtk_tree_model_get_iter_first (getModel(), iter))
+ return false;
+
+ int _id = -1;
+ do {
+ gtk_tree_model_get (getModel(), iter, m_colsNb, &_id, -1);
+ if (_id == id)
+ return true;
+ } while (gtk_tree_model_iter_next (getModel(), iter));
+ return false;
+ }
+
+ int getIdOf (int row) {
+ GtkTreeIter iter;
+ if (!gtk_tree_model_iter_nth_child (getModel(), &iter, NULL, row))
+ return -1;
+
+ int id;
+ gtk_tree_model_get (getModel(), &iter, m_colsNb, &id, -1);
+ return id;
+ }
+
+ void addRow (int id)
+ {
+ IMPL
+ GtkTreeIter iter;
+ gtk_list_store_append (getStore(), &iter);
+ gtk_list_store_set (getStore(), &iter, m_colsNb, id, -1);
+ }
+
+ void setItemText (string text, int id, int col)
+ {
+ IMPL
+ GtkTreeIter iter;
+ if (getRowOf (&iter, id))
+ gtk_list_store_set (getStore(), &iter, col, text.c_str(), -1);
+ }
+
+ void setItemBool (gboolean state, int id, int col)
+ {
+ IMPL
+ GtkTreeIter iter;
+ if (getRowOf (&iter, id))
+ gtk_list_store_set (getStore(), &iter, col, state, -1);
+ }
+
+ void setItemIcon (string icon, int id, int col)
+ {
+ IMPL
+ GtkTreeIter iter;
+ if (getRowOf (&iter, id)) {
+ GdkPixbuf *pixbuf;
+ if (icon[0] != '/')
+ icon = ICON_DIR + icon;
+
+ GError *error = 0;
+ pixbuf = gdk_pixbuf_new_from_file (icon.c_str(), &error);
+ if (!pixbuf)
+ y2warning ("YGTable: Could not load icon: %s.\n"
+ "Because %s", icon.c_str(), error->message);
+
+ gtk_list_store_set (getStore(), &iter, col, pixbuf, -1);
+ }
+ }
+
+ void deleteRows()
+ {
+ IMPL
+ blockEvents();
+ gtk_list_store_clear (getStore());
+ unblockEvents();
+ }
+
+ int getCurrentRow()
+ {
+ IMPL
+ GtkTreePath *path;
+ gtk_tree_view_get_cursor (GTK_TREE_VIEW(getWidget()), &path, NULL);
+ if (path == NULL)
+ return -1;
+
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter (getModel(), &iter, path);
+ gtk_tree_path_free (path);
+
+ int id;
+ gtk_tree_model_get (getModel(), &iter, m_colsNb, &id, -1);
+ return id;
+ }
+
+ void setCurrentRow (int id)
+ {
+ IMPL
+ blockEvents();
+ GtkTreeIter iter;
+ if (getRowOf (&iter, id)) {
+ GtkTreePath *path = gtk_tree_model_get_path (getModel(), &iter);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (getWidget()), path, NULL, false);
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (getWidget()), path, NULL,
+ TRUE, 0.5, 0.5);
+ gtk_tree_path_free (path);
+ }
+ unblockEvents();
+ }
+
+ void blockEvents()
+ {
+ g_signal_handlers_block_by_func (getWidget(), (gpointer) selected_cb, this);
+ g_signal_handlers_block_by_func (getWidget(), (gpointer) selected_delayed_cb, this);
+ }
+ void unblockEvents()
+ {
+ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) selected_cb, this);
+ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) selected_delayed_cb, this);
+ }
+
+ // toggled by user (through clicking on the renderer or some other action)
+ void toggle (GtkTreePath *path, gint column)
+ {
+ IMPL
+ GtkTreeIter iter;
+ if (!gtk_tree_model_get_iter (getModel(), &iter, path))
+ return;
+ gboolean state;
+
+ gtk_tree_model_get (getModel(), &iter, column, &state, -1);
+ gtk_list_store_set (getStore(), &iter, column, !state, -1);
+
+ emitEvent (YEvent::ValueChanged);
+ }
+
+ static void selected_cb (GtkTreeView *tree_view, YGTableView* pThis)
+ {
+ IMPL
+ pThis->emitEvent (YEvent::SelectionChanged);
+ }
+
+ static void selected_delayed_cb (GtkTreeView *tree_view, YGTableView* pThis)
+ {
+ IMPL
+ pThis->emitEvent (YEvent::SelectionChanged, true, true, false);
+ }
+
+ static void activated_cb (GtkTreeView *tree_view, GtkTreePath *path,
+ GtkTreeViewColumn *column, YGTableView* pThis)
+ {
+ IMPL
+ pThis->emitEvent (YEvent::Activated);
+ }
+
+ static void toggled_cb (GtkCellRendererToggle *renderer, gchar *path_str,
+ YGTableView *pThis)
+ {
+ IMPL
+ GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
+ gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (renderer), "column"));
+ pThis->toggle (path, column);
+ gtk_tree_path_free (path);
+ }
+};
+
+#include "YTable.h"
+
+class YGTable : public YTable, public YGTableView
+{
+public:
+ YGTable (const YWidgetOpt &opt, YGWidget *parent,
+ vector <string> headers)
+ : YTable (opt, headers.size()),
+ YGTableView (this, parent, opt, YCPString(""))
+ {
+ IMPL
+ vector <GType> types;
+ types.assign (numCols(), G_TYPE_STRING);
+ initModel (types, true);
+ for (int i = 0; i < numCols(); i++)
+ insertColumn (i, headers[i], types[i]);
+
+ setLabelVisible (false);
+
+ if (!opt.keepSorting.value())
+ YGUtils::tree_view_set_sortable (GTK_TREE_VIEW (getWidget()), 0);
+ if (numCols() >= 3)
+ gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (getWidget()), TRUE);
+
+ g_signal_connect (G_OBJECT (getWidget()), "row-activated",
+ G_CALLBACK (activated_cb), (YGTableView*) this);
+ if (opt.immediateMode.value())
+ g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
+ G_CALLBACK (selected_cb), (YGTableView*) this);
+ }
+
+ virtual void itemAdded (vector<string> elements, int index)
+ {
+ IMPL
+ addRow (index);
+ for (unsigned int c = 0; c < elements.size(); c++)
+ setItemText (elements[c], index, c);
+
+ // always have one row selected
+ if (getCurrentRow() == -1)
+ setCurrentRow (index);
+ }
+
+ virtual void itemsCleared()
+ { IMPL; deleteRows(); }
+
+ virtual void cellChanged (int index, int colnum, const YCPString& text)
+ { IMPL; setItemText (text->value(), index, colnum); }
+
+ virtual int getCurrentItem()
+ { IMPL; return getCurrentRow(); }
+
+ virtual void setCurrentItem (int index)
+ { IMPL; setCurrentRow (index); }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createTable (YWidget *parent, YWidgetOpt & opt,
+ vector<string> headers)
+{
+ return new YGTable (opt, YGWidget::get (parent), headers);
+}
+
+#include "YSelectionBox.h"
+
+class YGSelectionBox : public YSelectionBox, public YGTableView
+{
+public:
+ YGSelectionBox (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString &label)
+ : YSelectionBox (opt, label),
+ YGTableView (this, parent, opt, label)
+ {
+ /* we'll have to wait for 09 to get nicer to construct vectors :P */
+ vector <GType> types;
+ types.push_back (GDK_TYPE_PIXBUF);
+ types.push_back (G_TYPE_STRING);
+ initModel (types, false);
+
+ insertColumn (1, "", G_TYPE_STRING);
+ setSearchCol (1);
+ // pixbuf column will be added later, if needed
+
+ g_signal_connect (G_OBJECT (getWidget()), "row-activated",
+ G_CALLBACK (activated_cb), (YGTableView*) this);
+ if (opt.immediateMode.value())
+ g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
+ G_CALLBACK (selected_cb), (YGTableView*) this);
+ else
+ g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
+ G_CALLBACK (selected_delayed_cb), (YGTableView*) this);
+ }
+
+ // YSelectionBox
+ virtual int getCurrentItem()
+ { IMPL; return getCurrentRow(); }
+
+ virtual void setCurrentItem (int index)
+ { IMPL; setCurrentRow (index); }
+
+ // YSelectionWidget
+ virtual void itemAdded (const YCPString &str, int index, bool selected)
+ {
+ IMPL
+ addRow (index);
+
+ if (hasIcons()) {
+ if (m_colsNb == 1) // make space for pixbufs
+ insertColumn (0, "", GDK_TYPE_PIXBUF);
+ setItemIcon (itemIcon (index)->value(), index, 0);
+ }
+ setItemText (str->value(), index, 1);
+
+ if (selected)
+ setCurrentRow (index);
+ }
+
+ virtual void deleteAllItems()
+ { IMPL; deleteRows(); }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createSelectionBox (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label)
+{
+ IMPL
+ return new YGSelectionBox (opt, YGWidget::get (parent), label);
+}
+
+#include "YMultiSelectionBox.h"
+
+class YGMultiSelectionBox : public YMultiSelectionBox, public YGTableView
+{
+public:
+ YGMultiSelectionBox (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString &label)
+ : YMultiSelectionBox (opt, label),
+ YGTableView (this, parent, opt, label)
+ {
+ vector <GType> types;
+ types.push_back (G_TYPE_BOOLEAN);
+ types.push_back (GDK_TYPE_PIXBUF);
+ types.push_back (G_TYPE_STRING);
+ initModel (types, false);
+
+ insertColumn (0, "", G_TYPE_BOOLEAN);
+ insertColumn (2, "", G_TYPE_STRING);
+ setSearchCol (2);
+ // pixbuf column will be added later, if needed
+
+ g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
+ G_CALLBACK (selected_cb), (YGTableView*) this);
+ // Let the user toggle, using space/enter or double click (not an event).
+ g_signal_connect_after (G_OBJECT (getWidget()), "row-activated",
+ G_CALLBACK (multi_activated_cb), this);
+ }
+
+ // YMultiSelectionBox
+ virtual int getCurrentItem()
+ { IMPL; return getCurrentRow(); }
+
+ virtual void setCurrentItem (int index)
+ { IMPL; setCurrentRow (index); }
+
+ // YSelectionWidget
+ virtual void itemAdded (const YCPString &str, int index, bool selected)
+ {
+ IMPL
+ addRow (index);
+
+ if (hasIcons()) {
+ if (m_colsNb == 2) // make space for pixbufs
+ insertColumn (1, "", GDK_TYPE_PIXBUF);
+ setItemIcon (itemIcon (index)->value(), index, 1);
+ }
+ setItemBool (selected, index, 0);
+ setItemText (str->value(), index, 2);
+ }
+
+ virtual void deleteAllItems()
+ { IMPL; deleteRows(); }
+
+ // Toggle related methods follow
+ /* Returns the state of the toggle at the row "index".
+ Pass -1 for query only. 0 and 1 to set it false or true. */
+ bool itemSelected (int id, int state)
+ {
+ IMPL
+ GtkTreeIter iter;
+ if (!getRowOf (&iter, id))
+ throw "Row doesn't exist";
+
+ if (state != -1)
+ gtk_list_store_set (getStore(), &iter, 0, state, -1);
+ gtk_tree_model_get (getModel(), &iter, 0, &state, -1);
+ return state;
+ }
+
+ virtual bool itemIsSelected (int index)
+ {
+ IMPL
+ bool state = 0;
+ try { state = itemSelected (index, -1); }
+ catch (char *str) { y2error ("%s - itemIsSelected(%d): %s - ignoring",
+ YMultiSelectionBox::widgetClass(), index, str); }
+ return state;
+ }
+
+ virtual void selectItem (int index)
+ {
+ IMPL
+ try { itemSelected (index, 1); }
+ catch (char *str) { y2error ("%s - selectItem(%d): %s - ignoring",
+ YMultiSelectionBox::widgetClass(), index, str); }
+ }
+
+ virtual void deselectAllItems()
+ {
+ for (int i = 0; ; i++)
+ try { itemSelected (i, false); }
+ catch (...) { break; }
+ }
+
+ static void multi_activated_cb (GtkTreeView *tree_view, GtkTreePath *path,
+ GtkTreeViewColumn *column, YGMultiSelectionBox* pThis)
+ {
+ IMPL
+ pThis->toggle (path, 0);
+ }
+
+ YGWIDGET_IMPL_COMMON
+};
+
+YWidget *
+YGUI::createMultiSelectionBox (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label)
+{
+ IMPL
+ return new YGMultiSelectionBox (opt, YGWidget::get (parent), label);
+}
Added: trunk/gtk/10_3/src/YGTextEntry.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGTextEntry.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGTextEntry.cc (added)
+++ trunk/gtk/10_3/src/YGTextEntry.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,74 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YTextEntry.h"
+#include "YGWidget.h"
+#include "ygtkfieldentry.h"
+
+class YGTextEntry : public YTextEntry, public YGLabeledWidget
+{
+public:
+ YGTextEntry (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString &label, const YCPString &text)
+ : YTextEntry (opt, label),
+ YGLabeledWidget (this, parent, label, YD_HORIZ, true,
+ YGTK_TYPE_FILTER_ENTRY, NULL)
+ {
+ gtk_entry_set_activates_default (GTK_ENTRY (getWidget()), TRUE);
+ setText (text);
+
+ if (opt.passwordMode.value())
+ gtk_entry_set_visibility (GTK_ENTRY (getWidget()), FALSE);
+
+ // Signals to know of any text modification
+ g_signal_connect (G_OBJECT (getWidget()), "changed",
+ G_CALLBACK (text_changed_cb), this);
+ }
+
+ virtual ~YGTextEntry() {}
+
+ // YTextEntry
+ virtual YCPString getText()
+ {
+ return YCPString (gtk_entry_get_text (GTK_ENTRY (getWidget())));
+ }
+
+ virtual void setText (const YCPString &text)
+ {
+ /* No need to check for valid chars as that's the responsible of the YCP
+ application programmer. */
+ gtk_entry_set_text (GTK_ENTRY (getWidget()), text->value_cstr());
+ }
+
+ virtual void setInputMaxLength (const YCPInteger &numberOfChars)
+ {
+ gtk_entry_set_width_chars (GTK_ENTRY (getWidget()),
+ numberOfChars->asInteger()->value());
+ }
+
+ virtual void setValidChars (const YCPString &validChars)
+ {
+ ygtk_filter_entry_set_valid_chars (YGTK_FILTER_ENTRY (getWidget()),
+ validChars->value_cstr());
+ YTextEntry::setValidChars (validChars);
+ }
+
+ static void text_changed_cb (GtkEditable *editable, YGTextEntry *pThis)
+ {
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YTextEntry)
+};
+
+YWidget *
+YGUI::createTextEntry (YWidget *parent, YWidgetOpt & opt,
+ const YCPString & label, const YCPString & text)
+{
+ return new YGTextEntry (opt, YGWidget::get (parent), label, text);
+}
Added: trunk/gtk/10_3/src/YGTime.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGTime.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGTime.cc (added)
+++ trunk/gtk/10_3/src/YGTime.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,229 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGWidget.h"
+#include "ygtkfieldentry.h"
+
+#include "YTime.h"
+
+class YGTime : public YTime, public YGLabeledWidget
+{
+public:
+ YGTime (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString &label, const YCPString &time)
+ : YTime (opt, label),
+ YGLabeledWidget (this, parent, label, YD_HORIZ, true,
+ YGTK_TYPE_FIELD_ENTRY, NULL)
+ {
+ IMPL
+ ygtk_field_entry_add_field (YGTK_FIELD_ENTRY (getWidget()), ':',
+ 2, "0123456789");
+ ygtk_field_entry_add_field (YGTK_FIELD_ENTRY (getWidget()), ':',
+ 2, "0123456789");
+ setNewTime (time);
+
+ gtk_widget_show_all (getWidget());
+ g_signal_connect (G_OBJECT (getWidget()), "field-entry-changed",
+ G_CALLBACK (value_changed_cb), this);
+ }
+
+ virtual ~YGTime() {}
+
+ // YTime
+ virtual void setNewTime (const YCPString &time)
+ {
+ IMPL
+ char hours[3], mins[3];
+ sscanf (time->value_cstr(), "%2s:%2s", hours, mins);
+
+ YGtkFieldEntry *entry = YGTK_FIELD_ENTRY (getWidget());
+ ygtk_field_entry_set_field_text (entry, 0, hours);
+ ygtk_field_entry_set_field_text (entry, 1, mins);
+ }
+
+ virtual YCPString getTime()
+ {
+ IMPL
+ const gchar *hours, *mins;
+ YGtkFieldEntry *entry = YGTK_FIELD_ENTRY (getWidget());
+ hours = ygtk_field_entry_get_field_text (entry, 0);
+ mins = ygtk_field_entry_get_field_text (entry, 1);
+
+ gchar *time = g_strdup_printf ("%02d:%02d:00", atoi (hours), atoi (mins));
+ YCPString str = YCPString (time);
+ g_free (time);
+ return str;
+ }
+
+ // callbacks
+ static void value_changed_cb (YGtkFieldEntry *entry, gint field_nb,
+ YGTime *pThis)
+ { IMPL; pThis->emitEvent (YEvent::ValueChanged); }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YTime)
+};
+
+YWidget *
+YGUI::createTime (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, const YCPString &time)
+{
+ IMPL
+ return new YGTime (opt, YGWidget::get (parent), label, time);
+}
+
+#include "YDate.h"
+#include "ygtkmenubutton.h"
+
+class YGDate : public YDate, public YGLabeledWidget
+{
+ GtkWidget *m_entry, *m_calendar, *m_popup_calendar;
+
+public:
+ YGDate (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPString &label, const YCPString &date)
+ : YDate (opt, label),
+ YGLabeledWidget (this, parent, label, YD_HORIZ, true, GTK_TYPE_HBOX, NULL)
+ {
+ IMPL
+ m_entry = ygtk_field_entry_new();
+ ygtk_field_entry_add_field (YGTK_FIELD_ENTRY (m_entry), '-', 4, "0123456789");
+ ygtk_field_entry_add_field (YGTK_FIELD_ENTRY (m_entry), '-', 2, "0123456789");
+ ygtk_field_entry_add_field (YGTK_FIELD_ENTRY (m_entry), '-', 2, "0123456789");
+
+ GtkWidget *menu_button = ygtk_menu_button_new();
+ m_calendar = gtk_calendar_new();
+ gtk_widget_show (m_calendar);
+ GtkWidget *popup = ygtk_popup_window_new (m_calendar);
+ ygtk_menu_button_set_popup (YGTK_MENU_BUTTON (menu_button), popup);
+
+ gtk_box_pack_start (GTK_BOX (getWidget()), m_entry, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (getWidget()), menu_button, FALSE, TRUE, 6);
+ gtk_widget_show_all (getWidget());
+
+ setNewDate (date);
+ g_signal_connect (G_OBJECT (m_entry), "field-entry-changed",
+ G_CALLBACK (value_changed_cb), this);
+
+ g_signal_connect (G_OBJECT (m_calendar), "day-selected",
+ G_CALLBACK (calendar_changed_cb), this);
+ g_signal_connect (G_OBJECT (m_calendar), "day-selected-double-click",
+ G_CALLBACK (double_click_cb), popup);
+ }
+
+ virtual ~YGDate() {}
+
+ GtkCalendar *getCalendar()
+ { return GTK_CALENDAR (m_calendar); }
+
+ YGtkFieldEntry *getEntry()
+ { return YGTK_FIELD_ENTRY (m_entry); }
+
+ // YDate
+ virtual void setNewDate (const YCPString &date)
+ {
+ IMPL
+ char year[5], month[3], day[3];
+ sscanf (date->value_cstr(), "%4s-%2s-%2s", year, month, day);
+
+ gtk_calendar_select_month (getCalendar(), atoi (month)-1, atoi (year));
+ gtk_calendar_select_day (getCalendar(), atoi (day));
+
+ YGtkFieldEntry *entry = getEntry();
+ ygtk_field_entry_set_field_text (entry, 0, year);
+ ygtk_field_entry_set_field_text (entry, 1, month);
+ ygtk_field_entry_set_field_text (entry, 2, day);
+ }
+
+ virtual YCPString getDate()
+ {
+ IMPL
+ const gchar *year, *month, *day;
+ YGtkFieldEntry *entry = getEntry();
+ year = ygtk_field_entry_get_field_text (entry, 0);
+ month = ygtk_field_entry_get_field_text (entry, 1);
+ day = ygtk_field_entry_get_field_text (entry, 2);
+
+ gchar *time = g_strdup_printf ("%04d-%02d-%02d", atoi (year),
+ atoi (month), atoi (day));
+ YCPString str = YCPString (time);
+ g_free (time);
+ return str;
+ }
+
+ // callbacks
+ static void value_changed_cb (YGtkFieldEntry *entry, gint field_nb,
+ YGDate *pThis)
+ {
+ IMPL
+ int year, month, day;
+ year = atoi (ygtk_field_entry_get_field_text (pThis->getEntry(), 0));
+ month = atoi (ygtk_field_entry_get_field_text (pThis->getEntry(), 1));
+ day = atoi (ygtk_field_entry_get_field_text (pThis->getEntry(), 2));
+
+ if (day < 1 || day > 31 || month < 1 || month > 12)
+ return; // avoid GtkCalendar warnings
+
+ g_signal_handlers_block_by_func (pThis->getCalendar(),
+ (gpointer) calendar_changed_cb, pThis);
+
+ gtk_calendar_select_month (pThis->getCalendar(), month-1, year);
+ gtk_calendar_select_day (pThis->getCalendar(), day);
+
+ g_signal_handlers_unblock_by_func (pThis->getCalendar(),
+ (gpointer) calendar_changed_cb, pThis);
+
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ static void calendar_changed_cb (GtkCalendar *calendar, YGDate *pThis)
+ {
+ IMPL
+ guint year, month, day;
+ gtk_calendar_get_date (calendar, &year, &month, &day);
+ month += 1; // GTK calendar months go from 0 to 11
+
+ gchar *year_str, *month_str, *day_str;
+ year_str = g_strdup_printf ("%d", year);
+ month_str = g_strdup_printf ("%d", month);
+ day_str = g_strdup_printf ("%d", day);
+
+ g_signal_handlers_block_by_func (pThis->getEntry(),
+ (gpointer) value_changed_cb, pThis);
+
+ YGtkFieldEntry *entry = pThis->getEntry();
+ ygtk_field_entry_set_field_text (entry, 0, year_str);
+ ygtk_field_entry_set_field_text (entry, 1, month_str);
+ ygtk_field_entry_set_field_text (entry, 2, day_str);
+
+ g_signal_handlers_unblock_by_func (pThis->getEntry(),
+ (gpointer) value_changed_cb, pThis);
+
+ g_free (year_str);
+ g_free (month_str);
+ g_free (day_str);
+
+ pThis->emitEvent (YEvent::ValueChanged);
+ }
+
+ static void double_click_cb (GtkCalendar *calendar, YGtkPopupWindow *popup)
+ {
+ // close popup
+ gtk_widget_hide (GTK_WIDGET (popup));
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(YDate)
+};
+
+YWidget *
+YGUI::createDate (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, const YCPString &date)
+{
+ IMPL
+ return new YGDate (opt, YGWidget::get (parent), label, date);
+}
Added: trunk/gtk/10_3/src/YGTree.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGTree.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGTree.cc (added)
+++ trunk/gtk/10_3/src/YGTree.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,156 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YEvent.h"
+#include "YTree.h"
+#include "YGUtils.h"
+#include "YGWidget.h"
+
+class YGTree : public YTree, public YGScrolledWidget
+{
+public:
+ YGTree (const YWidgetOpt &opt, YGWidget *parent, YCPString label)
+ : YTree (opt, label)
+ , YGScrolledWidget (this, parent, label, YD_VERT, true,
+ GTK_TYPE_TREE_VIEW, NULL)
+ {
+ GtkTreeStore *tree = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
+ gtk_tree_view_set_model(GTK_TREE_VIEW(getWidget()), GTK_TREE_MODEL(tree));
+ g_object_unref (G_OBJECT (tree));
+
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (getWidget()),
+ 0, "", gtk_cell_renderer_text_new(), "text", 0, NULL);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (getWidget()), FALSE);
+
+ // Events
+ if (opt.notifyMode.value()) {
+ g_signal_connect (G_OBJECT (getWidget()), "row-activated",
+ G_CALLBACK (activated_cb), this);
+ g_signal_connect (G_OBJECT (getWidget()), "cursor-changed",
+ G_CALLBACK (selected_cb), this);
+ }
+ else
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (getWidget())), GTK_SELECTION_NONE);
+ }
+
+ virtual ~YGTree() { }
+
+ inline GtkTreeModel *getModel()
+ { return gtk_tree_view_get_model (GTK_TREE_VIEW (getWidget())); }
+ inline GtkTreeStore *getStore()
+ { return GTK_TREE_STORE (getModel()); }
+
+ // YTree
+ void addItems (const YTreeItemList &items, GtkTreeIter *parent)
+ {
+ GtkTreeIter iter;
+ for (unsigned int i = 0; i < items.size(); i++) {
+ gtk_tree_store_append (getStore(), &iter, parent);
+ gtk_tree_store_set (getStore(), &iter, 0,
+ items[i]->getText()->value_cstr(), 1, items[i], -1);
+
+ // store pointer to GtkTreePath for use in setCurrentItem()
+ { // need to create a path cause iterator would only return the path as a string
+ GtkTreePath* path = gtk_tree_model_get_path (getModel(), &iter);
+ // get current index...
+ gint depth = gtk_tree_path_get_depth (path);
+ gint *index = gtk_tree_path_get_indices (path) + depth - 1;
+ items[i]->setData (GINT_TO_POINTER (*index));
+ gtk_tree_path_free (path);
+ }
+
+ if (parent && items[i]->parent()->isOpenByDefault()) {
+ GtkTreePath *path = gtk_tree_model_get_path (getModel(), &iter);
+ gtk_tree_view_expand_to_path (GTK_TREE_VIEW (getWidget()), path);
+ gtk_tree_path_free(path);
+ }
+
+ addItems (items[i]->itemList(), &iter);
+ }
+ }
+
+ virtual void rebuildTree()
+ {
+ gtk_tree_store_clear (getStore());
+ addItems (items, NULL);
+ }
+
+protected:
+ virtual const YTreeItem *getCurrentItem() const
+ {
+ GtkTreePath *path;
+ GtkTreeViewColumn *column;
+ gtk_tree_view_get_cursor
+ (GTK_TREE_VIEW(const_cast(this)->getWidget()),
+ &path, &column);
+ if (path == NULL || column == NULL)
+ return NULL;
+
+ GtkTreeIter iter;
+ YTreeItem *item = 0;
+ gtk_tree_model_get_iter
+ (const_cast(this)->getModel(), &iter, path);
+ gtk_tree_model_get
+ (const_cast(this)->getModel(), &iter, 1, &item, -1);
+
+ return item;
+ }
+
+ /* Constructs a GtkTreePath to the item.
+ path argument must have been created and unset. */
+ void getItemPath (GtkTreePath *path, YTreeItem *item)
+ {
+ if (item == NULL)
+ return;
+ getItemPath (path, item->parent());
+ gtk_tree_path_append_index (path, GPOINTER_TO_INT (item->data()));
+ }
+
+ virtual void setCurrentItem (YTreeItem *item)
+ {
+ IMPL
+ GtkTreePath *path = gtk_tree_path_new();
+ getItemPath (path, item);
+
+ g_signal_handlers_block_by_func (getWidget(), (gpointer) selected_cb, this);
+ gtk_tree_view_expand_to_path (GTK_TREE_VIEW (getWidget()), path);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW(getWidget()), path, NULL, FALSE);
+ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) selected_cb, this);
+
+ gtk_tree_path_free (path);
+ }
+
+ virtual void deleteAllItems()
+ {
+ gtk_tree_store_clear (getStore());
+ YTree::deleteAllItems();
+ }
+
+ static void selected_cb (GtkTreeView *tree_view, YWidget* pThis)
+ {
+ if (pThis->getNotify() && !YGUI::ui()->eventPendingFor(pThis))
+ YGUI::ui()->sendEvent (new YWidgetEvent (pThis, YEvent::SelectionChanged));
+ }
+
+ static void activated_cb (GtkTreeView *tree_view, GtkTreePath *path,
+ GtkTreeViewColumn *column, YGTree* pThis)
+ {
+ if (pThis->getNotify())
+ YGUI::ui()->sendEvent (new YWidgetEvent (pThis, YEvent::Activated));
+ }
+
+ YGWIDGET_IMPL_COMMON
+ YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN (YTree)
+};
+
+YWidget *
+YGUI::createTree (YWidget *parent, YWidgetOpt & opt, const YCPString & label)
+{
+ return new YGTree (opt, YGWidget::get (parent), label);
+}
+
Added: trunk/gtk/10_3/src/YGUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGUI.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGUI.cc (added)
+++ trunk/gtk/10_3/src/YGUI.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,809 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include "YGUI.h"
+#include "YGUtils.h"
+#include "YGWidget.h"
+#include "YGDialog.h"
+#include
+#include
+#include
+
+#define DEFAULT_MACRO_FILE_NAME "macro.ycp"
+#define BUSY_CURSOR_TIMEOUT 250
+
+YGUI::YGUI (int argc, char ** argv,
+ bool with_threads,
+ const char *macro_file) :
+ YUI (with_threads),
+ busy_timeout (0),
+ m_done_init (false),
+ m_argc (0),
+ m_argv (NULL)
+{
+ IMPL
+ m_have_wm = true;
+ m_no_border = m_fullscreen = false;
+ m_default_size.width = m_default_size.height = 0;
+
+ m_argc = argc;
+ m_argv = g_new0 (char *, argc);
+ memcpy (m_argv, argv, sizeof (char *) * argc);
+ if (!with_threads)
+ checkInit();
+
+#ifdef IMPL_DEBUG
+ fprintf (stderr, "I'm initialized '%s' - come & get me !\n",
+ with_threads ? "with threads !" : "no threads");
+#endif
+
+ for (int i = 1; i < m_argc; i++)
+ {
+ const char *argp = m_argv[i];
+ if (!argp) continue;
+ if (argp[0] != '-') {
+ printf ("Warning: Unknown argument '%s'\n", argp);
+ continue;
+ }
+ argp++;
+ if (argp[0] == '-') argp++;
+
+ if (!strcmp (argp, "no-wm"))
+ m_have_wm = false;
+ else if (!strcmp (argp, "fullscreen"))
+ m_fullscreen = true;
+ else if (!strcmp (argp, "noborder"))
+ m_no_border = true;
+ else if (!strcmp (argp, "geometry")) {
+ argp = argv [++i];
+ if (i == argc)
+ printf ("Warning: no value passed to --geometry\n");
+ else if (sscanf (argp, "%dx%d", &m_default_size.width,
+ &m_default_size.height) == EOF) {
+ printf ("Warning: invalid --geometry value: %s\n", argp);
+ m_default_size.width = m_default_size.height = 0;
+ }
+ }
+ else if (!strcmp (argp, "help")) {
+ printf (
+ "Command line options for the YaST2 Gtk UI:\n"
+ "\n"
+ "--no-wm assume no window manager is running\n"
+ "--noborder no window manager border for main dialogs\n"
+ "--fullscreen use full screen for main dialogs\n"
+ "--geomtry WxH sets a default size of W per H to main dialogs\n"
+ "--nothreads run without additional UI threads\n"
+ "--help prints this help text\n"
+ "\n"
+ );
+ exit (0);
+ }
+ else
+ printf ("Warning: Unknown argument '--%s'\n", argp);
+ }
+
+ if (macro_file)
+ playMacro (macro_file);
+
+ // without this none of the (default) threading action works ...
+ topmostConstructorHasFinished();
+}
+
+YGUI::~YGUI()
+{
+ IMPL
+ g_free (m_argv);
+}
+
+static gboolean
+ycp_wakeup_fn (GIOChannel *source,
+ GIOCondition condition,
+ gpointer data)
+{
+ *(int *)data = TRUE;
+ return TRUE;
+}
+
+void YGUI::checkInit()
+{
+ if (!m_done_init) {
+ gtk_init (&m_argc, &m_argv);
+ m_done_init = TRUE;
+ }
+}
+
+void
+YGUI::idleLoop (int fd_ycp)
+{
+ IMPL
+ // The rational for this is that we need somewhere to run
+ // the magic 'main' thread, that can process thread unsafe
+ // incoming CORBA messages for us
+ checkInit();
+
+ GIOChannel *wakeup;
+ wakeup = g_io_channel_unix_new (fd_ycp);
+ g_io_channel_set_encoding (wakeup, NULL, NULL);
+ g_io_channel_set_buffered (wakeup, FALSE);
+
+ int woken = FALSE;
+ guint watch_tag = g_io_add_watch (wakeup, (GIOCondition)(G_IO_IN | G_IO_PRI),
+ ycp_wakeup_fn, &woken);
+ while (!woken)
+ g_main_context_iteration (NULL, TRUE);
+
+ g_source_remove (watch_tag);
+ g_io_channel_unref (wakeup);
+}
+
+static gboolean user_input_timeout_cb (YGUI *pThis)
+{
+ IMPL
+ if (!pThis->pendingEvent())
+ pThis->sendEvent (new YTimeoutEvent());
+ return FALSE;
+}
+
+void
+YGUI::sendEvent (YEvent *event)
+{
+ m_event_handler.sendEvent (event);
+ g_main_context_wakeup (NULL);
+}
+
+// utility that implements both userInput() and pollInput()
+YEvent *
+YGUI::waitInput (unsigned long timeout_ms, bool block)
+{
+ IMPL
+ if (!currentYGDialog())
+ return NULL;
+
+ if (block)
+ normalCursor(); // waiting for input, so no more busy
+
+ guint timeout = 0;
+ YEvent *event = NULL;
+
+ if (timeout_ms > 0)
+ timeout = g_timeout_add (timeout_ms,
+ (GSourceFunc) user_input_timeout_cb, this);
+
+ if (block)
+ {
+ while (!pendingEvent())
+ g_main_context_iteration (NULL, TRUE);
+ }
+ else
+ while (g_main_context_iteration (NULL, FALSE)) ;
+
+ if (pendingEvent())
+ event = m_event_handler.consumePendingEvent();
+
+ if (timeout)
+ g_source_remove (timeout);
+
+ if (block) // if YCP keeps working for more than X time, set busy cursor
+ busy_timeout = g_timeout_add (BUSY_CURSOR_TIMEOUT, busy_timeout_cb, this);
+
+ return event;
+}
+
+YEvent *
+YGUI::userInput (unsigned long timeout_ms)
+{
+ return waitInput (timeout_ms, true);
+}
+
+YEvent *YGUI::pollInput()
+{
+ return waitInput (0, false);
+}
+
+// dialog bits
+
+static GdkScreen *getScreen ()
+{
+ return gdk_display_get_default_screen (gdk_display_get_default());
+}
+
+int YGUI::getDisplayWidth()
+{
+ IMPL
+ return gdk_screen_get_width (getScreen());
+}
+
+int YGUI::getDisplayHeight()
+{
+ IMPL
+ return gdk_screen_get_height (getScreen());
+}
+
+int YGUI::getDefaultSize (YUIDimension dim)
+{
+ if (dim == YD_HORIZ) {
+ if (!m_default_size.width) {
+ if (m_fullscreen)
+ m_default_size.width = getDisplayWidth();
+ else
+ m_default_size.width = MIN (600, getDisplayWidth());
+ }
+ return m_default_size.width;
+ }
+ else { // YD_VERT
+ if (!m_default_size.height) {
+ if (m_fullscreen)
+ m_default_size.height = getDisplayHeight();
+ else
+ m_default_size.height = MIN (450, getDisplayHeight());
+ }
+ return m_default_size.height;
+ }
+}
+
+// YWidget layout units -> pixels conversion. Same as yast-qt's.
+long YGUI::deviceUnits (YUIDimension dim, float size)
+{
+ if (dim == YD_HORIZ) return (long) ((size * (640.0/80)) + 0.5);
+ else return (long) ((size * (480.0/25)) + 0.5);
+}
+
+float YGUI::layoutUnits (YUIDimension dim, long device_units)
+{
+ float size = (float) device_units;
+ if (dim == YD_HORIZ) return size * (80/640.0);
+ else return size * (25/480.0);
+}
+
+static void errorMsg (const char *msg)
+{
+ GtkWidget* dialog = gtk_message_dialog_new
+ (NULL, GtkDialogFlags (0), GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK, "%s", msg);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+}
+
+void YGUI::internalError (const char *msg)
+{
+ errorMsg (msg);
+ abort(); // going down
+}
+
+/* File/directory dialogs. */
+#include <sstream>
+
+static YCPValue askForFileOrDirectory (GtkFileChooserAction action,
+ const YCPString &path, const YCPString &filter_pattern,
+ const YCPString &title)
+{
+ IMPL
+ GtkWidget *dialog;
+ dialog = gtk_file_chooser_dialog_new (title->value_cstr(),
+ YGUI::ui()->currentWindow(), action, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ action == GTK_FILE_CHOOSER_ACTION_SAVE ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (dialog), TRUE);
+
+ // Yast likes to pass the path and suggested filename as a whole. We will need to
+ // split that up for GTK+.
+ string dirpath (path->value()), filename;
+ if (!dirpath.empty()) {
+ string::size_type i;
+ // we don't support local paths
+ if (dirpath [0] != '/') {
+ filename = dirpath;
+ dirpath = "";
+ }
+ else if (!(g_file_test (dirpath.c_str(), G_FILE_TEST_IS_DIR))) {
+ i = dirpath.find_last_of ("/");
+ if (i == string::npos) {
+ filename = dirpath;
+ dirpath = "";
+ }
+ else {
+ string path (dirpath);
+ dirpath = path.substr (0, i+1);
+ filename = path.substr (i+1);
+ }
+ }
+
+ // check if dirpath and filename are valid
+ if (!dirpath.empty())
+ if (!g_file_test (dirpath.c_str(), G_FILE_TEST_IS_DIR)) {
+ y2warning ("Path passed to file dialog isn't valid: '%s'", path->value_cstr());
+ dirpath = "";
+ }
+ i = filename.find ("/");
+ if (i != string::npos) {
+ y2warning ("Path passed to file dialog isn't valid: '%s'", path->value_cstr());
+ filename = "";
+ }
+ }
+
+ if (!dirpath.empty())
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), dirpath.c_str());
+ if (!filename.empty())
+ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), filename.c_str());
+
+ string filter_str (filter_pattern->value());
+ if (filter_str != "" && filter_str != "*") {
+ GtkFileFilter *filter = gtk_file_filter_new();
+ gtk_file_filter_set_name (filter, filter_str.c_str());
+ // cut filter_pattern into chuncks like GTK likes
+ std::istringstream stream (filter_str);
+ while (!stream.eof()) {
+ string str;
+ stream >> str;
+ if (!str.empty() && str [str.size()-1] == ',')
+ str.erase (str.size()-1);
+ gtk_file_filter_add_pattern (filter, str.c_str());
+ }
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
+ }
+
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
+ char* filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+ YCPString ret (filename);
+ g_free (filename);
+
+ gtk_widget_destroy (dialog);
+ return ret;
+ }
+ gtk_widget_destroy (dialog);
+ return YCPVoid();
+}
+
+YCPValue YGUI::askForExistingDirectory (const YCPString &path,
+ const YCPString &title)
+{
+ IMPL
+ return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, path,
+ YCPString (""), title);
+}
+
+YCPValue YGUI::askForExistingFile (const YCPString &path,
+ const YCPString &filter, const YCPString &title)
+{
+ IMPL
+ return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_OPEN, path, filter, title);
+}
+
+YCPValue YGUI::askForSaveFileName (const YCPString &path,
+ const YCPString &filter, const YCPString &title)
+{
+ IMPL
+ return askForFileOrDirectory (GTK_FILE_CHOOSER_ACTION_SAVE, path, filter, title);
+}
+
+bool YGUI::textMode() IMPL_RET(false)
+bool YGUI::hasImageSupport() IMPL_RET(true)
+bool YGUI::hasLocalImageSupport() IMPL_RET(true)
+bool YGUI::hasAnimationSupport() IMPL_RET(true)
+bool YGUI::hasIconSupport() IMPL_RET(true)
+bool YGUI::hasFullUtf8Support() IMPL_RET(true)
+bool YGUI::richTextSupportsTable() IMPL_RET(false)
+bool YGUI::leftHandedMouse() IMPL_RET(false)
+
+gboolean YGUI::busy_timeout_cb (gpointer data)
+{
+ YGUI *pThis = (YGUI *) data;
+ pThis->busyCursor();
+ pThis->busy_timeout = 0;
+ return FALSE;
+}
+
+void YGUI::busyCursor()
+{
+ YGDialog *dialog = currentYGDialog();
+ if (dialog)
+ dialog->busyCursor();
+}
+
+void YGUI::normalCursor()
+{
+ if (busy_timeout) {
+ g_source_remove (busy_timeout);
+ busy_timeout = 0;
+ }
+
+ YGDialog *dialog = currentYGDialog();
+ if (dialog)
+ dialog->normalCursor();
+}
+
+void YGUI::redrawScreen()
+{
+ gtk_widget_queue_draw (GTK_WIDGET (currentWindow()));
+}
+
+YCPValue YGUI::runPkgSelection (YWidget *packageSelector)
+{
+ y2milestone ("Running package selection...");
+
+ // TODO: we may have to do some trickery here to disable close button
+ // and auto activate dialogs (whatever that is)
+// _wm_close_blocked = true;
+// _auto_activate_dialogs = false;
+
+ YCPValue input = YCPVoid();
+ try {
+ input = evaluateUserInput();
+ }
+ catch (const std::exception &e) {
+ y2error ("Caught std::exception: %s", e.what());
+ y2error ("This is a libzypp problem. Do not file a bug against the UI!");
+ }
+ catch (...) {
+ y2error ("Caught unspecified exception.");
+ y2error ("This is a libzypp problem. Do not file a bug against the UI!");
+ }
+
+// _auto_activate_dialogs = true;
+// _wm_close_blocked = false;
+ y2milestone ("Package selection done - returning %s", input->toString().c_str());
+
+ return input;
+}
+
+void YGUI::makeScreenShot (string filename)
+{
+ IMPL
+ bool interactive = filename.empty();
+
+ GtkWidget *widget = GTK_WIDGET (currentWindow());
+ if (!widget) {
+ if (interactive)
+ errorMsg ("No dialog to take screenshot of.");
+ return;
+ }
+
+ GError *error = 0;
+ GdkPixbuf *shot =
+ gdk_pixbuf_get_from_drawable (NULL, GDK_DRAWABLE (widget->window),
+ gdk_colormap_get_system(), 0, 0, 0, 0, widget->allocation.width,
+ widget->allocation.height);
+
+ if (!shot) {
+ if (interactive)
+ errorMsg ("Couldn't take a screenshot.");
+ return;
+ }
+
+ if (interactive) {
+ //** ask user for filename
+ // calculate a default directory...
+ if (screenShotNameTemplate.empty()) {
+ string dir;
+ const char *homedir = getenv("HOME");
+ const char *ssdir = getenv("Y2SCREENSHOTS");
+ if (!homedir || !strcmp (homedir, "/")) {
+ // no homedir defined (installer)
+ dir = "/tmp/" + (ssdir ? (string(ssdir)) : (string("")));
+ if (mkdir (dir.c_str(), 0700) == -1)
+ dir = "";
+ }
+ else {
+ dir = homedir + (ssdir ? ("/" + string(ssdir)) : (string("")));
+ mkdir (dir.c_str(), 0750); // create a dir for what to put the pics
+ }
+
+ screenShotNameTemplate = dir + "/%s-%03d.png";
+ }
+
+ // calculate a default filename...
+ const char *baseName = moduleName();
+ if (!baseName)
+ baseName = "scr";
+
+ int nb;
+ map ::iterator it = screenShotNb.find (baseName);
+ if (it == screenShotNb.end())
+ nb = 0;
+
+ {
+ char *tmp_name = g_strdup_printf (screenShotNameTemplate.c_str(), baseName, nb);
+ filename = tmp_name;
+ g_free (tmp_name);
+ }
+ y2debug ("screenshot: %s", filename.c_str());
+
+ YCPValue ret = askForSaveFileName (YCPString (filename.c_str()),
+ YCPString ("*.png"),
+ YCPString ("Save screenshot to"));
+ if (!ret->isString()) { // user dismissed the dialog
+ y2debug ("Save screen shot canceled by user");
+ goto makeScreenShot_ret;
+ }
+
+ filename = ret->asString()->value();
+ screenShotNb.erase (baseName);
+ screenShotNb[baseName] = nb + 1;
+ }
+
+ y2debug ("Saving screen shot to %s", filename.c_str());
+ if (gdk_pixbuf_save (shot, filename.c_str(), "png", &error, NULL)) {
+ y2error ("Couldn't save screen shot %s", filename.c_str());
+ if (interactive) {
+ string msg = "Couldn't save screenshot to file " + filename
+ + " - " + error->message;
+ errorMsg (msg.c_str());
+ }
+ goto makeScreenShot_ret;
+ }
+
+ if (recordingMacro()) {
+ // save the taking of the screenshot and its name to the macro
+ macroRecorder->beginBlock();
+ currentDialog()->saveUserInput (macroRecorder);
+ macroRecorder->recordMakeScreenShot (true, filename.c_str());
+ macroRecorder->recordUserInput (YCPVoid());
+ macroRecorder->endBlock();
+ }
+
+ makeScreenShot_ret:
+ g_object_unref (G_OBJECT (shot));
+}
+
+void YGUI::beep()
+{
+ gdk_beep();
+ GtkWindow *window = currentWindow();
+ if (window)
+ gtk_window_present (window);
+}
+
+YCPString YGUI::glyph (const YCPSymbol &symbol)
+{
+ string sym = symbol->symbol();
+ if (sym == YUIGlyph_ArrowLeft)
+ return YCPString ("\u2190");
+ if (sym == YUIGlyph_ArrowRight)
+ return YCPString ("\u2192");
+ if (sym == YUIGlyph_ArrowUp)
+ return YCPString ("\u2191");
+ if (sym == YUIGlyph_ArrowDown)
+ return YCPString ("\u2193");
+ if (sym == YUIGlyph_CheckMark)
+ return YCPString ("\u2714");
+ if (sym == YUIGlyph_BulletArrowRight)
+ return YCPString ("\u279c");
+ if (sym == YUIGlyph_BulletCircle)
+ return YCPString ("\u274d");
+ if (sym == YUIGlyph_BulletSquare)
+ return YCPString ("\u274f");
+ return YCPString ("");
+}
+
+void YGUI::toggleRecordMacro()
+{
+ if (recordingMacro()) {
+ stopRecordMacro();
+ normalCursor();
+
+ GtkWidget* dialog = gtk_message_dialog_new (NULL,
+ GtkDialogFlags (0), GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
+ "Macro recording done.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+ else {
+ YCPValue ret = askForSaveFileName (YCPString (DEFAULT_MACRO_FILE_NAME),
+ YCPString ("*.ycp"),
+ YCPString ("Select Macro File to Record to"));
+ if (ret->isString()) {
+ YCPString filename = ret->asString();
+ recordMacro (filename->value_cstr());
+ }
+ }
+}
+
+void YGUI::askPlayMacro()
+{
+ YCPValue ret = askForExistingFile (YCPString (DEFAULT_MACRO_FILE_NAME),
+ YCPString ("*.ycp"), YCPString ("Select Macro File to Play"));
+
+ if (ret->isString()) {
+ busyCursor();
+ YCPString filename = ret->asString();
+
+ playMacro (filename->value_cstr());
+ sendEvent (new YEvent()); // flush
+ }
+}
+
+void YGUI::askSaveLogs()
+{
+ YCPValue file = askForSaveFileName (YCPString ("/tmp/y2logs.tgz"),
+ YCPString ("*.tgz *.tar.gz"), YCPString ("Save y2logs to..."));
+
+ if (file->isString()) {
+ std::string command = "/sbin/save_y2logs";
+ command += " '" + file->asString()->value() + "'";
+ y2milestone ("Saving y2logs: %s", command.c_str());
+ int ret = system (command.c_str());
+ if (ret == 0)
+ y2milestone ("y2logs saved to %s", file->asString()->value_cstr());
+ else {
+ char *error = g_strdup_printf (
+ "Error: couldn't save y2logs: \"%s\" (exit value: %d)",
+ command.c_str(), ret);
+ y2error (error);
+ errorMsg (error);
+ g_free (error);
+ }
+ }
+}
+
+// debug dialogs
+
+//#define IS_VALID_COL
+void dumpYastTree (YWidget *widget)
+{
+ IMPL
+ struct inner {
+ static void dumpYastTree (YWidget *widget, GtkTreeStore *store,
+ GtkTreeIter *parent_node)
+ {
+ YGWidget *ygwidget;
+ if (!widget || !(ygwidget = YGWidget::get (widget)))
+ return;
+
+ GtkTreeIter iter;
+ gtk_tree_store_append (store, &iter, parent_node);
+
+ YContainerWidget *container = dynamic_cast (widget);
+ gchar *stretch = g_strdup_printf ("%d x %d",
+ ygwidget->isStretchable (YD_HORIZ), ygwidget->isStretchable (YD_VERT));
+ gchar *weight = g_strdup_printf ("%ld x %ld",
+ widget->weight (YD_HORIZ), widget->weight (YD_VERT));
+ gtk_tree_store_set (store, &iter, 0, widget->widgetClass(),
+ 1, ygwidget->getDebugLabel().c_str(), 2, stretch, 3, weight,
+#ifdef IS_VALID_COL
+ 4, widget->isValid(),
+#endif
+ -1);
+ g_free (stretch);
+ g_free (weight);
+
+ if (container)
+ for (int i = 0; i < container->numChildren(); i++)
+ dumpYastTree (container->child (i), store, &iter);
+ }
+ static void dialog_response_cb (GtkDialog *dialog, gint response, YWidget *ywidget)
+ {
+ if (response == 1) {
+ GtkTreeStore *store;
+ GtkTreeView *view;
+ store = (GtkTreeStore *) g_object_get_data (G_OBJECT (dialog), "store");
+ view = (GtkTreeView *) g_object_get_data (G_OBJECT (dialog), "view");
+ gtk_tree_store_clear (store);
+ dumpYastTree (ywidget, store, NULL);
+ gtk_tree_view_expand_all (view);
+ }
+ else
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ }
+ };
+
+ int cols = 4;
+#ifdef IS_VALID_COL
+ cols++;
+#endif
+ GtkTreeStore *store = gtk_tree_store_new (cols,
+ G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING
+#ifdef IS_VALID_COL
+ , G_TYPE_BOOLEAN
+#endif
+ );
+
+ GtkWidget *dialog = gtk_dialog_new_with_buttons ("YWidgets Tree", NULL,
+ GtkDialogFlags (GTK_DIALOG_NO_SEPARATOR), GTK_STOCK_REFRESH, 1,
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), -1, 400);
+
+ GtkWidget *view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view),
+ gtk_tree_view_column_new_with_attributes ("Type",
+ gtk_cell_renderer_text_new(), "text", 0, NULL));
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view),
+ gtk_tree_view_column_new_with_attributes ("Label",
+ gtk_cell_renderer_text_new(), "text", 1, NULL));
+ gtk_tree_view_column_set_expand (gtk_tree_view_get_column (
+ GTK_TREE_VIEW (view), 1), TRUE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view),
+ gtk_tree_view_column_new_with_attributes ("Stretch",
+ gtk_cell_renderer_text_new(), "text", 2, NULL));
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view),
+ gtk_tree_view_column_new_with_attributes ("Weight",
+ gtk_cell_renderer_text_new(), "text", 3, NULL));
+#ifdef IS_VALID_COL
+ gtk_tree_view_append_column (GTK_TREE_VIEW (view),
+ gtk_tree_view_column_new_with_attributes ("Valid",
+ gtk_cell_renderer_toggle_new(), "active", 4, NULL));
+#endif
+ gtk_tree_view_set_enable_tree_lines (GTK_TREE_VIEW (view), TRUE);
+
+ GtkWidget *scroll_win = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll_win),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll_win),
+ GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+
+ gtk_container_add (GTK_CONTAINER (scroll_win), view);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scroll_win);
+
+ inner::dumpYastTree (widget, store, NULL);
+ gtk_tree_view_expand_all (GTK_TREE_VIEW (view));
+
+ g_object_set_data (G_OBJECT (dialog), "view", view);
+ g_object_set_data (G_OBJECT (dialog), "store", store);
+ g_signal_connect (G_OBJECT (dialog), "response",
+ G_CALLBACK (inner::dialog_response_cb), widget);
+
+ gtk_widget_show_all (dialog);
+}
+
+#include
+
+void dumpYastHtml (YWidget *widget)
+{
+ struct inner {
+ static void dumpYastHtml (YWidget *widget, GtkBox *box)
+ {
+ YGWidget *ygwidget;
+ if (!widget || !(ygwidget = YGWidget::get (widget)))
+ return;
+
+ YRichText *rtext = dynamic_cast (widget);
+ if (rtext) {
+ std::string text = rtext->getText()->value();
+ char *xml = ygutils_convert_to_xhmlt_and_subst (text.c_str(), NULL);
+
+ GtkWidget *view = gtk_text_view_new();
+ gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
+ gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
+ gtk_text_buffer_set_text (buffer, xml, -1);
+
+ GtkWidget *scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
+ GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (scroll), view);
+ gtk_box_pack_start (box, scroll, TRUE, TRUE, 6);
+
+ g_free (xml);
+ }
+
+ YContainerWidget *container = dynamic_cast (widget);
+ if (container)
+ for (int i = 0; i < container->numChildren(); i++)
+ dumpYastHtml (container->child (i), box);
+ }
+ static void destroy_dialog (GtkDialog *dialog, gint arg)
+ { gtk_widget_destroy (GTK_WIDGET (dialog)); }
+ };
+
+ IMPL
+ GtkWidget *dialog = gtk_dialog_new_with_buttons ("YWidgets HTML", NULL,
+ GtkDialogFlags (GTK_DIALOG_NO_SEPARATOR), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);
+
+ inner::dumpYastHtml (widget, GTK_BOX (GTK_DIALOG (dialog)->vbox));
+
+ gtk_widget_show_all (dialog);
+ g_signal_connect (G_OBJECT (dialog), "response",
+ G_CALLBACK (inner::destroy_dialog), 0);
+}
+
Added: trunk/gtk/10_3/src/YGUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGUI.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGUI.h (added)
+++ trunk/gtk/10_3/src/YGUI.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,313 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#ifndef YGUI_H
+#define YGUI_H
+
+#include
+#include
+#include
+
+using std::string;
+using std::vector;
+
+/* Comment the following line to disable debug messages */
+// #define IMPL_DEBUG
+#define LOC fprintf (stderr, "%s (%s)\n", G_STRLOC, G_STRFUNC)
+#ifdef IMPL_DEBUG
+ #define IMPL { LOC; }
+#else
+ #define IMPL { }
+#endif
+#define IMPL_NULL { IMPL; return NULL; }
+#define IMPL_VOID { IMPL; return YCPVoid(); }
+#define IMPL_RET(a) { IMPL; return (a); }
+
+#define ICON_DIR THEMEDIR "/icons/22x22/apps/"
+
+/* Compatibility */
+#if YAST2_VERSION > 2014004
+# define YAST2_YGUI_CHECKBOX_FRAME 1
+#elif YAST2_VERSION >= 2014000
+# define YAST2_YGUI_CHECKBOX_FRAME 0
+#elif YAST2_VERSION > 2013032
+# define YAST2_YGUI_CHECKBOX_FRAME 1
+#else
+# define YAST2_YGUI_CHECKBOX_FRAME 0
+#endif
+
+class YGDialog;
+
+class YGUI: public YUI
+{
+public:
+ YGUI (int argc, char **argv,
+ bool with_threads, const char *macro_file);
+ virtual ~YGUI();
+
+ static YGUI *ui() { return (YGUI *)YUI::ui(); }
+
+ // non abstract loop bits:
+ virtual void blockEvents (bool block = true) IMPL
+ virtual bool eventsBlocked() const IMPL_RET (false)
+ virtual void internalError (const char *msg);
+ virtual void idleLoop (int fd_ycp);
+ virtual YEvent * waitInput (unsigned long timeout_ms, bool block);
+ virtual YEvent * userInput (unsigned long timeout_millisec);
+ virtual YEvent * pollInput();
+
+ virtual void showDialog (YDialog *dialog);
+ virtual void closeDialog (YDialog *dialog);
+ // Non abstract virtuals:
+ virtual YCPValue setLanguage (const YCPTerm & term) IMPL_VOID
+
+ // event pieces:
+ private:
+ YSimpleEventHandler m_event_handler;
+ public:
+ void sendEvent (YEvent *event);
+ YEvent *pendingEvent() const { return m_event_handler.pendingEvent(); }
+ bool eventPendingFor (YWidget *widget) const { return m_event_handler.eventPendingFor (widget); }
+
+ // container widgets
+ virtual YDialog *createDialog (YWidgetOpt &opt);
+ virtual YContainerWidget *createSplit (YWidget *parent, YWidgetOpt &opt, YUIDimension dimension);
+ virtual YContainerWidget *createReplacePoint (YWidget *parent, YWidgetOpt &opt);
+ virtual YContainerWidget *createAlignment (YWidget *parent, YWidgetOpt &opt,
+ YAlignmentType halign,
+ YAlignmentType valign);
+ virtual YContainerWidget *createSquash (YWidget *parent, YWidgetOpt &opt,
+ bool hsquash, bool vsquash);
+ virtual YContainerWidget *createRadioButtonGroup (YWidget *parent, YWidgetOpt &opt);
+ virtual YContainerWidget *createFrame (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label);
+#if YAST2_YGUI_CHECKBOX_FRAME
+ virtual YContainerWidget *createCheckBoxFrame( YWidget *parent, YWidgetOpt & opt, const YCPString & label, bool checked );
+#endif
+
+ // leaf widgets
+ virtual YWidget *createEmpty (YWidget *parent, YWidgetOpt &opt);
+ virtual YWidget *createSpacing (YWidget *parent, YWidgetOpt &opt, float size,
+ bool horizontal, bool vertical);
+ virtual YWidget *createLabel (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &text);
+ virtual YWidget *createRichText (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &text);
+ virtual YWidget *createLogView (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, int visibleLines,
+ int maxLines);
+ virtual YWidget *createPushButton (YWidget *parent, YWidgetOpt &opt,
+ const YCPString & label);
+ virtual YWidget *createMenuButton (YWidget *parent, YWidgetOpt &opt,
+ const YCPString & label);
+ virtual YWidget *createRadioButton (YWidget *parent, YWidgetOpt &opt,
+ YRadioButtonGroup *rbg,
+ const YCPString &label, bool checked);
+ virtual YWidget *createCheckBox (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, bool checked);
+ virtual YWidget *createTextEntry (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, const YCPString &text);
+ virtual YWidget *createMultiLineEdit (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label,
+ const YCPString &text);
+ virtual YWidget *createSelectionBox (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label);
+ virtual YWidget *createMultiSelectionBox (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label);
+ virtual YWidget *createComboBox (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label);
+ virtual YWidget *createTree (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label);
+ virtual YWidget *createTable (YWidget *parent, YWidgetOpt &opt,
+ std::vectorstd::string header);
+ virtual YWidget *createProgressBar (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label,
+ const YCPInteger &maxprogress,
+ const YCPInteger &progress);
+ virtual YWidget *createImage (YWidget *parent, YWidgetOpt &opt,
+ YCPByteblock imagedata, YCPString defaulttext);
+ virtual YWidget *createImage (YWidget *parent, YWidgetOpt &opt,
+ YCPString file_name, YCPString defaulttext);
+ virtual YWidget *createIntField (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, int minValue,
+ int maxValue, int initialValue);
+
+ // Package selector
+ virtual YWidget *createPackageSelector (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &floppyDevice);
+ virtual YWidget *createPkgSpecial (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &subwidget);
+ virtual YCPValue runPkgSelection (YWidget *packageSelector);
+
+/*
+ // FIXME: do we need to implement these new bits ?
+
+ // New package selector bits ...
+ bool hasPatternSelector();
+ YWidget * createPatternSelector ( YWidget * parent,
+ YWidgetOpt & opt );
+
+ bool hasSimplePatchSelector();
+ YWidget * createSimplePatchSelector( YWidget * parent,
+ YWidgetOpt & opt );
+*/
+
+ // Optional widgets
+ virtual YWidget *createDummySpecialWidget (YWidget *parent, YWidgetOpt &opt)
+ IMPL_NULL;
+ virtual bool hasDummySpecialWidget() { return false; }
+
+ virtual YWidget *createDownloadProgress (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label,
+ const YCPString &filename,
+ int expectedSize);
+ virtual bool hasDownloadProgress() { return true; }
+
+ virtual YWidget *createBarGraph (YWidget *parent, YWidgetOpt &opt);
+ virtual bool hasBarGraph() { return true; }
+
+ virtual YWidget *createColoredLabel (YWidget *parent, YWidgetOpt &opt,
+ YCPString label, YColor foreground,
+ YColor background, int margin);
+ virtual bool hasColoredLabel() { return true; }
+
+ virtual YWidget *createDate (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, const YCPString &date);
+ virtual bool hasDate() { return true; }
+
+ virtual YWidget *createTime (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, const YCPString &time);
+ virtual bool hasTime() { return true; }
+
+ virtual YWidget *createDumbTab (YWidget *parent, YWidgetOpt &opt);
+ virtual bool hasDumbTab() { return true; }
+
+ virtual YWidget *createMultiProgressMeter (YWidget *parent, YWidgetOpt &opt,
+ bool horizontal, const YCPList & maxValues);
+ virtual bool hasMultiProgressMeter() { return true; }
+
+ virtual YWidget *createSlider (YWidget *parent, YWidgetOpt &opt,
+ const YCPString &label, int min,
+ int max, int initial);
+ virtual bool hasSlider() { return true; }
+
+ virtual YWidget *createPartitionSplitter (YWidget *parent,
+ YWidgetOpt &opt,
+ int usedSize,
+ int totalFreeSize,
+ int newPartSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const YCPString &usedLabel,
+ const YCPString &freeLabel,
+ const YCPString &newPartLabel,
+ const YCPString &freeFieldLabel,
+ const YCPString &newPartFieldLabel);
+ virtual bool hasPartitionSplitter() { return true; }
+
+ virtual YWidget *createPatternSelector (YWidget *parent, YWidgetOpt &opt) IMPL_NULL;
+ virtual bool hasPatternSelector() { return false; }
+
+ virtual YWidget *createWizard (YWidget *parent,
+ YWidgetOpt &opt,
+ const YCPValue &backButtonId,
+ const YCPString &backButtonLabel,
+ const YCPValue &abortButtonId,
+ const YCPString &abortButtonLabel,
+ const YCPValue &nextButtonId,
+ const YCPString &nextButtonLabel);
+ virtual bool hasWizard() { return true; }
+
+
+ virtual int getDisplayWidth();
+ virtual int getDisplayHeight();
+ // let's fool YWidgets here because it tries to be smart if our default
+ // dialog size is too small
+ virtual int getDefaultWidth() { return 10000; }
+ virtual int getDefaultHeight() { return 10000; }
+ // Dunno where this is used in practice, but these can be got by a YCP
+ // apps, so better implement them.
+ virtual int getDisplayDepth() { return 24; }
+ virtual long getDisplayColors() { return 256*256*256; }
+
+ virtual long deviceUnits (YUIDimension dim, float size);
+ virtual float layoutUnits (YUIDimension dim, long device_units);
+
+ virtual bool textMode();
+ virtual bool hasImageSupport();
+ virtual bool hasLocalImageSupport();
+ virtual bool hasAnimationSupport();
+ virtual bool hasIconSupport();
+ virtual bool hasFullUtf8Support();
+ virtual bool richTextSupportsTable();
+ virtual bool leftHandedMouse();
+
+ virtual YCPString glyph (const YCPSymbol &glyph);
+ virtual void redrawScreen();
+
+ // convience function to be used rather than currentDialog()
+ // NULL if there is no dialog at the moment.
+ GtkWindow *currentWindow();
+ YGDialog *currentYGDialog();
+
+ virtual void busyCursor();
+ virtual void normalCursor();
+
+ guint busy_timeout; // for busy cursor
+ static gboolean busy_timeout_cb (gpointer data);
+
+ virtual void beep();
+ virtual void makeScreenShot (string filename);
+
+ /* File/directory dialogs. */
+ virtual YCPValue askForExistingDirectory (const YCPString &startDir,
+ const YCPString &headline);
+ virtual YCPValue askForExistingFile (const YCPString &startWith,
+ const YCPString &filter,
+ const YCPString &headline);
+ virtual YCPValue askForSaveFileName (const YCPString &startWith,
+ const YCPString &filter,
+ const YCPString &headline);
+
+ // Starts macro recording and asks for a filename to save it to
+ // If there is already one in progress, it just resumes/pauses as appropriate
+ // activated by Ctrl-Shift-Alt-M
+ void toggleRecordMacro();
+
+ // Plays a macro, opening a dialog first to ask for the filename
+ // activated by Ctrl-Shift-Alt-P
+ void askPlayMacro();
+
+ // On Shift-F8, run save_logs
+ void askSaveLogs();
+
+ private:
+ // window-related arguments
+ bool m_have_wm, m_no_border, m_fullscreen;
+ GtkRequisition m_default_size;
+
+ // for delayed gtk+ init in the right thread
+ bool m_done_init;
+ int m_argc;
+ char **m_argv;
+ void checkInit();
+
+ // for screenshots:
+ map screenShotNb;
+ string screenShotNameTemplate;
+
+ public:
+ // Helpers for internal use [ visibility hidden ]
+ int getDefaultSize (YUIDimension dim);
+ bool setFullscreen() const { return m_fullscreen || !m_have_wm; }
+ bool hasWM() const { return m_have_wm; }
+ bool unsetBorder() const { return m_no_border; }
+};
+
+// debug helpers.
+void dumpYastTree (YWidget *widget);
+void dumpYastHtml (YWidget *widget);
+
+#endif // YGUI_H
+
Added: trunk/gtk/10_3/src/YGUtils.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGUtils.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGUtils.cc (added)
+++ trunk/gtk/10_3/src/YGUtils.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,727 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include "YGUtils.h"
+
+string YGUtils::mapKBAccel (const char *src)
+{
+ // we won't use use replace since we also want to escape _ to __
+ string str;
+ int length = strlen (src);
+ str.reserve (length);
+
+ for (int i = 0; i < length; i++) {
+ if (src[i] == '_')
+ str += "__";
+ else if (src[i] == '&')
+ str += '_';
+ else
+ str += src[i];
+ }
+ return str;
+}
+
+string YGUtils::filterText (const char* text, int length, const char *valid_chars)
+{
+ if (length == -1)
+ length = strlen (text);
+ if (valid_chars[0] == '\0')
+ return string(text);
+
+ string str;
+ str.reserve (length);
+ for (int i = 0; text[i] && i < length; i++) {
+ for (int j = 0; valid_chars[j]; j++)
+ if(text[i] == valid_chars[j]) {
+ str += text[i];
+ break;
+ }
+ }
+ return str;
+}
+
+void YGUtils::filterText (GtkEditable *editable, int pos, int length,
+ const char *valid_chars)
+{
+ gchar *text = gtk_editable_get_chars (editable, pos, pos + length);
+ string str = filterText (text, length, valid_chars);
+ if (length == -1)
+ length = strlen (text);
+
+ if (str != text) { // invalid text
+ // delete current text
+ gtk_editable_delete_text (editable, pos, length);
+ // insert correct text
+ gtk_editable_insert_text (editable, str.c_str(), str.length(), &pos);
+
+ g_signal_stop_emission_by_name (editable, "insert_text");
+ gdk_beep(); // BEEP!
+ }
+
+ g_free (text);
+}
+
+void YGUtils::replace (string &str, const char *mouth, int mouth_len, const char *food)
+{
+ if (mouth_len < 0)
+ mouth_len = strlen (mouth);
+ unsigned int i = 0;
+ while ((i = str.find (mouth, i)) != string::npos)
+ {
+ str.erase (i, mouth_len);
+ str.insert (i, food);
+ }
+}
+
+void YGUtils::scrollTextViewDown(GtkTextView *text_view)
+{
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (text_view);
+ GtkTextIter end_iter;
+ gtk_text_buffer_get_end_iter (buffer, &end_iter);
+ GtkTextMark *end_mark;
+ end_mark = gtk_text_buffer_create_mark
+ (buffer, NULL, &end_iter, FALSE);
+ gtk_text_view_scroll_to_mark (text_view,
+ end_mark, 0.0, FALSE, 0, 0);
+ gtk_text_buffer_delete_mark (buffer, end_mark);
+}
+
+void YGUtils::escapeMarkup (string &str)
+{
+ for (unsigned int i = 0; i < str.length(); i++) {
+ switch (str[i]) {
+ case '<':
+ str.erase (i, 1);
+ str.insert (i, "<");
+ break;
+ case '>':
+ str.erase (i, 1);
+ str.insert (i, ">");
+ break;
+ case '&':
+ str.erase (i, 1);
+ str.insert (i, "&");
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+#define PROD_ENTITY "&product;"
+
+inline void skipSpace(const char *instr, int &i)
+{
+ while (g_ascii_isspace (instr[i])) i++;
+}
+
+typedef struct {
+ GString *tag;
+ int tag_len : 31;
+ unsigned int early_closer : 1;
+} TagEntry;
+
+static TagEntry *
+tag_entry_new (GString *tag, int tag_len)
+{
+ static const char *early_closers[] = { "p", "li" };
+ TagEntry *entry = g_new (TagEntry, 1);
+ entry->tag = tag;
+ entry->tag_len = tag_len;
+ entry->early_closer = FALSE;
+
+ for (unsigned int i = 0; i < G_N_ELEMENTS (early_closers); i++)
+ if (!g_ascii_strncasecmp (tag->str, early_closers[i], tag_len))
+ entry->early_closer = TRUE;
+ return entry;
+}
+
+static void
+tag_entry_free (TagEntry *entry)
+{
+ if (entry && entry->tag)
+ g_string_free (entry->tag, TRUE);
+ g_free (entry);
+}
+
+static void
+emit_unclosed_tags_for (GString *outp, GQueue *tag_queue, const char *tag_str, int tag_len)
+{
+ gboolean matched = FALSE;
+
+ // top-level tag ...
+ if (g_queue_is_empty (tag_queue))
+ return;
+
+ do {
+ TagEntry *last_entry = (TagEntry *)g_queue_pop_tail (tag_queue);
+ if (!last_entry)
+ break;
+
+ if (last_entry->tag_len != tag_len ||
+ g_ascii_strncasecmp (last_entry->tag->str, tag_str, tag_len)) {
+ /* different tag - emit a close ... */
+ g_string_append (outp, "");
+ g_string_append_len (outp, last_entry->tag->str, last_entry->tag_len);
+ g_string_append_c (outp, '>');
+ } else
+ matched = TRUE;
+
+ tag_entry_free (last_entry);
+ } while (!matched);
+}
+
+static gboolean
+check_early_close (GString *outp, GQueue *tag_queue, TagEntry *entry)
+{
+ TagEntry *last_tag;
+
+ // Early closers:
+ if (!entry->early_closer)
+ return FALSE;
+
+ last_tag = (TagEntry *) g_queue_peek_tail (tag_queue);
+ if (!last_tag || !last_tag->early_closer)
+ return FALSE;
+
+ if (entry->tag_len != last_tag->tag_len ||
+ g_ascii_strncasecmp (last_tag->tag->str, entry->tag->str, entry->tag_len))
+ return FALSE;
+
+ // Emit close & leave last tag on the stack
+
+ g_string_append (outp, "");
+ g_string_append_len (outp, entry->tag->str, entry->tag_len);
+ g_string_append_c (outp, '>');
+
+ return TRUE;
+}
+
+
+// We have to:
+// + manually substitute the product entity.
+// + rewrite <br> and <hr> tags
+// + deal with <a attrib=noquotes>
+gchar *ygutils_convert_to_xhmlt_and_subst (const char *instr, const char *product)
+{
+ GString *outp = g_string_new ("");
+ GQueue *tag_queue = g_queue_new();
+ int i = 0;
+
+ skipSpace (instr, i);
+
+ // We must add an outer tag to make GMarkup happy
+ gboolean addOuterTag = TRUE;
+// gboolean addOuterTag = FALSE;
+// if ((addOuterTag = (instr[i] != '<')))
+ g_string_append (outp, "<body>");
+
+ for (; instr[i] != '\0'; i++)
+ {
+ // Tag foo
+ if (instr[i] == '<') {
+ // ignore comments
+ if (strncmp (&instr[i], "<!--", 4) == 0) {
+ for (i += 3; instr[i] != '\0'; i++)
+ if (strncmp (&instr[i], "-->", 3) == 0) {
+ i += 2;
+ break;
+ }
+ continue;
+ }
+
+ gint j;
+ gboolean is_close = FALSE;
+ gboolean in_tag;
+ int tag_len;
+ GString *tag = g_string_sized_new (20);
+
+ i++;
+ skipSpace (instr, i);
+
+ if (instr[i] == '/') {
+ i++;
+ is_close = TRUE;
+ }
+
+ skipSpace (instr, i);
+
+ // find the tag name piece
+ in_tag = TRUE;
+ tag_len = 0;
+ for (; instr[i] != '>' && instr[i]; i++) {
+ if (in_tag) {
+ if (!g_ascii_isalnum(instr[i]))
+ in_tag = FALSE;
+ else
+ tag_len++;
+ }
+ g_string_append_c (tag, instr[i]);
+ }
+
+ // Unmatched tags
+ if ( !is_close && tag_len == 2 &&
+ (!g_ascii_strncasecmp (tag->str, "hr", 2) ||
+ !g_ascii_strncasecmp (tag->str, "br", 2)) &&
+ tag->str[tag->len - 1] != '/')
+ g_string_append_c (tag, '/');
+
+ // Add quoting for un-quoted attributes
+ for (int j = 0; j < (signed) tag->len; j++) {
+ if (tag->str[j] == '=') {
+ if (tag->str[j+1] != '"') {
+ g_string_insert_c (tag, j+1, '"');
+ for (j++; !g_ascii_isspace (tag->str[j]) && tag->str[j]; j++) ;
+ g_string_insert_c (tag, j, '"');
+ }
+ }
+ }
+
+ // Is it an open or close ?
+ j = tag->len - 1;
+
+ while (j > 0 && g_ascii_isspace (tag->str[j])) j--;
+
+ gboolean is_open_close = (tag->str[j] == '/');
+ if (is_open_close)
+ ; // ignore it
+ else if (is_close)
+ emit_unclosed_tags_for (outp, tag_queue, tag->str, tag_len);
+ else {
+ TagEntry *entry = tag_entry_new (tag, tag_len);
+
+ entry->tag = tag;
+ entry->tag_len = tag_len;
+
+ if (!check_early_close (outp, tag_queue, entry))
+ g_queue_push_tail (tag_queue, entry);
+ else {
+ entry->tag = NULL;
+ tag_entry_free (entry);
+ }
+ }
+
+ g_string_append_c (outp, '<');
+ if (is_close)
+ g_string_append_c (outp, '/');
+ g_string_append_len (outp, tag->str, tag->len);
+ g_string_append_c (outp, '>');
+
+ if (is_close || is_open_close)
+ g_string_free (tag, TRUE);
+ }
+/*
+ else if (instr[i] == '&' &&
+ !g_ascii_strncasecmp (instr + i, PROD_ENTITY,
+ sizeof (PROD_ENTITY) - 1)) {
+ // 1 Magic entity
+ g_string_append (outp, product);
+ i += sizeof (PROD_ENTITY) - 2;
+ }
+*/
+ // non-break space entity
+ else if (instr[i] == '&' &&
+ !g_ascii_strncasecmp (instr + i, " ",
+ sizeof (" ") - 1)) {
+ // Replace this by a white-space
+ g_string_append (outp, " ");
+ i += sizeof (" ") - 2;
+ }
+
+#if 0
+ // removing new-lines chars sure isn't a xhtml conversion
+ // but it's still valid xhtml and GtkTextView appreciates it
+ else if (/*cut_breaklines &&*/ instr[i] == '\n') {
+ // In HTML a breakline should be treated as a white space when
+ // not in the start of a paragraph.
+ if (i > 0 && instr[i-1] != '>' && !g_ascii_isspace (instr[i-1]))
+ g_string_append_c (outp, ' ');
+ }
+#endif
+
+ else // Normal text
+ g_string_append_c (outp, instr[i]);
+ }
+
+ emit_unclosed_tags_for (outp, tag_queue, "", 0);
+ g_queue_free (tag_queue);
+
+ if (addOuterTag)
+ g_string_append (outp, "</body>");
+
+ gchar *ret = g_string_free (outp, FALSE);
+ return ret;
+}
+
+int YGUtils::getCharsWidth (GtkWidget *widget, int chars_nb)
+{
+ PangoContext *context = gtk_widget_get_pango_context (widget);
+ PangoFontMetrics *metrics = pango_context_get_metrics (context,
+ widget->style->font_desc, NULL);
+
+ int width = pango_font_metrics_get_approximate_char_width (metrics);
+ pango_font_metrics_unref (metrics);
+
+ return PANGO_PIXELS (width) * chars_nb;
+}
+
+int YGUtils::getCharsHeight (GtkWidget *widget, int chars_nb)
+{
+ PangoContext *context = gtk_widget_get_pango_context (widget);
+ PangoFontMetrics *metrics = pango_context_get_metrics (context,
+ widget->style->font_desc, NULL);
+
+ int height = pango_font_metrics_get_ascent (metrics) +
+ pango_font_metrics_get_descent (metrics);
+ pango_font_metrics_unref (metrics);
+
+ return PANGO_PIXELS (height) * chars_nb;
+}
+
+void YGUtils::setWidgetFont (GtkWidget *widget, PangoWeight weight, double scale)
+{
+ PangoFontDescription *font_desc = widget->style->font_desc;
+ int size = pango_font_description_get_size (font_desc);
+
+ PangoFontDescription* font = pango_font_description_new();
+ pango_font_description_set_weight (font, weight);
+ pango_font_description_set_size (font, (int)(size * scale));
+
+ gtk_widget_modify_font (widget, font);
+ pango_font_description_free (font);
+}
+
+int ygutils_getCharsWidth (GtkWidget *widget, int chars_nb)
+{ return YGUtils::getCharsWidth (widget, chars_nb); }
+int ygutils_getCharsHeight (GtkWidget *widget, int chars_nb)
+{ return YGUtils::getCharsHeight (widget, chars_nb); }
+void ygutils_setWidgetFont (GtkWidget *widget, PangoWeight weight, double scale)
+{ YGUtils::setWidgetFont (widget, weight, scale); }
+
+int YGUtils::strcmp (const char *str1, const char *str2)
+{
+ // (if you think this is ugly, just wait for the Perl version! :P)
+ const char *i, *j;
+ for (i = str1, j = str2; *i && *j; i++, j++) {
+ // number comparasion
+ if (isdigit (*i) && isdigit (*j)) {
+ int n1, n2;
+ for (n1 = 0; isdigit (*i); i++)
+ n1 = (*i - '0') + (n1 * 10);
+ for (n2 = 0; isdigit (*j); j++)
+ n2 = (*j - '0') + (n2 * 10);
+
+ if (n1 != n2)
+ return n1 - n2;
+
+ // prepare for loop
+ i--; j--;
+ }
+
+ // regular character comparasion
+ else if (g_ascii_tolower (*i) != g_ascii_tolower(*j))
+ return g_ascii_tolower (*i) - g_ascii_tolower (*j);
+ }
+ if (*i)
+ return -1;
+ if (*j)
+ return 1;
+ return 0; // identicals
+}
+
+bool YGUtils::contains (const string &haystack, const string &needle)
+{
+ unsigned int i, j;
+ for (i = 0; i < haystack.length(); i++) {
+ for (j = 0; j < needle.length() && i+j < haystack.length(); j++)
+ if (g_ascii_tolower (haystack[i+j]) != g_ascii_tolower (needle[j]))
+ break;
+ if (j == needle.length())
+ return true;
+ }
+ return false;
+}
+
+std::list <string> YGUtils::splitString (const string &str, char separator)
+{
+ std::list <string> parts;
+ unsigned int i, j;
+ // ignore first character, if separator
+ i = j = (str[0] == separator) ? 1 : 0;
+ for (; i < str.length(); i++)
+ if (str[i] == separator) {
+ parts.push_back (str.substr (j, i - j));
+ j = ++i;
+ }
+ parts.push_back (str.substr (j));
+ return parts;
+}
+
+void YGUtils::print_model (GtkTreeModel *model, int string_col)
+{
+ fprintf (stderr, "printing model...\n");
+ int depth = 0;
+ GtkTreeIter iter;
+
+ if (!gtk_tree_model_get_iter_first (model, &iter)) {
+ fprintf (stderr, "Couldn't even get a first iterator\n");
+ return;
+ }
+
+ while (true)
+ {
+ // print node
+ gchar *package_name = 0;
+ gtk_tree_model_get (model, &iter, string_col, &package_name, -1);
+ for (int i = 0; i < depth*4; i++)
+ fprintf (stderr, " ");
+ fprintf (stderr, "%s\n", package_name);
+ g_free (package_name);
+
+ if (gtk_tree_model_iter_has_child (model, &iter)) {
+ GtkTreeIter parent = iter;
+ gtk_tree_model_iter_children (model, &iter, &parent);
+ depth++;
+ }
+ else {
+ if (gtk_tree_model_iter_next (model, &iter))
+ ; // continue
+ else {
+ // let's see if there is a parent
+ GtkTreeIter child = iter;
+ if (gtk_tree_model_iter_parent (model, &iter, &child) &&
+ gtk_tree_model_iter_next (model, &iter))
+ depth--;
+ else
+ break;
+ }
+ }
+ }
+}
+
+void YGUtils::tree_view_radio_toggle_cb (GtkCellRendererToggle *renderer,
+ gchar *path_str, GtkTreeModel *model)
+{
+ // Toggle the box
+ GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
+ gint *column = (gint*) g_object_get_data (G_OBJECT (renderer), "column");
+ GtkTreeIter iter;
+ gtk_tree_model_get_iter (model, &iter, path);
+ gtk_tree_path_free (path);
+
+ // Disable radio buttons from the same parent
+ GtkTreeIter parent_iter, child_iter;
+ if (gtk_tree_model_iter_parent (model, &parent_iter, &iter) &&
+ gtk_tree_model_iter_children (model, &child_iter, &parent_iter)) {
+ do gtk_tree_store_set (GTK_TREE_STORE (model), &child_iter, column, FALSE, -1);
+ while (gtk_tree_model_iter_next (model, &child_iter));
+ gtk_tree_store_set (GTK_TREE_STORE (model), &iter, column, TRUE, -1);
+ }
+}
+
+gint YGUtils::sort_compare_cb (GtkTreeModel *model, GtkTreeIter *a,
+ GtkTreeIter *b, gpointer data)
+{
+ IMPL
+ gint col = GPOINTER_TO_INT (data);
+ gchar *str1 = 0, *str2 = 0;
+ gtk_tree_model_get (model, a, col, &str1, -1);
+ gtk_tree_model_get (model, b, col, &str2, -1);
+ gint cmp = 0;
+ if (str1 && str2)
+ cmp = YGUtils::strcmp (str1, str2);
+
+ if (str1)
+ g_free (str1);
+ if (str2)
+ g_free (str2);
+ return cmp;
+}
+
+static void header_clicked_cb (GtkTreeViewColumn *column, GtkTreeSortable *sortable)
+{
+ IMPL
+ GtkTreeViewColumn *last_sorted =
+ (GtkTreeViewColumn *) g_object_get_data (G_OBJECT (sortable), "last-sorted");
+ int id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (column), "id"));
+
+ GtkSortType sort = GTK_SORT_ASCENDING;
+ if (last_sorted != column) {
+ if (last_sorted)
+ gtk_tree_view_column_set_sort_indicator (last_sorted, FALSE);
+ gtk_tree_view_column_set_sort_indicator (column, TRUE);
+ g_object_set_data (G_OBJECT (sortable), "last-sorted", column);
+ }
+ else {
+ sort = gtk_tree_view_column_get_sort_order (column);
+ sort = sort == GTK_SORT_ASCENDING ? GTK_SORT_DESCENDING : GTK_SORT_ASCENDING;
+ }
+
+ gtk_tree_view_column_set_sort_order (column, sort);
+ gtk_tree_sortable_set_sort_column_id (sortable, id, sort);
+}
+
+void YGUtils::tree_view_set_sortable (GtkTreeView *view, int default_sort_col)
+{
+ IMPL
+ g_assert (gtk_tree_view_get_headers_visible (view));
+
+ /* Set all string columns clickable. */
+ GtkTreeSortable *sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model (view));
+ // we need a pointer, this function is used by different stuff, so to we'll
+ // use g_object_*_data() to do of garbage collector
+ g_object_set_data (G_OBJECT (sortable), "last-sorted", NULL);
+
+ GList *columns = gtk_tree_view_get_columns (view);
+ for (GList *i = g_list_first (columns); i; i = i->next) {
+ GtkTreeViewColumn *column = (GtkTreeViewColumn *) i->data;
+ int col_nb = g_list_position (columns, i);
+
+ // check if it really is a string column
+ bool string_col = false;
+ GList *renderers = gtk_tree_view_column_get_cell_renderers (column);
+ for (GList *j = g_list_first (renderers); j; j = j->next)
+ if (GTK_IS_CELL_RENDERER_TEXT (j->data)) {
+ string_col = true;
+ break;
+ }
+ g_list_free (renderers);
+ if (!string_col)
+ continue;
+
+ // set sortable and clickable
+ gtk_tree_sortable_set_sort_func (sortable, col_nb, sort_compare_cb,
+ GINT_TO_POINTER (col_nb), NULL);
+ g_object_set_data (G_OBJECT (column), "id", GINT_TO_POINTER (col_nb));
+ gtk_tree_view_column_set_clickable (column, TRUE);
+ g_signal_connect (G_OBJECT (column), "clicked",
+ G_CALLBACK (header_clicked_cb), sortable);
+ if (col_nb == default_sort_col)
+ header_clicked_cb (column, sortable);
+ }
+ g_list_free (columns);
+}
+
+GValue YGUtils::floatToGValue (float num)
+{
+ GValue value = { 0 };
+ g_value_init (&value, G_TYPE_FLOAT);
+ g_value_set_float (&value, num);
+ return value;
+}
+
+#define SCROLLING_TIME 700
+#define SCROLLING_STEP 100
+struct ScrollData {
+ int orix, oriy, diffx, diffy, time;
+ GtkTreeView *view;
+};
+
+static gboolean scroll_timeout (gpointer _data) {
+ ScrollData *data = (ScrollData *) _data;
+ data->time += SCROLLING_STEP;
+
+ int x = data->orix + data->diffx;
+ int y = ((data->diffy * data->time) / SCROLLING_TIME) + data->oriy;
+
+ gtk_tree_view_scroll_to_point (data->view, x, y);
+ return data->time < SCROLLING_TIME;
+}
+
+void YGUtils::tree_view_smooth_scroll_to_point (GtkTreeView *view, gint x, gint y) {
+ GdkRectangle rect;
+ gtk_tree_view_get_visible_rect (view, &rect);
+ if (rect.x == x && rect.y == y)
+ return;
+
+ ScrollData *data = (ScrollData *) g_malloc (sizeof (ScrollData));
+ data->orix = rect.x;
+ data->oriy = rect.y;
+ data->diffx = x - rect.x;
+ data->diffy = y - rect.y;
+ data->time = 0;
+ data->view = view;
+
+ static int id = 0;
+ if (id)
+ g_source_remove (id);
+ id = g_timeout_add_full (G_PRIORITY_DEFAULT, SCROLLING_STEP, scroll_timeout, data, g_free);
+}
+
+#define ENGLISH_STOCK_ITEMS
+
+#ifdef ENGLISH_STOCK_ITEMS
+struct StockMap { const char *ycp_label, *gtk_stock; };
+static const StockMap stockMap[] = {
+ // keep them sorted!
+ {"Abort", GTK_STOCK_CANCEL },
+ {"Accept", GTK_STOCK_APPLY },
+ {"Add", GTK_STOCK_ADD },
+ {"Back", GTK_STOCK_GO_BACK },
+ {"Cancel", GTK_STOCK_CANCEL },
+ {"Configure", GTK_STOCK_PREFERENCES },
+ {"Continue", GTK_STOCK_OK },
+ {"Delete", GTK_STOCK_DELETE },
+ {"Down", GTK_STOCK_GO_DOWN },
+ {"Edit", GTK_STOCK_EDIT },
+ {"Launch", GTK_STOCK_EXECUTE },
+ {"Next", GTK_STOCK_GO_FORWARD },
+ {"No", GTK_STOCK_NO },
+ {"OK", GTK_STOCK_OK },
+ {"Quit", GTK_STOCK_QUIT },
+ {"Search", GTK_STOCK_FIND },
+ {"Up", GTK_STOCK_GO_UP },
+ {"Yes", GTK_STOCK_YES },
+};
+#define STOCKMAP_SIZE (sizeof (stockMap)/sizeof(StockMap))
+static int strcmp_cb (const void *a, const void *b)
+{ return strcmp ((char *) a, ((StockMap *) b)->ycp_label); }
+
+void YGUtils::setStockIcon (GtkWidget *button, std::string ycp_str)
+{
+ // is English the current locale?
+ static bool firstTime = true, isEnglish;
+ if (firstTime) {
+ char *lang = getenv ("LANG");
+ isEnglish = !lang || (!*lang) || !strcmp (lang, "C") ||
+ (lang[0] == 'e' && lang[1] == 'n') ||
+ !strcmp (lang, "POSIX");
+ firstTime = false;
+ }
+ if (!isEnglish)
+ return;
+
+ unsigned int i = 0;
+ while ((i = ycp_str.find ('_', i)) != string::npos)
+ ycp_str.erase (i, 1);
+
+ bool failed = true;
+ void *ptr;
+ ptr = bsearch (ycp_str.c_str(), stockMap, STOCKMAP_SIZE,
+ sizeof(stockMap[0]), strcmp_cb);
+ if (ptr) {
+ const char *stock = ((StockMap *) ptr)->gtk_stock;
+ GdkPixbuf *pixbuf;
+ pixbuf = gtk_widget_render_icon (button, stock,
+ GTK_ICON_SIZE_BUTTON, NULL);
+ if (pixbuf) {
+ GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ g_object_unref (G_OBJECT (pixbuf));
+ failed = false;
+ }
+ }
+ if (failed)
+ gtk_button_set_image (GTK_BUTTON (button), NULL);
+}
+
+void ygutils_setStockIcon (GtkWidget *button, const char *ycp_str)
+{ YGUtils::setStockIcon (button, ycp_str); }
+
+#else
+void ygutils_setStockIcon (GtkWidget *button, const char *ycp_str) {}
+#endif
+
Added: trunk/gtk/10_3/src/YGUtils.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGUtils.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGUtils.h (added)
+++ trunk/gtk/10_3/src/YGUtils.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,103 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#ifndef YGUTILS_H
+#define YGUTILS_H
+
+#include <string>
+#include <list>
+#include
+#include
+#include
+#include
+#include
+
+// TODO: do a cleanup here. We should probably split string, gtk and stuff
+// Some GtkTreeView should probably go to their own files
+// Let's avoid GTK+ stuff, better to replicate that, if needed, than leave in
+// this general purpose utils.
+
+/* YGUtils.h/cc have some functionality that is shared between different parts
+ of the code. */
+
+namespace YGUtils
+{
+ /* Replaces Yast's '&' accelerator by Gnome's '_' (and proper escaping). */
+ std::string mapKBAccel (const char *src);
+
+ /* Filters characters that are not on the valids_chars array from the text string
+ Length is used to tell the length of text, in case it isn't NUL
+ terminated (you may pass -1, if it is).
+ Use the compare string member if you want to see if there was any change. */
+ std::string filterText (const char* text, int length, const char* valid_chars);
+
+ /* Convenience call for widgets that implement GtkEditable interface.
+ This function inserts and deletes text, if needed, so you may want
+ to block those signals, if you have them set. */
+ void filterText (GtkEditable *editable, int pos, int length,
+ const char *valid_chars);
+
+ /* Replaces every 'mouth' by 'food' in 'str'. */
+ void replace (std::string &str, const char *mouth, int mouth_len, const char *food);
+
+ /* Escapes markup text (eg. changes '<' by '\<'). */
+ void escapeMarkup (std::string &str);
+
+ /* Adds functionality to GtkTextView to scroll to bottom. */
+ void scrollTextViewDown(GtkTextView *text_view);
+
+ /* Returns the average width of the given number of characters in pixels. */
+ int getCharsWidth (GtkWidget *widget, int chars_nb);
+ int getCharsHeight (GtkWidget *widget, int chars_nb);
+
+ /* Sets some widget font proprities. */
+ void setWidgetFont (GtkWidget *widget, PangoWeight weight, double scale);
+
+ /* A more sane strcmp() from the user point of view that honors numbers.
+ i.e. "20" < "100" */
+ int strcmp (const char *str1, const char *str2);
+
+ /* Checks if a std::string contains some other string (case insensitive). */
+ bool contains (const std::string &haystack, const std::string &needle);
+
+ /* Splits a string into parts as separated by the separator characters.
+ eg: splitString ("Office/Writer", '/') => { "Office", "Writer" } */
+ std::list splitString (const std::string &str, char separator);
+
+ /* Prints a GtkTreeModel for debugging purposes. */
+ void print_model (GtkTreeModel *model, int string_col);
+
+ /* To be used as a callback to sort tree views. */
+ gint sort_compare_cb (GtkTreeModel *model, GtkTreeIter *a,
+ GtkTreeIter *b, gpointer data);
+
+ /* To be used as a callback for a GtkTreeView with toggle cells. */
+ void tree_view_radio_toggle_cb (GtkCellRendererToggle *renderer,
+ gchar *path_str, GtkTreeModel *model);
+
+ /* Goes through all GtkTreeView columns and checks for TextCellRenderers,
+ setting those columns as sortable. */
+ void tree_view_set_sortable (GtkTreeView *view, int default_sort_col);
+
+ /* Like gtk_tree_view_scroll_to_point(), but does smooth scroll. */
+ void tree_view_smooth_scroll_to_point (GtkTreeView *view, gint x, gint y);
+
+ /* Converts stuff to GValues */
+ GValue floatToGValue (float num);
+
+ void setStockIcon (GtkWidget *button, std::string ycp_str);
+};
+
+extern "C" {
+ int ygutils_getCharsWidth (GtkWidget *widget, int chars_nb);
+ int ygutils_getCharsHeight (GtkWidget *widget, int chars_nb);
+ void ygutils_setWidgetFont (GtkWidget *widget, PangoWeight weight, double scale);
+
+ /* Convert html to xhtml (or at least try) */
+ gchar *ygutils_convert_to_xhmlt_and_subst (const char *instr, const char *product);
+ void ygutils_setStockIcon (GtkWidget *button, const char *ycp_str);
+};
+
+#endif // YGUTILS_H
+
Added: trunk/gtk/10_3/src/YGWidget.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGWidget.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGWidget.cc (added)
+++ trunk/gtk/10_3/src/YGWidget.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,313 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include "YGWidget.h"
+#include "YGUtils.h"
+#include "ygtkratiobox.h"
+
+// default widgets border -- may be overlapped with a setBorder(..)
+#define DEFAULT_BORDER 6
+#define LABEL_WIDGET_SPACING 4
+
+/* YGWidget follows */
+
+YGWidget::YGWidget(YWidget *y_widget, YGWidget *parent, bool show,
+ GtkType type, const char *property_name, ...)
+ : m_y_widget (y_widget)
+{
+ va_list args;
+ va_start (args, property_name);
+ construct (y_widget, parent, show, type, property_name, args);
+ va_end (args);
+}
+
+void YGWidget::construct (YWidget *y_widget, YGWidget *parent, bool _show,
+ GType type, const char *property_name, va_list args)
+{
+ m_widget = GTK_WIDGET (g_object_new_valist (type, property_name, args));
+
+ if (type == GTK_TYPE_WINDOW)
+ m_adj_size = m_widget;
+ else {
+ m_adj_size = ygtk_adj_size_new();
+ g_object_ref_sink (G_OBJECT (m_adj_size));
+ gtk_widget_show (m_adj_size);
+ gtk_container_add (GTK_CONTAINER (m_adj_size), m_widget);
+ }
+
+ y_widget->setWidgetRep ((void *) this);
+ if (parent)
+ y_widget->setParent (parent->m_y_widget);
+
+#ifdef IMPL_DEBUG
+ fprintf (stderr, "Set YWidget %p rep to %p\n", y_widget, this);
+#endif
+
+ // Split by two so that with another widget it will have full border...
+ setBorder (DEFAULT_BORDER / 2);
+
+ if (_show)
+ show();
+}
+
+YGWidget::~YGWidget()
+{
+ IMPL
+ gtk_widget_destroy (m_adj_size);
+ g_object_unref (G_OBJECT (m_adj_size));
+}
+
+void YGWidget::show()
+{
+ gtk_widget_show (m_widget);
+}
+
+YGWidget *YGWidget::get (YWidget *y_widget)
+{
+ if (!y_widget || !y_widget->widgetRep()) {
+#ifdef IMPL_DEBUG
+ if (y_widget)
+ fprintf (stderr, "Widget '%s' (label: '%s') not supported\n",
+ y_widget->widgetClass(), y_widget->debugLabel().c_str());
+ else
+ fprintf (stderr, "YGWidget::get() on null\n");
+#endif
+ return NULL;
+ }
+ return (YGWidget *) (y_widget->widgetRep());
+}
+
+bool YGWidget::doSetKeyboardFocus()
+{
+ IMPL
+ gtk_widget_grab_focus (GTK_WIDGET (getWidget()));
+ return gtk_widget_is_focus (GTK_WIDGET (getWidget()));
+}
+
+void YGWidget::doSetEnabling (bool enabled)
+{
+ gtk_widget_set_sensitive (getWidget(), enabled);
+}
+
+void YGWidget::emitEvent(YEvent::EventReason reason, bool if_notify,
+ bool if_not_pending, bool immediate)
+{
+ struct inner
+ {
+ static gboolean dispatchEvent (gpointer data)
+ {
+ YWidgetEvent *event = (YWidgetEvent *) data;
+ if (!YGUI::ui()->eventPendingFor (event->widget()))
+ YGUI::ui()->sendEvent (event);
+ return FALSE;
+ }
+ };
+
+ if (!if_notify || m_y_widget->getNotify())
+ {
+ if (!immediate)
+ g_timeout_add (250, inner::dispatchEvent, new YWidgetEvent (m_y_widget, reason));
+ else if (!if_not_pending || !YGUI::ui()->eventPendingFor (m_y_widget))
+ {
+ if (immediate)
+ YGUI::ui()->sendEvent (new YWidgetEvent (m_y_widget, reason));
+ }
+ }
+}
+
+void YGWidget::setBorder (unsigned int border)
+{
+ IMPL
+ gtk_container_set_border_width (GTK_CONTAINER (m_adj_size), border);
+}
+
+void YGWidget::setMinSize (unsigned int width, unsigned int height)
+{
+ IMPL
+ ygtk_adj_size_set_min (YGTK_ADJ_SIZE (m_adj_size), width, height);
+}
+
+void YGWidget::setMinSizeInChars (unsigned int width, unsigned int height)
+{
+ IMPL
+ if (width)
+ width = YGUtils::getCharsWidth (getWidget(), width);
+ if (height)
+ height = YGUtils::getCharsHeight (getWidget(), height);
+ setMinSize (width, height);
+}
+
+void YGWidget::sync_stretchable (YWidget *child)
+{
+ IMPL
+ YWidget *parent = m_y_widget->yParent();
+ if (parent)
+ // tell parent to sync too!
+ YGWidget::get (parent)->sync_stretchable (m_y_widget);
+}
+
+// JEEZ. WHEN the hell will yast-ui code fix their damn code.
+#if 1
+/* Checks everywhere in a container to see if there are children (so
+ he is completely initialized) so that we may ask him for stretchable()
+ because some YContainerWidgets crash when they don't have children. */
+#include "YSplit.h"
+static bool safe_stretchable (YWidget *widget)
+{
+ YContainerWidget *container = dynamic_cast (widget);
+ if (container) {
+ YSplit *split = dynamic_cast (widget);
+ // in the case of YSplit its safe to ask for stretchability with no kids
+ if (split) {
+ if (!split->hasChildren())
+ return true;
+ }
+ else
+ if (!container->hasChildren())
+ return false;
+
+ for (int i = 0; i < container->numChildren(); i++)
+ if (!safe_stretchable (container->child (i)))
+ return false;
+ }
+ return true;
+}
+#else
+static bool safe_stretchable (YWidget *widget)
+{
+ return true;
+}
+#endif
+
+bool YGWidget::isStretchable (YUIDimension dim)
+{
+ if (safe_stretchable (m_y_widget))
+ return m_y_widget->stretchable (dim);
+ return false;
+}
+
+/* YGLabeledWidget follows */
+
+YGLabeledWidget::YGLabeledWidget (YWidget *y_widget, YGWidget *parent,
+ YCPString label_text, YUIDimension label_ori,
+ bool show, GType type,
+ const char *property_name, ...)
+ : YGWidget (y_widget, parent, show,
+ label_ori == YD_VERT ? GTK_TYPE_VBOX : GTK_TYPE_HBOX,
+ "spacing", LABEL_WIDGET_SPACING, NULL)
+{
+ // Create the field widget
+ va_list args;
+ va_start (args, property_name);
+ m_field = GTK_WIDGET (g_object_new_valist (type, property_name, args));
+ va_end (args);
+
+ // Create the label
+ m_label = gtk_label_new ("");
+ gtk_misc_set_alignment (GTK_MISC (m_label), 0.0, 0.5);
+ if (label_ori == YD_HORIZ)
+ gtk_label_set_line_wrap (GTK_LABEL (m_label), TRUE);
+ if(show) {
+ gtk_widget_show (m_label);
+ gtk_widget_show (m_field);
+ }
+
+ setBuddy (m_field);
+ doSetLabel (label_text);
+
+ // Set the container and show widgets
+ gtk_box_pack_start (GTK_BOX (m_widget), m_label, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (m_widget), m_field, TRUE, TRUE, 0);
+ m_orientation = label_ori;
+}
+
+void YGLabeledWidget::setLabelVisible (bool show)
+{
+ if (show)
+ gtk_widget_show (m_label);
+ else
+ gtk_widget_hide (m_label);
+}
+
+void YGLabeledWidget::setBuddy (GtkWidget *widget)
+{
+ gtk_label_set_mnemonic_widget (GTK_LABEL (m_label), widget);
+}
+
+void YGLabeledWidget::doSetLabel (const YCPString &label)
+{
+ string str = YGUtils::mapKBAccel (label->value_cstr());
+ if (str.empty()) {
+ gtk_widget_hide (m_label);
+ }
+ else {
+ gtk_widget_show (m_label);
+
+ // add a ':' at the end
+ int last = str.length()-1;
+ if (str [last] != ':' && str [last] != '.' && str [last] != ' ')
+ str += ':';
+
+ // set it as upper case
+ unsigned int first = (str [0] == '_') ? 1 : 0;
+ if (str [first] >= 'a' && str [first] <= 'z')
+ str [first] += 'A' - 'a';
+
+ gtk_label_set_text (GTK_LABEL (m_label), str.c_str());
+ gtk_label_set_use_underline (GTK_LABEL (m_label), TRUE);
+ }
+}
+
+/* YGScrolledWidget follows */
+#define MAX_SCROLL_WIDTH 120
+
+YGScrolledWidget::YGScrolledWidget (YWidget *y_widget, YGWidget *parent,
+ bool show, GType type,
+ const char *property_name, ...)
+ : YGLabeledWidget (y_widget, parent, YCPString (""), YD_VERT, show,
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW, "shadow-type", GTK_SHADOW_IN, NULL)
+{
+ va_list args;
+ va_start (args, property_name);
+ construct(type, property_name, args);
+ va_end (args);
+
+ setLabelVisible (false);
+}
+
+YGScrolledWidget::YGScrolledWidget (YWidget *y_widget, YGWidget *parent,
+ YCPString label_text, YUIDimension label_ori,
+ bool show, GType type,
+ const char *property_name, ...)
+ : YGLabeledWidget (y_widget, parent, label_text, label_ori, show,
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW, "shadow-type", GTK_SHADOW_IN, NULL)
+{
+ va_list args;
+ va_start (args, property_name);
+ construct(type, property_name, args);
+ va_end (args);
+}
+
+void YGScrolledWidget::construct (GType type, const char *property_name,
+ va_list args)
+{
+ m_widget = GTK_WIDGET (g_object_new_valist (type, property_name, args));
+ setBuddy (m_widget);
+
+ setPolicy (GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (YGLabeledWidget::getWidget()), m_widget);
+ gtk_widget_show (m_widget);
+}
+
+void YGScrolledWidget::setPolicy (GtkPolicyType hpolicy, GtkPolicyType vpolicy)
+{
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (YGLabeledWidget::getWidget()),
+ hpolicy, vpolicy);
+ ygtk_tuned_scrolled_window_set_auto_policy (
+ YGTK_TUNED_SCROLLED_WINDOW (YGLabeledWidget::getWidget()),
+ hpolicy == GTK_POLICY_AUTOMATIC ? MAX_SCROLL_WIDTH : 0, 0);
+}
+
Added: trunk/gtk/10_3/src/YGWidget.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGWidget.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGWidget.h (added)
+++ trunk/gtk/10_3/src/YGWidget.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,151 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#ifndef YGWIDGET_H
+#define YGWIDGET_H
+
+#include
+#include
+#include "YGUI.h"
+#include "YEvent.h"
+
+class YGWidget
+{
+public:
+ YGWidget(YWidget *y_widget, YGWidget *parent, bool show,
+ GType type, const char *property_name, ...);
+ virtual ~YGWidget();
+
+ virtual GtkWidget *getWidget() { return m_widget; }
+ const char *getWidgetName() const
+ { return const_cast (m_y_widget)->widgetClass(); }
+ // YWidget::debugLabel() sucks for most widgets -- let's allow it to be overload
+ virtual string getDebugLabel() const
+ { // container debug labels are worse than useless
+ if (dynamic_cast (m_y_widget) == NULL)
+ return const_cast (m_y_widget)->debugLabel(); return string(); }
+ void show();
+
+ // containers should use this call rather than getWidget()
+ GtkWidget *getLayout() { return m_adj_size; }
+
+ // Get the YGWidget associated with a YWidget
+ static YGWidget *get (YWidget *y_widget);
+
+ // for YWidget
+ virtual bool doSetKeyboardFocus();
+ virtual void doSetEnabling (bool enabled);
+
+ // Event handling
+ void emitEvent(YEvent::EventReason reason, bool if_notify = true,
+ bool if_not_pending = false, bool immediate = true);
+
+ // Aesthetics
+ void setBorder (unsigned int border); // in pixels
+ void setMinSize (unsigned int min_width, unsigned int min_height);
+ void setMinSizeInChars (unsigned int min_width, unsigned int min_height);
+
+ // whenever the stretchable property may change (eg. when adding a child
+ // for a container), call this function to make sure it is honored.
+ virtual void sync_stretchable (YWidget *child = 0);
+
+ // should be used instead of YWidget::stretchable() as this has some safeguards
+ // against crashes that some YContainerWidgets lead to
+ bool isStretchable (YUIDimension dim);
+
+protected:
+ GtkWidget *m_widget; // associated GtkWidget -- use getWidget()
+ YWidget *m_y_widget; // associated YWidget
+ GtkWidget *m_adj_size; // installed on m_widget, allows better size constrains
+
+ void construct (YWidget *y_widget, YGWidget *parent,
+ bool show, GType type,
+ const char *property_name, va_list args);
+};
+
+/*
+ * Macros to help implement proxies between common YWidget virtual
+ * methods and the (multiply inherited) YGWidget base implementation
+ * for GTK+.
+ */
+#define YGWIDGET_IMPL_COMMON \
+ virtual bool setKeyboardFocus() \
+ { return doSetKeyboardFocus(); } \
+ virtual void setEnabling (bool enabled) \
+ { doSetEnabling (enabled); } \
+ virtual long nicesize (YUIDimension dim) { return 0; } \
+ virtual void moveChild (YWidget *child, long x, long y) {} \
+ virtual void setSize (long width, long height) {}
+
+// for containers
+// We can't use childAdded, since some classes don't want this called
+// for some children.
+#define YGWIDGET_IMPL_CHILD_ADDED(container) \
+ virtual void addChild (YWidget *ychild) { \
+ YContainerWidget::addChild (ychild); \
+ GtkWidget *child = YGWidget::get (ychild)->getLayout(); \
+ gtk_container_add (GTK_CONTAINER (container), child); \
+ sync_stretchable(); \
+ }
+#define YGWIDGET_IMPL_CHILD_REMOVED(container) \
+ virtual void childRemoved (YWidget *ychild) { \
+ GtkWidget *child = YGWidget::get (ychild)->getLayout(); \
+ gtk_container_remove (GTK_CONTAINER (container), child); \
+ }
+
+/* This is a convenience class that allows for a label next to the
+ intended widget. It should be used, in case you have the need for
+ such, as it gives an uniform API. */
+class YGLabeledWidget : public YGWidget
+{
+ public:
+ YGLabeledWidget(YWidget *y_widget, YGWidget *parent,
+ YCPString label_text, YUIDimension label_ori,
+ bool show, GType type, const char *property_name, ...);
+ virtual ~YGLabeledWidget () {}
+
+ virtual GtkWidget* getWidget() { return m_field; }
+
+ void setLabelVisible(bool show);
+ void setBuddy (GtkWidget *widget);
+ virtual void doSetLabel (const YCPString &label);
+
+ YUIDimension orientation() { return m_orientation; }
+ GtkWidget *getLabelWidget() { return m_label; }
+
+ protected:
+ GtkWidget *m_label, *m_field;
+ YUIDimension m_orientation;
+};
+
+#define YGLABEL_WIDGET_IMPL_SET_LABEL_CHAIN(ParentClass) \
+ virtual void setLabel (const YCPString &label) { \
+ IMPL \
+ doSetLabel (label); \
+ ParentClass::setLabel (label); \
+ }
+
+/* This is a convenience class for widgets that need scrollbars. */
+class YGScrolledWidget : public YGLabeledWidget
+{
+ public:
+ YGScrolledWidget(YWidget *y_widget, YGWidget *parent,
+ bool show, GType type, const char *property_name, ...);
+ // if you want a label, use:
+ YGScrolledWidget(YWidget *y_widget, YGWidget *parent,
+ YCPString label_text, YUIDimension label_ori,
+ bool show, GType type, const char *property_name, ...);
+ virtual ~YGScrolledWidget () {}
+
+ virtual GtkWidget *getWidget() { return m_widget; }
+
+ // you should use this method, not gtk_scrolled_window_set...
+ void setPolicy (GtkPolicyType hpolicy, GtkPolicyType vpolicy);
+
+ protected:
+ void construct(GType type, const char *property_name, va_list args);
+ GtkWidget *m_widget;
+};
+
+#endif /*YGWIDGET_H*/
Added: trunk/gtk/10_3/src/YGWizard.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGWizard.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGWizard.cc (added)
+++ trunk/gtk/10_3/src/YGWizard.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,373 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include "YGWidget.h"
+#include "YGUtils.h"
+#include "ygtkwizard.h"
+#include "YWizard.h"
+#include "YPushButton.h"
+
+class YGWizard : public YWizard, public YGWidget
+{
+ bool m_verboseCommands;
+
+ /* YCP requires us to allow people to use YPushButton API on the wizard buttons.
+ Wizard already has handlers for them; this seems like bad design.
+
+ We could support wrapping right in our framework. One way, would be to subclass
+ YWidgetOpt to have a wrapping field where we would set a GtkWidget*. Then,
+ classes should pass opt to YGWidget and it would create a shallow instance
+ around it. However, this isn't really doable. The problem is that, like
+ in this case, the API isn't really exact; events must be sent as YWizard events.
+ */
+ struct YGWButton : public YPushButton {
+ /* Thin class; just changes the associated button label and keeps track
+ of id change. */
+ YGWButton (GtkWidget *widget, const YCPString &label, const YCPValue &id)
+ : YPushButton (YWidgetOpt(), label)
+ { m_widget = widget; setId (id); setLabel (label); }
+
+ void setLabel (const YCPString &label) {
+ string str = YGUtils::mapKBAccel (label->value_cstr());
+ gtk_button_set_label (GTK_BUTTON (m_widget), str.c_str());
+ str.empty() ? gtk_widget_hide (m_widget) : gtk_widget_show (m_widget);
+ YGUtils::setStockIcon (m_widget, str);
+ YPushButton::setLabel (label);
+ }
+
+ long nicesize (YUIDimension dim) { return 0; }
+ void setEnabling (bool enable) {
+ gtk_widget_set_sensitive (m_widget, enable);
+ YWidget::setEnabling (enable);
+ }
+
+ private:
+ GtkWidget *m_widget;
+ };
+
+ YGWButton *m_back_button, *m_abort_button, *m_next_button;
+ // release notes button would be a little more hassle to support; yast-qt
+ // doesn't support it too anyway.
+
+public:
+ YGWizard (const YWidgetOpt &opt, YGWidget *parent,
+ const YCPValue &backButtonId, const YCPString &backButtonLabel,
+ const YCPValue &abortButtonId, const YCPString &abortButtonLabel,
+ const YCPValue &nextButtonId, const YCPString &nextButtonLabel)
+ : YWizard (opt, backButtonId, backButtonLabel,
+ abortButtonId, abortButtonLabel,
+ nextButtonId, nextButtonLabel),
+ YGWidget (this, parent, true, YGTK_TYPE_WIZARD, NULL)
+ {
+ IMPL
+ setBorder (0);
+ m_verboseCommands = false;
+
+ //** Application area
+ {
+ // We set a YReplacePoint as child with a certain id and it will then be
+ // replaced by the actual content. We put a YEmpty on it because it would
+ // crash otherwise (stretchable() functions should really check for
+ // hasChildren() first!).
+
+ YWidgetOpt opt, stretchOpt;
+ stretchOpt.isHStretchable.setValue( true );
+ stretchOpt.isVStretchable.setValue( true );
+
+ YWidget *align, *rp, *empty;
+ align = YGUI::ui()->createAlignment (this, stretchOpt,
+ YAlignCenter, YAlignCenter);
+ rp = YGUI::ui()->createReplacePoint (align, opt);
+ rp->setId (YCPSymbol (YWizardContentsReplacePointID));
+ empty = YGUI::ui()->createEmpty (rp, opt);
+
+ ((YContainerWidget *) align)->addChild (rp);
+ ((YContainerWidget *) rp)->addChild (empty);
+ this->addChild (align);
+ }
+
+ YGtkWizard *ygtk_wizard = YGTK_WIZARD (getWidget());
+
+ //** Steps/tree pane
+ bool steps_enabled = opt.stepsEnabled.value();
+ bool tree_enabled = opt.treeEnabled.value();
+ if (steps_enabled && tree_enabled) {
+ y2error ("YGWizard doesn't support both steps and tree enabled at the "
+ "same time.\nDisabling the steps...");
+ steps_enabled = false;
+ }
+ if (steps_enabled)
+ ygtk_wizard_enable_steps (ygtk_wizard);
+ if (tree_enabled)
+ ygtk_wizard_enable_tree (ygtk_wizard);
+
+ //** Setting the bottom buttons
+ m_back_button = new YGWButton (ygtk_wizard->m_back_button, backButtonLabel,
+ backButtonId);
+ m_abort_button = new YGWButton (ygtk_wizard->m_abort_button, abortButtonLabel,
+ abortButtonId);
+ m_next_button = new YGWButton (ygtk_wizard->m_next_button, nextButtonLabel,
+ nextButtonId);
+ YContainerWidget::addChild (m_back_button);
+ YContainerWidget::addChild (m_abort_button);
+ YContainerWidget::addChild (m_next_button);
+
+ ygtk_wizard_set_back_button_ptr_id (ygtk_wizard, new YCPValue (backButtonId),
+ delete_data_cb);
+ ygtk_wizard_set_abort_button_ptr_id (ygtk_wizard, new YCPValue (abortButtonId),
+ delete_data_cb);
+ ygtk_wizard_set_next_button_ptr_id (ygtk_wizard, new YCPValue (nextButtonId),
+ delete_data_cb);
+
+ //** All event are sent through this signal together with an id
+ g_signal_connect (G_OBJECT (getWidget()), "action-triggered",
+ G_CALLBACK (action_triggered_cb), this);
+ }
+
+ virtual ~YGWizard()
+ {
+ // m_back/abort/next_button are added as children and will be freed by ~YContainerWidget
+ }
+
+ /* The purpose of this function is to do some sanity checks, besides
+ the simple test "cmd->name() == func".
+ args_type is a reverse hexadecimal number where
+ any = 0, string = 1, boolean = 2. */
+ static bool isCommand (const YCPTerm &cmd, const char *func,
+ guint args_nb, guint args_type)
+ {
+ if (cmd->name() == func) {
+ if ((unsigned) cmd->size() != args_nb) {
+ y2error ("YGWizard: expected %d arguments for the '%s' command. %d given.",
+ args_nb, func, cmd->size());
+ return false;
+ }
+
+ guint i, t;
+ for (i = 0, t = args_type; i < args_nb; i++, t >>= 4)
+ switch (t % 0x4) {
+ case 0x1:
+ if (!cmd->value(i)->isString()) {
+ y2error ("YGWizard: expected string as the %d argument for "
+ "the '%s' command.", i+1, func);
+ return false;
+ }
+ break;
+ case 0x2:
+ if (!cmd->value(i)->isBoolean()) {
+ y2error ("YGWizard: expected boolean as the %d argument for "
+ "the '%s' command.", i+1, func);
+ return false;
+ }
+ break;
+ }
+ return true;
+ }
+ return false;
+ }
+
+#define getStdStringArg(cmd, arg) (cmd->value(arg)->asString()->value())
+#define getCStringArg(cmd, arg) (cmd->value(arg)->asString()->value_cstr())
+#define getBoolArg(cmd, arg) (cmd->value(arg)->asBoolean()->value())
+#define getAnyArg(cmd, arg) (cmd->value(arg))
+
+ YCPValue command (const YCPTerm &cmd)
+ {
+ IMPL
+ if (m_verboseCommands)
+ y2milestone ("Processing wizard command: %s\n", cmd->name().c_str());
+
+ YGtkWizard *wizard = YGTK_WIZARD (getWidget());
+ if (isCommand (cmd, "SetHelpText", 1, 0x1))
+ ygtk_wizard_set_help_text (wizard, getCStringArg (cmd, 0));
+
+ else if (isCommand (cmd, "AddTreeItem", 3, 0x111)) {
+ if (!ygtk_wizard_add_tree_item (wizard, getCStringArg (cmd, 0),
+ getCStringArg (cmd, 1), getCStringArg (cmd, 2))) {
+ y2error ("YGWizard: there is no tree item with id '%s'",
+ getCStringArg (cmd, 0));
+ return YCPBoolean (false);
+ }
+ }
+ else if (isCommand (cmd, "DeleteTreeItems", 0, 0))
+ ygtk_wizard_clear_tree (wizard);
+ else if (isCommand (cmd, "SelectTreeItem", 1, 0x1)) {
+ if (!ygtk_wizard_select_tree_item (wizard, getCStringArg (cmd, 0))) {
+ y2error ("YGWizard: there is no tree item with id '%s'",
+ getCStringArg (cmd, 0));
+ return YCPBoolean (false);
+ }
+ }
+
+ else if (isCommand (cmd, "SetDialogHeading", 1, 0x1))
+ ygtk_wizard_set_header_text (wizard, YGUI::ui()->currentWindow(),
+ getCStringArg (cmd, 0));
+ else if (isCommand (cmd, "SetDialogIcon", 1, 0x1)) {
+ if (!ygtk_wizard_set_header_icon (wizard,
+ YGUI::ui()->currentWindow(), getCStringArg (cmd, 0))) {
+ y2warning ("YGWizard: could not load image: %s", getCStringArg (cmd, 0));
+// return YCPBoolean (false); - installer relies on this succeeding
+ }
+ }
+
+ else if (isCommand (cmd, "SetAbortButtonLabel", 1, 0x1) ||
+ isCommand (cmd, "SetCancelButtonLabel", 1, 0x1)) {
+ string str = YGUtils::mapKBAccel(getCStringArg (cmd, 0));
+ ygtk_wizard_set_abort_button_label (wizard, str.c_str());
+ }
+ else if (isCommand (cmd, "SetBackButtonLabel", 1, 0x1)) {
+ string str = YGUtils::mapKBAccel(getCStringArg (cmd, 0));
+ ygtk_wizard_set_back_button_label (wizard, str.c_str());
+ }
+ else if (isCommand (cmd, "SetNextButtonLabel", 1, 0x1) ||
+ isCommand (cmd, "SetAcceptButtonLabel", 1, 0x1)) {
+ string str = YGUtils::mapKBAccel(getCStringArg (cmd, 0));
+ ygtk_wizard_set_next_button_label (wizard, str.c_str());
+ }
+
+ else if (isCommand (cmd, "SetAbortButtonID", 1, 0x0)) {
+ YCPValue *id = new YCPValue (getAnyArg (cmd, 0));
+ ygtk_wizard_set_abort_button_ptr_id (wizard, id, delete_data_cb);
+ m_abort_button->setId (*id);
+ }
+ else if (isCommand (cmd, "SetBackButtonID", 1, 0x0)) {
+ YCPValue *id = new YCPValue (getAnyArg (cmd, 0));
+ ygtk_wizard_set_back_button_ptr_id (wizard, id, delete_data_cb);
+ m_back_button->setId (*id);
+ }
+ else if (isCommand (cmd, "SetNextButtonID", 1, 0x0)) {
+ YCPValue *id = new YCPValue (getAnyArg (cmd, 0));
+ ygtk_wizard_set_next_button_ptr_id (wizard, id, delete_data_cb);
+ m_next_button->setId (*id);
+ }
+
+ else if (isCommand (cmd, "EnableAbortButton", 1, 0x2))
+ ygtk_wizard_enable_abort_button (wizard, getBoolArg (cmd, 0));
+ else if (isCommand (cmd, "EnableBackButton", 1, 0x2))
+ ygtk_wizard_enable_back_button (wizard, getBoolArg (cmd, 0));
+ else if (isCommand (cmd, "EnableNextButton", 1, 0x2))
+ ygtk_wizard_enable_next_button (wizard, getBoolArg (cmd, 0));
+
+ else if (isCommand (cmd, "ProtectNextButton", 1, 0x2))
+ ygtk_wizard_protect_next_button (wizard, getBoolArg (cmd, 0));
+
+ else if (isCommand (cmd, "SetFocusToNextButton", 0, 0))
+ ygtk_wizard_focus_next_button (wizard);
+ else if (isCommand (cmd, "SetFocusToBackButton", 0, 0))
+ ygtk_wizard_focus_back_button (wizard);
+
+ else if (isCommand (cmd, "AddMenu", 2, 0x11)) {
+ string str = YGUtils::mapKBAccel(getCStringArg (cmd, 0));
+ ygtk_wizard_add_menu (wizard, str.c_str(), getCStringArg (cmd, 1));
+ }
+ else if (isCommand (cmd, "AddMenuEntry", 3, 0x111)) {
+ string str = YGUtils::mapKBAccel(getCStringArg (cmd, 1));
+ if (!ygtk_wizard_add_menu_entry (wizard, getCStringArg (cmd, 0),
+ str.c_str(), getCStringArg (cmd, 2))) {
+ y2error ("YGWizard: there is no menu item with id '%s'",
+ getCStringArg (cmd, 0));
+ return YCPBoolean (false);
+ }
+ }
+ else if (isCommand (cmd, "AddSubMenu", 3, 0x111)) {
+ string str = YGUtils::mapKBAccel(getCStringArg (cmd, 1));
+ if (!ygtk_wizard_add_sub_menu (wizard, getCStringArg (cmd, 0),
+ str.c_str(), getCStringArg (cmd, 2))) {
+ y2error ("YGWizard: there is no menu item with id '%s'",
+ getCStringArg (cmd, 0));
+ return YCPBoolean (false);
+ }
+ }
+ else if (isCommand (cmd, "AddMenuSeparator", 3, 0x111)) {
+ if (!ygtk_wizard_add_menu_separator (wizard, getCStringArg (cmd, 0))) {
+ y2error ("YGWizard: there is no menu item with id '%s'",
+ getCStringArg (cmd, 0));
+ return YCPBoolean (false);
+ }
+ }
+
+ else if (isCommand (cmd, "SetVerboseCommands", 1, 0x2))
+ m_verboseCommands = getBoolArg (cmd, 0);
+ else if (isCommand (cmd, "Ping", 0, 0))
+ y2debug ("YGWizard is active");
+
+ else if (isCommand (cmd, "AddStepHeading", 1, 0x1))
+ ygtk_wizard_add_step_header (wizard, getCStringArg (cmd, 0));
+ else if (isCommand (cmd, "AddStep", 2, 0x11))
+ ygtk_wizard_add_step (wizard, getCStringArg (cmd, 0), getCStringArg (cmd, 1));
+ else if (isCommand (cmd, "SetCurrentStep", 1, 0x1)) {
+ if (!ygtk_wizard_set_current_step (wizard, getCStringArg (cmd, 0))) {
+ y2error ("YGWizard: there is no step with id %s.", getCStringArg (cmd, 0));
+ return YCPBoolean (false);
+ }
+ }
+ else if (isCommand (cmd, "UpdateSteps", 0, 0))
+ ;
+ else if (isCommand (cmd, "DeleteSteps", 0, 0))
+ ygtk_wizard_clear_steps (wizard);
+
+ else if (isCommand (cmd, "ShowReleaseNotesButton", 2, 0x01)) {
+ string label = YGUtils::mapKBAccel(getCStringArg (cmd, 0));
+ ygtk_wizard_set_release_notes_button_label (wizard, label.c_str());
+ ygtk_wizard_set_release_notes_button_ptr_id (wizard,
+ new YCPValue (getAnyArg (cmd, 1)), delete_data_cb);
+ }
+ else if (isCommand (cmd, "HideReleaseNotesButton", 0, 0))
+ ygtk_wizard_show_release_notes_button (wizard, FALSE);
+
+ else if (isCommand (cmd, "RetranslateInternalButtons", 0, 0))
+ ; // we don't need this as we don't use switch buttons
+
+ else {
+ y2error ("Unsupported wizard command (or invalid arguments): %s\n",
+ cmd->name().c_str());
+ return YCPBoolean (false);
+ }
+ return YCPBoolean (true);
+ }
+
+ virtual YCPString currentTreeSelection()
+ {
+ YGtkWizard *wizard = YGTK_WIZARD (getWidget());
+ const char *selected = ygtk_wizard_get_tree_selection (wizard);
+ if (selected)
+ return YCPString (selected);
+ return YCPString ("");
+ }
+
+ static void action_triggered_cb (YGtkWizard *wizard, gpointer id,
+ gint id_type, YGWizard *pThis)
+ {
+ IMPL
+ if ((GType) id_type == G_TYPE_STRING) {
+ YCPString _id ((char *) id);
+ YGUI::ui()->sendEvent (new YMenuEvent (YCPValue (_id)));
+ }
+ else
+ YGUI::ui()->sendEvent (new YMenuEvent (*((YCPValue *) id)));
+ }
+
+ static void delete_data_cb (gpointer data)
+ { delete (YCPValue*) data; }
+
+
+ YGWIDGET_IMPL_COMMON
+ YGWIDGET_IMPL_CHILD_ADDED (getWidget())
+ YGWIDGET_IMPL_CHILD_REMOVED (getWidget())
+};
+
+YWidget *
+YGUI::createWizard (YWidget *parent, YWidgetOpt &opt,
+ const YCPValue &backButtonId, const YCPString &backButtonLabel,
+ const YCPValue &abortButtonId, const YCPString &abortButtonLabel,
+ const YCPValue &nextButtonId, const YCPString &nextButtonLabel)
+{
+ return new YGWizard (opt, YGWidget::get (parent),
+ backButtonId, backButtonLabel,
+ abortButtonId, abortButtonLabel,
+ nextButtonId, nextButtonLabel);
+}
Added: trunk/gtk/10_3/src/YGi18n.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/YGi18n.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/YGi18n.h (added)
+++ trunk/gtk/10_3/src/YGi18n.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,38 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE GmbH |
+\----------------------------------------------------------------------/
+
+ File: YGi18n.h
+
+ Author: Jiri Srain
+
+/-*/
+
+// -*- c++ -*-
+
+#ifndef YGi18n_h
+#define YGi18n_h
+
+#include
+
+
+inline const char * _( const char * msgid )
+{
+ return ( !msgid || !*msgid ) ? "" : gettext(msgid );
+}
+
+inline const char * _( const char * msgid1, const char * msgid2, unsigned long int n )
+{
+ return ngettext(msgid1, msgid2, n );
+}
+
+
+#endif // YGi18n_h
Added: trunk/gtk/10_3/src/dummy
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/dummy?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/dummy (added)
+++ trunk/gtk/10_3/src/dummy Fri Jan 18 12:58:22 2008
@@ -0,0 +1,131 @@
+#! /bin/sh
+
+# dummy - temporary wrapper script for .libs/dummy
+# Generated by ltmain.sh - GNU libtool 1.5.24 (1.1220.2.455 2007/06/24 02:13:29)
+#
+# The dummy program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='/usr/bin/sed -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command="(cd /home/rick2/Documents/yast/gtk/10_3/src; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=\"/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/lib/qt3/bin\"; export PATH; g++ -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -DY2LOG=\\\"ui-gtk\\\" -DTHEMEDIR=\\\"/usr/share/YaST2/theme/current\\\" -g -O2 -Wall -Wformat=2 -o \$progdir/\$file dummy.o ./.libs/libpy2gtk.so -L/usr/lib/YaST2/plugin /usr/lib/YaST2/plugin/libpy2UI.so -L/usr/lib /usr/lib/libycp.so /usr/lib/libxcrypt.so /usr/lib/libycpvalues.so /usr/lib/liby2.so /usr/lib/liby2util.so -lcrypto /usr/lib/libxml2.so -lssl -lutil -lblocxx /usr/lib/libgtk-x11-2.0.so /usr/lib/libgdk-x11-2.0.so /usr/lib/libatk-1.0.so /usr/lib/libgdk_pixbuf-2.0.so -lpangocairo-1.0 -lpango-1.0 /usr/lib/libcairo.so /usr/lib/libfontconfig.so /usr/lib/libfreetype.so -lexpat /usr/lib/libglitz.so /usr/lib/libpng12.so -lz /usr/lib/libxcb-render-util.so /usr/lib/libxcb-render.so /usr/lib/libXrender.so /usr/lib/libX11.so /usr/lib/libxcb-xlib.so /usr/lib/libxcb.so /usr/lib/libXau.so /usr/lib/libgmodule-2.0.so -ldl /usr/lib/libgthread-2.0.so -lpthread -lrt /usr/lib/libgobject-2.0.so /usr/lib/libglib-2.0.so /usr/lib/libpcre.so -lzypp -Wl,--rpath -Wl,/home/rick2/Documents/yast/gtk/10_3/src/.libs -Wl,--rpath -Wl,/usr/lib/YaST2/plugin -Wl,--rpath -Wl,/usr/lib/YaST2/plugin ) "
+
+# This environment variable determines our operation mode.
+if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
+ # install mode needs the following variable:
+ notinst_deplibs=' libpy2gtk.la'
+else
+ # When we are sourced in execute mode, $file and $echo are already set.
+ if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+ echo="echo"
+ file="$0"
+ # Make sure echo works.
+ if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec /bin/sh "$0" --no-reexec ${1+"$@"}
+ fi
+ fi
+
+ # Find the directory that this script lives in.
+ thisdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "x$thisdir" = "x$file" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=`ls -ld "$file" | /usr/bin/sed -n 's/.*-> //p'`
+ while test -n "$file"; do
+ destdir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+
+ # If there was a directory component, then change thisdir.
+ if test "x$destdir" != "x$file"; then
+ case "$destdir" in
+ [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
+ *) thisdir="$thisdir/$destdir" ;;
+ esac
+ fi
+
+ file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ file=`ls -ld "$thisdir/$file" | /usr/bin/sed -n 's/.*-> //p'`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=`cd "$thisdir" && pwd`
+ test -n "$absdir" && thisdir="$absdir"
+
+ program=lt-'dummy'
+ progdir="$thisdir/.libs"
+
+ if test ! -f "$progdir/$program" || \
+ { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /usr/bin/sed 1q`; \
+ test "X$file" != "X$progdir/$program"; }; then
+
+ file="$$-$program"
+
+ if test ! -d "$progdir"; then
+ mkdir "$progdir"
+ else
+ rm -f "$progdir/$file"
+ fi
+
+ # relink executable if necessary
+ if test -n "$relink_command"; then
+ if relink_command_output=`eval $relink_command 2>&1`; then :
+ else
+ echo "$relink_command_output" >&2
+ rm -f "$progdir/$file"
+ exit 1
+ fi
+ fi
+
+ mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null ||
+ { rm -f "$progdir/$program";
+ mv -f "$progdir/$file" "$progdir/$program"; }
+ rm -f "$progdir/$file"
+ fi
+
+ if test -f "$progdir/$program"; then
+ if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+ # Run the actual program with our arguments.
+
+ exec "$progdir/$program" ${1+"$@"}
+
+ $echo "$0: cannot exec $program $*"
+ exit 1
+ fi
+ else
+ # The program doesn't exist.
+ $echo "$0: error: \`$progdir/$program' does not exist" 1>&2
+ $echo "This script is just a wrapper for $program." 1>&2
+ echo "See the libtool documentation for more information." 1>&2
+ exit 1
+ fi
+fi
Added: trunk/gtk/10_3/src/dummy.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/dummy.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/dummy.cc (added)
+++ trunk/gtk/10_3/src/dummy.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,12 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+
+int main (int argc, char **argv)
+{
+ YGUI(argc, argv, false, "foo");
+ return 0;
+}
Added: trunk/gtk/10_3/src/icons/pkg-available-locked.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-available-locked.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-available-locked.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-available-locked.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,553 @@
+/* XPM */
+static const char * pkg_available_locked_xpm[] = {
+"32 32 518 2",
+" c None",
+". c #3E4174",
+"+ c #3F4275",
+"@ c #3D3E71",
+"# c #3A3B6C",
+"$ c #3C3E71",
+"% c #3E4074",
+"& c #3C3F73",
+"* c #3B3D71",
+"= c #434475",
+"- c #8588A7",
+"; c #BFC4D6",
+"> c #E3E7EE",
+", c #F1F2F5",
+"' c #F6F7F9",
+") c #E0E6EF",
+"! c #C6D2E4",
+"~ c #A4B2CD",
+"{ c #6B739B",
+"] c #3E3F71",
+"^ c #393B6F",
+"/ c #3F4172",
+"( c #A0A6C0",
+"_ c #EAEEF2",
+": c #D6DDE5",
+"< c #D9DDE2",
+"[ c #FEFEFE",
+"} c #959BA2",
+"| c #BFD4EA",
+"1 c #C0D3E8",
+"2 c #C6D7EA",
+"3 c #C6D5E7",
+"4 c #7A86AB",
+"5 c #3D3E70",
+"6 c #3D3D71",
+"7 c #595B86",
+"8 c #EAECF0",
+"9 c #E8EBEE",
+"0 c #CACED3",
+"a c #C2CAD3",
+"b c #DAE8F6",
+"c c #FDFDFD",
+"d c #C5C7C8",
+"e c #8A9095",
+"f c #ABBAC9",
+"g c #BCD2EA",
+"h c #B4CBE6",
+"i c #ACC4E1",
+"j c #DEE5ED",
+"k c #EFF0F2",
+"l c #C6CCD8",
+"m c #4B4E7C",
+"n c #74779C",
+"o c #F1F2F4",
+"p c #B4BBC3",
+"q c #BEC9D5",
+"r c #C4CDD7",
+"s c #A4B0BC",
+"t c #D7E5F2",
+"u c #ACAEB1",
+"v c #AAB7C6",
+"w c #D0E1F4",
+"x c #B5C1CE",
+"y c #B6CAE0",
+"z c #B9CFE9",
+"A c #DFE6ED",
+"B c #CDD0D3",
+"C c #B5BDC5",
+"D c #E5E6E8",
+"E c #E8E9EC",
+"F c #5D6188",
+"G c #5A5D88",
+"H c #FBFBFC",
+"I c #C1CAD4",
+"J c #CAE0F6",
+"K c #FCFDFD",
+"L c #E2E3E5",
+"M c #D8E7F4",
+"N c #E0EFFE",
+"O c #D0DDEB",
+"P c #DAEAFA",
+"Q c #D5E5F7",
+"R c #CDE0F3",
+"S c #CBDEF1",
+"T c #C2CEDB",
+"U c #A9B6C4",
+"V c #939BA4",
+"W c #E5EAEE",
+"X c #F7F7F7",
+"Y c #EEEEEE",
+"Z c #E7E7E9",
+"` c #4C4E7A",
+" . c #454677",
+".. c #F1F2F3",
+"+. c #ECECED",
+"@. c #C3C4C6",
+"#. c #AFB5BD",
+"$. c #E2F0FF",
+"%. c #DFEDFC",
+"&. c #D8E8F9",
+"*. c #D0E2F5",
+"=. c #BFCEDF",
+"-. c #C3C9CF",
+";. c #FCFCFC",
+">. c #EFEFEF",
+",. c #E9E9E9",
+"'. c #D3D3D8",
+"). c #3D3F71",
+"!. c #A5A8C0",
+"~. c #FFFFFF",
+"{. c #D2D3D5",
+"]. c #ADB7C2",
+"^. c #CDDAE6",
+"/. c #E1F0FF",
+"(. c #DAEAFB",
+"_. c #D1E4F6",
+":. c #CEDFF3",
+"<. c #F0F1F3",
+"[. c #F4F5F5",
+"}. c #F8F9F9",
+"|. c #F2F2F2",
+"1. c #E5E5E5",
+"2. c #E6E6E6",
+"3. c #7D819A",
+"4. c #424475",
+"5. c #A3A6A8",
+"6. c #9FABB6",
+"7. c #D5E5F4",
+"8. c #E0EFFF",
+"9. c #DBEBFC",
+"0. c #D1E4F7",
+"a. c #EAEDF1",
+"b. c #C8CACD",
+"c. c #768697",
+"d. c #A9B1BA",
+"e. c #C2C5CA",
+"f. c #E3E4E5",
+"g. c #F4F4F4",
+"h. c #E7E7E7",
+"i. c #DDDDDD",
+"j. c #DCDCDD",
+"k. c #3C3E6E",
+"l. c #8689A7",
+"m. c #BBBDC0",
+"n. c #B4C5D6",
+"o. c #DEEEFF",
+"p. c #DFEEFF",
+"q. c #DFEFFF",
+"r. c #D9EAFB",
+"s. c #D0E3F6",
+"t. c #BCC6D2",
+"u. c #C6CBD1",
+"v. c #D6DEE7",
+"w. c #ABBED4",
+"x. c #869DB7",
+"y. c #819CB9",
+"z. c #A1AAB4",
+"A. c #E8E8E8",
+"B. c #DBDBDB",
+"C. c #E0E0E0",
+"D. c #626487",
+"E. c #3E4173",
+"F. c #CDCEDA",
+"G. c #CCCED0",
+"H. c #CDCFD1",
+"I. c #899CB0",
+"J. c #CCE2FB",
+"K. c #DCEDFF",
+"L. c #DDEDFE",
+"M. c #D5E7FA",
+"N. c #EFF2F4",
+"O. c #F0F1F2",
+"P. c #F3F5F6",
+"Q. c #DADFE5",
+"R. c #E3E6E9",
+"S. c #D3D3D4",
+"T. c #D4D5D5",
+"U. c #9A9BAB",
+"V. c #3A3D6F",
+"W. c #414476",
+"X. c #EFEFF3",
+"Y. c #818B96",
+"Z. c #88A2BE",
+"`. c #93A8C0",
+" + c #B6D0EB",
+".+ c #C4DDF7",
+"++ c #D0E6FC",
+"@+ c #DDEEFF",
+"#+ c #DCEDFE",
+"$+ c #D7E8FB",
+"%+ c #CFE3F7",
+"&+ c #E3E9F0",
+"*+ c #B0B5BA",
+"=+ c #C3C7CB",
+"-+ c #CFD0D0",
+";+ c #79899C",
+">+ c #A3A7B2",
+",+ c #37396B",
+"'+ c #3F4072",
+")+ c #F8F8FA",
+"!+ c #95A9C0",
+"~+ c #B2C8E0",
+"{+ c #A9C7E8",
+"]+ c #B2CFED",
+"^+ c #BBD6F2",
+"/+ c #C2DCF6",
+"(+ c #CCE2F9",
+"_+ c #D5E8FB",
+":+ c #D3E6FA",
+"<+ c #CEE2F7",
+"[+ c #C8DDF3",
+"}+ c #F7F8F8",
+"|+ c #92A1B2",
+"1+ c #D6D6D6",
+"2+ c #CBCBCB",
+"3+ c #8E9CAE",
+"4+ c #393B6E",
+"5+ c #3A3A6E",
+"6+ c #E0E3E8",
+"7+ c #ECEDEF",
+"8+ c #C7CCD1",
+"9+ c #9DBCDF",
+"0+ c #AAC8E9",
+"a+ c #B1CEED",
+"b+ c #B8D3F0",
+"c+ c #BCD6F3",
+"d+ c #C0D9F4",
+"e+ c #C5DCF4",
+"f+ c #C7DDF4",
+"g+ c #C4DBF2",
+"h+ c #C9DCF2",
+"i+ c #EBEBEB",
+"j+ c #969FA9",
+"k+ c #B2B7BC",
+"l+ c #535F6D",
+"m+ c #8CA1BB",
+"n+ c #39396D",
+"o+ c #3C3D70",
+"p+ c #CCD9EA",
+"q+ c #7D9AB9",
+"r+ c #A2ACB8",
+"s+ c #A6B7CB",
+"t+ c #E1E8F0",
+"u+ c #CBD4DD",
+"v+ c #C3D4E7",
+"w+ c #B0CDEC",
+"x+ c #B2CEED",
+"y+ c #AFCCEB",
+"z+ c #ACC9EA",
+"A+ c #A7C5E6",
+"B+ c #D4D8DC",
+"C+ c #F1F1F1",
+"D+ c #D1D1D2",
+"E+ c #B1B5BA",
+"F+ c #546F90",
+"G+ c #889EBD",
+"H+ c #B9C8DE",
+"I+ c #90B2D7",
+"J+ c #86ABD4",
+"K+ c #8DA2B8",
+"L+ c #F3F3F4",
+"M+ c #B8C9DC",
+"N+ c #A5C4E6",
+"O+ c #A3C2E5",
+"P+ c #9FBFE3",
+"Q+ c #99BBE0",
+"R+ c #91AFCF",
+"S+ c #BABEC3",
+"T+ c #949AA1",
+"U+ c #9FA6AD",
+"V+ c #F9F9F9",
+"W+ c #F5F5F5",
+"X+ c #EAEAEA",
+"Y+ c #DEDEDE",
+"Z+ c #D3D3D3",
+"`+ c #B3B5B6",
+" @ c #426083",
+".@ c #7C90B1",
+"+@ c #383A6E",
+"@@ c #3C3F71",
+"#@ c #96A7C6",
+"$@ c #9DB9DA",
+"%@ c #7EA5D0",
+"&@ c #C1D2E4",
+"*@ c #FBFBFB",
+"=@ c #B2C3D4",
+"-@ c #9BBCE0",
+";@ c #97B9DE",
+">@ c #93B6DC",
+",@ c #8FB2DA",
+"'@ c #89AED6",
+")@ c #799DC5",
+"!@ c #79A0CC",
+"~@ c #739CCA",
+"{@ c #EBEDEE",
+"]@ c #ECECEC",
+"^@ c #848484",
+"/@ c #393939",
+"(@ c #2D2D2D",
+"_@ c #0F1316",
+":@ c #161F29",
+"<@ c #4F5C7A",
+"[@ c #393A6C",
+"}@ c #646F99",
+"|@ c #B1C8E1",
+"1@ c #749DCB",
+"2@ c #D6DDE4",
+"3@ c #E8EAED",
+"4@ c #98B1CE",
+"5@ c #88ADD6",
+"6@ c #83A9D3",
+"7@ c #78A0CD",
+"8@ c #719AC9",
+"9@ c #6994C5",
+"0@ c #A4ADB8",
+"a@ c #707070",
+"b@ c #7B7B7B",
+"c@ c #D2D2D2",
+"d@ c #BBBBBB",
+"e@ c #707072",
+"f@ c #12121D",
+"g@ c #B2C6DF",
+"h@ c #779ECA",
+"i@ c #9DAEC0",
+"j@ c #FAFAFA",
+"k@ c #FBFCFC",
+"l@ c #6C7C90",
+"m@ c #7CA3CF",
+"n@ c #6D98C7",
+"o@ c #6792C4",
+"p@ c #5F8DC0",
+"q@ c #505A66",
+"r@ c #858585",
+"s@ c #BEBEBE",
+"t@ c #3F3F3F",
+"u@ c #1E1E1E",
+"v@ c #1C1D1E",
+"w@ c #4D4D4E",
+"x@ c #B1B1B1",
+"y@ c #6B7BA5",
+"z@ c #9EBAD9",
+"A@ c #6892C2",
+"B@ c #C0C4C9",
+"C@ c #F6F6F6",
+"D@ c #CED0D3",
+"E@ c #6589B1",
+"F@ c #709AC9",
+"G@ c #6C97C7",
+"H@ c #6893C4",
+"I@ c #638FC1",
+"J@ c #5C8ABE",
+"K@ c #5585BA",
+"L@ c #343638",
+"M@ c #C2C2C2",
+"N@ c #212121",
+"O@ c #BCBCBC",
+"P@ c #909295",
+"Q@ c #6C84A5",
+"R@ c #525E89",
+"S@ c #2E2E2E",
+"T@ c #AAAAAA",
+"U@ c #000000",
+"V@ c #3C3F72",
+"W@ c #9BB2D0",
+"X@ c #80A3CC",
+"Y@ c #5F88B6",
+"Z@ c #CED0D2",
+"`@ c #B4B8BB",
+" # c #6089B7",
+".# c #6490C2",
+"+# c #618EC0",
+"@# c #5D8ABE",
+"## c #5886BB",
+"$# c #5282B8",
+"%# c #4B7DB5",
+" c #2C2C2C",
+"*# c #C0C0C0",
+"=# c #191919",
+"-# c #989A9C",
+";# c #4C5E75",
+"># c #7385A5",
+",# c #393B6D",
+"'# c #161616",
+")# c #C1C0C0",
+"!# c #474B7C",
+"~# c #A1B9D5",
+"{# c #6E96C4",
+"]# c #B3BAC2",
+"^# c #9EA3A8",
+"/# c #48627E",
+"(# c #5A89BD",
+"_# c #5887BC",
+":# c #5584BA",
+"<# c #5181B8",
+"[# c #4C7EB5",
+"}# c #4779B2",
+"|# c #28486D",
+"1# c #141312",
+"2# c #9B9794",
+"3# c #201D1C",
+"4# c #0B0B07",
+"5# c #040302",
+"6# c #050403",
+"7# c #2F2921",
+"8# c #A8A39E",
+"9# c #1A130B",
+"0# c #2F335E",
+"a# c #4E5785",
+"b# c #9CB5D3",
+"c# c #A8B3C0",
+"d# c #CDCDCD",
+"e# c #CFCFCF",
+"f# c #687685",
+"g# c #4F80B7",
+"h# c #4E7FB6",
+"i# c #4C7DB5",
+"j# c #497BB3",
+"k# c #4678B1",
+"l# c #4175AF",
+"m# c #3E71AB",
+"n# c #A59176",
+"o# c #E0C4A0",
+"p# c #DFC4A3",
+"q# c #DABE9A",
+"r# c #D6BA94",
+"s# c #CDA676",
+"t# c #815A2B",
+"u# c #2E3058",
+"v# c #444977",
+"w# c #B4B9C4",
+"x# c #8F949A",
+"y# c #375A82",
+"z# c #4376B0",
+"A# c #4275AF",
+"B# c #4074AE",
+"C# c #3E72AC",
+"D# c #3E6FA9",
+"E# c #3D6CA4",
+"F# c #3C699F",
+"G# c #E2C5A1",
+"H# c #D8B58C",
+"I# c #CA9F68",
+"J# c #AC8758",
+"K# c #A78252",
+"L# c #A78253",
+"M# c #A37B4B",
+"N# c #BC8849",
+"O# c #AC712E",
+"P# c #202040",
+"Q# c #3A3B6D",
+"R# c #6E718E",
+"S# c #8697AD",
+"T# c #81A0C4",
+"U# c #648AB7",
+"V# c #4E79AC",
+"W# c #4672A6",
+"X# c #3E6BA0",
+"Y# c #446EA0",
+"Z# c #4C71A1",
+"`# c #5E7EA6",
+" $ c #E3C6A2",
+".$ c #D5AE7E",
+"+$ c #B08D5F",
+"@$ c #D5B284",
+"#$ c #CFAB7C",
+"$$ c #CFAC7B",
+"%$ c #CBA471",
+"&$ c #BC8746",
+"*$ c #AA6F2B",
+"=$ c #2A2B50",
+"-$ c #505985",
+";$ c #6D7FA6",
+">$ c #7E93B6",
+",$ c #869BBB",
+"'$ c #8AA1BE",
+")$ c #8297B6",
+"!$ c #798CAC",
+"~$ c #66759A",
+"{$ c #E1C4A0",
+"]$ c #D0A674",
+"^$ c #C79B64",
+"/$ c #AA8455",
+"($ c #A47E4E",
+"_$ c #A07744",
+":$ c #BA8442",
+"<$ c #1D1D37",
+"[$ c #2F3057",
+"}$ c #353765",
+"|$ c #363969",
+"1$ c #39396A",
+"2$ c #363768",
+"3$ c #343664",
+"4$ c #2E2F56",
+"5$ c #E1C29C",
+"6$ c #CEA470",
+"7$ c #AD8D64",
+"8$ c #D2B289",
+"9$ c #CDAC83",
+"0$ c #CEAD83",
+"a$ c #CCA77B",
+"b$ c #B8803E",
+"c$ c #AD7332",
+"d$ c #E0C29E",
+"e$ c #D4AC79",
+"f$ c #CDA66E",
+"g$ c #AF8D5E",
+"h$ c #AB8758",
+"i$ c #AB8858",
+"j$ c #A8814C",
+"k$ c #B47E3E",
+"l$ c #D0A874",
+"m$ c #C6965D",
+"n$ c #BE8D50",
+"o$ c #BA894B",
+"p$ c #BD8C4E",
+"q$ c #BC8A4C",
+"r$ c #BA8647",
+"s$ c #A47136",
+" ",
+" ",
+" . + @ # $ % & ",
+" * = - ; > , ' ) ! ~ { ] ^ ",
+" / ( _ : < [ [ [ } | 1 2 3 4 5 ",
+" 6 7 8 9 0 a b c d e f g h i j k l m ^ ",
+" n o p q r s t u v w x y z A B C D E F ",
+" G H I J K L M N O P Q R S T U V W X Y Z ` ",
+" ., [ [ ..+.@.#.$.$.%.&.*.=.-.;.[ [ ;.>.,.'.). ",
+" !.~.[ [ [ {.].^./././.(._.:.<.[.}.[ [ |.1.2.3. ",
+" 4.H [ [ c 5.6.7.8.8.8.8.9.0.a.b.c.d.e.f.g.h.i.j.k. ",
+" l.~.[ [ m.n.o.p.q.q.q.q.r.s.t.u.v.w.x.y.z.A.B.C.D. ",
+" E.F.;.G.H.I.J.K.o.o.o.o.L.M.s.N.[ [ O.P.Q.R.h.S.T.U.V. ",
+" W.X.Y.Z.`. +.+++@+@+@+#+$+%+&+[ [ [ [ [ [ *+=+-+;+>+,+ ",
+" '+)+!+~+{+]+^+/+(+_+_+:+<+[+}+[ [ [ [ [ ;.+.|+1+2+3+4+ ",
+" 5+6+7+8+9+0+a+b+c+d+e+f+g+h+[ [ [ [ [ [ X i+j+k+l+m+n+ ",
+" o+p+q+r+s+t+u+v+w+x+a+y+z+A+B+[ [ [ [ ;.C+1.D+E+F+G+4+ ",
+" & H+I+J+K+[ [ L+M+N+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@ ",
+" @@#@$@%@&@[ [ [ *@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@ ",
+" }@|@1@2@[ [ [ [ [ 3@4@5@6@%@7@8@9@0@a@b@c@B.B.d@e@f@ ",
+" $ g@h@i@j@[ [ [ [ k@l@m@7@~@n@o@p@q@r@s@t@u@v@w@x@^@ ",
+" y@z@A@B@|.C@V+j@D@E@F@G@H@I@J@K@L@M@N@O@P@Q@R@S@T@U@ ",
+" V@W@X@Y@Z@A.i+]@`@ #.#+#@###$#%#*#=#-#;#>#,#'#)#U@ ",
+" !#~#{#]#B.i.^#/#(#_#:#<#[#}#|#1#2#3#4#5#5#6#7#8#9# ",
+" 0#a#b#c#d#e#f#g#h#i#j#k#l#m#U@n#o#p#p#q#q#q#r#s#t#U@",
+" u#v#w#1+x#y#z#A#B#C#D#E#F#U@G#H#I#J#K#K#L#M#N#O#U@",
+" P#Q#R#S#T#U#V#W#X#Y#Z#`#U@ $.$+$@$#$#$$$%$&$*$U@",
+" =$Q#-$;$>$,$'$)$!$~$U@{$]$^$/$($($($_$:$O#U@",
+" <$[$}$|$1$2$3$4$U@5$6$7$8$9$9$0$a$b$c$U@",
+" U@d$e$f$g$h$h$i$j$&$k$U@",
+" U@l$m$n$n$o$o$p$q$r$s$U@",
+" U@U@U@U@U@U@U@U@U@U@ "};
Added: trunk/gtk/10_3/src/icons/pkg-available.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-available.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-available.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-available.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,505 @@
+/* XPM */
+static const char * pkg_available_xpm[] = {
+"32 32 470 2",
+" c None",
+". c #3E4174",
+"+ c #3F4275",
+"@ c #3D3E71",
+"# c #3A3B6C",
+"$ c #3C3E71",
+"% c #3E4074",
+"& c #3C3F73",
+"* c #3B3D71",
+"= c #434475",
+"- c #8588A7",
+"; c #BFC4D6",
+"> c #E3E7EE",
+", c #F1F2F5",
+"' c #F6F7F9",
+") c #E0E6EF",
+"! c #C6D2E4",
+"~ c #A4B2CD",
+"{ c #6B739B",
+"] c #3E3F71",
+"^ c #393B6F",
+"/ c #3F4172",
+"( c #A0A6C0",
+"_ c #EAEEF2",
+": c #D6DDE5",
+"< c #D9DDE2",
+"[ c #FEFEFE",
+"} c #959BA2",
+"| c #BFD4EA",
+"1 c #C0D3E8",
+"2 c #C6D7EA",
+"3 c #C6D5E7",
+"4 c #7A86AB",
+"5 c #3D3E70",
+"6 c #3D3D71",
+"7 c #595B86",
+"8 c #EAECF0",
+"9 c #E8EBEE",
+"0 c #CACED3",
+"a c #C2CAD3",
+"b c #DAE8F6",
+"c c #FDFDFD",
+"d c #C5C7C8",
+"e c #8A9095",
+"f c #ABBAC9",
+"g c #BCD2EA",
+"h c #B4CBE6",
+"i c #ACC4E1",
+"j c #DEE5ED",
+"k c #EFF0F2",
+"l c #C6CCD8",
+"m c #4B4E7C",
+"n c #74779C",
+"o c #F1F2F4",
+"p c #B4BBC3",
+"q c #BEC9D5",
+"r c #C4CDD7",
+"s c #A4B0BC",
+"t c #D7E5F2",
+"u c #ACAEB1",
+"v c #AAB7C6",
+"w c #D0E1F4",
+"x c #B5C1CE",
+"y c #B6CAE0",
+"z c #B9CFE9",
+"A c #DFE6ED",
+"B c #CDD0D3",
+"C c #B5BDC5",
+"D c #E5E6E8",
+"E c #E8E9EC",
+"F c #5D6188",
+"G c #5A5D88",
+"H c #FBFBFC",
+"I c #C1CAD4",
+"J c #CAE0F6",
+"K c #FCFDFD",
+"L c #E2E3E5",
+"M c #D8E7F4",
+"N c #E0EFFE",
+"O c #D0DDEB",
+"P c #DAEAFA",
+"Q c #D5E5F7",
+"R c #CDE0F3",
+"S c #CBDEF1",
+"T c #C2CEDB",
+"U c #A9B6C4",
+"V c #939BA4",
+"W c #E5EAEE",
+"X c #F7F7F7",
+"Y c #EEEEEE",
+"Z c #E7E7E9",
+"` c #4C4E7A",
+" . c #454677",
+".. c #F1F2F3",
+"+. c #ECECED",
+"@. c #C3C4C6",
+"#. c #AFB5BD",
+"$. c #E2F0FF",
+"%. c #DFEDFC",
+"&. c #D8E8F9",
+"*. c #D0E2F5",
+"=. c #BFCEDF",
+"-. c #C3C9CF",
+";. c #FCFCFC",
+">. c #EFEFEF",
+",. c #E9E9E9",
+"'. c #D3D3D8",
+"). c #3D3F71",
+"!. c #A5A8C0",
+"~. c #FFFFFF",
+"{. c #D2D3D5",
+"]. c #ADB7C2",
+"^. c #CDDAE6",
+"/. c #E1F0FF",
+"(. c #DAEAFB",
+"_. c #D1E4F6",
+":. c #CEDFF3",
+"<. c #F0F1F3",
+"[. c #F4F5F5",
+"}. c #F8F9F9",
+"|. c #F2F2F2",
+"1. c #E5E5E5",
+"2. c #E6E6E6",
+"3. c #7D819A",
+"4. c #424475",
+"5. c #A3A6A8",
+"6. c #9FABB6",
+"7. c #D5E5F4",
+"8. c #E0EFFF",
+"9. c #DBEBFC",
+"0. c #D1E4F7",
+"a. c #EAEDF1",
+"b. c #C8CACD",
+"c. c #768697",
+"d. c #A9B1BA",
+"e. c #C2C5CA",
+"f. c #E3E4E5",
+"g. c #F4F4F4",
+"h. c #E7E7E7",
+"i. c #DDDDDD",
+"j. c #DCDCDD",
+"k. c #3C3E6E",
+"l. c #8689A7",
+"m. c #BBBDC0",
+"n. c #B4C5D6",
+"o. c #DEEEFF",
+"p. c #DFEEFF",
+"q. c #DFEFFF",
+"r. c #D9EAFB",
+"s. c #D0E3F6",
+"t. c #BCC6D2",
+"u. c #C6CBD1",
+"v. c #D6DEE7",
+"w. c #ABBED4",
+"x. c #869DB7",
+"y. c #819CB9",
+"z. c #A1AAB4",
+"A. c #E8E8E8",
+"B. c #DBDBDB",
+"C. c #E0E0E0",
+"D. c #626487",
+"E. c #3E4173",
+"F. c #CDCEDA",
+"G. c #CCCED0",
+"H. c #CDCFD1",
+"I. c #899CB0",
+"J. c #CCE2FB",
+"K. c #DCEDFF",
+"L. c #DDEDFE",
+"M. c #D5E7FA",
+"N. c #EFF2F4",
+"O. c #F0F1F2",
+"P. c #F3F5F6",
+"Q. c #DADFE5",
+"R. c #E3E6E9",
+"S. c #D3D3D4",
+"T. c #D4D5D5",
+"U. c #9A9BAB",
+"V. c #3A3D6F",
+"W. c #414476",
+"X. c #EFEFF3",
+"Y. c #818B96",
+"Z. c #88A2BE",
+"`. c #93A8C0",
+" + c #B6D0EB",
+".+ c #C4DDF7",
+"++ c #D0E6FC",
+"@+ c #DDEEFF",
+"#+ c #DCEDFE",
+"$+ c #D7E8FB",
+"%+ c #CFE3F7",
+"&+ c #E3E9F0",
+"*+ c #B0B5BA",
+"=+ c #C3C7CB",
+"-+ c #CFD0D0",
+";+ c #79899C",
+">+ c #A3A7B2",
+",+ c #37396B",
+"'+ c #3F4072",
+")+ c #F8F8FA",
+"!+ c #95A9C0",
+"~+ c #B2C8E0",
+"{+ c #A9C7E8",
+"]+ c #B2CFED",
+"^+ c #BBD6F2",
+"/+ c #C2DCF6",
+"(+ c #CCE2F9",
+"_+ c #D5E8FB",
+":+ c #D3E6FA",
+"<+ c #CEE2F7",
+"[+ c #C8DDF3",
+"}+ c #F7F8F8",
+"|+ c #92A1B2",
+"1+ c #D6D6D6",
+"2+ c #CBCBCB",
+"3+ c #8E9CAE",
+"4+ c #393B6E",
+"5+ c #3A3A6E",
+"6+ c #E0E3E8",
+"7+ c #ECEDEF",
+"8+ c #C7CCD1",
+"9+ c #9DBCDF",
+"0+ c #AAC8E9",
+"a+ c #B1CEED",
+"b+ c #B8D3F0",
+"c+ c #BCD6F3",
+"d+ c #C0D9F4",
+"e+ c #C5DCF4",
+"f+ c #C7DDF4",
+"g+ c #C4DBF2",
+"h+ c #C9DCF2",
+"i+ c #EBEBEB",
+"j+ c #969FA9",
+"k+ c #B2B7BC",
+"l+ c #535F6D",
+"m+ c #8CA1BB",
+"n+ c #39396D",
+"o+ c #3C3D70",
+"p+ c #CCD9EA",
+"q+ c #7D9AB9",
+"r+ c #A2ACB8",
+"s+ c #A6B7CB",
+"t+ c #E1E8F0",
+"u+ c #CBD4DD",
+"v+ c #C3D4E7",
+"w+ c #B0CDEC",
+"x+ c #B2CEED",
+"y+ c #AFCCEB",
+"z+ c #ACC9EA",
+"A+ c #A7C5E6",
+"B+ c #D4D8DC",
+"C+ c #F1F1F1",
+"D+ c #D1D1D2",
+"E+ c #B1B5BA",
+"F+ c #546F90",
+"G+ c #889EBD",
+"H+ c #B9C8DE",
+"I+ c #90B2D7",
+"J+ c #86ABD4",
+"K+ c #8DA2B8",
+"L+ c #F3F3F4",
+"M+ c #B8C9DC",
+"N+ c #A5C4E6",
+"O+ c #A3C2E5",
+"P+ c #9FBFE3",
+"Q+ c #99BBE0",
+"R+ c #91AFCF",
+"S+ c #BABEC3",
+"T+ c #949AA1",
+"U+ c #9FA6AD",
+"V+ c #F9F9F9",
+"W+ c #F5F5F5",
+"X+ c #EAEAEA",
+"Y+ c #DEDEDE",
+"Z+ c #D3D3D3",
+"`+ c #B3B5B6",
+" @ c #426083",
+".@ c #7C90B1",
+"+@ c #383A6E",
+"@@ c #3C3F71",
+"#@ c #96A7C6",
+"$@ c #9DB9DA",
+"%@ c #7EA5D0",
+"&@ c #C1D2E4",
+"*@ c #FBFBFB",
+"=@ c #B2C3D4",
+"-@ c #9BBCE0",
+";@ c #97B9DE",
+">@ c #93B6DC",
+",@ c #8FB2DA",
+"'@ c #89AED6",
+")@ c #799DC5",
+"!@ c #79A0CC",
+"~@ c #739CCA",
+"{@ c #EBEDEE",
+"]@ c #ECECEC",
+"^@ c #E2E2E2",
+"/@ c #D7D7D7",
+"(@ c #CCCCCC",
+"_@ c #475566",
+":@ c #5E80A9",
+"<@ c #68789F",
+"[@ c #3A3B6D",
+"}@ c #646F99",
+"|@ c #B1C8E1",
+"1@ c #749DCB",
+"2@ c #D6DDE4",
+"3@ c #E8EAED",
+"4@ c #98B1CE",
+"5@ c #88ADD6",
+"6@ c #83A9D3",
+"7@ c #78A0CD",
+"8@ c #719AC9",
+"9@ c #6994C5",
+"0@ c #AFB9C5",
+"a@ c #E3E3E3",
+"b@ c #D9D9D9",
+"c@ c #CECECE",
+"d@ c #A2A5A8",
+"e@ c #325784",
+"f@ c #7691B3",
+"g@ c #4E5682",
+"h@ c #B2C6DF",
+"i@ c #779ECA",
+"j@ c #9DAEC0",
+"k@ c #FAFAFA",
+"l@ c #FBFCFC",
+"m@ c #6C7C90",
+"n@ c #7CA3CF",
+"o@ c #6D98C7",
+"p@ c #6792C4",
+"q@ c #5F8DC0",
+"r@ c #8DA1B8",
+"s@ c #CFCFCF",
+"t@ c #C5C5C5",
+"u@ c #93969A",
+"v@ c #446897",
+"w@ c #7C92B1",
+"x@ c #3B3C6E",
+"y@ c #6B7BA5",
+"z@ c #9EBAD9",
+"A@ c #6892C2",
+"B@ c #C0C4C9",
+"C@ c #F6F6F6",
+"D@ c #CED0D3",
+"E@ c #6589B1",
+"F@ c #709AC9",
+"G@ c #6C97C7",
+"H@ c #6893C4",
+"I@ c #638FC1",
+"J@ c #5C8ABE",
+"K@ c #5585BA",
+"L@ c #92A7BE",
+"M@ c #BCBCBC",
+"N@ c #909295",
+"O@ c #6C84A5",
+"P@ c #525E89",
+"Q@ c #3C3F72",
+"R@ c #9BB2D0",
+"S@ c #80A3CC",
+"T@ c #5F88B6",
+"U@ c #CED0D2",
+"V@ c #B4B8BB",
+"W@ c #6089B7",
+"X@ c #6490C2",
+"Y@ c #618EC0",
+"Z@ c #5D8ABE",
+"`@ c #5886BB",
+" # c #5282B8",
+".# c #4B7DB5",
+"+# c #889AAF",
+"@# c #C3C3C3",
+"## c #BBBBBB",
+"$# c #989A9C",
+"%# c #4C5E75",
+" c #7385A5",
+"*# c #393B6D",
+"=# c #474B7C",
+"-# c #A1B9D5",
+";# c #6E96C4",
+"># c #B3BAC2",
+",# c #9EA3A8",
+"'# c #48627E",
+")# c #5A89BD",
+"!# c #5887BC",
+"~# c #5584BA",
+"{# c #5181B8",
+"]# c #4C7EB5",
+"^# c #4779B2",
+"/# c #4174AF",
+"(# c #597DA6",
+"_# c #B8B8B8",
+":# c #B0B0B0",
+"<# c #898B8F",
+"[# c #798BA8",
+"}# c #3F4371",
+"|# c #2F335E",
+"1# c #4E5785",
+"2# c #9CB5D3",
+"3# c #A8B3C0",
+"4# c #CDCDCD",
+"5# c #687685",
+"6# c #4F80B7",
+"7# c #4E7FB6",
+"8# c #4C7DB5",
+"9# c #497BB3",
+"0# c #4678B1",
+"a# c #4175AF",
+"b# c #3E71AB",
+"c# c #3D6DA5",
+"d# c #3D699E",
+"e# c #A4A5A7",
+"f# c #ACADAD",
+"g# c #7B8392",
+"h# c #464B78",
+"i# c #2C2D56",
+"j# c #2E3058",
+"k# c #444977",
+"l# c #B4B9C4",
+"m# c #8F949A",
+"n# c #375A82",
+"o# c #4376B0",
+"p# c #4275AF",
+"q# c #4074AE",
+"r# c #3E72AC",
+"s# c #3E6FA9",
+"t# c #3D6CA4",
+"u# c #3C699F",
+"v# c #3B6599",
+"w# c #496D9B",
+"x# c #7D8899",
+"y# c #6D788E",
+"z# c #2A2B51",
+"A# c #202040",
+"B# c #6E718E",
+"C# c #8697AD",
+"D# c #81A0C4",
+"E# c #648AB7",
+"F# c #4E79AC",
+"G# c #4672A6",
+"H# c #3E6BA0",
+"I# c #446EA0",
+"J# c #4C71A1",
+"K# c #5E7EA6",
+"L# c #758DAF",
+"M# c #7E91B0",
+"N# c #565E87",
+"O# c #38396B",
+"P# c #1D1D38",
+"Q# c #2A2B50",
+"R# c #505985",
+"S# c #6D7FA6",
+"T# c #7E93B6",
+"U# c #869BBB",
+"V# c #8AA1BE",
+"W# c #8297B6",
+"X# c #798CAC",
+"Y# c #66759A",
+"Z# c #4B517C",
+"`# c #3A3B6B",
+" $ c #292A4D",
+".$ c #1D1D37",
+"+$ c #2F3057",
+"@$ c #353765",
+"#$ c #363969",
+"$$ c #39396A",
+"%$ c #363768",
+"&$ c #343664",
+"*$ c #2E2F56",
+"=$ c #1B1B35",
+" ",
+" ",
+" . + @ # $ % & ",
+" * = - ; > , ' ) ! ~ { ] ^ ",
+" / ( _ : < [ [ [ } | 1 2 3 4 5 ",
+" 6 7 8 9 0 a b c d e f g h i j k l m ^ ",
+" n o p q r s t u v w x y z A B C D E F ",
+" G H I J K L M N O P Q R S T U V W X Y Z ` ",
+" ., [ [ ..+.@.#.$.$.%.&.*.=.-.;.[ [ ;.>.,.'.). ",
+" !.~.[ [ [ {.].^./././.(._.:.<.[.}.[ [ |.1.2.3. ",
+" 4.H [ [ c 5.6.7.8.8.8.8.9.0.a.b.c.d.e.f.g.h.i.j.k. ",
+" l.~.[ [ m.n.o.p.q.q.q.q.r.s.t.u.v.w.x.y.z.A.B.C.D. ",
+" E.F.;.G.H.I.J.K.o.o.o.o.L.M.s.N.[ [ O.P.Q.R.h.S.T.U.V. ",
+" W.X.Y.Z.`. +.+++@+@+@+#+$+%+&+[ [ [ [ [ [ *+=+-+;+>+,+ ",
+" '+)+!+~+{+]+^+/+(+_+_+:+<+[+}+[ [ [ [ [ ;.+.|+1+2+3+4+ ",
+" 5+6+7+8+9+0+a+b+c+d+e+f+g+h+[ [ [ [ [ [ X i+j+k+l+m+n+ ",
+" o+p+q+r+s+t+u+v+w+x+a+y+z+A+B+[ [ [ [ ;.C+1.D+E+F+G+4+ ",
+" & H+I+J+K+[ [ L+M+N+N+O+P+Q+R+S+T+U+V+W+X+Y+Z+`+ @.@+@ ",
+" @@#@$@%@&@[ [ [ *@=@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@ ",
+" }@|@1@2@[ [ [ [ [ 3@4@5@6@%@7@8@9@0@a@b@c@d@e@f@g@ ",
+" $ h@i@j@k@[ [ [ [ l@m@n@7@~@o@p@q@r@b@s@t@u@v@w@x@ ",
+" y@z@A@B@|.C@V+k@D@E@F@G@H@I@J@K@L@c@t@M@N@O@P@ ",
+" Q@R@S@T@U@A.i+]@V@W@X@Y@Z@`@ #.#+#@###$#%#*# ",
+" =#-#;#>#B.i.,#'#)#!#~#{#]#^#/#(#_#:#<#[#}# ",
+" |#1#2#3#4#s@5#6#7#8#9#0#a#b#c#d#e#f#g#h#i# ",
+" j#k#l#1+m#n#o#p#q#r#s#t#u#v#w#x#y#}#z# ",
+" A#[@B#C#D#E#F#G#H#I#J#K#L#M#N#O#P# ",
+" Q#[@R#S#T#U#V#W#X#Y#Z#`# $ ",
+" .$+$@$#$$$%$&$*$=$ ",
+" ",
+" ",
+" "};
Added: trunk/gtk/10_3/src/icons/pkg-install-auto.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-install-auto.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-install-auto.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-install-auto.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,325 @@
+/* XPM */
+static const char * pkg_install_auto_xpm[] = {
+"32 32 290 2",
+" c None",
+". c #1F4B8A",
+"+ c #214C89",
+"@ c #214C8A",
+"# c #214D8A",
+"$ c #204A88",
+"% c #204B88",
+"& c #2B558F",
+"* c #5B80AF",
+"= c #7998C0",
+"- c #89A6C9",
+"; c #85A2C6",
+"> c #698AB5",
+", c #355D95",
+"' c #1F4C89",
+") c #5377A7",
+"! c #8AA5CA",
+"~ c #8BA7CB",
+"{ c #90ABCE",
+"] c #93ADCE",
+"^ c #96AFD0",
+"/ c #98B1D1",
+"( c #99B2D1",
+"_ c #6C8CB6",
+": c #234E89",
+"< c #1F4987",
+"[ c #5B7CAA",
+"} c #5B7CAB",
+"| c #41669C",
+"1 c #446BA0",
+"2 c #6283B2",
+"3 c #90ABCD",
+"4 c #93ADCF",
+"5 c #8CA7CC",
+"6 c #8AA6CB",
+"7 c #94ADCF",
+"8 c #7C99C1",
+"9 c #325A91",
+"0 c #2D558F",
+"a c #1F4C87",
+"b c #214C88",
+"c c #315891",
+"d c #86A2C7",
+"e c #8DA9CC",
+"f c #84A1C8",
+"g c #809FC6",
+"h c #6587B3",
+"i c #204B8B",
+"j c #224C88",
+"k c #325C93",
+"l c #7F9EC6",
+"m c #7B9BC4",
+"n c #7A9AC3",
+"o c #91ACCE",
+"p c #305991",
+"q c #1E4A86",
+"r c #204A8A",
+"s c #6A8BB7",
+"t c #83A1C8",
+"u c #7697C2",
+"v c #7395C1",
+"w c #86A3C9",
+"x c #6183B1",
+"y c #1F4A87",
+"z c #545454",
+"A c #595959",
+"B c #5C5C5C",
+"C c #4D5766",
+"D c #446798",
+"E c #89A5CB",
+"F c #7193BF",
+"G c #6D90BE",
+"H c #7797C2",
+"I c #7F9DC4",
+"J c #284E83",
+"K c #5B5B5B",
+"L c #585858",
+"M c #535353",
+"N c #AFAFAF",
+"O c #FCFCFC",
+"P c #FEFEFE",
+"Q c #FDFDFD",
+"R c #F0F2F5",
+"S c #6B8FBD",
+"T c #698DBC",
+"U c #6A8EBD",
+"V c #8EA9CC",
+"W c #2A528D",
+"X c #F6F6F6",
+"Y c #F5F5F5",
+"Z c #F4F4F4",
+"` c #F3F3F3",
+" . c #F2F2F2",
+".. c #959595",
+"+. c #AFBCCE",
+"@. c #8CA8CC",
+"#. c #658ABA",
+"$. c #6388B9",
+"%. c #6187B8",
+"&. c #95AECF",
+"*. c #6F89AD",
+"=. c #DEDEDE",
+"-. c #979797",
+";. c #F8F8F8",
+">. c #E5E5E5",
+",. c #9CADC3",
+"'. c #385E95",
+"). c #7A99C2",
+"!. c #8DA8CC",
+"~. c #5F85B8",
+"{. c #5D84B7",
+"]. c #5B82B6",
+"^. c #94AFCF",
+"/. c #97B0D0",
+"(. c #6182B0",
+"_. c #486A9B",
+":. c #D9DADB",
+"<. c #EDEDED",
+"[. c #7E7E7E",
+"}. c #DFDFDF",
+"|. c #ECECEC",
+"1. c #E0E0E0",
+"2. c #E3E3E3",
+"3. c #869BB9",
+"4. c #3A6198",
+"5. c #7B9AC3",
+"6. c #5A82B5",
+"7. c #5981B5",
+"8. c #5880B4",
+"9. c #4E79B0",
+"0. c #4370AB",
+"a. c #3969A7",
+"b. c #6C8FBE",
+"c. c #6889B6",
+"d. c #345A90",
+"e. c #CACDD2",
+"f. c #D7D7D7",
+"g. c #E2E2E2",
+"h. c #C3C3C3",
+"i. c #696969",
+"j. c #FAFAFA",
+"k. c #E1E1E1",
+"l. c #E4E4E4",
+"m. c #E7E7E7",
+"n. c #6C87AC",
+"o. c #42699C",
+"p. c #7B9BC3",
+"q. c #5881B5",
+"r. c #4A76AE",
+"s. c #416EAA",
+"t. c #3666A5",
+"u. c #3364A4",
+"v. c #5C83B6",
+"w. c #7493BE",
+"x. c #2D568F",
+"y. c #BBC3CE",
+"z. c #DCDCDC",
+"A. c #D9D9D9",
+"B. c #E9E9E9",
+"C. c #5F5F5F",
+"D. c #BDBDBD",
+"E. c #F0F0F0",
+"F. c #E0E1E2",
+"G. c #5A78A3",
+"H. c #426A9F",
+"I. c #3A69A7",
+"J. c #4D78B0",
+"K. c #7D9CC4",
+"L. c #315992",
+"M. c #A2B0C2",
+"N. c #DBDBDB",
+"O. c #DADADA",
+"P. c #D8D8D8",
+"Q. c #A2A2A2",
+"R. c #555555",
+"S. c #DDDDDD",
+"T. c #D8D9DA",
+"U. c #486A9A",
+"V. c #476EA2",
+"W. c #6F92BF",
+"X. c #416FAA",
+"Y. c #82A0C7",
+"Z. c #3C6298",
+"`. c #7E93B1",
+" + c #919191",
+".+ c #D6D6D6",
+"++ c #CCCED2",
+"@+ c #395E93",
+"#+ c #557AAC",
+"$+ c #7092BF",
+"%+ c #3D6CA9",
+"&+ c #7E9DC6",
+"*+ c #4A70A2",
+"=+ c #58769F",
+"-+ c #D0D0D0",
+";+ c #D1D1D1",
+">+ c #D2D2D2",
+",+ c #D4D4D4",
+"'+ c #7F7F7F",
+")+ c #D5D5D5",
+"!+ c #BABFC6",
+"~+ c #2F578E",
+"{+ c #5E82B1",
+"]+ c #89A5CA",
+"^+ c #597CAD",
+"/+ c #3C6093",
+"(+ c #C1C3C5",
+"_+ c #CACACA",
+":+ c #CCCCCC",
+"<+ c #CDCDCD",
+"[+ c #676767",
+"}+ c #CECECE",
+"|+ c #C8C8C8",
+"1+ c #AEB4BD",
+"2+ c #2B538C",
+"3+ c #4D72A6",
+"4+ c #2B548D",
+"5+ c #B0B5BB",
+"6+ c #C4C4C4",
+"7+ c #C6C6C6",
+"8+ c #D3D3D3",
+"9+ c #626262",
+"0+ c #B6B6B6",
+"a+ c #EBEBEB",
+"b+ c #CFCFCF",
+"c+ c #CBCBCB",
+"d+ c #A2ABB8",
+"e+ c #9D9D9D",
+"f+ c #555753",
+"g+ c #575955",
+"h+ c #CDD0D5",
+"i+ c #575757",
+"j+ c #DBDCDA",
+"k+ c #BABBB9",
+"l+ c #585A56",
+"m+ c #E8E8E8",
+"n+ c #DCDDDB",
+"o+ c #BBBCBA",
+"p+ c #595B57",
+"q+ c #B7B7B7",
+"r+ c #5A5C58",
+"s+ c #B0B0B0",
+"t+ c #B4B4B4",
+"u+ c #B3B3B3",
+"v+ c #B2B2B2",
+"w+ c #B1B1B1",
+"x+ c #AEAEAE",
+"y+ c #ADADAD",
+"z+ c #ACACAC",
+"A+ c #ABABAB",
+"B+ c #AAAAAA",
+"C+ c #A8A8A8",
+"D+ c #A7A7A7",
+"E+ c #A6A6A6",
+"F+ c #A5A5A5",
+"G+ c #A4A4A4",
+"H+ c #A1A1A1",
+"I+ c #A0A0A0",
+"J+ c #9F9F9F",
+"K+ c #B9B9B9",
+"L+ c #565854",
+"M+ c #DDDEDC",
+"N+ c #989898",
+"O+ c #C5C5C5",
+"P+ c #949494",
+"Q+ c #C2C2C2",
+"R+ c #929292",
+"S+ c #C1C1C1",
+"T+ c #909090",
+"U+ c #BFBFBF",
+"V+ c #DCDDDA",
+"W+ c #C0C1BF",
+"X+ c #C1C2C0",
+"Y+ c #969696",
+"Z+ c #C0C0C0",
+"`+ c #8F8F8F",
+" @ c #C4C5C3",
+".@ c #C3C4C2",
+"+@ c #A9A9A9",
+"@@ c #939393",
+"#@ c #CCCDCB",
+"$@ c #525252",
+"%@ c #D4D5D3",
+"&@ c #C9C9C9",
+"*@ c #C7C7C7",
+"=@ c #BBBBBB",
+"-@ c #515151",
+";@ c #D7D8D6",
+">@ c #505050",
+",@ c #D3D4D2",
+" ",
+" . + @ # $ ",
+" % & * = - ; > , ' ",
+" % ) ! ~ { ] ^ / ( _ : ",
+" < [ } | 1 2 3 4 5 6 7 8 # ",
+" 9 0 a b c d e f g 3 h i ",
+" < j k 3 l m n o p ",
+" q r s t u v w x y ",
+" z A B B B B C D E F G H I J B K K K L M ",
+" M N O P Q Q O R c ~ S T U V W X Y Z ` ... ",
+" z Y +.y y y y y : @.#.$.%.&.y y y y y *.=.M ",
+" -.;.>.,.'.).t w 6 !.~.{.].^./.( / (._.:.<.[. ",
+" M }.|.1.2.3.4.5.#.].6.7.8.9.0.a.b.c.d.e.f.g.h.M ",
+" i.j.k.l.m.m.n.o.p.q.r.s.t.u.u.v.w.x.y.z.A.A.B.C. ",
+" z D.E.k.>.>.l.F.G.H.U I.u.u.u.J.K.L.M.z.N.O.P.l.Q. ",
+" R.E.l.>.l.g.1.S.T.U.V.W.a.u.X.Y.Z.`.P.A.O.O.O.O.P.M ",
+" +Y z.m.1.z.A..+.+++@+#+$+%+&+*+=+-+;+>+,+.+=.,+>.'+ ",
+" M P.m.z.2.}..+)+)+,+;+!+~+{+]+^+/+(+_+:+<+-+P.N.>+N.D.z ",
+" [+Y z.A.f.}.}.f.,+;+}+|+1+2+3+4+5+6+7+_+<+P.A.<+-+8+1.9+ ",
+" 0+a+P.f.f..+O.g.=.f.b+c+|+d+y d+7+_+-+f.O.>+}+b+>+P.S.e+ ",
+" M B.1.f+g+f+f+>+)+.+A.z.z.N.O.h+A.N.A.f.-+}+b+;+8+g.X O.8+i+ ",
+" M X z.g+j+k+l+.+z.N.A.P.f..+,+,+,+)+.+f.f.P.P.P.f..+f.)+m+R. ",
+" M E.1.g+n+o+p+P.}.=.S.S.S.z.z.N.N.O.O.O.A.P.f.f..+.+)+)+-+M ",
+" M B.q+f+n+o+r+s+t+u+v+w+N x+y+z+A+B+C+D+E+F+G+Q.H+I+J+J+K+M ",
+"f+f+f+L+r+M+o+p+f+f+f+f+B+z+y+x+A+B+N+O+-.h.P+Q+R+S+T+U+J+q+M ",
+"f+V+n+M+n+n+W+W+W+W+X+f+B+A+y+y+A+B+N+O+Y+h.P+Q+ +Z+`+U+J+t+M ",
+"f+j+ @.@.@.@.@.@.@.@.@f+B+A+y+z+B++@N+O+Y+h.@@S+ +Z+`+U+J+v+M ",
+"f+f+f+f+f+#@#@l+f+f+f+f+y+B+z+z+B++@-.6+..h.@@S+T+U+`+U+I+x+M ",
+" $@O+k.f+%@%@l+)+f.)+8+;+b+<+c+&@*@6+Q+U+D.=@K+0+t+v+w+N ..-@ ",
+" -@M f+;@;@L+M M M M M M M M M M M M M M M M M M M M M >@ ",
+" f+,@,@g+ ",
+" L+g+g+L+ "};
Added: trunk/gtk/10_3/src/icons/pkg-install.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-install.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-install.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-install.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,318 @@
+/* XPM */
+static const char * pkg_install_xpm[] = {
+"32 32 283 2",
+" c None",
+". c #1F4B8A",
+"+ c #214C89",
+"@ c #214C8A",
+"# c #214D8A",
+"$ c #204A88",
+"% c #204B88",
+"& c #2B558F",
+"* c #5B80AF",
+"= c #7998C0",
+"- c #89A6C9",
+"; c #85A2C6",
+"> c #698AB5",
+", c #355D95",
+"' c #1F4C89",
+") c #5377A7",
+"! c #8AA5CA",
+"~ c #8BA7CB",
+"{ c #90ABCE",
+"] c #93ADCE",
+"^ c #96AFD0",
+"/ c #98B1D1",
+"( c #99B2D1",
+"_ c #6C8CB6",
+": c #234E89",
+"< c #1F4987",
+"[ c #5B7CAA",
+"} c #5B7CAB",
+"| c #41669C",
+"1 c #446BA0",
+"2 c #6283B2",
+"3 c #90ABCD",
+"4 c #93ADCF",
+"5 c #8CA7CC",
+"6 c #8AA6CB",
+"7 c #94ADCF",
+"8 c #7C99C1",
+"9 c #325A91",
+"0 c #2D558F",
+"a c #1F4C87",
+"b c #214C88",
+"c c #315891",
+"d c #86A2C7",
+"e c #8DA9CC",
+"f c #84A1C8",
+"g c #809FC6",
+"h c #6587B3",
+"i c #204B8B",
+"j c #224C88",
+"k c #325C93",
+"l c #7F9EC6",
+"m c #7B9BC4",
+"n c #7A9AC3",
+"o c #91ACCE",
+"p c #305991",
+"q c #1E4A86",
+"r c #204A8A",
+"s c #6A8BB7",
+"t c #83A1C8",
+"u c #7697C2",
+"v c #7395C1",
+"w c #86A3C9",
+"x c #6183B1",
+"y c #1F4A87",
+"z c #545454",
+"A c #595959",
+"B c #5C5C5C",
+"C c #4D5766",
+"D c #446798",
+"E c #89A5CB",
+"F c #7193BF",
+"G c #6D90BE",
+"H c #7797C2",
+"I c #7F9DC4",
+"J c #284E83",
+"K c #5B5B5B",
+"L c #585858",
+"M c #535353",
+"N c #AFAFAF",
+"O c #FCFCFC",
+"P c #FEFEFE",
+"Q c #FDFDFD",
+"R c #F0F2F5",
+"S c #6B8FBD",
+"T c #698DBC",
+"U c #6A8EBD",
+"V c #8EA9CC",
+"W c #2A528D",
+"X c #F6F6F6",
+"Y c #F5F5F5",
+"Z c #F4F4F4",
+"` c #F3F3F3",
+" . c #F2F2F2",
+".. c #959595",
+"+. c #AFBCCE",
+"@. c #8CA8CC",
+"#. c #658ABA",
+"$. c #6388B9",
+"%. c #6187B8",
+"&. c #95AECF",
+"*. c #6F89AD",
+"=. c #DEDEDE",
+"-. c #979797",
+";. c #F8F8F8",
+">. c #E5E5E5",
+",. c #9CADC3",
+"'. c #385E95",
+"). c #7A99C2",
+"!. c #8DA8CC",
+"~. c #5F85B8",
+"{. c #5D84B7",
+"]. c #5B82B6",
+"^. c #94AFCF",
+"/. c #97B0D0",
+"(. c #6182B0",
+"_. c #486A9B",
+":. c #D9DADB",
+"<. c #EDEDED",
+"[. c #7E7E7E",
+"}. c #DFDFDF",
+"|. c #ECECEC",
+"1. c #E0E0E0",
+"2. c #E3E3E3",
+"3. c #869BB9",
+"4. c #3A6198",
+"5. c #7B9AC3",
+"6. c #5A82B5",
+"7. c #5981B5",
+"8. c #5880B4",
+"9. c #4E79B0",
+"0. c #4370AB",
+"a. c #3969A7",
+"b. c #6C8FBE",
+"c. c #6889B6",
+"d. c #345A90",
+"e. c #CACDD2",
+"f. c #D7D7D7",
+"g. c #E2E2E2",
+"h. c #C3C3C3",
+"i. c #696969",
+"j. c #FAFAFA",
+"k. c #E1E1E1",
+"l. c #E4E4E4",
+"m. c #E7E7E7",
+"n. c #6C87AC",
+"o. c #42699C",
+"p. c #7B9BC3",
+"q. c #5881B5",
+"r. c #4A76AE",
+"s. c #416EAA",
+"t. c #3666A5",
+"u. c #3364A4",
+"v. c #5C83B6",
+"w. c #7493BE",
+"x. c #2D568F",
+"y. c #BBC3CE",
+"z. c #DCDCDC",
+"A. c #D9D9D9",
+"B. c #E9E9E9",
+"C. c #5F5F5F",
+"D. c #BDBDBD",
+"E. c #F0F0F0",
+"F. c #E0E1E2",
+"G. c #5A78A3",
+"H. c #426A9F",
+"I. c #3A69A7",
+"J. c #4D78B0",
+"K. c #7D9CC4",
+"L. c #315992",
+"M. c #A2B0C2",
+"N. c #DBDBDB",
+"O. c #DADADA",
+"P. c #D8D8D8",
+"Q. c #A2A2A2",
+"R. c #555555",
+"S. c #DDDDDD",
+"T. c #D8D9DA",
+"U. c #486A9A",
+"V. c #476EA2",
+"W. c #6F92BF",
+"X. c #416FAA",
+"Y. c #82A0C7",
+"Z. c #3C6298",
+"`. c #7E93B1",
+" + c #919191",
+".+ c #D6D6D6",
+"++ c #CCCED2",
+"@+ c #395E93",
+"#+ c #557AAC",
+"$+ c #7092BF",
+"%+ c #3D6CA9",
+"&+ c #7E9DC6",
+"*+ c #4A70A2",
+"=+ c #58769F",
+"-+ c #D0D0D0",
+";+ c #D1D1D1",
+">+ c #D2D2D2",
+",+ c #D4D4D4",
+"'+ c #7F7F7F",
+")+ c #D5D5D5",
+"!+ c #BABFC6",
+"~+ c #2F578E",
+"{+ c #5E82B1",
+"]+ c #89A5CA",
+"^+ c #597CAD",
+"/+ c #3C6093",
+"(+ c #C1C3C5",
+"_+ c #CACACA",
+":+ c #CCCCCC",
+"<+ c #CDCDCD",
+"[+ c #676767",
+"}+ c #CECECE",
+"|+ c #C8C8C8",
+"1+ c #AEB4BD",
+"2+ c #2B538C",
+"3+ c #4D72A6",
+"4+ c #2B548D",
+"5+ c #B0B5BB",
+"6+ c #C4C4C4",
+"7+ c #C6C6C6",
+"8+ c #D3D3D3",
+"9+ c #626262",
+"0+ c #B6B6B6",
+"a+ c #EBEBEB",
+"b+ c #CFCFCF",
+"c+ c #CBCBCB",
+"d+ c #A2ABB8",
+"e+ c #9D9D9D",
+"f+ c #F7F7F7",
+"g+ c #CDD0D5",
+"h+ c #575757",
+"i+ c #E8E8E8",
+"j+ c #BABABA",
+"k+ c #B9B9B9",
+"l+ c #B8B8B8",
+"m+ c #B7B7B7",
+"n+ c #B5B5B5",
+"o+ c #B4B4B4",
+"p+ c #B3B3B3",
+"q+ c #B2B2B2",
+"r+ c #B1B1B1",
+"s+ c #AEAEAE",
+"t+ c #ADADAD",
+"u+ c #ACACAC",
+"v+ c #ABABAB",
+"w+ c #AAAAAA",
+"x+ c #A8A8A8",
+"y+ c #A7A7A7",
+"z+ c #A6A6A6",
+"A+ c #A5A5A5",
+"B+ c #A4A4A4",
+"C+ c #A1A1A1",
+"D+ c #A0A0A0",
+"E+ c #9F9F9F",
+"F+ c #EAEAEA",
+"G+ c #848484",
+"H+ c #8A8A8A",
+"I+ c #929292",
+"J+ c #999999",
+"K+ c #9E9E9E",
+"L+ c #A3A3A3",
+"M+ c #989898",
+"N+ c #C5C5C5",
+"O+ c #949494",
+"P+ c #C2C2C2",
+"Q+ c #C1C1C1",
+"R+ c #909090",
+"S+ c #BFBFBF",
+"T+ c #878787",
+"U+ c #969696",
+"V+ c #C0C0C0",
+"W+ c #8F8F8F",
+"X+ c #8E8E8E",
+"Y+ c #8C8C8C",
+"Z+ c #A9A9A9",
+"`+ c #939393",
+" @ c #B0B0B0",
+".@ c #525252",
+"+@ c #C9C9C9",
+"@@ c #C7C7C7",
+"#@ c #BBBBBB",
+"$@ c #515151",
+"%@ c #505050",
+" ",
+" . + @ # $ ",
+" % & * = - ; > , ' ",
+" % ) ! ~ { ] ^ / ( _ : ",
+" < [ } | 1 2 3 4 5 6 7 8 # ",
+" 9 0 a b c d e f g 3 h i ",
+" < j k 3 l m n o p ",
+" q r s t u v w x y ",
+" z A B B B B C D E F G H I J B K K K L M ",
+" M N O P Q Q O R c ~ S T U V W X Y Z ` ... ",
+" z Y +.y y y y y : @.#.$.%.&.y y y y y *.=.M ",
+" -.;.>.,.'.).t w 6 !.~.{.].^./.( / (._.:.<.[. ",
+" M }.|.1.2.3.4.5.#.].6.7.8.9.0.a.b.c.d.e.f.g.h.M ",
+" i.j.k.l.m.m.n.o.p.q.r.s.t.u.u.v.w.x.y.z.A.A.B.C. ",
+" z D.E.k.>.>.l.F.G.H.U I.u.u.u.J.K.L.M.z.N.O.P.l.Q. ",
+" R.E.l.>.l.g.1.S.T.U.V.W.a.u.X.Y.Z.`.P.A.O.O.O.O.P.M ",
+" +Y z.m.1.z.A..+.+++@+#+$+%+&+*+=+-+;+>+,+.+=.,+>.'+ ",
+" M P.m.z.2.}..+)+)+,+;+!+~+{+]+^+/+(+_+:+<+-+P.N.>+N.D.z ",
+" [+Y z.A.f.}.}.f.,+;+}+|+1+2+3+4+5+6+7+_+<+P.A.<+-+8+1.9+ ",
+" 0+a+S.O.P..+O.g.=.f.b+c+|+d+y d+7+_+-+f.O.>+}+b+>+P.S.e+ ",
+" M B.k.f+m.O.A..+)+.+A.z.z.N.O.g+A.N.A.f.-+}+b+;+8+g.X O.8+h+ ",
+" M X z.S.N.z.z.z.z.N.A.P.f..+,+,+,+)+.+f.f.P.P.P.f..+f.)+i+R. ",
+" M E.1.k.k.1.1.}.}.=.S.S.S.z.z.N.N.O.O.O.A.P.f.f..+.+)+)+-+M ",
+" M |.j+j+k+l+m+n+o+p+q+r+N s+t+u+v+w+x+y+z+A+B+Q.C+D+E+E+k+M ",
+" M F+j+j+G+H+I+J+K+L+y+w+u+t+s+v+w+M+N+-.h.O+P+I+Q+R+S+E+m+M ",
+" M B.j+k+T+H+I+J+K+L+y+w+v+t+t+v+w+M+N+U+h.O+P+ +V+W+S+E+o+M ",
+" M m.j+k+X+Y+I+J+K+L+y+w+v+t+u+w+Z+M+N+U+h.`+Q+ +V+W+S+E+q+M ",
+" M l.j+l+l+n+k+p+ @N u+t+w+u+u+w+Z+-.6+..h.`+Q+R+S+W+S+D+s+M ",
+" .@N+k.1.=.z.N.A.f.)+8+;+b+<+c++@@@6+P+S+D.#@k+0+o+q+r+N ..$@ ",
+" $@M M M M M M M M M M M M M M M M M M M M M M M M M M %@ ",
+" ",
+" "};
Added: trunk/gtk/10_3/src/icons/pkg-installed-locked.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-installed-locked.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-installed-locked.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-installed-locked.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,595 @@
+/* XPM */
+static const char * pkg_installed_locked_xpm[] = {
+"32 32 560 2",
+" c None",
+". c #949594",
+"+ c #909090",
+"@ c #8F8F8F",
+"# c #8D8D8D",
+"$ c #8B8B8B",
+"% c #898989",
+"& c #878787",
+"* c #868686",
+"= c #848484",
+"- c #828282",
+"; c #808080",
+"> c #7E7E7E",
+", c #7D7D7D",
+"' c #7B7B7B",
+") c #797979",
+"! c #777777",
+"~ c #7C7C7C",
+"{ c #959595",
+"] c #F1F2EF",
+"^ c #F5F6F3",
+"/ c #F4F5F3",
+"( c #F4F5F2",
+"_ c #F4F4F2",
+": c #F3F4F2",
+"< c #F3F4F1",
+"[ c #F2F4F1",
+"} c #F2F3F1",
+"| c #EDEEEB",
+"1 c #A2A2A2",
+"2 c #F2F3F0",
+"3 c #B9BBC8",
+"4 c #3E3F8E",
+"5 c #545592",
+"6 c #535491",
+"7 c #525290",
+"8 c #515190",
+"9 c #52528F",
+"0 c #51518F",
+"a c #50508F",
+"b c #51518E",
+"c c #53548D",
+"d c #52538D",
+"e c #52528B",
+"f c #51518B",
+"g c #53538D",
+"h c #55568E",
+"i c #54548E",
+"j c #55558E",
+"k c #54548D",
+"l c #535494",
+"m c #D4D7D0",
+"n c #EEF0ED",
+"o c #858685",
+"p c #AAAAA9",
+"q c #F0F2EE",
+"r c #A7AAC0",
+"s c #6A6A91",
+"t c #7E7E96",
+"u c #7D7D95",
+"v c #7C7C94",
+"w c #7A7A93",
+"x c #797992",
+"y c #777790",
+"z c #767690",
+"A c #75758F",
+"B c #74748D",
+"C c #73738D",
+"D c #71718B",
+"E c #70708B",
+"F c #6F6F8A",
+"G c #6D6D88",
+"H c #6B6B86",
+"I c #6A6A85",
+"J c #696985",
+"K c #494A8B",
+"L c #A4A5A2",
+"M c #CFD1CF",
+"N c #8D8E8D",
+"O c #AFB0AF",
+"P c #EFF0ED",
+"Q c #9697B8",
+"R c #67678C",
+"S c #6E6E89",
+"T c #686884",
+"U c #676783",
+"V c #666683",
+"W c #656582",
+"X c #646482",
+"Y c #636380",
+"Z c #626280",
+"` c #454688",
+" . c #D3D6CF",
+".. c #EAECE8",
+"+. c #959695",
+"@. c #B8B8B7",
+"#. c #EEEFEB",
+"$. c #8284AD",
+"%. c #646488",
+"&. c #6A6A86",
+"*. c #676784",
+"=. c #646481",
+"-. c #616180",
+";. c #61617F",
+">. c #5F5F7F",
+",. c #5F5F7E",
+"'. c #535375",
+"). c #3F4084",
+"!. c #B2B4B0",
+"~. c #B7B8B7",
+"{. c #9B9C9B",
+"]. c #BFBFBE",
+"^. c #ECEDE9",
+"/. c #7173A4",
+"(. c #646486",
+"_. c #696986",
+":. c #676785",
+"<. c #666684",
+"[. c #656583",
+"}. c #646483",
+"|. c #636381",
+"1. c #626281",
+"2. c #616181",
+"3. c #606080",
+"4. c #60607F",
+"5. c #5E5E7E",
+"6. c #5B5B7D",
+"7. c #49496E",
+"8. c #36365F",
+"9. c #292954",
+"0. c #242450",
+"a. c #373880",
+"b. c #D2D5CE",
+"c. c #E5E7E3",
+"d. c #A4A5A3",
+"e. c #C5C5C3",
+"f. c #EAECE7",
+"g. c #61639D",
+"h. c #5F5F80",
+"i. c #5D5D7F",
+"j. c #5C5C7E",
+"k. c #565679",
+"l. c #3E3E66",
+"m. c #2A2A56",
+"n. c #272754",
+"o. c #282855",
+"p. c #34357E",
+"q. c #B8BBB6",
+"r. c #ACADAB",
+"s. c #CACBC9",
+"t. c #E8EAE5",
+"u. c #575998",
+"v. c #606081",
+"w. c #5E5E80",
+"x. c #5C5C7F",
+"y. c #5B5B7E",
+"z. c #5A5A7E",
+"A. c #5A5A7D",
+"B. c #58587C",
+"C. c #545479",
+"D. c #3F3F69",
+"E. c #2C2C59",
+"F. c #2A2A58",
+"G. c #2B2B59",
+"H. c #2B2B5A",
+"I. c #2C2C5A",
+"J. c #2C2C5B",
+"K. c #30317C",
+"L. c #D0D4CD",
+"M. c #E0E2DD",
+"N. c #B0B1AF",
+"O. c #8C8C8C",
+"P. c #CFD0CD",
+"Q. c #E7E9E4",
+"R. c #535595",
+"S. c #5B5B7F",
+"T. c #59597E",
+"U. c #59597D",
+"V. c #58587D",
+"W. c #57577C",
+"X. c #55557C",
+"Y. c #474770",
+"Z. c #31315F",
+"`. c #2D2D5C",
+" + c #2E2E5D",
+".+ c #2F2F5E",
+"++ c #2F2F5F",
+"@+ c #30305F",
+"#+ c #303060",
+"$+ c #2D2D7B",
+"%+ c #BFC1BC",
+"&+ c #A4A4A3",
+"*+ c #B6B7B5",
+"=+ c #5D5D5D",
+"-+ c #8E8E8E",
+";+ c #D3D5D2",
+">+ c #E5E7E2",
+",+ c #525393",
+"'+ c #58587F",
+")+ c #58587E",
+"!+ c #57577D",
+"~+ c #56567D",
+"{+ c #54547C",
+"]+ c #53537B",
+"^+ c #4D4D76",
+"/+ c #393967",
+"(+ c #313160",
+"_+ c #313161",
+":+ c #323262",
+"<+ c #333363",
+"[+ c #333364",
+"}+ c #343465",
+"|+ c #2E2E7A",
+"1+ c #C5C9C7",
+"2+ c #DBDDD8",
+"3+ c #BBBCB9",
+"4+ c #5E5E5E",
+"5+ c #8E8E8D",
+"6+ c #D8D8D6",
+"7+ c #E3E6E0",
+"8+ c #505192",
+"9+ c #54547D",
+"0+ c #52527B",
+"a+ c #4F4F79",
+"b+ c #41416E",
+"c+ c #353565",
+"d+ c #353566",
+"e+ c #353567",
+"f+ c #363667",
+"g+ c #363668",
+"h+ c #373768",
+"i+ c #373769",
+"j+ c #383869",
+"k+ c #38386A",
+"l+ c #303078",
+"m+ c #B8BCC3",
+"n+ c #D8DBD5",
+"o+ c #C0C1BE",
+"p+ c #606060",
+"q+ c #DCDDDA",
+"r+ c #E1E4DE",
+"s+ c #4C4D90",
+"t+ c #51517C",
+"u+ c #50507C",
+"v+ c #50507B",
+"w+ c #4E4E7B",
+"x+ c #464674",
+"y+ c #39396B",
+"z+ c #3A3A6C",
+"A+ c #3A3A6D",
+"B+ c #3B3B6D",
+"C+ c #3B3B6E",
+"D+ c #3C3C6F",
+"E+ c #3C3C70",
+"F+ c #313179",
+"G+ c #ADB0BD",
+"H+ c #D5D9D3",
+"I+ c #C4C6C2",
+"J+ c #8A8A89",
+"K+ c #DFE0DE",
+"L+ c #DFE1DC",
+"M+ c #48498E",
+"N+ c #4B4B7A",
+"O+ c #444474",
+"P+ c #3C3C6E",
+"Q+ c #3D3D70",
+"R+ c #3D3D71",
+"S+ c #3E3E71",
+"T+ c #3E3E72",
+"U+ c #3F3F73",
+"V+ c #404074",
+"W+ c #404075",
+"X+ c #323277",
+"Y+ c #A0A3B9",
+"Z+ c #D4D6D0",
+"`+ c #C8CAC7",
+" @ c #5E5E5C",
+".@ c #E3E3E1",
+"+@ c #DCE0D9",
+"@@ c #41418B",
+"#@ c #404072",
+"$@ c #414175",
+"%@ c #414176",
+"&@ c #424276",
+"*@ c #424277",
+"=@ c #434378",
+"-@ c #434379",
+";@ c #444479",
+">@ c #44447A",
+",@ c #45457A",
+"'@ c #36367B",
+")@ c #9193B1",
+"!@ c #D1D5CF",
+"~@ c #CCCECB",
+"{@ c #585958",
+"]@ c #848584",
+"^@ c #E5E6E3",
+"/@ c #DBDED6",
+"(@ c #3C3C88",
+"_@ c #45457B",
+":@ c #46467C",
+"<@ c #47477D",
+"[@ c #47477E",
+"}@ c #48487E",
+"|@ c #48487F",
+"1@ c #49497F",
+"2@ c #3D3D7E",
+"3@ c #8183AA",
+"4@ c #CFD2CC",
+"5@ c #D1D2CF",
+"6@ c #575756",
+"7@ c #808180",
+"8@ c #E7E9E6",
+"9@ c #D9DCD5",
+"0@ c #383987",
+"a@ c #46467D",
+"b@ c #494980",
+"c@ c #4A4A81",
+"d@ c #4B4B82",
+"e@ c #4B4B83",
+"f@ c #4C4C84",
+"g@ c #4D4D85",
+"h@ c #454583",
+"i@ c #7073A3",
+"j@ c #CDD1CB",
+"k@ c #D3D6D1",
+"l@ c #525252",
+"m@ c #EAEBE8",
+"n@ c #D7DAD2",
+"o@ c #202184",
+"p@ c #3B3C87",
+"q@ c #3B3C88",
+"r@ c #3B3B88",
+"s@ c #3B3C89",
+"t@ c #3C3C89",
+"u@ c #3C3C8A",
+"v@ c #3C3D8A",
+"w@ c #3D3D8A",
+"x@ c #373889",
+"y@ c #66689F",
+"z@ c #CBCFC8",
+"A@ c #D7D9D5",
+"B@ c #4D4D4D",
+"C@ c #787878",
+"D@ c #EAECE9",
+"E@ c #D1D4CE",
+"F@ c #CED2CA",
+"G@ c #CED1CA",
+"H@ c #CDD1C9",
+"I@ c #CDD0C9",
+"J@ c #CCD0C8",
+"K@ c #CCCFC8",
+"L@ c #CBCFC7",
+"M@ c #CBCEC7",
+"N@ c #CACEC6",
+"O@ c #AEB0AB",
+"P@ c #B3B6AF",
+"Q@ c #C9CCC5",
+"R@ c #C8CCC4",
+"S@ c #C8CBC4",
+"T@ c #C7CBC4",
+"U@ c #C7CAC3",
+"V@ c #C6CAC3",
+"W@ c #747672",
+"X@ c #343534",
+"Y@ c #2C2C2B",
+"Z@ c #2B2C2B",
+"`@ c #2F302F",
+" # c #A6A8A5",
+".# c #494949",
+"+# c #D4D6D2",
+"@# c #EBECE9",
+"## c #E9EBE7",
+"$# c #E8EAE6",
+"%# c #E7E9E5",
+" c #E6E8E5",
+"*# c #E6E8E4",
+"=# c #E4E6E2",
+"-# c #E3E6E1",
+";# c #E2E5E1",
+"># c #E2E4E0",
+",# c #E1E3DF",
+"'# c #D2D4D1",
+")# c #6F706E",
+"!# c #D2D2D2",
+"~# c #DBDBDB",
+"{# c #BCBCBC",
+"]# c #767676",
+"^# c #272727",
+"/# c #747474",
+"(# c #6E6E6E",
+"_# c #6C6C6C",
+":# c #6A6A6A",
+"<# c #686868",
+"[# c #676767",
+"}# c #656565",
+"|# c #636363",
+"1# c #616161",
+"2# c #5F5F5F",
+"3# c #5C5C5C",
+"4# c #5A5A5A",
+"5# c #585858",
+"6# c #565656",
+"7# c #555555",
+"8# c #535353",
+"9# c #515151",
+"0# c #313131",
+"a# c #838383",
+"b# c #BABABA",
+"c# c #383838",
+"d# c #1D1D1D",
+"e# c #4C4C4C",
+"f# c #B1B1B1",
+"g# c #4F504E",
+"h# c #838581",
+"i# c #ACAFA9",
+"j# c #ADB0AA",
+"k# c #8B8E89",
+"l# c #8D908C",
+"m# c #ABADAA",
+"n# c #A7A7A6",
+"o# c #363636",
+"p# c #C1C1C1",
+"q# c #0D0D0D",
+"r# c #2E2E2E",
+"s# c #AAAAAA",
+"t# c #000000",
+"u# c #525451",
+"v# c #9B9E9A",
+"w# c #AFB2AC",
+"x# c #B1B3AE",
+"y# c #AEB1AB",
+"z# c #A8AAA5",
+"A# c #2C2C2C",
+"B# c #BFBFBF",
+"C# c #141414",
+"D# c #A1A1A1",
+"E# c #A5A5A5",
+"F# c #A8A8A8",
+"G# c #171717",
+"H# c #C1C0C0",
+"I# c #595959",
+"J# c #595958",
+"K# c #585857",
+"L# c #575757",
+"M# c #515150",
+"N# c #505050",
+"O# c #14120F",
+"P# c #9B9794",
+"Q# c #201D1C",
+"R# c #0B0B07",
+"S# c #040302",
+"T# c #050403",
+"U# c #2F2921",
+"V# c #A8A39E",
+"W# c #1A130B",
+"X# c #DCE0D8",
+"Y# c #DFE3DB",
+"Z# c #DFE3DA",
+"`# c #E0E3DA",
+" $ c #E0E3DB",
+".$ c #E1E3DB",
+"+$ c #E0E4DB",
+"@$ c #E0E4DC",
+"#$ c #A59176",
+"$$ c #E0C4A0",
+"%$ c #DFC4A3",
+"&$ c #DABE9A",
+"*$ c #D6BA94",
+"=$ c #CDA676",
+"-$ c #815A2B",
+";$ c #949693",
+">$ c #9F9F9E",
+",$ c #9D9D9D",
+"'$ c #E2C5A1",
+")$ c #D8B58C",
+"!$ c #CA9F68",
+"~$ c #AC8758",
+"{$ c #A78252",
+"]$ c #A78253",
+"^$ c #A37B4B",
+"/$ c #BC8849",
+"($ c #AC712E",
+"_$ c #636463",
+":$ c #BBBDB8",
+"<$ c #9FA09F",
+"[$ c #9C9D9C",
+"}$ c #E3C6A2",
+"|$ c #D5AE7E",
+"1$ c #B08D5F",
+"2$ c #D5B284",
+"3$ c #CFAB7C",
+"4$ c #CFAC7B",
+"5$ c #CBA471",
+"6$ c #BC8746",
+"7$ c #AA6F2B",
+"8$ c #676867",
+"9$ c #BDC0BC",
+"0$ c #A7A9A6",
+"a$ c #AEAEAE",
+"b$ c #ACACAB",
+"c$ c #E1C4A0",
+"d$ c #D0A674",
+"e$ c #C79B64",
+"f$ c #AA8455",
+"g$ c #A47E4E",
+"h$ c #A07744",
+"i$ c #BA8442",
+"j$ c #A4A7A2",
+"k$ c #959991",
+"l$ c #7A7D77",
+"m$ c #A3A6A0",
+"n$ c #777874",
+"o$ c #858782",
+"p$ c #989B94",
+"q$ c #E1C29C",
+"r$ c #CEA470",
+"s$ c #AD8D64",
+"t$ c #D2B289",
+"u$ c #CDAC83",
+"v$ c #CEAD83",
+"w$ c #CCA77B",
+"x$ c #B8803E",
+"y$ c #AD7332",
+"z$ c #D4D9D1",
+"A$ c #E0E5DC",
+"B$ c #E1E5DE",
+"C$ c #E2E5DE",
+"D$ c #E1E6DD",
+"E$ c #E2E6DE",
+"F$ c #E1E6DF",
+"G$ c #E2E7DE",
+"H$ c #E2E7DD",
+"I$ c #E3E7DE",
+"J$ c #E3E8DE",
+"K$ c #E3E8DF",
+"L$ c #E0C29E",
+"M$ c #D4AC79",
+"N$ c #CDA66E",
+"O$ c #AF8D5E",
+"P$ c #AB8758",
+"Q$ c #AB8858",
+"R$ c #A8814C",
+"S$ c #B47E3E",
+"T$ c #575857",
+"U$ c #5A5B5A",
+"V$ c #595A59",
+"W$ c #555655",
+"X$ c #535453",
+"Y$ c #525352",
+"Z$ c #515251",
+"`$ c #525251",
+" % c #D0A874",
+".% c #C6965D",
+"+% c #BE8D50",
+"@% c #BA894B",
+"#% c #BD8C4E",
+"$% c #BC8A4C",
+"%% c #BA8647",
+"&% c #A47136",
+" . + @ @ @ @ @ @ @ @ @ @ # $ % & * = - ; > , ' ) ! ~ ",
+" { ] ^ ^ ^ ^ ^ ^ / / / / ( ( _ _ : : : < < < [ } | ) ",
+" 1 2 3 4 5 5 6 7 8 9 0 a b c d e f g h i j k l m n o ",
+" p q r s t u v w x y z A B C D E F G G H I J K L M N ",
+" O P Q R z A B C D E S G G H I T U V W X Y Z ` ...+. ",
+" @.#.$.%.S G G H &.J T *.V V =.=.Z -.;.>.,.'.).!.~.{. ",
+" ].^./.(._.:.*.<.[.}.|.1.2.3.4.>.5.6.7.8.9.0.a.b.c.d. ",
+" e.f.g.(.}.}.1.2.2.h.h.i.i.j.6.k.l.m.n.n.o.o.p.q.r.r. ",
+" s.t.u.2.v.h.w.x.x.y.z.A.B.C.D.E.F.G.G.H.I.J.K.L.M.N. ",
+" O.P.Q.R.x.S.S.T.U.V.W.W.X.Y.Z.`. + +.+.+++@+#+$+%+&+*+=+ ",
+" -+;+>+,+'+)+!+~+X.{+]+^+/+(+_+_+:+:+<+[+[+}+}+|+1+2+3+4+ ",
+" 5+6+7+8+9+{+{+0+0+a+b+c+}+d+d+e+f+g+h+i+j+k+k+l+m+n+o+p+ ",
+" # q+r+s+t+u+v+w+x+y+i+k+k+y+y+z+z+A+B+C+D+D+E+F+G+H+I+4+ ",
+" J+K+L+M+w+N+O+D+B+C+P+D+E+Q+R+S+T+T+U+U+V+V+W+X+Y+Z+`+ @ ",
+" & .@+@@@#@R+T+T+U+U+V+V+W+$@%@&@*@*@=@-@;@>@,@'@)@!@~@{@ ",
+" ]@^@/@(@%@&@*@*@=@=@;@;@>@_@_@:@:@<@<@[@}@|@1@2@3@4@5@6@ ",
+" 7@8@9@0@_@:@:@a@<@[@}@|@1@b@b@c@c@d@d@e@f@f@g@h@i@j@k@l@ ",
+" ~ m@n@o@p@q@r@r@q@s@t@t@t@s@s@t@u@v@v@v@w@v@v@x@y@z@A@B@ ",
+" C@D@E@F@G@H@I@I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ #.# ",
+" C@+#@#@#..m@##$#$#%#*#c.>+=#-#;#>#,#'#)#' !#~#~#{#]#^# ",
+" /#(#_#:#<#[#}#|#1#2#4+3#4#5#6#7#8#9#0#a#b#c#d#d#e#f#a# ",
+" g#h#i#j#k#k#k#k#k#l#m#n#o#p#q# r#s#t# ",
+" u#v#w#x#w#y#j#j#y#y#j#z#A#B#C#D#E#F#E#G#H#t# ",
+" <#|#1#2#4+3#I#5#J#I#K#L#7#8#9#M#N#0#O#P#Q#R#S#S#T#U#V#W# ",
+" |#X#Y#Y#Z#Y#Y#`# $`# $.$+$+$+$@$@$t##$$$%$%$&$&$&$*$=$-$t#",
+" ;$>$,$,$,$,$,$,$,$,$,$,$,$,$,$,$,$t#'$)$!$~${${$]$^$/$($t#",
+" _$:$E#E#E#<$[$[$[$[$[$[$[$[$[$[$E#E#t#}$|$1$2$3$3$4$5$6$7$t#",
+" 8$9$s#s#s#0$a$a$a$a$a$a$a$a$a$b$&+a$t#c$d$e$f$g$g$g$h$i$($t#",
+" j$k$l$l$l$m$n$n$n$n$n$n$n$n$n$o$p$l$t#q$r$s$t$u$u$v$w$x$y$t#",
+" 2#z$@$@$A$A$B$C$D$E$D$F$G$G$H$G$I$J$K$t#L$M$N$O$P$P$Q$R$6$S$t#",
+" I#T$U$V$T$W$X$Y$Y$Y$Z$Z$Z$Z$`$`$`$`$`$t# %.%+%+%@%@%#%$%%%&%t#",
+" t#t#t#t#t#t#t#t#t#t# "};
Added: trunk/gtk/10_3/src/icons/pkg-installed-upgradable-locked.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-installed-upgradable-locked.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-installed-upgradable-locked.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-installed-upgradable-locked.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,595 @@
+/* XPM */
+static const char * pkg_installed_upgradable_locked_xpm[] = {
+"32 32 560 2",
+" c None",
+". c #949594",
+"+ c #909090",
+"@ c #8F8F8F",
+"# c #8D8D8D",
+"$ c #8B8B8B",
+"% c #898989",
+"& c #878787",
+"* c #868686",
+"= c #848382",
+"- c #B76F2C",
+"; c #CB6913",
+"> c #CE5F05",
+", c #CE5C00",
+"' c #CD5F04",
+") c #C66512",
+"! c #986B47",
+"~ c #7C7C7C",
+"{ c #959595",
+"] c #F1F2EF",
+"^ c #F5F6F3",
+"/ c #F4F5F3",
+"( c #F4F5F2",
+"_ c #F4F4F2",
+": c #DFB994",
+"< c #D16911",
+"[ c #E0811C",
+"} c #F0A132",
+"| c #F7AE3B",
+"1 c #F8B13E",
+"2 c #F7AC3B",
+"3 c #F09F32",
+"4 c #DD7F1E",
+"5 c #C36110",
+"6 c #A2A2A2",
+"7 c #F2F3F0",
+"8 c #B9BBC8",
+"9 c #3E3F8E",
+"0 c #545592",
+"a c #535491",
+"b c #525290",
+"c c #515190",
+"d c #52528F",
+"e c #51518F",
+"f c #50508F",
+"g c #51518E",
+"h c #53548D",
+"i c #52538D",
+"j c #795659",
+"k c #CF6005",
+"l c #EE9C2F",
+"m c #F8AC3D",
+"n c #F79A38",
+"o c #F79537",
+"p c #F79938",
+"q c #F8A63B",
+"r c #E9972E",
+"s c #CC5D00",
+"t c #AAAAA9",
+"u c #F0F2EE",
+"v c #A7AAC0",
+"w c #6A6A91",
+"x c #7E7E96",
+"y c #7D7D95",
+"z c #7C7C94",
+"A c #7A7A93",
+"B c #797992",
+"C c #777790",
+"D c #767690",
+"E c #75758F",
+"F c #74748D",
+"G c #73738D",
+"H c #717087",
+"I c #CE660D",
+"J c #EE9C2E",
+"K c #F8A33B",
+"L c #FBD8B7",
+"M c #FFFFFF",
+"N c #FBD5B0",
+"O c #F89E39",
+"P c #E7952B",
+"Q c #CC5C00",
+"R c #AFB0AF",
+"S c #EFF0ED",
+"T c #9697B8",
+"U c #67678C",
+"V c #71718B",
+"W c #70708B",
+"X c #6E6E89",
+"Y c #6D6D88",
+"Z c #6B6B86",
+"` c #AE672B",
+" . c #E1811D",
+".. c #F8AB3C",
+"+. c #FBD5B2",
+"@. c #F8A43A",
+"#. c #DA7A14",
+"$. c #B8B8B7",
+"%. c #EEEFEB",
+"&. c #8284AD",
+"*. c #646488",
+"=. c #6A6A86",
+"-. c #696985",
+";. c #686884",
+">. c #676784",
+",. c #666683",
+"'. c #CA6510",
+"). c #F69130",
+"!. c #FAC796",
+"~. c #FBD4AE",
+"{. c #FAC898",
+"]. c #F79837",
+"^. c #E7962A",
+"/. c #BFBFBE",
+"(. c #ECEDE9",
+"_. c #7173A4",
+":. c #646486",
+"<. c #696986",
+"[. c #676785",
+"}. c #666684",
+"|. c #656583",
+"1. c #646483",
+"2. c #636381",
+"3. c #626281",
+"4. c #616181",
+"5. c #606080",
+"6. c #F7AB3B",
+"7. c #F69132",
+"8. c #F9B97B",
+"9. c #FBCEA3",
+"0. c #F8B778",
+"a. c #F78E2A",
+"b. c #F79333",
+"c. c #EFA033",
+"d. c #CD5B00",
+"e. c #C5C5C3",
+"f. c #EAECE7",
+"g. c #61639D",
+"h. c #5F5F80",
+"i. c #5D5D7F",
+"j. c #5C5C7E",
+"k. c #F8AD3D",
+"l. c #F79434",
+"m. c #F58416",
+"n. c #F6A352",
+"o. c #F9BD82",
+"p. c #F8A85B",
+"q. c #F57900",
+"r. c #F57A01",
+"s. c #F68517",
+"t. c #F7912E",
+"u. c #F1A235",
+"v. c #CACBC9",
+"w. c #E8EAE5",
+"x. c #575998",
+"y. c #606081",
+"z. c #5E5E80",
+"A. c #5C5C7F",
+"B. c #5B5B7E",
+"C. c #5A5A7E",
+"D. c #5A5A7D",
+"E. c #58587C",
+"F. c #545479",
+"G. c #CB5D02",
+"H. c #F6A531",
+"I. c #F78F29",
+"J. c #F68415",
+"K. c #F57A02",
+"L. c #EB9929",
+"M. c #8C8C8C",
+"N. c #CFD0CD",
+"O. c #E7E9E4",
+"P. c #535595",
+"Q. c #5B5B7F",
+"R. c #59597E",
+"S. c #59597D",
+"T. c #58587D",
+"U. c #57577C",
+"V. c #55557C",
+"W. c #474770",
+"X. c #31315F",
+"Y. c #BE5B0C",
+"Z. c #F0921D",
+"`. c #F57E04",
+" + c #F57D04",
+".+ c #E69426",
+"++ c #8E8E8E",
+"@+ c #D3D5D2",
+"#+ c #E5E7E2",
+"$+ c #525393",
+"%+ c #58587F",
+"&+ c #58587E",
+"*+ c #57577D",
+"=+ c #56567D",
+"-+ c #54547C",
+";+ c #53537B",
+">+ c #4D4D76",
+",+ c #393967",
+"'+ c #313160",
+")+ c #313161",
+"!+ c #744334",
+"~+ c #D87814",
+"{+ c #F79116",
+"]+ c #EC9222",
+"^+ c #D87712",
+"/+ c #8E8E8D",
+"(+ c #D8D8D6",
+"_+ c #E3E6E0",
+":+ c #505192",
+"<+ c #54547D",
+"[+ c #52527B",
+"}+ c #4F4F79",
+"|+ c #41416E",
+"1+ c #353565",
+"2+ c #343465",
+"3+ c #353566",
+"4+ c #353567",
+"5+ c #BA580D",
+"6+ c #EA9020",
+"7+ c #F6870D",
+"8+ c #F58A13",
+"9+ c #D88B26",
+"0+ c #DCDDDA",
+"a+ c #E1E4DE",
+"b+ c #4C4D90",
+"c+ c #51517C",
+"d+ c #50507C",
+"e+ c #50507B",
+"f+ c #4E4E7B",
+"g+ c #464674",
+"h+ c #39396B",
+"i+ c #373769",
+"j+ c #38386A",
+"k+ c #3A3A6C",
+"l+ c #544058",
+"m+ c #C65A04",
+"n+ c #E38E23",
+"o+ c #F79117",
+"p+ c #EF9425",
+"q+ c #DC9433",
+"r+ c #C65B05",
+"s+ c #8A8A89",
+"t+ c #DFE0DE",
+"u+ c #DFE1DC",
+"v+ c #48498E",
+"w+ c #4B4B7A",
+"x+ c #444474",
+"y+ c #3C3C6F",
+"z+ c #3B3B6D",
+"A+ c #3B3B6E",
+"B+ c #3C3C6E",
+"C+ c #3C3C70",
+"D+ c #3D3D70",
+"E+ c #3D3D71",
+"F+ c #3E3E71",
+"G+ c #3E3E72",
+"H+ c #533F55",
+"I+ c #AF5313",
+"J+ c #D17518",
+"K+ c #DD8C25",
+"L+ c #EC9727",
+"M+ c #F19927",
+"N+ c #E09029",
+"O+ c #DD912E",
+"P+ c #D0802B",
+"Q+ c #C66D25",
+"R+ c #765D47",
+"S+ c #E3E3E1",
+"T+ c #DCE0D9",
+"U+ c #41418B",
+"V+ c #404072",
+"W+ c #3F3F73",
+"X+ c #404074",
+"Y+ c #404075",
+"Z+ c #414175",
+"`+ c #414176",
+" @ c #424276",
+".@ c #424277",
+"+@ c #434378",
+"@@ c #6E433A",
+"#@ c #A04F19",
+"$@ c #C15706",
+"%@ c #CB5A00",
+"&@ c #BF5706",
+"*@ c #B05F24",
+"=@ c #B18762",
+"-@ c #CCCECB",
+";@ c #585958",
+">@ c #848584",
+",@ c #E5E6E3",
+"'@ c #DBDED6",
+")@ c #3C3C88",
+"!@ c #444479",
+"~@ c #44447A",
+"{@ c #45457B",
+"]@ c #46467C",
+"^@ c #47477D",
+"/@ c #47477E",
+"(@ c #48487E",
+"_@ c #48487F",
+":@ c #49497F",
+"<@ c #3D3D7E",
+"[@ c #8183AA",
+"}@ c #CFD2CC",
+"|@ c #D1D2CF",
+"1@ c #575756",
+"2@ c #808180",
+"3@ c #E7E9E6",
+"4@ c #D9DCD5",
+"5@ c #383987",
+"6@ c #46467D",
+"7@ c #494980",
+"8@ c #4A4A81",
+"9@ c #4B4B82",
+"0@ c #4B4B83",
+"a@ c #4C4C84",
+"b@ c #4D4D85",
+"c@ c #454583",
+"d@ c #7073A3",
+"e@ c #CDD1CB",
+"f@ c #D3D6D1",
+"g@ c #525252",
+"h@ c #EAEBE8",
+"i@ c #D7DAD2",
+"j@ c #202184",
+"k@ c #3B3C87",
+"l@ c #3B3C88",
+"m@ c #3B3B88",
+"n@ c #3B3C89",
+"o@ c #3C3C89",
+"p@ c #3C3C8A",
+"q@ c #3C3D8A",
+"r@ c #3D3D8A",
+"s@ c #373889",
+"t@ c #66689F",
+"u@ c #CBCFC8",
+"v@ c #D7D9D5",
+"w@ c #4D4D4D",
+"x@ c #787878",
+"y@ c #EAECE9",
+"z@ c #D1D4CE",
+"A@ c #CED2CA",
+"B@ c #CED1CA",
+"C@ c #CDD1C9",
+"D@ c #CDD0C9",
+"E@ c #CCD0C8",
+"F@ c #CCCFC8",
+"G@ c #CBCFC7",
+"H@ c #CBCEC7",
+"I@ c #CACEC6",
+"J@ c #AEB0AB",
+"K@ c #B3B6AF",
+"L@ c #C9CCC5",
+"M@ c #C8CCC4",
+"N@ c #C8CBC4",
+"O@ c #C7CBC4",
+"P@ c #C7CAC3",
+"Q@ c #C6CAC3",
+"R@ c #747672",
+"S@ c #343534",
+"T@ c #2C2C2B",
+"U@ c #2B2C2B",
+"V@ c #2F302F",
+"W@ c #A6A8A5",
+"X@ c #494949",
+"Y@ c #D4D6D2",
+"Z@ c #EBECE9",
+"`@ c #EAECE8",
+" # c #E9EBE7",
+".# c #E8EAE6",
+"+# c #E7E9E5",
+"@# c #E6E8E5",
+"## c #E6E8E4",
+"$# c #E5E7E3",
+"%# c #E4E6E2",
+" c #E3E6E1",
+"*# c #E2E5E1",
+"=# c #E2E4E0",
+"-# c #E1E3DF",
+";# c #D2D4D1",
+"># c #6F706E",
+",# c #7B7B7B",
+"'# c #D2D2D2",
+")# c #DBDBDB",
+"!# c #BCBCBC",
+"~# c #767676",
+"{# c #272727",
+"]# c #747474",
+"^# c #6E6E6E",
+"/# c #6C6C6C",
+"(# c #6A6A6A",
+"_# c #686868",
+":# c #676767",
+"<# c #656565",
+"[# c #636363",
+"}# c #616161",
+"|# c #5F5F5F",
+"1# c #5E5E5E",
+"2# c #5C5C5C",
+"3# c #5A5A5A",
+"4# c #585858",
+"5# c #565656",
+"6# c #555555",
+"7# c #535353",
+"8# c #515151",
+"9# c #313131",
+"0# c #838383",
+"a# c #BABABA",
+"b# c #383838",
+"c# c #1D1D1D",
+"d# c #4C4C4C",
+"e# c #B1B1B1",
+"f# c #4F504E",
+"g# c #838581",
+"h# c #ACAFA9",
+"i# c #ADB0AA",
+"j# c #8B8E89",
+"k# c #8D908C",
+"l# c #ABADAA",
+"m# c #A7A7A6",
+"n# c #363636",
+"o# c #C1C1C1",
+"p# c #0D0D0D",
+"q# c #2E2E2E",
+"r# c #AAAAAA",
+"s# c #000000",
+"t# c #525451",
+"u# c #9B9E9A",
+"v# c #AFB2AC",
+"w# c #B1B3AE",
+"x# c #AEB1AB",
+"y# c #A8AAA5",
+"z# c #2C2C2C",
+"A# c #BFBFBF",
+"B# c #141414",
+"C# c #A1A1A1",
+"D# c #A5A5A5",
+"E# c #A8A8A8",
+"F# c #171717",
+"G# c #C1C0C0",
+"H# c #595959",
+"I# c #595958",
+"J# c #585857",
+"K# c #575757",
+"L# c #515150",
+"M# c #505050",
+"N# c #14120F",
+"O# c #9B9794",
+"P# c #201D1C",
+"Q# c #0B0B07",
+"R# c #040302",
+"S# c #050403",
+"T# c #2F2921",
+"U# c #A8A39E",
+"V# c #1A130B",
+"W# c #DCE0D8",
+"X# c #DFE3DB",
+"Y# c #DFE3DA",
+"Z# c #E0E3DA",
+"`# c #E0E3DB",
+" $ c #E1E3DB",
+".$ c #E0E4DB",
+"+$ c #E0E4DC",
+"@$ c #A59176",
+"#$ c #E0C4A0",
+"$$ c #DFC4A3",
+"%$ c #DABE9A",
+"&$ c #D6BA94",
+"*$ c #CDA676",
+"=$ c #815A2B",
+"-$ c #949693",
+";$ c #9F9F9E",
+">$ c #9D9D9D",
+",$ c #E2C5A1",
+"'$ c #D8B58C",
+")$ c #CA9F68",
+"!$ c #AC8758",
+"~$ c #A78252",
+"{$ c #A78253",
+"]$ c #A37B4B",
+"^$ c #BC8849",
+"/$ c #AC712E",
+"($ c #636463",
+"_$ c #BBBDB8",
+":$ c #9FA09F",
+"<$ c #9C9D9C",
+"[$ c #E3C6A2",
+"}$ c #D5AE7E",
+"|$ c #B08D5F",
+"1$ c #D5B284",
+"2$ c #CFAB7C",
+"3$ c #CFAC7B",
+"4$ c #CBA471",
+"5$ c #BC8746",
+"6$ c #AA6F2B",
+"7$ c #676867",
+"8$ c #BDC0BC",
+"9$ c #A7A9A6",
+"0$ c #AEAEAE",
+"a$ c #ACACAB",
+"b$ c #A4A4A3",
+"c$ c #E1C4A0",
+"d$ c #D0A674",
+"e$ c #C79B64",
+"f$ c #AA8455",
+"g$ c #A47E4E",
+"h$ c #A07744",
+"i$ c #BA8442",
+"j$ c #A4A7A2",
+"k$ c #959991",
+"l$ c #7A7D77",
+"m$ c #A3A6A0",
+"n$ c #777874",
+"o$ c #858782",
+"p$ c #989B94",
+"q$ c #E1C29C",
+"r$ c #CEA470",
+"s$ c #AD8D64",
+"t$ c #D2B289",
+"u$ c #CDAC83",
+"v$ c #CEAD83",
+"w$ c #CCA77B",
+"x$ c #B8803E",
+"y$ c #AD7332",
+"z$ c #D4D9D1",
+"A$ c #E0E5DC",
+"B$ c #E1E5DE",
+"C$ c #E2E5DE",
+"D$ c #E1E6DD",
+"E$ c #E2E6DE",
+"F$ c #E1E6DF",
+"G$ c #E2E7DE",
+"H$ c #E2E7DD",
+"I$ c #E3E7DE",
+"J$ c #E3E8DE",
+"K$ c #E3E8DF",
+"L$ c #E0C29E",
+"M$ c #D4AC79",
+"N$ c #CDA66E",
+"O$ c #AF8D5E",
+"P$ c #AB8758",
+"Q$ c #AB8858",
+"R$ c #A8814C",
+"S$ c #B47E3E",
+"T$ c #575857",
+"U$ c #5A5B5A",
+"V$ c #595A59",
+"W$ c #555655",
+"X$ c #535453",
+"Y$ c #525352",
+"Z$ c #515251",
+"`$ c #525251",
+" % c #D0A874",
+".% c #C6965D",
+"+% c #BE8D50",
+"@% c #BA894B",
+"#% c #BD8C4E",
+"$% c #BC8A4C",
+"%% c #BA8647",
+"&% c #A47136",
+" . + @ @ @ @ @ @ @ @ @ @ # $ % & * = - ; > , ' ) ! ~ ",
+" { ] ^ ^ ^ ^ ^ ^ / / / / ( ( _ _ : < [ } | 1 2 3 4 5 ",
+" 6 7 8 9 0 0 a b c d e f g h i j k l m n o o o p q r s ",
+" t u v w x y z A B C D E F G H I J K o o L M N o o O P Q ",
+" R S T U D E F G V W X Y Y Z ` ...o o o L M +.o o o @.#. ",
+" $.%.&.*.X Y Y Z =.-.;.>.,.,.'.3 p o o ).!.~.{.o o o ].^., ",
+" /.(._.:.<.[.>.}.|.1.2.3.4.5.' 6.o o o 7.8.9.0.a.b.o o c.d.",
+" e.f.g.:.1.1.3.4.4.h.h.i.i.j., k.o o l.m.n.o.p.q.r.s.t.u., ",
+" v.w.x.4.y.h.z.A.A.B.C.D.E.F.G.H.I.J.K.q.q.q.q.q.q.q.q.L., ",
+" M.N.O.P.A.Q.Q.R.S.T.U.U.V.W.X.Y.Z.`.q.q.q.o.M 8.q.q.q. +.+, ",
+" ++@+#+$+%+&+*+=+V.-+;+>+,+'+)+!+~+{+q.q.q.o.M 8.q.q.q.]+^+ ",
+" /+(+_+:+<+-+-+[+[+}+|+1+2+3+3+4+5+6+7+q.q.q.q.q.q.q.8+9+, ",
+" # 0+a+b+c+d+e+f+g+h+i+j+j+h+h+k+l+m+n+o+ +q.q.q. +p+q+r+ ",
+" s+t+u+v+f+w+x+y+z+A+B+y+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+ ",
+" & S+T+U+V+E+G+G+W+W+X+X+Y+Z+`+ @.@.@+@@@#@$@%@&@*@=@-@;@ ",
+" >@,@'@)@`+ @.@.@+@+@!@!@~@{@{@]@]@^@^@/@(@_@:@<@[@}@|@1@ ",
+" 2@3@4@5@{@]@]@6@^@/@(@_@:@7@7@8@8@9@9@0@a@a@b@c@d@e@f@g@ ",
+" ~ h@i@j@k@l@m@m@l@n@o@o@o@n@n@o@p@q@q@q@r@q@q@s@t@u@v@w@ ",
+" x@y@z@A@B@C@D@D@E@F@G@H@I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@ ",
+" x@Y@Z@Z@`@h@ #.#.#+#@###$##+%#*#=#-#;#>#,#'#)#)#!#~#{# ",
+" ]#^#/#(#_#:#<#[#}#|#1#2#3#4#5#6#7#8#9#0#a#b#c#c#d#e#0# ",
+" f#g#h#i#j#j#j#j#j#k#l#m#n#o#p# q#r#s# ",
+" t#u#v#w#v#x#i#i#x#x#i#y#z#A#B#C#D#E#D#F#G#s# ",
+" _#[#}#|#1#2#H#4#I#H#J#K#6#7#8#L#M#9#N#O#P#Q#R#R#S#T#U#V# ",
+" [#W#X#X#Y#X#X#Z#`#Z#`# $.$.$.$+$+$s#@$#$$$$$%$%$%$&$*$=$s#",
+" -$;$>$>$>$>$>$>$>$>$>$>$>$>$>$>$>$s#,$'$)$!$~$~${$]$^$/$s#",
+" ($_$D#D#D#:$<$<$<$<$<$<$<$<$<$<$D#D#s#[$}$|$1$2$2$3$4$5$6$s#",
+" 7$8$r#r#r#9$0$0$0$0$0$0$0$0$0$a$b$0$s#c$d$e$f$g$g$g$h$i$/$s#",
+" j$k$l$l$l$m$n$n$n$n$n$n$n$n$n$o$p$l$s#q$r$s$t$u$u$v$w$x$y$s#",
+" |#z$+$+$A$A$B$C$D$E$D$F$G$G$H$G$I$J$K$s#L$M$N$O$P$P$Q$R$5$S$s#",
+" H#T$U$V$T$W$X$Y$Y$Y$Z$Z$Z$Z$`$`$`$`$`$s# %.%+%+%@%@%#%$%%%&%s#",
+" s#s#s#s#s#s#s#s#s#s# "};
Added: trunk/gtk/10_3/src/icons/pkg-installed-upgradable.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-installed-upgradable.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-installed-upgradable.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-installed-upgradable.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,557 @@
+/* XPM */
+static const char * pkg_installed_upgradable_xpm[] = {
+"32 32 522 2",
+" c None",
+". c #949594",
+"+ c #909090",
+"@ c #8F8F8F",
+"# c #8D8D8D",
+"$ c #8B8B8B",
+"% c #898989",
+"& c #878787",
+"* c #868686",
+"= c #848382",
+"- c #B76F2C",
+"; c #CB6913",
+"> c #CE5F05",
+", c #CE5C00",
+"' c #CD5F04",
+") c #C66512",
+"! c #986B47",
+"~ c #7C7C7C",
+"{ c #959595",
+"] c #F1F2EF",
+"^ c #F5F6F3",
+"/ c #F4F5F3",
+"( c #F4F5F2",
+"_ c #F4F4F2",
+": c #DFB994",
+"< c #D16911",
+"[ c #E0811C",
+"} c #F0A132",
+"| c #F7AE3B",
+"1 c #F8B13E",
+"2 c #F7AC3B",
+"3 c #F09F32",
+"4 c #DD7F1E",
+"5 c #C36110",
+"6 c #A2A2A2",
+"7 c #F2F3F0",
+"8 c #B9BBC8",
+"9 c #3E3F8E",
+"0 c #545592",
+"a c #535491",
+"b c #525290",
+"c c #515190",
+"d c #52528F",
+"e c #51518F",
+"f c #50508F",
+"g c #51518E",
+"h c #53548D",
+"i c #52538D",
+"j c #795659",
+"k c #CF6005",
+"l c #EE9C2F",
+"m c #F8AC3D",
+"n c #F79A38",
+"o c #F79537",
+"p c #F79938",
+"q c #F8A63B",
+"r c #E9972E",
+"s c #CC5D00",
+"t c #AAAAA9",
+"u c #F0F2EE",
+"v c #A7AAC0",
+"w c #6A6A91",
+"x c #7E7E96",
+"y c #7D7D95",
+"z c #7C7C94",
+"A c #7A7A93",
+"B c #797992",
+"C c #777790",
+"D c #767690",
+"E c #75758F",
+"F c #74748D",
+"G c #73738D",
+"H c #717087",
+"I c #CE660D",
+"J c #EE9C2E",
+"K c #F8A33B",
+"L c #FBD8B7",
+"M c #FFFFFF",
+"N c #FBD5B0",
+"O c #F89E39",
+"P c #E7952B",
+"Q c #CC5C00",
+"R c #AFB0AF",
+"S c #EFF0ED",
+"T c #9697B8",
+"U c #67678C",
+"V c #71718B",
+"W c #70708B",
+"X c #6E6E89",
+"Y c #6D6D88",
+"Z c #6B6B86",
+"` c #AE672B",
+" . c #E1811D",
+".. c #F8AB3C",
+"+. c #FBD5B2",
+"@. c #F8A43A",
+"#. c #DA7A14",
+"$. c #B8B8B7",
+"%. c #EEEFEB",
+"&. c #8284AD",
+"*. c #646488",
+"=. c #6A6A86",
+"-. c #696985",
+";. c #686884",
+">. c #676784",
+",. c #666683",
+"'. c #CA6510",
+"). c #F69130",
+"!. c #FAC796",
+"~. c #FBD4AE",
+"{. c #FAC898",
+"]. c #F79837",
+"^. c #E7962A",
+"/. c #BFBFBE",
+"(. c #ECEDE9",
+"_. c #7173A4",
+":. c #646486",
+"<. c #696986",
+"[. c #676785",
+"}. c #666684",
+"|. c #656583",
+"1. c #646483",
+"2. c #636381",
+"3. c #626281",
+"4. c #616181",
+"5. c #606080",
+"6. c #F7AB3B",
+"7. c #F69132",
+"8. c #F9B97B",
+"9. c #FBCEA3",
+"0. c #F8B778",
+"a. c #F78E2A",
+"b. c #F79333",
+"c. c #EFA033",
+"d. c #CD5B00",
+"e. c #C5C5C3",
+"f. c #EAECE7",
+"g. c #61639D",
+"h. c #5F5F80",
+"i. c #5D5D7F",
+"j. c #5C5C7E",
+"k. c #F8AD3D",
+"l. c #F79434",
+"m. c #F58416",
+"n. c #F6A352",
+"o. c #F9BD82",
+"p. c #F8A85B",
+"q. c #F57900",
+"r. c #F57A01",
+"s. c #F68517",
+"t. c #F7912E",
+"u. c #F1A235",
+"v. c #CACBC9",
+"w. c #E8EAE5",
+"x. c #575998",
+"y. c #606081",
+"z. c #5E5E80",
+"A. c #5C5C7F",
+"B. c #5B5B7E",
+"C. c #5A5A7E",
+"D. c #5A5A7D",
+"E. c #58587C",
+"F. c #545479",
+"G. c #CB5D02",
+"H. c #F6A531",
+"I. c #F78F29",
+"J. c #F68415",
+"K. c #F57A02",
+"L. c #EB9929",
+"M. c #8C8C8C",
+"N. c #CFD0CD",
+"O. c #E7E9E4",
+"P. c #535595",
+"Q. c #5B5B7F",
+"R. c #59597E",
+"S. c #59597D",
+"T. c #58587D",
+"U. c #57577C",
+"V. c #55557C",
+"W. c #474770",
+"X. c #31315F",
+"Y. c #BE5B0C",
+"Z. c #F0921D",
+"`. c #F57E04",
+" + c #F57D04",
+".+ c #E69426",
+"++ c #8E8E8E",
+"@+ c #D3D5D2",
+"#+ c #E5E7E2",
+"$+ c #525393",
+"%+ c #58587F",
+"&+ c #58587E",
+"*+ c #57577D",
+"=+ c #56567D",
+"-+ c #54547C",
+";+ c #53537B",
+">+ c #4D4D76",
+",+ c #393967",
+"'+ c #313160",
+")+ c #313161",
+"!+ c #744334",
+"~+ c #D87814",
+"{+ c #F79116",
+"]+ c #EC9222",
+"^+ c #D87712",
+"/+ c #8E8E8D",
+"(+ c #D8D8D6",
+"_+ c #E3E6E0",
+":+ c #505192",
+"<+ c #54547D",
+"[+ c #52527B",
+"}+ c #4F4F79",
+"|+ c #41416E",
+"1+ c #353565",
+"2+ c #343465",
+"3+ c #353566",
+"4+ c #353567",
+"5+ c #BA580D",
+"6+ c #EA9020",
+"7+ c #F6870D",
+"8+ c #F58A13",
+"9+ c #D88B26",
+"0+ c #DCDDDA",
+"a+ c #E1E4DE",
+"b+ c #4C4D90",
+"c+ c #51517C",
+"d+ c #50507C",
+"e+ c #50507B",
+"f+ c #4E4E7B",
+"g+ c #464674",
+"h+ c #39396B",
+"i+ c #373769",
+"j+ c #38386A",
+"k+ c #3A3A6C",
+"l+ c #544058",
+"m+ c #C65A04",
+"n+ c #E38E23",
+"o+ c #F79117",
+"p+ c #EF9425",
+"q+ c #DC9433",
+"r+ c #C65B05",
+"s+ c #8A8A89",
+"t+ c #DFE0DE",
+"u+ c #DFE1DC",
+"v+ c #48498E",
+"w+ c #4B4B7A",
+"x+ c #444474",
+"y+ c #3C3C6F",
+"z+ c #3B3B6D",
+"A+ c #3B3B6E",
+"B+ c #3C3C6E",
+"C+ c #3C3C70",
+"D+ c #3D3D70",
+"E+ c #3D3D71",
+"F+ c #3E3E71",
+"G+ c #3E3E72",
+"H+ c #533F55",
+"I+ c #AF5313",
+"J+ c #D17518",
+"K+ c #DD8C25",
+"L+ c #EC9727",
+"M+ c #F19927",
+"N+ c #E09029",
+"O+ c #DD912E",
+"P+ c #D0802B",
+"Q+ c #C66D25",
+"R+ c #765D47",
+"S+ c #E3E3E1",
+"T+ c #DCE0D9",
+"U+ c #41418B",
+"V+ c #404072",
+"W+ c #3F3F73",
+"X+ c #404074",
+"Y+ c #404075",
+"Z+ c #414175",
+"`+ c #414176",
+" @ c #424276",
+".@ c #424277",
+"+@ c #434378",
+"@@ c #6E433A",
+"#@ c #A04F19",
+"$@ c #C15706",
+"%@ c #CB5A00",
+"&@ c #BF5706",
+"*@ c #B05F24",
+"=@ c #B18762",
+"-@ c #CCCECB",
+";@ c #585958",
+">@ c #848584",
+",@ c #E5E6E3",
+"'@ c #DBDED6",
+")@ c #3C3C88",
+"!@ c #444479",
+"~@ c #44447A",
+"{@ c #45457B",
+"]@ c #46467C",
+"^@ c #47477D",
+"/@ c #47477E",
+"(@ c #48487E",
+"_@ c #48487F",
+":@ c #49497F",
+"<@ c #3D3D7E",
+"[@ c #8183AA",
+"}@ c #CFD2CC",
+"|@ c #D1D2CF",
+"1@ c #575756",
+"2@ c #808180",
+"3@ c #E7E9E6",
+"4@ c #D9DCD5",
+"5@ c #383987",
+"6@ c #46467D",
+"7@ c #494980",
+"8@ c #4A4A81",
+"9@ c #4B4B82",
+"0@ c #4B4B83",
+"a@ c #4C4C84",
+"b@ c #4D4D85",
+"c@ c #454583",
+"d@ c #7073A3",
+"e@ c #CDD1CB",
+"f@ c #D3D6D1",
+"g@ c #525252",
+"h@ c #EAEBE8",
+"i@ c #D7DAD2",
+"j@ c #202184",
+"k@ c #3B3C87",
+"l@ c #3B3C88",
+"m@ c #3B3B88",
+"n@ c #3B3C89",
+"o@ c #3C3C89",
+"p@ c #3C3C8A",
+"q@ c #3C3D8A",
+"r@ c #3D3D8A",
+"s@ c #373889",
+"t@ c #66689F",
+"u@ c #CBCFC8",
+"v@ c #D7D9D5",
+"w@ c #4D4D4D",
+"x@ c #787878",
+"y@ c #EAECE9",
+"z@ c #D1D4CE",
+"A@ c #CED2CA",
+"B@ c #CED1CA",
+"C@ c #CDD1C9",
+"D@ c #CDD0C9",
+"E@ c #CCD0C8",
+"F@ c #CCCFC8",
+"G@ c #CBCFC7",
+"H@ c #CBCEC7",
+"I@ c #CACEC6",
+"J@ c #AEB0AB",
+"K@ c #B3B6AF",
+"L@ c #C9CCC5",
+"M@ c #C8CCC4",
+"N@ c #C8CBC4",
+"O@ c #C7CBC4",
+"P@ c #C7CAC3",
+"Q@ c #C6CAC3",
+"R@ c #C6C9C3",
+"S@ c #C5C9C3",
+"T@ c #C5C8C2",
+"U@ c #C4C8C2",
+"V@ c #C5C9C2",
+"W@ c #D9DBD7",
+"X@ c #4A4A4A",
+"Y@ c #D4D6D2",
+"Z@ c #EBECE9",
+"`@ c #EAECE8",
+" # c #E9EBE7",
+".# c #E8EAE6",
+"+# c #E7E9E5",
+"@# c #E6E8E5",
+"## c #E6E8E4",
+"$# c #E5E7E3",
+"%# c #E4E6E2",
+" c #E3E6E1",
+"*# c #E2E5E1",
+"=# c #E2E4E0",
+"-# c #E1E3DF",
+";# c #E0E2DE",
+"># c #DFE2DD",
+",# c #DEE1DC",
+"'# c #DEE0DC",
+")# c #DDDFDB",
+"!# c #DCDEDA",
+"~# c #C0C2BE",
+"{# c #4D4D4C",
+"]# c #747474",
+"^# c #6E6E6E",
+"/# c #6C6C6C",
+"(# c #6A6A6A",
+"_# c #686868",
+":# c #676767",
+"<# c #656565",
+"[# c #636363",
+"}# c #616161",
+"|# c #5F5F5F",
+"1# c #5E5E5E",
+"2# c #5C5C5C",
+"3# c #5A5A5A",
+"4# c #585858",
+"5# c #565656",
+"6# c #555555",
+"7# c #535353",
+"8# c #515151",
+"9# c #4F4F4F",
+"0# c #4C4C4C",
+"a# c #484848",
+"b# c #4F504E",
+"c# c #838581",
+"d# c #ACAFA9",
+"e# c #ADB0AA",
+"f# c #8B8E89",
+"g# c #8D908C",
+"h# c #ABADAA",
+"i# c #A7A7A6",
+"j# c #A1A1A0",
+"k# c #7C7D7C",
+"l# c #525451",
+"m# c #9B9E9A",
+"n# c #AFB2AC",
+"o# c #B1B3AE",
+"p# c #AEB1AB",
+"q# c #A8AAA5",
+"r# c #9D9F9D",
+"s# c #939392",
+"t# c #A1A1A1",
+"u# c #A5A5A5",
+"v# c #A8A8A8",
+"w# c #595959",
+"x# c #595958",
+"y# c #585857",
+"z# c #575757",
+"A# c #515150",
+"B# c #505050",
+"C# c #4E4E4E",
+"D# c #AAAAAA",
+"E# c #A7A7A7",
+"F# c #ACACAC",
+"G# c #DCE0D8",
+"H# c #DFE3DB",
+"I# c #DFE3DA",
+"J# c #E0E3DA",
+"K# c #E0E3DB",
+"L# c #E1E3DB",
+"M# c #E0E4DB",
+"N# c #E0E4DC",
+"O# c #E1E4DB",
+"P# c #E1E4DC",
+"Q# c #DDE2D9",
+"R# c #545654",
+"S# c #949693",
+"T# c #9F9F9E",
+"U# c #9D9D9D",
+"V# c #9A9B9A",
+"W# c #DADDD5",
+"X# c #9B9B9A",
+"Y# c #9B9B9B",
+"Z# c #9A9B99",
+"`# c #959792",
+" $ c #636463",
+".$ c #BBBDB8",
+"+$ c #9FA09F",
+"@$ c #9C9D9C",
+"#$ c #C9CCC6",
+"$$ c #A0A19F",
+"%$ c #BCC0B9",
+"&$ c #5C5D5C",
+"*$ c #ABABAB",
+"=$ c #676867",
+"-$ c #BDC0BC",
+";$ c #A7A9A6",
+">$ c #AEAEAE",
+",$ c #ACACAB",
+"'$ c #A4A4A3",
+")$ c #B1B2B0",
+"!$ c #B4B6B1",
+"~$ c #AAABAA",
+"{$ c #BEC1BC",
+"]$ c #606160",
+"^$ c #A4A7A2",
+"/$ c #959991",
+"($ c #7A7D77",
+"_$ c #A3A6A0",
+":$ c #777874",
+"<$ c #858782",
+"[$ c #989B94",
+"}$ c #989B95",
+"|$ c #D2D4CD",
+"1$ c #868983",
+"2$ c #848882",
+"3$ c #9EA19A",
+"4$ c #A6A9A4",
+"5$ c #D4D9D1",
+"6$ c #E0E5DC",
+"7$ c #E1E5DE",
+"8$ c #E2E5DE",
+"9$ c #E1E6DD",
+"0$ c #E2E6DE",
+"a$ c #E1E6DF",
+"b$ c #E2E7DE",
+"c$ c #E2E7DD",
+"d$ c #E3E7DE",
+"e$ c #E3E8DE",
+"f$ c #E3E8DF",
+"g$ c #E4E8DF",
+"h$ c #E5E8E0",
+"i$ c #E4E9E0",
+"j$ c #E5E9E0",
+"k$ c #E5E9E1",
+"l$ c #DCE1D9",
+"m$ c #575857",
+"n$ c #5A5B5A",
+"o$ c #595A59",
+"p$ c #555655",
+"q$ c #535453",
+"r$ c #525352",
+"s$ c #515251",
+"t$ c #525251",
+"u$ c #535352",
+"v$ c #545453",
+"w$ c #4D4E4D",
+" . + @ @ @ @ @ @ @ @ @ @ # $ % & * = - ; > , ' ) ! ~ ",
+" { ] ^ ^ ^ ^ ^ ^ / / / / ( ( _ _ : < [ } | 1 2 3 4 5 ",
+" 6 7 8 9 0 0 a b c d e f g h i j k l m n o o o p q r s ",
+" t u v w x y z A B C D E F G H I J K o o L M N o o O P Q ",
+" R S T U D E F G V W X Y Y Z ` ...o o o L M +.o o o @.#. ",
+" $.%.&.*.X Y Y Z =.-.;.>.,.,.'.3 p o o ).!.~.{.o o o ].^., ",
+" /.(._.:.<.[.>.}.|.1.2.3.4.5.' 6.o o o 7.8.9.0.a.b.o o c.d.",
+" e.f.g.:.1.1.3.4.4.h.h.i.i.j., k.o o l.m.n.o.p.q.r.s.t.u., ",
+" v.w.x.4.y.h.z.A.A.B.C.D.E.F.G.H.I.J.K.q.q.q.q.q.q.q.q.L., ",
+" M.N.O.P.A.Q.Q.R.S.T.U.U.V.W.X.Y.Z.`.q.q.q.o.M 8.q.q.q. +.+, ",
+" ++@+#+$+%+&+*+=+V.-+;+>+,+'+)+!+~+{+q.q.q.o.M 8.q.q.q.]+^+ ",
+" /+(+_+:+<+-+-+[+[+}+|+1+2+3+3+4+5+6+7+q.q.q.q.q.q.q.8+9+, ",
+" # 0+a+b+c+d+e+f+g+h+i+j+j+h+h+k+l+m+n+o+ +q.q.q. +p+q+r+ ",
+" s+t+u+v+f+w+x+y+z+A+B+y+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+ ",
+" & S+T+U+V+E+G+G+W+W+X+X+Y+Z+`+ @.@.@+@@@#@$@%@&@*@=@-@;@ ",
+" >@,@'@)@`+ @.@.@+@+@!@!@~@{@{@]@]@^@^@/@(@_@:@<@[@}@|@1@ ",
+" 2@3@4@5@{@]@]@6@^@/@(@_@:@7@7@8@8@9@9@0@a@a@b@c@d@e@f@g@ ",
+" ~ h@i@j@k@l@m@m@l@n@o@o@o@n@n@o@p@q@q@q@r@q@q@s@t@u@v@w@ ",
+" x@y@z@A@B@C@D@D@E@F@G@H@I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@ ",
+" x@Y@Z@Z@`@h@ #.#.#+#@###$##+%#*#=#-#-#;#>#,#'#)#!#~#{# ",
+" ]#^#/#(#_#:#<#[#}#|#1#2#3#4#5#6#7#8#9#w@0#X@a#a#a#w@ ",
+" b#c#d#e#f#f#f#f#f#g#h#i#j#k# ",
+" l#m#n#o#n#p#e#e#p#p#e#q#r#s#6 t#u#v#u# ",
+" _#[#}#|#1#2#w#4#x#w#y#z#6#7#8#A#B#9#w@0#0#0#w@C#<#D#E#F# ",
+" [#G#H#H#I#H#H#J#K#J#K#L#M#M#M#N#N#M#N#M#N#O#P#Q#R# v#D#",
+" S#T#U#U#U#U#U#U#U#U#U#U#U#U#U#U#U#U#V#W#X#Y#Y#Z#`# 6 v#",
+" $.$u#u#u#+$@$@$@$@$@$@$@$@$@$@$u#u#u#u##$$$u#u#u#%$&$E#*$ ",
+" =$-$D#D#D#;$>$>$>$>$>$>$>$>$>$,$'$>$>$>$)$!$~$D#D#{$]$ ",
+" ^$/$($($($_$:$:$:$:$:$:$:$:$:$<$[$($($($}$|$1$2$2$3$4$ ",
+" |#5$N#N#6$6$7$8$9$0$9$a$b$b$c$b$d$e$f$g$g$h$i$j$i$i$k$l$8# ",
+" w#m$n$o$m$p$q$r$r$r$s$s$s$s$t$t$t$t$t$t$t$t$u$u$u$u$v$B#w$ ",
+" "};
Added: trunk/gtk/10_3/src/icons/pkg-installed.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-installed.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-installed.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-installed.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,558 @@
+/* XPM */
+static const char * pkg_installed_xpm[] = {
+"32 32 523 2",
+" c None",
+". c #949594",
+"+ c #909090",
+"@ c #8F8F8F",
+"# c #8D8D8D",
+"$ c #8B8B8B",
+"% c #898989",
+"& c #878787",
+"* c #868686",
+"= c #848484",
+"- c #828282",
+"; c #808080",
+"> c #7E7E7E",
+", c #7D7D7D",
+"' c #7B7B7B",
+") c #797979",
+"! c #777777",
+"~ c #7C7C7C",
+"{ c #959595",
+"] c #F1F2EF",
+"^ c #F5F6F3",
+"/ c #F4F5F3",
+"( c #F4F5F2",
+"_ c #F4F4F2",
+": c #F3F4F2",
+"< c #F3F4F1",
+"[ c #F2F4F1",
+"} c #F2F3F1",
+"| c #EDEEEB",
+"1 c #A2A2A2",
+"2 c #F2F3F0",
+"3 c #B9BBC8",
+"4 c #3E3F8E",
+"5 c #545592",
+"6 c #535491",
+"7 c #525290",
+"8 c #515190",
+"9 c #52528F",
+"0 c #51518F",
+"a c #50508F",
+"b c #51518E",
+"c c #53548D",
+"d c #52538D",
+"e c #52528B",
+"f c #51518B",
+"g c #53538D",
+"h c #55568E",
+"i c #54548E",
+"j c #55558E",
+"k c #54548D",
+"l c #535494",
+"m c #D4D7D0",
+"n c #EEF0ED",
+"o c #858685",
+"p c #AAAAA9",
+"q c #F0F2EE",
+"r c #A7AAC0",
+"s c #6A6A91",
+"t c #7E7E96",
+"u c #7D7D95",
+"v c #7C7C94",
+"w c #7A7A93",
+"x c #797992",
+"y c #777790",
+"z c #767690",
+"A c #75758F",
+"B c #74748D",
+"C c #73738D",
+"D c #71718B",
+"E c #70708B",
+"F c #6F6F8A",
+"G c #6D6D88",
+"H c #6B6B86",
+"I c #6A6A85",
+"J c #696985",
+"K c #494A8B",
+"L c #A4A5A2",
+"M c #CFD1CF",
+"N c #8D8E8D",
+"O c #AFB0AF",
+"P c #EFF0ED",
+"Q c #9697B8",
+"R c #67678C",
+"S c #6E6E89",
+"T c #686884",
+"U c #676783",
+"V c #666683",
+"W c #656582",
+"X c #646482",
+"Y c #636380",
+"Z c #626280",
+"` c #454688",
+" . c #D3D6CF",
+".. c #EAECE8",
+"+. c #959695",
+"@. c #B8B8B7",
+"#. c #EEEFEB",
+"$. c #8284AD",
+"%. c #646488",
+"&. c #6A6A86",
+"*. c #676784",
+"=. c #646481",
+"-. c #616180",
+";. c #61617F",
+">. c #5F5F7F",
+",. c #5F5F7E",
+"'. c #535375",
+"). c #3F4084",
+"!. c #B2B4B0",
+"~. c #B7B8B7",
+"{. c #9B9C9B",
+"]. c #BFBFBE",
+"^. c #ECEDE9",
+"/. c #7173A4",
+"(. c #646486",
+"_. c #696986",
+":. c #676785",
+"<. c #666684",
+"[. c #656583",
+"}. c #646483",
+"|. c #636381",
+"1. c #626281",
+"2. c #616181",
+"3. c #606080",
+"4. c #60607F",
+"5. c #5E5E7E",
+"6. c #5B5B7D",
+"7. c #49496E",
+"8. c #36365F",
+"9. c #292954",
+"0. c #242450",
+"a. c #373880",
+"b. c #D2D5CE",
+"c. c #E5E7E3",
+"d. c #A4A5A3",
+"e. c #C5C5C3",
+"f. c #EAECE7",
+"g. c #61639D",
+"h. c #5F5F80",
+"i. c #5D5D7F",
+"j. c #5C5C7E",
+"k. c #565679",
+"l. c #3E3E66",
+"m. c #2A2A56",
+"n. c #272754",
+"o. c #282855",
+"p. c #34357E",
+"q. c #B8BBB6",
+"r. c #ACADAB",
+"s. c #CACBC9",
+"t. c #E8EAE5",
+"u. c #575998",
+"v. c #606081",
+"w. c #5E5E80",
+"x. c #5C5C7F",
+"y. c #5B5B7E",
+"z. c #5A5A7E",
+"A. c #5A5A7D",
+"B. c #58587C",
+"C. c #545479",
+"D. c #3F3F69",
+"E. c #2C2C59",
+"F. c #2A2A58",
+"G. c #2B2B59",
+"H. c #2B2B5A",
+"I. c #2C2C5A",
+"J. c #2C2C5B",
+"K. c #30317C",
+"L. c #D0D4CD",
+"M. c #E0E2DD",
+"N. c #B0B1AF",
+"O. c #8C8C8C",
+"P. c #CFD0CD",
+"Q. c #E7E9E4",
+"R. c #535595",
+"S. c #5B5B7F",
+"T. c #59597E",
+"U. c #59597D",
+"V. c #58587D",
+"W. c #57577C",
+"X. c #55557C",
+"Y. c #474770",
+"Z. c #31315F",
+"`. c #2D2D5C",
+" + c #2E2E5D",
+".+ c #2F2F5E",
+"++ c #2F2F5F",
+"@+ c #30305F",
+"#+ c #303060",
+"$+ c #2D2D7B",
+"%+ c #BFC1BC",
+"&+ c #A4A4A3",
+"*+ c #B6B7B5",
+"=+ c #5D5D5D",
+"-+ c #8E8E8E",
+";+ c #D3D5D2",
+">+ c #E5E7E2",
+",+ c #525393",
+"'+ c #58587F",
+")+ c #58587E",
+"!+ c #57577D",
+"~+ c #56567D",
+"{+ c #54547C",
+"]+ c #53537B",
+"^+ c #4D4D76",
+"/+ c #393967",
+"(+ c #313160",
+"_+ c #313161",
+":+ c #323262",
+"<+ c #333363",
+"[+ c #333364",
+"}+ c #343465",
+"|+ c #2E2E7A",
+"1+ c #C5C9C7",
+"2+ c #DBDDD8",
+"3+ c #BBBCB9",
+"4+ c #5E5E5E",
+"5+ c #8E8E8D",
+"6+ c #D8D8D6",
+"7+ c #E3E6E0",
+"8+ c #505192",
+"9+ c #54547D",
+"0+ c #52527B",
+"a+ c #4F4F79",
+"b+ c #41416E",
+"c+ c #353565",
+"d+ c #353566",
+"e+ c #353567",
+"f+ c #363667",
+"g+ c #363668",
+"h+ c #373768",
+"i+ c #373769",
+"j+ c #383869",
+"k+ c #38386A",
+"l+ c #303078",
+"m+ c #B8BCC3",
+"n+ c #D8DBD5",
+"o+ c #C0C1BE",
+"p+ c #606060",
+"q+ c #DCDDDA",
+"r+ c #E1E4DE",
+"s+ c #4C4D90",
+"t+ c #51517C",
+"u+ c #50507C",
+"v+ c #50507B",
+"w+ c #4E4E7B",
+"x+ c #464674",
+"y+ c #39396B",
+"z+ c #3A3A6C",
+"A+ c #3A3A6D",
+"B+ c #3B3B6D",
+"C+ c #3B3B6E",
+"D+ c #3C3C6F",
+"E+ c #3C3C70",
+"F+ c #313179",
+"G+ c #ADB0BD",
+"H+ c #D5D9D3",
+"I+ c #C4C6C2",
+"J+ c #8A8A89",
+"K+ c #DFE0DE",
+"L+ c #DFE1DC",
+"M+ c #48498E",
+"N+ c #4B4B7A",
+"O+ c #444474",
+"P+ c #3C3C6E",
+"Q+ c #3D3D70",
+"R+ c #3D3D71",
+"S+ c #3E3E71",
+"T+ c #3E3E72",
+"U+ c #3F3F73",
+"V+ c #404074",
+"W+ c #404075",
+"X+ c #323277",
+"Y+ c #A0A3B9",
+"Z+ c #D4D6D0",
+"`+ c #C8CAC7",
+" @ c #5E5E5C",
+".@ c #E3E3E1",
+"+@ c #DCE0D9",
+"@@ c #41418B",
+"#@ c #404072",
+"$@ c #414175",
+"%@ c #414176",
+"&@ c #424276",
+"*@ c #424277",
+"=@ c #434378",
+"-@ c #434379",
+";@ c #444479",
+">@ c #44447A",
+",@ c #45457A",
+"'@ c #36367B",
+")@ c #9193B1",
+"!@ c #D1D5CF",
+"~@ c #CCCECB",
+"{@ c #585958",
+"]@ c #848584",
+"^@ c #E5E6E3",
+"/@ c #DBDED6",
+"(@ c #3C3C88",
+"_@ c #45457B",
+":@ c #46467C",
+"<@ c #47477D",
+"[@ c #47477E",
+"}@ c #48487E",
+"|@ c #48487F",
+"1@ c #49497F",
+"2@ c #3D3D7E",
+"3@ c #8183AA",
+"4@ c #CFD2CC",
+"5@ c #D1D2CF",
+"6@ c #575756",
+"7@ c #808180",
+"8@ c #E7E9E6",
+"9@ c #D9DCD5",
+"0@ c #383987",
+"a@ c #46467D",
+"b@ c #494980",
+"c@ c #4A4A81",
+"d@ c #4B4B82",
+"e@ c #4B4B83",
+"f@ c #4C4C84",
+"g@ c #4D4D85",
+"h@ c #454583",
+"i@ c #7073A3",
+"j@ c #CDD1CB",
+"k@ c #D3D6D1",
+"l@ c #525252",
+"m@ c #EAEBE8",
+"n@ c #D7DAD2",
+"o@ c #202184",
+"p@ c #3B3C87",
+"q@ c #3B3C88",
+"r@ c #3B3B88",
+"s@ c #3B3C89",
+"t@ c #3C3C89",
+"u@ c #3C3C8A",
+"v@ c #3C3D8A",
+"w@ c #3D3D8A",
+"x@ c #373889",
+"y@ c #66689F",
+"z@ c #CBCFC8",
+"A@ c #D7D9D5",
+"B@ c #4D4D4D",
+"C@ c #787878",
+"D@ c #EAECE9",
+"E@ c #D1D4CE",
+"F@ c #CED2CA",
+"G@ c #CED1CA",
+"H@ c #CDD1C9",
+"I@ c #CDD0C9",
+"J@ c #CCD0C8",
+"K@ c #CCCFC8",
+"L@ c #CBCFC7",
+"M@ c #CBCEC7",
+"N@ c #CACEC6",
+"O@ c #AEB0AB",
+"P@ c #B3B6AF",
+"Q@ c #C9CCC5",
+"R@ c #C8CCC4",
+"S@ c #C8CBC4",
+"T@ c #C7CBC4",
+"U@ c #C7CAC3",
+"V@ c #C6CAC3",
+"W@ c #C6C9C3",
+"X@ c #C5C9C3",
+"Y@ c #C5C8C2",
+"Z@ c #C4C8C2",
+"`@ c #C5C9C2",
+" # c #D9DBD7",
+".# c #4A4A4A",
+"+# c #D4D6D2",
+"@# c #EBECE9",
+"## c #E9EBE7",
+"$# c #E8EAE6",
+"%# c #E7E9E5",
+" c #E6E8E5",
+"*# c #E6E8E4",
+"=# c #E4E6E2",
+"-# c #E3E6E1",
+";# c #E2E5E1",
+"># c #E2E4E0",
+",# c #E1E3DF",
+"'# c #E0E2DE",
+")# c #DFE2DD",
+"!# c #DEE1DC",
+"~# c #DEE0DC",
+"{# c #DDDFDB",
+"]# c #DCDEDA",
+"^# c #C0C2BE",
+"/# c #4D4D4C",
+"(# c #747474",
+"_# c #6E6E6E",
+":# c #6C6C6C",
+"<# c #6A6A6A",
+"[# c #686868",
+"}# c #676767",
+"|# c #656565",
+"1# c #636363",
+"2# c #616161",
+"3# c #5F5F5F",
+"4# c #5C5C5C",
+"5# c #5A5A5A",
+"6# c #585858",
+"7# c #565656",
+"8# c #555555",
+"9# c #535353",
+"0# c #515151",
+"a# c #4F4F4F",
+"b# c #4C4C4C",
+"c# c #484848",
+"d# c #4F504E",
+"e# c #838581",
+"f# c #ACAFA9",
+"g# c #ADB0AA",
+"h# c #8B8E89",
+"i# c #8D908C",
+"j# c #ABADAA",
+"k# c #A7A7A6",
+"l# c #A1A1A0",
+"m# c #7C7D7C",
+"n# c #525451",
+"o# c #9B9E9A",
+"p# c #AFB2AC",
+"q# c #B1B3AE",
+"r# c #AEB1AB",
+"s# c #A8AAA5",
+"t# c #9D9F9D",
+"u# c #939392",
+"v# c #A1A1A1",
+"w# c #A5A5A5",
+"x# c #A8A8A8",
+"y# c #595959",
+"z# c #595958",
+"A# c #585857",
+"B# c #575757",
+"C# c #515150",
+"D# c #505050",
+"E# c #4E4E4E",
+"F# c #AAAAAA",
+"G# c #A7A7A7",
+"H# c #ACACAC",
+"I# c #DCE0D8",
+"J# c #DFE3DB",
+"K# c #DFE3DA",
+"L# c #E0E3DA",
+"M# c #E0E3DB",
+"N# c #E1E3DB",
+"O# c #E0E4DB",
+"P# c #E0E4DC",
+"Q# c #E1E4DB",
+"R# c #E1E4DC",
+"S# c #DDE2D9",
+"T# c #545654",
+"U# c #949693",
+"V# c #9F9F9E",
+"W# c #9D9D9D",
+"X# c #9A9B9A",
+"Y# c #DADDD5",
+"Z# c #9B9B9A",
+"`# c #9B9B9B",
+" $ c #9A9B99",
+".$ c #959792",
+"+$ c #636463",
+"@$ c #BBBDB8",
+"#$ c #9FA09F",
+"$$ c #9C9D9C",
+"%$ c #C9CCC6",
+"&$ c #A0A19F",
+"*$ c #BCC0B9",
+"=$ c #5C5D5C",
+"-$ c #ABABAB",
+";$ c #676867",
+">$ c #BDC0BC",
+",$ c #A7A9A6",
+"'$ c #AEAEAE",
+")$ c #ACACAB",
+"!$ c #B1B2B0",
+"~$ c #B4B6B1",
+"{$ c #AAABAA",
+"]$ c #BEC1BC",
+"^$ c #606160",
+"/$ c #A4A7A2",
+"($ c #959991",
+"_$ c #7A7D77",
+":$ c #A3A6A0",
+"<$ c #777874",
+"[$ c #858782",
+"}$ c #989B94",
+"|$ c #989B95",
+"1$ c #D2D4CD",
+"2$ c #868983",
+"3$ c #848882",
+"4$ c #9EA19A",
+"5$ c #A6A9A4",
+"6$ c #D4D9D1",
+"7$ c #E0E5DC",
+"8$ c #E1E5DE",
+"9$ c #E2E5DE",
+"0$ c #E1E6DD",
+"a$ c #E2E6DE",
+"b$ c #E1E6DF",
+"c$ c #E2E7DE",
+"d$ c #E2E7DD",
+"e$ c #E3E7DE",
+"f$ c #E3E8DE",
+"g$ c #E3E8DF",
+"h$ c #E4E8DF",
+"i$ c #E5E8E0",
+"j$ c #E4E9E0",
+"k$ c #E5E9E0",
+"l$ c #E5E9E1",
+"m$ c #DCE1D9",
+"n$ c #575857",
+"o$ c #5A5B5A",
+"p$ c #595A59",
+"q$ c #555655",
+"r$ c #535453",
+"s$ c #525352",
+"t$ c #515251",
+"u$ c #525251",
+"v$ c #535352",
+"w$ c #545453",
+"x$ c #4D4E4D",
+" . + @ @ @ @ @ @ @ @ @ @ # $ % & * = - ; > , ' ) ! ~ ",
+" { ] ^ ^ ^ ^ ^ ^ / / / / ( ( _ _ : : : < < < [ } | ) ",
+" 1 2 3 4 5 5 6 7 8 9 0 a b c d e f g h i j k l m n o ",
+" p q r s t u v w x y z A B C D E F G G H I J K L M N ",
+" O P Q R z A B C D E S G G H I T U V W X Y Z ` ...+. ",
+" @.#.$.%.S G G H &.J T *.V V =.=.Z -.;.>.,.'.).!.~.{. ",
+" ].^./.(._.:.*.<.[.}.|.1.2.3.4.>.5.6.7.8.9.0.a.b.c.d. ",
+" e.f.g.(.}.}.1.2.2.h.h.i.i.j.6.k.l.m.n.n.o.o.p.q.r.r. ",
+" s.t.u.2.v.h.w.x.x.y.z.A.B.C.D.E.F.G.G.H.I.J.K.L.M.N. ",
+" O.P.Q.R.x.S.S.T.U.V.W.W.X.Y.Z.`. + +.+.+++@+#+$+%+&+*+=+ ",
+" -+;+>+,+'+)+!+~+X.{+]+^+/+(+_+_+:+:+<+[+[+}+}+|+1+2+3+4+ ",
+" 5+6+7+8+9+{+{+0+0+a+b+c+}+d+d+e+f+g+h+i+j+k+k+l+m+n+o+p+ ",
+" # q+r+s+t+u+v+w+x+y+i+k+k+y+y+z+z+A+B+C+D+D+E+F+G+H+I+4+ ",
+" J+K+L+M+w+N+O+D+B+C+P+D+E+Q+R+S+T+T+U+U+V+V+W+X+Y+Z+`+ @ ",
+" & .@+@@@#@R+T+T+U+U+V+V+W+$@%@&@*@*@=@-@;@>@,@'@)@!@~@{@ ",
+" ]@^@/@(@%@&@*@*@=@=@;@;@>@_@_@:@:@<@<@[@}@|@1@2@3@4@5@6@ ",
+" 7@8@9@0@_@:@:@a@<@[@}@|@1@b@b@c@c@d@d@e@f@f@g@h@i@j@k@l@ ",
+" ~ m@n@o@p@q@r@r@q@s@t@t@t@s@s@t@u@v@v@v@w@v@v@x@y@z@A@B@ ",
+" C@D@E@F@G@H@I@I@J@K@L@M@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ #.# ",
+" C@+#@#@#..m@##$#$#%#*#c.>+=#-#;#>#,#,#'#)#!#~#{#]#^#/# ",
+" (#_#:#<#[#}#|#1#2#3#4+4#5#6#7#8#9#0#a#B@b#.#c#c#c#B@ ",
+" d#e#f#g#h#h#h#h#h#i#j#k#l#m# ",
+" n#o#p#q#p#r#g#g#r#r#g#s#t#u#1 v#w#x#w# ",
+" [#1#2#3#4+4#y#6#z#y#A#B#8#9#0#C#D#a#B@b#b#b#B@E#|#F#G#H# ",
+" 1#I#J#J#K#J#J#L#M#L#M#N#O#O#O#P#P#O#P#O#P#Q#R#S#T# x#F#",
+" U#V#W#W#W#W#W#W#W#W#W#W#W#W#W#W#W#W#X#Y#Z#`#`# $.$ 1 x#",
+" +$@$w#w#w##$$$$$$$$$$$$$$$$$$$$$w#w#w#w#%$&$w#w#w#*$=$G#-$ ",
+" ;$>$F#F#F#,$'$'$'$'$'$'$'$'$'$)$&+'$'$'$!$~${$F#F#]$^$ ",
+" /$($_$_$_$:$<$<$<$<$<$<$<$<$<$[$}$_$_$_$|$1$2$3$3$4$5$ ",
+" 3#6$P#P#7$7$8$9$0$a$0$b$c$c$d$c$e$f$g$h$h$i$j$k$j$j$l$m$0# ",
+" y#n$o$p$n$q$r$s$s$s$t$t$t$t$u$u$u$u$u$u$u$u$v$v$v$v$w$D#x$ ",
+" "};
Added: trunk/gtk/10_3/src/icons/pkg-list-mode.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-list-mode.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-list-mode.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-list-mode.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,13 @@
+/* XPM */
+static const char * pkg_list_mode_xpm[] = {
+"8 8 2 1",
+" c None",
+". c #000000",
+" ",
+"........",
+" ",
+" ",
+"...... ",
+" ",
+" ",
+"........"};
Added: trunk/gtk/10_3/src/icons/pkg-locked.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-locked.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-locked.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-locked.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,109 @@
+/* XPM */
+static const char * pkg_locked_xpm[] = {
+"16 16 90 1",
+" c None",
+". c #000000",
+"+ c #1E1E1E",
+"@ c #7A7A7A",
+"# c #D2D2D2",
+"$ c #DBDBDB",
+"% c #BCBCBC",
+"& c #727272",
+"* c #080808",
+"= c #848484",
+"- c #BEBEBE",
+"; c #383838",
+"> c #1C1C1C",
+", c #4D4D4D",
+"' c #B1B1B1",
+") c #2D2D2D",
+"! c #C2C2C2",
+"~ c #090909",
+"{ c #2E2E2E",
+"] c #AAAAAA",
+"^ c #2B2B2B",
+"/ c #C0C0C0",
+"( c #161616",
+"_ c #C1C0C0",
+": c #13110E",
+"< c #9B9794",
+"[ c #201D1C",
+"} c #0B0B07",
+"| c #040302",
+"1 c #050403",
+"2 c #2F2921",
+"3 c #A8A39E",
+"4 c #1A130B",
+"5 c #A59176",
+"6 c #E0C4A0",
+"7 c #DFC4A3",
+"8 c #DABE9A",
+"9 c #D6BA94",
+"0 c #CDA676",
+"a c #815A2B",
+"b c #E2C5A1",
+"c c #D8B58C",
+"d c #CA9F68",
+"e c #AC8758",
+"f c #A78252",
+"g c #A78253",
+"h c #A37B4B",
+"i c #BC8849",
+"j c #AC712E",
+"k c #E3C6A2",
+"l c #D5AE7E",
+"m c #B08D5F",
+"n c #D5B284",
+"o c #CFAB7C",
+"p c #CFAC7B",
+"q c #CBA471",
+"r c #BC8746",
+"s c #AA6F2B",
+"t c #E1C4A0",
+"u c #D0A674",
+"v c #C79B64",
+"w c #AA8455",
+"x c #A47E4E",
+"y c #A07744",
+"z c #BA8442",
+"A c #E1C29C",
+"B c #CEA470",
+"C c #AD8D64",
+"D c #D2B289",
+"E c #CDAC83",
+"F c #CEAD83",
+"G c #CCA77B",
+"H c #B8803E",
+"I c #AD7332",
+"J c #E0C29E",
+"K c #D4AC79",
+"L c #CDA66E",
+"M c #AF8D5E",
+"N c #AB8758",
+"O c #AB8858",
+"P c #A8814C",
+"Q c #B47E3E",
+"R c #D0A874",
+"S c #C6965D",
+"T c #BE8D50",
+"U c #BA894B",
+"V c #BD8C4E",
+"W c #BC8A4C",
+"X c #BA8647",
+"Y c #A47136",
+" ",
+" .... ",
+" +@#$$%&* ",
+" =-;>>,'= ",
+" )!~ {]. ",
+" ^/. (_. ",
+" :<[}||1234 ",
+" .567788890a. ",
+" .bcdeffghij. ",
+" .klmnoopqrs. ",
+" .tuvwxxxyzj. ",
+" .ABCDEEFGHI. ",
+" .JKLMNNOPrQ. ",
+" .RSTTUUVWXY. ",
+" .......... ",
+" "};
Added: trunk/gtk/10_3/src/icons/pkg-remove-auto.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-remove-auto.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-remove-auto.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-remove-auto.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,424 @@
+/* XPM */
+static const char * pkg_remove_auto_xpm[] = {
+"32 32 389 2",
+" c None",
+". c #8D8E89",
+"+ c #888A85",
+"@ c #8B8D88",
+"# c #8D8F8A",
+"$ c #F3F3F3",
+"% c #F7F7F7",
+"& c #F6F6F6",
+"* c #F5F5F5",
+"= c #F2F2F2",
+"- c #E6E6E6",
+"; c #E5E5E5",
+"> c #E4E4E4",
+", c #E3E3E3",
+"' c #E2E2E2",
+") c #E1E1E1",
+"! c #F4F4F4",
+"~ c #204B88",
+"{ c #234D8A",
+"] c #868A88",
+"^ c #F1F1F1",
+"/ c #CACACA",
+"( c #C3C3C3",
+"_ c #C2C2C2",
+": c #C1C1C1",
+"< c #C8C8C8",
+"[ c #E0E0E0",
+"} c #244E8C",
+"| c #224C89",
+"1 c #5485C5",
+"2 c #598BCB",
+"3 c #7D8181",
+"4 c #DDDDDD",
+"5 c #CECECE",
+"6 c #CDCDCD",
+"7 c #CCCCCC",
+"8 c #CBCBCB",
+"9 c #DEDEDE",
+"0 c #7D7F7A",
+"a c #4C7DBC",
+"b c #214C89",
+"c c #3965A2",
+"d c #6090CD",
+"e c #727676",
+"f c #C9C9C9",
+"g c #BABABA",
+"h c #A6A6A6",
+"i c #9F9F9F",
+"j c #9E9E9E",
+"k c #A4A4A4",
+"l c #B8B8B8",
+"m c #B7B7B7",
+"n c #B6B6B6",
+"o c #727470",
+"p c #325F9C",
+"q c #5B86C1",
+"r c #406492",
+"s c #646763",
+"t c #6B6D69",
+"u c #6A6B67",
+"v c #6D6E6A",
+"w c #395983",
+"x c #224C8A",
+"y c #28528E",
+"z c #769FD4",
+"A c #5A8BCB",
+"B c #3B5D88",
+"C c #243953",
+"D c #243954",
+"E c #263B56",
+"F c #263B57",
+"G c #273D59",
+"H c #273E5A",
+"I c #283E5B",
+"J c #283F5D",
+"K c #29405E",
+"L c #29415F",
+"M c #2A4261",
+"N c #2B4362",
+"O c #2B4463",
+"P c #2C4565",
+"Q c #2D4666",
+"R c #2D4768",
+"S c #2E4869",
+"T c #2E496A",
+"U c #2F4A6C",
+"V c #304B6D",
+"W c #3C5074",
+"X c #5C85C2",
+"Y c #5E8ECC",
+"Z c #2B5793",
+"` c #5179B1",
+" . c #739DD3",
+".. c #5F81BC",
+"+. c #89425D",
+"@. c #AB1213",
+"#. c #AB1314",
+"$. c #884B67",
+"%. c #5477AE",
+"&. c #7499C8",
+"*. c #6794CE",
+"=. c #588ACA",
+"-. c #667AB0",
+";. c #BE4E52",
+">. c #E18080",
+",. c #E17E7E",
+"'. c #B84C52",
+"). c #758BBC",
+"!. c #234D89",
+"~. c #224D8A",
+"{. c #7A9AC5",
+"]. c #5581BA",
+"^. c #4978B5",
+"/. c #4878B5",
+"(. c #4976B2",
+"_. c #704D72",
+":. c #6B5178",
+"<. c #4877B3",
+"[. c #668DC1",
+"}. c #2F5892",
+"|. c #214B88",
+"1. c #587BAB",
+"2. c #809DC2",
+"3. c #819EC3",
+"4. c #809DC3",
+"5. c #7F9DC2",
+"6. c #7E9BC1",
+"7. c #7C9AC1",
+"8. c #7C9AC0",
+"9. c #7A98C0",
+"0. c #7998BF",
+"a. c #7897BE",
+"b. c #7796BE",
+"c. c #7595BD",
+"d. c #7494BD",
+"e. c #7393BC",
+"f. c #7192BB",
+"g. c #7191BB",
+"h. c #7091BB",
+"i. c #6E8FBA",
+"j. c #6D8FBA",
+"k. c #6C8EB9",
+"l. c #6A8CB7",
+"m. c #29518C",
+"n. c #204A85",
+"o. c #204A87",
+"p. c #204986",
+"q. c #898A89",
+"r. c #B8B9B6",
+"s. c #8B8D89",
+"t. c #838581",
+"u. c #C6C6C5",
+"v. c #BDBEBD",
+"w. c #B3B4B3",
+"x. c #B0B0AF",
+"y. c #A9AAA8",
+"z. c #B0B1B0",
+"A. c #C4C5C4",
+"B. c #B1B2B1",
+"C. c #ADADAC",
+"D. c #B6B7B5",
+"E. c #ABACAA",
+"F. c #B5B5B4",
+"G. c #787A76",
+"H. c #9D9E9B",
+"I. c #BFC0BD",
+"J. c #C3C4C3",
+"K. c #7D7F7C",
+"L. c #888985",
+"M. c #848581",
+"N. c #C0C1C0",
+"O. c #BBBBBB",
+"P. c #BCBDBC",
+"Q. c #B4B5B4",
+"R. c #BFC0BF",
+"S. c #BFBFBE",
+"T. c #A4A4A3",
+"U. c #B2B3B2",
+"V. c #C8C8C7",
+"W. c #C6C6C6",
+"X. c #B1B1B0",
+"Y. c #B4B5B3",
+"Z. c #B9B9B8",
+"`. c #7C7D7A",
+" + c #A9AAA6",
+".+ c #C8C8C6",
+"++ c #C0C1BE",
+"@+ c #727371",
+"#+ c #BEBFBC",
+"$+ c #8E908A",
+"%+ c #898B86",
+"&+ c #BDBDBC",
+"*+ c #BEBFBE",
+"=+ c #B6B7B6",
+"-+ c #BEBEBD",
+";+ c #D2D2D2",
+">+ c #A6A7A5",
+",+ c #C7C8C7",
+"'+ c #C9C9C8",
+")+ c #B2B3B1",
+"!+ c #C1C2C1",
+"~+ c #CFCFCF",
+"{+ c #B8B9B8",
+"]+ c #BABAB9",
+"^+ c #B8B9B5",
+"/+ c #D2D3D0",
+"(+ c #BCBDBA",
+"_+ c #686A66",
+":+ c #C4C5C2",
+"<+ c #92948F",
+"[+ c #CBCCCB",
+"}+ c #C4C4C3",
+"|+ c #BDBEBC",
+"1+ c #C3C3C2",
+"2+ c #D3D3D3",
+"3+ c #AFB0AE",
+"4+ c #CDCDCC",
+"5+ c #D1D1D1",
+"6+ c #BBBCBA",
+"7+ c #B7B7B6",
+"8+ c #C5C6C5",
+"9+ c #D6D6D6",
+"0+ c #8F918C",
+"a+ c #BFC0BC",
+"b+ c #D8D9D6",
+"c+ c #B5B7B3",
+"d+ c #C8C9C7",
+"e+ c #999A93",
+"f+ c #92938E",
+"g+ c #D9D9D9",
+"h+ c #C9CAC9",
+"i+ c #C7C7C6",
+"j+ c #BFC0BE",
+"k+ c #DBDBDB",
+"l+ c #BEBFBD",
+"m+ c #C2C2C1",
+"n+ c #D0D0CF",
+"o+ c #DFDFDF",
+"p+ c #C1C2C0",
+"q+ c #C3C4C2",
+"r+ c #CACAC9",
+"s+ c #B6B6B5",
+"t+ c #989994",
+"u+ c #C8C8C4",
+"v+ c #DEDEDC",
+"w+ c #ABADA9",
+"x+ c #C8C9C6",
+"y+ c #9C9E9A",
+"z+ c #91938F",
+"A+ c #EAEAEA",
+"B+ c #D8D8D7",
+"C+ c #D2D2D1",
+"D+ c #A0A09D",
+"E+ c #CFCFCE",
+"F+ c #CBCBCA",
+"G+ c #D6D6D5",
+"H+ c #E0E0DF",
+"I+ c #D1D2D1",
+"J+ c #B2B3B0",
+"K+ c #9EA09B",
+"L+ c #CCCDC9",
+"M+ c #E2E3E0",
+"N+ c #A1A29E",
+"O+ c #555753",
+"P+ c #565854",
+"Q+ c #A0A19E",
+"R+ c #E7E7E6",
+"S+ c #E3E4E3",
+"T+ c #E8E8E8",
+"U+ c #929490",
+"V+ c #DEDEDD",
+"W+ c #D5D5D4",
+"X+ c #DDDEDD",
+"Y+ c #DADAD9",
+"Z+ c #D3D4D2",
+"`+ c #DCDCDC",
+" @ c #D4D5D4",
+".@ c #AAABA8",
+"+@ c #E4E4E3",
+"@@ c #A0A29E",
+"#@ c #D1D2CE",
+"$@ c #E7E7E5",
+"%@ c #90928F",
+"&@ c #575955",
+"*@ c #DBDCDA",
+"=@ c #BABBB9",
+"-@ c #585A56",
+";@ c #EDEDEC",
+">@ c #EFEFEE",
+",@ c #D3D3D2",
+"'@ c #AFB1AB",
+")@ c #C4C4C2",
+"!@ c #E9E9E9",
+"~@ c #D9D9D8",
+"{@ c #E7E7E7",
+"]@ c #D1D2D0",
+"^@ c #D7D8D7",
+"/@ c #EBEBEA",
+"(@ c #F0F0F0",
+"_@ c #9A9B96",
+":@ c #EEEEED",
+"<@ c #D4D5D1",
+"[@ c #EBEBE9",
+"}@ c #838480",
+"|@ c #DCDDDB",
+"1@ c #595B57",
+"2@ c #949591",
+"3@ c #E1E2E1",
+"4@ c #D2D3D1",
+"5@ c #AEAFAC",
+"6@ c #B5B7B1",
+"7@ c #A0A29D",
+"8@ c #BABBB8",
+"9@ c #AEB0AC",
+"0@ c #E2E3E2",
+"a@ c #9D9E99",
+"b@ c #A2A39F",
+"c@ c #B5B6B2",
+"d@ c #D7D8D3",
+"e@ c #767774",
+"f@ c #A9ABA5",
+"g@ c #9FA09B",
+"h@ c #969794",
+"i@ c #BBBDB7",
+"j@ c #B3B5AF",
+"k@ c #959792",
+"l@ c #999A96",
+"m@ c #9B9D98",
+"n@ c #A2A39E",
+"o@ c #ABADA7",
+"p@ c #979995",
+"q@ c #989995",
+"r@ c #9A9C97",
+"s@ c #A6A7A2",
+"t@ c #B2B4AE",
+"u@ c #C8C9C3",
+"v@ c #EBECEA",
+"w@ c #5A5C58",
+"x@ c #DDDEDC",
+"y@ c #B9BBB5",
+"z@ c #CBCDC7",
+"A@ c #D7D8D4",
+"B@ c #DCDDDA",
+"C@ c #C0C1BF",
+"D@ c #CDCEC8",
+"E@ c #D9DAD6",
+"F@ c #E8E8E6",
+"G@ c #C4C5C3",
+"H@ c #AEB0AA",
+"I@ c #C6C8C2",
+"J@ c #DADAD6",
+"K@ c #E3E4E1",
+"L@ c #CCCDCB",
+"M@ c #AFB1AD",
+"N@ c #B0B1AE",
+"O@ c #B0B2AE",
+"P@ c #B1B2AD",
+"Q@ c #B1B3AF",
+"R@ c #B2B3AE",
+"S@ c #B2B4AF",
+"T@ c #B2B3AF",
+"U@ c #B3B4B1",
+"V@ c #B4B5B1",
+"W@ c #B4B5B0",
+"X@ c #B5B6B1",
+"Y@ c #B4B5B2",
+"Z@ c #BEC0BC",
+"`@ c #D3D4D1",
+" # c #D8D9D5",
+".# c #D4D5D3",
+"+# c #C3C4C1",
+"@# c #C7C7C5",
+"## c #C7C7C4",
+"$# c #C6C7C4",
+"%# c #C6C6C3",
+" c #C5C6C3",
+"*# c #C5C5C3",
+"=# c #C5C5C2",
+"-# c #C6C6C4",
+";# c #DBDBD9",
+"># c #D7D8D6",
+",# c #D9D9D7",
+"'# c #DDDDDC",
+")# c #DEDFDD",
+"!# c #DFDFDD",
+"~# c #DFDFDE",
+"{# c #5F5F5D",
+"]# c #454744",
+"^# c #414541",
+" ",
+" . + + + + + + + + + + + + + + + + + + @ ",
+" # $ % & & & & & & & & & & & & * * * * + ",
+" @ = - ; > > , , , , , ' ' ' ' ) ' , ! + ",
+" ~ { ] ^ , / ( ( _ _ _ _ _ _ _ _ : : < [ $ + } | ",
+" | 1 2 3 4 5 6 7 8 8 8 8 / 8 7 7 8 8 8 8 / 9 0 2 a b ",
+" c d 2 e f g h i i i i j j k l m m m m m n / o 2 2 p ",
+" { q d r s t u u u u u u u u u u u u u u u u v u w 2 a x ",
+" y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ",
+" | ` .2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ..+.@.#.$.%.{ ",
+" } &.*.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.-.;.>.,.'.).!. ",
+" ~.{.].^.^.^.^.^.^.^.^.^././././././././././././.(._.:.<.[.}. ",
+" |.1.2.3.3.3.3.3.3.3.4.5.6.7.8.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m. ",
+" n.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.p. ",
+" q.r.s.t.u.v.v.w._ x.f y.z.A.f B.C.v.5 D.E.F.G.H.I.J. ",
+" K.r.L.M.N.O.P.Q.R.S.5 T.U.V.W.X.X._ 6 Y.C.Z.`. +.+++ ",
+" @+#+$+%+( &+*+=+S.-+;+>+Q.,+'+Y.)+!+~+{+B.]+%+^+/+(+ ",
+" _+:+<+# [+}+A.|+1+-+2+3+{+4+5+6+7+8+9+N.7+v.0+a+b+c+ ",
+" d+e+f+g+4 h+i+4+j+k+l+m+n+o+p+q+r+[ ;+s+m+t+u+v+w+ ",
+" x+y+z+A+4+B+C+, D+, E+F+G+H+F+I+E+> ; J+'+K+L+M+N+ ",
+" O+P+O+O+Q+R+S+T+U+V+[ W+X+Y+Z+`+ @- = .@+@@@#@$@%@ ",
+" &@*@=@-@<+;@>@,@'@)@!@~@{@]@4+{@^@/@(@_@:@3+<@[@}@ ",
+" P+|@6+1@2@3@4@5@6@7@{@,@V+8@9@W+W+3@0@a@b@c@d@[@e@ ",
+" O+|@6+1@f@g@h@'@i@j@k@l@m@n@o@7@p@q@r@s@t@u@d@v@ ",
+"O+O+O+P+w@x@6+w@O+O+O+O+i@i@i@i@y@i@i@i@i@i@i@i@i@z@A@v@ ",
+"O+B@|@x@|@|@C@C@C@C@p+O+i@i@i@i@i@i@i@i@i@i@i@i@i@D@E@F@ ",
+"O+*@G@q+q+q+q+q+q+q+q+O+H@H@H@H@H@H@H@H@H@H@H@H@H@I@J@K@ ",
+"O+O+O+O+O+L@L@-@O+O+O+O+M@N@O@P@Q@R@S@T@U@V@W@X@Y@Z@`@ # ",
+" O+.#.#-@+#@#@###$#$#$#$#%#%#*#*#=#-#;#(+ ",
+" O+>#>#-@,#'#'#X+V+v+v+v+V+V+)#)#)#!#!#~#~#B@m+{# ",
+" O+Z+Z+P+]#]#]#]#]#]#]#]#]#]#]#]#]#]#]#]#]#]#^# ",
+" P+&@&@P+ "};
Added: trunk/gtk/10_3/src/icons/pkg-remove.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-remove.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-remove.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-remove.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,435 @@
+/* XPM */
+static const char * pkg_remove_xpm[] = {
+"32 32 400 2",
+" c None",
+". c #8D8E89",
+"+ c #888A85",
+"@ c #8B8D88",
+"# c #8D8F8A",
+"$ c #F3F3F3",
+"% c #F7F7F7",
+"& c #F6F6F6",
+"* c #F5F5F5",
+"= c #F2F2F2",
+"- c #E6E6E6",
+"; c #E5E5E5",
+"> c #E4E4E4",
+", c #E3E3E3",
+"' c #E2E2E2",
+") c #E1E1E1",
+"! c #F4F4F4",
+"~ c #204B88",
+"{ c #234D8A",
+"] c #868A88",
+"^ c #F1F1F1",
+"/ c #CACACA",
+"( c #C3C3C3",
+"_ c #C2C2C2",
+": c #C1C1C1",
+"< c #C8C8C8",
+"[ c #E0E0E0",
+"} c #244E8C",
+"| c #224C89",
+"1 c #5485C5",
+"2 c #598BCB",
+"3 c #7D8181",
+"4 c #DDDDDD",
+"5 c #CECECE",
+"6 c #CDCDCD",
+"7 c #CCCCCC",
+"8 c #CBCBCB",
+"9 c #DEDEDE",
+"0 c #7D7F7A",
+"a c #4C7DBC",
+"b c #214C89",
+"c c #3965A2",
+"d c #6090CD",
+"e c #727676",
+"f c #C9C9C9",
+"g c #BABABA",
+"h c #A6A6A6",
+"i c #9F9F9F",
+"j c #9E9E9E",
+"k c #A4A4A4",
+"l c #B8B8B8",
+"m c #B7B7B7",
+"n c #B6B6B6",
+"o c #727470",
+"p c #325F9C",
+"q c #5B86C1",
+"r c #406492",
+"s c #646763",
+"t c #6B6D69",
+"u c #6A6B67",
+"v c #6D6E6A",
+"w c #395983",
+"x c #224C8A",
+"y c #28528E",
+"z c #769FD4",
+"A c #5A8BCB",
+"B c #3B5D88",
+"C c #243953",
+"D c #243954",
+"E c #263B56",
+"F c #263B57",
+"G c #273D59",
+"H c #273E5A",
+"I c #283E5B",
+"J c #283F5D",
+"K c #29405E",
+"L c #29415F",
+"M c #2A4261",
+"N c #2B4362",
+"O c #2B4463",
+"P c #2C4565",
+"Q c #2D4666",
+"R c #2D4768",
+"S c #2E4869",
+"T c #2E496A",
+"U c #2F4A6C",
+"V c #304B6D",
+"W c #3C5074",
+"X c #5C85C2",
+"Y c #5E8ECC",
+"Z c #2B5793",
+"` c #5179B1",
+" . c #739DD3",
+".. c #5F81BC",
+"+. c #89425D",
+"@. c #AB1213",
+"#. c #AB1314",
+"$. c #884B67",
+"%. c #5477AE",
+"&. c #7499C8",
+"*. c #6794CE",
+"=. c #588ACA",
+"-. c #667AB0",
+";. c #BE4E52",
+">. c #E18080",
+",. c #E17E7E",
+"'. c #B84C52",
+"). c #758BBC",
+"!. c #234D89",
+"~. c #224D8A",
+"{. c #7A9AC5",
+"]. c #5581BA",
+"^. c #4978B5",
+"/. c #4878B5",
+"(. c #4976B2",
+"_. c #704D72",
+":. c #6B5178",
+"<. c #4877B3",
+"[. c #668DC1",
+"}. c #2F5892",
+"|. c #214B88",
+"1. c #587BAB",
+"2. c #809DC2",
+"3. c #819EC3",
+"4. c #809DC3",
+"5. c #7F9DC2",
+"6. c #7E9BC1",
+"7. c #7C9AC1",
+"8. c #7C9AC0",
+"9. c #7A98C0",
+"0. c #7998BF",
+"a. c #7897BE",
+"b. c #7796BE",
+"c. c #7595BD",
+"d. c #7494BD",
+"e. c #7393BC",
+"f. c #7192BB",
+"g. c #7191BB",
+"h. c #7091BB",
+"i. c #6E8FBA",
+"j. c #6D8FBA",
+"k. c #6C8EB9",
+"l. c #6A8CB7",
+"m. c #29518C",
+"n. c #204A85",
+"o. c #204A87",
+"p. c #204986",
+"q. c #898A89",
+"r. c #B8B9B6",
+"s. c #8B8D89",
+"t. c #838581",
+"u. c #C6C6C5",
+"v. c #BDBEBD",
+"w. c #B3B4B3",
+"x. c #B0B0AF",
+"y. c #A9AAA8",
+"z. c #B0B1B0",
+"A. c #C4C5C4",
+"B. c #B1B2B1",
+"C. c #ADADAC",
+"D. c #B6B7B5",
+"E. c #ABACAA",
+"F. c #B5B5B4",
+"G. c #787A76",
+"H. c #9D9E9B",
+"I. c #BFC0BD",
+"J. c #C3C4C3",
+"K. c #7D7F7C",
+"L. c #888985",
+"M. c #848581",
+"N. c #C0C1C0",
+"O. c #BBBBBB",
+"P. c #BCBDBC",
+"Q. c #B4B5B4",
+"R. c #BFC0BF",
+"S. c #BFBFBE",
+"T. c #A4A4A3",
+"U. c #B2B3B2",
+"V. c #C8C8C7",
+"W. c #C6C6C6",
+"X. c #B1B1B0",
+"Y. c #B4B5B3",
+"Z. c #B9B9B8",
+"`. c #7C7D7A",
+" + c #A9AAA6",
+".+ c #C8C8C6",
+"++ c #C0C1BE",
+"@+ c #727371",
+"#+ c #BEBFBC",
+"$+ c #8E908A",
+"%+ c #898B86",
+"&+ c #BDBDBC",
+"*+ c #BEBFBE",
+"=+ c #B6B7B6",
+"-+ c #BEBEBD",
+";+ c #D2D2D2",
+">+ c #A6A7A5",
+",+ c #C7C8C7",
+"'+ c #C9C9C8",
+")+ c #B2B3B1",
+"!+ c #C1C2C1",
+"~+ c #CFCFCF",
+"{+ c #B8B9B8",
+"]+ c #BABAB9",
+"^+ c #B8B9B5",
+"/+ c #D2D3D0",
+"(+ c #BCBDBA",
+"_+ c #686A66",
+":+ c #C4C5C2",
+"<+ c #92948F",
+"[+ c #CBCCCB",
+"}+ c #C4C4C3",
+"|+ c #BDBEBC",
+"1+ c #C3C3C2",
+"2+ c #D3D3D3",
+"3+ c #AFB0AE",
+"4+ c #CDCDCC",
+"5+ c #D1D1D1",
+"6+ c #BBBCBA",
+"7+ c #B7B7B6",
+"8+ c #C5C6C5",
+"9+ c #D6D6D6",
+"0+ c #8F918C",
+"a+ c #BFC0BC",
+"b+ c #D8D9D6",
+"c+ c #B5B7B3",
+"d+ c #C8C9C7",
+"e+ c #999A93",
+"f+ c #92938E",
+"g+ c #D9D9D9",
+"h+ c #C9CAC9",
+"i+ c #C7C7C6",
+"j+ c #BFC0BE",
+"k+ c #DBDBDB",
+"l+ c #BEBFBD",
+"m+ c #C2C2C1",
+"n+ c #D0D0CF",
+"o+ c #DFDFDF",
+"p+ c #C1C2C0",
+"q+ c #C3C4C2",
+"r+ c #CACAC9",
+"s+ c #B6B6B5",
+"t+ c #989994",
+"u+ c #C8C8C4",
+"v+ c #DEDEDC",
+"w+ c #ABADA9",
+"x+ c #CCCDCA",
+"y+ c #9EA09C",
+"z+ c #929490",
+"A+ c #EAEAEA",
+"B+ c #D8D8D7",
+"C+ c #D2D2D1",
+"D+ c #A0A09D",
+"E+ c #CFCFCE",
+"F+ c #CBCBCA",
+"G+ c #D6D6D5",
+"H+ c #E0E0DF",
+"I+ c #D1D2D1",
+"J+ c #B2B3B0",
+"K+ c #9EA09B",
+"L+ c #CCCDC9",
+"M+ c #E2E3E0",
+"N+ c #A1A29E",
+"O+ c #CACBC8",
+"P+ c #A7A9A3",
+"Q+ c #AEAEAC",
+"R+ c #A3A4A1",
+"S+ c #E7E7E6",
+"T+ c #E3E4E3",
+"U+ c #E8E8E8",
+"V+ c #DEDEDD",
+"W+ c #D5D5D4",
+"X+ c #DDDEDD",
+"Y+ c #DADAD9",
+"Z+ c #D3D4D2",
+"`+ c #DCDCDC",
+" @ c #D4D5D4",
+".@ c #AAABA8",
+"+@ c #E4E4E3",
+"@@ c #A0A29E",
+"#@ c #D1D2CE",
+"$@ c #E7E7E5",
+"%@ c #90928F",
+"&@ c #CACAC8",
+"*@ c #A9ABA7",
+"=@ c #DCDDDC",
+"-@ c #F8F8F8",
+";@ c #959792",
+">@ c #EDEDEC",
+",@ c #EFEFEE",
+"'@ c #D3D3D2",
+")@ c #AFB1AB",
+"!@ c #C4C4C2",
+"~@ c #E9E9E9",
+"{@ c #D9D9D8",
+"]@ c #E7E7E7",
+"^@ c #D1D2D0",
+"/@ c #D7D8D7",
+"(@ c #EBEBEA",
+"_@ c #F0F0F0",
+":@ c #9A9B96",
+"<@ c #EEEEED",
+"[@ c #D4D5D1",
+"}@ c #EBEBE9",
+"|@ c #838480",
+"1@ c #C6C7C4",
+"2@ c #BABCB6",
+"3@ c #A2A4A0",
+"4@ c #989995",
+"5@ c #E1E2E1",
+"6@ c #D2D3D1",
+"7@ c #AEAFAC",
+"8@ c #B5B7B1",
+"9@ c #A0A29D",
+"0@ c #BABBB8",
+"a@ c #AEB0AC",
+"b@ c #E2E3E2",
+"c@ c #9D9E99",
+"d@ c #A2A39F",
+"e@ c #B5B6B2",
+"f@ c #D7D8D3",
+"g@ c #767774",
+"h@ c #C1C2BE",
+"i@ c #BDBFBC",
+"j@ c #A3A5A0",
+"k@ c #9FA19C",
+"l@ c #AEB0AA",
+"m@ c #9FA09B",
+"n@ c #969794",
+"o@ c #BBBDB7",
+"p@ c #B3B5AF",
+"q@ c #999A96",
+"r@ c #9B9D98",
+"s@ c #A2A39E",
+"t@ c #ABADA7",
+"u@ c #979995",
+"v@ c #9A9C97",
+"w@ c #A6A7A2",
+"x@ c #B2B4AE",
+"y@ c #C8C9C3",
+"z@ c #EBECEA",
+"A@ c #BBBCB9",
+"B@ c #C1C3BE",
+"C@ c #B9BBB5",
+"D@ c #CBCDC7",
+"E@ c #D7D8D4",
+"F@ c #C4C5C0",
+"G@ c #CDCEC8",
+"H@ c #D9DAD6",
+"I@ c #E8E8E6",
+"J@ c #AAADA9",
+"K@ c #C7C8C4",
+"L@ c #B4B6B0",
+"M@ c #C6C8C2",
+"N@ c #DADAD6",
+"O@ c #E3E4E1",
+"P@ c #C5C5C3",
+"Q@ c #B2B4AF",
+"R@ c #ADAFAB",
+"S@ c #AEAFAB",
+"T@ c #B0B1AC",
+"U@ c #B0B2AC",
+"V@ c #AFB1AD",
+"W@ c #B0B1AE",
+"X@ c #B0B2AE",
+"Y@ c #B1B2AD",
+"Z@ c #B1B3AF",
+"`@ c #B2B3AE",
+" # c #B2B3AF",
+".# c #B3B4B1",
+"+# c #B4B5B1",
+"@# c #B4B5B0",
+"## c #B5B6B1",
+"$# c #B4B5B2",
+"%# c #BEC0BC",
+" c #D3D4D1",
+"*# c #D8D9D5",
+"=# c #6B6D6B",
+"-# c #C7C8C5",
+";# c #C7C7C5",
+"># c #C7C7C4",
+",# c #C6C6C3",
+"'# c #C5C6C3",
+")# c #C5C5C2",
+"!# c #C6C6C4",
+"~# c #DBDBD9",
+"{# c #484946",
+"]# c #B3B3B0",
+"^# c #DCDDDB",
+"/# c #DDDDDB",
+"(# c #DDDDDC",
+"_# c #DEDFDD",
+":# c #DFDFDD",
+"<# c #DFDFDE",
+"[# c #DCDDDA",
+"}# c #5F5F5D",
+"|# c #424442",
+"1# c #454643",
+"2# c #454744",
+"3# c #414541",
+" ",
+" . + + + + + + + + + + + + + + + + + + @ ",
+" # $ % & & & & & & & & & & & & * * * * + ",
+" @ = - ; > > , , , , , ' ' ' ' ) ' , ! + ",
+" ~ { ] ^ , / ( ( _ _ _ _ _ _ _ _ : : < [ $ + } | ",
+" | 1 2 3 4 5 6 7 8 8 8 8 / 8 7 7 8 8 8 8 / 9 0 2 a b ",
+" c d 2 e f g h i i i i j j k l m m m m m n / o 2 2 p ",
+" { q d r s t u u u u u u u u u u u u u u u u v u w 2 a x ",
+" y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ",
+" | ` .2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ..+.@.#.$.%.{ ",
+" } &.*.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.-.;.>.,.'.).!. ",
+" ~.{.].^.^.^.^.^.^.^.^.^././././././././././././.(._.:.<.[.}. ",
+" |.1.2.3.3.3.3.3.3.3.4.5.6.7.8.9.0.a.b.c.d.e.f.g.h.i.j.k.l.m. ",
+" n.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.p. ",
+" q.r.s.t.u.v.v.w._ x.f y.z.A.f B.C.v.5 D.E.F.G.H.I.J. ",
+" K.r.L.M.N.O.P.Q.R.S.5 T.U.V.W.X.X._ 6 Y.C.Z.`. +.+++ ",
+" @+#+$+%+( &+*+=+S.-+;+>+Q.,+'+Y.)+!+~+{+B.]+%+^+/+(+ ",
+" _+:+<+# [+}+A.|+1+-+2+3+{+4+5+6+7+8+9+N.7+v.0+a+b+c+ ",
+" d+e+f+g+4 h+i+4+j+k+l+m+n+o+p+q+r+[ ;+s+m+t+u+v+w+ ",
+" x+y+z+A+4+B+C+, D+, E+F+G+H+F+I+E+> ; J+'+K+L+M+N+ ",
+" O+P+Q+& R+S+T+U+z+V+[ W+X+Y+Z+`+ @- = .@+@@@#@$@%@ ",
+" &@*@=@-@;@>@,@'@)@!@~@{@]@^@4+]@/@(@_@:@<@3+[@}@|@ ",
+" 1@2@3@H+4@5@6@7@8@9@]@'@V+0@a@W+W+5@b@c@d@e@f@}@g@ ",
+" h@i@j@k@l@m@n@)@o@p@;@q@r@s@t@9@u@4@v@w@x@y@f@z@ ",
+" A@B@o@o@o@o@o@o@o@o@o@o@C@o@o@o@o@o@o@o@o@D@E@z@ ",
+" F.F@o@o@o@o@o@o@o@o@o@o@o@o@o@o@o@o@o@o@o@G@H@I@ ",
+" J@K@L@l@l@l@l@l@l@l@l@l@l@l@l@l@l@l@l@l@l@M@N@O@ ",
+" q@P@Q@R@S@a@T@U@V@W@X@Y@Z@`@Q@ #.#+#@###$#%#*# ",
+" =#W+x+-#-#;#;#>#1@1@1@1@,#,#'#'#'#'#P@P@)#!#~#(+ ",
+" {#]#^#/#/#(#(#X+V+v+v+v+V+V+_#_#_#:#:#<#<#[#m+}# ",
+" |#1#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#2#3# ",
+" "};
Added: trunk/gtk/10_3/src/icons/pkg-tiles-mode.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-tiles-mode.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-tiles-mode.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-tiles-mode.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,13 @@
+/* XPM */
+static const char * pkg_tiles_mode_xpm[] = {
+"8 8 2 1",
+" c None",
+". c #000000",
+" ",
+" .. .. ",
+" .. .. ",
+" ",
+" ",
+" .. .. ",
+" .. .. ",
+" "};
Added: trunk/gtk/10_3/src/icons/pkg-unlocked.xpm
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/icons/pkg-unlocked.xpm?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/icons/pkg-unlocked.xpm (added)
+++ trunk/gtk/10_3/src/icons/pkg-unlocked.xpm Fri Jan 18 12:58:22 2008
@@ -0,0 +1,107 @@
+/* XPM */
+static const char * pkg_unlocked_xpm[] = {
+"16 16 88 1",
+" c None",
+". c #000000",
+"+ c #1E1E1E",
+"@ c #7A7A7A",
+"# c #D2D2D2",
+"$ c #DBDBDB",
+"% c #727272",
+"& c #080808",
+"* c #848484",
+"= c #BEBEBE",
+"- c #363636",
+"; c #1D1D1D",
+"> c #B1B1B1",
+", c #2D2D2D",
+"' c #C2C2C2",
+") c #090909",
+"! c #2E2E2E",
+"~ c #AAAAAA",
+"{ c #2B2B2B",
+"] c #C0C0C0",
+"^ c #161616",
+"/ c #C1C0C0",
+"( c #13110E",
+"_ c #9B9794",
+": c #201D1C",
+"< c #0B0B07",
+"[ c #040302",
+"} c #050403",
+"| c #0D0C09",
+"1 c #282624",
+"2 c #1A130B",
+"3 c #A59176",
+"4 c #E0C4A0",
+"5 c #DFC4A3",
+"6 c #DABE9A",
+"7 c #D6BA94",
+"8 c #CDA676",
+"9 c #815A2B",
+"0 c #E2C5A1",
+"a c #D8B58C",
+"b c #CA9F68",
+"c c #AC8758",
+"d c #A78252",
+"e c #A78253",
+"f c #A37B4B",
+"g c #BC8849",
+"h c #AC712E",
+"i c #E3C6A2",
+"j c #D5AE7E",
+"k c #B08D5F",
+"l c #D5B284",
+"m c #CFAB7C",
+"n c #CFAC7B",
+"o c #CBA471",
+"p c #BC8746",
+"q c #AA6F2B",
+"r c #E1C4A0",
+"s c #D0A674",
+"t c #C79B64",
+"u c #AA8455",
+"v c #A47E4E",
+"w c #A07744",
+"x c #BA8442",
+"y c #E1C29C",
+"z c #CEA470",
+"A c #AD8D64",
+"B c #D2B289",
+"C c #CDAC83",
+"D c #CEAD83",
+"E c #CCA77B",
+"F c #B8803E",
+"G c #AD7332",
+"H c #E0C29E",
+"I c #D4AC79",
+"J c #CDA66E",
+"K c #AF8D5E",
+"L c #AB8758",
+"M c #AB8858",
+"N c #A8814C",
+"O c #B47E3E",
+"P c #D0A874",
+"Q c #C6965D",
+"R c #BE8D50",
+"S c #BA894B",
+"T c #BD8C4E",
+"U c #BC8A4C",
+"V c #BA8647",
+"W c #A47136",
+" ",
+" .. ",
+" +@#$%& ",
+" *=-;>* ",
+",') !~. ",
+"{]. ^/. ",
+" (_:<[[}|12 ",
+" .3455666789.",
+" .0abcddefgh.",
+" .ijklmmnopq.",
+" .rstuvvvwxh.",
+" .yzABCCDEFG.",
+" .HIJKLLMNpO.",
+" .PQRRSSTUVW.",
+" .......... ",
+" "};
Added: trunk/gtk/10_3/src/mng-loader.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/mng-loader.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/mng-loader.c (added)
+++ trunk/gtk/10_3/src/mng-loader.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,342 @@
+#include "mng-loader.h"
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+/* Some select chunk IDs, from libmng.h */
+#define MNG_UINT_MHDR 0x4d484452L
+#define MNG_UINT_BACK 0x4241434bL
+#define MNG_UINT_PLTE 0x504c5445L
+#define MNG_UINT_tRNS 0x74524e53L
+#define MNG_UINT_IHDR 0x49484452L
+#define MNG_UINT_IDAT 0x49444154L
+#define MNG_UINT_IEND 0x49454e44L
+#define MNG_UINT_MEND 0x4d454e44L
+#define MNG_UINT_FRAM 0x4652414dL
+#define MNG_UINT_LOOP 0x4c4f4f50L
+#define MNG_UINT_ENDL 0x454e444cL
+#define MNG_UINT_TERM 0x5445524dL
+
+//** Utilities to read the MNG file
+
+typedef gboolean (*ChunkParser)(YGdkMngPixbuf*, guint8*, GError**);
+
+struct ChunkLoad {
+ guint8 Id;
+ ChunkParser Function;
+
+};
+
+static gboolean read_signature (FILE *file)
+{
+ guchar buf[8];
+ fread (buf, 1, 8, file);
+ return memcmp (buf, "\212MNG\r\n\032\n", 8) == 0;
+}
+
+static gboolean read_uint8 (FILE *file, guint8 *value)
+{
+ return fread (value, 1, 1, file) >= 1;
+}
+
+static gboolean read_uint32 (FILE *file, guint32 *value)
+{
+ guint8 buffer[4];
+ if (fread (buffer, 1, 4, file) < 4)
+ return FALSE;
+ *value = buffer[0] << 24; *value |= buffer[1] << 16;
+ *value |= buffer[2] << 8; *value |= buffer[3];
+ return TRUE;
+}
+
+static gboolean read_data (FILE *file, guint32 size, GdkPixbufLoader *loader,
+ GError **error)
+{
+ guchar data [size];
+ if (fread (data, 1, size, file) < size)
+ {
+ g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ "Unexpected end of file when reading PNG chunk");
+ return FALSE;
+ }
+ return gdk_pixbuf_loader_write (loader, data, size, error);
+}
+
+static void image_prepared_cb (GdkPixbufLoader *loader, YGdkMngPixbuf *mng_pixbuf)
+{
+ GdkPixbuf *pix = gdk_pixbuf_loader_get_pixbuf (loader);
+ mng_pixbuf->frames = g_list_append (mng_pixbuf->frames, pix);
+}
+
+//** YGdkMngPixbuf
+
+G_DEFINE_TYPE (YGdkMngPixbuf, ygdk_mng_pixbuf, GDK_TYPE_PIXBUF_ANIMATION)
+
+static void ygdk_mng_pixbuf_init (YGdkMngPixbuf *pixbuf)
+{
+}
+
+GdkPixbufAnimation *ygdk_mng_pixbuf_new_from_file (const gchar *filename,
+ GError **error_msg)
+{
+ gboolean error = FALSE;
+ #define SET_ERROR(msg) { error = TRUE; \
+ g_set_error (error_msg, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, msg); }
+
+ FILE *file = fopen (filename, "rb");
+ if (!file)
+ {
+ SET_ERROR ("Could not open specified file")
+ return NULL;
+ }
+
+ if (!read_signature (file))
+ {
+ SET_ERROR ("Not a MNG file")
+ return NULL;
+ }
+
+ YGdkMngPixbuf *mng_pixbuf = g_object_new (YGDK_TYPE_MNG_PIXBUF, NULL);
+ mng_pixbuf->iteration_max = 0x7fffffff;
+
+ guint32 chunk_size, chunk_id;
+ long offset;
+ GdkPixbufLoader *loader = NULL; /* currently loading... */
+ gboolean first_read = TRUE;
+
+ do {
+ error = !read_uint32 (file, &chunk_size);
+ error = error || !read_uint32 (file, &chunk_id);
+ if (error)
+ {
+ SET_ERROR ("Unexpected end of file on new chunk")
+ break;
+ }
+ offset = ftell (file) + chunk_size + 4/*CRC*/;
+
+ if (first_read && chunk_id != MNG_UINT_MHDR)
+ {
+ SET_ERROR ("MHDR chunk must come first")
+ break;
+ }
+
+ // not currently reading a PNG stream
+ if (!loader)
+ {
+ switch (chunk_id)
+ {
+ case MNG_UINT_MHDR:
+ if (!first_read)
+ {
+ SET_ERROR ("Only one MHDR chunk allowed")
+ break;
+ }
+
+ if (chunk_size == 7*4)
+ {
+ // Read MHDR chunk data
+ error = !read_uint32 (file, &mng_pixbuf->frame_width);
+ error = error || !read_uint32 (file, &mng_pixbuf->frame_height);
+ error = error || !read_uint32 (file, &mng_pixbuf->ticks_per_second);
+ if (error)
+ SET_ERROR ("Unexpected end of file on MHDR chunk")
+
+ /* Next atttributes: Nominal_layer_count, Nominal_frame_count,
+ Nominal_play_time, Simplicity_profile */
+ else if (mng_pixbuf->frame_width <= 0 ||
+ mng_pixbuf->frame_height <= 0 ||
+ mng_pixbuf->ticks_per_second < 0)
+ SET_ERROR ("Invalid MHDR parameter")
+ }
+ else
+ SET_ERROR ("MHDR chunk must be 28 bytes long")
+ break;
+ case MNG_UINT_IHDR:
+ loader = gdk_pixbuf_loader_new_with_type ("png", NULL);
+ g_signal_connect (G_OBJECT (loader), "area-prepared",
+ G_CALLBACK (image_prepared_cb), mng_pixbuf);
+ gdk_pixbuf_loader_set_size (loader, mng_pixbuf->frame_width,
+ mng_pixbuf->frame_height);
+
+ {
+ const guchar sig[8] = { 137, 80, 78, 71, 13, 10, 26, 10 };
+ if(!gdk_pixbuf_loader_write (loader, sig, 8, error_msg))
+ {
+ error = TRUE;
+ break;
+ }
+ }
+ break;
+ case MNG_UINT_TERM:
+ if (chunk_size > 1)
+ {
+ // Read TERM chunk data
+ guint8 t;
+ error = !read_uint8 (file, &t); // term action
+ if (t == 3 && chunk_size == 2+8)
+ {
+ error = error || !read_uint8 (file, &t); // after term action
+ error = error || !read_uint32 (file, &mng_pixbuf->last_frame_delay);
+ error = error || !read_uint32 (file, &mng_pixbuf->iteration_max);
+ if (error)
+ SET_ERROR ("Unexpected end of file on TERM chunk")
+ }
+ else
+ SET_ERROR ("TERM chunk must be 10 bytes when term action is 3")
+ }
+ else
+ SET_ERROR ("TERM chunk must have at least 1 byte")
+ break;
+ case MNG_UINT_BACK:
+ // TODO:
+ break;
+ case MNG_UINT_IDAT:
+ case MNG_UINT_IEND:
+ if (loader != NULL)
+ SET_ERROR ("Corrupted PNG chunk closures")
+ break;
+ case MNG_UINT_MEND:
+ default:
+ break;
+ }
+ }
+
+ if (error)
+ break;
+
+ // loading a PNG stream
+ if (loader)
+ {
+ fseek (file, -8, SEEK_CUR);
+ if (!read_data (file, chunk_size+8+4, loader, error_msg))
+ error = TRUE;
+ else if (chunk_id == MNG_UINT_IEND)
+ {
+ if (!gdk_pixbuf_loader_close (loader, error_msg))
+ {
+ error = TRUE;
+ break;
+ }
+ loader = NULL;
+ }
+ }
+
+ fseek (file, offset, SEEK_SET);
+ first_read = FALSE;
+ } while (chunk_id != MNG_UINT_MEND && !error);
+
+ if (error)
+ {
+ g_object_unref (G_OBJECT (mng_pixbuf));
+ return NULL;
+ }
+ #undef SET_ERROR
+
+ return GDK_PIXBUF_ANIMATION (mng_pixbuf);
+}
+
+gboolean ygdk_mng_pixbuf_is_static_image (GdkPixbufAnimation *anim)
+{
+ return FALSE;
+}
+
+GdkPixbuf *ygdk_mng_pixbuf_get_static_image (GdkPixbufAnimation *anim)
+{
+ YGdkMngPixbuf *mng_anim = YGDK_MNG_PIXBUF (anim);
+ return g_list_nth_data (mng_anim->frames, 0);
+}
+
+void ygdk_mng_pixbuf_get_size (GdkPixbufAnimation *anim, int *width, int *height)
+{
+ YGdkMngPixbuf *mng_anim = YGDK_MNG_PIXBUF (anim);
+ if (width) *width = mng_anim->frame_width;
+ if (height) *height = mng_anim->frame_height;
+}
+
+GdkPixbufAnimationIter *ygdk_mng_pixbuf_get_iter (GdkPixbufAnimation *anim,
+ const GTimeVal *start_time)
+{
+ YGdkMngPixbufIter *iter = g_object_new (YGDK_TYPE_MNG_PIXBUF_ITER, NULL);
+ iter->mng_pixbuf = YGDK_MNG_PIXBUF( anim );
+ iter->cur_frame = 0;
+ return GDK_PIXBUF_ANIMATION_ITER( iter );
+}
+
+static void ygdk_mng_pixbuf_class_init (YGdkMngPixbufClass *klass)
+{
+ ygdk_mng_pixbuf_parent_class = g_type_class_peek_parent (klass);
+
+ GdkPixbufAnimationClass *pixbuf_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
+ pixbuf_class->is_static_image = ygdk_mng_pixbuf_is_static_image;
+ pixbuf_class->get_static_image = ygdk_mng_pixbuf_get_static_image;
+ pixbuf_class->get_size = ygdk_mng_pixbuf_get_size;
+ pixbuf_class->get_iter = ygdk_mng_pixbuf_get_iter;
+}
+
+//** YGdkMngPixbufIter
+
+G_DEFINE_TYPE (YGdkMngPixbufIter, ygdk_mng_pixbuf_iter, GDK_TYPE_PIXBUF_ANIMATION_ITER)
+
+static void ygdk_mng_pixbuf_iter_init (YGdkMngPixbufIter *iter)
+{
+}
+
+GdkPixbuf *ygdk_mng_pixbuf_iter_get_pixbuf (GdkPixbufAnimationIter *iter)
+{
+ YGdkMngPixbufIter *mng_iter = YGDK_MNG_PIXBUF_ITER (iter);
+ return g_list_nth_data (mng_iter->mng_pixbuf->frames, mng_iter->cur_frame);
+}
+
+gboolean ygdk_mng_pixbuf_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter)
+{
+ return FALSE;
+}
+
+int ygdk_mng_pixbuf_iter_get_delay_time (GdkPixbufAnimationIter *iter)
+{
+ YGdkMngPixbufIter *mng_iter = YGDK_MNG_PIXBUF_ITER (iter);
+ int delay = mng_iter->mng_pixbuf->ticks_per_second;
+ if (mng_iter->cur_frame == g_list_length (mng_iter->mng_pixbuf->frames)-1)
+ delay += mng_iter->mng_pixbuf->last_frame_delay;
+ return delay;
+}
+
+gboolean ygdk_mng_pixbuf_iter_advance (GdkPixbufAnimationIter *iter,
+ const GTimeVal *current_time)
+{
+ YGdkMngPixbufIter *mng_iter = YGDK_MNG_PIXBUF_ITER (iter);
+ YGdkMngPixbuf *mng_pixbuf = mng_iter->mng_pixbuf;
+ if (!mng_pixbuf->frames)
+ return FALSE;
+
+ gboolean can_advance = TRUE;
+ int frames_len = g_list_length (mng_pixbuf->frames);
+ if (mng_iter->cur_frame+1 == frames_len)
+ {
+ if (mng_pixbuf->iteration_max == 0x7fffffff ||
+ mng_iter->cur_iteration < mng_pixbuf->iteration_max)
+ mng_iter->cur_iteration++;
+ else
+ can_advance = FALSE;
+ }
+
+ if (can_advance)
+ mng_iter->cur_frame = (mng_iter->cur_frame+1) % frames_len;
+ return can_advance;
+}
+
+static void ygdk_mng_pixbuf_iter_class_init (YGdkMngPixbufIterClass *klass)
+{
+ ygdk_mng_pixbuf_iter_parent_class = g_type_class_peek_parent (klass);
+
+ GdkPixbufAnimationIterClass *iter_class = GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
+ iter_class->get_delay_time = ygdk_mng_pixbuf_iter_get_delay_time;
+ iter_class->get_pixbuf = ygdk_mng_pixbuf_iter_get_pixbuf;
+ iter_class->on_currently_loading_frame = ygdk_mng_pixbuf_iter_on_currently_loading_frame;
+ iter_class->advance = ygdk_mng_pixbuf_iter_advance;
+}
+
Added: trunk/gtk/10_3/src/mng-loader.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/mng-loader.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/mng-loader.h (added)
+++ trunk/gtk/10_3/src/mng-loader.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,72 @@
+/* GdkPixbuf doesn't support MNG files... MNG is a wrapper around PNG
+ that adds movie playback capabilities.
+ This code doesn't even cover MNG-VLC (smallest subset of the format),
+ but is hopefully enough for common uses. */
+
+#ifndef YGDK_MNG_PIXBUF_H
+#define YGDK_MNG_PIXBUF_H
+
+#define GDK_PIXBUF_ENABLE_BACKEND
+#include
+
+G_BEGIN_DECLS
+#define YGDK_TYPE_MNG_PIXBUF (ygdk_mng_pixbuf_get_type ())
+#define YGDK_MNG_PIXBUF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGDK_TYPE_MNG_PIXBUF, YGdkMngPixbuf))
+#define YGDK_MNG_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGDK_TYPE_MNG_PIXBUF, YGdkMngPixbufClass))
+#define YGDK_IS_MNG_PIXBUF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGDK_TYPE_MNG_PIXBUF))
+#define YGDK_IS_MNG_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGDK_TYPE_MNG_PIXBUF))
+#define YGDK_MNG_PIXBUF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGK_TYPE_MNG_PIXBUF, YGdkMngPixbufClass))
+
+typedef struct YGdkMngPixbuf
+{
+ GdkPixbufAnimation parent;
+
+ // private: (use GdkPixbufAnimation API)
+ GList *frames; // of GdkPixbufs
+ // MHDR header
+ guint32 frame_width, frame_height, ticks_per_second;
+ // TERM header
+ guint32 last_frame_delay, iteration_max;
+} YGdkMngPixbuf;
+
+typedef struct YGdkMngPixbufClass
+{
+ GdkPixbufAnimationClass parent_class;
+} YGdkMngPixbufClass;
+
+GdkPixbufAnimation *ygdk_mng_pixbuf_new_from_file (const gchar *filename, GError **error_msg);
+
+GType ygdk_mng_pixbuf_get_type (void) G_GNUC_CONST;
+
+#define YGDK_TYPE_MNG_PIXBUF_ITER (ygdk_mng_pixbuf_iter_get_type ())
+#define YGDK_MNG_PIXBUF_ITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGDK_TYPE_MNG_PIXBUF_ITER, YGdkMngPixbufIter))
+#define YGDK_MNG_PIXBUF_ITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), YGDK_TYPE_MNG_PIXBUF_ITER, YGdkMngPixbufIterClass))
+#define YGDK_IS_MNG_PIXBUF_ITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), YGDK_TYPE_MNG_PIXBUF_ITER))
+#define YGDK_MNG_PIXBUF_ITER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), YGDK_TYPE_MNG_PIXBUF_ITER, YGdkMngPixbufIterClass))
+
+typedef struct YGdkMngPixbufIter {
+ GdkPixbufAnimationIter parent;
+
+ // private:
+ YGdkMngPixbuf *mng_pixbuf;
+ int cur_frame, cur_iteration;
+} YGdkMngPixbufIter;
+
+typedef struct YGdkMngPixbufIterClass {
+ GdkPixbufAnimationIterClass parent_class;
+} YGdkMngPixbufIterClass;
+
+GType ygdk_mng_pixbuf_iter_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+#endif /*YGDK_MNG_PIXBUF_H*/
+
Added: trunk/gtk/10_3/src/pkg-selector-help.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/pkg-selector-help.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/pkg-selector-help.h (added)
+++ trunk/gtk/10_3/src/pkg-selector-help.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,90 @@
+static const char *pkg_help = _(
+"<h1>Purpose</h1>"
+"<p>This tool lets you manage software, as in 'install, remove, update applications'.</p>"
+"<p>openSUSE's software management is also called 'package management'. A package is "
+"generally an application bundle, but multiple packages that extend the application "
+"may be offered in order to avoid clutter (e.g. games tend to de-couple the music "
+"data in another package, since its not essential and requires significant disk space). "
+"The base package will get the application's name, while extra packages are suffix-ed. "
+"Common extras are:</p>"
+"<ul>"
+"<li>-plugin-: extends the application with some extra functionality.</li>"
+"<li>-devel: needed for software development.</li>"
+"<li>-debuginfo: needed for software beta-testing.</li>"
+"<li>-fr, -dr, -pl (language siglas): translation files (your language package will "
+"be marked for installation automatically).</li>"
+"</ul>"
+"<p>You will find both packages installed on your system, and packages that are made "
+"available through the setup-ed repositories. You cans either install or upgrade "
+"an available package, or remove an installed one.</p>"
+"<blockquote>A repository is a packages media; it can either be local (like your Suse CDs), "
+"or a remote internet server. You can find utilities to setup repositories "
+"on the YaST control center.</blockquote>"
+""
+"<h1>Usage</h1>"
+"<h2>Available, Upgrades, Installed buttons</h2>"
+"<p>These buttons produce listings of the different sources of packages. 'Available' "
+"are the ones from the setup-ed repositories less those you have installed. "
+"'Installed' lists the packages installed in your system. 'Upgrades' is a "
+"mix listing of the installed packages that have more recent versions available. "
+"'All' will combine all sources.</p>"
+""
+"<h2>Filters</h2>"
+"<p>Enter free text into the search-field to match their names and descriptions. "
+"(a search for 'office' will bring up the 'OpenOffice' packages as well as "
+"AbiWord which carries the word 'office' in its description). You can also "
+"choose to view software from a specific repository.</p>"
+""
+"<h2>Categories & Collections</h2>"
+"<p>Software for openSUSE is indexed so that you can find software for a specific "
+"task when you don't know the name of the software you are looking for. Browse "
+"indices of software by using the tree-view in the left column; you can view the "
+"available software by their Package names, or grouped in 'Categories' or 'Patterns' "
+"by the selecting a view-mode from the drop-down-menu below. Categories' are simple, "
+"hierarchical classifications of software packages, like 'Multimedia/Video', while "
+"'Patterns' are task-oriented collections of multiple packages that install like one "
+"(the installation of the 'server'-pattern for example will install various software "
+"needed for running a server). By using 'Install All' you make sure that future "
+"collection changes, when you upgrade openSUSE, will be honored.</p>"
+""
+"<h2>Software details in the box below</h2>"
+"<p>In the package detail view you can perform actions affecting this software; "
+"like install, uninstall, version-upgrade or -downgrade. All changes that you "
+"make will be saved, but not yet performed.</p>"
+"<p>You can review changes in the right-side pane of the software-manager. You can "
+"revoke changes individually at any time by clicking the 'undo'-button next to "
+"a saved change.</p>"
+"<p>The lock button can be used to lock the selected package state; it won't allow "
+"some automatic operation to install, upgrade or remove the package. This is only "
+"useful in very unusual cases: for instance, you may not want to install some "
+"drivers because they interfer with your system, yet you want to install some "
+"collection that includes them.</p>"
+"<p>The changes will be performed once you decide to click the 'perform changes' "
+"button in the lower-right corner. If you want to leave the software-manager "
+"without performing any changes, simply press the button labeled 'Abort'.</p>"
+""
+"<p><i>Thanks to Christian Jäger for co-designing this tool.</i></p>"
+);
+
+static const char *patch_help = _(
+"<h1>Purpose</h1>"
+"<p>This tool gives you control on overviewing and picking patches. You may also "
+"reverse patches that have been applied to the system.</p>"
+""
+"<h1>Usage</h1>"
+"<h2>Categories</h2>"
+"<p>Patches are grouped as follows:</p>"
+"<ul>"
+"<li>Security: patches a software flaw that could be exploited to gain "
+"restricted privilege.</li>"
+"<li>Recommended: fixes non-security related flaws (e.g. data corruption, "
+"performance slowdown)</li>"
+"<li>Optional: ones that only apply to few users.</li>"
+"</ul>"
+"<p>Only patches that apply to your system will be visible. openSUSE developers "
+"are very restrained in pushing patches; you can be sure that all patches are "
+"of signficant severity.</p>"
+"<p>If you are looking for applications enhancements, you should check for Upgrades "
+"on the Software Manager.</p>"
+);
+
Added: trunk/gtk/10_3/src/test.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/test.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/test.cc (added)
+++ trunk/gtk/10_3/src/test.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,186 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+
+bool testMapKBAccel()
+{
+ fprintf (stderr, "Test map KB accels\t");
+ struct {
+ const char *in;
+ const char *out;
+ } aTests[] = {
+ { "Foo&", "Foo_" },
+ { "B&aa", "B_aa" },
+ { "&Foo", "_Foo" },
+ { "_Foo", "__Foo" },
+// FIXME - unfortunately it seems yast has noescaping policy
+// for labels (hmm) at least judging from the code at
+// ncurses/src/NCstring.cc (getHotKey)
+// { "&&Foo", "&Foo" },
+ { NULL, NULL }
+ };
+ for (int i = 0; aTests[i].in; i++) {
+ string mapped = YGUtils::mapKBAccel(aTests[i].in);
+ if (mapped != aTests[i].out) {
+ fprintf (stderr, "Mis-mapped accel '%s' vs '%s'\n",
+ mapped.c_str(), aTests[i].out);
+ return false;
+ }
+ fprintf (stderr, "%d ", i);
+ }
+ fprintf (stderr, "\n");
+ return true;
+}
+
+bool testFilterText ()
+{
+ fprintf (stderr, "Test filter text\t");
+ struct {
+ const char *in;
+ const char *valid;
+ const char *out;
+ } aTests[] = {
+ { "Foo", "F", "F" },
+ { "Foo", "Fo", "Foo" },
+ { "Baa", "a", "aa" },
+ { "Kuckles", "Ks", "Ks" },
+ { NULL, NULL }
+ };
+ for (int i = 0; aTests[i].in; i++) {
+ string filtered = YGUtils::filterText
+ (aTests[i].in, strlen (aTests[i].in), aTests[i].valid);
+ if (filtered != aTests[i].out) {
+ fprintf (stderr, "Mis-filtered text '%s' vs '%s'\n",
+ filtered.c_str(), aTests[i].out);
+ return false;
+ }
+ fprintf (stderr, "%d ", i);
+ }
+ fprintf (stderr, "\n");
+ return true;
+}
+
+bool testXHtmlConvert()
+{
+ fprintf (stderr, "Test HTML->XML rewrite \t");
+ struct {
+ const char *in;
+ const char *out;
+ } aTests[] = {
+ // preservation
+ { "<p>foo</p>", "<body><p>foo</p></body>" },
+ // product substitution
+ { "&product;", "<body>foo</body>" },
+ { " <p>&product;</p>", "<body><p>foo</p></body>" },
+ // outer tag
+ { "some text", "<body>some text</body>" },
+ // unquoted attributes
+ { "<foo baa=Foo></foo>", "<body></foo></body>" },
+ // break tags
+ { "<br>", "<body><br/></body>" },
+ { "<hr>", "<body><hr/></body>" },
+ // unclosed tags
+ { "<p>", "<body><p></p></body>" },
+ { "<b>unclosed", "<body><b>unclosed</b></body>" },
+ { "<b><i>bold</i>", "<body><b><i>bold</i></b></body>" },
+ { "<i><i>bold</i>", "<body><i><i>bold</i></i></body>" },
+ { "<unclosed foo=baa>",
+ "<body></unclosed></body>" },
+ // unclosed 'early close' tags
+ { "<i>Some<p>text<p> here<p></i>",
+ "<body><i>Some<p>text</p><p> here</p><p></p></i></body>" },
+ { "<ul><li>foo<li>baa",
+ "<body><ul><li>foo</li><li>baa</li></ul></body>" },
+ { "no outer<p>unclosed<p>several<b>unclosed bold",
+ "<body>no outer<p>unclosed</p><p>several<b>unclosed bold</b></p></body>" },
+ // multiple white spacing -- proper HTML would had collapsed those multiple
+ // spaces -- not important anyway
+ { "one day I will do", "<body>one day I will do</body>" },
+ // comment
+ { "we need <b>to <!-- really need to? --> do something</b> about it.",
+ "<body>we need <b>to do something</b> about it.</body>" },
+ { NULL, NULL }
+ };
+ for (int i = 0; aTests[i].in; i++) {
+ gchar *out = ygutils_convert_to_xhmlt_and_subst (aTests[i].in, "foo");
+ if (strcmp (out, aTests[i].out)) {
+ fprintf (stderr, "Mis-converted entry %d XML '%s' should be '%s'\n",
+ i, out, aTests[i].out);
+ return false;
+ }
+ fprintf (stderr, "%d ", i);
+ g_free (out);
+ }
+ fprintf (stderr, "\n");
+ return true;
+}
+
+bool testStrCmp()
+{
+ fprintf (stderr, "Test our strcmp\t");
+ struct {
+ const char *in1, *in2;
+ int out;
+ } aTests[] = {
+ { "aaa", "aaaa", 1 },
+ { "29", "235", -1 },
+ { "aA", "Aa", 0 },
+ { "200rt9", "200rT9", 0 },
+ { NULL, NULL }
+ };
+ for (int i = 0; aTests[i].in1; i++) {
+ int ret = YGUtils::strcmp(aTests[i].in1, aTests[i].in2);
+ if (ret * aTests[i].out < 0 || (ret && !aTests[i].out) || (!ret && aTests[i].out)) {
+ fprintf (stderr, "Mis-mapped str comp '%d' vs '%d' ('%s' to '%s')\n",
+ ret, aTests[i].out, aTests[i].in1, aTests[i].in2);
+ return false;
+ }
+ fprintf (stderr, "%d ", i);
+ }
+ fprintf (stderr, "\n");
+ return true;
+}
+
+bool testMarkupEscape()
+{
+ fprintf (stderr, "Test markup escape\t");
+ struct {
+ const char *in;
+ const char *out;
+ bool escape_br;
+ } aTests[] = {
+ { "< text />", "< text />" },
+ { "um\ndois\ntres", "um\ndois\ntres" },
+ { NULL, NULL }
+ };
+ for (int i = 0; aTests[i].in; i++) {
+ string out = YGUtils::escape_markup (aTests[i].in);
+ if (out != aTests[i].out) {
+ fprintf (stderr, "Mis-converted entry %d XML '%s' should be '%s'\n",
+ i, out.c_str(), aTests[i].out);
+ return false;
+ }
+ fprintf (stderr, "%d ", i);
+ }
+ fprintf (stderr, "\n");
+ return true;
+}
+
+int main (int argc, char **argv)
+{
+ bool bSuccess = true;
+
+ bSuccess &= testMapKBAccel();
+ bSuccess &= testFilterText();
+ bSuccess &= testXHtmlConvert();
+ bSuccess &= testStrCmp();
+ bSuccess &= testMarkupEscape();
+
+ return !bSuccess;
+}
Added: trunk/gtk/10_3/src/ygdkmngloader.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygdkmngloader.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygdkmngloader.c (added)
+++ trunk/gtk/10_3/src/ygdkmngloader.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,411 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGdkMngLoader image loader */
+// check the header file for information about this loader
+
+#include "ygdkmngloader.h"
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+/* A few chunks ids */
+#define MNG_UINT_MHDR 0x4d484452L
+#define MNG_UINT_BACK 0x4241434bL
+#define MNG_UINT_PLTE 0x504c5445L
+#define MNG_UINT_tRNS 0x74524e53L
+#define MNG_UINT_IHDR 0x49484452L
+#define MNG_UINT_IDAT 0x49444154L
+#define MNG_UINT_IEND 0x49454e44L
+#define MNG_UINT_MEND 0x4d454e44L
+#define MNG_UINT_FRAM 0x4652414dL
+#define MNG_UINT_LOOP 0x4c4f4f50L
+#define MNG_UINT_ENDL 0x454e444cL
+#define MNG_UINT_TERM 0x5445524dL
+
+//** Utilities to read the MNG file
+
+typedef struct DataStream {
+ const guint8 *data;
+ const long size;
+ long offset;
+} DataStream;
+static DataStream data_stream_constructor (const guint8 *raw_data, long size)
+{
+ DataStream data = { raw_data, size, 0 };
+ return data;
+}
+
+static gboolean read_signature (DataStream *data)
+{
+ if (data->offset+8 > data->size)
+ return FALSE;
+ data->offset += 8;
+ return memcmp (data->data + data->offset-8, "\212MNG\r\n\032\n", 8) == 0;
+}
+
+static gboolean read_uint8 (DataStream *data, guint8 *value)
+{
+ if (data->offset+1 > data->size)
+ return FALSE;
+ *value = data->data [data->offset++];
+ return TRUE;
+}
+
+static gboolean read_uint32 (DataStream *data, guint32 *value)
+{
+ if (data->offset+4 > data->size)
+ return FALSE;
+ *value = data->data[data->offset+0] << 24;
+ *value |= data->data[data->offset+1] << 16;
+ *value |= data->data[data->offset+2] << 8;
+ *value |= data->data[data->offset+3];
+ data->offset += 4;
+ return TRUE;
+}
+
+static gboolean read_data (DataStream *data, guint32 size, GdkPixbufLoader *loader,
+ GError **error)
+{
+ if (data->offset+size > data->size)
+ {
+ g_set_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
+ "Unexpected end of file when reading PNG chunk");
+ return FALSE;
+ }
+ gboolean ret;
+ ret = gdk_pixbuf_loader_write (loader, data->data + data->offset, size, error);
+ data->offset += size;
+ return ret;
+}
+
+static void image_prepared_cb (GdkPixbufLoader *loader, YGdkMngPixbuf *mng_pixbuf)
+{
+ GdkPixbuf *pix = gdk_pixbuf_loader_get_pixbuf (loader);
+ mng_pixbuf->frames = g_list_append (mng_pixbuf->frames, pix);
+}
+
+//** YGdkMngPixbuf
+
+G_DEFINE_TYPE (YGdkMngPixbuf, ygdk_mng_pixbuf, GDK_TYPE_PIXBUF_ANIMATION)
+
+static void ygdk_mng_pixbuf_init (YGdkMngPixbuf *pixbuf)
+{
+}
+
+gboolean ygdk_mng_pixbuf_is_file_mng (const gchar *filename)
+{
+ FILE *file = fopen (filename, "rb");
+ if (!file)
+ goto is_file_mng_failed;
+
+ guchar raw_data [8];
+ if (fread (raw_data, 1, 8, file) < 8)
+ goto is_file_mng_failed;
+
+ gboolean ret = ygdk_mng_pixbuf_is_data_mng (raw_data, 8);
+ fclose (file);
+ return ret;
+
+is_file_mng_failed:
+ if (file)
+ fclose (file);
+ return FALSE;
+}
+
+gboolean ygdk_mng_pixbuf_is_data_mng (const guint8 *raw_data, long size)
+{
+ DataStream data = data_stream_constructor (raw_data, size);
+ return read_signature (&data);
+}
+
+#define SET_ERROR(msg) { error = TRUE; \
+ g_set_error (error_msg, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, msg); }
+
+GdkPixbufAnimation *ygdk_mng_pixbuf_new_from_file (const gchar *filename,
+ GError **error_msg)
+{
+ gboolean error = FALSE;
+ FILE *file = fopen (filename, "rb");
+ if (!file)
+ {
+ SET_ERROR ("Could not open specified file")
+ return NULL;
+ }
+
+ fseek (file, 0, SEEK_END);
+ long file_size = ftell (file);
+ fseek (file, 0, SEEK_SET);
+
+ GdkPixbufAnimation *mng_pixbuf = 0;
+ guchar *data = mmap (NULL, file_size, PROT_READ, MAP_PRIVATE,
+ fileno (file), 0);
+ if (data == MAP_FAILED)
+ SET_ERROR ("Could not map file")
+ else
+ {
+ mng_pixbuf = ygdk_mng_pixbuf_new_from_data (data, file_size, error_msg);
+ munmap (data, file_size);
+ }
+ fclose (file);
+ return mng_pixbuf;
+}
+
+GdkPixbufAnimation *ygdk_mng_pixbuf_new_from_data (const guint8 *raw_data, long size,
+ GError **error_msg)
+{
+ DataStream data = data_stream_constructor (raw_data, size);
+
+ gboolean error = FALSE;
+ if (!read_signature (&data))
+ {
+ SET_ERROR ("Not a MNG file")
+ return NULL;
+ }
+
+ YGdkMngPixbuf *mng_pixbuf = g_object_new (YGDK_TYPE_MNG_PIXBUF, NULL);
+ mng_pixbuf->iteration_max = 0x7fffffff;
+
+ guint32 chunk_size, chunk_id;
+ long chunk_offset;
+ GdkPixbufLoader *loader = NULL; /* currently loading... */
+ gboolean first_read = TRUE;
+
+ do {
+ error = !read_uint32 (&data, &chunk_size);
+ error = error || !read_uint32 (&data, &chunk_id);
+ if (error)
+ {
+ SET_ERROR ("Unexpected end of file on new chunk")
+ break;
+ }
+ chunk_offset = data.offset + chunk_size + 4/*CRC*/;
+
+ if (first_read && chunk_id != MNG_UINT_MHDR)
+ {
+ SET_ERROR ("MHDR chunk must come first")
+ break;
+ }
+
+ // not currently reading a PNG stream
+ if (!loader)
+ {
+ switch (chunk_id)
+ {
+ case MNG_UINT_MHDR:
+ if (!first_read)
+ {
+ SET_ERROR ("Only one MHDR chunk allowed")
+ break;
+ }
+
+ if (chunk_size == 7*4)
+ {
+ // Read MHDR chunk data
+ error = !read_uint32 (&data, &mng_pixbuf->frame_width);
+ error = error || !read_uint32 (&data, &mng_pixbuf->frame_height);
+ error = error || !read_uint32 (&data, &mng_pixbuf->ticks_per_second);
+ if (error)
+ SET_ERROR ("Unexpected end of file on MHDR chunk")
+ /* Next atttributes: Nominal_layer_count, Nominal_frame_count,
+ Nominal_play_time, Simplicity_profile */
+ else if (mng_pixbuf->frame_width <= 0 ||
+ mng_pixbuf->frame_height <= 0 ||
+ mng_pixbuf->ticks_per_second < 0)
+ SET_ERROR ("Invalid MHDR parameter")
+//fprintf(stderr, "ticks per second: %d\n", mng_pixbuf->ticks_per_second);
+ }
+ else
+ SET_ERROR ("MHDR chunk must be 28 bytes long")
+ break;
+ case MNG_UINT_IHDR:
+ loader = gdk_pixbuf_loader_new_with_type ("png", NULL);
+ g_signal_connect (G_OBJECT (loader), "area-prepared",
+ G_CALLBACK (image_prepared_cb), mng_pixbuf);
+ gdk_pixbuf_loader_set_size (loader, mng_pixbuf->frame_width,
+ mng_pixbuf->frame_height);
+
+ {
+ const guchar sig[8] = { 137, 80, 78, 71, 13, 10, 26, 10 };
+ if(!gdk_pixbuf_loader_write (loader, sig, 8, error_msg))
+ {
+ error = TRUE;
+ break;
+ }
+ }
+ break;
+ case MNG_UINT_TERM:
+ if (chunk_size > 1)
+ {
+ // Read TERM chunk data
+ guint8 t;
+ error = !read_uint8 (&data, &t); // term action
+ if (t == 3 && chunk_size == 2+8)
+ {
+ error = error || !read_uint8 (&data, &t); // after term action
+ error = error || !read_uint32 (&data, &mng_pixbuf->last_frame_delay);
+ error = error || !read_uint32 (&data, &mng_pixbuf->iteration_max);
+ if (error)
+ SET_ERROR ("Unexpected end of file on TERM chunk")
+ }
+ else
+ SET_ERROR ("TERM chunk must be 10 bytes when term action is 3")
+ }
+ else
+ SET_ERROR ("TERM chunk must have at least 1 byte")
+ break;
+ case MNG_UINT_BACK:
+ // TODO:
+ break;
+ case MNG_UINT_IDAT:
+ case MNG_UINT_IEND:
+ if (loader != NULL)
+ SET_ERROR ("Corrupted PNG chunk closures")
+ break;
+ case MNG_UINT_MEND:
+ default:
+ break;
+ }
+ }
+
+ if (error)
+ break;
+
+ // loading a PNG stream
+ if (loader)
+ {
+ data.offset -= 8;
+ if (!read_data (&data, chunk_size+8+4, loader, error_msg))
+ error = TRUE;
+ else if (chunk_id == MNG_UINT_IEND)
+ {
+ if (!gdk_pixbuf_loader_close (loader, error_msg))
+ {
+ error = TRUE;
+ break;
+ }
+ loader = NULL;
+ }
+ }
+
+ data.offset = chunk_offset;
+ first_read = FALSE;
+ } while (chunk_id != MNG_UINT_MEND && !error);
+
+ if (error)
+ {
+ g_object_unref (G_OBJECT (mng_pixbuf));
+ return NULL;
+ }
+ return GDK_PIXBUF_ANIMATION (mng_pixbuf);
+}
+
+#undef SET_ERROR
+
+static gboolean ygdk_mng_pixbuf_is_static_image (GdkPixbufAnimation *anim)
+{
+ YGdkMngPixbuf *mng_anim = YGDK_MNG_PIXBUF (anim);
+ return g_list_length (mng_anim->frames) == 1;
+}
+
+static GdkPixbuf *ygdk_mng_pixbuf_get_static_image (GdkPixbufAnimation *anim)
+{
+ YGdkMngPixbuf *mng_anim = YGDK_MNG_PIXBUF (anim);
+ return g_list_nth_data (mng_anim->frames, 0);
+}
+
+static void ygdk_mng_pixbuf_get_size (GdkPixbufAnimation *anim, int *width, int *height)
+{
+ YGdkMngPixbuf *mng_anim = YGDK_MNG_PIXBUF (anim);
+ if (width) *width = mng_anim->frame_width;
+ if (height) *height = mng_anim->frame_height;
+}
+
+static GdkPixbufAnimationIter *ygdk_mng_pixbuf_get_iter (GdkPixbufAnimation *anim,
+ const GTimeVal *start_time)
+{
+ YGdkMngPixbufIter *iter = g_object_new (YGDK_TYPE_MNG_PIXBUF_ITER, NULL);
+ iter->mng_pixbuf = YGDK_MNG_PIXBUF( anim );
+ iter->cur_frame = 0;
+ return GDK_PIXBUF_ANIMATION_ITER( iter );
+}
+
+static void ygdk_mng_pixbuf_class_init (YGdkMngPixbufClass *klass)
+{
+ ygdk_mng_pixbuf_parent_class = g_type_class_peek_parent (klass);
+
+ GdkPixbufAnimationClass *pixbuf_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
+ pixbuf_class->is_static_image = ygdk_mng_pixbuf_is_static_image;
+ pixbuf_class->get_static_image = ygdk_mng_pixbuf_get_static_image;
+ pixbuf_class->get_size = ygdk_mng_pixbuf_get_size;
+ pixbuf_class->get_iter = ygdk_mng_pixbuf_get_iter;
+}
+
+//** YGdkMngPixbufIter
+
+G_DEFINE_TYPE (YGdkMngPixbufIter, ygdk_mng_pixbuf_iter, GDK_TYPE_PIXBUF_ANIMATION_ITER)
+
+static void ygdk_mng_pixbuf_iter_init (YGdkMngPixbufIter *iter)
+{
+}
+
+static GdkPixbuf *ygdk_mng_pixbuf_iter_get_pixbuf (GdkPixbufAnimationIter *iter)
+{
+ YGdkMngPixbufIter *mng_iter = YGDK_MNG_PIXBUF_ITER (iter);
+ return g_list_nth_data (mng_iter->mng_pixbuf->frames, mng_iter->cur_frame);
+}
+
+static gboolean ygdk_mng_pixbuf_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter)
+{
+ return FALSE;
+}
+
+static int ygdk_mng_pixbuf_iter_get_delay_time (GdkPixbufAnimationIter *iter)
+{
+ YGdkMngPixbufIter *mng_iter = YGDK_MNG_PIXBUF_ITER (iter);
+ int delay = 1000.0 / mng_iter->mng_pixbuf->ticks_per_second;
+ if (mng_iter->cur_frame == g_list_length (mng_iter->mng_pixbuf->frames)-1)
+ delay += mng_iter->mng_pixbuf->last_frame_delay;
+ return delay;
+}
+
+static gboolean ygdk_mng_pixbuf_iter_advance (GdkPixbufAnimationIter *iter,
+ const GTimeVal *current_time)
+{
+ YGdkMngPixbufIter *mng_iter = YGDK_MNG_PIXBUF_ITER (iter);
+ YGdkMngPixbuf *mng_pixbuf = mng_iter->mng_pixbuf;
+ if (!mng_pixbuf->frames)
+ return FALSE;
+
+ gboolean can_advance = TRUE;
+ int frames_len = g_list_length (mng_pixbuf->frames);
+ if (mng_iter->cur_frame+1 == frames_len)
+ {
+ if (mng_pixbuf->iteration_max == 0x7fffffff ||
+ mng_iter->cur_iteration < mng_pixbuf->iteration_max)
+ mng_iter->cur_iteration++;
+ else
+ can_advance = FALSE;
+ }
+
+ if (can_advance)
+ mng_iter->cur_frame = (mng_iter->cur_frame+1) % frames_len;
+ return can_advance;
+}
+
+static void ygdk_mng_pixbuf_iter_class_init (YGdkMngPixbufIterClass *klass)
+{
+ ygdk_mng_pixbuf_iter_parent_class = g_type_class_peek_parent (klass);
+
+ GdkPixbufAnimationIterClass *iter_class = GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
+ iter_class->get_delay_time = ygdk_mng_pixbuf_iter_get_delay_time;
+ iter_class->get_pixbuf = ygdk_mng_pixbuf_iter_get_pixbuf;
+ iter_class->on_currently_loading_frame = ygdk_mng_pixbuf_iter_on_currently_loading_frame;
+ iter_class->advance = ygdk_mng_pixbuf_iter_advance;
+}
+
Added: trunk/gtk/10_3/src/ygdkmngloader.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygdkmngloader.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygdkmngloader.h (added)
+++ trunk/gtk/10_3/src/ygdkmngloader.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,80 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* GdkPixbuf doesn't support MNG files... MNG extends PNG adding movie playback
+ capabilities.
+ This code aims for MNG-VLC (smallest subset of the format), though
+ it isn't completely compliable.
+*/
+
+#ifndef YGDK_MNG_PIXBUF_H
+#define YGDK_MNG_PIXBUF_H
+
+#define GDK_PIXBUF_ENABLE_BACKEND
+#include
+G_BEGIN_DECLS
+
+#define YGDK_TYPE_MNG_PIXBUF (ygdk_mng_pixbuf_get_type ())
+#define YGDK_MNG_PIXBUF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGDK_TYPE_MNG_PIXBUF, YGdkMngPixbuf))
+#define YGDK_MNG_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGDK_TYPE_MNG_PIXBUF, YGdkMngPixbufClass))
+#define YGDK_IS_MNG_PIXBUF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGDK_TYPE_MNG_PIXBUF))
+#define YGDK_IS_MNG_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGDK_TYPE_MNG_PIXBUF))
+#define YGDK_MNG_PIXBUF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGK_TYPE_MNG_PIXBUF, YGdkMngPixbufClass))
+
+typedef struct YGdkMngPixbuf
+{
+ GdkPixbufAnimation parent;
+
+ // private: (use GdkPixbufAnimation API)
+ GList *frames; // of GdkPixbufs
+ // MHDR header
+ guint32 frame_width, frame_height, ticks_per_second;
+ // TERM header
+ guint32 last_frame_delay, iteration_max;
+} YGdkMngPixbuf;
+
+typedef struct YGdkMngPixbufClass
+{
+ GdkPixbufAnimationClass parent_class;
+} YGdkMngPixbufClass;
+
+GdkPixbufAnimation *ygdk_mng_pixbuf_new_from_file (const gchar *filename, GError **error);
+GdkPixbufAnimation *ygdk_mng_pixbuf_new_from_data (const guint8 *data, long size, GError **error);
+gboolean ygdk_mng_pixbuf_is_file_mng (const gchar *filename);
+gboolean ygdk_mng_pixbuf_is_data_mng (const guint8 *data, long size);
+
+GType ygdk_mng_pixbuf_get_type (void) G_GNUC_CONST;
+
+#define YGDK_TYPE_MNG_PIXBUF_ITER (ygdk_mng_pixbuf_iter_get_type ())
+#define YGDK_MNG_PIXBUF_ITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGDK_TYPE_MNG_PIXBUF_ITER, YGdkMngPixbufIter))
+#define YGDK_MNG_PIXBUF_ITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), YGDK_TYPE_MNG_PIXBUF_ITER, YGdkMngPixbufIterClass))
+#define YGDK_IS_MNG_PIXBUF_ITER_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), YGDK_TYPE_MNG_PIXBUF_ITER))
+#define YGDK_MNG_PIXBUF_ITER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), YGDK_TYPE_MNG_PIXBUF_ITER, YGdkMngPixbufIterClass))
+
+typedef struct YGdkMngPixbufIter {
+ GdkPixbufAnimationIter parent;
+
+ // private:
+ YGdkMngPixbuf *mng_pixbuf;
+ int cur_frame, cur_iteration;
+} YGdkMngPixbufIter;
+
+typedef struct YGdkMngPixbufIterClass {
+ GdkPixbufAnimationIterClass parent_class;
+} YGdkMngPixbufIterClass;
+
+GType ygdk_mng_pixbuf_iter_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+#endif /*YGDK_MNG_PIXBUF_H*/
+
Added: trunk/gtk/10_3/src/ygtkbargraph.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkbargraph.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkbargraph.c (added)
+++ trunk/gtk/10_3/src/ygtkbargraph.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,196 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkBarGraph widget */
+// check the header file for information about this widget
+
+#include
+#include "ygtkbargraph.h"
+#include
+#include
+#include
+
+G_DEFINE_TYPE (YGtkBarGraph, ygtk_bar_graph, YGTK_TYPE_RATIO_HBOX)
+
+static void ygtk_bar_graph_init (YGtkBarGraph *bar)
+{
+// ygtk_ratio_box_set_homogeneous (YGTK_RATIO_BOX (bar), TRUE);
+
+ bar->m_tooltips = gtk_tooltips_new();
+ gtk_container_set_border_width (GTK_CONTAINER (bar), 12);
+}
+
+/* Just to avoid the size getting too big, when we have little bars. */
+static void ygtk_bar_graph_size_request (GtkWidget *widget, GtkRequisition *requisition)
+{
+ GTK_WIDGET_CLASS (ygtk_bar_graph_parent_class)->size_request (widget, requisition);
+ const int max_width = 250;
+ if (requisition->width > max_width)
+ requisition->width = max_width;
+ requisition->height += 6;
+}
+
+GtkWidget *ygtk_bar_graph_new (void)
+{
+ return g_object_new (YGTK_TYPE_BAR_GRAPH, NULL);
+}
+
+void ygtk_bar_graph_create_entries (YGtkBarGraph *bar, guint entries)
+{
+ // Remove the ones in excess
+ guint i;
+ for (i = entries; i < g_list_length (YGTK_RATIO_BOX (bar)->children); i++)
+ gtk_container_remove (GTK_CONTAINER (bar),
+ (GtkWidget*) g_list_nth_data (YGTK_RATIO_BOX (bar)->children, i));
+
+ // Add new ones, if missing
+ for (i = g_list_length (YGTK_RATIO_BOX (bar)->children); i < entries; i++) {
+ GtkWidget *label = ygtk_colored_label_new();
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
+
+ YGtkColoredLabel *color_label = YGTK_COLORED_LABEL (label);
+ ygtk_colored_label_set_shadow_type (color_label, GTK_SHADOW_OUT);
+
+ // we need a GtkEventBox or something, so we may assign a tooltip to it
+ GtkWidget *box = gtk_event_box_new();
+ gtk_container_add (GTK_CONTAINER (box), label);
+ gtk_container_add (GTK_CONTAINER (bar), box);
+
+ gtk_widget_show_all (box);
+ }
+}
+
+void ygtk_bar_graph_setup_entry (YGtkBarGraph *bar, int index,
+ const gchar *label_entry, int value)
+{
+ YGtkRatioBoxChild *box_child = (YGtkRatioBoxChild *)
+ g_list_nth_data (YGTK_RATIO_BOX (bar)->children, index);
+
+ g_return_if_fail (box_child);
+ GtkWidget *box = box_child->widget;
+ GtkWidget *label = gtk_bin_get_child (GTK_BIN (box));
+
+ if (value < 0)
+ value = 0;
+
+ // Reading label text
+ if (label_entry) {
+ GString *label_text = g_string_new (label_entry);
+ { // Replace %1 by value(i)
+ guint i;
+ for (i = 0; i < label_text->len; i++)
+ if (label_text->str[i] == '%' && label_text->str[i+1] == '1') {
+ gchar *value_str = g_strdup_printf ("%d", value);
+ label_text = g_string_erase (label_text, i, 2);
+ label_text = g_string_insert (label_text, i, value_str);
+ g_free (value_str);
+ }
+ }
+ gtk_label_set_label (GTK_LABEL (label), label_text->str);
+
+ // Tooltip with the label -- useful if the bar entry gets too small
+ gtk_tooltips_set_tip (bar->m_tooltips, box, label_text->str, NULL);
+ }
+
+ // Set proportion
+ gtk_widget_set_size_request (box, 10, -1); // for homogeneous...
+ ygtk_ratio_box_set_child_packing (YGTK_RATIO_BOX (bar), box, MAX (value, 1),
+ TRUE, TRUE, 0);
+
+ // Set background color
+ // The Tango palette
+ const guint palette [][3] = {
+ { 138, 226, 52 }, // Chameleon 1
+ { 252, 175, 62 }, // Orange 1
+ { 114, 159, 207 }, // Sky Blue 1
+ { 233, 185, 110 }, // Chocolate 1
+ { 239, 41, 41 }, // Scarlet Red 1
+ { 252, 233, 79 }, // Butter 1
+ { 173, 127, 168 }, // Plum 1
+ { 115, 210, 22 }, // Chameleon 2
+ { 245, 121, 0 }, // Orange 2
+ { 52, 101, 164 }, // Sky Blue 2
+ { 193, 125, 17 }, // Chocolate 2
+ { 204, 0, 0 }, // Scarlet Red 2
+ { 237, 212, 0 }, // Butter 2
+ { 117, 80, 123 }, // Plum 2
+ { 78, 154, 6 }, // Chameleon 3
+ { 206, 92, 0 }, // Orange 3
+ { 32, 74, 135 }, // Sky Blue 3
+ { 143, 89, 2 }, // Chocolate 3
+ { 164, 0, 0 }, // Scarlet Red 3
+ { 196, 160, 0 }, // Butter 3
+ { 92, 53, 102 }, // Plum 3
+ { 238, 238, 236 }, // Aluminium 1
+ { 211, 215, 207 }, // Aluminium 2
+ { 186, 189, 182 }, // Aluminium 3
+ { 136, 138, 133 }, // Aluminium 4
+ { 85, 87, 83 }, // Aluminium 5
+ { 46, 52, 54 }, // Aluminium 6
+ };
+
+ const guint *color = palette [index % G_N_ELEMENTS (palette)];
+
+ YGtkColoredLabel *color_label = YGTK_COLORED_LABEL (label);
+ ygtk_colored_label_set_background (color_label, color[0], color[1], color[2]);
+}
+
+static void ygtk_bar_graph_class_init (YGtkBarGraphClass *klass)
+{
+ ygtk_bar_graph_parent_class = g_type_class_peek_parent (klass);
+
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->size_request = ygtk_bar_graph_size_request;
+}
+
+//** YGtkColoredLabel
+
+G_DEFINE_TYPE (YGtkColoredLabel, ygtk_colored_label, GTK_TYPE_LABEL)
+
+static void ygtk_colored_label_init (YGtkColoredLabel *label)
+{
+ label->shadow = GTK_SHADOW_NONE;
+}
+
+static gboolean ygtk_colored_label_expose_event (GtkWidget *widget, GdkEventExpose *event)
+{
+ GtkStyle *style = gtk_widget_get_style (widget);
+ GtkAllocation *alloc = &widget->allocation;
+ gtk_paint_box (style, widget->window, GTK_STATE_NORMAL,
+ YGTK_COLORED_LABEL (widget)->shadow, &event->area,
+ widget, NULL, alloc->x, alloc->y, alloc->width, alloc->height);
+
+ GTK_WIDGET_CLASS (ygtk_colored_label_parent_class)->expose_event (widget, event);
+ return FALSE;
+}
+
+GtkWidget *ygtk_colored_label_new (void)
+{ return g_object_new (YGTK_TYPE_COLORED_LABEL, NULL); }
+
+void ygtk_colored_label_set_foreground (YGtkColoredLabel *label, guint red,
+ guint green, guint blue)
+{
+ GdkColor color = { 0, red << 8, green << 8, blue << 8 };
+ gtk_widget_modify_fg (GTK_WIDGET (label), GTK_STATE_NORMAL, &color);
+}
+
+void ygtk_colored_label_set_background (YGtkColoredLabel *label, guint red,
+ guint green, guint blue)
+{
+ GdkColor color = { 0, red << 8, green << 8, blue << 8 };
+ gtk_widget_modify_bg (GTK_WIDGET (label), GTK_STATE_NORMAL, &color);
+}
+
+void ygtk_colored_label_set_shadow_type (YGtkColoredLabel *label, GtkShadowType type)
+{
+ label->shadow = type;
+}
+
+static void ygtk_colored_label_class_init (YGtkColoredLabelClass *klass)
+{
+ ygtk_colored_label_parent_class = g_type_class_peek_parent (klass);
+
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->expose_event = ygtk_colored_label_expose_event;
+}
Added: trunk/gtk/10_3/src/ygtkbargraph.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkbargraph.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkbargraph.h (added)
+++ trunk/gtk/10_3/src/ygtkbargraph.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,101 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkBarGraph is just a simple graph of bars that may be
+ changed during run-time (see ygtk_bar_graph_setup_entry()).
+*/
+
+#ifndef YGTK_BAR_GRAPH_H
+#define YGTK_BAR_GRAPH_H
+
+#include "ygtkratiobox.h"
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_BAR_GRAPH (ygtk_bar_graph_get_type ())
+#define YGTK_BAR_GRAPH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_BAR_GRAPH, YGtkBarGraph))
+#define YGTK_BAR_GRAPH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_BAR_GRAPH, YGtkBarGraphClass))
+#define YGTK_IS_BAR_GRAPH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_BAR_GRAPH))
+#define YGTK_IS_BAR_GRAPH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_BAR_GRAPH))
+#define YGTK_BAR_GRAPH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_BAR_GRAPH, YGtkBarGraphClass))
+
+typedef struct _YGtkBarGraph YGtkBarGraph;
+typedef struct _YGtkBarGraphClass YGtkBarGraphClass;
+
+struct _YGtkBarGraph
+{
+ YGtkRatioHBox parent;
+
+ // private
+ GtkTooltips *m_tooltips;
+};
+
+struct _YGtkBarGraphClass
+{
+ YGtkRatioBoxClass parent_class;
+};
+
+GtkWidget *ygtk_bar_graph_new (void);
+GType ygtk_bar_graph_get_type (void) G_GNUC_CONST;
+
+void ygtk_bar_graph_create_entries (YGtkBarGraph *bar, guint entries);
+void ygtk_bar_graph_setup_entry (YGtkBarGraph *bar, int index,
+ const gchar *label_entry, int value);
+
+G_END_DECLS
+#endif /*YGTK_BAR_GRAPH_H*/
+
+#ifndef YGTK_COLORED_LABEL_H
+#define YGTK_COLORED_LABEL_H
+
+#include
+G_BEGIN_DECLS
+
+/* YGtkColoredLabel is a GtkLabel where gtk_modify_bg() can be used. It also
+ allows a frame around it. */
+
+#define YGTK_TYPE_COLORED_LABEL (ygtk_colored_label_get_type ())
+#define YGTK_COLORED_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_COLORED_LABEL, YGtkColoredLabel))
+#define YGTK_COLORED_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_COLORED_LABEL, YGtkColoredLabelClass))
+#define YGTK_IS_COLORED_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_COLORED_LABEL))
+#define YGTK_IS_COLORED_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_COLORED_LABEL))
+#define YGTK_COLORED_LABEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_COLORED_LABEL, YGtkColoredLabelClass))
+
+typedef struct _YGtkColoredLabel
+{
+ GtkLabel parent;
+
+ // private
+ GtkShadowType shadow;
+} YGtkColoredLabel;
+
+typedef struct _YGtkColoredLabelClass
+{
+ GtkLabelClass parent_class;
+} YGtkColoredLabelClass;
+
+GtkWidget *ygtk_colored_label_new (void);
+GType ygtk_colored_label_get_type (void) G_GNUC_CONST;
+
+// A convenience function (you may use gtk_widget_modify_fg() and
+// gtk_widget_modify_bg() instead), where colors range is [0, 255]
+void ygtk_colored_label_set_foreground (YGtkColoredLabel *label, guint red,
+ guint green, guint blue);
+void ygtk_colored_label_set_background (YGtkColoredLabel *label, guint red,
+ guint green, guint blue);
+
+void ygtk_colored_label_set_shadow_type (YGtkColoredLabel *label, GtkShadowType type);
+
+G_END_DECLS
+#endif /*YGTK_COLORED_LABEL*/
Added: trunk/gtk/10_3/src/ygtkfieldentry.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkfieldentry.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkfieldentry.c (added)
+++ trunk/gtk/10_3/src/ygtkfieldentry.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,222 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkFieldEntry widget */
+// check the header file for information about this widget
+
+#include
+#include "ygtkfieldentry.h"
+#include
+#include
+
+//** YGtkFilterEntry
+
+static void ygtk_filter_entry_editable_init (GtkEditableClass *iface);
+
+G_DEFINE_TYPE_WITH_CODE (YGtkFilterEntry, ygtk_filter_entry, GTK_TYPE_ENTRY,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, ygtk_filter_entry_editable_init))
+
+static void ygtk_filter_entry_init (YGtkFilterEntry *entry)
+{
+}
+
+static void ygtk_filter_entry_insert_text (GtkEditable *editable, const gchar *new_text,
+ gint new_text_length, gint *pos)
+{
+ const gchar *valid_chars = YGTK_FILTER_ENTRY (editable)->valid_chars;
+ if (valid_chars) {
+ const gchar *i, *j;
+ for (i = new_text; *i; i++) {
+ for (j = valid_chars; *j; j++) {
+ if (*i == *j)
+ break;
+ }
+ if (!*j) {
+ // not valid text
+ gdk_beep();
+ return;
+ }
+ }
+ }
+
+ GtkEditableClass *parent_editable_iface = g_type_interface_peek
+ (ygtk_filter_entry_parent_class, GTK_TYPE_EDITABLE);
+ parent_editable_iface->insert_text (editable, new_text, new_text_length, pos);
+}
+
+static void ygtk_filter_entry_destroy (GtkObject *object)
+{
+ YGtkFilterEntry *entry = YGTK_FILTER_ENTRY (object);
+ if (entry->valid_chars)
+ g_free (entry->valid_chars);
+ entry->valid_chars = NULL;
+
+ GTK_OBJECT_CLASS (ygtk_filter_entry_parent_class)->destroy (object);
+}
+
+GtkWidget *ygtk_filter_entry_new (void)
+{
+ return g_object_new (YGTK_TYPE_FILTER_ENTRY, NULL);
+}
+
+void ygtk_filter_entry_set_valid_chars (YGtkFilterEntry *entry, const gchar *valid_chars)
+{
+ if (entry->valid_chars)
+ g_free (entry->valid_chars);
+ entry->valid_chars = g_strdup (valid_chars);
+}
+
+static void ygtk_filter_entry_class_init (YGtkFilterEntryClass *klass)
+{
+ ygtk_filter_entry_parent_class = g_type_class_peek_parent (klass);
+
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_filter_entry_destroy;
+}
+
+static void ygtk_filter_entry_editable_init (GtkEditableClass *iface)
+{
+ iface->insert_text = ygtk_filter_entry_insert_text;
+}
+
+//** YGtkFieldEntry
+
+static guint filter_entry_signal;
+G_DEFINE_TYPE (YGtkFieldEntry, ygtk_field_entry, GTK_TYPE_HBOX)
+
+static void ygtk_field_entry_init (YGtkFieldEntry *entry)
+{
+ gtk_box_set_spacing (GTK_BOX (entry), 4);
+}
+
+static YGtkFilterEntry *ygtk_field_entry_focus_next_entry (YGtkFieldEntry *fields,
+ YGtkFilterEntry *current_entry,
+ gint side)
+{
+ GList *children = gtk_container_get_children (GTK_CONTAINER (fields));
+ gint pos = g_list_index (children, current_entry);
+
+ YGtkFilterEntry *next_entry = g_list_nth_data (children, pos + (2 * side));
+ g_list_free (children);
+
+ if (next_entry)
+ gtk_widget_grab_focus (GTK_WIDGET (next_entry));
+ return next_entry;
+}
+
+// If max characters reached, jump to next field
+static void ygtk_field_entry_insert_text (GtkEditable *editable, const gchar *new_text,
+ gint new_text_length, gint *position, YGtkFieldEntry *fields)
+{
+ if (*position == gtk_entry_get_max_length (GTK_ENTRY (editable))) {
+ YGtkFilterEntry *next_entry = ygtk_field_entry_focus_next_entry (fields,
+ YGTK_FILTER_ENTRY (editable), 1);
+ if (next_entry) {
+ gint pos = 0;
+ gtk_editable_insert_text (GTK_EDITABLE (next_entry), new_text,
+ new_text_length, &pos);
+ gtk_editable_set_position (GTK_EDITABLE (next_entry), pos);
+
+ // it would not insert the text anyway, but to avoid the beep
+ g_signal_stop_emission_by_name (editable, "insert_text");
+ }
+ }
+}
+
+static void ygtk_field_entry_move_cursor (GtkEntry *entry, GtkMovementStep move,
+ gint count, gboolean selection, YGtkFieldEntry *fields)
+{
+ if (move == GTK_MOVEMENT_VISUAL_POSITIONS) {
+ if (count > 0)
+ ygtk_field_entry_focus_next_entry (fields, YGTK_FILTER_ENTRY (entry), 1);
+ else
+ ygtk_field_entry_focus_next_entry (fields, YGTK_FILTER_ENTRY (entry), -1);
+ }
+}
+
+static void ygtk_field_entry_entry_changed (GtkEditable *editable, YGtkFieldEntry *fields)
+{
+ GList *children = gtk_container_get_children (GTK_CONTAINER (fields));
+ gint nb = g_list_index (children, YGTK_FILTER_ENTRY (editable)) / 2;
+ g_list_free (children);
+
+ g_signal_emit (fields, filter_entry_signal, 0, nb);
+}
+
+GtkWidget *ygtk_field_entry_new (void)
+{
+ return g_object_new (YGTK_TYPE_FIELD_ENTRY, NULL);
+}
+
+void ygtk_field_entry_add_field (YGtkFieldEntry *fields, gchar separator,
+ guint max_length, const gchar *valid_chars)
+{
+ GtkWidget *label = 0, *entry;
+ if (fields->use_separator) {
+ const gchar str[2] = { separator, '\0' };
+ label = gtk_label_new (str);
+ }
+ entry = ygtk_filter_entry_new();
+ gtk_entry_set_max_length (GTK_ENTRY (entry), max_length);
+ gtk_entry_set_width_chars (GTK_ENTRY (entry), (max_length == 0) ? -1 : max_length);
+ ygtk_filter_entry_set_valid_chars (YGTK_FILTER_ENTRY (entry), valid_chars);
+
+ g_signal_connect (G_OBJECT (entry), "insert-text",
+ G_CALLBACK (ygtk_field_entry_insert_text), fields);
+ g_signal_connect (G_OBJECT (entry), "move-cursor",
+ G_CALLBACK (ygtk_field_entry_move_cursor), fields);
+
+ g_signal_connect (G_OBJECT (entry), "changed",
+ G_CALLBACK (ygtk_field_entry_entry_changed), fields);
+
+ GtkBox *box = GTK_BOX (fields);
+ if (label)
+ gtk_box_pack_start (box, label, FALSE, FALSE, 0);
+ gtk_box_pack_start (box, entry, TRUE, TRUE, 0);
+
+ fields->use_separator = TRUE;
+}
+
+static YGtkFilterEntry *ygtk_field_entry_get_field (YGtkFieldEntry *fields, guint nb)
+{
+ YGtkFilterEntry *entry;
+
+ GList *children = gtk_container_get_children (GTK_CONTAINER (fields));
+ entry = g_list_nth_data (children, nb * 2);
+ g_list_free (children);
+
+ return entry;
+}
+
+void ygtk_field_entry_set_field_text (YGtkFieldEntry *fields, guint nb, const gchar *text)
+{
+ YGtkFilterEntry *entry = ygtk_field_entry_get_field (fields, nb);
+ g_signal_handlers_block_by_func (entry,
+ (gpointer) ygtk_field_entry_entry_changed, fields);
+ g_signal_handlers_block_by_func (entry,
+ (gpointer) ygtk_field_entry_insert_text, fields);
+
+ gtk_entry_set_text (GTK_ENTRY (entry), text);
+
+ g_signal_handlers_unblock_by_func (entry,
+ (gpointer) ygtk_field_entry_entry_changed, fields);
+ g_signal_handlers_unblock_by_func (entry,
+ (gpointer) ygtk_field_entry_insert_text, fields);
+}
+
+const gchar *ygtk_field_entry_get_field_text (YGtkFieldEntry *fields, guint nb)
+{
+ YGtkFilterEntry *entry = ygtk_field_entry_get_field (fields, nb);
+ return gtk_entry_get_text (GTK_ENTRY (entry));
+}
+
+static void ygtk_field_entry_class_init (YGtkFieldEntryClass *klass)
+{
+ ygtk_field_entry_parent_class = g_type_class_peek_parent (klass);
+
+ filter_entry_signal = g_signal_new ("field_entry_changed",
+ G_OBJECT_CLASS_TYPE (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (YGtkFieldEntryClass, filter_entry_changed),
+ NULL, NULL, gtk_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+}
Added: trunk/gtk/10_3/src/ygtkfieldentry.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkfieldentry.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkfieldentry.h (added)
+++ trunk/gtk/10_3/src/ygtkfieldentry.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,102 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkFieldEntry is an extension of GtkEntry with the added
+ functionality of being able to define fields (useful for when
+ you need the user to set a IP address or time/date). The number
+ of fields, their individual range and separation character
+ is all customizable.
+
+ YGtkFilterEntry is an extension to GtkEntry that only accepts
+ input that is specified in an array of valid characters
+*/
+
+#ifndef YGTK_FILTER_ENTRY_H
+#define YGTK_FILTER_ENTRY_H
+
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_FILTER_ENTRY (ygtk_filter_entry_get_type ())
+#define YGTK_FILTER_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_FILTER_ENTRY, YGtkFilterEntry))
+#define YGTK_FILTER_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_FILTER_ENTRY, YGtkFilterEntryClass))
+#define YGTK_IS_FILTER_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_FILTER_ENTRY))
+#define YGTK_IS_FILTER_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_FILTER_ENTRY))
+#define YGTK_FILTER_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_FILTER_ENTRY, YGtkFilterEntryClass))
+
+typedef struct _YGtkFilterEntry
+{
+ GtkEntry parent;
+
+ // private:
+ gchar *valid_chars;
+} YGtkFilterEntry;
+
+typedef struct _YGtkFilterEntryClass
+{
+ GtkEntryClass parent_class;
+} YGtkFilterEntryClass;
+
+GtkWidget* ygtk_filter_entry_new (void);
+GType ygtk_filter_entry_get_type (void) G_GNUC_CONST;
+
+void ygtk_filter_entry_set_valid_chars (YGtkFilterEntry *entry,
+ const gchar *valid_chars);
+
+G_END_DECLS
+#endif /*YGTK_FILTER_ENTRY_H*/
+
+#ifndef YGTK_FIELD_ENTRY_H
+#define YGTK_FIELD_ENTRY_H
+
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_FIELD_ENTRY (ygtk_field_entry_get_type ())
+#define YGTK_FIELD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_FIELD_ENTRY, YGtkFieldEntry))
+#define YGTK_FIELD_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_FIELD_ENTRY, YGtkFieldEntryClass))
+#define IS_YGTK_FIELD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_FIELD_ENTRY))
+#define IS_YGTK_FIELD_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_FIELD_ENTRY))
+#define YGTK_FIELD_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_FIELD_ENTRY, YGtkFieldEntryClass))
+
+typedef struct _YGtkFieldEntry
+{
+ GtkHBox parent;
+
+ // private:
+ // used to disable separator for the first field
+ gboolean use_separator;
+} YGtkFieldEntry;
+
+typedef struct _YGtkFieldEntryClass
+{
+ GtkHBoxClass parent_class;
+
+ void (* filter_entry_changed) (YGtkFieldEntry *entry, gint field_nb);
+} YGtkFieldEntryClass;
+
+GtkWidget* ygtk_field_entry_new (void);
+GType ygtk_field_entry_get_type (void) G_GNUC_CONST;
+
+// if this is the first field, separator will be ignored. max_length can be 0 to
+// disable it. valids_chars can be NULL to disable it.
+void ygtk_field_entry_add_field (YGtkFieldEntry *entry, gchar separator,
+ guint max_length, const gchar *valid_chars);
+
+// convinience
+void ygtk_field_entry_set_field_text (YGtkFieldEntry *entry, guint nb, const gchar *text);
+const gchar *ygtk_field_entry_get_field_text (YGtkFieldEntry *entry, guint nb);
+
+G_END_DECLS
+#endif /*YGTK_FIELD_ENTRY_H*/
Added: trunk/gtk/10_3/src/ygtkfindentry.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkfindentry.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkfindentry.c (added)
+++ trunk/gtk/10_3/src/ygtkfindentry.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,517 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkExtEntry widget */
+// check the header file for information about this widget
+
+#include
+#include "ygtkfindentry.h"
+#include
+
+G_DEFINE_TYPE (YGtkExtEntry, ygtk_ext_entry, GTK_TYPE_ENTRY)
+
+static void ygtk_ext_entry_init (YGtkExtEntry *entry)
+{
+}
+
+static void ygtk_ext_entry_destroy (GtkObject *object)
+{
+ GTK_OBJECT_CLASS (ygtk_ext_entry_parent_class)->destroy (object);
+
+ YGtkExtEntry *entry = YGTK_EXT_ENTRY (object);
+ ygtk_ext_entry_set_border_window_size (entry, YGTK_EXT_ENTRY_LEFT_WIN, 0);
+ ygtk_ext_entry_set_border_window_size (entry, YGTK_EXT_ENTRY_RIGHT_WIN, 0);
+}
+
+static void ygtk_ext_entry_map (GtkWidget *widget)
+{
+ if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget)) {
+ GTK_WIDGET_CLASS (ygtk_ext_entry_parent_class)->map (widget);
+
+ YGtkExtEntry *entry = YGTK_EXT_ENTRY (widget);
+ if (entry->left_window)
+ gdk_window_show (entry->left_window);
+ if (entry->right_window)
+ gdk_window_show (entry->right_window);
+ }
+}
+
+static void ygtk_ext_entry_unmap (GtkWidget *widget)
+{
+ if (GTK_WIDGET_MAPPED (widget)) {
+ YGtkExtEntry *entry = YGTK_EXT_ENTRY (widget);
+ if (entry->left_window)
+ gdk_window_hide (entry->left_window);
+ if (entry->right_window)
+ gdk_window_hide (entry->right_window);
+
+ GTK_WIDGET_CLASS (ygtk_ext_entry_parent_class)->unmap (widget);
+ }
+}
+
+static void ygtk_ext_entry_sync_color (YGtkExtEntry *entry)
+{
+ /* We don't use gtk_style_set_background() since we want to reflect
+ gtk_widget_modify_base() color, if changed. */
+
+ GtkWidget *widget = GTK_WIDGET (entry);
+ GdkColor color = widget->style->base [GTK_STATE_NORMAL];
+ gdk_rgb_find_color (gtk_widget_get_colormap (widget), &color);
+
+ if (entry->left_window)
+ gdk_window_set_background (entry->left_window, &color);
+ if (entry->right_window)
+ gdk_window_set_background (entry->right_window, &color);
+}
+
+static void ygtk_ext_entry_style_set (GtkWidget *widget, GtkStyle *prev_style)
+{
+ GTK_WIDGET_CLASS (ygtk_ext_entry_parent_class)->style_set (widget, prev_style);
+ ygtk_ext_entry_sync_color (YGTK_EXT_ENTRY (widget));
+}
+
+GdkWindow *ygtk_ext_entry_get_window (YGtkExtEntry *entry,
+ YGtkExtEntryWindowType type)
+{
+ switch (type) {
+ case YGTK_EXT_ENTRY_WIDGET_WIN:
+ return gtk_widget_get_parent_window (GTK_WIDGET (entry));
+ case YGTK_EXT_ENTRY_TEXT_WIN:
+ return GTK_ENTRY (entry)->text_area;
+ case YGTK_EXT_ENTRY_LEFT_WIN:
+ return entry->left_window;
+ case YGTK_EXT_ENTRY_RIGHT_WIN:
+ return entry->right_window;
+ }
+ return NULL;
+}
+
+void ygtk_ext_entry_set_border_window_size (YGtkExtEntry *entry,
+ YGtkExtEntryWindowType type, gint size)
+{
+ GtkWidget *widget = GTK_WIDGET (entry);
+ g_return_if_fail (type == YGTK_EXT_ENTRY_LEFT_WIN || type == YGTK_EXT_ENTRY_RIGHT_WIN);
+
+ GdkWindow **window;
+ if (type == YGTK_EXT_ENTRY_LEFT_WIN)
+ window = &entry->left_window;
+ else
+ window = &entry->right_window;
+
+ if (size) {
+ if (!*window) {
+ // must be realized to create a window
+ GdkWindowAttr attributes;
+ gint attributes_mask;
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = gtk_widget_get_visual (widget);
+ attributes.colormap = gtk_widget_get_colormap (widget);
+ attributes.event_mask = gtk_widget_get_events (widget);
+ attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK
+ | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK
+ | GDK_ENTER_NOTIFY_MASK | GDK_POINTER_MOTION_MASK
+ | GDK_POINTER_MOTION_HINT_MASK;
+ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+ // this will be tuned on size_allocate
+ if (type == YGTK_EXT_ENTRY_LEFT_WIN)
+ attributes.x = 0;
+ else
+ attributes.x = widget->allocation.width - size;
+ attributes.y = widget->allocation.y;
+ attributes.width = size;
+ attributes.height = widget->allocation.height;
+
+ *window = gdk_window_new (widget->window,
+ &attributes, attributes_mask);
+ gdk_window_set_user_data (*window, widget);
+ // set background style
+ ygtk_ext_entry_sync_color (entry);
+
+ if (GTK_WIDGET_MAPPED (widget))
+ gdk_window_show (*window);
+ gtk_widget_queue_resize (widget);
+ }
+ else {
+ gint width, height;
+ gdk_drawable_get_size (GDK_DRAWABLE (*window), &width, &height);
+ if (width != size) {
+ gdk_window_resize (*window, size, height);
+ gtk_widget_queue_resize (widget);
+ }
+ }
+ }
+ else { // remove the window
+ if (*window) {
+ gdk_window_set_user_data (*window, NULL);
+ gdk_window_destroy (*window);
+ *window = NULL;
+ gtk_widget_queue_resize (widget);
+ }
+ }
+}
+
+gint ygtk_ext_entry_get_border_window_size (YGtkExtEntry *entry,
+ YGtkExtEntryWindowType type)
+{
+ g_return_val_if_fail (type == YGTK_EXT_ENTRY_LEFT_WIN || type == YGTK_EXT_ENTRY_RIGHT_WIN, 0);
+ GdkWindow *window = ygtk_ext_entry_get_window (entry, type);
+ gint size = 0;
+ if (window && gdk_window_is_visible (window))
+ gdk_drawable_get_size (GDK_DRAWABLE (window), &size, NULL);
+ return size;
+}
+
+static void ygtk_ext_entry_size_request (GtkWidget *widget, GtkRequisition *req)
+{
+ GTK_WIDGET_CLASS (ygtk_ext_entry_parent_class)->size_request (widget, req);
+
+ YGtkExtEntry *entry = YGTK_EXT_ENTRY (widget);
+ req->width += ygtk_ext_entry_get_border_window_size (entry,
+ YGTK_EXT_ENTRY_LEFT_WIN);
+ req->width += ygtk_ext_entry_get_border_window_size (entry,
+ YGTK_EXT_ENTRY_RIGHT_WIN);
+}
+
+static void ygtk_ext_entry_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GTK_WIDGET_CLASS (ygtk_ext_entry_parent_class)->size_allocate
+ (widget, allocation);
+ if (!GTK_WIDGET_REALIZED (widget))
+ return;
+
+ YGtkExtEntry *entry = YGTK_EXT_ENTRY (widget);
+ gint left_border, right_border;
+ left_border = ygtk_ext_entry_get_border_window_size (entry,
+ YGTK_EXT_ENTRY_LEFT_WIN);
+ right_border = ygtk_ext_entry_get_border_window_size (entry,
+ YGTK_EXT_ENTRY_RIGHT_WIN);
+
+ GdkWindow *window;
+ gint _x, _y, _w, _h, x, w;
+
+ // text window
+ window = ygtk_ext_entry_get_window (entry, YGTK_EXT_ENTRY_TEXT_WIN);
+ gdk_window_get_geometry (window, &_x, &_y, &_w, &_h, NULL);
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
+ x = _x + left_border;
+ else
+ x = _x + right_border;
+ w = _w - (left_border + right_border);
+ gdk_window_move_resize (window, x, _y, w, _h);
+
+ // left window
+ window = ygtk_ext_entry_get_window (entry, YGTK_EXT_ENTRY_LEFT_WIN);
+ if (window && gdk_window_is_visible (window)) {
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
+ x = _x;
+ else
+ x = _x + _w - left_border;
+ w = left_border;
+ gdk_window_move_resize (window, x, _y, w, _h);
+ }
+
+ // right window
+ window = ygtk_ext_entry_get_window (entry, YGTK_EXT_ENTRY_RIGHT_WIN);
+ if (window && gdk_window_is_visible (window)) {
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
+ x = _x + _w - right_border;
+ else
+ x = _x;
+ w = right_border;
+ gdk_window_move_resize (window, x, _y, w, _h);
+ }
+}
+
+GtkWidget *ygtk_ext_entry_new (void)
+{
+ return g_object_new (YGTK_TYPE_EXT_ENTRY, NULL);
+}
+
+static void ygtk_ext_entry_class_init (YGtkExtEntryClass *klass)
+{
+ GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
+ gtkwidget_class->map = ygtk_ext_entry_map;
+ gtkwidget_class->unmap = ygtk_ext_entry_unmap;
+ gtkwidget_class->style_set = ygtk_ext_entry_style_set;
+ gtkwidget_class->size_request = ygtk_ext_entry_size_request;
+ gtkwidget_class->size_allocate = ygtk_ext_entry_size_allocate;
+
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_ext_entry_destroy;
+}
+
+/* YGtkFindEntry widget */
+// check the header file for information about this widget
+
+#include
+#define ARROW_SIZE 7
+
+static void ygtk_find_entry_editable_init (GtkEditableClass *iface);
+
+G_DEFINE_TYPE_WITH_CODE (YGtkFindEntry, ygtk_find_entry, YGTK_TYPE_EXT_ENTRY,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, ygtk_find_entry_editable_init))
+
+static void ygtk_find_entry_init (YGtkFindEntry *entry)
+{
+}
+
+static void ygtk_find_entry_destroy (GtkObject *object)
+{
+ GTK_OBJECT_CLASS (ygtk_find_entry_parent_class)->destroy (object);
+
+ YGtkFindEntry *entry = YGTK_FIND_ENTRY (object);
+
+#define DESTROY_ICON(icon) \
+ if (icon) { g_object_unref (G_OBJECT (icon)); icon = NULL; }
+
+ DESTROY_ICON (entry->find_icon)
+ DESTROY_ICON (entry->find_hover_icon)
+ DESTROY_ICON (entry->clear_icon)
+ DESTROY_ICON (entry->clear_hover_icon)
+#undef DESTROY_ICON
+}
+
+// Code from Banshee: shades a pixbuf a bit, used to provide the hover effect
+static inline guchar pixel_clamp (int val)
+{ return MAX (0, MIN (255, val)); }
+static GdkPixbuf *pixbuf_color_shift (const GdkPixbuf *src, int shift)
+{
+ if (!src)
+ return NULL;
+
+ int width = gdk_pixbuf_get_width (src), height = gdk_pixbuf_get_height (src);
+ gboolean has_alpha = gdk_pixbuf_get_has_alpha (src);
+
+ GdkPixbuf *dest = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
+ has_alpha, gdk_pixbuf_get_bits_per_sample (src), width, height);
+
+ guchar *src_pixels_orig = gdk_pixbuf_get_pixels (src);
+ guchar *dest_pixels_orig = gdk_pixbuf_get_pixels (dest);
+
+ int src_rowstride = gdk_pixbuf_get_rowstride (src);
+ int dest_rowstride = gdk_pixbuf_get_rowstride (dest);
+ int i, j;
+ for (i = 0; i < height; i++) {
+ guchar *src_pixels = src_pixels_orig + (i * src_rowstride);
+ guchar *dest_pixels = dest_pixels_orig + (i * dest_rowstride);
+ for (j = 0; j < width; j++) {
+ *(dest_pixels++) = pixel_clamp (*(src_pixels++) + shift);
+ *(dest_pixels++) = pixel_clamp (*(src_pixels++) + shift);
+ *(dest_pixels++) = pixel_clamp (*(src_pixels++) + shift);
+ if (has_alpha)
+ *(dest_pixels++) = *(src_pixels++);
+ }
+ }
+ return dest;
+}
+
+static void ygtk_find_entry_set_borders (YGtkFindEntry *entry)
+{
+ YGtkExtEntry *eentry = YGTK_EXT_ENTRY (entry);
+ int left_border = 0, right_border = 0;
+ if (entry->find_icon) {
+ left_border = gdk_pixbuf_get_width (entry->find_icon) + 2;
+ if (entry->context_menu)
+ left_border += ARROW_SIZE - 1;
+ }
+ if (entry->clear_icon)
+ right_border = gdk_pixbuf_get_width (entry->clear_icon) + 2;
+
+ ygtk_ext_entry_set_border_window_size (eentry,
+ YGTK_EXT_ENTRY_LEFT_WIN, left_border);
+ ygtk_ext_entry_set_border_window_size (eentry,
+ YGTK_EXT_ENTRY_RIGHT_WIN, right_border);
+ gtk_widget_queue_resize (GTK_WIDGET (entry));
+}
+
+static void ygtk_find_entry_realize (GtkWidget *widget)
+{
+ GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->realize (widget);
+
+ YGtkExtEntry *eentry = YGTK_EXT_ENTRY (widget);
+ YGtkFindEntry *fentry = YGTK_FIND_ENTRY (widget);
+ fentry->find_icon = gtk_widget_render_icon (widget, GTK_STOCK_FIND,
+ GTK_ICON_SIZE_MENU, NULL);
+ fentry->clear_icon = gtk_widget_render_icon (widget, GTK_STOCK_CLEAR,
+ GTK_ICON_SIZE_MENU, NULL);
+
+ fentry->find_hover_icon = pixbuf_color_shift (fentry->find_icon, 30);
+ fentry->clear_hover_icon = pixbuf_color_shift (fentry->clear_icon, 30);
+
+ ygtk_find_entry_set_borders (fentry);
+
+ GdkDisplay *display = gtk_widget_get_display (widget);
+ GdkCursor *cursor = gdk_cursor_new_for_display (display, GDK_HAND1);
+
+ gdk_window_set_cursor (eentry->left_window, cursor);
+ gdk_window_set_cursor (eentry->right_window, cursor);
+ gdk_cursor_unref (cursor);
+}
+
+static void ygtk_find_entry_map (GtkWidget *widget)
+{
+ if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget)) {
+ GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->map (widget);
+ // only show clear icon when the entry has text
+ GdkWindow *clear_win = YGTK_EXT_ENTRY (widget)->right_window;
+ if (clear_win)
+ gdk_window_hide (clear_win);
+ }
+}
+
+static gboolean ygtk_find_entry_expose (GtkWidget *widget, GdkEventExpose *event)
+{
+ YGtkExtEntry *eentry = YGTK_EXT_ENTRY (widget);
+ YGtkFindEntry *fentry = YGTK_FIND_ENTRY (widget);
+
+ GdkWindow *hover_window = gdk_display_get_window_at_pointer (
+ gtk_widget_get_display (widget), NULL, NULL);
+
+ if (event->window == eentry->left_window ||
+ event->window == eentry->right_window) {
+ gboolean hover = hover_window == event->window;
+ GdkPixbuf *pixbuf;
+ if (event->window == eentry->left_window)
+ pixbuf = hover ? fentry->find_hover_icon : fentry->find_icon;
+ else
+ pixbuf = hover ? fentry->clear_hover_icon : fentry->clear_icon;
+
+ int pix_height = gdk_pixbuf_get_height (pixbuf), win_width, win_height, y;
+ gdk_drawable_get_size (event->window, &win_width, &win_height);
+ y = (win_height - pix_height) / 2;
+
+ gdk_draw_pixbuf (event->window, widget->style->fg_gc[0], pixbuf,
+ 0, 0, 1, y, -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
+
+ if (fentry->context_menu && event->window == eentry->left_window)
+ gtk_paint_arrow (widget->style, event->window, GTK_STATE_NORMAL,
+ GTK_SHADOW_NONE, &event->area, widget, NULL,
+ GTK_ARROW_DOWN, FALSE,
+ win_width - ARROW_SIZE - 1, win_height - ARROW_SIZE,
+ ARROW_SIZE, ARROW_SIZE);
+ }
+ else
+ GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->expose_event (widget, event);
+ return TRUE;
+}
+
+/* Re-draw find/clear windows on mouse hover. */
+static gboolean ygtk_find_entry_enter_leave_notify_event (GtkWidget *widget,
+ GdkEventCrossing *event)
+{
+ if (widget == gtk_get_event_widget ((GdkEvent*) event)) {
+ YGtkExtEntry *eentry = YGTK_EXT_ENTRY (widget);
+ if (event->window == eentry->left_window ||
+ event->window == eentry->right_window)
+ gdk_window_invalidate_rect (event->window, NULL, FALSE);
+ }
+ return FALSE;
+}
+
+static void ygtk_find_entry_actual_popup_menu (GtkWidget *widget, guint button,
+ guint32 time)
+{
+ GtkMenu *menu = YGTK_FIND_ENTRY (widget)->context_menu;
+ gtk_menu_popup (menu, NULL, NULL, NULL, NULL, button, time);
+}
+
+static gboolean ygtk_find_entry_popup_menu (GtkWidget *widget)
+{
+ if (YGTK_FIND_ENTRY (widget)->context_menu) {
+ ygtk_find_entry_actual_popup_menu (widget, 0, gtk_get_current_event_time());
+ return TRUE;
+ }
+ return GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->popup_menu (widget);
+}
+
+static gboolean ygtk_find_entry_button_press_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ YGtkFindEntry *fentry = YGTK_FIND_ENTRY (widget);
+ YGtkExtEntry *eentry = YGTK_EXT_ENTRY (widget);
+ if (event->window == eentry->left_window) {
+ // If the entry has an associated context menu, use it.
+ // Otherwise, find icon selects entry's text.
+ gtk_widget_grab_focus (widget);
+ if (fentry->context_menu)
+ ygtk_find_entry_actual_popup_menu (widget, event->button, event->time);
+ else
+ gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
+ }
+ else if (event->window == eentry->right_window) {
+ gtk_editable_delete_text (GTK_EDITABLE (widget), 0, -1);
+ gtk_widget_grab_focus (widget);
+ }
+ else
+ return GTK_WIDGET_CLASS (ygtk_find_entry_parent_class)->button_press_event
+ (widget, event);
+ return TRUE;
+}
+
+static void ygtk_find_entry_insert_text (GtkEditable *editable,
+ const gchar *new_text, gint new_text_len, gint *pos)
+{
+ GtkEditableClass *parent_editable_iface = g_type_interface_peek
+ (ygtk_find_entry_parent_class, GTK_TYPE_EDITABLE);
+ parent_editable_iface->insert_text (editable, new_text, new_text_len, pos);
+
+ GdkWindow *clear_win = YGTK_EXT_ENTRY (editable)->right_window;
+ if (clear_win)
+ gdk_window_show (clear_win);
+}
+
+static void ygtk_find_entry_delete_text (GtkEditable *editable, gint start_pos,
+ gint end_pos)
+{
+ GtkEditableClass *parent_editable_iface = g_type_interface_peek
+ (ygtk_find_entry_parent_class, GTK_TYPE_EDITABLE);
+ parent_editable_iface->delete_text (editable, start_pos, end_pos);
+
+ int has_text = strlen (gtk_entry_get_text (GTK_ENTRY (editable)));
+ if (!has_text) {
+ /* Set or delete text may be called while the widget has not yet been
+ realized. */
+ GdkWindow *clear_win = YGTK_EXT_ENTRY (editable)->right_window;
+ if (clear_win)
+ gdk_window_hide (clear_win);
+ }
+}
+
+void ygtk_find_entry_attach_menu (YGtkFindEntry *entry, GtkMenu *menu)
+{
+ if (entry->context_menu)
+ gtk_menu_detach (entry->context_menu);
+ entry->context_menu = menu;
+ if (menu)
+ gtk_menu_attach_to_widget (menu, GTK_WIDGET (entry), NULL);
+ ygtk_find_entry_set_borders (entry);
+}
+
+GtkWidget *ygtk_find_entry_new (void /*gboolean will_use_find_icon */)
+{
+ return g_object_new (YGTK_TYPE_FIND_ENTRY, NULL);
+}
+
+static void ygtk_find_entry_class_init (YGtkFindEntryClass *klass)
+{
+ GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
+ gtkwidget_class->realize = ygtk_find_entry_realize;
+ gtkwidget_class->map = ygtk_find_entry_map;
+ gtkwidget_class->expose_event = ygtk_find_entry_expose;
+ gtkwidget_class->enter_notify_event = ygtk_find_entry_enter_leave_notify_event;
+ gtkwidget_class->leave_notify_event = ygtk_find_entry_enter_leave_notify_event;
+ gtkwidget_class->button_press_event = ygtk_find_entry_button_press_event;
+ gtkwidget_class->popup_menu = ygtk_find_entry_popup_menu;
+
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_find_entry_destroy;
+}
+
+static void ygtk_find_entry_editable_init (GtkEditableClass *iface)
+{
+ iface->insert_text = ygtk_find_entry_insert_text;
+ iface->delete_text = ygtk_find_entry_delete_text;
+}
Added: trunk/gtk/10_3/src/ygtkfindentry.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkfindentry.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkfindentry.h (added)
+++ trunk/gtk/10_3/src/ygtkfindentry.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,99 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkExtEntry extends GtkEntry adding two optional GdkWindows, at each
+ horizontal corner, which are created at demand. Very useful to create
+ a panel, an icon or something inside of it.
+ GtkTextView provides something similar and would be nice to have this
+ right on GtkEntry; in fact, GtkSpinButton could be simplified if it
+ were for this.
+ Right-to-left is supported at this level (borders are mirrored, if it
+ is set). If you don't want that, use gtk_widget_set_direction().
+
+ YGtkFindEntry is a convinience widget that has a find icon, with an
+ optional menu, at the left, and an erase icon at the right.
+*/
+
+#ifndef YGTK_FIND_ENTRY_H
+#define YGTK_FIND_ENTRY_H
+
+#include
+G_BEGIN_DECLS
+
+//** YGtkExtEntry
+
+#define YGTK_TYPE_EXT_ENTRY (ygtk_ext_entry_get_type ())
+#define YGTK_EXT_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_EXT_ENTRY, YGtkExtEntry))
+#define YGTK_EXT_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_EXT_ENTRY, YGtkExtEntryClass))
+#define YGTK_IS_EXT_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_EXT_ENTRY))
+#define YGTK_IS_EXT_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_EXT_ENTRY))
+#define YGTK_EXT_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_EXT_ENTRY, YGtkExtEntryClass))
+
+typedef struct _YGtkExtEntry
+{
+ GtkEntry parent;
+ // members:
+ GdkWindow *left_window, *right_window;
+} YGtkExtEntry;
+
+typedef struct _YGtkExtEntryClass
+{
+ GtkEntryClass parent_class;
+} YGtkExtEntryClass;
+
+GtkWidget* ygtk_ext_entry_new (void);
+GType ygtk_ext_entry_get_type (void) G_GNUC_CONST;
+
+// API based on that of GtkTextView -- limited to our needs
+typedef enum
+{ YGTK_EXT_ENTRY_WIDGET_WIN, YGTK_EXT_ENTRY_TEXT_WIN,
+ YGTK_EXT_ENTRY_LEFT_WIN, YGTK_EXT_ENTRY_RIGHT_WIN
+} YGtkExtEntryWindowType;
+
+GdkWindow *ygtk_ext_entry_get_window (YGtkExtEntry *entry,
+ YGtkExtEntryWindowType type);
+void ygtk_ext_entry_set_border_window_size (YGtkExtEntry *entry,
+ YGtkExtEntryWindowType type, gint size);
+gint ygtk_ext_entry_get_border_window_size (YGtkExtEntry *entry,
+ YGtkExtEntryWindowType type);
+
+//** YGtkFindEntry
+
+#define YGTK_TYPE_FIND_ENTRY (ygtk_find_entry_get_type ())
+#define YGTK_FIND_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_FIND_ENTRY, YGtkFindEntry))
+#define YGTK_FIND_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_FIND_ENTRY, YGtkFindEntryClass))
+#define YGTK_IS_FIND_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_FIND_ENTRY))
+#define YGTK_IS_FIND_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_FIND_ENTRY))
+#define YGTK_FIND_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_FIND_ENTRY, YGtkFindEntryClass))
+
+typedef struct _YGtkFindEntry
+{
+ YGtkExtEntry parent;
+ // members
+ GdkPixbuf *find_icon, *clear_icon, *find_hover_icon, *clear_hover_icon;
+ GtkMenu *context_menu;
+} YGtkFindEntry;
+
+typedef struct _YGtkFindEntryClass
+{
+ YGtkExtEntryClass parent_class;
+} YGtkFindEntryClass;
+
+GtkWidget* ygtk_find_entry_new (void);
+GType ygtk_find_entry_get_type (void) G_GNUC_CONST;
+
+void ygtk_find_entry_attach_menu (YGtkFindEntry *entry, GtkMenu *popup_menu);
+
+G_END_DECLS
+#endif /*YGTK_FIND_ENTRY_H*/
Added: trunk/gtk/10_3/src/ygtkhtmlwrap.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkhtmlwrap.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkhtmlwrap.c (added)
+++ trunk/gtk/10_3/src/ygtkhtmlwrap.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,170 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkHtmlWrap widget */
+// check the header file for information about this widget
+
+#include
+#include
+#include
+#include "ygtkhtmlwrap.h"
+
+GtkWidget *ygtk_html_wrap_new (void)
+{
+ return g_object_new (ygtk_html_wrap_get_type(), NULL);
+}
+
+
+// Utilities
+static inline void adjust_scroll (GtkAdjustment *vadj, gboolean top)
+{
+ g_assert (vadj != 0);
+ if (top)
+ gtk_adjustment_set_value (vadj, vadj->lower);
+ else /* bottom */
+ gtk_adjustment_set_value (vadj, vadj->upper - vadj->page_size);
+}
+
+static void gdkwindow_set_background (GdkWindow *window, const char *image)
+{
+ if (image) {
+ GError *error = 0;
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (image, &error);
+ if (!pixbuf) {
+ g_warning ("ygtkrichtext: could not open background image: '%s'"
+ " - %s", image, error->message);
+ return;
+ }
+
+ GdkPixmap *pixmap;
+ gdk_pixbuf_render_pixmap_and_mask_for_colormap (pixbuf,
+ gdk_drawable_get_colormap (GDK_DRAWABLE (window)), &pixmap, NULL, 0);
+ g_object_unref (G_OBJECT (pixbuf));
+
+ gdk_window_set_back_pixmap (window, pixmap, FALSE);
+ }
+ else
+ gdk_window_clear (window);
+}
+
+// GtkHTML
+#ifdef USE_GTKHTML
+#include
+#include
+#include
+
+GType ygtk_html_wrap_get_type (void)
+{
+ return GTK_TYPE_HTML;
+}
+
+static void gtkhtml_url_requested_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *stream)
+{ // to load images (and possibly other external embed files)
+ FILE *file = fopen (url, "rb");
+
+ fseek (file, 0, SEEK_END);
+ size_t file_size = ftell (file);
+ rewind (file);
+
+ gboolean error;
+ gchar *data = g_new (gchar, file_size);
+ error = fread (data, 1, file_size, file) < file_size;
+ fclose (file);
+
+ if (!error)
+ gtk_html_stream_write (stream, data, file_size);
+ g_free (data);
+}
+
+void ygtk_html_wrap_init (GtkWidget *widget)
+{
+ gtk_html_set_editable (GTK_HTML (widget), FALSE);
+ g_signal_connect (G_OBJECT (widget), "url-requested",
+ G_CALLBACK (gtkhtml_url_requested_cb), NULL);
+}
+
+void ygtk_html_wrap_set_text (GtkWidget *widget, const gchar* text)
+{
+ GtkHTMLStream *stream = gtk_html_begin (GTK_HTML (widget));
+ gtk_html_write (GTK_HTML (widget), stream, text, strlen (text));
+ gtk_html_end (GTK_HTML (widget), stream, GTK_HTML_STREAM_OK);
+}
+
+void ygtk_html_wrap_scroll (GtkWidget *widget, gboolean top)
+{
+ adjust_scroll (GTK_LAYOUT (widget)->vadjustment, top);
+}
+
+gboolean ygtk_html_wrap_search (GtkWidget *widget, const gchar *text)
+{
+/* if (*text == '\0')
+ return TRUE;*/
+ return gtk_html_engine_search (GTK_HTML (widget), text, FALSE, TRUE, FALSE);
+}
+
+gboolean ygtk_html_wrap_search_next (GtkWidget *widget, const gchar *text)
+{
+ return gtk_html_engine_search_next (GTK_HTML (widget));
+}
+
+void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, GCallback callback, gpointer data)
+{
+ g_signal_connect (G_OBJECT (widget), "link-clicked", callback, data);
+}
+
+void ygtk_html_wrap_set_background (GtkWidget *widget, const char *image)
+{
+ // TODO
+}
+
+// YGtkRichText
+#else
+#include "ygtkrichtext.h"
+
+GType ygtk_html_wrap_get_type()
+{
+ return YGTK_TYPE_RICH_TEXT;
+}
+
+void ygtk_html_wrap_init (GtkWidget *widget)
+{
+}
+
+void ygtk_html_wrap_set_text (GtkWidget *widget, const gchar* text)
+{
+ ygtk_rich_text_set_text (YGTK_RICH_TEXT (widget), text, TRUE);
+}
+
+void ygtk_html_wrap_scroll (GtkWidget *widget, gboolean top)
+{
+ adjust_scroll (GTK_TEXT_VIEW (widget)->vadjustment, top);
+}
+
+gboolean ygtk_html_wrap_search (GtkWidget *widget, const gchar *text)
+{
+ gboolean ret = ygtk_rich_text_mark_text (YGTK_RICH_TEXT (widget), text);
+ ygtk_rich_text_forward_mark (YGTK_RICH_TEXT (widget), text);
+ return ret;
+}
+
+gboolean ygtk_html_wrap_search_next (GtkWidget *widget, const gchar *text)
+{
+ return ygtk_rich_text_forward_mark (YGTK_RICH_TEXT (widget), text);
+}
+
+void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, GCallback callback, gpointer data)
+{
+ g_signal_connect (G_OBJECT (widget), "link-clicked", callback, data);
+}
+
+void ygtk_html_wrap_set_background (GtkWidget *widget, const char *image)
+{
+ g_return_if_fail (GTK_WIDGET_REALIZED (widget));
+ GdkWindow *window = gtk_text_view_get_window
+ (GTK_TEXT_VIEW (widget), GTK_TEXT_WINDOW_TEXT);
+ gdkwindow_set_background (window, image);
+}
+
+#endif
+
Added: trunk/gtk/10_3/src/ygtkhtmlwrap.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkhtmlwrap.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkhtmlwrap.h (added)
+++ trunk/gtk/10_3/src/ygtkhtmlwrap.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,37 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkHtmlWrap is a wrapper around either GtkHtml and YGtkRichText, as
+ set at compilation time. GtkHtml is superior, but to avoid dependencies,
+ we use our customized in case it isn't installed.
+ If you flag it as plain_text, it will simply wrap GtkTextView.
+*/
+
+#ifndef YGTK_HTML_WRAP_H
+#define YGTK_HTML_WRAP_H
+
+#include
+G_BEGIN_DECLS
+
+GtkWidget *ygtk_html_wrap_new (void);
+
+GType ygtk_html_wrap_get_type (void);
+void ygtk_html_wrap_init (GtkWidget *widget); // if you use g_object_new(), call this
+
+void ygtk_html_wrap_set_text (GtkWidget *widget, const gchar* text);
+void ygtk_html_wrap_scroll (GtkWidget *widget, gboolean top /* or bottom */);
+
+// callback of type: void (GtkWidget *htmlwrap, const gchar *url, gpointer data)
+void ygtk_html_wrap_connect_link_clicked (GtkWidget *widget, GCallback callback, gpointer data);
+
+// not supported on plain text
+gboolean ygtk_html_wrap_search (GtkWidget *widget, const gchar *text);
+gboolean ygtk_html_wrap_search_next (GtkWidget *widget, const gchar *text); // F3
+
+// set a background image -- to be done on (or after) realize
+void ygtk_html_wrap_set_background (GtkWidget *widget, const char *image);
+
+G_END_DECLS
+#endif /* YGTK_HTML_WRAP_H */
+
Added: trunk/gtk/10_3/src/ygtkimage.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkimage.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkimage.c (added)
+++ trunk/gtk/10_3/src/ygtkimage.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,285 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkImage widget */
+// check the header file for information about this widget
+
+#include
+#include "ygdkmngloader.h"
+#include "ygtkimage.h"
+#include
+
+G_DEFINE_TYPE (YGtkImage, ygtk_image, GTK_TYPE_DRAWING_AREA)
+
+static void ygtk_image_init (YGtkImage *image)
+{
+}
+
+static void ygtk_image_free_pixbuf (YGtkImage *image)
+{
+ if (image->animated) {
+ if (image->animation) {
+ g_object_unref (G_OBJECT (image->animation->pixbuf));
+ if (image->animation->timeout_id)
+ g_source_remove (image->animation->timeout_id);
+ g_free (image->animation);
+ image->animation = NULL;
+ }
+ }
+ else {
+ if (image->pixbuf) {
+ g_object_unref (G_OBJECT (image->pixbuf));
+ image->pixbuf = NULL;
+ }
+ }
+}
+
+static void ygtk_image_destroy (GtkObject *object)
+{
+ YGtkImage *image = YGTK_IMAGE (object);
+ if (image->alt_text)
+ g_free (image->alt_text);
+ image->alt_text = NULL;
+ ygtk_image_free_pixbuf (image);
+ GTK_OBJECT_CLASS (ygtk_image_parent_class)->destroy (object);
+}
+
+static void ygtk_image_set_pixbuf (YGtkImage *image, GdkPixbuf *pixbuf, const char *error_msg)
+{
+ ygtk_image_free_pixbuf (image);
+ gtk_widget_queue_resize (GTK_WIDGET (image));
+
+ if (pixbuf) {
+ image->animated = FALSE;
+ image->pixbuf = pixbuf;
+ image->loaded = TRUE;
+ }
+/* else
+ g_warning ("Couldn't load image - %s", error_msg);*/
+}
+
+static gboolean ygtk_image_advance_frame_cb (gpointer data)
+{
+ YGtkImage *image = (YGtkImage *) data;
+ struct _YGtkImageAnimation *animation = image->animation;
+
+ if (!animation->frame) // no frame yet loaded
+ animation->frame = gdk_pixbuf_animation_get_iter (animation->pixbuf, NULL);
+ else
+ if (gdk_pixbuf_animation_iter_advance (animation->frame, NULL))
+ gtk_widget_queue_draw (GTK_WIDGET (image));
+
+ // shedule next frame
+ int delay = gdk_pixbuf_animation_iter_get_delay_time (animation->frame);
+ if (delay != -1)
+ animation->timeout_id = g_timeout_add (delay, ygtk_image_advance_frame_cb, data);
+ return FALSE;
+}
+
+static void ygtk_image_set_animation (YGtkImage *image, GdkPixbufAnimation *pixbuf,
+ const char *error_msg)
+{
+ ygtk_image_free_pixbuf (image);
+ gtk_widget_queue_resize (GTK_WIDGET (image));
+
+ if (pixbuf) {
+ image->animated = TRUE;
+ image->animation = g_new0 (struct _YGtkImageAnimation, 1);
+ image->animation->pixbuf = pixbuf;
+ image->loaded = TRUE;
+ ygtk_image_advance_frame_cb (image);
+ }
+/* else
+ g_warning ("Couldn't load image - %s", error_msg);*/
+}
+
+void ygtk_image_set_from_file (YGtkImage *image, const char *filename, gboolean anim)
+{
+ GError *error = 0;
+ if (anim) {
+ GdkPixbufAnimation *pixbuf;
+ if (ygdk_mng_pixbuf_is_file_mng (filename))
+ pixbuf = ygdk_mng_pixbuf_new_from_file (filename, &error);
+ else
+ pixbuf = gdk_pixbuf_animation_new_from_file (filename, &error);
+ ygtk_image_set_animation (image, pixbuf, error ? error->message : "(undefined)");
+ }
+ else {
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, &error);
+ ygtk_image_set_pixbuf (image, pixbuf, error ? error->message : "(undefined)");
+ }
+}
+
+static void ygtk_image_loaded_cb (GdkPixbufLoader *loader, YGtkImage *image)
+{
+ if (image->animated) {
+ if (image->animation) {
+ // a new frame loaded -- just redraw the widget
+ if (gdk_pixbuf_animation_iter_on_currently_loading_frame
+ (image->animation->frame))
+ gtk_widget_queue_draw (GTK_WIDGET (image));
+ }
+ else {
+ GdkPixbufAnimation *pixbuf = gdk_pixbuf_loader_get_animation (loader);
+ g_object_ref (G_OBJECT (pixbuf));
+ ygtk_image_set_animation (image, pixbuf, "on block data reading callback");
+ }
+ }
+ else {
+ GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+ g_object_ref (G_OBJECT (pixbuf));
+ ygtk_image_set_pixbuf (image, pixbuf, "on block data reading callback");
+ }
+}
+
+void ygtk_image_set_from_data (YGtkImage *image, const guint8 *data, long data_size, gboolean anim)
+{
+ GError *error = 0;
+ if (anim && ygdk_mng_pixbuf_is_data_mng (data, data_size)) {
+ GdkPixbufAnimation *pixbuf;
+ pixbuf = ygdk_mng_pixbuf_new_from_data (data, data_size, &error);
+ ygtk_image_set_animation (image, pixbuf, error ? error->message : "(undefined)");
+ }
+ else {
+ image->animated = anim;
+ GdkPixbufLoader *loader = gdk_pixbuf_loader_new();
+ g_signal_connect (G_OBJECT (loader), "area-prepared",
+ G_CALLBACK (ygtk_image_loaded_cb), image);
+ if (!gdk_pixbuf_loader_write (loader, data, data_size, &error))
+ g_warning ("Could not load image from data blocks: %s", error->message);
+ gdk_pixbuf_loader_close (loader, &error);
+ }
+}
+
+void ygtk_image_set_props (YGtkImage *image, YGtkImageAlign align, const gchar *alt_text)
+{
+ image->align = align;
+ if (image->alt_text)
+ g_free (image->alt_text);
+ image->alt_text = g_strdup (alt_text);
+ gtk_widget_queue_draw (GTK_WIDGET (image));
+}
+
+static void ygtk_image_size_request (GtkWidget *widget, GtkRequisition *requisition)
+{
+ YGtkImage *image = YGTK_IMAGE (widget);
+ int width = 0, height = 0;
+ if (image->loaded) {
+ if (image->animated) {
+ width = gdk_pixbuf_animation_get_width (image->animation->pixbuf);
+ height = gdk_pixbuf_animation_get_height (image->animation->pixbuf);
+ }
+ else {
+ width = gdk_pixbuf_get_width (image->pixbuf);
+ height = gdk_pixbuf_get_height (image->pixbuf);
+ }
+ }
+ else if (image->alt_text) {
+ PangoLayout *layout;
+ layout = gtk_widget_create_pango_layout (widget, image->alt_text);
+ pango_layout_get_pixel_size (layout, &width, &height);
+ }
+ requisition->width = width;
+ requisition->height = height;
+}
+
+static GdkPixbuf *ygtk_image_render_state (GtkWidget *widget, GdkPixbuf *pixbuf)
+{
+ // as in GtkImage
+ GtkIconSource *source = gtk_icon_source_new();
+ GdkPixbuf *rendered;
+ gtk_icon_source_set_pixbuf (source, pixbuf);
+ gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR);
+ gtk_icon_source_set_size_wildcarded (source, FALSE);
+ rendered = gtk_style_render_icon (widget->style, source,
+ gtk_widget_get_direction (widget), GTK_WIDGET_STATE (widget),
+ /* arbitrary */ (GtkIconSize)-1, widget, "gtk-image");
+ gtk_icon_source_free (source);
+ return rendered;
+}
+
+static gboolean ygtk_image_expose_event (GtkWidget *widget, GdkEventExpose *event)
+{
+ YGtkImage *image = YGTK_IMAGE (widget);
+ int width, height;
+ width = widget->allocation.width;
+ height = widget->allocation.height;
+
+ cairo_t *cr = gdk_cairo_create (widget->window);
+
+ if (!image->loaded && image->alt_text) {
+ // show alt text if no image was loaded
+ PangoLayout *layout;
+ layout = gtk_widget_create_pango_layout (widget, image->alt_text);
+
+ int x, y;
+ x = (width - widget->requisition.width) / 2;
+ y = (height - widget->requisition.height) / 2;
+
+ cairo_move_to (cr, x, y);
+ pango_cairo_show_layout (cr, layout);
+
+ g_object_unref (layout);
+ cairo_destroy (cr);
+ return TRUE;
+ }
+
+ GdkPixbuf *pixbuf;
+ if (image->animated)
+ pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (image->animation->frame);
+ else
+ pixbuf = image->pixbuf;
+
+ gboolean needs_transform = GTK_WIDGET_STATE (widget) != GTK_STATE_NORMAL;
+ if (needs_transform)
+ pixbuf = ygtk_image_render_state (widget, pixbuf);
+ int x = 0, y = 0;
+ if (image->align == CENTER_IMAGE_ALIGN) {
+ x = (width - widget->requisition.width) / 2;
+ y = (height - widget->requisition.height) / 2;
+ }
+
+ gdk_cairo_set_source_pixbuf (cr, pixbuf, x, y);
+
+ switch (image->align) {
+ case CENTER_IMAGE_ALIGN:
+ break;
+ case SCALE_IMAGE_ALIGN:
+ {
+ double scale_x = (double) gdk_pixbuf_get_width (pixbuf) / width;
+ double scale_y = (double) gdk_pixbuf_get_height (pixbuf) / height;
+ cairo_matrix_t matrix;
+ cairo_matrix_init_scale (&matrix, scale_x, scale_y);
+ cairo_pattern_set_matrix (cairo_get_source (cr), &matrix);
+ break;
+ }
+ case TILE_IMAGE_ALIGN:
+ cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
+ break;
+ }
+
+ cairo_rectangle (cr, x, y, width, height);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
+ if (needs_transform)
+ g_object_unref (G_OBJECT (pixbuf));
+ return FALSE;
+}
+
+GtkWidget* ygtk_image_new (void)
+{
+ return g_object_new (YGTK_TYPE_IMAGE, NULL);
+}
+
+static void ygtk_image_class_init (YGtkImageClass *klass)
+{
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->expose_event = ygtk_image_expose_event;
+ widget_class->size_request = ygtk_image_size_request;
+
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_image_destroy;
+}
+
Added: trunk/gtk/10_3/src/ygtkimage.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkimage.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkimage.h (added)
+++ trunk/gtk/10_3/src/ygtkimage.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,75 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* GtkImage doesn't provide all the functionality asked by libyui,
+ such as scaling and tiling. Thus, YGtkImage is a more powerful
+ GtkImage.
+*/
+
+#ifndef YGTK_IMAGE_H
+#define YGTK_IMAGE_H
+
+#include
+#include
+
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_IMAGE (ygtk_image_get_type ())
+#define YGTK_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_IMAGE, YGtkImage))
+#define YGTK_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_IMAGE, YGtkImageClass))
+#define YGTK_IS_IMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_IMAGE))
+#define YGTK_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_IMAGE))
+#define YGTK_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_IMAGE, YGtkImageClass))
+
+typedef enum {
+ CENTER_IMAGE_ALIGN, SCALE_IMAGE_ALIGN, TILE_IMAGE_ALIGN
+} YGtkImageAlign;
+
+struct _YGtkImageAnimation {
+ GdkPixbufAnimation *pixbuf;
+ GdkPixbufAnimationIter *frame;
+ guint timeout_id;
+};
+
+typedef struct _YGtkImage
+{
+ GtkDrawingArea parent;
+
+ // properties:
+ YGtkImageAlign align;
+
+ gboolean animated;
+ union {
+ GdkPixbuf *pixbuf;
+ struct _YGtkImageAnimation *animation;
+ };
+
+ gboolean loaded;
+ gchar *alt_text;
+
+} YGtkImage;
+
+typedef struct _YGtkImageClass
+{
+ GtkDrawingAreaClass parent_class;
+} YGtkImageClass;
+
+GtkWidget* ygtk_image_new (void);
+GType ygtk_image_get_type (void) G_GNUC_CONST;
+
+void ygtk_image_set_from_file (YGtkImage *image, const char *filename, gboolean anim);
+void ygtk_image_set_from_data (YGtkImage *image, const guint8 *data, long size, gboolean anim);
+void ygtk_image_set_props (YGtkImage *image, YGtkImageAlign align, const gchar *alt_text);
+
+// as we don't have a window,
+
+G_END_DECLS
+
+#endif /* YGTK_IMAGE_H */
+
Added: trunk/gtk/10_3/src/ygtkmenubutton.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkmenubutton.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkmenubutton.c (added)
+++ trunk/gtk/10_3/src/ygtkmenubutton.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,247 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkMenuButton widget */
+// check the header file for information about this widget
+
+#include
+#include "ygtkmenubutton.h"
+#include
+#include
+
+//** YGtkPopupWindow
+
+G_DEFINE_TYPE (YGtkPopupWindow, ygtk_popup_window, GTK_TYPE_WINDOW)
+
+static void ygtk_popup_window_init (YGtkPopupWindow *popup)
+{
+ GtkWindow *window = GTK_WINDOW (popup);
+ gtk_window_set_resizable (window, FALSE);
+
+ GtkWidget *frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
+ gtk_widget_show (frame);
+ gtk_container_add (GTK_CONTAINER (window), frame);
+}
+
+static void ygtk_popup_window_hide (GtkWidget *widget)
+{
+ gtk_grab_remove (widget);
+ GTK_WIDGET_CLASS (ygtk_popup_window_parent_class)->hide (widget);
+}
+
+static gboolean ygtk_popup_window_key_press_event (GtkWidget *widget, GdkEventKey *event)
+{
+ if (event->keyval == GDK_Escape) {
+ gtk_widget_hide (widget);
+ return TRUE;
+ }
+ return GTK_WIDGET_CLASS (ygtk_popup_window_parent_class)->key_press_event
+ (widget, event);
+}
+
+static gboolean ygtk_popup_window_button_press_event (GtkWidget *widget,
+ GdkEventButton *event)
+{
+ // NOTE: You can't rely on events x and y since the event may take place
+ // outside of the window.
+ // So, we'll check if this widget (or any of its kids) got the event
+ // If that's not the case, close the menu
+
+ GtkWidget *child = gtk_get_event_widget ((GdkEvent *) event);
+ if (child != widget)
+ while (child) {
+ if (child == widget)
+ return FALSE;
+ child = child->parent;
+ }
+ gtk_widget_hide (widget);
+ return TRUE;
+}
+
+GtkWidget *ygtk_popup_window_new (GtkWidget *child)
+{
+ GtkWidget *widget = g_object_new (YGTK_TYPE_POPUP_WINDOW,
+ "type", GTK_WINDOW_POPUP, NULL);
+ GtkWidget *frame = gtk_bin_get_child (GTK_BIN (widget));
+ gtk_container_add (GTK_CONTAINER (frame), child);
+ return widget;
+}
+
+void ygtk_popup_window_popup (GtkWidget *widget, gint x, gint y, guint activate_time)
+{
+ gtk_grab_add (widget);
+ gtk_window_move (GTK_WINDOW (widget), x, y);
+ gtk_widget_grab_focus (widget);
+ gtk_widget_show (widget);
+
+ // grab this with your teeth
+ if (gdk_pointer_grab (widget->window, TRUE,
+ GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
+ NULL, NULL, activate_time) == 0)
+ if (gdk_keyboard_grab (widget->window, TRUE, activate_time) != 0)
+ gdk_pointer_ungrab(activate_time);
+}
+
+static void ygtk_popup_window_class_init (YGtkPopupWindowClass *klass)
+{
+ ygtk_popup_window_parent_class = g_type_class_peek_parent (klass);
+
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->key_press_event = ygtk_popup_window_key_press_event;
+ widget_class->button_press_event = ygtk_popup_window_button_press_event;
+ widget_class->hide = ygtk_popup_window_hide;
+}
+
+//** YGtkMenuButton
+
+G_DEFINE_TYPE (YGtkMenuButton, ygtk_menu_button, GTK_TYPE_TOGGLE_BUTTON)
+
+static void ygtk_menu_button_init (YGtkMenuButton *button)
+{
+ button->popup = NULL;
+ button->label = gtk_label_new ("");
+
+ GtkWidget *hbox, *arrow;
+ hbox = gtk_hbox_new (FALSE, 0);
+ arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
+
+ if (gtk_widget_get_direction (arrow) == GTK_TEXT_DIR_LTR) {
+ gtk_container_add (GTK_CONTAINER (hbox), button->label);
+ gtk_container_add (GTK_CONTAINER (hbox), arrow);
+ }
+ else {
+ gtk_container_add (GTK_CONTAINER (hbox), arrow);
+ gtk_container_add (GTK_CONTAINER (hbox), button->label);
+ }
+
+ gtk_box_set_child_packing (GTK_BOX (hbox), arrow, FALSE, FALSE,
+ 5, GTK_PACK_START);
+
+ gtk_widget_show_all (hbox);
+ gtk_container_add (GTK_CONTAINER (button), hbox);
+}
+
+static void ygtk_menu_button_free_popup (YGtkMenuButton *button)
+{
+ if (button->popup) {
+ gtk_widget_destroy (GTK_WIDGET (button->popup));
+ g_object_unref (G_OBJECT (button->popup));
+ button->popup = NULL;
+ }
+}
+
+static void ygtk_menu_button_finalize (GObject *object)
+{
+ ygtk_menu_button_free_popup (YGTK_MENU_BUTTON (object));
+ G_OBJECT_CLASS (ygtk_menu_button_parent_class)->finalize (object);
+}
+
+static void ygtk_menu_button_get_menu_pos (GtkMenu *menu, gint *x, gint *y,
+ gboolean *push_in, gpointer pointer)
+{
+ GtkWidget *widget = (GtkWidget*) pointer;
+ gdk_window_get_origin (widget->window, x, y);
+ *x += widget->allocation.x;
+ *y += widget->allocation.y + widget->allocation.height;
+ *push_in = TRUE;
+}
+
+static void ygtk_menu_button_show_popup (YGtkMenuButton *button)
+{
+ GtkWidget *widget = GTK_WIDGET (button);
+ GtkWidget *popup = button->popup;
+ if (!popup)
+ return;
+
+ guint activate_time = gtk_get_current_event_time();
+
+ if (GTK_IS_MENU (popup))
+ gtk_menu_popup (GTK_MENU (popup), NULL, NULL, ygtk_menu_button_get_menu_pos,
+ widget, 0, activate_time);
+ else { // GTK_IS_WINDOW
+ gint x, y;
+ gdk_window_get_origin (GDK_WINDOW (widget->window), &x, &y);
+ x += widget->allocation.x;
+ y += widget->allocation.y + widget->allocation.height;
+
+ ygtk_popup_window_popup (popup, x, y, activate_time);
+ }
+
+ if (widget->allocation.width > popup->allocation.width)
+ gtk_widget_set_size_request (popup, widget->allocation.width, -1);
+}
+
+static void ygtk_menu_button_hide_popup (YGtkMenuButton *button)
+{
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
+}
+
+static void ygtk_menu_button_button_toggle (GtkToggleButton *button)
+{
+ if (gtk_toggle_button_get_active (button))
+ ygtk_menu_button_show_popup (YGTK_MENU_BUTTON (button));
+ else
+ ygtk_menu_button_hide_popup (YGTK_MENU_BUTTON (button));
+}
+
+static gint ygtk_menu_button_button_press (GtkWidget *widget, GdkEventButton *event)
+{
+ if (event->type == GDK_BUTTON_PRESS && event->button == 1) {
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+ ygtk_menu_button_show_popup (YGTK_MENU_BUTTON (widget));
+ }
+ else
+ ygtk_menu_button_hide_popup (YGTK_MENU_BUTTON (widget));
+ return TRUE;
+ }
+ return FALSE;
+}
+
+GtkWidget *ygtk_menu_button_new (void)
+{
+ return g_object_new (YGTK_TYPE_MENU_BUTTON, NULL);
+}
+
+void ygtk_menu_button_set_label (YGtkMenuButton *button, const gchar *label)
+{
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (button->label), label);
+ gtk_widget_show (button->label);
+}
+
+static void menu_button_hide_popup (GtkWidget *widget, YGtkMenuButton *button)
+{ ygtk_menu_button_hide_popup (button); }
+
+void ygtk_menu_button_set_popup (YGtkMenuButton *button, GtkWidget *popup)
+{
+ ygtk_menu_button_free_popup (button);
+
+ if (!GTK_IS_MENU (popup) && !IS_YGTK_POPUP_WINDOW (popup)) {
+ // install widget on a YGtkPopupMenu
+ button->popup = ygtk_popup_window_new (popup);
+ }
+ else
+ button->popup = popup;
+
+ g_object_ref (G_OBJECT (button->popup));
+ gtk_object_sink (GTK_OBJECT (button->popup));
+
+ g_signal_connect (G_OBJECT (popup), "hide",
+ G_CALLBACK (menu_button_hide_popup), button);
+}
+
+static void ygtk_menu_button_class_init (YGtkMenuButtonClass *klass)
+{
+ ygtk_menu_button_parent_class = g_type_class_peek_parent (klass);
+
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = ygtk_menu_button_finalize;
+
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->button_press_event = ygtk_menu_button_button_press;
+
+ GtkToggleButtonClass *toggle_button_class = GTK_TOGGLE_BUTTON_CLASS (klass);
+ toggle_button_class->toggled = ygtk_menu_button_button_toggle;
+}
Added: trunk/gtk/10_3/src/ygtkmenubutton.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkmenubutton.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkmenubutton.h (added)
+++ trunk/gtk/10_3/src/ygtkmenubutton.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,90 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkMenuButton is a button that displays a widget when pressed.
+ This widget can either be of type GtkMenu or another, like a
+ GtkCalendar and we'll do the proper "emulation" (the work of
+ the YGtkPopupWindow widget).
+*/
+
+#ifndef YGTK_POPUP_WINDOW_H
+#define YGTK_POPUP_WINDOW_H
+
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_POPUP_WINDOW (ygtk_popup_window_get_type ())
+#define YGTK_POPUP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_POPUP_WINDOW, YGtkPopupWindow))
+#define YGTK_POPUP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_POPUP_WINDOW, YGtkPopupWindowClass))
+#define IS_YGTK_POPUP_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_POPUP_WINDOW))
+#define IS_YGTK_POPUP_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_POPUP_WINDOW))
+#define YGTK_POPUP_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_POPUP_WINDOW, YGtkPopupWindowClass))
+
+typedef struct _YGtkPopupWindow
+{
+ GtkWindow parent;
+} YGtkPopupWindow;
+
+typedef struct _YGtkPopupWindowClass
+{
+ GtkWindowClass parent_class;
+} YGtkPopupWindowClass;
+
+// don't forget to use gtk_widget_show() on the child!
+GtkWidget* ygtk_popup_window_new (GtkWidget *child);
+GType ygtk_popup_window_get_type (void) G_GNUC_CONST;
+
+void ygtk_popup_window_popup (GtkWidget *widget, gint x, gint y, guint activate_time);
+
+G_END_DECLS
+#endif /*YGTK_POPUP_WINDOW_H*/
+
+#ifndef YGTK_MENU_BUTTON_H
+#define YGTK_MENU_BUTTON_H
+
+#include
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_MENU_BUTTON (ygtk_menu_button_get_type ())
+#define YGTK_MENU_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_MENU_BUTTON, YGtkMenuButton))
+#define YGTK_MENU_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_MENU_BUTTON, YGtkMenuButtonClass))
+#define IS_YGTK_MENU_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_MENU_BUTTON))
+#define IS_YGTK_MENU_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_MENU_BUTTON))
+#define YGTK_MENU_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_MENU_BUTTON, YGtkMenuButtonClass))
+
+typedef struct _YGtkMenuButton
+{
+ GtkToggleButton parent;
+
+ // private:
+ GtkWidget *label, *popup;
+} YGtkMenuButton;
+
+typedef struct _YGtkMenuButtonClass
+{
+ GtkToggleButtonClass parent_class;
+} YGtkMenuButtonClass;
+
+GtkWidget* ygtk_menu_button_new (void);
+GType ygtk_menu_button_get_type (void) G_GNUC_CONST;
+
+void ygtk_menu_button_set_label (YGtkMenuButton *button, const gchar *label);
+
+/* Popup must be either a GtkMenu or a YGtkPopupWindow. */
+// You may hide your popup "manually" issueing a gtk_widget_hide() on it
+void ygtk_menu_button_set_popup (YGtkMenuButton *button, GtkWidget *popup);
+
+G_END_DECLS
+#endif /*YGTK_MENU_BUTTON_H*/
Added: trunk/gtk/10_3/src/ygtkratiobox.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkratiobox.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkratiobox.c (added)
+++ trunk/gtk/10_3/src/ygtkratiobox.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,587 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkRatioBox widget */
+// check the header file for information about this widget
+
+#include
+#include "ygtkratiobox.h"
+
+G_DEFINE_ABSTRACT_TYPE (YGtkRatioBox, ygtk_ratio_box, GTK_TYPE_CONTAINER)
+
+static void ygtk_ratio_box_init (YGtkRatioBox *box)
+{
+ GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW);
+ gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), FALSE);
+}
+
+static GType ygtk_ratio_box_child_type (GtkContainer* container)
+{ return GTK_TYPE_WIDGET; }
+
+void ygtk_ratio_box_pack (YGtkRatioBox *box, GtkWidget *child,
+ gfloat ratio, gboolean xfill, gboolean yfill,
+ guint padding)
+{
+ YGtkRatioBoxChild* child_info;
+ child_info = g_new (YGtkRatioBoxChild, 1);
+ child_info->widget = child;
+ child_info->ratio = ratio;
+ child_info->padding = padding;
+ child_info->xfill = xfill;
+ child_info->yfill = yfill;
+ child_info->expand = 0;
+
+ box->children = g_list_append (box->children, child_info);
+
+ gtk_widget_freeze_child_notify (child);
+ gtk_widget_set_parent (child, GTK_WIDGET (box));
+ gtk_widget_thaw_child_notify (child);
+}
+
+static YGtkRatioBoxChild *ygtk_ratio_get_child_info (YGtkRatioBox *box, GtkWidget *child)
+{
+ YGtkRatioBoxChild *i = NULL;
+ GList *list;
+ for (list = box->children; list; list = list->next) {
+ i = (YGtkRatioBoxChild*) list->data;
+ if (i->widget == child)
+ break;
+ }
+ if (!list)
+ return NULL;
+ return i;
+}
+
+static void ygtk_ratio_box_add (GtkContainer *container, GtkWidget *child)
+{
+ ygtk_ratio_box_pack (YGTK_RATIO_BOX (container), child, 1.0, TRUE, TRUE, 0);
+}
+
+static void ygtk_ratio_box_remove (GtkContainer *container, GtkWidget *widget)
+{
+ YGtkRatioBox* box = YGTK_RATIO_BOX (container);
+
+ GList* child = box->children;
+ for (child = box->children; child; child = child->next) {
+ YGtkRatioBoxChild *box_child = (YGtkRatioBoxChild*) child->data;
+ if (box_child->widget == widget) {
+ gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
+ gtk_widget_unparent (widget);
+
+ box->children = g_list_remove_link (box->children, child);
+ g_list_free (child);
+ g_free (box_child);
+
+ if (was_visible)
+ gtk_widget_queue_resize (GTK_WIDGET (container));
+ break;
+ }
+ }
+}
+
+static void ygtk_ratio_box_forall (GtkContainer *container, gboolean include_internals,
+ GtkCallback callback, gpointer callback_data)
+{
+ g_return_if_fail (callback != NULL);
+
+ YGtkRatioBox* box = YGTK_RATIO_BOX (container);
+
+ GList* children = box->children;
+ while (children) {
+ YGtkRatioBoxChild* child = (YGtkRatioBoxChild*) children->data;
+ children = children->next;
+ (* callback) (child->widget, callback_data);
+ }
+}
+
+/* We put size_request and _allocate in the same functions for both
+ orientations because it's just easier to maintain having the
+ logic in the same place. */
+
+static void ygtk_ratio_box_size_request (GtkWidget *widget,
+ GtkRequisition *requisition,
+ GtkOrientation orientation)
+{
+ YGtkRatioBox* box = YGTK_RATIO_BOX (widget);
+ gfloat ratios_sum = 0;
+ box->has_must_expand = FALSE;
+ GList* child;
+ for (child = box->children; child; child = child->next) {
+ YGtkRatioBoxChild* box_child = (YGtkRatioBoxChild*) child->data;
+ if (!GTK_WIDGET_VISIBLE (box_child->widget))
+ continue;
+ if (box_child->ratio)
+ ratios_sum += box_child->ratio;
+ if (box_child->must_expand)
+ box->has_must_expand = TRUE;
+ }
+
+ // If we want to calculate horizontal size, primary_req would be horizontal
+ // length, while secondary the height. Idem for the inverse.
+ guint primary_req = 0, secondary_req = 0;
+ box->weight_length = 0; // biggest ratio of widget-size / widget-ratio
+
+ for (child = box->children; child; child = child->next) {
+ YGtkRatioBoxChild* box_child = (YGtkRatioBoxChild*) child->data;
+ if (!GTK_WIDGET_VISIBLE (box_child->widget))
+ continue;
+
+ GtkRequisition child_req;
+ gtk_widget_size_request (box_child->widget, &child_req);
+
+ guint prim_length, sec_length;
+ if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+ prim_length = child_req.width;
+ sec_length = child_req.height;
+ }
+ else {
+ prim_length = child_req.height;
+ sec_length = child_req.width;
+ }
+
+ if (box_child->ratio)
+ {
+ int length = (prim_length * ratios_sum) / box_child->ratio;
+ box->weight_length = MAX (box->weight_length, length);
+ }
+ else
+ primary_req += prim_length;
+ primary_req += box_child->padding + box->spacing;
+ secondary_req = MAX (secondary_req, sec_length);
+ }
+
+ primary_req += box->weight_length;
+
+ guint border = GTK_CONTAINER (widget)->border_width * 2;
+ primary_req += border*2; secondary_req += border*2;
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+ requisition->width = primary_req;
+ requisition->height = secondary_req;
+ }
+ else {
+ requisition->width = secondary_req;
+ requisition->height = primary_req;
+ }
+}
+
+static void ygtk_ratio_box_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation,
+ GtkOrientation orientation)
+{
+ YGtkRatioBox* box = YGTK_RATIO_BOX (widget);
+ guint border = GTK_CONTAINER (widget)->border_width;
+
+ // a first loop to get some data for expansibles (ie. childs with weight)
+ gfloat ratios_sum = 0;
+ gint expand_num = 0, max_ratio = 0;
+ gint expansable_length;
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ expansable_length = allocation->width - border*2;
+ else
+ expansable_length = allocation->height - border*2;
+
+ GList* child;
+ for (child = box->children; child; child = child->next) {
+ YGtkRatioBoxChild* box_child = (YGtkRatioBoxChild*) child->data;
+ if (!GTK_WIDGET_VISIBLE (box_child->widget))
+ continue;
+
+ if (box_child->expand)
+ expand_num++;
+ if (box_child->ratio)
+ {
+ ratios_sum += box_child->ratio;
+ max_ratio = MAX (max_ratio, box_child->ratio);
+ }
+
+ if (!box_child->ratio)
+ {
+ GtkRequisition child_req;
+ gtk_widget_get_child_requisition (box_child->widget, &child_req);
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ expansable_length -= child_req.width;
+ else
+ expansable_length -= child_req.height;
+ }
+ expansable_length -= box->spacing - box_child->padding;
+ }
+ expansable_length -= box->weight_length;
+
+ gint child_pos = 0;
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ child_pos = allocation->x + border;
+ else
+ child_pos = allocation->y + border;
+
+ gboolean right_to_left = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
+ for (child = box->children; child; child = child->next) {
+ YGtkRatioBoxChild* box_child = (YGtkRatioBoxChild*) child->data;
+ if (!GTK_WIDGET_VISIBLE (box_child->widget))
+ continue;
+
+ GtkAllocation child_alloc;
+ gint length;
+
+ GtkRequisition child_req;
+ gtk_widget_get_child_requisition (box_child->widget, &child_req);
+
+ if (!box_child->ratio)
+ {
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ length = child_req.width;
+ else
+ length = child_req.height;
+ }
+
+ // give extra size (honor stretch order)
+ if (box_child->ratio)
+ {
+ int available_length = box->weight_length;
+ if (!box->has_must_expand)
+ available_length += expansable_length;
+ length = (box_child->ratio * available_length) / ratios_sum;
+ }
+ else if (box_child->expand && (ratios_sum == 0 || box_child->must_expand))
+ {
+ // FIXME: something is wrong for expansable_length being < 0 at times
+ // we aren't asking for enough size!
+ if (expansable_length > 0)
+ length += expansable_length / expand_num;
+ }
+
+ if (orientation == GTK_ORIENTATION_HORIZONTAL) {
+ child_alloc.x = child_pos;
+ child_alloc.y = allocation->y + border;
+ child_alloc.width = length;
+ child_alloc.height = allocation->height - border*2;
+ }
+ else { // GTK_ORIENTATION_VERTICAL
+ child_alloc.x = allocation->x + border;
+ child_alloc.y = child_pos;
+ child_alloc.width = allocation->width - border*2;
+ child_alloc.height = length;
+ }
+
+ if (!box_child->xfill) {
+ // we also need to center the widget
+ gint width = MIN (child_alloc.width, child_req.width);
+ child_alloc.x += MAX ((child_alloc.width - width) / 2, 0);
+ child_alloc.width = width;
+ }
+ if (!box_child->yfill) {
+ gint height = MIN (child_alloc.height, child_req.height);
+ child_alloc.y += MAX ((child_alloc.height - height) / 2, 0);
+ child_alloc.height = height;
+ }
+
+ if (right_to_left)
+ child_alloc.x = allocation->width - child_alloc.x - child_alloc.width;
+
+ gtk_widget_size_allocate (box_child->widget, &child_alloc);
+ child_pos += length + box->spacing + box_child->padding;
+ }
+}
+
+void ygtk_ratio_box_set_child_packing (YGtkRatioBox *box, GtkWidget *child,
+ gfloat ratio, gboolean xfill, gboolean yfill,
+ guint padding)
+{
+ YGtkRatioBoxChild *child_info;
+ child_info = ygtk_ratio_get_child_info (box, child);
+
+ if (child_info) {
+ gtk_widget_freeze_child_notify (child);
+
+ child_info->ratio = ratio;
+ child_info->xfill = xfill;
+ child_info->yfill = yfill;
+ child_info->padding = padding;
+ child_info->expand = 0;
+ child_info->must_expand = 0;
+
+ if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
+ gtk_widget_queue_resize (child);
+
+ gtk_widget_thaw_child_notify (child);
+ }
+}
+
+void ygtk_ratio_box_get_child_packing (YGtkRatioBox *box, GtkWidget *child,
+ gfloat *ratio, gboolean *xfill,
+ gboolean *yfill, guint *padding,
+ gboolean *expand)
+{
+ YGtkRatioBoxChild *child_info;
+ child_info = ygtk_ratio_get_child_info (box, child);
+
+ if (child_info) {
+ gtk_widget_freeze_child_notify (child);
+
+ if (ratio) *ratio = child_info->ratio;
+ if (xfill) *xfill = child_info->xfill;
+ if (yfill) *yfill = child_info->yfill;
+ if (padding) *padding = child_info->padding;
+ if (expand) *expand = child_info->expand;
+ }
+}
+
+void ygtk_ratio_box_set_child_expand (YGtkRatioBox *box, GtkWidget *child,
+ gboolean expand, gboolean must_expand)
+{
+ YGtkRatioBoxChild *child_info;
+ child_info = ygtk_ratio_get_child_info (box, child);
+ if (child_info)
+ {
+ child_info->expand = expand;
+ if (expand)
+ child_info->must_expand = must_expand;
+ }
+}
+
+void ygtk_ratio_box_set_child_ratio (YGtkRatioBox *box, GtkWidget *child,
+ gfloat ratio)
+{
+ YGtkRatioBoxChild *child_info;
+ child_info = ygtk_ratio_get_child_info (box, child);
+ if (child_info)
+ child_info->ratio = ratio;
+}
+
+void ygtk_ratio_box_set_spacing (YGtkRatioBox *box, gint spacing)
+{
+ box->spacing = spacing;
+}
+
+static void ygtk_ratio_box_class_init (YGtkRatioBoxClass *klass)
+{
+ ygtk_ratio_box_parent_class = (GtkContainerClass*) g_type_class_peek_parent (klass);
+
+ GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
+ container_class->add = ygtk_ratio_box_add;
+ container_class->remove = ygtk_ratio_box_remove;
+ container_class->forall = ygtk_ratio_box_forall;
+ container_class->child_type = ygtk_ratio_box_child_type;
+}
+
+//** RatioHBox
+
+G_DEFINE_TYPE (YGtkRatioHBox, ygtk_ratio_hbox, YGTK_TYPE_RATIO_BOX)
+
+static void ygtk_ratio_hbox_init (YGtkRatioHBox *box)
+{
+}
+
+static void ygtk_ratio_hbox_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ ygtk_ratio_box_size_request (widget, requisition, GTK_ORIENTATION_HORIZONTAL);
+}
+
+static void ygtk_ratio_hbox_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ ygtk_ratio_box_size_allocate (widget, allocation, GTK_ORIENTATION_HORIZONTAL);
+}
+
+GtkWidget* ygtk_ratio_hbox_new (gint spacing)
+{
+ YGtkRatioBox* box = (YGtkRatioBox*) g_object_new (YGTK_TYPE_RATIO_HBOX, NULL);
+ box->spacing = spacing;
+ return GTK_WIDGET (box);
+}
+
+static void ygtk_ratio_hbox_class_init (YGtkRatioHBoxClass *klass)
+{
+ ygtk_ratio_hbox_parent_class = (YGtkRatioBoxClass*) g_type_class_peek_parent (klass);
+
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->size_request = ygtk_ratio_hbox_size_request;
+ widget_class->size_allocate = ygtk_ratio_hbox_size_allocate;
+}
+
+//** RatioVBox
+
+G_DEFINE_TYPE (YGtkRatioVBox, ygtk_ratio_vbox, YGTK_TYPE_RATIO_BOX)
+
+static void ygtk_ratio_vbox_init (YGtkRatioVBox *box)
+{
+}
+
+static void ygtk_ratio_vbox_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ ygtk_ratio_box_size_request (widget, requisition, GTK_ORIENTATION_VERTICAL);
+}
+
+static void ygtk_ratio_vbox_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ ygtk_ratio_box_size_allocate (widget, allocation, GTK_ORIENTATION_VERTICAL);
+}
+
+GtkWidget* ygtk_ratio_vbox_new (gint spacing)
+{
+ YGtkRatioBox* box = (YGtkRatioBox*) g_object_new (YGTK_TYPE_RATIO_VBOX, NULL);
+ box->spacing = spacing;
+ return GTK_WIDGET (box);
+}
+
+static void ygtk_ratio_vbox_class_init (YGtkRatioVBoxClass *klass)
+{
+ ygtk_ratio_vbox_parent_class = g_type_class_peek_parent (klass);
+
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->size_request = ygtk_ratio_vbox_size_request;
+ widget_class->size_allocate = ygtk_ratio_vbox_size_allocate;
+}
+
+//** YGtkAdjSize
+
+G_DEFINE_TYPE (YGtkAdjSize, ygtk_adj_size, GTK_TYPE_BIN)
+
+static void ygtk_adj_size_init (YGtkAdjSize *adj_size)
+{
+ GTK_WIDGET_SET_FLAGS (adj_size, GTK_NO_WINDOW);
+ gtk_widget_set_redraw_on_allocate (GTK_WIDGET (adj_size), FALSE);
+}
+
+static void ygtk_adj_size_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ GtkWidget *child = GTK_BIN (widget)->child;
+ requisition->width = requisition->height = 0;
+ if (child && GTK_WIDGET_VISIBLE (child)) {
+ gtk_widget_size_request (child, requisition);
+ guint border = GTK_CONTAINER (widget)->border_width;
+ requisition->width += border * 2;
+ requisition->height += border * 2;
+
+ YGtkAdjSize *adj_size = YGTK_ADJ_SIZE (widget);
+ requisition->width = MAX (requisition->width, adj_size->min_width);
+ requisition->height = MAX (requisition->height, adj_size->min_height);
+
+ if (adj_size->max_width)
+ requisition->width = MIN (requisition->width, adj_size->max_width);
+ if (adj_size->max_height)
+ requisition->height = MIN (requisition->height, adj_size->max_height);
+
+ if (adj_size->only_expand) {
+ adj_size->min_width = requisition->width;
+ adj_size->min_height = requisition->height;
+ }
+ }
+}
+
+static void ygtk_adj_size_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GtkWidget *child = GTK_BIN (widget)->child;
+ if (child && GTK_WIDGET_VISIBLE (child)) {
+ GtkAllocation child_alloc = *allocation;
+ guint border = GTK_CONTAINER (widget)->border_width;
+ child_alloc.x += border;
+ child_alloc.y += border;
+ child_alloc.width -= border * 2;
+ child_alloc.height -= border * 2;
+ gtk_widget_size_allocate (child, &child_alloc);
+ }
+ GTK_WIDGET_CLASS (ygtk_adj_size_parent_class)->size_allocate (widget, allocation);
+}
+
+GtkWidget* ygtk_adj_size_new (void)
+{
+ return GTK_WIDGET (g_object_new (YGTK_TYPE_ADJ_SIZE, NULL));
+}
+
+void ygtk_adj_size_set_min (YGtkAdjSize *adj_size, guint min_width, guint min_height)
+{
+ adj_size->min_width = min_width;
+ adj_size->min_height = min_height;
+}
+
+void ygtk_adj_size_set_max (YGtkAdjSize *adj_size, guint max_width, guint max_height)
+{
+ adj_size->max_width = max_width;
+ adj_size->max_height = max_height;
+}
+
+void ygtk_adj_size_set_only_expand (YGtkAdjSize *adj_size, gboolean only_expand)
+{
+ adj_size->only_expand = only_expand;
+}
+
+static void ygtk_adj_size_class_init (YGtkAdjSizeClass *klass)
+{
+ ygtk_adj_size_parent_class = g_type_class_peek_parent (klass);
+
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->size_request = ygtk_adj_size_size_request;
+ widget_class->size_allocate = ygtk_adj_size_size_allocate;
+}
+
+//** YGtkTunedScrolledWindow
+
+G_DEFINE_TYPE (YGtkTunedScrolledWindow, ygtk_tuned_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
+
+static void ygtk_tuned_scrolled_window_init (YGtkTunedScrolledWindow *scroll)
+{
+}
+
+static void ygtk_tuned_scrolled_window_size_request (GtkWidget *widget,
+ GtkRequisition *requisition)
+{
+ YGtkTunedScrolledWindow *scroll = YGTK_TUNED_SCROLLED_WINDOW (widget);
+
+ GtkRequisition child_req;
+ GtkWidget *child = GTK_BIN (widget)->child;
+ gtk_widget_size_request (child, &child_req);
+
+ GtkScrolledWindow *gscroll = GTK_SCROLLED_WINDOW (widget);
+ GtkPolicyType hpolicy, vpolicy;
+ gtk_scrolled_window_get_policy (gscroll, &hpolicy, &vpolicy);
+
+ if (scroll->max_width) {
+ if (child_req.width < scroll->max_width)
+ gscroll->hscrollbar_policy = GTK_POLICY_NEVER;
+ else
+ gscroll->hscrollbar_policy = GTK_POLICY_AUTOMATIC;
+ }
+ if (scroll->max_height) {
+ if (child_req.height < scroll->max_height)
+ gscroll->vscrollbar_policy = GTK_POLICY_NEVER;
+ else
+ gscroll->vscrollbar_policy = GTK_POLICY_AUTOMATIC;
+ }
+
+ GTK_WIDGET_CLASS (ygtk_tuned_scrolled_window_parent_class)->size_request (widget, requisition);
+ if (scroll->max_width)
+ requisition->width = MIN (requisition->width, scroll->max_width);
+ if (scroll->max_height)
+ requisition->height = MIN (requisition->height, scroll->max_height);
+}
+
+GtkWidget* ygtk_tuned_scrolled_window_new (GtkWidget *child)
+{
+ YGtkTunedScrolledWindow *scroll = g_object_new (YGTK_TYPE_TUNED_SCROLLED_WINDOW, NULL);
+ if (child)
+ gtk_container_add (GTK_CONTAINER (scroll), child);
+ return GTK_WIDGET (scroll);
+}
+
+void ygtk_tuned_scrolled_window_set_auto_policy (YGtkTunedScrolledWindow *scroll,
+ guint max_width, guint max_height)
+{
+ scroll->max_width = max_width;
+ scroll->max_height = max_height;
+}
+
+static void ygtk_tuned_scrolled_window_class_init (YGtkTunedScrolledWindowClass *klass)
+{
+ ygtk_tuned_scrolled_window_parent_class = g_type_class_peek_parent (klass);
+
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->size_request = ygtk_tuned_scrolled_window_size_request;
+}
+
Added: trunk/gtk/10_3/src/ygtkratiobox.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkratiobox.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkratiobox.h (added)
+++ trunk/gtk/10_3/src/ygtkratiobox.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,240 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkRatioBox is an improvement over the GtkBox container that
+ allows the programmer to set stretch weights to containees.
+
+ It is similar to GtkBox in usage but instead of feeding an
+ expand boolean, a weight is given instead. In fact, it should
+ behave just the same as a GtkBox if you give 0 for not expand
+ and 1 to.
+*/
+/*
+ Quirks (cause of yast-core):
+ if one of the children has certain special properties, then only widgets with
+ the same properties will be expanded. These are, by order:
+ both stretch and rubber-band
+ both stretch and weight
+ weight
+ stretch
+
+ We use different naming:
+ stretch = expand
+ rubber-band or layout-stretch = must expand
+ weight = ratio
+*/
+
+#ifndef YGTK_RATIO_BOX_H
+#define YGTK_RATIO_BOX_H
+
+#include
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_RATIO_BOX (ygtk_ratio_box_get_type ())
+#define YGTK_RATIO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_RATIO_BOX, YGtkRatioBox))
+#define YGTK_RATIO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_RATIO_BOX, YGtkRatioBoxClass))
+#define YGTK_IS_RATIO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_RATIO_BOX))
+#define YGTK_IS_RATIO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_RATIO_BOX))
+#define YGTK_RATIO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_RATIO_BOX, YGtkRatioBoxClass))
+
+typedef struct _YGtkRatioBox
+{
+ GtkContainer parent;
+
+ // private (read-only):
+ GList *children;
+ gint16 spacing;
+ guint weight_length; // min-length for weight widgets
+ guint has_must_expand : 1; // cache
+} YGtkRatioBox;
+
+typedef struct _YGtkRatioBoxClass
+{
+ GtkContainerClass parent_class;
+} YGtkRatioBoxClass;
+
+typedef struct _YGtkRatioBoxChild
+{
+ GtkWidget *widget;
+ // members
+ guint16 padding;
+ gfloat ratio;
+ guint xfill : 1;
+ guint yfill : 1;
+ guint expand : 1; // twilight zone flag; use ratio
+ guint must_expand : 1; // higher order expand
+} YGtkRatioBoxChild;
+
+GType ygtk_ratio_box_get_type (void) G_GNUC_CONST;
+
+void ygtk_ratio_box_set_spacing (YGtkRatioBox *box, gint spacing);
+
+void ygtk_ratio_box_pack (YGtkRatioBox *box, GtkWidget *child, gfloat ratio,
+ gboolean xfill, gboolean yfill, guint padding);
+
+// If you don't want to use ratios, you can use the ordinary expand flag. NOTE:
+// If some other child has ratio > 0, this one won't expand.
+// All this mess is so we can conform with yast-core.
+void ygtk_ratio_box_set_child_expand (YGtkRatioBox *box, GtkWidget *child,
+ gboolean expand, gboolean must_expand);
+void ygtk_ratio_box_set_child_ratio (YGtkRatioBox *box, GtkWidget *child,
+ gfloat ratio);
+
+void ygtk_ratio_box_set_child_packing (YGtkRatioBox *box, GtkWidget *child,
+ gfloat ratio, gboolean xfill,
+ gboolean yfill, guint padding);
+
+void ygtk_ratio_box_get_child_packing (YGtkRatioBox *box, GtkWidget *child,
+ gfloat *ratio, gboolean *xfill,
+ gboolean *yfill, guint *padding,
+ gboolean *expandable);
+
+/* RatioHBox */
+
+#define YGTK_TYPE_RATIO_HBOX (ygtk_ratio_hbox_get_type ())
+#define YGTK_RATIO_HBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_RATIO_HBOX, YGtkRatioHBox))
+#define YGTK_RATIO_HBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_RATIO_HBOX, YGtkRatioHBoxClass))
+#define YGTK_IS_RATIO_HBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_RATIO_HBOX))
+#define YGTK_IS_RATIO_HBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_RATIO_HBOX))
+#define YGTK_RATIO_HBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_RATIO_HBOX, YGtkRatioHBoxClass))
+
+typedef struct _YGtkRatioHBox
+{
+ YGtkRatioBox parent;
+} YGtkRatioHBox;
+
+typedef struct _YGtkRatioHBoxClass
+{
+ YGtkRatioBoxClass parent_class;
+} YGtkRatioHBoxClass;
+
+GtkWidget* ygtk_ratio_hbox_new (gint spacing);
+GType ygtk_ratio_hbox_get_type (void) G_GNUC_CONST;
+
+/* RatioVBox */
+
+#define YGTK_TYPE_RATIO_VBOX (ygtk_ratio_vbox_get_type ())
+#define YGTK_RATIO_VBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_RATIO_VBOX, YGtkRatioVBox))
+#define YGTK_RATIO_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_RATIO_VBOX, YGtkRatioVBoxClass))
+#define YGTK_IS_RATIO_VBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_RATIO_VBOX))
+#define YGTK_IS_RATIO_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_RATIO_VBOX))
+#define YGTK_RATIO_VBOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_RATIO_VBOX, YGtkRatioVBoxClass))
+
+typedef struct _YGtkRatioVBox
+{
+ YGtkRatioBox parent;
+} YGtkRatioVBox;
+
+typedef struct _YGtkRatioVBoxClass
+{
+ YGtkRatioBoxClass parent_class;
+} YGtkRatioVBoxClass;
+
+GtkWidget* ygtk_ratio_vbox_new (gint spacing);
+GType ygtk_ratio_vbox_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+#endif /* YGTK_RATIO_BOX_H */
+
+/* YGtkAdjSize container allows for better fine grained size constrains. */
+#ifndef YGTK_ADJ_SIZE_H
+#define YGTK_ADJ_SIZE_H
+
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_ADJ_SIZE (ygtk_adj_size_get_type ())
+#define YGTK_ADJ_SIZE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_ADJ_SIZE, YGtkAdjSize))
+#define YGTK_ADJ_SIZE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_ADJ_SIZE, YGtkAdjSizeClass))
+#define YGTK_IS_ADJ_SIZE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_ADJ_SIZE))
+#define YGTK_IS_ADJ_SIZE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_ADJ_SIZE))
+#define YGTK_ADJ_SIZE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_ADJ_SIZE, YGtkAdjSizeClass))
+
+typedef struct _YGtkAdjSize
+{
+ GtkBin parent;
+ // members
+ guint min_width, min_height, max_width, max_height;
+ gboolean only_expand;
+} YGtkAdjSize;
+
+typedef struct _YGtkAdjSizeClass
+{
+ GtkBinClass parent_class;
+} YGtkAdjSizeClass;
+
+GType ygtk_adj_size_get_type (void) G_GNUC_CONST;
+GtkWidget* ygtk_adj_size_new (void);
+
+void ygtk_adj_size_set_min (YGtkAdjSize *adj_size, guint min_width, guint min_height);
+void ygtk_adj_size_set_max (YGtkAdjSize *adj_size, guint max_width, guint max_height);
+
+/* Only allow the child to grow (ie. to ask for bigger sizes). */
+void ygtk_adj_size_set_only_expand (YGtkAdjSize *adj_size, gboolean only_expand);
+
+G_END_DECLS
+#endif /*YGTK_ADJ_SIZE_H*/
+
+/* YGtkScrolledWindow gives some a more fine-grained automatic scroll policy.
+ It allows the user to specify from which size scrolling should be applied. */
+#ifndef YGTK_TUNED_SCROLLED_WIDOW_H
+#define YGTK_TUNED_SCROLLED_WIDOW_H
+
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_TUNED_SCROLLED_WINDOW (ygtk_tuned_scrolled_window_get_type ())
+#define YGTK_TUNED_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW, YGtkTunedScrolledWindow))
+#define YGTK_TUNED_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW, YGtkTunedScrolledWindowClass))
+#define YGTK_IS_TUNED_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW))
+#define YGTK_IS_TUNED_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW))
+#define YGTK_TUNED_SCROLLED_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_TUNED_SCROLLED_WINDOW, YGtkTunedScrolledWindowClass))
+
+typedef struct _YGtkTunedScrolledWindow
+{
+ GtkScrolledWindow parent;
+ // members
+ guint max_width, max_height;
+} YGtkTunedScrolledWindow;
+
+typedef struct _YGtkTunedScrolledWindowClass
+{
+ GtkScrolledWindowClass parent_class;
+} YGtkTunedScrolledWindowClass;
+
+GType ygtk_tuned_scrolled_window_get_type (void) G_GNUC_CONST;
+GtkWidget* ygtk_tuned_scrolled_window_new (GtkWidget *child /*or NULL*/);
+
+void ygtk_tuned_scrolled_window_set_auto_policy (YGtkTunedScrolledWindow *scroll,
+ guint max_width, guint max_height);
+
+G_END_DECLS
+#endif /*YGTK_TUNED_SCROLLED_WIDOW_H*/
+
Added: trunk/gtk/10_3/src/ygtkrichtext.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkrichtext.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkrichtext.c (added)
+++ trunk/gtk/10_3/src/ygtkrichtext.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,716 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkRichText widget */
+// check the header file for information about this widget
+
+#include
+#include "ygtkrichtext.h"
+#include
+#include
+
+#define IDENT_MARGIN 20
+#define PARAGRAPH_SPACING 12
+
+//#define PRINT_WARNINGS
+
+// Sucky - but we mix C & C++ so ...
+/* Convert html to xhtml (or at least try) */
+gchar *ygutils_convert_to_xhmlt_and_subst (const char *instr, const char *product);
+
+G_DEFINE_TYPE (YGtkRichText, ygtk_rich_text, GTK_TYPE_TEXT_VIEW)
+
+static GdkCursor *hand_cursor, *regular_cursor;
+static guint ref_cursor = 0;
+static guint link_clicked_signal;
+static GdkColor link_color = { 0, 0, 0, 0xeeee };
+
+// utilities
+// Looks at all tags covering the position of iter in the text view,
+// and returns the link the text points to, in case that text is a link.
+static const char* get_link (GtkTextView *text_view, gint x, gint y)
+{
+ GtkTextIter iter;
+ gtk_text_view_get_iter_at_location (text_view, &iter, x, y);
+
+ char *link = NULL;
+ GSList *tags = gtk_text_iter_get_tags (&iter), *tagp;
+ for (tagp = tags; tagp != NULL; tagp = tagp->next) {
+ GtkTextTag *tag = (GtkTextTag*) tagp->data;
+ link = (char*) g_object_get_data (G_OBJECT (tag), "link");
+ if (link)
+ break;
+ }
+
+ if (tags)
+ g_slist_free (tags);
+ return link;
+}
+
+// callbacks
+// Links can also be activated by clicking.
+static gboolean event_after (GtkWidget *text_view, GdkEvent *ev)
+{
+ GtkTextIter start, end;
+ GtkTextBuffer *buffer;
+ GdkEventButton *event;
+ gint x, y;
+
+ if (ev->type != GDK_BUTTON_RELEASE)
+ return FALSE;
+
+ event = (GdkEventButton *)ev;
+ if (event->button != 1)
+ return FALSE;
+
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
+
+ // We shouldn't follow a link if the user is selecting something.
+ gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
+ if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end))
+ return FALSE;
+
+ gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
+ GTK_TEXT_WINDOW_WIDGET, (gint) event->x, (gint) event->y, &x, &y);
+
+ const char *link = get_link (GTK_TEXT_VIEW (text_view), x, y);
+ if (link) // report link
+ g_signal_emit (YGTK_RICH_TEXT (text_view), link_clicked_signal, 0, link);
+ return FALSE;
+}
+
+#include
+static int mystrcmp(void *a, void *b)
+{ return g_ascii_strcasecmp (*(char **)a, *(char **)b); }
+
+static gboolean isBlockTag (const char *tag)
+{
+ static const char *Tags[] =
+ { "blockquote", "h1", "h2", "h3", "h4", "h5", "li", "p", "pre" };
+ void *ret;
+ ret = bsearch (&tag, Tags, sizeof (Tags)/sizeof(char*), sizeof(char *), (void*)mystrcmp);
+ return ret != 0;
+}
+static gboolean isIdentTag (const char *tag)
+{
+ static const char *Tags[] =
+ { "blockquote", "ol", "ul" };
+ void *ret;
+ ret = bsearch (&tag, Tags, sizeof (Tags)/sizeof(char*), sizeof(char *), (void*)mystrcmp);
+ return ret != 0;
+}
+
+void ygtk_rich_text_init (YGtkRichText *rtext)
+{
+ rtext->prodname = NULL;
+
+ GtkTextView *tview = GTK_TEXT_VIEW (rtext);
+ gtk_text_view_set_wrap_mode (tview, GTK_WRAP_WORD_CHAR);
+ gtk_text_view_set_editable (tview, FALSE);
+ gtk_text_view_set_cursor_visible (tview, FALSE);
+ gtk_text_view_set_pixels_below_lines (tview, 4);
+
+ // Init link support
+ if (!ref_cursor) {
+ GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (rtext));
+ hand_cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
+ regular_cursor = gdk_cursor_new_for_display (display, GDK_XTERM);
+ }
+ ref_cursor++;
+
+#if GTK_CHECK_VERSION(2,10,0)
+ gtk_widget_style_get (GTK_WIDGET (rtext), "link_color", &link_color, NULL);
+#endif
+
+ g_signal_connect (tview, "event-after",
+ G_CALLBACK (event_after), NULL);
+
+ // Create a few tags like 'h3', 'b', 'i'. others need to be created as we parse
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (tview);
+ PangoFontDescription *font_desc = GTK_WIDGET (rtext)->style->font_desc;
+ int size = pango_font_description_get_size (font_desc);
+ if (pango_font_description_get_size_is_absolute (font_desc))
+ size /= PANGO_SCALE;
+
+ gtk_text_buffer_create_tag (buffer, "h1", "weight", PANGO_WEIGHT_HEAVY,
+ "size", (int)(size * PANGO_SCALE_XX_LARGE), "pixels-below-lines", 16, NULL);
+ gtk_text_buffer_create_tag (buffer, "h2", "weight", PANGO_WEIGHT_ULTRABOLD,
+ "size", (int)(size * PANGO_SCALE_X_LARGE), "pixels-below-lines", 15, NULL);
+ gtk_text_buffer_create_tag (buffer, "h3", "weight", PANGO_WEIGHT_BOLD,
+ "size", (int)(size * PANGO_SCALE_LARGE), "pixels-below-lines", 14, NULL);
+ gtk_text_buffer_create_tag (buffer, "h4", "weight", PANGO_WEIGHT_SEMIBOLD,
+ "size", (int)(size * PANGO_SCALE_LARGE), "pixels-below-lines", 13, NULL);
+ gtk_text_buffer_create_tag (buffer, "h5",
+ "size", (int)(size * PANGO_SCALE_LARGE), NULL);
+ gtk_text_buffer_create_tag (buffer, "p", "pixels-below-lines", 12, NULL);
+ gtk_text_buffer_create_tag (buffer, "big",
+ "size", (int)(size * PANGO_SCALE_LARGE), NULL);
+ gtk_text_buffer_create_tag (buffer, "small",
+ "size", (int)(size * PANGO_SCALE_SMALL), NULL);
+ gtk_text_buffer_create_tag (buffer, "tt", "family", "monospace", NULL);
+ gtk_text_buffer_create_tag (buffer, "pre", "family", "monospace", NULL);
+ gtk_text_buffer_create_tag (buffer, "b", "weight", PANGO_WEIGHT_BOLD, NULL);
+ gtk_text_buffer_create_tag (buffer, "i", "style", PANGO_STYLE_ITALIC, NULL);
+ gtk_text_buffer_create_tag (buffer, "u", "underline", PANGO_UNDERLINE_SINGLE, NULL);
+ gtk_text_buffer_create_tag (buffer, "center", "justification", GTK_JUSTIFY_CENTER,
+ NULL);
+ // helpers
+ gtk_text_buffer_create_tag (buffer, "keyword", "background", "yellow", NULL);
+}
+
+static void ygtk_rich_text_destroy (GtkObject *object)
+{
+ YGtkRichText *rtext = YGTK_RICH_TEXT (object);
+
+ if (rtext->prodname)
+ // destroy can be called multiple times, and we must ref only once
+ if (ref_cursor > 0 && (--ref_cursor == 0)) {
+ gdk_cursor_unref (hand_cursor);
+ gdk_cursor_unref (regular_cursor);
+ }
+
+ if (rtext->prodname)
+ g_free (rtext->prodname);
+ rtext->prodname = NULL;
+
+ GTK_OBJECT_CLASS (ygtk_rich_text_parent_class)->destroy (object);
+}
+
+// Change the cursor to the "hands" cursor typically used by web browsers,
+// if there is a link in the given position.
+static void set_cursor_if_appropriate (GtkTextView *text_view, gint x, gint y)
+ {
+ static gboolean hovering_over_link = FALSE;
+ gboolean hovering = get_link (text_view, x, y) != NULL;
+
+ if (hovering != hovering_over_link) {
+ hovering_over_link = hovering;
+
+ if (hovering_over_link)
+ gdk_window_set_cursor (gtk_text_view_get_window
+ (text_view, GTK_TEXT_WINDOW_TEXT), hand_cursor);
+ else
+ gdk_window_set_cursor (gtk_text_view_get_window
+ (text_view, GTK_TEXT_WINDOW_TEXT), regular_cursor);
+ }
+}
+
+// Update the cursor image if the pointer moved.
+static gboolean ygtk_rich_text_motion_notify_event (GtkWidget *text_view,
+ GdkEventMotion *event)
+{
+ gint x, y;
+ gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
+ GTK_TEXT_WINDOW_WIDGET,
+ (gint) event->x, (gint) event->y,
+ &x, &y);
+ set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y);
+
+ gdk_window_get_pointer (text_view->window, NULL, NULL, NULL);
+ return TRUE;
+}
+
+// Also update the cursor image if the window becomes visible
+// (e.g. when a window covering it got iconified).
+static gboolean ygtk_rich_text_visibility_notify_event (GtkWidget *text_view,
+ GdkEventVisibility *event)
+{
+ gint wx, wy, bx, by;
+
+ gdk_window_get_pointer (text_view->window, &wx, &wy, NULL);
+ gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
+ GTK_TEXT_WINDOW_WIDGET,
+ wx, wy, &bx, &by);
+ set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), bx, by);
+ return TRUE;
+}
+
+/* Rich Text parsing methods. */
+
+typedef struct _HTMLList
+{
+ gboolean ordered;
+ char enumeration;
+} HTMLList;
+
+static void HTMLList_init (HTMLList *list, gboolean ordered)
+{
+ list->ordered = ordered;
+ list->enumeration = 1;
+}
+
+typedef struct GRTPTag {
+ GtkTextMark *mark;
+ GtkTextTag *tag;
+} GRTPTag;
+typedef struct GRTParseState {
+ GtkTextBuffer *buffer;
+ GtkTextTagTable *tags;
+ GList *htags; // of GRTPTag
+
+ // Attributes for tags that affect their children
+ gboolean pre_mode;
+ gboolean default_color;
+ int left_margin;
+ GList *html_list; // of HTMLList
+} GRTParseState;
+
+static void GRTParseState_init (GRTParseState *state, GtkTextBuffer *buffer)
+{
+ state->buffer = buffer;
+ state->pre_mode = FALSE;
+ state->default_color = TRUE;
+ state->left_margin = 0;
+ state->tags = gtk_text_buffer_get_tag_table (buffer);
+ state->html_list = NULL;
+ state->htags = NULL;
+}
+
+static void free_list (GList *list)
+{
+ GList *i;
+ for (i = g_list_first (list); i; i = i->next)
+ g_free (i->data);
+ g_list_free (list);
+}
+
+static void GRTParseState_free (GRTParseState *state)
+{
+ // NOTE: some elements might not have been freed because of bad html
+ free_list (state->html_list);
+ free_list (state->htags);
+}
+
+static char *elide_whitespace (const char *instr, int len);
+
+// Tags to support: <p> and not </p>:
+// either 'elide' \ns (turn off with <pre> I guess
+static void
+rt_start_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ gpointer user_data,
+ GError **error)
+{ // Called for open tags <foo bar="baz">
+ if (!g_ascii_strcasecmp (element_name, "body"))
+ return;
+
+ GRTParseState *state = (GRTParseState*) user_data;
+ GRTPTag *tag = g_malloc (sizeof (GRTPTag));
+ GtkTextIter iter;
+ gtk_text_buffer_get_end_iter (state->buffer, &iter);
+ tag->mark = gtk_text_buffer_create_mark (state->buffer, NULL, &iter, TRUE);
+
+ if (!g_ascii_strcasecmp (element_name, "pre"))
+ state->pre_mode = TRUE;
+
+ // Check if this is a block tag
+ if (isBlockTag (element_name)) {
+ // make sure this opens a new paragraph
+ if (!gtk_text_iter_starts_line (&iter))
+ {
+ gtk_text_buffer_insert (state->buffer, &iter, "\n", -1);
+ gtk_text_buffer_get_end_iter (state->buffer, &iter);
+ }
+ }
+
+ char *lower = g_ascii_strdown (element_name, -1);
+ tag->tag = gtk_text_tag_table_lookup (state->tags, lower);
+
+ // Special tags that must be inserted manually
+ if (!tag->tag) {
+ if (!g_ascii_strcasecmp (element_name, "font")) {
+ if (attribute_names[0] &&
+ !g_ascii_strcasecmp (attribute_names[0], "color")) {
+ tag->tag = gtk_text_buffer_create_tag (state->buffer, NULL,
+ "foreground", attribute_values[0],
+ NULL);
+ state->default_color = FALSE;
+ }
+#ifdef PRINT_WARNINGS
+ else
+ g_warning ("Unknown font attribute: '%s'", attribute_names[0]);
+#endif
+ }
+ else if (!g_ascii_strcasecmp (element_name, "a")) {
+ if (attribute_names[0] &&
+ !g_ascii_strcasecmp (attribute_names[0], "href")) {
+ tag->tag = gtk_text_buffer_create_tag (state->buffer, NULL,
+ "underline", PANGO_UNDERLINE_SINGLE,
+ NULL);
+ if (state->default_color)
+ g_object_set (tag->tag, "foreground-gdk", &link_color, NULL);
+ g_object_set_data (G_OBJECT (tag->tag), "link", g_strdup (attribute_values[0]));
+ }
+#ifdef PRINT_WARNINGS
+ else
+ g_warning ("Unknown a attribute: '%s'", attribute_names[0]);
+#endif
+ }
+ else if (!g_ascii_strcasecmp (element_name, "li")) {
+ HTMLList *front_list;
+
+ if (state->html_list &&
+ (front_list = g_list_first (state->html_list)->data) &&
+ (front_list->ordered)) {;
+ gchar *str = g_strdup_printf ("%d. ", front_list->enumeration++);
+ gtk_text_buffer_insert (state->buffer, &iter, str, -1);
+ g_free (str);
+ }
+ else { // \\u25cf for bigger bullets
+ gtk_text_buffer_insert (state->buffer, &iter, "\u2022 ", -1);
+ }
+ }
+ // Tags that affect the margin
+ else if (!g_ascii_strcasecmp (element_name, "ul") ||
+ !g_ascii_strcasecmp (element_name, "ol")) {
+ HTMLList *list = g_malloc (sizeof (HTMLList));
+ HTMLList_init (list, !g_ascii_strcasecmp (element_name, "ol"));
+ state->html_list = g_list_append (state->html_list, list);
+ }
+
+ else if (!g_ascii_strcasecmp (element_name, "img")) {
+ if (attribute_names[0] &&
+ !g_ascii_strcasecmp (attribute_names[0], "src")) {
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (attribute_values[0], NULL);
+ if (pixbuf) {
+ gtk_text_buffer_insert_pixbuf (state->buffer, &iter, pixbuf);
+ g_object_unref (G_OBJECT (pixbuf));
+ }
+ }
+#ifdef PRINT_WARNINGS
+ else
+ g_warning ("Unknown img attribute: '%s'", attribute_names[0]);
+#endif
+ }
+
+ // for tags like <br/>, GMarkup will pass them through the end
+ // tag callback too, so we'll deal with them there
+ else if (!g_ascii_strcasecmp (element_name, "br"))
+ ;
+
+ else
+ {
+#ifdef PRINT_WARNINGS
+ if (isBlockTag (element_name))
+ ;
+ else
+ g_warning ("Unknown tag '%s'", element_name);
+#endif
+ }
+ }
+
+ if (!tag->tag && isIdentTag (element_name)) {
+ state->left_margin += IDENT_MARGIN;
+ tag->tag = gtk_text_buffer_create_tag (state->buffer, NULL,
+ "left-margin", state->left_margin, NULL);
+ }
+
+ g_free (lower);
+ state->htags = g_list_append (state->htags, tag);
+}
+
+static void
+rt_end_element (GMarkupParseContext *context,
+ const gchar *element_name,
+ gpointer user_data,
+ GError **error)
+{ // Called for close tags </foo>
+ if (!g_ascii_strcasecmp (element_name, "body"))
+ return;
+
+ GRTParseState *state = (GRTParseState*) user_data;
+
+ if (g_list_length (state->htags) == 0) {
+ g_warning ("Urgh - empty tag queue closing '%s'", element_name);
+ return;
+ }
+
+ g_return_if_fail (state->htags != NULL);
+ GRTPTag *tag = g_list_last (state->htags)->data;
+ state->htags = g_list_remove (state->htags, tag);
+
+ GtkTextIter start, end;
+ gtk_text_buffer_get_iter_at_mark (state->buffer, &start, tag->mark);
+ gtk_text_buffer_get_end_iter (state->buffer, &end);
+
+ gint appendLines = 0;
+
+ if (isIdentTag (element_name))
+ state->left_margin -= IDENT_MARGIN;
+
+ if (!g_ascii_strcasecmp (element_name, "ul") ||
+ !g_ascii_strcasecmp (element_name, "ol")) {
+ HTMLList *last_list = g_list_last (state->html_list)->data;
+ state->html_list = g_list_remove (state->html_list, last_list);
+ g_free (last_list);
+ }
+ else if (!g_ascii_strcasecmp (element_name, "font"))
+ state->default_color = TRUE;
+
+ else if (!g_ascii_strcasecmp (element_name, "pre")) {
+ state->pre_mode = FALSE;
+/*
+ // \n must be inserted as <br>
+ char *txt = gtk_text_buffer_get_text (state->buffer,
+ &start, &end, TRUE);
+ char endc = txt ? txt[strlen(txt) - 1] : '\0';
+ appendLines = (endc != '\r' && endc != '\n') ? 1 : 0;
+ g_free (txt);*/
+ }
+
+ else if (!g_ascii_strcasecmp (element_name, "br"))
+ appendLines = 1;
+
+ if (isBlockTag (element_name))
+ {
+// appendLines = 2;
+// if (!g_ascii_strcasecmp (element_name, "li"))
+ appendLines = 1;
+ }
+
+
+ if (appendLines) {
+ gtk_text_buffer_insert (state->buffer, &end,
+ appendLines == 1 ? "\n" : "\n\n", -1);
+ gtk_text_buffer_get_iter_at_mark (state->buffer, &start, tag->mark);
+ gtk_text_buffer_get_end_iter (state->buffer, &end);
+ }
+
+ if (tag->tag)
+ gtk_text_buffer_apply_tag (state->buffer, tag->tag, &start, &end);
+
+ gtk_text_buffer_delete_mark (state->buffer, tag->mark);
+ g_free (tag);
+}
+
+static void
+rt_text (GMarkupParseContext *context,
+ const gchar *text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error)
+{ // Called for character data, NB. text NOT nul-terminated
+ GRTParseState *state = (GRTParseState*) user_data;
+ GtkTextIter start, end;
+ gtk_text_buffer_get_end_iter (state->buffer, &start);
+ if (state->pre_mode)
+ gtk_text_buffer_insert_with_tags (state->buffer, &start,
+ text, text_len, NULL, NULL);
+ else {
+ char *real = elide_whitespace (text, text_len);
+ gtk_text_buffer_insert_with_tags (state->buffer, &start,
+ real, -1, NULL, NULL);
+ g_free (real);
+ }
+ gtk_text_buffer_get_end_iter (state->buffer, &end);
+}
+
+static void
+rt_passthrough (GMarkupParseContext *context,
+ const gchar *passthrough_text,
+ gsize text_len,
+ gpointer user_data,
+ GError **error)
+{
+ // ignore comments etc.
+}
+
+static void
+rt_error (GMarkupParseContext *context,
+ GError *error,
+ gpointer user_data)
+{
+}
+
+static GMarkupParser rt_parser = {
+ rt_start_element,
+ rt_end_element,
+ rt_text,
+ rt_passthrough,
+ rt_error
+};
+
+GtkWidget *ygtk_rich_text_new (void)
+{
+ return g_object_new (YGTK_TYPE_RICH_TEXT, NULL);
+}
+
+/* String preparation methods. */
+
+#define IS_WHITE(c) (g_ascii_isspace (c) || (c) == '\t')
+
+static char *elide_whitespace (const char *instr, int len)
+{
+ GString *dest = g_string_new ("");
+ if (len < 0)
+ len = strlen (instr);
+ gboolean last_white = FALSE;
+ int i;
+// FIXME: whitespace elision needs to happen across tags [urk]
+// FIXME: perhaps post-process non-pre sections when they are complete ?
+ for (i = 0; i < len; i++)
+ {
+ char ch = instr[i];
+ if (ch == '\r' || ch == '\n')
+ continue;
+ if (ch == '\t')
+ ch = ' ';
+ gboolean cur_white = IS_WHITE (ch);
+ if (!cur_white || !last_white)
+ g_string_append_c (dest, ch);
+ last_white = cur_white;
+ }
+
+ return g_string_free (dest, FALSE);
+}
+
+void ygtk_richttext_set_prodname (YGtkRichText *rtext, const char *prodname)
+{
+ rtext->prodname = g_strdup (prodname);
+}
+
+void ygtk_rich_text_set_text (YGtkRichText* rtext, const gchar* text,
+ gboolean rich_text)
+{
+ GtkTextBuffer *buffer;
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rtext));
+
+ if (!rich_text) {
+ gtk_text_buffer_set_text (buffer, text, -1);
+ return;
+ }
+
+ // remove any possible existing text
+ gtk_text_buffer_set_text (buffer, "", 0);
+
+ GRTParseState state;
+ GRTParseState_init (&state, buffer);
+
+ GMarkupParseContext *ctx;
+ ctx = g_markup_parse_context_new (&rt_parser, (GMarkupParseFlags)0, &state, NULL);
+
+ char *xml = ygutils_convert_to_xhmlt_and_subst (text, rtext->prodname);
+ GError *error = NULL;
+ if (!g_markup_parse_context_parse (ctx, xml, -1, &error)) {
+#ifdef PRINT_WARNINGS
+ g_warning ("Markup parse error '%s'", error ? error->message : "Unknown");
+#endif
+ }
+ g_free (xml);
+
+ g_markup_parse_context_free (ctx);
+ GRTParseState_free (&state);
+
+ // remove last empty line, if any
+ GtkTextIter end_it, before_end_it;
+ gtk_text_buffer_get_end_iter (buffer, &end_it);
+ before_end_it = end_it;
+ if (gtk_text_iter_backward_char (&before_end_it) &&
+ gtk_text_iter_get_char (&before_end_it) == '\n')
+ gtk_text_buffer_delete (buffer, &before_end_it, &end_it);
+}
+
+/* gtk_text_iter_forward_search() is case-sensitive so we roll our own.
+ The idea is to keep use get_text and strstr there, but to be more
+ efficient we check per line. */
+static gboolean ygtk_rich_text_forward_search (const GtkTextIter *begin,
+ const GtkTextIter *end, const gchar *_key, GtkTextIter *match_start,
+ GtkTextIter *match_end)
+{
+ if (*_key == 0)
+ return FALSE;
+
+ /* gtk_text_iter_get_char() returns a gunichar (ucs4 coding), so we
+ convert the given string (which is utf-8, like anyhting in gtk+) */
+ gunichar *key = g_utf8_to_ucs4 (_key, -1, NULL, NULL, NULL);
+ if (!key) // conversion error -- should not happen
+ return FALSE;
+
+ // convert key to lower case, to avoid work later
+ gunichar *k;
+ for (k = key; *k; k++)
+ *k = g_unichar_tolower (*k);
+
+ GtkTextIter iter = *begin, iiter;
+ while (!gtk_text_iter_is_end (&iter) && gtk_text_iter_compare (&iter, end) <= 0) {
+ iiter = iter;
+ for (k = key; *k == g_unichar_tolower (gtk_text_iter_get_char (&iiter)) && (*k);
+ k++, gtk_text_iter_forward_char (&iiter))
+ ;
+ if (!*k) {
+ *match_start = iter;
+ *match_end = iiter;
+ return TRUE;
+ }
+ gtk_text_iter_forward_char (&iter);
+ }
+ return FALSE;
+}
+
+gboolean ygtk_rich_text_mark_text (YGtkRichText *rtext, const gchar *text)
+{
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rtext));
+ GtkTextIter iter, end, match_start, match_end;
+
+ gtk_text_buffer_get_bounds (buffer, &iter, &end);
+ gtk_text_buffer_remove_tag_by_name (buffer, "keyword", &iter, &end);
+
+ gtk_text_buffer_select_range (buffer, &iter, &iter); // unselect text
+ if (!text || *text == '\0')
+ return TRUE;
+
+ gboolean found = FALSE;
+ while (ygtk_rich_text_forward_search (&iter, &end, text,
+ &match_start, &match_end)) {
+ found = TRUE;
+ gtk_text_buffer_apply_tag_by_name (buffer, "keyword", &match_start, &match_end);
+ iter = match_end;
+ gtk_text_iter_forward_char (&iter);
+ }
+ return found;
+}
+
+gboolean ygtk_rich_text_forward_mark (YGtkRichText *rtext, const gchar *text)
+{
+ GtkTextIter start_iter, end_iter;
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rtext));
+ gtk_text_buffer_get_iter_at_mark (buffer, &start_iter,
+ gtk_text_buffer_get_selection_bound (buffer));
+ gtk_text_buffer_get_end_iter (buffer, &end_iter);
+
+ gboolean found;
+ found = ygtk_rich_text_forward_search (&start_iter, &end_iter, text,
+ &start_iter, &end_iter);
+ if (!found) {
+ gtk_text_buffer_get_start_iter (buffer, &start_iter);
+ found = ygtk_rich_text_forward_search (&start_iter, &end_iter, text,
+ &start_iter, &end_iter);
+ }
+
+ if (found) {
+ gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (rtext), &start_iter, 0.10,
+ FALSE, 0, 0);
+ gtk_text_buffer_select_range (buffer, &start_iter, &end_iter);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+void ygtk_rich_text_class_init (YGtkRichTextClass *klass)
+{
+ GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
+ gtkwidget_class->motion_notify_event = ygtk_rich_text_motion_notify_event;
+ gtkwidget_class->visibility_notify_event = ygtk_rich_text_visibility_notify_event;
+
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_rich_text_destroy;
+
+ link_clicked_signal = g_signal_new ("link-clicked",
+ G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (YGtkRichTextClass, link_clicked), NULL, NULL,
+ g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
+}
+
Added: trunk/gtk/10_3/src/ygtkrichtext.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkrichtext.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkrichtext.h (added)
+++ trunk/gtk/10_3/src/ygtkrichtext.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,59 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkRichText is a very simple widget that displays HTML code.
+ It was done, since GTK+ doesn't offer one out of box, and to
+ avoid dependencies.
+*/
+
+#ifndef YGTK_RICH_TEXT_H
+#define YGTK_RICH_TEXT_H
+
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_RICH_TEXT (ygtk_rich_text_get_type ())
+#define YGTK_RICH_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_RICH_TEXT, YGtkRichText))
+#define YGTK_RICH_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_RICH_TEXT, YGtkRichTextClass))
+#define YGTK_IS_RICH_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_RICH_TEXT))
+#define YGTK_IS_RICH_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_RICH_TEXT))
+#define YGTK_RICH_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_RICH_TEXT, YGtkRichTextClass))
+
+typedef struct _YGtkRichText
+{
+ GtkTextView parent;
+ // private:
+ char *prodname;
+} YGtkRichText;
+
+typedef struct _YGtkRichTextClass
+{
+ GtkTextViewClass parent_class;
+
+ // signals:
+ void (*link_clicked) (YGtkRichText *rich_text, const gchar *link);
+} YGtkRichTextClass;
+
+GtkWidget* ygtk_rich_text_new (void);
+GType ygtk_rich_text_get_type (void) G_GNUC_CONST;
+
+/* Sets some text to YGtkRichText, may be HTML or plain text, as indicated by
+ rich_text. */
+void ygtk_rich_text_set_text (YGtkRichText* rtext, const gchar* text,
+ gboolean rich_text);
+
+void ygtk_richttext_set_prodname (YGtkRichText *rtext, const char *prodname);
+
+// To be used together with an entry box to search for text
+gboolean ygtk_rich_text_mark_text (YGtkRichText *rtext, const gchar *text);
+gboolean ygtk_rich_text_forward_mark (YGtkRichText *rtext, const gchar *text); // F3
+
+G_END_DECLS
+#endif /* YGTK_RICH_TEXT_H */
+
Added: trunk/gtk/10_3/src/ygtkscrolledwindow.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkscrolledwindow.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkscrolledwindow.c (added)
+++ trunk/gtk/10_3/src/ygtkscrolledwindow.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,99 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkScrolledWindow widget */
+// check the header file for information about this widget
+
+#include
+#include "ygtkscrolledwindow.h"
+#include
+
+#define CHILD_SPACING 2
+
+G_DEFINE_TYPE (YGtkScrolledWindow, ygtk_scrolled_window, GTK_TYPE_SCROLLED_WINDOW)
+
+static void ygtk_scrolled_window_init (YGtkScrolledWindow *scroll)
+{
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN);
+}
+
+static void ygtk_scrolled_window_destroy (GtkObject *object)
+{
+ GTK_OBJECT_CLASS (ygtk_scrolled_window_parent_class)->destroy (object);
+ YGtkScrolledWindow *scroll = YGTK_SCROLLED_WINDOW (object);
+ ygtk_scrolled_window_set_corner_widget (scroll, NULL);
+}
+
+static void ygtk_scrolled_window_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GTK_WIDGET_CLASS (ygtk_scrolled_window_parent_class)->size_allocate
+ (widget, allocation);
+ if (!GTK_WIDGET_REALIZED (widget))
+ return;
+
+ YGtkScrolledWindow *scroll = YGTK_SCROLLED_WINDOW (widget);
+ if (scroll->corner_child) {
+ GtkRequisition req;
+ gtk_widget_size_request (scroll->corner_child, &req);
+
+ GtkWidget *vbar;
+ vbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (scroll));
+
+ vbar->allocation.height = MAX (0, widget->allocation.height - req.height - CHILD_SPACING);
+ GtkAllocation alloc = { vbar->allocation.x,
+ vbar->allocation.y + vbar->allocation.height + CHILD_SPACING,
+ vbar->allocation.width,
+ req.height };
+ gtk_widget_size_allocate (scroll->corner_child, &alloc);
+ }
+}
+
+static void ygtk_scrolled_window_forall (GtkContainer *container,
+ gboolean include_internals, GtkCallback callback, gpointer callback_data)
+{
+ GTK_CONTAINER_CLASS (ygtk_scrolled_window_parent_class)->forall (container,
+ include_internals, callback, callback_data);
+ if (include_internals) {
+ YGtkScrolledWindow *scroll = YGTK_SCROLLED_WINDOW (container);
+ if (scroll->corner_child)
+ callback (scroll->corner_child, callback_data);
+ }
+}
+
+void ygtk_scrolled_window_set_corner_widget (YGtkScrolledWindow *scroll, GtkWidget *child)
+{
+ if (scroll->corner_child)
+ gtk_widget_unparent (scroll->corner_child);
+ scroll->corner_child = child;
+ if (child)
+ gtk_widget_set_parent (child, GTK_WIDGET (scroll));
+}
+
+void ygtk_scrolled_window_replace (YGtkScrolledWindow *scroll, GtkWidget *child)
+{
+ GtkWidget *current = gtk_bin_get_child (GTK_BIN (scroll));
+ if (current)
+ gtk_container_remove (GTK_CONTAINER (scroll), current);
+ if (child)
+ gtk_container_add (GTK_CONTAINER (scroll), child);
+}
+
+GtkWidget *ygtk_scrolled_window_new (void)
+{ return g_object_new (YGTK_TYPE_SCROLLED_WINDOW, NULL); }
+
+static void ygtk_scrolled_window_class_init (YGtkScrolledWindowClass *klass)
+{
+ GtkContainerClass *gtkcontainer_class = GTK_CONTAINER_CLASS (klass);
+ gtkcontainer_class->forall = ygtk_scrolled_window_forall;
+
+ GtkWidgetClass *gtkwidget_class = GTK_WIDGET_CLASS (klass);
+ gtkwidget_class->size_allocate = ygtk_scrolled_window_size_allocate;
+
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_scrolled_window_destroy;
+}
+
Added: trunk/gtk/10_3/src/ygtkscrolledwindow.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkscrolledwindow.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkscrolledwindow.h (added)
+++ trunk/gtk/10_3/src/ygtkscrolledwindow.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,51 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkScrolledWindow extends GtkScrolledWindow adding the possibility to add
+ a widget in the corner between the scrollbars, flowing into the vertical
+ scroll bar (which is why the policy should be ALWAYS for the vertical bar).
+*/
+
+#ifndef YGTK_SCROLLED_WINDOW_H
+#define YGTK_SCROLLED_WINDOW_H
+
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_SCROLLED_WINDOW (ygtk_scrolled_window_get_type ())
+#define YGTK_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_SCROLLED_WINDOW, YGtkScrolledWindow))
+#define YGTK_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_SCROLLED_WINDOW, YGtkScrolledWindowClass))
+#define YGTK_IS_SCROLLED_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_SCROLLED_WINDOW))
+#define YGTK_IS_SCROLLED_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_SCROLLED_WINDOW))
+#define YGTK_SCROLLED_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_SCROLLED_WINDOW, YGtkScrolledWindowClass))
+
+typedef struct _YGtkScrolledWindow
+{
+ GtkScrolledWindow parent;
+ //members:
+ GtkWidget *corner_child;
+} YGtkScrolledWindow;
+
+typedef struct _YGtkScrolledWindowClass
+{
+ GtkScrolledWindowClass parent_class;
+} YGtkScrolledWindowClass;
+
+GtkWidget* ygtk_scrolled_window_new (void);
+GType ygtk_scrolled_window_get_type (void) G_GNUC_CONST;
+
+// container_add/remove combo
+void ygtk_scrolled_window_replace (YGtkScrolledWindow *scroll, GtkWidget *child);
+
+void ygtk_scrolled_window_set_corner_widget (YGtkScrolledWindow *scroll,
+ GtkWidget *widget);
+
+G_END_DECLS
+#endif /*YGTK_SCROLLED_WINDOW_H*/
+
Added: trunk/gtk/10_3/src/ygtksteps.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtksteps.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtksteps.c (added)
+++ trunk/gtk/10_3/src/ygtksteps.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,324 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkSteps widget */
+// check the header file for information about this widget
+
+#include
+#include "ygtksteps.h"
+#include
+#include
+#include
+#include
+#include
+
+#define BORDER 6
+#define STEPS_HEADER_SPACING 8
+#define STEPS_SPACING 2
+#define STEPS_IDENTATION 30
+#define CURRENT_MARK_ANIMATION_TIME 250
+#define CURRENT_MARK_ANIMATION_OFFSET 3
+#define CURRENT_MARK_FRAMES_NB (CURRENT_MARK_ANIMATION_OFFSET*2)
+
+G_DEFINE_TYPE (YGtkSteps, ygtk_steps, GTK_TYPE_WIDGET)
+
+static void ygtk_steps_init (YGtkSteps *steps)
+{
+ GTK_WIDGET_SET_FLAGS (steps, GTK_NO_WINDOW);
+
+ PangoContext *context = gtk_widget_get_pango_context (GTK_WIDGET (steps));
+ steps->check_mark_layout = pango_layout_new (context);
+ steps->current_mark_layout = pango_layout_new (context);
+ pango_layout_set_markup (steps->check_mark_layout, "\u2714", -1);
+ pango_layout_set_markup (steps->current_mark_layout, "<b>\u2192</b>", -1);
+ steps->current_mark_timeout_id = steps->current_mark_frame = 0;
+}
+
+static void ygtk_steps_destroy (GtkObject *object)
+{
+ YGtkSteps *steps = YGTK_STEPS (object);
+
+ if (steps->current_mark_timeout_id) {
+ g_source_remove (steps->current_mark_timeout_id);
+ steps->current_mark_timeout_id = 0;
+ }
+
+ g_object_unref (steps->check_mark_layout);
+ steps->check_mark_layout = NULL;
+
+ g_object_unref (steps->current_mark_layout);
+ steps->current_mark_layout = NULL;
+
+ ygtk_steps_clear (steps);
+ GTK_OBJECT_CLASS (ygtk_steps_parent_class)->destroy (object);
+}
+
+
+static inline YGtkSingleStep *ygtk_steps_get_step (YGtkSteps *steps, guint step_nb)
+{
+ return g_list_nth_data (steps->steps, step_nb);
+}
+
+static void ygtk_step_invalidate_layout (YGtkSingleStep *step)
+{
+ if (step->layout) {
+ g_object_unref (G_OBJECT (step->layout));
+ step->layout = NULL;
+ }
+ if (step->layout_bold) {
+ g_object_unref (G_OBJECT (step->layout_bold));
+ step->layout_bold = NULL;
+ }
+}
+
+// should be called rather than accessing step->layout
+static PangoLayout *ygtk_steps_get_step_layout (YGtkSteps *steps, guint step_nb)
+{
+ YGtkSingleStep *step = ygtk_steps_get_step (steps, step_nb);
+
+ if (!step->layout) {
+ step->layout = gtk_widget_create_pango_layout (GTK_WIDGET (steps), NULL);
+
+ gchar *text, *text_bold = 0;
+ if (step->is_heading) {
+ text = g_strdup_printf ("%s</span>",
+ step->text);
+ pango_layout_set_spacing (step->layout, STEPS_HEADER_SPACING * PANGO_SCALE);
+ }
+ else {
+ if (!step->layout_bold)
+ step->layout_bold = gtk_widget_create_pango_layout (GTK_WIDGET (steps), NULL);
+ g_assert (step->layout_bold);
+ text = g_strdup (step->text);
+ text_bold = g_strdup_printf ("<b>%s</b>", step->text);
+ pango_layout_set_indent (step->layout, STEPS_IDENTATION * PANGO_SCALE);
+ pango_layout_set_indent (step->layout_bold, STEPS_IDENTATION * PANGO_SCALE);
+ pango_layout_set_spacing (step->layout, STEPS_SPACING * PANGO_SCALE);
+ pango_layout_set_spacing (step->layout_bold, STEPS_SPACING * PANGO_SCALE);
+ }
+
+ pango_layout_set_markup (step->layout, text, -1);
+ g_free (text);
+ if (step->layout_bold)
+ {
+ pango_layout_set_markup (step->layout_bold, text_bold, -1);
+ g_free (text_bold);
+ }
+ }
+
+ if (steps->current_step == step_nb)
+ return step->layout_bold;
+ return step->layout;
+}
+
+// If PangoContext got invalidated (eg. system language change), re-compute it!
+static void ygtk_steps_recompute_layout (YGtkSteps *steps)
+{
+ GList *it;
+ for (it = steps->steps; it; it = it->next) {
+ YGtkSingleStep *step = it->data;
+ if (step->layout)
+ pango_layout_context_changed (step->layout);
+ if (step->layout_bold)
+ pango_layout_context_changed (step->layout_bold);
+ }
+}
+
+static void ygtk_steps_direction_changed (GtkWidget *widget, GtkTextDirection dir)
+{
+ ygtk_steps_recompute_layout (YGTK_STEPS (widget));
+ GTK_WIDGET_CLASS (ygtk_steps_parent_class)->direction_changed (widget, dir);
+}
+
+static void ygtk_steps_style_set (GtkWidget *widget, GtkStyle *style)
+{
+ ygtk_steps_recompute_layout (YGTK_STEPS (widget));
+ GTK_WIDGET_CLASS (ygtk_steps_parent_class)->style_set (widget, style);
+}
+
+static void ygtk_steps_size_request (GtkWidget *widget, GtkRequisition *requisition)
+{
+ requisition->width = requisition->height = 0;
+
+ YGtkSteps *steps = YGTK_STEPS (widget);
+ int i;
+ for (i = 0; i < ygtk_steps_total (steps); i++) {
+ PangoLayout *layout = ygtk_steps_get_step_layout (steps, i);
+ YGtkSingleStep *step = ygtk_steps_get_step (steps, i);
+ if (!step->is_heading)
+ layout = step->layout_bold;
+
+ int w, h;
+ pango_layout_get_pixel_size (layout, &w, &h);
+ w += PANGO_PIXELS (pango_layout_get_indent (layout));
+ h += PANGO_PIXELS (pango_layout_get_spacing (layout)) * 2;
+
+ requisition->width = MAX (w, requisition->width);
+ requisition->height += h;
+ }
+
+ requisition->width += BORDER * 2;
+ requisition->height += BORDER * 2;
+}
+
+static gboolean ygtk_steps_expose_event (GtkWidget *widget, GdkEventExpose *event)
+{
+ int x = widget->allocation.x + BORDER, y = widget->allocation.y + BORDER;
+ GtkStyle *style = gtk_widget_get_style (widget);
+
+ YGtkSteps *steps = YGTK_STEPS (widget);
+ int i;
+ for (i = 0; i < ygtk_steps_total (steps); i++) {
+ PangoLayout *layout = ygtk_steps_get_step_layout (steps, i);
+
+ // as opposite to identation, we need to apply spacing ourselves, since we aren't
+ // really using paragraphs
+ y += PANGO_PIXELS (pango_layout_get_spacing (layout));
+
+ gtk_paint_layout (style, widget->window, GTK_STATE_NORMAL, TRUE,
+ NULL, /*event->area,*/ widget, NULL, x, y, layout);
+
+ if (i <= steps->current_step && !ygtk_steps_get_step (steps, i)->is_heading) {
+ PangoLayout *mark = (i == steps->current_step) ? steps->current_mark_layout
+ : steps->check_mark_layout;
+ int x_;
+ pango_layout_get_pixel_size (mark, &x_, NULL);
+ x_ = x + STEPS_IDENTATION - x_ - 6;
+ if (i == steps->current_step) {
+ if (steps->current_mark_frame < CURRENT_MARK_FRAMES_NB/2)
+ x_ -= steps->current_mark_frame * CURRENT_MARK_ANIMATION_OFFSET;
+ else
+ x_ -= (CURRENT_MARK_FRAMES_NB - steps->current_mark_frame) *
+ CURRENT_MARK_ANIMATION_OFFSET;
+ }
+
+ gtk_paint_layout (style, widget->window, GTK_STATE_NORMAL, TRUE,
+ NULL, /*event->area,*/ widget, NULL, x_, y, mark);
+ }
+
+ int h;
+ pango_layout_get_pixel_size (layout, NULL, &h);
+ // we need spacing for both sides
+ y += h + PANGO_PIXELS (pango_layout_get_spacing (layout));
+ }
+ return FALSE;
+}
+
+GtkWidget* ygtk_steps_new (void)
+{
+ return g_object_new (YGTK_TYPE_STEPS, NULL);
+}
+
+guint ygtk_steps_append (YGtkSteps *steps, const gchar *step_text)
+{
+ gint steps_nb;
+
+ g_return_val_if_fail (YGTK_IS_STEPS (steps), 0);
+
+ steps_nb = ygtk_steps_total (steps);
+
+ // check if the text is the same as the previous...
+ if (steps_nb) {
+ YGtkSingleStep *last_step = g_list_last (steps->steps)->data;
+ if (!g_strcasecmp (last_step->text, step_text)) {
+ last_step->strength++;
+ return steps_nb-1;
+ }
+ }
+
+ // New step
+ YGtkSingleStep *step = g_new0 (YGtkSingleStep, 1);
+ step->is_heading = FALSE;
+ step->text = g_strdup (step_text);
+ step->strength = 1;
+ step->layout = step->layout_bold = NULL;
+
+ steps->steps = g_list_append (steps->steps, step);
+ gtk_widget_queue_resize (GTK_WIDGET (steps));
+ return steps_nb;
+}
+
+void ygtk_steps_append_heading (YGtkSteps *steps, const gchar *heading)
+{
+ YGtkSingleStep *step;
+
+ g_return_if_fail (YGTK_IS_STEPS (steps));
+
+ step = g_new0 (YGtkSingleStep, 1);
+ step->is_heading = TRUE;
+ step->text = g_strdup (heading);
+ step->strength = 1; // not important anyway
+ step->layout = step->layout_bold = NULL;
+
+ steps->steps = g_list_append (steps->steps, step);
+ gtk_widget_queue_resize (GTK_WIDGET (steps));
+}
+
+void ygtk_steps_advance (YGtkSteps *steps)
+{
+ if (steps->current_step + 1 < ygtk_steps_total (steps))
+ ygtk_steps_set_current (steps, steps->current_step + 1);
+}
+
+static gboolean current_mark_animation_cb (void *steps_ptr)
+{
+ YGtkSteps *steps = steps_ptr;
+
+ // ugly -- should use gtk_widget_queue_draw_area (widget, x, y, w, h)
+ // but we need to iterate through all steps to get current location and
+ // all, so...
+ gtk_widget_queue_draw (GTK_WIDGET (steps));
+
+ if (++steps->current_mark_frame == CURRENT_MARK_FRAMES_NB) {
+ steps->current_mark_frame = 0;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void ygtk_steps_set_current (YGtkSteps *steps, guint step)
+{
+ guint old_step = steps->current_step;
+ steps->current_step = step;
+
+ // update step icons
+ ygtk_step_invalidate_layout (ygtk_steps_get_step (steps, old_step));
+ ygtk_step_invalidate_layout (ygtk_steps_get_step (steps, step));
+
+ steps->current_mark_frame = 0;
+ steps->current_mark_timeout_id = g_timeout_add
+ (CURRENT_MARK_ANIMATION_TIME / CURRENT_MARK_FRAMES_NB,
+ current_mark_animation_cb, steps);
+}
+
+guint ygtk_steps_total (YGtkSteps *steps)
+{
+ return g_list_length (steps->steps);
+}
+
+void ygtk_steps_clear (YGtkSteps *steps)
+{
+ GList *it;
+ for (it = steps->steps; it; it = it->next) {
+ YGtkSingleStep *step = it->data;
+ ygtk_step_invalidate_layout (step);
+ g_free (step->text);
+ g_free (step);
+ }
+ g_list_free (steps->steps);
+ steps->steps = NULL;
+}
+
+static void ygtk_steps_class_init (YGtkStepsClass *klass)
+{
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->expose_event = ygtk_steps_expose_event;
+ widget_class->size_request = ygtk_steps_size_request;
+ widget_class->direction_changed = ygtk_steps_direction_changed;
+ widget_class->style_set = ygtk_steps_style_set;
+
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_steps_destroy;
+}
+
Added: trunk/gtk/10_3/src/ygtksteps.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtksteps.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtksteps.h (added)
+++ trunk/gtk/10_3/src/ygtksteps.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,82 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkSteps is a widget that displays a list of steps, useful
+ to show the progress of some configuration tool as it does
+ the work of updating files or services or whatever.
+
+ You use the append functions to initializate the steps. If,
+ for some reason, you want one step to count as more than one
+ (ie. so that a ygtk_steps_advance() needs to be called more than
+ once to actually advance for a given step), you may append a
+ step with the same name of the previous, that they'll be collapsed.
+ (Internally, we call that the 'strength' of the step.)
+
+ TODO: the PangoLayout usage is getting a bit hacky. We may want to
+ replace it with Cairo methods.
+*/
+
+#ifndef YGTK_STEPS_H
+#define YGTK_STEPS_H
+
+#include
+#include
+
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_STEPS (ygtk_steps_get_type ())
+#define YGTK_STEPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_STEPS, YGtkSteps))
+#define YGTK_STEPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_STEPS, YGtkStepsClass))
+#define YGTK_IS_STEPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_STEPS))
+#define YGTK_IS_STEPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_STEPS))
+#define YGTK_STEPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_STEPS, YGtkStepsClass))
+
+typedef struct _YGtkSteps
+{
+ GtkWidget parent;
+
+ // private:
+ GList *steps; // of YGtkSingleStep
+ guint current_step;
+ PangoLayout *check_mark_layout, *current_mark_layout;
+ // for current_mark little animation
+ guint current_mark_timeout_id, current_mark_frame;
+
+} YGtkSteps;
+
+typedef struct _YGtkStepsClass
+{
+ GtkWidgetClass parent_class;
+} YGtkStepsClass;
+
+typedef struct _YGtkSingleStep
+{
+ gboolean is_heading;
+ gchar *text;
+ guint strength; // check the text at top
+
+ // private -- don't access it, call ygtk_step_get_layout() instead
+ PangoLayout *layout, *layout_bold; // cache
+} YGtkSingleStep;
+
+GtkWidget* ygtk_steps_new (void);
+GType ygtk_steps_get_type (void) G_GNUC_CONST;
+
+guint ygtk_steps_append (YGtkSteps *steps, const gchar *label);
+void ygtk_steps_append_heading (YGtkSteps *steps, const gchar *heading);
+
+void ygtk_steps_advance (YGtkSteps *steps);
+void ygtk_steps_set_current (YGtkSteps *steps, guint step);
+guint ygtk_steps_total (YGtkSteps *steps);
+
+void ygtk_steps_clear (YGtkSteps *steps);
+
+G_END_DECLS
+
+#endif /* YGTK_STEPS_H */
Added: trunk/gtk/10_3/src/ygtktogglebutton.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtktogglebutton.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtktogglebutton.c (added)
+++ trunk/gtk/10_3/src/ygtktogglebutton.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,90 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkToggleButton widget */
+// check the header file for information about this widget
+
+#include
+#include "ygtktogglebutton.h"
+#include
+
+static guint toggle_changed_signal;
+
+G_DEFINE_TYPE (YGtkToggleButton, ygtk_toggle_button, GTK_TYPE_TOGGLE_BUTTON)
+
+static void ygtk_toggle_button_init (YGtkToggleButton *button)
+{
+}
+
+static void ygtk_toggle_button_destroy (GtkObject *object)
+{
+ GTK_OBJECT_CLASS (ygtk_toggle_button_parent_class)->destroy (object);
+ YGtkToggleButton *button = YGTK_TOGGLE_BUTTON (object);
+ if (button->group && !button->foreign_group) {
+ g_slist_free (button->group);
+ button->group = NULL;
+ }
+}
+
+static void ygtk_toggle_button_toggled (GtkToggleButton *toggle)
+{
+ GSList *group = YGTK_TOGGLE_BUTTON (toggle)->group;
+
+ if (gtk_toggle_button_get_active (toggle)) {
+ // disable any active
+ GSList *i;
+ for (i = group; i; i = i->next) {
+ GtkToggleButton *t = i->data;
+ if (t->active && t != toggle) {
+ gtk_toggle_button_set_active (t, FALSE);
+ break;
+ }
+ }
+
+ if (i) {
+ gint nb = g_slist_index (group, toggle);
+ g_signal_emit (YGTK_TOGGLE_BUTTON (toggle), toggle_changed_signal, 0, nb);
+ }
+ }
+ else {
+ // force it to be enabled, if no other is (other could be enabled; eg. when
+ // this code gets triggered from the previous case).
+ GSList *i;
+ for (i = group; i; i = i->next) {
+ GtkToggleButton *t = i->data;
+ if (t->active && t != toggle)
+ break;
+ }
+ if (!i)
+ gtk_toggle_button_set_active (toggle, TRUE);
+ }
+}
+
+GSList *ygtk_toggle_button_get_group (YGtkToggleButton *button)
+{
+ return button->group;
+}
+
+GtkWidget *ygtk_toggle_button_new (GSList *group)
+{
+ YGtkToggleButton *button = g_object_new (YGTK_TYPE_TOGGLE_BUTTON, NULL);
+ button->group = g_slist_append (group, button);
+ button->foreign_group = group != NULL;
+ return (GtkWidget *) button;
+}
+
+static void ygtk_toggle_button_class_init (YGtkToggleButtonClass *klass)
+{
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_toggle_button_destroy;
+
+ GtkToggleButtonClass *gtktogglebutton_class = GTK_TOGGLE_BUTTON_CLASS (klass);
+ gtktogglebutton_class->toggled = ygtk_toggle_button_toggled;
+
+ toggle_changed_signal = g_signal_new ("toggle-changed",
+ G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (YGtkToggleButtonClass, toggle_changed), NULL, NULL,
+ g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+}
+
Added: trunk/gtk/10_3/src/ygtktogglebutton.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtktogglebutton.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtktogglebutton.h (added)
+++ trunk/gtk/10_3/src/ygtktogglebutton.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,49 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkToggleButton extends GtkToggleButton to add groups, just like GtkRadioButtons.
+*/
+
+#ifndef YGTK_TOGGLE_BUTTON_H
+#define YGTK_TOGGLE_BUTTON_H
+
+#include
+G_BEGIN_DECLS
+
+#define YGTK_TYPE_TOGGLE_BUTTON (ygtk_toggle_button_get_type ())
+#define YGTK_TOGGLE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_TOGGLE_BUTTON, YGtkToggleButton))
+#define YGTK_TOGGLE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_TOGGLE_BUTTON, YGtkToggleButtonClass))
+#define YGTK_IS_TOGGLE_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_TOGGLE_BUTTON))
+#define YGTK_IS_TOGGLE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_TOGGLE_BUTTON))
+#define YGTK_TOGGLE_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_TOGGLE_BUTTON, YGtkToggleButtonClass))
+
+typedef struct _YGtkToggleButton
+{
+ GtkToggleButton parent;
+ // members:
+ GSList *group;
+ gboolean foreign_group; // (shouldn't be needed...)
+} YGtkToggleButton;
+
+typedef struct _YGtkToggleButtonClass
+{
+ GtkToggleButtonClass parent_class;
+
+ // signals:
+ void (*toggle_changed) (GtkToggleButton *toggle, gint nb);
+} YGtkToggleButtonClass;
+
+GtkWidget* ygtk_toggle_button_new (GSList *group);
+GType ygtk_toggle_button_get_type (void) G_GNUC_CONST;
+
+GSList *ygtk_toggle_button_get_group (YGtkToggleButton *button);
+
+G_END_DECLS
+#endif /*YGTK_TOGGLE_BUTTON_H*/
+
Added: trunk/gtk/10_3/src/ygtkwizard.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkwizard.c?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkwizard.c (added)
+++ trunk/gtk/10_3/src/ygtkwizard.c Fri Jan 18 12:58:22 2008
@@ -0,0 +1,1300 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkWizard widget */
+// check the header file for information about this widget
+
+#include
+#include "ygtkwizard.h"
+#include
+#include
+#include
+#include
+#include "ygtkhtmlwrap.h"
+#include "ygtksteps.h"
+#include "ygtkfindentry.h"
+
+#define BUTTONS_SPACING 12
+#define BORDER 4
+#define CHILD_BORDER 6
+
+// YGUtils bridge
+extern void ygutils_setWidgetFont (GtkWidget *widget, PangoWeight weight,
+ double scale);
+extern void ygutils_setStockIcon (GtkWidget *button, const char *ycp_str);
+
+//** YGtkHelpDialog
+
+G_DEFINE_TYPE (YGtkHelpDialog, ygtk_help_dialog, GTK_TYPE_WINDOW)
+
+// callbacks
+static void ygtk_help_dialog_find_next (YGtkHelpDialog *dialog)
+{
+ const gchar *text = gtk_entry_get_text (GTK_ENTRY (dialog->search_entry));
+ ygtk_html_wrap_search_next (dialog->help_text, text);
+}
+
+static void search_entry_modified_cb (GtkEditable *editable, YGtkHelpDialog *dialog)
+{
+ gchar *key = gtk_editable_get_chars (editable, 0, -1);
+ if (!ygtk_html_wrap_search (dialog->help_text, key)) {
+ GdkColor red = { 0, 255 << 8, 102 << 8, 102 << 8 },
+ white = { 0, 255 << 8, 255 << 8, 255 << 8 };
+ gtk_widget_modify_base (dialog->search_entry, GTK_STATE_NORMAL, &red);
+ gtk_widget_modify_text (dialog->search_entry, GTK_STATE_NORMAL, &white);
+ gdk_beep();
+ }
+ else {
+ gtk_widget_modify_base (dialog->search_entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_text (dialog->search_entry, GTK_STATE_NORMAL, NULL);
+ }
+ g_free (key);
+}
+static void search_entry_activated_cb (GtkEntry *entry, YGtkHelpDialog *dialog)
+{ ygtk_help_dialog_find_next (dialog); }
+static void close_button_clicked_cb (GtkButton *button, YGtkHelpDialog *dialog)
+{ gtk_widget_hide (GTK_WIDGET (dialog)); }
+
+static void ygtk_help_dialog_init (YGtkHelpDialog *dialog)
+{
+ gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
+ gtk_window_set_type_hint (GTK_WINDOW (dialog), GDK_WINDOW_TYPE_HINT_DIALOG);
+
+
+ gtk_window_set_title (GTK_WINDOW (dialog), "Help");
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 350);
+
+ // title
+ GtkStockItem help_item;
+ gtk_stock_lookup (GTK_STOCK_HELP, &help_item);
+
+ dialog->title_box = gtk_hbox_new (FALSE, 6);
+ gtk_container_set_border_width (GTK_CONTAINER (dialog->title_box), 6);
+ dialog->title_image = gtk_image_new_from_stock (GTK_STOCK_HELP,
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
+ dialog->title_label = gtk_label_new ("Help");
+ gtk_widget_modify_fg (dialog->title_label, GTK_STATE_NORMAL,
+ &dialog->title_label->style->fg [GTK_STATE_SELECTED]);
+ ygutils_setWidgetFont (dialog->title_label, PANGO_WEIGHT_ULTRABOLD,
+ PANGO_SCALE_LARGE);
+ gtk_box_pack_start (GTK_BOX (dialog->title_box), dialog->title_image,
+ FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (dialog->title_box), dialog->title_label,
+ FALSE, FALSE, 0);
+
+ // help text
+ dialog->help_box = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (dialog->help_box),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (dialog->help_box),
+ GTK_SHADOW_IN);
+ dialog->help_text = ygtk_html_wrap_new();
+ gtk_container_add (GTK_CONTAINER (dialog->help_box), dialog->help_text);
+
+ // bottom part (search entry + close button)
+ GtkWidget *bottom_box;
+ bottom_box = gtk_hbox_new (FALSE, 0);
+ dialog->search_entry = ygtk_find_entry_new();
+ gtk_widget_set_size_request (dialog->search_entry, 140, -1);
+ dialog->close_button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ GTK_WIDGET_SET_FLAGS (dialog->close_button, GTK_CAN_DEFAULT);
+
+ gtk_box_pack_start (GTK_BOX (bottom_box), dialog->search_entry, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (bottom_box), dialog->close_button, FALSE, FALSE, 0);
+
+ g_signal_connect (G_OBJECT (dialog->search_entry), "changed",
+ G_CALLBACK (search_entry_modified_cb), dialog);
+ g_signal_connect (G_OBJECT (dialog->search_entry), "activate",
+ G_CALLBACK (search_entry_activated_cb), dialog);
+
+ // glue it
+ dialog->vbox = gtk_vbox_new (FALSE, 12);
+ gtk_box_pack_start (GTK_BOX (dialog->vbox), dialog->title_box, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (dialog->vbox), dialog->help_box, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (dialog->vbox), bottom_box, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (dialog), dialog->vbox);
+ gtk_widget_show_all (dialog->vbox);
+
+ g_signal_connect (G_OBJECT (dialog->close_button), "clicked",
+ G_CALLBACK (close_button_clicked_cb), dialog);
+ g_signal_connect (G_OBJECT (dialog), "delete-event",
+ G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+}
+
+static void ygtk_help_dialog_realize (GtkWidget *widget)
+{
+ GTK_WIDGET_CLASS (ygtk_help_dialog_parent_class)->realize (widget);
+ YGtkHelpDialog *dialog = YGTK_HELP_DIALOG (widget);
+
+ // set help text background
+ gtk_widget_realize (dialog->help_text);
+ ygtk_html_wrap_set_background (dialog->help_text, THEMEDIR "/wizard/help-background.png");
+
+ // set close as default widget
+ gtk_widget_grab_default (dialog->close_button);
+ gtk_widget_grab_focus (dialog->close_button);
+}
+
+static gboolean ygtk_help_dialog_expose_event (GtkWidget *widget, GdkEventExpose *event)
+{
+ YGtkHelpDialog *dialog = YGTK_HELP_DIALOG (widget);
+
+ // draw rect on title
+ int x, y, w, h;
+ x = dialog->title_box->allocation.x;
+ y = dialog->title_box->allocation.y;
+ w = dialog->title_box->allocation.width;
+ h = dialog->title_box->allocation.height;
+ if (x + w >= event->area.x && x <= event->area.x + event->area.width &&
+ y + h >= event->area.y && x <= event->area.y + event->area.height) {
+ cairo_t *cr = gdk_cairo_create (widget->window);
+ gdk_cairo_set_source_color (cr, &widget->style->bg [GTK_STATE_SELECTED]);
+ cairo_rectangle (cr, x, y, w, h);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
+ }
+
+ gtk_container_propagate_expose (GTK_CONTAINER (dialog), dialog->vbox, event);
+ return FALSE;
+}
+
+static void ygtk_help_dialog_close (YGtkHelpDialog *dialog)
+{ gtk_widget_hide (GTK_WIDGET (dialog)); }
+
+GtkWidget *ygtk_help_dialog_new (GtkWindow *parent)
+{
+ GtkWidget *dialog = g_object_new (YGTK_TYPE_HELP_DIALOG, NULL);
+ if (parent)
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+ return dialog;
+}
+
+void ygtk_help_dialog_set_text (YGtkHelpDialog *dialog, const gchar *text)
+{
+ gtk_editable_delete_text (GTK_EDITABLE (dialog->search_entry), 0, -1);
+ ygtk_html_wrap_set_text (dialog->help_text, text);
+}
+
+static void ygtk_help_dialog_class_init (YGtkHelpDialogClass *klass)
+{
+ klass->find_next = ygtk_help_dialog_find_next;
+ klass->close = ygtk_help_dialog_close;
+
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->expose_event = ygtk_help_dialog_expose_event;
+ widget_class->realize = ygtk_help_dialog_realize;
+
+ // key bindings (F3 for next word, Esc to close the window)
+ g_signal_new ("find_next", G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (YGtkHelpDialogClass, find_next),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("close", G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (YGtkHelpDialogClass, close),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+ GtkBindingSet *binding_set = gtk_binding_set_by_class (klass);
+ gtk_binding_entry_add_signal (binding_set, GDK_F3, 0, "find_next", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0, "close", 0);
+}
+
+//** YGtkWizard
+
+static gint get_header_padding (GtkWidget *widget)
+{
+#if 0
+// TODO: read GtkAssistance style_rc attributes
+ gint padding;
+ gtk_widget_style_get (widget, "header-padding", &padding, NULL);
+ return padding;
+#else
+ return 6;
+#endif
+}
+
+static gint get_content_padding (GtkWidget *widget)
+{
+#if 0
+ gint padding;
+ gtk_widget_style_get (widget, "content-padding", &padding, NULL);
+ return padding;
+#else
+ return 1;
+#endif
+}
+
+// callbacks
+static void destroy_tree_path (gpointer data)
+{
+ GtkTreePath *path = data;
+ gtk_tree_path_free (path);
+}
+
+// signals
+static guint action_triggered_signal;
+
+static void ygtk_marshal_VOID__POINTER_INT (GClosure *closure,
+ GValue *return_value, guint n_param_values, const GValue *param_values,
+ gpointer invocation_hint, gpointer marshal_data)
+{
+ typedef void (*GMarshalFunc_VOID__POINTER_INT) (gpointer data1, gpointer arg_1,
+ gint arg_2, gpointer data2);
+ register GMarshalFunc_VOID__POINTER_INT callback;
+ register GCClosure *cc = (GCClosure*) closure;
+ register gpointer data1, data2;
+
+ g_return_if_fail (n_param_values == 3);
+
+ if (G_CCLOSURE_SWAP_DATA (closure)) {
+ data1 = closure->data;
+ data2 = g_value_peek_pointer (param_values + 0);
+ }
+ else {
+ data1 = g_value_peek_pointer (param_values + 0);
+ data2 = closure->data;
+ }
+ callback = (GMarshalFunc_VOID__POINTER_INT)
+ (marshal_data ? marshal_data : cc->callback);
+
+ callback (data1, g_value_get_pointer (param_values + 1),
+ g_value_get_int (param_values + 2), data2);
+}
+
+static void button_clicked_cb (GtkButton *button, YGtkWizard *wizard)
+{
+ gpointer id;
+ id = g_object_get_data (G_OBJECT (button), "ptr-id");
+ if (id)
+ g_signal_emit (wizard, action_triggered_signal, 0, id, G_TYPE_POINTER);
+ id = g_object_get_data (G_OBJECT (button), "str-id");
+ if (id)
+ g_signal_emit (wizard, action_triggered_signal, 0, id, G_TYPE_STRING);
+}
+
+static GtkWidget *button_new (YGtkWizard *wizard)
+{
+ GtkWidget *button = gtk_button_new_with_mnemonic ("");
+ GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (button_clicked_cb), wizard);
+ return button;
+}
+
+static void ygtk_wizard_popup_help (YGtkWizard *wizard)
+{
+ if (!wizard->m_help_dialog) {
+ GtkWindow *window = (GtkWindow *) gtk_widget_get_ancestor (
+ GTK_WIDGET (wizard), GTK_TYPE_WINDOW);
+ wizard->m_help_dialog = ygtk_help_dialog_new (window);
+ ygtk_help_dialog_set_text (YGTK_HELP_DIALOG (wizard->m_help_dialog),
+ wizard->m_help);
+ }
+ gtk_window_present (GTK_WINDOW (wizard->m_help_dialog));
+}
+
+static void help_button_clicked_cb (GtkWidget *button, YGtkWizard *wizard)
+{ ygtk_wizard_popup_help (wizard); }
+
+G_DEFINE_TYPE (YGtkWizard, ygtk_wizard, GTK_TYPE_BIN)
+
+static void ygtk_wizard_init (YGtkWizard *wizard)
+{
+ wizard->menu_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, NULL);
+ wizard->tree_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, destroy_tree_path);
+ wizard->steps_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, NULL);
+
+ gtk_container_set_border_width (GTK_CONTAINER (wizard), BORDER);
+ wizard->child_border_width = CHILD_BORDER;
+
+ //** Title
+ wizard->m_title = gtk_hbox_new (FALSE, 0);
+
+ wizard->m_title_image = gtk_image_new();
+ wizard->m_title_label = gtk_label_new("");
+ gtk_label_set_ellipsize (GTK_LABEL (wizard->m_title_label), PANGO_ELLIPSIZE_END);
+ gtk_misc_set_alignment (GTK_MISC (wizard->m_title_label), 0, 0.5);
+
+ // setup label look
+ gtk_widget_modify_fg (wizard->m_title_label, GTK_STATE_NORMAL,
+ &wizard->m_title_label->style->fg [GTK_STATE_SELECTED]);
+ // set a strong font to the heading label
+ ygutils_setWidgetFont (wizard->m_title_label, PANGO_WEIGHT_ULTRABOLD,
+ PANGO_SCALE_XX_LARGE);
+
+ gtk_box_pack_start (GTK_BOX (wizard->m_title), wizard->m_title_label,
+ TRUE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (wizard->m_title), wizard->m_title_image,
+ FALSE, FALSE, 0);
+
+ gtk_widget_set_parent (wizard->m_title, GTK_WIDGET (wizard));
+ gtk_widget_show_all (wizard->m_title);
+
+ //** Adding the bottom buttons
+ wizard->m_next_button = button_new (wizard);
+ wizard->m_back_button = button_new (wizard);
+ wizard->m_abort_button = button_new (wizard);
+ wizard->m_release_notes_button = button_new (wizard);
+
+ wizard->m_help_button = gtk_button_new_from_stock (GTK_STOCK_HELP);
+ GTK_WIDGET_SET_FLAGS (wizard->m_help_button, GTK_CAN_DEFAULT);
+ g_signal_connect (G_OBJECT (wizard->m_help_button), "clicked",
+ G_CALLBACK (help_button_clicked_cb), wizard);
+
+ // we need to protect this button against insensitive in some cases
+ // this is a flag to enable that
+ ygtk_wizard_protect_next_button (wizard, FALSE);
+
+ wizard->m_buttons = gtk_hbox_new (FALSE, 12);
+
+ gtk_box_pack_start (GTK_BOX (wizard->m_buttons), wizard->m_help_button, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (wizard->m_buttons), wizard->m_release_notes_button,
+ FALSE, TRUE, 0);
+
+ gtk_box_pack_end (GTK_BOX (wizard->m_buttons), wizard->m_next_button, FALSE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (wizard->m_buttons), wizard->m_back_button, FALSE, TRUE, 0);
+ gtk_box_pack_end (GTK_BOX (wizard->m_buttons), wizard->m_abort_button, FALSE, TRUE, 0);
+
+ gtk_widget_set_parent (wizard->m_buttons, GTK_WIDGET (wizard));
+ gtk_widget_show (wizard->m_buttons);
+
+ // make buttons all having the same size
+ GtkSizeGroup *buttons_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+ gtk_size_group_add_widget (buttons_group, wizard->m_help_button);
+ gtk_size_group_add_widget (buttons_group, wizard->m_release_notes_button);
+ gtk_size_group_add_widget (buttons_group, wizard->m_next_button);
+ gtk_size_group_add_widget (buttons_group, wizard->m_back_button);
+ gtk_size_group_add_widget (buttons_group, wizard->m_abort_button);
+ g_object_unref (G_OBJECT (buttons_group));
+
+ //** The menu and the navigation widgets will be created when requested.
+ //** Help dialog will be build on realize so we can give it a parent window.
+}
+
+static void ygtk_wizard_realize (GtkWidget *widget)
+{
+ GTK_WIDGET_CLASS (ygtk_wizard_parent_class)->realize (widget);
+ YGtkWizard *wizard = YGTK_WIZARD (widget);
+ gtk_widget_grab_default (wizard->m_next_button);
+ gtk_widget_grab_focus (wizard->m_next_button);
+}
+
+static void destroy_hash (GHashTable **hash)
+{
+ if (*hash)
+ g_hash_table_destroy (*hash);
+ *hash = NULL;
+}
+
+static void ygtk_wizard_destroy (GtkObject *object)
+{
+ GTK_OBJECT_CLASS (ygtk_wizard_parent_class)->destroy (object);
+
+ YGtkWizard *wizard = YGTK_WIZARD (object);
+
+ destroy_hash (&wizard->menu_ids);
+ destroy_hash (&wizard->tree_ids);
+ destroy_hash (&wizard->steps_ids);
+
+ if (wizard->m_help) {
+ g_free (wizard->m_help);
+ wizard->m_help = NULL;
+ }
+
+/* We must unparent these widgets from the wizard as they would try
+ to use gtk_container_remove() on it. We ref them since we still
+ want to call destroy on them so they children die. */
+#define DESTROY_WIDGET(widget) \
+ if (widget) { \
+ gtk_widget_unparent (widget); \
+ widget = NULL; \
+ }
+ DESTROY_WIDGET (wizard->m_title)
+ DESTROY_WIDGET (wizard->m_buttons)
+ DESTROY_WIDGET (wizard->m_menu)
+ DESTROY_WIDGET (wizard->m_steps)
+ DESTROY_WIDGET (wizard->m_title)
+#undef DESTROY_WIDGET
+
+ if (wizard->m_help_dialog) {
+ gtk_widget_destroy (wizard->m_help_dialog);
+ wizard->m_help_dialog = NULL;
+ }
+}
+
+GtkWidget *ygtk_wizard_new (void)
+{
+ return g_object_new (YGTK_TYPE_WIZARD, NULL);
+}
+
+static void selected_menu_item_cb (GtkMenuItem *item, const char *id)
+{
+ YGtkWizard *wizard = g_object_get_data (G_OBJECT (item), "wizard");
+ g_signal_emit (wizard, action_triggered_signal, 0, id, G_TYPE_STRING);
+}
+
+static void tree_item_selected_cb (GtkTreeView *tree_view, YGtkWizard *wizard)
+{
+ const gchar *id = ygtk_wizard_get_tree_selection (wizard);
+ if (id)
+ g_signal_emit (wizard, action_triggered_signal, 0, id, G_TYPE_STRING);
+}
+
+void ygtk_wizard_enable_steps (YGtkWizard *wizard)
+{
+ g_return_if_fail (wizard->m_steps == NULL);
+
+ wizard->m_steps = ygtk_steps_new();
+ gtk_widget_modify_text (wizard->m_steps, GTK_STATE_NORMAL,
+ &wizard->m_steps->style->fg [GTK_STATE_SELECTED]);
+
+ gtk_widget_set_parent (wizard->m_steps, GTK_WIDGET (wizard));
+ gtk_widget_show (wizard->m_steps);
+ gtk_widget_queue_resize (GTK_WIDGET (wizard));
+}
+
+void ygtk_wizard_enable_tree (YGtkWizard *wizard)
+{
+ g_return_if_fail (wizard->m_tree == NULL);
+
+ wizard->m_tree_view = gtk_tree_view_new_with_model
+ (GTK_TREE_MODEL (gtk_tree_store_new (1, G_TYPE_STRING)));
+ gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (wizard->m_tree_view),
+ 0, "", gtk_cell_renderer_text_new(), "text", 0, NULL);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (wizard->m_tree_view), FALSE);
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
+ GTK_TREE_VIEW (wizard->m_tree_view)), GTK_SELECTION_BROWSE);
+
+ g_signal_connect (G_OBJECT (wizard->m_tree_view), "cursor-changed",
+ G_CALLBACK (tree_item_selected_cb), wizard);
+
+ wizard->m_tree = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wizard->m_tree),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (wizard->m_tree),
+ GTK_SHADOW_IN);
+
+ gtk_container_add (GTK_CONTAINER (wizard->m_tree), wizard->m_tree_view);
+ gtk_widget_set_size_request (wizard->m_tree, 180, -1);
+
+ GtkWidget *child = wizard->m_child, *pane;
+ pane = gtk_hpaned_new();
+ gtk_paned_pack1 (GTK_PANED (pane), wizard->m_tree, TRUE, TRUE);
+ gtk_widget_show_all (pane);
+ ygtk_wizard_set_child (wizard, pane);
+ wizard->m_pane = pane;
+ if (child)
+ gtk_container_add (GTK_CONTAINER (wizard), child);
+ gtk_paned_set_position (GTK_PANED (pane), 180);
+}
+
+static void ygtk_wizard_add_child (GtkContainer *container, GtkWidget *child)
+{
+ YGtkWizard *wizard = YGTK_WIZARD (container);
+ wizard->m_child = child;
+ if (wizard->m_pane)
+ gtk_paned_pack2 (GTK_PANED (wizard->m_pane), child, TRUE, FALSE);
+ else
+ GTK_CONTAINER_CLASS (ygtk_wizard_parent_class)->add (container, child);
+}
+
+static void ygtk_wizard_remove_child (GtkContainer *container, GtkWidget *child)
+{
+ YGtkWizard *wizard = YGTK_WIZARD (container);
+ wizard->m_child = NULL;
+ if (wizard->m_pane && child != wizard->m_pane)
+ gtk_container_remove (GTK_CONTAINER (wizard->m_pane), child);
+ else
+ GTK_CONTAINER_CLASS (ygtk_wizard_parent_class)->remove (container, child);
+}
+
+void ygtk_wizard_set_child (YGtkWizard *wizard, GtkWidget *new_child)
+{
+ if (wizard->m_child)
+ gtk_container_remove (GTK_CONTAINER (wizard), wizard->m_child);
+ if (new_child)
+ gtk_container_add (GTK_CONTAINER (wizard), new_child);
+}
+
+#define ENABLE_WIDGET(enable, widget) \
+ (enable ? gtk_widget_show (widget) : gtk_widget_hide (widget))
+#define ENABLE_WIDGET_STR(str, widget) \
+ (str && str[0] ? gtk_widget_show (widget) : gtk_widget_hide (widget))
+
+/* Commands */
+
+void ygtk_wizard_set_help_text (YGtkWizard *wizard, const gchar *text)
+{
+ if (wizard->m_help)
+ g_free (wizard->m_help);
+ wizard->m_help = g_strdup (text);
+ if (wizard->m_help_dialog)
+ ygtk_help_dialog_set_text (YGTK_HELP_DIALOG (wizard->m_help_dialog), text);
+ ENABLE_WIDGET_STR (text, wizard->m_help_button);
+}
+
+gboolean ygtk_wizard_add_tree_item (YGtkWizard *wizard, const char *parent_id,
+ const char *text, const char *id)
+{
+ GtkTreeModel *model = gtk_tree_view_get_model
+ (GTK_TREE_VIEW (wizard->m_tree_view));
+ GtkTreeIter iter;
+
+ if (!parent_id || !*parent_id)
+ gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
+ else {
+ GtkTreePath *path = g_hash_table_lookup (wizard->tree_ids, parent_id);
+ if (path == NULL)
+ return FALSE;
+ GtkTreeIter parent_iter;
+ gtk_tree_model_get_iter (model, &parent_iter, path);
+ gtk_tree_store_append (GTK_TREE_STORE (model), &iter, &parent_iter);
+ }
+
+ gtk_tree_store_set (GTK_TREE_STORE (model), &iter, 0, text, -1);
+ g_hash_table_insert (wizard->tree_ids, g_strdup (id),
+ gtk_tree_model_get_path (model, &iter));
+ return TRUE;
+}
+
+/* this is g_hash_table_remove_all in new glib */
+static gboolean hash_table_clear_cb (gpointer key, gpointer value, gpointer data)
+{
+ return TRUE;
+}
+static void yg_hash_table_remove_all (GHashTable *hash_table)
+{
+ g_hash_table_foreach_remove (hash_table, hash_table_clear_cb, NULL);
+}
+
+void ygtk_wizard_clear_tree (YGtkWizard *wizard)
+{
+ GtkTreeView *tree = GTK_TREE_VIEW (wizard->m_tree_view);
+ gtk_tree_store_clear (GTK_TREE_STORE (gtk_tree_view_get_model (tree)));
+ yg_hash_table_remove_all (wizard->tree_ids);
+}
+
+gboolean ygtk_wizard_select_tree_item (YGtkWizard *wizard, const char *id)
+{
+ GtkTreePath *path = g_hash_table_lookup (wizard->tree_ids, id);
+ if (path == NULL)
+ return FALSE;
+
+ g_signal_handlers_block_by_func (wizard->m_tree_view,
+ (gpointer) tree_item_selected_cb, wizard);
+
+ GtkWidget *widget = wizard->m_tree_view;
+ gtk_tree_view_expand_to_path (GTK_TREE_VIEW (widget), path);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), path,
+ NULL, FALSE);
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (widget), path, NULL,
+ TRUE, 0.5, 0.5);
+
+ g_signal_handlers_unblock_by_func (wizard->m_tree_view,
+ (gpointer) tree_item_selected_cb, wizard);
+ return TRUE;
+}
+
+void ygtk_wizard_set_header_text (YGtkWizard *wizard, GtkWindow *window,
+ const char *text)
+{
+ gtk_label_set_text (GTK_LABEL (wizard->m_title_label), text);
+ if (window) {
+ char *title = g_strdup_printf ("%s - YaST", text);
+ gtk_window_set_title (window, title);
+ g_free (title);
+ }
+}
+
+gboolean ygtk_wizard_set_header_icon (YGtkWizard *wizard, GtkWindow *window,
+ const char *icon)
+{
+ GError *error = 0;
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (icon, &error);
+ if (!pixbuf)
+ return FALSE;
+
+ gtk_image_set_from_pixbuf (GTK_IMAGE (wizard->m_title_image), pixbuf);
+ if (window)
+ gtk_window_set_icon (window, pixbuf);
+ g_object_unref (G_OBJECT (pixbuf));
+ return TRUE;
+}
+
+void ygtk_wizard_set_abort_button_label (YGtkWizard *wizard, const char *text)
+{
+ gtk_button_set_label (GTK_BUTTON (wizard->m_abort_button), text);
+ ENABLE_WIDGET_STR (text, wizard->m_abort_button);
+ ygutils_setStockIcon (wizard->m_abort_button, text);
+}
+
+void ygtk_wizard_set_back_button_label (YGtkWizard *wizard, const char *text)
+{
+ gtk_button_set_label (GTK_BUTTON (wizard->m_back_button), text);
+ ENABLE_WIDGET_STR (text, wizard->m_back_button);
+ ygutils_setStockIcon (wizard->m_back_button, text);
+}
+
+void ygtk_wizard_set_next_button_label (YGtkWizard *wizard, const char *text)
+{
+ gtk_button_set_label (GTK_BUTTON (wizard->m_next_button), text);
+ ENABLE_WIDGET_STR (text, wizard->m_next_button);
+ ygutils_setStockIcon (wizard->m_next_button, text);
+}
+
+void ygtk_wizard_set_back_button_ptr_id (YGtkWizard *wizard, gpointer id, GDestroyNotify destroy_cb)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_back_button), "ptr-id", id, destroy_cb);
+}
+
+void ygtk_wizard_set_next_button_ptr_id (YGtkWizard *wizard, gpointer id, GDestroyNotify destroy_cb)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_next_button), "ptr-id", id, destroy_cb);
+}
+
+void ygtk_wizard_set_abort_button_ptr_id (YGtkWizard *wizard, gpointer id, GDestroyNotify destroy_cb)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_abort_button), "ptr-id", id, destroy_cb);
+}
+
+void ygtk_wizard_set_release_notes_button_ptr_id (YGtkWizard *wizard, gpointer id, GDestroyNotify destroy_cb)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_release_notes_button), "ptr-id", id, destroy_cb);
+}
+
+void ygtk_wizard_set_back_button_str_id (YGtkWizard *wizard, const char *id)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_back_button), "str-id",
+ g_strdup (id), g_free);
+}
+
+void ygtk_wizard_set_next_button_str_id (YGtkWizard *wizard, const char *id)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_next_button), "str-id",
+ g_strdup (id), g_free);
+}
+
+void ygtk_wizard_set_abort_button_str_id (YGtkWizard *wizard, const char *id)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_abort_button), "str-id",
+ g_strdup (id), g_free);
+}
+
+void ygtk_wizard_set_release_notes_button_str_id (YGtkWizard *wizard, const char *id)
+{
+ g_object_set_data_full (G_OBJECT (wizard->m_release_notes_button), "str-id",
+ g_strdup (id), g_free);
+}
+
+void ygtk_wizard_set_release_notes_button_label (YGtkWizard *wizard, const gchar *text)
+{
+ gtk_button_set_label (GTK_BUTTON (wizard->m_release_notes_button), text);
+ gtk_widget_show (wizard->m_release_notes_button);
+}
+
+void ygtk_wizard_show_release_notes_button (YGtkWizard *wizard, gboolean enable)
+{
+ ENABLE_WIDGET (enable, wizard->m_release_notes_button);
+}
+
+void ygtk_wizard_enable_back_button (YGtkWizard *wizard, gboolean enable)
+{
+ gtk_widget_set_sensitive (GTK_WIDGET (wizard->m_back_button), enable);
+}
+
+void ygtk_wizard_enable_next_button (YGtkWizard *wizard, gboolean enable)
+{
+ if (enable || !ygtk_wizard_is_next_button_protected (wizard))
+ gtk_widget_set_sensitive (GTK_WIDGET (wizard->m_next_button), enable);
+}
+
+void ygtk_wizard_enable_abort_button (YGtkWizard *wizard, gboolean enable)
+{
+ gtk_widget_set_sensitive (GTK_WIDGET (wizard->m_abort_button), enable);
+}
+
+gboolean ygtk_wizard_is_next_button_protected (YGtkWizard *wizard)
+{
+ return GPOINTER_TO_INT (g_object_get_data (
+ G_OBJECT (wizard->m_next_button), "protect"));
+}
+
+void ygtk_wizard_protect_next_button (YGtkWizard *wizard, gboolean protect)
+{
+ g_object_set_data (G_OBJECT (wizard->m_abort_button), "protect",
+ GINT_TO_POINTER (protect));
+}
+
+void ygtk_wizard_focus_next_button (YGtkWizard *wizard)
+{
+ gtk_widget_grab_focus (wizard->m_next_button);
+}
+
+void ygtk_wizard_focus_back_button (YGtkWizard *wizard)
+{
+ gtk_widget_grab_focus (wizard->m_back_button);
+}
+
+void ygtk_wizard_add_menu (YGtkWizard *wizard, const char *text,
+ const char *id)
+{
+ if (!wizard->m_menu) {
+ wizard->m_menu = gtk_menu_bar_new();
+ gtk_widget_set_parent (wizard->m_menu, GTK_WIDGET (wizard));
+ gtk_widget_queue_draw (GTK_WIDGET (wizard));
+ }
+
+ GtkWidget *entry = gtk_menu_item_new_with_mnemonic (text);
+ gtk_menu_shell_append (GTK_MENU_SHELL (wizard->m_menu), entry);
+
+ GtkWidget *submenu = gtk_menu_new();
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (entry), submenu);
+
+ g_hash_table_insert (wizard->menu_ids, g_strdup (id), submenu);
+ gtk_widget_show_all (wizard->m_menu);
+}
+
+gboolean ygtk_wizard_add_menu_entry (YGtkWizard *wizard, const char *parent_id,
+ const char *text, const char *id)
+{
+ GtkWidget *parent = g_hash_table_lookup (wizard->menu_ids, parent_id);
+ if (!parent)
+ return FALSE;
+
+ GtkWidget *entry = gtk_menu_item_new_with_mnemonic (text);
+ gtk_menu_shell_append (GTK_MENU_SHELL (parent), entry);
+ gtk_widget_show (entry);
+
+ // we need to get YGtkWizard to send signal
+ g_object_set_data (G_OBJECT (entry), "wizard", wizard);
+ g_signal_connect_data (G_OBJECT (entry), "activate",
+ G_CALLBACK (selected_menu_item_cb), g_strdup (id),
+ (GClosureNotify) g_free, 0);
+ return TRUE;
+}
+
+gboolean ygtk_wizard_add_sub_menu (YGtkWizard *wizard, const char *parent_id,
+ const char *text, const char *id)
+{
+ GtkWidget *parent = g_hash_table_lookup (wizard->menu_ids, parent_id);
+ if (!parent)
+ return FALSE;
+
+ GtkWidget *entry = gtk_menu_item_new_with_mnemonic (text);
+ gtk_menu_shell_append (GTK_MENU_SHELL (parent), entry);
+
+ GtkWidget *submenu = gtk_menu_new();
+ gtk_menu_item_set_submenu (GTK_MENU_ITEM (entry), submenu);
+
+ g_hash_table_insert (wizard->menu_ids, g_strdup (id), submenu);
+ gtk_widget_show_all (entry);
+ return TRUE;
+}
+
+gboolean ygtk_wizard_add_menu_separator (YGtkWizard *wizard, const char *parent_id)
+{
+ GtkWidget *parent = g_hash_table_lookup (wizard->menu_ids, parent_id);
+ if (!parent)
+ return FALSE;
+
+ GtkWidget *separator = gtk_separator_menu_item_new();
+ gtk_menu_shell_append (GTK_MENU_SHELL (parent), separator);
+ gtk_widget_show (separator);
+ return TRUE;
+}
+
+void ygtk_wizard_clear_menu (YGtkWizard *wizard)
+{
+ if (!wizard->m_menu)
+ return;
+ yg_hash_table_remove_all (wizard->menu_ids);
+ GList *children = gtk_container_get_children (GTK_CONTAINER (wizard->m_menu)), *i;
+ for (i = children; i; i = i->next) {
+ GtkWidget *child = (GtkWidget *) i->data;
+ gtk_container_remove (GTK_CONTAINER (wizard->m_menu), child);
+ }
+}
+
+void ygtk_wizard_add_step_header (YGtkWizard *wizard, const char *text)
+{
+ g_return_if_fail (wizard->m_steps != NULL);
+ ygtk_steps_append_heading (YGTK_STEPS (wizard->m_steps), text);
+}
+
+void ygtk_wizard_add_step (YGtkWizard *wizard, const char* text, const char *id)
+{
+ guint step_nb;
+ g_return_if_fail (wizard->m_steps != NULL);
+ step_nb = ygtk_steps_append (YGTK_STEPS (wizard->m_steps), text);
+ g_hash_table_insert (wizard->steps_ids, g_strdup (id), GINT_TO_POINTER (step_nb));
+}
+
+gboolean ygtk_wizard_set_current_step (YGtkWizard *wizard, const char *id)
+{
+ gpointer step_nb = g_hash_table_lookup (wizard->steps_ids, id);
+ if (!step_nb)
+ return FALSE;
+ ygtk_steps_set_current (YGTK_STEPS (wizard->m_steps), GPOINTER_TO_INT (step_nb));
+ return TRUE;
+}
+
+void ygtk_wizard_clear_steps (YGtkWizard *wizard)
+{
+ ygtk_steps_clear (YGTK_STEPS (wizard->m_steps));
+ yg_hash_table_remove_all (wizard->steps_ids);
+}
+
+static const gchar *found_key;
+static void hash_lookup_tree_path_value (gpointer _key, gpointer _value,
+ gpointer user_data)
+{
+ gchar *key = _key;
+ GtkTreePath *value = _value;
+ GtkTreePath *needle = user_data;
+
+ if (gtk_tree_path_compare (value, needle) == 0)
+ found_key = key;
+}
+
+const gchar *ygtk_wizard_get_tree_selection (YGtkWizard *wizard)
+{
+ GtkTreePath *path;
+ gtk_tree_view_get_cursor (GTK_TREE_VIEW (wizard->m_tree_view),
+ &path, NULL);
+ if (path == NULL)
+ return NULL;
+
+ /* A more elegant solution would be using a crossed hash table, but there
+ is none out of box, so we'll just iterate the hash table. */
+ found_key = 0;
+ g_hash_table_foreach (wizard->tree_ids, hash_lookup_tree_path_value, path);
+
+ gtk_tree_path_free (path);
+ return found_key;
+}
+
+void ygtk_wizard_set_sensitive (YGtkWizard *wizard, gboolean sensitive)
+{
+ // TODO: check if this chains through
+ gtk_widget_set_sensitive (GTK_WIDGET (wizard), sensitive);
+
+ if (ygtk_wizard_is_next_button_protected (wizard))
+ gtk_widget_set_sensitive (wizard->m_next_button, TRUE);
+}
+
+static void ygtk_wizard_size_request (GtkWidget *widget, GtkRequisition *requisition)
+{
+ YGtkWizard *wizard = YGTK_WIZARD (widget);
+
+ gint border = GTK_CONTAINER (wizard)->border_width;
+ gint child_border = wizard->child_border_width;
+ gint header_padding = get_header_padding (GTK_WIDGET (wizard));
+ gint content_padding = get_content_padding (GTK_WIDGET (wizard));
+ GtkRequisition req; // temp usage
+
+ requisition->width = 0;
+ requisition->height = border * 2;
+
+ if (wizard->m_menu) {
+ gtk_widget_size_request (wizard->m_menu, &req);
+ requisition->width = MAX (requisition->width, req.width);
+ requisition->height += req.height;
+ }
+
+ // title
+ gtk_widget_size_request (wizard->m_title, &req);
+ req.width += header_padding * 2 + border*2;
+ req.height += header_padding * 2;
+
+ requisition->width = MAX (MIN (req.width, 40), requisition->width);
+ requisition->height += req.height;
+
+ // body
+ {
+ GtkRequisition nav_req, child_req;
+
+ if (wizard->m_steps) {
+ gtk_widget_size_request (wizard->m_steps, &nav_req);
+ nav_req.width += content_padding * 2;
+ nav_req.height += content_padding * 2;
+ }
+ else
+ nav_req.width = nav_req.height = 0;
+
+ GtkWidget *child = GTK_BIN (wizard)->child;
+ if (child && GTK_WIDGET_VISIBLE (child))
+ gtk_widget_size_request (child, &child_req);
+ else
+ child_req.width = child_req.height = 0;
+ child_req.width += content_padding * 2 + child_border*2;
+ child_req.height += content_padding * 2 + child_border*2;
+
+ req.width = nav_req.width + child_req.width + border*2;
+ req.height = MAX (nav_req.height, child_req.height);
+
+ requisition->width = MAX (requisition->width, req.width);
+ requisition->height += req.height;
+ }
+
+ // buttons
+ gtk_widget_size_request (wizard->m_buttons, &req);
+ req.width += border*2;
+ req.height += BUTTONS_SPACING + border;
+
+ requisition->width = MAX (requisition->width, req.width);
+ requisition->height += req.height;
+}
+
+// helper -- applies padding to a GtkAllocation
+static inline void apply_allocation_padding (GtkAllocation *alloc, gint padding)
+{
+ alloc->x += padding;
+ alloc->y += padding;
+ alloc->width -= padding * 2;
+ alloc->height -= padding * 2;
+}
+
+static void ygtk_wizard_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
+{
+ YGtkWizard *wizard = YGTK_WIZARD (widget);
+
+ gint border = GTK_CONTAINER (wizard)->border_width;
+ gint header_padding = get_header_padding (widget);
+ gint content_padding = get_content_padding (widget);
+ GtkRequisition req; // temp usage
+ // we use "areas" because we need to do some tweaking when doing the actual
+ // allocation and this makes it easier to place the other widgets.
+ GtkAllocation menu_area, title_area, nav_area, child_area, buttons_area;
+
+ // menu
+ menu_area.x = allocation->x;
+ menu_area.y = allocation->y;
+ if (wizard->m_menu) {
+ gtk_widget_get_child_requisition (wizard->m_menu, &req);
+ menu_area.width = allocation->width;
+ menu_area.height = req.height;
+ }
+ else
+ menu_area.width = menu_area.height = 0;
+
+ // title
+ gtk_widget_get_child_requisition (wizard->m_title, &req);
+ title_area.x = allocation->x + border;
+ title_area.y = menu_area.y + menu_area.height + border;
+ title_area.width = allocation->width - border*2;
+ title_area.height = req.height + header_padding*2;
+
+ // buttons
+ gtk_widget_get_child_requisition (wizard->m_buttons, &req);
+ buttons_area.x = title_area.x;
+ buttons_area.y = (allocation->y + allocation->height) - req.height - border;
+ buttons_area.width = title_area.width;
+ buttons_area.height = req.height;
+
+ // child (aka content aka containee)
+ child_area.x = title_area.x;
+ child_area.y = title_area.y + title_area.height;
+ child_area.width = title_area.width;
+ child_area.height = allocation->height - menu_area.height - title_area.height -
+ buttons_area.height - border*2 - BUTTONS_SPACING;
+
+ // navigation pane
+ nav_area.x = child_area.x;
+ nav_area.y = child_area.y;
+ nav_area.height = child_area.height;
+ if (wizard->m_steps) {
+ gtk_widget_get_child_requisition (wizard->m_steps, &req);
+ nav_area.width = req.width + content_padding*2;
+
+ child_area.x += nav_area.width;
+ child_area.width -= nav_area.width;
+ /* // align to child
+ title_area.x += nav_area.width;
+ title_area.width -= nav_area.width;*/
+ }
+ else
+ nav_area.width = 0;
+
+ // Actual allocations
+ // menu
+ if (wizard->m_menu)
+ gtk_widget_size_allocate (wizard->m_menu, &menu_area);
+
+ // title
+ apply_allocation_padding (&title_area, header_padding);
+ gtk_widget_size_allocate (wizard->m_title, &title_area);
+
+ // child
+ GtkWidget *child = GTK_BIN (wizard)->child;
+ if (child && GTK_WIDGET_VISIBLE (child)) {
+ apply_allocation_padding (&child_area, content_padding + wizard->child_border_width);
+ gtk_widget_size_allocate (child, &child_area);
+ }
+
+ // navigation pane
+ if (wizard->m_steps) {
+ apply_allocation_padding (&nav_area, content_padding);
+ gtk_widget_size_allocate (wizard->m_steps, &nav_area);
+ }
+
+ // buttons
+ gtk_widget_size_allocate (wizard->m_buttons, &buttons_area);
+
+ GTK_WIDGET_CLASS (ygtk_wizard_parent_class)->size_allocate (widget, allocation);
+}
+
+static gboolean ygtk_wizard_expose_event (GtkWidget *widget, GdkEventExpose *event)
+{
+ if (!GTK_WIDGET_DRAWABLE (widget))
+ return FALSE;
+ YGtkWizard *wizard = YGTK_WIZARD (widget);
+
+ gint border = GTK_CONTAINER (wizard)->border_width;
+ gint header_padding = get_header_padding (widget);
+ gint content_padding = get_content_padding (widget);
+
+ // paint a colored box
+ cairo_t *cr = gdk_cairo_create (widget->window);
+ int x, y, w, h;
+
+ // (outer rectangle)
+ x = border;
+ y = border;
+ w = widget->allocation.width - border*2;
+ h = wizard->m_buttons->allocation.y - border - BUTTONS_SPACING;
+ if (wizard->m_menu) {
+ y += wizard->m_menu->allocation.height;
+ h -= wizard->m_menu->allocation.height;
+ }
+
+ gdk_cairo_set_source_color (cr, &widget->style->bg [GTK_STATE_SELECTED]);
+ cairo_rectangle (cr, x, y, w, h);
+ cairo_fill (cr);
+
+ // (inner rectangle)
+ x += content_padding;
+ w -= content_padding*2;
+ y += wizard->m_title->allocation.height + header_padding*2 + content_padding;
+ h -= wizard->m_title->allocation.height + header_padding*2 + content_padding*2;
+ if (wizard->m_steps) {
+ int steps_w = wizard->m_steps->allocation.width;
+ x += steps_w + content_padding;
+ w -= steps_w + content_padding;
+ }
+
+ gdk_cairo_set_source_color (cr, &widget->style->bg [GTK_STATE_NORMAL]);
+ cairo_rectangle (cr, x, y, w, h);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
+
+ // propagate expose
+ GtkContainer *container = GTK_CONTAINER (wizard);
+ if (wizard->m_menu)
+ gtk_container_propagate_expose (container, wizard->m_menu, event);
+ gtk_container_propagate_expose (container, wizard->m_title, event);
+ if (wizard->m_steps)
+ gtk_container_propagate_expose (container, wizard->m_steps, event);
+ gtk_container_propagate_expose (container, wizard->m_buttons, event);
+ if (GTK_BIN (container)->child)
+ gtk_container_propagate_expose (container, GTK_BIN (container)->child, event);
+ return TRUE;
+}
+
+static void ygtk_wizard_forall (GtkContainer *container, gboolean include_internals,
+ GtkCallback callback, gpointer callback_data)
+{
+ YGtkWizard *wizard = YGTK_WIZARD (container);
+ if (include_internals) {
+ (*callback) (wizard->m_title, callback_data);
+ (*callback) (wizard->m_buttons, callback_data);
+ if (wizard->m_menu)
+ (*callback) (wizard->m_menu, callback_data);
+ if (wizard->m_steps)
+ (*callback) (wizard->m_steps, callback_data);
+ }
+
+ GtkWidget *containee = GTK_BIN (container)->child;
+ if (containee)
+ (*callback) (containee, callback_data);
+}
+
+//** Accessibility hooks
+
+static gint ygtk_wizard_accessible_get_n_children (AtkObject *accessible)
+{
+ GtkWidget *widget = GTK_ACCESSIBLE (accessible)->widget;
+ if (!widget)
+ return 0;
+ YGtkWizard *wizard = YGTK_WIZARD (widget);
+ int nb = 1 /*content*/ + 5 /* buttons */;
+ if (wizard->m_tree_view)
+ nb++; /* side navigator */
+ return nb;
+}
+
+static AtkObject *ygtk_wizard_accessible_ref_child (AtkObject *accessible, gint index)
+{
+ GtkWidget *widget = GTK_ACCESSIBLE (accessible)->widget;
+ if (!widget)
+ return NULL;
+ YGtkWizard *wizard = YGTK_WIZARD (widget);
+ GtkWidget *child = 0;
+ if (wizard->m_tree_view) {
+ if (index == 0)
+ child = wizard->m_tree_view;
+ index--;
+ }
+ switch (index) {
+ case 0:
+ child = wizard->m_child;
+ break;
+ case 1:
+ child = wizard->m_help_button;
+ break;
+ case 2:
+ child = wizard->m_abort_button;
+ break;
+ case 3:
+ child = wizard->m_back_button;
+ break;
+ case 4:
+ child = wizard->m_next_button;
+ break;
+ case 5:
+ if (GTK_WIDGET_VISIBLE (wizard->m_release_notes_button))
+ child = wizard->m_release_notes_button;
+ break;
+ default:
+ break;
+ }
+
+ if (child) {
+ AtkObject *obj = gtk_widget_get_accessible (child);
+ return g_object_ref (obj);
+ }
+ return NULL;
+}
+
+static void ygtk_wizard_accessible_class_init (AtkObjectClass *class)
+{
+ class->get_n_children = ygtk_wizard_accessible_get_n_children;
+ class->ref_child = ygtk_wizard_accessible_ref_child;
+}
+
+static GType ygtk_wizard_accessible_get_type (void)
+{
+ static GType type = 0;
+ if (!type) {
+ GType derived_type = g_type_parent (YGTK_TYPE_WIZARD);
+ AtkObjectFactory *factory;
+ GType derived_atk_type;
+ GTypeQuery query;
+ factory = atk_registry_get_factory (atk_get_default_registry(), derived_type);
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ g_type_query (derived_atk_type, &query);
+ type = g_type_register_static_simple (derived_atk_type,
+ "YGtkWizardAccessible", query.class_size,
+ (GClassInitFunc) ygtk_wizard_accessible_class_init, query.instance_size,
+ NULL, 0);
+ }
+ return type;
+}
+
+static AtkObject *ygtk_wizard_accessible_new (GObject *obj)
+{
+ g_return_val_if_fail (YGTK_IS_WIZARD (obj), NULL);
+ AtkObject *accessible = g_object_new (ygtk_wizard_accessible_get_type (), NULL);
+ atk_object_initialize (accessible, obj);
+ return accessible;
+}
+
+static GType ygtk_wizard_accessible_factory_get_accessible_type (void)
+{
+ return ygtk_wizard_accessible_get_type();
+}
+
+static AtkObject*ygtk_wizard_accessible_factory_create_accessible (GObject *obj)
+{
+ return ygtk_wizard_accessible_new (obj);
+}
+
+static void ygtk_wizard_accessible_factory_class_init (AtkObjectFactoryClass *class)
+{
+ class->create_accessible = ygtk_wizard_accessible_factory_create_accessible;
+ class->get_accessible_type = ygtk_wizard_accessible_factory_get_accessible_type;
+}
+
+static GType ygtk_wizard_accessible_factory_get_type (void)
+{
+ static GType type = 0;
+ if (!type) {
+ type = g_type_register_static_simple (ATK_TYPE_OBJECT_FACTORY,
+ "YGtkWizardAccessibleFactory", sizeof (AtkObjectFactoryClass),
+ (GClassInitFunc) ygtk_wizard_accessible_factory_class_init,
+ sizeof (AtkObjectFactory), NULL, 0);
+ }
+ return type;
+}
+
+static AtkObject *ygtk_wizard_get_accessible (GtkWidget *widget)
+{
+ static gboolean first_time = TRUE;
+ if (first_time) {
+ GType derived_type = g_type_parent (YGTK_TYPE_WIZARD);
+ AtkRegistry *registry = atk_get_default_registry();
+ AtkObjectFactory *factory;
+ GType derived_atk_type;
+ factory = atk_registry_get_factory (registry, derived_type);
+ derived_atk_type = atk_object_factory_get_accessible_type (factory);
+ if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE)) {
+ atk_registry_set_factory_type (registry, YGTK_TYPE_WIZARD,
+ ygtk_wizard_accessible_factory_get_type());
+ }
+ first_time = FALSE;
+ }
+ return GTK_WIDGET_CLASS (ygtk_wizard_parent_class)->get_accessible (widget);
+}
+
+static void ygtk_wizard_class_init (YGtkWizardClass *klass)
+{
+ ygtk_wizard_parent_class = g_type_class_peek_parent (klass);
+
+ GtkWidgetClass* widget_class = GTK_WIDGET_CLASS (klass);
+ //** Get expose, so we can draw line border
+ widget_class->expose_event = ygtk_wizard_expose_event;
+ widget_class->realize = ygtk_wizard_realize;
+ widget_class->size_request = ygtk_wizard_size_request;
+ widget_class->size_allocate = ygtk_wizard_size_allocate;
+ widget_class->get_accessible = ygtk_wizard_get_accessible;
+
+ GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
+ container_class->forall = ygtk_wizard_forall;
+ container_class->add = ygtk_wizard_add_child;
+ container_class->remove = ygtk_wizard_remove_child;
+
+ GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass);
+ gtkobject_class->destroy = ygtk_wizard_destroy;
+
+ action_triggered_signal = g_signal_new ("action-triggered",
+ G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (YGtkWizardClass, action_triggered),
+ NULL, NULL, ygtk_marshal_VOID__POINTER_INT, G_TYPE_NONE,
+ 2, G_TYPE_POINTER, G_TYPE_INT);
+
+ // on F1, popup the help box
+ klass->popup_help = ygtk_wizard_popup_help;
+ g_signal_new ("popup_help", G_TYPE_FROM_CLASS (G_OBJECT_CLASS (klass)),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (YGtkWizardClass, popup_help),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+ GtkBindingSet *binding_set = gtk_binding_set_by_class (klass);
+ gtk_binding_entry_add_signal (binding_set, GDK_F1, 0, "popup_help", 0);
+}
+
Added: trunk/gtk/10_3/src/ygtkwizard.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkwizard.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkwizard.h (added)
+++ trunk/gtk/10_3/src/ygtkwizard.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,178 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkWizard is a widget based on GtkAssistant, which we couldn't
+ use (for starters, GtkAssistant comes from GtkWindow and we need
+ a widget, not a window).
+*/
+
+#ifndef YGTK_WIZARD_H
+#define YGTK_WIZARD_H
+
+#include
+#include
+#include
+G_BEGIN_DECLS
+
+// YGtkHelpDialog (for showing help text)
+/* Shows help text. It is GtkWindow-inherited, rather than GtkDialog, because
+ we want to place a search entry next to the buttons. */
+
+#define YGTK_TYPE_HELP_DIALOG (ygtk_help_dialog_get_type ())
+#define YGTK_HELP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_HELP_DIALOG, YGtkHelpDialog))
+#define YGTK_HELP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_HELP_DIALOG, YGtkHelpDialogClass))
+#define YGTK_IS_HELP_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_HELP_DIALOG))
+#define YGTK_IS_HELP_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_HELP_DIALOG))
+#define YGTK_HELP_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_HELP_DIALOG, YGtkHelpDialogClass))
+
+typedef struct _YGtkHelpDialog
+{
+ GtkWindow parent;
+
+ // parent:
+ GtkWidget *title_box, *title_label, *title_image;
+ GtkWidget *help_box, *help_text;
+ GtkWidget *search_entry, *close_button;
+ GtkWidget *vbox;
+} YGtkHelpDialog;
+
+typedef struct _YGtkHelpDialogClass
+{
+ GtkWindowClass parent_class;
+
+ // signals
+ void (*find_next) (YGtkHelpDialog *dialog);
+ void (*close) (YGtkHelpDialog *dialog);
+} YGtkHelpDialogClass;
+
+GtkWidget *ygtk_help_dialog_new (GtkWindow *parent);
+GType ygtk_help_dialog_get_type (void) G_GNUC_CONST;
+
+void ygtk_help_dialog_set_text (YGtkHelpDialog *dialog, const char *text);
+
+// YGtkWizard
+
+#define YGTK_TYPE_WIZARD (ygtk_wizard_get_type ())
+#define YGTK_WIZARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_WIZARD, YGtkWizard))
+#define YGTK_WIZARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_WIZARD, YGtkWizardClass))
+#define YGTK_IS_WIZARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ YGTK_TYPE_WIZARD))
+#define YGTK_IS_WIZARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ YGTK_TYPE_WIZARD))
+#define YGTK_WIZARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_WIZARD, YGtkWizardClass))
+
+typedef struct _YGtkWizard
+{
+ GtkBin bin;
+
+ // private:
+ /* Hash tables to assign Yast Ids to Gtk entries. */
+ GHashTable *menu_ids; /* gchar* -> GtkWidget* */
+ GHashTable *tree_ids; /* gchar* -> GtkTreePath* */
+ GHashTable *steps_ids; /* gchar* -> guint */
+
+ /* Widgets for layout. */
+ GtkWidget *m_menu, *m_title, *m_steps, *m_tree, *m_buttons;
+ GtkWidget *m_child, *m_pane;
+ // containee can be accessed via GTK_BIN (wizard)->child
+
+ /* Widgets we need to have access to. */
+ GtkWidget *m_title_label, *m_title_image, *m_tree_view,
+ *m_back_button, *m_abort_button, *m_next_button, *m_help_button,
+ *m_release_notes_button;
+
+ /* The help text. */
+ gchar *m_help;
+ GtkWidget *m_help_dialog;
+
+ guint child_border_width;
+} YGtkWizard;
+
+typedef struct _YGtkWizardClass
+{
+ GtkBinClass parent_class;
+
+ // signals:
+ void (*action_triggered) (YGtkWizard *wizard, gpointer id, gint id_type);
+ void (*popup_help) (YGtkWizard *dialog);
+} YGtkWizardClass;
+
+GtkWidget *ygtk_wizard_new (void);
+GType ygtk_wizard_get_type (void) G_GNUC_CONST;
+
+// Enable a steps or tree pane widget -- should be called right after
+// initilization and only _one_ of them
+void ygtk_wizard_enable_steps (YGtkWizard *wizard);
+void ygtk_wizard_enable_tree (YGtkWizard *wizard);
+
+// convinience method that removes the current child, if set, and swaps it by
+// the given one (you may pass NULL to just remove current child)
+void ygtk_wizard_set_child (YGtkWizard *wizard, GtkWidget *widget);
+
+// commands
+// (commands that may fail return a sucess boolean.)
+void ygtk_wizard_set_help_text (YGtkWizard *wizard, const gchar *text);
+
+// you may pass a window widget if you want the title/icon to be set on it as well
+void ygtk_wizard_set_header_text (YGtkWizard *wizard, GtkWindow *window,
+ const char *text);
+gboolean ygtk_wizard_set_header_icon (YGtkWizard *wizard, GtkWindow *window,
+ const char *icon);
+
+void ygtk_wizard_set_back_button_label (YGtkWizard *wizard, const char *text);
+void ygtk_wizard_set_abort_button_label (YGtkWizard *wizard, const char *text);
+void ygtk_wizard_set_next_button_label (YGtkWizard *wizard, const char *text);
+void ygtk_wizard_set_back_button_str_id (YGtkWizard *wizard, const char *id);
+void ygtk_wizard_set_next_button_str_id (YGtkWizard *wizard, const char *id);
+void ygtk_wizard_set_abort_button_str_id (YGtkWizard *wizard, const char *id);
+void ygtk_wizard_set_release_notes_button_str_id (YGtkWizard *wizard, const char *id);
+void ygtk_wizard_set_back_button_ptr_id (YGtkWizard *wizard, gpointer id, GDestroyNotify destroy_cb);
+void ygtk_wizard_set_next_button_ptr_id (YGtkWizard *wizard, gpointer id, GDestroyNotify destroy_cb);
+void ygtk_wizard_set_abort_button_ptr_id (YGtkWizard *wizard, gpointer id, GDestroyNotify destroy_cb);
+void ygtk_wizard_set_release_notes_button_ptr_id (YGtkWizard *wizard, gpointer id, GDestroyNotify destroy_cb);
+void ygtk_wizard_enable_back_button (YGtkWizard *wizard, gboolean enable);
+void ygtk_wizard_enable_next_button (YGtkWizard *wizard, gboolean enable);
+void ygtk_wizard_enable_abort_button (YGtkWizard *wizard, gboolean enable);
+gboolean ygtk_wizard_is_next_button_protected (YGtkWizard *wizard);
+void ygtk_wizard_protect_next_button (YGtkWizard *wizard, gboolean protect);
+void ygtk_wizard_focus_next_button (YGtkWizard *wizard);
+void ygtk_wizard_focus_back_button (YGtkWizard *wizard);
+
+void ygtk_wizard_add_menu (YGtkWizard *wizard, const char *text,
+ const char *id);
+gboolean ygtk_wizard_add_menu_entry (YGtkWizard *wizard, const char *parent_id,
+ const char *text, const char *id);
+gboolean ygtk_wizard_add_sub_menu (YGtkWizard *wizard, const char *parent_id,
+ const char *text, const char *id);
+gboolean ygtk_wizard_add_menu_separator (YGtkWizard *wizard, const char *parent_id);
+void ygtk_wizard_clear_menu (YGtkWizard *wizard);
+
+void ygtk_wizard_add_step_header (YGtkWizard *wizard, const char *text);
+void ygtk_wizard_add_step (YGtkWizard *wizard, const char* text, const char *id);
+gboolean ygtk_wizard_set_current_step (YGtkWizard *wizard, const char *id);
+void ygtk_wizard_clear_steps (YGtkWizard *wizard);
+
+gboolean ygtk_wizard_add_tree_item (YGtkWizard *wizard, const char *parent_id,
+ const char *text, const char *id);
+void ygtk_wizard_clear_tree (YGtkWizard *wizard);
+gboolean ygtk_wizard_select_tree_item (YGtkWizard *wizard, const char *id);
+const gchar *ygtk_wizard_get_tree_selection (YGtkWizard *wizard);
+
+void ygtk_wizard_set_release_notes_button_label (YGtkWizard *wizard, const gchar *text);
+void ygtk_wizard_show_release_notes_button (YGtkWizard *wizard, gboolean enable);
+
+// You should call this method rather than GtkWidget's if you want
+// to honor next_button protect flag
+void ygtk_wizard_set_sensitive (YGtkWizard *wizard, gboolean sensitive);
+
+G_END_DECLS
+#endif /* YGTK_WIZARD_H */
Added: trunk/gtk/10_3/src/ygtkzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkzyppwrapper.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkzyppwrapper.cc (added)
+++ trunk/gtk/10_3/src/ygtkzyppwrapper.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,332 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* YGtkZyppWrapper, gtk+ hooks for zypp wrapper */
+// check the header file for information about these hooks
+
+#include
+#include "ygtkzyppwrapper.h"
+#include "YGUtils.h"
+
+#include "icons/pkg-installed.xpm"
+#include "icons/pkg-installed-upgradable.xpm"
+#include "icons/pkg-installed-upgradable-locked.xpm"
+#include "icons/pkg-installed-locked.xpm"
+#include "icons/pkg-available.xpm"
+#include "icons/pkg-available-locked.xpm"
+#include "icons/pkg-install.xpm"
+#include "icons/pkg-remove.xpm"
+#include "icons/pkg-install-auto.xpm"
+#include "icons/pkg-remove-auto.xpm"
+
+// bridge as we don't want to mix c++ class polymorphism and gobject
+struct YGtkZyppModel::PoolNotify : public Ypp::Pool::Listener {
+YGtkZyppModel *model;
+ virtual void entryChanged (Ypp::Pool::Iter iter, Ypp::Package *package)
+ { ygtk_zypp_model_entry_changed (model, iter); }
+ virtual void entryInserted (Ypp::Pool::Iter iter, Ypp::Package *package)
+ { ygtk_zypp_model_entry_inserted (model, iter); }
+ virtual void entryDeleted (Ypp::Pool::Iter iter, Ypp::Package *package)
+ { ygtk_zypp_model_entry_deleted (model, iter); }
+};
+
+// Icons resources
+struct PackageIcons {
+ GdkPixbuf *installed, *installed_upgradable, *installed_locked,
+ *installed_upgradable_locked, *available, *available_locked,
+ *to_install, *to_remove, *to_auto_install, *to_auto_remove;
+ PackageIcons() {
+ installed = gdk_pixbuf_new_from_xpm_data (pkg_installed_xpm);
+ installed_upgradable =
+ gdk_pixbuf_new_from_xpm_data (pkg_installed_upgradable_xpm);
+ installed_locked = gdk_pixbuf_new_from_xpm_data (pkg_installed_locked_xpm);
+ installed_upgradable_locked =
+ gdk_pixbuf_new_from_xpm_data (pkg_installed_upgradable_locked_xpm);
+ available = gdk_pixbuf_new_from_xpm_data (pkg_available_xpm);
+ available_locked = gdk_pixbuf_new_from_xpm_data (pkg_available_locked_xpm);
+ to_install = gdk_pixbuf_new_from_xpm_data (pkg_install_xpm);
+ to_remove = gdk_pixbuf_new_from_xpm_data (pkg_remove_xpm);
+ to_auto_install = gdk_pixbuf_new_from_xpm_data (pkg_install_auto_xpm);
+ to_auto_remove = gdk_pixbuf_new_from_xpm_data (pkg_remove_auto_xpm);
+ }
+ ~PackageIcons() {
+ g_object_unref (G_OBJECT (installed));
+ g_object_unref (G_OBJECT (installed_upgradable));
+ g_object_unref (G_OBJECT (installed_upgradable_locked));
+ g_object_unref (G_OBJECT (installed_locked));
+ g_object_unref (G_OBJECT (available));
+ g_object_unref (G_OBJECT (available_locked));
+ g_object_unref (G_OBJECT (to_install));
+ g_object_unref (G_OBJECT (to_remove));
+ g_object_unref (G_OBJECT (to_auto_install));
+ g_object_unref (G_OBJECT (to_auto_remove));
+ }
+};
+
+static PackageIcons *icons = NULL;
+void ygtk_zypp_model_finish()
+{
+ delete icons; icons = NULL;
+ Ypp::finish();
+}
+
+static void ygtk_zypp_model_tree_model_init (GtkTreeModelIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (YGtkZyppModel, ygtk_zypp_model, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_MODEL, ygtk_zypp_model_tree_model_init))
+
+static void ygtk_zypp_model_init (YGtkZyppModel *zmodel)
+{
+ if (!icons)
+ icons = new PackageIcons();
+}
+
+static void ygtk_zypp_model_finalize (GObject *object)
+{
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (object);
+ delete zmodel->notify;
+ zmodel->notify = NULL;
+ delete zmodel->pool;
+ zmodel->pool = NULL;
+ G_OBJECT_CLASS (ygtk_zypp_model_parent_class)->finalize (object);
+}
+
+static GtkTreeModelFlags ygtk_zypp_model_get_flags (GtkTreeModel *)
+{
+ return GtkTreeModelFlags (GTK_TREE_MODEL_ITERS_PERSIST | GTK_TREE_MODEL_LIST_ONLY);
+}
+
+static gboolean ygtk_zypp_model_get_iter (GtkTreeModel *model, GtkTreeIter *iter,
+ GtkTreePath *path)
+{
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
+ gint row = gtk_tree_path_get_indices (path)[0];
+
+ iter->user_data = (gpointer) zmodel->pool->getIter (row);
+ return iter->user_data != NULL;
+}
+
+static GtkTreePath *ygtk_zypp_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
+{
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
+ int row = zmodel->pool->getIndex (iter->user_data);
+
+ GtkTreePath *path = gtk_tree_path_new();
+ gtk_tree_path_append_index (path, row);
+ return path;
+}
+
+static gboolean ygtk_zypp_model_iter_next (GtkTreeModel *model, GtkTreeIter *iter)
+{
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
+ iter->user_data = zmodel->pool->getNext (iter->user_data);
+ return iter->user_data != NULL;
+}
+
+void ygtk_zypp_model_entry_changed (YGtkZyppModel *model, Ypp::Pool::Iter it)
+{
+ GtkTreeIter iter;
+ iter.user_data = it;
+ GtkTreePath *path = ygtk_zypp_model_get_path (GTK_TREE_MODEL (model), &iter);
+ gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
+ gtk_tree_path_free (path);
+}
+
+void ygtk_zypp_model_entry_inserted (YGtkZyppModel *model, Ypp::Pool::Iter it)
+{
+ GtkTreeIter iter;
+ iter.user_data = it;
+ GtkTreePath *path = ygtk_zypp_model_get_path (GTK_TREE_MODEL (model), &iter);
+ gtk_tree_model_row_inserted (GTK_TREE_MODEL (model), path, &iter);
+ gtk_tree_path_free (path);
+}
+
+void ygtk_zypp_model_entry_deleted (YGtkZyppModel *model, Ypp::Pool::Iter it)
+{
+ GtkTreeIter iter;
+ iter.user_data = it;
+ GtkTreePath *path = ygtk_zypp_model_get_path (GTK_TREE_MODEL (model), &iter);
+ gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path);
+ gtk_tree_path_free (path);
+}
+
+static gint ygtk_zypp_model_get_n_columns (GtkTreeModel *model)
+{
+ return YGtkZyppModel::TOTAL_COLUMNS;
+}
+
+static GType ygtk_zypp_model_get_column_type (GtkTreeModel *tree_model, gint column)
+{
+ switch (column)
+ {
+ case YGtkZyppModel::ICON_COLUMN:
+ return GDK_TYPE_PIXBUF;
+ case YGtkZyppModel::NAME_COLUMN:
+ case YGtkZyppModel::NAME_DESCRIPTION_COLUMN:
+ return G_TYPE_STRING;
+ case YGtkZyppModel::PTR_COLUMN:
+ return G_TYPE_POINTER;
+ }
+ return 0;
+}
+
+static void ygtk_zypp_model_get_value (GtkTreeModel *model, GtkTreeIter *iter,
+ gint column, GValue *value)
+{
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
+ Ypp::Package *package = zmodel->pool->get (iter->user_data);
+
+ g_value_init (value, ygtk_zypp_model_get_column_type (model, column));
+ switch (column)
+ {
+ case YGtkZyppModel::ICON_COLUMN:
+ {
+ GdkPixbuf *pixbuf;
+ bool locked = package->isLocked();
+ bool auto_ = package->isAuto();
+ if (package->toInstall()) {
+ if (auto_)
+ pixbuf = icons->to_auto_install;
+ else
+ pixbuf = icons->to_install;
+ }
+ else if (package->toRemove()) {
+ if (auto_)
+ pixbuf = icons->to_auto_remove;
+ else
+ pixbuf = icons->to_remove;
+ }
+ else if (package->hasUpgrade()) {
+ if (locked)
+ pixbuf = icons->installed_upgradable_locked;
+ else
+ pixbuf = icons->installed_upgradable;
+ }
+ else if (package->isInstalled()) {
+ if (locked)
+ pixbuf = icons->installed_locked;
+ else
+ pixbuf = icons->installed;
+ }
+ else {
+ if (locked)
+ pixbuf = icons->available_locked;
+ else
+ pixbuf = icons->available;
+ }
+ g_value_set_object (value, (GObject *) pixbuf);
+ break;
+ }
+ case YGtkZyppModel::NAME_COLUMN:
+ {
+ std::string name = package->name();
+ const unsigned int max_width = 15;
+ if (name.size() > max_width) {
+ name.erase (max_width-3);
+ name += "...";
+ }
+ g_value_set_string (value, g_strdup (name.c_str()));
+ break;
+ }
+ case YGtkZyppModel::NAME_DESCRIPTION_COLUMN:
+ {
+ std::string str = package->name();
+ std::string summary = package->summary();
+ if (!summary.empty()) {
+ YGUtils::escapeMarkup (summary);
+ str += "\n<small>" + summary + "</small>";
+ }
+ g_value_set_string (value, g_strdup (str.c_str()));
+ break;
+ }
+ case YGtkZyppModel::PTR_COLUMN:
+ {
+ void *ptr;
+ ptr = (void *) package;
+ g_value_set_pointer (value, ptr);
+ break;
+ }
+ default:
+ g_warning ("YGtkZyppModel column %d doesn't exist.", column);
+ break;
+ }
+}
+
+static gboolean ygtk_zypp_model_iter_has_child (GtkTreeModel *model, GtkTreeIter *iter)
+{
+ return FALSE;
+}
+
+static gboolean ygtk_zypp_model_iter_parent (GtkTreeModel *model, GtkTreeIter *iter,
+ GtkTreeIter *child)
+{
+ return FALSE;
+}
+
+static gint ygtk_zypp_model_iter_n_children (GtkTreeModel *model, GtkTreeIter *iter)
+{
+ if (iter == NULL) { // special case: root
+ YGtkZyppModel *zmodel = YGTK_ZYPP_MODEL (model);
+ int length = 0;
+ Ypp::Pool::Iter iter = zmodel->pool->getFirst();
+ while (iter) {
+ length++;
+ iter = zmodel->pool->getNext (iter);
+ }
+ return length;
+ }
+ return 0;
+}
+
+static gboolean ygtk_zypp_model_iter_nth_child (GtkTreeModel *model, GtkTreeIter *iter,
+ GtkTreeIter *parent, gint n)
+{
+ if (parent == NULL) {
+ gboolean ret;
+ GtkTreePath *path = gtk_tree_path_new_from_indices (n, -1);
+ ret = ygtk_zypp_model_get_iter (model, iter, path);
+ gtk_tree_path_free (path);
+ return ret;
+ }
+ return FALSE;
+}
+
+static gboolean ygtk_zypp_model_iter_children (GtkTreeModel *model, GtkTreeIter *iter,
+ GtkTreeIter *parent)
+{
+ return ygtk_zypp_model_iter_nth_child (model, iter, parent, 0);
+}
+
+YGtkZyppModel *ygtk_zypp_model_new (Ypp::Query *query)
+{
+ YGtkZyppModel *zmodel = (YGtkZyppModel *) g_object_new (YGTK_TYPE_ZYPP_MODEL, NULL);
+ zmodel->notify = new YGtkZyppModel::PoolNotify();
+ zmodel->notify->model = zmodel;
+ zmodel->pool = new Ypp::Pool (query);
+ zmodel->pool->setListener (zmodel->notify);
+ return zmodel;
+}
+
+static void ygtk_zypp_model_class_init (YGtkZyppModelClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = ygtk_zypp_model_finalize;
+}
+
+static void ygtk_zypp_model_tree_model_init (GtkTreeModelIface *iface)
+{
+ iface->get_flags = ygtk_zypp_model_get_flags;
+ iface->get_n_columns = ygtk_zypp_model_get_n_columns;
+ iface->get_column_type = ygtk_zypp_model_get_column_type;
+ iface->get_iter = ygtk_zypp_model_get_iter;
+ iface->get_path = ygtk_zypp_model_get_path;
+ iface->get_value = ygtk_zypp_model_get_value;
+ iface->iter_next = ygtk_zypp_model_iter_next;
+ iface->iter_children = ygtk_zypp_model_iter_children;
+ iface->iter_has_child = ygtk_zypp_model_iter_has_child;
+ iface->iter_n_children = ygtk_zypp_model_iter_n_children;
+ iface->iter_nth_child = ygtk_zypp_model_iter_nth_child;
+ iface->iter_parent = ygtk_zypp_model_iter_parent;
+}
+
Added: trunk/gtk/10_3/src/ygtkzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/ygtkzyppwrapper.h?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/ygtkzyppwrapper.h (added)
+++ trunk/gtk/10_3/src/ygtkzyppwrapper.h Fri Jan 18 12:58:22 2008
@@ -0,0 +1,53 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* Contains ZyppWrapper query results in a GtkTreeModel.
+*/
+
+#ifndef YGTK_ZYPP_WRAPPER_H
+#define YGTK_ZYPP_WRAPPER_H
+
+#include "yzyppwrapper.h"
+#include
+
+#define YGTK_TYPE_ZYPP_MODEL (ygtk_zypp_model_get_type ())
+#define YGTK_ZYPP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ YGTK_TYPE_ZYPP_MODEL, YGtkZyppModel))
+#define YGTK_ZYPP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ YGTK_TYPE_ZYPP_MODEL, YGtkZyppModelClass))
+#define YGTK_IS_ZYPP_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), YGTK_TYPE_ZYPP_MODEL))
+#define YGTK_IS_ZYPP_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), YGTK_TYPE_ZYPP_MODEL))
+#define YGTK_ZYPP_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ YGTK_TYPE_ZYPP_MODEL, YGtkZyppModelClass))
+
+struct YGtkZyppModel
+{
+ GObject parent;
+
+ enum Columns {
+ ICON_COLUMN, NAME_COLUMN, NAME_DESCRIPTION_COLUMN, PTR_COLUMN, TOTAL_COLUMNS
+ };
+
+ Ypp::Pool *pool;
+
+ struct PoolNotify;
+ PoolNotify *notify;
+};
+
+struct YGtkZyppModelClass
+{
+ GObjectClass parent_class;
+};
+
+YGtkZyppModel *ygtk_zypp_model_new (Ypp::Query *query);
+GType ygtk_zypp_model_get_type (void) G_GNUC_CONST;
+// besides calling Ypp for cleaning, it also cleans the icons of this hook
+void ygtk_zypp_model_finish();
+
+void ygtk_zypp_model_entry_changed (YGtkZyppModel *model, Ypp::Pool::Iter iter);
+void ygtk_zypp_model_entry_inserted (YGtkZyppModel *model, Ypp::Pool::Iter iter);
+void ygtk_zypp_model_entry_deleted (YGtkZyppModel *model, Ypp::Pool::Iter iter);
+
+#endif /*YGTK_ZYPP_WRAPPER_H*/
+
Added: trunk/gtk/10_3/src/yzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/10_3/src/yzyppwrapper.cc?rev=43731&view=auto
==============================================================================
--- trunk/gtk/10_3/src/yzyppwrapper.cc (added)
+++ trunk/gtk/10_3/src/yzyppwrapper.cc Fri Jan 18 12:58:22 2008
@@ -0,0 +1,1423 @@
+/********************************************************************
+ * YaST2-GTK - http://en.opensuse.org/YaST2-GTK *
+ ********************************************************************/
+
+/* Ypp, zypp wrapper */
+// check the header file for information about this wrapper
+
+#include
+#include "YGi18n.h"
+#include "yzyppwrapper.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include "YGUtils.h"
+
+//** Zypp shortcuts
+
+typedef zypp::ResPoolProxy ZyppPool;
+inline ZyppPool zyppPool() { return zypp::getZYpp()->poolProxy(); }
+typedef zypp::ui::Selectable::Ptr ZyppSelectable;
+typedef zypp::ui::Selectable* ZyppSelectablePtr;
+typedef zypp::ResObject::constPtr ZyppObject;
+typedef zypp::ResObject* ZyppObjectPtr;
+typedef zypp::Package::constPtr ZyppPackage;
+typedef zypp::Patch::constPtr ZyppPatch;
+typedef zypp::Pattern::constPtr ZyppPattern;
+typedef zypp::Language::constPtr ZyppLanguage;
+inline ZyppPackage tryCastToZyppPkg (ZyppObject obj)
+{ return zypp::dynamic_pointer_cast <const zypp::Package> (obj); }
+inline ZyppPatch tryCastToZyppPatch (ZyppObject obj)
+{ return zypp::dynamic_pointer_cast <const zypp::Patch> (obj); }
+inline ZyppPattern tryCastToZyppPattern (ZyppObject obj)
+{ return zypp::dynamic_pointer_cast <const zypp::Pattern> (obj); }
+inline ZyppLanguage tryCastToZyppLanguage (ZyppObject obj)
+{ return zypp::dynamic_pointer_cast <const zypp::Language> (obj); }
+
+//** Utilities
+
+// converts a set of tree representation in a form of a strings to a tree structure.
+// String tree representations are, for instance, filenames: /dir1/dir2/file
+struct StringTree {
+ typedef int (*Compare)(const char *, const char *);
+ Compare compare;
+ char delim;
+ GNode *root;
+
+ StringTree (Compare compare, char delim)
+ : compare (compare), delim (delim)
+ {
+ // the root is a dummy node to keep GNode happy
+ root = g_node_new (NULL);
+ }
+
+ ~StringTree()
+ {
+ struct inner {
+ static void free (GNode *node, void *_data)
+ { delete ((Ypp::Node *) node->data); }
+ };
+ g_node_children_foreach (root, G_TRAVERSE_ALL, inner::free, NULL);
+ g_node_destroy (root);
+ }
+
+ Ypp::Node *getFirst()
+ {
+ return (Ypp::Node *) root->children->data;
+ }
+
+ Ypp::Node *add (const std::string &tree_str)
+ {
+ const std::list nodes_str = YGUtils::splitString (tree_str, delim);
+ GNode *parent = root, *sibling = 0;
+ Ypp::Node *ret = 0;
+
+ std::list ::const_iterator it;
+ for (it = nodes_str.begin(); it != nodes_str.end(); it++) {
+ bool found = false;
+ for (sibling = parent->children; sibling; sibling = sibling->next) {
+ Ypp::Node *yNode = (Ypp::Node *) sibling->data;
+ int cmp = (*compare) (it->c_str(), yNode->name.c_str());
+ if (cmp == 0) {
+ found = true;
+ ret = yNode;
+ break;
+ }
+ else if (cmp < 0)
+ break;
+ }
+ if (!found)
+ break;
+ parent = sibling;
+ }
+
+ for (; it != nodes_str.end(); it++) {
+ Ypp::Node *yNode = new Ypp::Node();
+ GNode *n = g_node_new ((void *) yNode);
+ yNode->name = *it;
+ yNode->impl = (void *) n;
+ g_node_insert_before (parent, sibling, n);
+ parent = n;
+ sibling = NULL;
+ ret = yNode;
+ }
+ return ret;
+ }
+};
+
+//** Singleton
+
+static Ypp *ypp = 0;
+
+Ypp *Ypp::get()
+{
+ if (!ypp)
+ ypp = new Ypp();
+ return ypp;
+}
+
+void Ypp::finish()
+{
+ delete ypp; ypp = NULL;
+}
+
+// Ypp::Impl declaration, to expose some methods for usage
+struct Ypp::Impl
+{
+public:
+ Impl();
+ ~Impl();
+
+ const Repository *getRepository (int nb);
+ int getRepository (const std::string &zyppId);
+ Disk *getDisk();
+
+ // for Packages
+ bool acceptLicense (Ypp::Package *package, const std::string &license);
+ void packageModified (Ypp::Package *package);
+
+ // for Pools
+ void addPool (Pool::Impl *pool);
+ void removePool (Pool::Impl *pool);
+ GSList *getPackages (Package::Type type);
+
+private:
+ bool resolveProblems();
+ Node *addCategory (Ypp::Package::Type type, const std::string &str);
+ void polishCategories (Ypp::Package::Type type);
+
+ void startTransactions();
+ void finishTransactions();
+
+ friend class Ypp;
+ GSList *packages [Package::TOTAL_TYPES]; // primitive pools
+ StringTree *categories [Package::TOTAL_TYPES];
+ GSList *repos;
+ Disk *disk;
+ Interface *interface;
+ GSList *pools;
+ bool inTransaction;
+ GSList *transactions;
+};
+
+//** Package
+
+struct Ypp::Package::Impl
+{
+ Impl (Type type, ZyppSelectable sel, Node *category)
+ : type (type), zyppSel (sel), category (category),
+ availableVersions (NULL), installedVersion (NULL)
+ {
+ // don't use getAvailableVersion(0) for hasUpgrade() has its inneficient.
+ // let's just cache candidate() at start, which should point to the newest version.
+ hasUpgrade = false;
+ ZyppObject candidate = zyppSel->candidateObj();
+ ZyppObject installed = zyppSel->installedObj();
+ if (!!candidate && !!installed)
+ hasUpgrade = zypp::Edition::compare (candidate->edition(), installed->edition()) > 0;
+ setUnmodified();
+ }
+
+ ~Impl()
+ {
+ delete installedVersion;
+ for (GSList *i = availableVersions; i; i = i->next)
+ delete ((Version *) i->data);
+ g_slist_free (availableVersions);
+ }
+
+ inline bool isModified()
+ { return curStatus != zyppSel->status(); }
+ inline void setUnmodified()
+ { curStatus = zyppSel->status(); }
+
+ std::string name, summary;
+ Type type;
+ ZyppSelectable zyppSel;
+ Ypp::Node *category;
+ GSList *availableVersions;
+ Version *installedVersion;
+ bool hasUpgrade;
+ zypp::ui::Status curStatus; // so we know if resolver touched it
+};
+
+Ypp::Package::Package (Ypp::Package::Impl *impl)
+: impl (impl)
+{}
+Ypp::Package::~Package()
+{ delete impl; }
+
+Ypp::Package::Type Ypp::Package::type()
+{ return impl->type; }
+
+const std::string &Ypp::Package::name()
+{
+ std::string &ret = impl->name;
+ if (ret.empty()) {
+ ZyppSelectable sel = impl->zyppSel;
+ ZyppObject obj = sel->theObj();
+ switch (impl->type) {
+ case PATTERN_TYPE:
+ ret = obj->summary();
+ break;
+ case LANGUAGE_TYPE:
+ ret = obj->description();
+ break;
+ default:
+ ret = sel->name();
+ break;
+ }
+ }
+ return ret;
+}
+
+const std::string &Ypp::Package::summary()
+{
+ std::string &ret = impl->summary;
+ if (ret.empty()) {
+ if (impl->type == PACKAGE_TYPE || impl->type == PATCH_TYPE)
+ ret = impl->zyppSel->theObj()->summary();
+ }
+ return ret;
+}
+
+std::string Ypp::Package::description()
+{
+ ZyppObject object = impl->zyppSel->theObj();
+ std::string text = object->description(), br = "<br>";
+ // if it has this header, then it is HTML
+ const char *header = "<!-- DT:Rich -->", header_len = 16;
+ if (!text.compare (0, header_len, header, header_len))
+ text.erase (0, header_len);
+ else {
+ YGUtils::escapeMarkup (text);
+ YGUtils::replace (text, "\n\n", 2, "<br>"); // break every double line
+ }
+
+ if (impl->type == PACKAGE_TYPE) {
+ ZyppPackage package = tryCastToZyppPkg (object);
+ std::string url = package->url(), license = package->license();
+ if (!url.empty())
+ text += br + "<b>" + _("Website: ") + "</b>" + url;
+ if (!license.empty())
+ text += br + "<b>" + _("License: ") + "</b>" + license;
+ }
+ else if (impl->type == PATCH_TYPE) {
+ ZyppPatch patch = tryCastToZyppPatch (object);
+ if (patch->reboot_needed())
+ text += br + br + "<b>" + "Reboot needed!" + "</b>";
+ }
+ if (impl->type != PATCH_TYPE)
+ text += br + "<b>" + _("Size: ") + "</b>" + object->size().asString();
+ return text;
+}
+
+std::string Ypp::Package::filelist()
+{
+ std::string text;
+ ZyppObject object = impl->zyppSel->installedObj();
+ ZyppPackage package = tryCastToZyppPkg (object);
+ if (package) {
+ StringTree tree (strcmp, '/');
+
+ const std::list &filesList = package->filenames();
+ for (std::list ::const_iterator it = filesList.begin();
+ it != filesList.end(); it++)
+ tree.add (*it);
+
+ struct inner {
+ static std::string getPath (GNode *node)
+ {
+ Node *yNode = (Node *) node->data;
+ if (!yNode)
+ return std::string();
+ return getPath (node->parent) + "/" + yNode->name;
+ }
+ static bool hasNextLeaf (GNode *node)
+ {
+ GNode *i;
+ for (i = node->next; i; i = i->next)
+ if (!i->children)
+ return true;
+ return false;
+ }
+ static bool hasPrevLeaf (GNode *node)
+ {
+ GNode *i;
+ for (i = node->prev; i; i = i->prev)
+ if (!i->children)
+ return true;
+ return false;
+ }
+ static gboolean traverse (GNode *node, void *_data)
+ {
+ Node *yNode = (Node *) node->data;
+ if (yNode) {
+ std::string *str = (std::string *) _data;
+ if (!hasPrevLeaf (node)) {
+ std::string path = getPath (node->parent);
+ *str += "<a href=" + path + ">" + path + "</a>";
+ *str += "<blockquote>";
+ }
+ else
+ *str += ", ";
+ *str += yNode->name;
+
+ if (!hasNextLeaf (node))
+ *str += "</blockquote>";
+ }
+ return FALSE;
+ }
+ };
+ g_node_traverse (tree.root, G_LEVEL_ORDER, G_TRAVERSE_LEAFS, -1,
+ inner::traverse, (void *) &text);
+ }
+ return text;
+}
+
+std::string Ypp::Package::changelog()
+{
+ string text;
+ ZyppObject object = impl->zyppSel->installedObj();
+ ZyppPackage package = tryCastToZyppPkg (object);
+ if (package) {
+ const std::list zypp::ChangelogEntry &changelogList = package->changelog();
+ for (std::list zypp::ChangelogEntry::const_iterator it = changelogList.begin();
+ it != changelogList.end(); it++) {
+ std::string date (it->date().form ("%d %B %Y")), author (it->author()),
+ changes (it->text());
+ YGUtils::escapeMarkup (author);
+ YGUtils::escapeMarkup (changes);
+ YGUtils::replace (changes, "\n", 1, "<br>");
+ if (author.compare (0, 2, "- ", 2) == 0) // zypp returns a lot of author strings as
+ author.erase (0, 2); // "- author". wtf?
+ text += date + " (" + author + "):<br><blockquote>" + changes + "</blockquote>";
+ }
+ }
+ return text;
+}
+
+std::string Ypp::Package::authors()
+{
+ std::string text;
+ ZyppObject object = impl->zyppSel->theObj();
+ ZyppPackage package = tryCastToZyppPkg (object);
+ if (package) {
+ std::string packager = package->packager(), authors;
+ YGUtils::escapeMarkup (packager);
+ const std::list std::string &authorsList = package->authors();
+ for (std::list std::string::const_iterator it = authorsList.begin();
+ it != authorsList.end(); it++) {
+ std::string author = *it;
+ YGUtils::escapeMarkup (author);
+ if (!authors.empty())
+ authors += "<br>";
+ authors += author;
+ }
+ // Some packagers put Authors over the Descriptions field. This seems to be rare
+ // on, so I'm not even going to bother.
+
+ if (!packager.empty())
+ text += _("Packaged by:") + ("<blockquote>" + packager) + "</blockquote>";
+ if (!authors.empty())
+ text += _("Developed by:") + ("<blockquote>" + authors) + "</blockquote>";
+ }
+ return text;
+}
+
+std::string Ypp::Package::provides()
+{
+ std::string text;
+ ZyppObject object = impl->zyppSel->theObj();
+ const zypp::CapSet &capSet = object->dep (zypp::Dep::PROVIDES);
+ for (zypp::CapSet::const_iterator it = capSet.begin();
+ it != capSet.end(); it++) {
+ if (!text.empty())
+ text += "\n";
+ text += it->asString();
+ }
+ return text;
+}
+
+std::string Ypp::Package::requires()
+{
+ std::string text;
+ ZyppObject object = impl->zyppSel->theObj();
+ const zypp::CapSet &capSet = object->dep (zypp::Dep::REQUIRES);
+ for (zypp::CapSet::const_iterator it = capSet.begin();
+ it != capSet.end(); it++) {
+ if (!text.empty())
+ text += "\n";
+ text += it->asString();
+ }
+ return text;
+}
+
+Ypp::Node *Ypp::Package::category()
+{
+ return impl->category;
+}
+
+bool Ypp::Package::fromCollection (Ypp::Package *collection)
+{
+ switch (collection->type()) {
+ case Ypp::Package::PATTERN_TYPE:
+ {
+ ZyppSelectable selectable = collection->impl->zyppSel;
+ ZyppObject object = selectable->theObj();
+ ZyppPattern pattern = tryCastToZyppPattern (object);
+
+ const set <string> &packages = pattern->install_packages();
+ for (set <string>::iterator it = packages.begin();
+ it != packages.end(); it++) {
+ if (this->impl->zyppSel->name() == *it)
+ return true;
+ }
+ break;
+ }
+ case Ypp::Package::LANGUAGE_TYPE:
+ {
+ ZyppSelectable selectable = collection->impl->zyppSel;
+ ZyppObject object = selectable->theObj();
+ ZyppLanguage language = tryCastToZyppLanguage (object);
+
+ ZyppObject pkgobj = this->impl->zyppSel->theObj();
+ const zypp::CapSet &capSet = pkgobj->dep (zypp::Dep::FRESHENS);
+ for (zypp::CapSet::const_iterator it = capSet.begin();
+ it != capSet.end(); it++) {
+ if (it->index() == language->name())
+ return true;
+ }
+ }
+ default:
+ break;
+ }
+ return false;
+}
+
+bool Ypp::Package::isInstalled()
+{
+ if (impl->type == Ypp::Package::PATCH_TYPE) {
+ if (impl->zyppSel->hasInstalledObj()) {
+ // broken? show as available
+ if (impl->zyppSel->installedPoolItem().status().isIncomplete())
+ return false;
+ }
+ }
+
+ return impl->zyppSel->hasInstalledObj();
+}
+
+bool Ypp::Package::hasUpgrade()
+{
+ return impl->hasUpgrade;
+}
+
+bool Ypp::Package::isLocked()
+{
+ zypp::ui::Status status = impl->zyppSel->status();
+ return status == zypp::ui::S_Taboo || status == zypp::ui::S_Protected;
+}
+
+bool Ypp::Package::toInstall (int *nb)
+{
+ if (nb) {
+ ZyppObject candidate = impl->zyppSel->candidateObj();
+ for (int i = 0; getAvailableVersion (i); i++) {
+ const Version *version = getAvailableVersion (i);
+ ZyppObject i_obj = (ZyppObjectPtr) version->impl;
+ if (i_obj == candidate) {
+ *nb = i;
+ break;
+ }
+ }
+ }
+ return impl->zyppSel->toInstall();
+}
+
+bool Ypp::Package::toRemove()
+{
+ return impl->zyppSel->toDelete();
+}
+
+bool Ypp::Package::isModified()
+{
+ return impl->zyppSel->toModify();
+}
+
+bool Ypp::Package::isAuto()
+{
+ zypp::ui::Status status = impl->zyppSel->status();
+ return status == zypp::ui::S_AutoInstall || status == zypp::ui::S_AutoUpdate ||
+ status == zypp::ui::S_AutoDel;
+}
+
+void Ypp::Package::install (int nb)
+{
+ if (isLocked())
+ return;
+ if (!impl->zyppSel->hasLicenceConfirmed())
+ {
+ const std::string &license = impl->zyppSel->candidateObj()->licenseToConfirm();
+ if (!license.empty())
+ if (!ypp->impl->acceptLicense (this, license))
+ return;
+ impl->zyppSel->setLicenceConfirmed();
+ }
+
+ zypp::ui::Status status = impl->zyppSel->status();
+ switch (status) {
+ // not applicable
+ case zypp::ui::S_Protected:
+ case zypp::ui::S_Taboo:
+ case zypp::ui::S_Install:
+ case zypp::ui::S_Update:
+ break;
+ // undo
+ case zypp::ui::S_Del:
+ status = zypp::ui::S_KeepInstalled;
+ break;
+ // nothing to do about it
+ case zypp::ui::S_AutoDel:
+ break;
+ // action
+ case zypp::ui::S_NoInst:
+ case zypp::ui::S_AutoInstall:
+ status = zypp::ui::S_Install;
+ break;
+ case zypp::ui::S_KeepInstalled:
+ case zypp::ui::S_AutoUpdate:
+ status = zypp::ui::S_Update;
+ break;
+ }
+
+ impl->zyppSel->set_status (status);
+ if (toInstall()) {
+ const Version *version = getAvailableVersion (nb);
+ ZyppObject candidate = (ZyppObjectPtr) version->impl;
+ if (!impl->zyppSel->setCandidate (candidate)) {
+ y2warning ("Error: Could not set package '%s' candidate to '%s'\n",
+ name().c_str(), version->number.c_str());
+ return;
+ }
+ }
+
+ ypp->impl->packageModified (this);
+}
+
+void Ypp::Package::remove()
+{
+ zypp::ui::Status status = impl->zyppSel->status();
+ switch (status) {
+ // not applicable
+ case zypp::ui::S_Protected:
+ case zypp::ui::S_Taboo:
+ case zypp::ui::S_NoInst:
+ case zypp::ui::S_Del:
+ break;
+ // undo
+ case zypp::ui::S_Install:
+ status = zypp::ui::S_NoInst;
+ break;
+ // nothing to do about it
+ case zypp::ui::S_AutoInstall:
+ case zypp::ui::S_AutoUpdate:
+ break;
+ case zypp::ui::S_Update:
+ status = zypp::ui::S_KeepInstalled;
+ break;
+ // action
+ case zypp::ui::S_KeepInstalled:
+ case zypp::ui::S_AutoDel:
+ status = zypp::ui::S_Del;
+ break;
+ }
+
+ impl->zyppSel->set_status (status);
+ ypp->impl->packageModified (this);
+}
+
+void Ypp::Package::undo()
+{
+ zypp::ui::Status status = impl->zyppSel->status();
+ switch (status) {
+ // not applicable
+ case zypp::ui::S_Protected:
+ case zypp::ui::S_Taboo:
+ case zypp::ui::S_NoInst:
+ case zypp::ui::S_KeepInstalled:
+ break;
+
+ // undo
+ case zypp::ui::S_Install:
+ status = zypp::ui::S_NoInst;
+ break;
+ case zypp::ui::S_Update:
+ case zypp::ui::S_Del:
+ status = zypp::ui::S_KeepInstalled;
+ break;
+
+ // for auto status, undo them by locking them
+ case zypp::ui::S_AutoInstall:
+ status = zypp::ui::S_Taboo;
+ break;
+ case zypp::ui::S_AutoUpdate:
+ case zypp::ui::S_AutoDel:
+ status = zypp::ui::S_Protected;
+ break;
+ }
+
+ impl->zyppSel->set_status (status);
+ ypp->impl->packageModified (this);
+}
+
+void Ypp::Package::lock (bool lock)
+{
+ undo();
+
+ zypp::ui::Status status;
+ if (lock)
+ status = isInstalled() ? zypp::ui::S_Protected : zypp::ui::S_Taboo;
+ else
+ status = isInstalled() ? zypp::ui::S_KeepInstalled : zypp::ui::S_NoInst;
+
+ impl->zyppSel->set_status (status);
+ ypp->impl->packageModified (this);
+}
+
+static Ypp::Package::Version *constructVersion (ZyppObject object)
+{
+ Ypp::Package::Version *version = new Ypp::Package::Version();
+ version->number = object->edition().version();
+ version->repo = ypp->impl->getRepository (object->repository().info().alias());
+ version->cmp = 0;
+ version->impl = (void *) get_pointer (object);
+ return version;
+}
+
+const Ypp::Package::Version *Ypp::Package::getInstalledVersion()
+{
+ if (!impl->installedVersion) {
+ const ZyppObject installedObj = impl->zyppSel->installedObj();
+ if (installedObj)
+ impl->installedVersion = constructVersion (installedObj);
+ }
+ return impl->installedVersion;
+}
+
+const Ypp::Package::Version *Ypp::Package::getAvailableVersion (int nb)
+{
+ if (!impl->availableVersions) {
+ const ZyppObject installedObj = impl->zyppSel->installedObj();
+ for (zypp::ui::Selectable::available_iterator it = impl->zyppSel->availableBegin();
+ it != impl->zyppSel->availableEnd(); it++) {
+ Version *version = constructVersion (*it);
+ if (installedObj)
+ version->cmp = zypp::Edition::compare ((*it)->edition(), installedObj->edition());
+ impl->availableVersions = g_slist_append (impl->availableVersions, version);
+ }
+ struct inner {
+ static gint version_compare (gconstpointer pa, gconstpointer pb)
+ {
+ ZyppObjectPtr a = (ZyppObjectPtr) ((Version *) pa)->impl;
+ ZyppObjectPtr b = (ZyppObjectPtr) ((Version *) pb)->impl;
+ // swapped arguments, as we want them sorted from newer to older
+ return zypp::Edition::compare (b->edition(), a->edition());
+ }
+ };
+ impl->availableVersions = g_slist_sort (impl->availableVersions,
+ inner::version_compare);
+ }
+ return (Version *) g_slist_nth_data (impl->availableVersions, nb);
+}
+
+bool Ypp::Package::isOnRepository (int repo_nb)
+{
+ int i;
+ for (i = 0; getAvailableVersion (i); i++)
+ if (getAvailableVersion (i)->repo == repo_nb)
+ return true;
+ // if there are no availables, answer yes to all repos
+ return i == 0;
+}
+
+//** Query
+
+struct Ypp::Query::Impl
+{
+ template <typename T>
+ struct Key
+ {
+ Key() : defined (false) {}
+ void set (T v)
+ {
+ defined = true;
+ value = v;
+ }
+ bool is (const T &v) const
+ {
+ if (!defined) return true;
+ return value == v;
+ }
+ bool defined;
+ T value;
+ };
+
+ template <typename T>
+ struct Keys
+ {
+ Keys() : defined (false) {}
+ void add (T v)
+ {
+ defined = true;
+ values.push_back (v);
+ }
+ bool is (const T &v) const
+ {
+ if (!defined) return true;
+ typename std::list <T>::const_iterator it;
+ for (it = values.begin(); it != values.end(); it++)
+ if (*it == v)
+ return true;
+ return false;
+ }
+ bool defined;
+ std::list <T> values;
+ };
+
+ Keys Ypp::Package::Type types;
+ Keys std::string names;
+ Keys categories;
+ Keys