Clean up trailing whitespace

This commit is contained in:
Daemonratte 2026-05-03 15:16:52 +02:00
commit 42a31c8576
792 changed files with 32776 additions and 32776 deletions

114
README.in
View file

@ -164,38 +164,38 @@ Release notes for 2.12
* The gtk_notebook_set/get_group_id() functions were found to be insufficient * The gtk_notebook_set/get_group_id() functions were found to be insufficient
and have been deprecated in favour of gtk_notebook_set/get_group(). and have been deprecated in favour of gtk_notebook_set/get_group().
* The move-focus signal has been moved to GtkWidget, to unify the * The move-focus signal has been moved to GtkWidget, to unify the
various implementations of this signal in specific widgets. Great care various implementations of this signal in specific widgets. Great care
has been taken to make sure that all code using this signal continues has been taken to make sure that all code using this signal continues
to work. to work.
* An unused and hardly visible GtkFrame has been removed from the menu * An unused and hardly visible GtkFrame has been removed from the menu
widget hierarchy when GtkComboBox::appears-as-list style property is widget hierarchy when GtkComboBox::appears-as-list style property is
set. Any RC file applying a different style to any widget below the set. Any RC file applying a different style to any widget below the
widget path "gtk-combobox-popup-window.GtkFrame" should take into widget path "gtk-combobox-popup-window.GtkFrame" should take into
account that the frame no longer exists. account that the frame no longer exists.
* The external print preview application used by GtkPrintOperationPreview * The external print preview application used by GtkPrintOperationPreview
is now passed the print settings on the command line with the is now passed the print settings on the command line with the
--print-settings parameter pointing to a temp file containing the --print-settings parameter pointing to a temp file containing the
settings. The preview application assumes ownership of the file and settings. The preview application assumes ownership of the file and
should delete it once it does not need it anymore. The --print-settings should delete it once it does not need it anymore. The --print-settings
commandline option is understood by Evince 0.9.0 and newer. To use a commandline option is understood by Evince 0.9.0 and newer. To use a
different print preview application, change the gtk-print-preview-command different print preview application, change the gtk-print-preview-command
setting in your gtkrc file, e.g. gtk-print-preview-command = "ggv %f" setting in your gtkrc file, e.g. gtk-print-preview-command = "ggv %f"
* GtkMenuShell is now defined as an abstract type. It was already * GtkMenuShell is now defined as an abstract type. It was already
documented as an abstract class, and there is little reason to documented as an abstract class, and there is little reason to
instantiate it. instantiate it.
* The GtkTooltips struct (this is the old tooltips API) is now considered * The GtkTooltips struct (this is the old tooltips API) is now considered
private. Code that used to access this struct, in particular the private. Code that used to access this struct, in particular the
tips_data_list field, will need to change. All of the old tooltips tips_data_list field, will need to change. All of the old tooltips
API has been deprecated in favour of a new implementation and API has been deprecated in favour of a new implementation and
API. This affects all of the gtk_tooltips_ functions, and functions API. This affects all of the gtk_tooltips_ functions, and functions
which take a GtkTooltips argument, such as gtk_tool_item_set_tooltip() which take a GtkTooltips argument, such as gtk_tool_item_set_tooltip()
and gtk_menu_tool_button_set_arrow_tooltip(). and gtk_menu_tool_button_set_arrow_tooltip().
* The memory management of the GtkRecentManager object has been changed, * The memory management of the GtkRecentManager object has been changed,
as using the screen didn't guarantee that the singleton instance was as using the screen didn't guarantee that the singleton instance was
correctly destroyed. The screen-related functions have been deprecated, correctly destroyed. The screen-related functions have been deprecated,
@ -203,14 +203,14 @@ Release notes for 2.12
the gtk_recent_manager_get_default() function is guaranteed to be valid the gtk_recent_manager_get_default() function is guaranteed to be valid
for the entire lifetime of an application. for the entire lifetime of an application.
* A number of interfaces that have been superseded by newer interfaces for * A number of interfaces that have been superseded by newer interfaces for
a long time have finally been deprecated. This includes a long time have finally been deprecated. This includes
gtk_widget_ref/unref(), gtk_rc_style_ref/unref() and the old file selector. gtk_widget_ref/unref(), gtk_rc_style_ref/unref() and the old file selector.
* The various coordinate systems in use in GtkTreeView widgets have * The various coordinate systems in use in GtkTreeView widgets have
been clarified in the documentation, and in the cause of doing so, been clarified in the documentation, and in the cause of doing so,
the functions gtk_tree_view_widget_to_tree_coords() and the functions gtk_tree_view_widget_to_tree_coords() and
gtk_tree_view_tree_to_widget_coords() have been deprecated in gtk_tree_view_tree_to_widget_coords() have been deprecated in
favour of a new family of gtk_tree_view_convert_ functions. favour of a new family of gtk_tree_view_convert_ functions.
* gtk_menu_item_remove_submenu() has been deprecated in favour of * gtk_menu_item_remove_submenu() has been deprecated in favour of
@ -254,14 +254,14 @@ Release notes for 2.10
gtk_range_set_[upper/lower]_stepper_sensitivity() functions to gtk_range_set_[upper/lower]_stepper_sensitivity() functions to
prevent the arrows from being rendered insensitive. prevent the arrows from being rendered insensitive.
* GtkObject now uses the "floating reference" support in GObject. * GtkObject now uses the "floating reference" support in GObject.
GTK_OBJECT_IS_FLOATING() will still work, but direct checking GTK_OBJECT_IS_FLOATING() will still work, but direct checking
of the GTK_FLOATING flag will no longer detect the floating of the GTK_FLOATING flag will no longer detect the floating
reference. Details about floating references can be found in the docs: reference. Details about floating references can be found in the docs:
http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#floating-ref http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#floating-ref
* Accelerators like (_F) are now stripped from labels when they are * Accelerators like (_F) are now stripped from labels when they are
displayed in toolbars. If this is not wanted, the feature can be displayed in toolbars. If this is not wanted, the feature can be
suppressed by inserting a Unicode control character, e.g ZWNJ. suppressed by inserting a Unicode control character, e.g ZWNJ.
* The pixbuf theme engine can now customize expanders (in GtkTreeView * The pixbuf theme engine can now customize expanders (in GtkTreeView
@ -274,14 +274,14 @@ Release notes for 2.10
* Several new signals have been added to GtkNotebook. Care has been taken * Several new signals have been added to GtkNotebook. Care has been taken
to choose signal names which do not collide with signals added by well-known to choose signal names which do not collide with signals added by well-known
derived classes. The names which can no longer be used for signals in derived classes. The names which can no longer be used for signals in
objects derived from GtkNotebook are page-reordered, page-removed and objects derived from GtkNotebook are page-reordered, page-removed and
page-added. page-added.
* Due to the interface changes in the file chooser backend interface, * Due to the interface changes in the file chooser backend interface,
the GTK+ ABI version has been bumped to 2.10.0. Third-party filesystem the GTK+ ABI version has been bumped to 2.10.0. Third-party filesystem
backends have to be ported to the new interface, other modules, such as backends have to be ported to the new interface, other modules, such as
theme engines, input method modules or pixbuf loaders have to be rebuilt theme engines, input method modules or pixbuf loaders have to be rebuilt
so that they are installed in the right place for GTK+ to find them. so that they are installed in the right place for GTK+ to find them.
@ -340,19 +340,19 @@ Release notes for 2.6
a clipboard manager following the specification at a clipboard manager following the specification at
http://www.freedesktop.org/wiki/Standards/clipboard-manager-spec http://www.freedesktop.org/wiki/Standards/clipboard-manager-spec
must be running. A sample implementation of such a clipboard manager must be running. A sample implementation of such a clipboard manager
is available at is available at
http://people.imendio.com/andersca/archives/clipboard-manager-0.3.tar.gz http://people.imendio.com/andersca/archives/clipboard-manager-0.3.tar.gz
Applications can use the function gdk_display_supports_clipboard_persistence() Applications can use the function gdk_display_supports_clipboard_persistence()
to find out if clipboard persistence is available. to find out if clipboard persistence is available.
* Notification on clipboard ownership changes via GdkOwnerChange events * Notification on clipboard ownership changes via GdkOwnerChange events
requires the XFIXES X extension. Applications can use the function requires the XFIXES X extension. Applications can use the function
gdk_display_supports_selection_notification() to find out if ownerchip gdk_display_supports_selection_notification() to find out if ownerchip
change notification is available. change notification is available.
* The icon theme code in GTK+ 2.6 follows the freedesktop.org icon theme * The icon theme code in GTK+ 2.6 follows the freedesktop.org icon theme
specification. Setting the XDG_DATA_DIRS environtment variable may be specification. Setting the XDG_DATA_DIRS environtment variable may be
necessary if your icons aren't installed in the default location necessary if your icons aren't installed in the default location
/usr/share/icons. /usr/share/icons.
* The icon theme code in GTK+ 2.6 can make use of mmap()able cache files * The icon theme code in GTK+ 2.6 can make use of mmap()able cache files
@ -360,49 +360,49 @@ Release notes for 2.6
gtk-update-icon-cache to generate these cache files. For further details, gtk-update-icon-cache to generate these cache files. For further details,
see the gtk-update-icon-cache man page or the GTK+ documentation. see the gtk-update-icon-cache man page or the GTK+ documentation.
* To reduce code size and improve efficiency, GTK+, when compiled * To reduce code size and improve efficiency, GTK+, when compiled
with the GNU toolchain, has separate internal and external entry with the GNU toolchain, has separate internal and external entry
points for exported functions. The internal names, which begin with points for exported functions. The internal names, which begin with
IA__, may be seen when debugging a GTK+ program. IA__, may be seen when debugging a GTK+ program.
* The following functions have been deprecated in GTK+ 2.6: * The following functions have been deprecated in GTK+ 2.6:
gdk_pango_context_set_colormap gdk_pango_context_set_colormap
gtk_cell_renderer_editing_canceled gtk_cell_renderer_editing_canceled
* The new GtkFileChooser widget emphasizes simplicity and thus does * The new GtkFileChooser widget emphasizes simplicity and thus does
not provide a navigation entry by default when opening files. not provide a navigation entry by default when opening files.
Experienced command line users will likely want to make heavy use of Experienced command line users will likely want to make heavy use of
the location dialog brought up by the Control-L key shortcut. the location dialog brought up by the Control-L key shortcut.
* The GTK+ libraries use an '_' prefix to indicate private symbols that * The GTK+ libraries use an '_' prefix to indicate private symbols that
must not be used by applications. On some platforms, symbols beginning must not be used by applications. On some platforms, symbols beginning
with prefixes such as _gtk, _gdk, and _pango will be exported with prefixes such as _gtk, _gdk, and _pango will be exported
from the library, on others not. In no case can applications from the library, on others not. In no case can applications
use these private symbols. In addition to that, GTK+ 2.6 makes several use these private symbols. In addition to that, GTK+ 2.6 makes several
symbols private which were not in any installed header files and symbols private which were not in any installed header files and
were never intended to be exported. were never intended to be exported.
* The gdk_pixbuf_xlib library included in the contrib/ directory * The gdk_pixbuf_xlib library included in the contrib/ directory
and the framebuffer GDK backend included in the gdk/linux-fb directory and the framebuffer GDK backend included in the gdk/linux-fb directory
of GTK+ are provided on an as-is basis and have not been tested at all. of GTK+ are provided on an as-is basis and have not been tested at all.
No guarantees about the degree of workingness or about future No guarantees about the degree of workingness or about future
compatibility are provided. compatibility are provided.
* On Unix, the assumption of GLib and GTK+ by default is that filenames on * On Unix, the assumption of GLib and GTK+ by default is that filenames on
the filesystem are encoded in UTF-8 rather than the encoding of the locale; the filesystem are encoded in UTF-8 rather than the encoding of the locale;
the GTK+ developers consider that having filenames whose interpretation the GTK+ developers consider that having filenames whose interpretation
depends on the current locale is fundamentally a bad idea. depends on the current locale is fundamentally a bad idea.
If you have filenames encoded in the encoding of your locale, then you If you have filenames encoded in the encoding of your locale, then you
may want to set the G_FILENAME_ENCODING environment variable: may want to set the G_FILENAME_ENCODING environment variable:
G_FILENAME_ENCODING=@locale G_FILENAME_ENCODING=@locale
export G_FILENAME_ENCODING export G_FILENAME_ENCODING
(Earlier versions of GLib 2.x required a different environment variable (Earlier versions of GLib 2.x required a different environment variable
setting; G_BROKEN_FILENAMES=1 to achieve the same effect; this setting; G_BROKEN_FILENAMES=1 to achieve the same effect; this
is still supported, but G_FILENAME_ENCODING is preferred.) is still supported, but G_FILENAME_ENCODING is preferred.)
Best integration of GTK+ 2.6 with the environment is achieved by Best integration of GTK+ 2.6 with the environment is achieved by
using a UTF-8 locale. using a UTF-8 locale.
On Windows, filenames passed to GTK+ should always be in UTF-8, as On Windows, filenames passed to GTK+ should always be in UTF-8, as
@ -413,7 +413,7 @@ Release notes for 2.6
When compiling against GTK+ 2.6, applications intended to be When compiling against GTK+ 2.6, applications intended to be
portable to Windows must take the UTF-8 file name encoding into portable to Windows must take the UTF-8 file name encoding into
consideration, and use the gstdio wrappers to access files whose consideration, and use the gstdio wrappers to access files whose
names have been constructed from strings returned from GTK+ or GLib. names have been constructed from strings returned from GTK+ or GLib.
@ -423,9 +423,9 @@ How to report bugs
Bugs should be reported to the GNOME bug tracking system. Bugs should be reported to the GNOME bug tracking system.
(http://bugzilla.gnome.org, product gtk+.) You will need to create an (http://bugzilla.gnome.org, product gtk+.) You will need to create an
account for yourself. account for yourself.
In the bug report please include: In the bug report please include:
* Information about your system. For instance: * Information about your system. For instance:
- What operating system and version - What operating system and version
@ -434,12 +434,12 @@ In the bug report please include:
And anything else you think is relevant. And anything else you think is relevant.
* How to reproduce the bug. * How to reproduce the bug.
If you can reproduce it with one of the tests or demos built with GTK+, If you can reproduce it with one of the tests or demos built with GTK+,
such as demos/gtk-demo/gtk-demo, that would be most convenient. Otherwise, such as demos/gtk-demo/gtk-demo, that would be most convenient. Otherwise,
please include a short test program that exhibits the behavior. As a please include a short test program that exhibits the behavior. As a
last resort, you can also provide a pointer to a larger piece of software last resort, you can also provide a pointer to a larger piece of software
that can be downloaded. that can be downloaded.
* If the bug was a crash, the exact text that was printed out when the * If the bug was a crash, the exact text that was printed out when the

View file

@ -150,6 +150,6 @@ cd $ORIGDIR || exit $?
if test -z "$NOCONFIGURE"; then if test -z "$NOCONFIGURE"; then
$srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" || exit $? $srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" || exit $?
echo echo
echo "Now type 'make' to compile $PROJECT." echo "Now type 'make' to compile $PROJECT."
fi fi

View file

@ -249,7 +249,7 @@
/* Define to 1 if your C compiler doesn't accept -c and -o together. */ /* Define to 1 if your C compiler doesn't accept -c and -o together. */
#ifndef _MSC_VER #ifndef _MSC_VER
/* #undef NO_MINUS_C_MINUS_O */ /* #undef NO_MINUS_C_MINUS_O */
#else #else
#define NO_MINUS_C_MINUS_O 1 #define NO_MINUS_C_MINUS_O 1
#endif #endif

View file

@ -296,7 +296,7 @@ AC_SUBST(gtktargetlib)
if test "x$enable_debug" = "xyes"; then if test "x$enable_debug" = "xyes"; then
test "$cflags_set" = set || CFLAGS="$CFLAGS -g" test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG -DG_ERRORCHECK_MUTEXES" GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG -DG_ERRORCHECK_MUTEXES"
else else
if test "x$enable_debug" = "xno"; then if test "x$enable_debug" = "xno"; then
GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS" GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
@ -314,7 +314,7 @@ fi
AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}", AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}",
[Define if debugging is enabled]) [Define if debugging is enabled])
# Build time sanity check... # Build time sanity check...
AM_SANITY_CHECK AM_SANITY_CHECK
@ -384,11 +384,11 @@ fi
# Honor aclocal flags # Honor aclocal flags
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
## Initial sanity check, done here so that users get told they ## Initial sanity check, done here so that users get told they
## have the wrong dependencies as early in the process as possible. ## have the wrong dependencies as early in the process as possible.
## Later on we actually use the cflags/libs from separate pkg-config ## Later on we actually use the cflags/libs from separate pkg-config
## calls. Oh, also the later pkg-config calls don't include ## calls. Oh, also the later pkg-config calls don't include
## the version requirements since those make the module lists ## the version requirements since those make the module lists
## annoying to construct ## annoying to construct
PKG_CHECK_MODULES(BASE_DEPENDENCIES, PKG_CHECK_MODULES(BASE_DEPENDENCIES,
[glib-2.0 >= glib_required_version dnl [glib-2.0 >= glib_required_version dnl
@ -426,7 +426,7 @@ dnl ******************************************************
dnl * See whether to include shared library dependencies * dnl * See whether to include shared library dependencies *
dnl ****************************************************** dnl ******************************************************
AC_ARG_ENABLE(explicit-deps, AC_ARG_ENABLE(explicit-deps,
[AS_HELP_STRING([--enable-explicit-deps=@<:@yes/no/auto@:>@], [AS_HELP_STRING([--enable-explicit-deps=@<:@yes/no/auto@:>@],
[use explicit dependencies in .pc files [default=auto]])],, [use explicit dependencies in .pc files [default=auto]])],,
[enable_explicit_deps=auto]) [enable_explicit_deps=auto])
@ -437,12 +437,12 @@ case $enable_explicit_deps in
export SED export SED
deplibs_check_method=`(./libtool --config; echo 'eval echo \"$deplibs_check_method\"') | sh` deplibs_check_method=`(./libtool --config; echo 'eval echo \"$deplibs_check_method\"') | sh`
if test "x$deplibs_check_method" '!=' xpass_all || test "x$enable_static" = xyes ; then if test "x$deplibs_check_method" '!=' xpass_all || test "x$enable_static" = xyes ; then
enable_explicit_deps=yes enable_explicit_deps=yes
else else
enable_explicit_deps=no enable_explicit_deps=no
fi fi
;; ;;
yes|no) yes|no)
;; ;;
*) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto]) *) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto])
;; ;;
@ -825,7 +825,7 @@ if test x$enable_modules = xno; then
else else
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_MSG_CHECKING(whether dynamic modules work) AC_MSG_CHECKING(whether dynamic modules work)
## for loop is to strip newline ## for loop is to strip newline
tmp=`$PKG_CONFIG --variable=gmodule_supported gmodule-no-export-2.0` tmp=`$PKG_CONFIG --variable=gmodule_supported gmodule-no-export-2.0`
for I in $tmp; do for I in $tmp; do
dynworks=$I dynworks=$I
@ -869,7 +869,7 @@ AC_ARG_WITH(included_immodules,
[ --with-included-immodules=MODULE1,MODULE2,... [ --with-included-immodules=MODULE1,MODULE2,...
build the specified input methods into gtk]) build the specified input methods into gtk])
if $dynworks; then if $dynworks; then
: :
else else
## if the option was specified, leave it; otherwise disable included immodules ## if the option was specified, leave it; otherwise disable included immodules
@ -941,7 +941,7 @@ AC_HEADER_SYS_WAIT
# support. # support.
# #
AC_CHECK_HEADER(sys/systeminfo.h, AC_CHECK_HEADER(sys/systeminfo.h,
AC_DEFINE(HAVE_SYS_SYSTEMINFO_H, 1, AC_DEFINE(HAVE_SYS_SYSTEMINFO_H, 1,
[Define to 1 if sys/systeminfo.h is available])) [Define to 1 if sys/systeminfo.h is available]))
AC_CHECK_HEADER(sys/sysinfo.h, AC_CHECK_HEADER(sys/sysinfo.h,
AC_DEFINE(HAVE_SYS_SYSINFO_H, 1, AC_DEFINE(HAVE_SYS_SYSINFO_H, 1,
@ -982,11 +982,11 @@ fi
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no) AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
if test ! -f $srcdir/gtk/gtkbuiltincache.h && if test ! -f $srcdir/gtk/gtkbuiltincache.h &&
test "x$REBUILD_PNGS" = "x#" ; then test "x$REBUILD_PNGS" = "x#" ; then
AC_MSG_ERROR([ AC_MSG_ERROR([
*** gtkbuiltincache.h is not in the tree, and cannot be built *** gtkbuiltincache.h is not in the tree, and cannot be built
*** because you don't have libpng, or (when cross-compiling) you *** because you don't have libpng, or (when cross-compiling) you
*** don't have a prebuilt gtk-update-icon-cache on the build system.]) *** don't have a prebuilt gtk-update-icon-cache on the build system.])
fi fi
@ -996,7 +996,7 @@ fi
GDK_EXTRA_LIBS="$GDK_WLIBS" GDK_EXTRA_LIBS="$GDK_WLIBS"
GDK_EXTRA_CFLAGS= GDK_EXTRA_CFLAGS=
# GTK+ uses some X calls, so needs to link against X directly # GTK+ uses some X calls, so needs to link against X directly
GTK_DEP_PACKAGES_FOR_X= GTK_DEP_PACKAGES_FOR_X=
GTK_DEP_LIBS_FOR_X= GTK_DEP_LIBS_FOR_X=
@ -1021,12 +1021,12 @@ if test "x$gdktarget" = "xx11"; then
X_PACKAGES="$X_PACKAGES x11 xext xrender" X_PACKAGES="$X_PACKAGES x11 xext xrender"
x_libs="`$PKG_CONFIG --libs x11 xext xrender`" x_libs="`$PKG_CONFIG --libs x11 xext xrender`"
X_CFLAGS="`$PKG_CONFIG --cflags x11 xext xrender`" X_CFLAGS="`$PKG_CONFIG --cflags x11 xext xrender`"
# Strip out any .la files that pkg-config might give us (this happens # Strip out any .la files that pkg-config might give us (this happens
# with -uninstalled.pc files) # with -uninstalled.pc files)
x_libs_for_checks= x_libs_for_checks=
for I in $x_libs ; do for I in $x_libs ; do
case $I in case $I in
*.la) ;; *.la) ;;
*) x_libs_for_checks="$x_libs_for_checks $I" ;; *) x_libs_for_checks="$x_libs_for_checks $I" ;;
esac esac
@ -1039,7 +1039,7 @@ if test "x$gdktarget" = "xx11"; then
if test x$no_x = xyes ; then if test x$no_x = xyes ; then
AC_MSG_ERROR([X development libraries not found]) AC_MSG_ERROR([X development libraries not found])
fi fi
x_cflags="$X_CFLAGS" x_cflags="$X_CFLAGS"
x_libs_for_checks="$X_LIBS -lXext -lXrender -lX11 $X_EXTRA_LIBS" x_libs_for_checks="$X_LIBS -lXext -lXrender -lX11 $X_EXTRA_LIBS"
@ -1054,7 +1054,7 @@ if test "x$gdktarget" = "xx11"; then
gtk_save_LIBS=$LIBS gtk_save_LIBS=$LIBS
LIBS="$x_libs_for_checks $LIBS" LIBS="$x_libs_for_checks $LIBS"
# Sanity check for the X11 and Xext libraries. While everything we need from # Sanity check for the X11 and Xext libraries. While everything we need from
# Xext is optional, the chances a system has *none* of these things is so # Xext is optional, the chances a system has *none* of these things is so
# small that we just unconditionally require it. # small that we just unconditionally require it.
@ -1088,9 +1088,9 @@ if test "x$gdktarget" = "xx11"; then
# Generic X11R6 check needed for XIM support; we could # Generic X11R6 check needed for XIM support; we could
# probably use this to replace the above, but we'll # probably use this to replace the above, but we'll
# leave the separate checks for XConvertCase and XInternAtoms # leave the separate checks for XConvertCase and XInternAtoms
# for clarity # for clarity
have_x11r6=false have_x11r6=false
AC_CHECK_FUNC(XAddConnectionWatch, AC_CHECK_FUNC(XAddConnectionWatch,
have_x11r6=true) have_x11r6=true)
@ -1120,7 +1120,7 @@ if test "x$gdktarget" = "xx11"; then
# X SYNC check # X SYNC check
gtk_save_CFLAGS="$CFLAGS" gtk_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $x_cflags" CFLAGS="$CFLAGS $x_cflags"
AC_CHECK_FUNC(XSyncQueryExtension, AC_CHECK_FUNC(XSyncQueryExtension,
[AC_CHECK_HEADER(X11/extensions/sync.h, [AC_CHECK_HEADER(X11/extensions/sync.h,
AC_DEFINE(HAVE_XSYNC, 1, [Have the SYNC extension library]), AC_DEFINE(HAVE_XSYNC, 1, [Have the SYNC extension library]),
@ -1135,9 +1135,9 @@ if test "x$gdktarget" = "xx11"; then
AC_CHECK_FUNC(XShmAttach, AC_CHECK_FUNC(XShmAttach,
:, :,
# On AIX, it is in XextSam instead # On AIX, it is in XextSam instead
[AC_CHECK_LIB(XextSam, XShmAttach, [AC_CHECK_LIB(XextSam, XShmAttach,
[GTK_ADD_LIB(x_extra_libs,XextSam)])]) [GTK_ADD_LIB(x_extra_libs,XextSam)])])
fi fi
if test "x$enable_shm" = "xyes"; then if test "x$enable_shm" = "xyes"; then
# Check for shared memory # Check for shared memory
@ -1151,7 +1151,7 @@ if test "x$gdktarget" = "xx11"; then
no_sys_shm=yes) no_sys_shm=yes)
# Check for the X shared memory extension header file # Check for the X shared memory extension header file
have_xshm=no have_xshm=no
AC_MSG_CHECKING(X11/extensions/XShm.h) AC_MSG_CHECKING(X11/extensions/XShm.h)
if test "x$no_xext_lib" = "xyes"; then if test "x$no_xext_lib" = "xyes"; then
: :
@ -1183,17 +1183,17 @@ if test "x$gdktarget" = "xx11"; then
# Check for Xinerama extension (Solaris impl or Xfree impl) # Check for Xinerama extension (Solaris impl or Xfree impl)
gtk_save_cppflags="$CPPFLAGS" gtk_save_cppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $x_cflags" CPPFLAGS="$CPPFLAGS $x_cflags"
# Check for XFree # Check for XFree
AC_MSG_CHECKING(for Xinerama support on XFree86) AC_MSG_CHECKING(for Xinerama support on XFree86)
have_xfree_xinerama=false have_xfree_xinerama=false
if $PKG_CONFIG --exists xinerama ; then if $PKG_CONFIG --exists xinerama ; then
have_xfree_xinerama=true have_xfree_xinerama=true
X_PACKAGES="$X_PACKAGES xinerama" X_PACKAGES="$X_PACKAGES xinerama"
else else
AC_CHECK_LIB(Xinerama, XineramaQueryExtension, AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
[AC_CHECK_HEADER(X11/extensions/Xinerama.h, [AC_CHECK_HEADER(X11/extensions/Xinerama.h,
[GTK_ADD_LIB(x_extra_libs,Xinerama) [GTK_ADD_LIB(x_extra_libs,Xinerama)
have_xfree_xinerama=true], :, have_xfree_xinerama=true], :,
[#include <X11/Xlib.h>])]) [#include <X11/Xlib.h>])])
@ -1212,13 +1212,13 @@ if test "x$gdktarget" = "xx11"; then
*-*-solaris*) *-*-solaris*)
# Check for solaris # Check for solaris
AC_MSG_CHECKING(for Xinerama support on Solaris) AC_MSG_CHECKING(for Xinerama support on Solaris)
have_solaris_xinerama=false have_solaris_xinerama=false
AC_CHECK_FUNC(XineramaGetInfo, AC_CHECK_FUNC(XineramaGetInfo,
[AC_CHECK_HEADER(X11/extensions/xinerama.h, [AC_CHECK_HEADER(X11/extensions/xinerama.h,
[have_solaris_xinerama=true], :, [have_solaris_xinerama=true], :,
[#include <X11/Xlib.h>])]) [#include <X11/Xlib.h>])])
if $have_solaris_xinerama ; then if $have_solaris_xinerama ; then
AC_DEFINE(HAVE_SOLARIS_XINERAMA, 1, AC_DEFINE(HAVE_SOLARIS_XINERAMA, 1,
[Define to 1 if solaris xinerama is available]) [Define to 1 if solaris xinerama is available])
@ -1234,13 +1234,13 @@ if test "x$gdktarget" = "xx11"; then
esac esac
fi fi
fi fi
# set up things for XInput # set up things for XInput
if test "x$with_xinput" = "xxfree" || test "x$with_xinput" = "xyes"; then if test "x$with_xinput" = "xxfree" || test "x$with_xinput" = "xyes"; then
AC_DEFINE(XINPUT_XFREE, 1, AC_DEFINE(XINPUT_XFREE, 1,
[Define to 1 if XFree XInput should be used]) [Define to 1 if XFree XInput should be used])
if $PKG_CONFIG --exists xi ; then if $PKG_CONFIG --exists xi ; then
X_PACKAGES="$X_PACKAGES xi" X_PACKAGES="$X_PACKAGES xi"
else else
@ -1262,20 +1262,20 @@ if test "x$gdktarget" = "xx11"; then
fi fi
X_PACKAGES="$X_PACKAGES xrandr" X_PACKAGES="$X_PACKAGES xrandr"
fi fi
# Checks for Xcursor library # Checks for Xcursor library
if $PKG_CONFIG --exists xcursor ; then if $PKG_CONFIG --exists xcursor ; then
AC_DEFINE(HAVE_XCURSOR, 1, [Have the Xcursor library]) AC_DEFINE(HAVE_XCURSOR, 1, [Have the Xcursor library])
X_PACKAGES="$X_PACKAGES xcursor" X_PACKAGES="$X_PACKAGES xcursor"
fi fi
# Checks for XFixes extension # Checks for XFixes extension
if test "x$enable_xfixes" != "xno" && $PKG_CONFIG --exists xfixes ; then if test "x$enable_xfixes" != "xno" && $PKG_CONFIG --exists xfixes ; then
AC_DEFINE(HAVE_XFIXES, 1, [Have the XFIXES X extension]) AC_DEFINE(HAVE_XFIXES, 1, [Have the XFIXES X extension])
X_PACKAGES="$X_PACKAGES xfixes" X_PACKAGES="$X_PACKAGES xfixes"
GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xfixes" GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xfixes"
fi fi
@ -1452,7 +1452,7 @@ if test "x$gdktarget" = "xx11"; then
GTK_PACKAGES="$GTK_PACKAGES pangoft2" GTK_PACKAGES="$GTK_PACKAGES pangoft2"
fi fi
GTK_EXTRA_LIBS= GTK_EXTRA_LIBS=
GTK_EXTRA_CFLAGS= GTK_EXTRA_CFLAGS=
GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES` $GTK_EXTRA_LIBS $MATH_LIB" GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES` $GTK_EXTRA_LIBS $MATH_LIB"
GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES $GTK_PACKAGES` $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS" GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES $GTK_PACKAGES` $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
@ -1499,7 +1499,7 @@ AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
[#include <sys/types.h> [#include <sys/types.h>
#include <sys/un.h>] #include <sys/un.h>]
) )
case $struct_sockaddr_un_sun_len in case $struct_sockaddr_un_sun_len in
true) true)
AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_UN_SUN_LEN, 1, AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_UN_SUN_LEN, 1,
[Have the sockaddr_un.sun_len member]) [Have the sockaddr_un.sun_len member])
@ -1544,7 +1544,7 @@ else
if test $CUPS_API_MAJOR -gt 1 -o \ if test $CUPS_API_MAJOR -gt 1 -o \
$CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 2; then $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 2; then
AC_DEFINE(HAVE_CUPS_API_1_2, 1, AC_DEFINE(HAVE_CUPS_API_1_2, 1,
[Define to 1 if CUPS 1.2 API is available]) [Define to 1 if CUPS 1.2 API is available])
fi fi
if test $CUPS_API_MAJOR -gt 1 -o \ if test $CUPS_API_MAJOR -gt 1 -o \
@ -1617,17 +1617,17 @@ AC_CHECK_HEADER(cairo-pdf.h,,AC_MSG_ERROR([
if test "$os_win32" != "yes"; then if test "$os_win32" != "yes"; then
AC_CHECK_HEADER(cairo-ps.h,,AC_MSG_ERROR([ AC_CHECK_HEADER(cairo-ps.h,,AC_MSG_ERROR([
*** Can't find cairo-ps.h. You must build Cairo with the *** Can't find cairo-ps.h. You must build Cairo with the
*** postscript backend enabled.])) *** postscript backend enabled.]))
AC_CHECK_HEADER(cairo-svg.h,,AC_MSG_ERROR([ AC_CHECK_HEADER(cairo-svg.h,,AC_MSG_ERROR([
*** Can't find cairo-svg.h. You must build Cairo with the *** Can't find cairo-svg.h. You must build Cairo with the
*** svg backend enabled.])) *** svg backend enabled.]))
fi fi
CPPFLAGS="$gtk_save_cppflags" CPPFLAGS="$gtk_save_cppflags"
AC_ARG_ENABLE(test-print-backend, AC_ARG_ENABLE(test-print-backend,
[AS_HELP_STRING([--enable-test-print-backend], [AS_HELP_STRING([--enable-test-print-backend],
[build test print backend])],, [build test print backend])],,

View file

@ -98,7 +98,7 @@ IMAGEFILES= alphatest.png \
gnome-gmush.png \ gnome-gmush.png \
gnome-gsame.png \ gnome-gsame.png \
gnu-keys.png \ gnu-keys.png \
gtk-logo-rgb.gif gtk-logo-rgb.gif
democode_DATA = $(demos) $(IMAGEFILES) demo.ui democode_DATA = $(demos) $(IMAGEFILES) demo.ui

View file

@ -552,7 +552,7 @@ do_appwindow (GtkWidget *do_widget)
/* Show text widget info in the statusbar */ /* Show text widget info in the statusbar */
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
g_signal_connect_object (buffer, g_signal_connect_object (buffer,
"changed", "changed",
G_CALLBACK (update_statusbar), G_CALLBACK (update_statusbar),

View file

@ -33,7 +33,7 @@ do_builder (GtkWidget *do_widget)
static GtkWidget *window = NULL; static GtkWidget *window = NULL;
GError *err = NULL; GError *err = NULL;
gchar *filename; gchar *filename;
if (!window) if (!window)
{ {
builder = gtk_builder_new (); builder = gtk_builder_new ();
@ -58,7 +58,7 @@ do_builder (GtkWidget *do_widget)
gtk_widget_show_all (window); gtk_widget_show_all (window);
} }
else else
{ {
gtk_widget_destroy (window); gtk_widget_destroy (window);
window = NULL; window = NULL;
} }

View file

@ -7,14 +7,14 @@
static GtkWidget * static GtkWidget *
create_bbox (gint horizontal, create_bbox (gint horizontal,
char *title, char *title,
gint spacing, gint spacing,
gint layout) gint layout)
{ {
GtkWidget *frame; GtkWidget *frame;
GtkWidget *bbox; GtkWidget *bbox;
GtkWidget *button; GtkWidget *button;
frame = gtk_frame_new (title); frame = gtk_frame_new (title);
if (horizontal) if (horizontal)
@ -27,13 +27,13 @@ create_bbox (gint horizontal,
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout); gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout);
gtk_box_set_spacing (GTK_BOX (bbox), spacing); gtk_box_set_spacing (GTK_BOX (bbox), spacing);
button = gtk_button_new_from_stock (GTK_STOCK_OK); button = gtk_button_new_from_stock (GTK_STOCK_OK);
gtk_container_add (GTK_CONTAINER (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
gtk_container_add (GTK_CONTAINER (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_from_stock (GTK_STOCK_HELP); button = gtk_button_new_from_stock (GTK_STOCK_HELP);
gtk_container_add (GTK_CONTAINER (bbox), button); gtk_container_add (GTK_CONTAINER (bbox), button);
@ -49,66 +49,66 @@ do_button_box (GtkWidget *do_widget)
GtkWidget *hbox; GtkWidget *hbox;
GtkWidget *frame_horz; GtkWidget *frame_horz;
GtkWidget *frame_vert; GtkWidget *frame_vert;
if (!window) if (!window)
{ {
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window), gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget)); gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes"); gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), G_CALLBACK (gtk_widget_destroyed),
&window); &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_container_set_border_width (GTK_CONTAINER (window), 10);
main_vbox = gtk_vbox_new (FALSE, 0); main_vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), main_vbox); gtk_container_add (GTK_CONTAINER (window), main_vbox);
frame_horz = gtk_frame_new ("Horizontal Button Boxes"); frame_horz = gtk_frame_new ("Horizontal Button Boxes");
gtk_box_pack_start (GTK_BOX (main_vbox), frame_horz, TRUE, TRUE, 10); gtk_box_pack_start (GTK_BOX (main_vbox), frame_horz, TRUE, TRUE, 10);
vbox = gtk_vbox_new (FALSE, 0); vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10); gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
gtk_container_add (GTK_CONTAINER (frame_horz), vbox); gtk_container_add (GTK_CONTAINER (frame_horz), vbox);
gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Spread", 40, GTK_BUTTONBOX_SPREAD), create_bbox (TRUE, "Spread", 40, GTK_BUTTONBOX_SPREAD),
TRUE, TRUE, 0); TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Edge", 40, GTK_BUTTONBOX_EDGE), create_bbox (TRUE, "Edge", 40, GTK_BUTTONBOX_EDGE),
TRUE, TRUE, 5); TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Start", 40, GTK_BUTTONBOX_START), create_bbox (TRUE, "Start", 40, GTK_BUTTONBOX_START),
TRUE, TRUE, 5); TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "End", 40, GTK_BUTTONBOX_END), create_bbox (TRUE, "End", 40, GTK_BUTTONBOX_END),
TRUE, TRUE, 5); TRUE, TRUE, 5);
frame_vert = gtk_frame_new ("Vertical Button Boxes"); frame_vert = gtk_frame_new ("Vertical Button Boxes");
gtk_box_pack_start (GTK_BOX (main_vbox), frame_vert, TRUE, TRUE, 10); gtk_box_pack_start (GTK_BOX (main_vbox), frame_vert, TRUE, TRUE, 10);
hbox = gtk_hbox_new (FALSE, 0); hbox = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10); gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
gtk_container_add (GTK_CONTAINER (frame_vert), hbox); gtk_container_add (GTK_CONTAINER (frame_vert), hbox);
gtk_box_pack_start (GTK_BOX (hbox), gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Spread", 30, GTK_BUTTONBOX_SPREAD), create_bbox (FALSE, "Spread", 30, GTK_BUTTONBOX_SPREAD),
TRUE, TRUE, 0); TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Edge", 30, GTK_BUTTONBOX_EDGE), create_bbox (FALSE, "Edge", 30, GTK_BUTTONBOX_EDGE),
TRUE, TRUE, 5); TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (hbox), gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Start", 30, GTK_BUTTONBOX_START), create_bbox (FALSE, "Start", 30, GTK_BUTTONBOX_START),
TRUE, TRUE, 5); TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (hbox), gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "End", 30, GTK_BUTTONBOX_END), create_bbox (FALSE, "End", 30, GTK_BUTTONBOX_END),
TRUE, TRUE, 5); TRUE, TRUE, 5);
} }
@ -118,7 +118,7 @@ do_button_box (GtkWidget *do_widget)
gtk_widget_show_all (window); gtk_widget_show_all (window);
} }
else else
{ {
gtk_widget_destroy (window); gtk_widget_destroy (window);
window = NULL; window = NULL;
} }

View file

@ -248,9 +248,9 @@ open_display_cb (GtkWidget *button,
gtk_entry_set_activates_default (GTK_ENTRY (display_entry), TRUE); gtk_entry_set_activates_default (GTK_ENTRY (display_entry), TRUE);
dialog_label = dialog_label =
gtk_label_new ("Please enter the name of\nthe new display\n"); gtk_label_new ("Please enter the name of\nthe new display\n");
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_container_add (GTK_CONTAINER (content_area), dialog_label); gtk_container_add (GTK_CONTAINER (content_area), dialog_label);
gtk_container_add (GTK_CONTAINER (content_area), display_entry); gtk_container_add (GTK_CONTAINER (content_area), display_entry);

View file

@ -15,12 +15,12 @@ static GtkWidget *frame;
/* Expose callback for the drawing area /* Expose callback for the drawing area
*/ */
static gboolean static gboolean
expose_event_callback (GtkWidget *widget, expose_event_callback (GtkWidget *widget,
GdkEventExpose *event, GdkEventExpose *event,
gpointer data) gpointer data)
{ {
GdkWindow *window = gtk_widget_get_window (widget); GdkWindow *window = gtk_widget_get_window (widget);
if (window) if (window)
{ {
GtkStyle *style; GtkStyle *style;
@ -47,28 +47,28 @@ change_color_callback (GtkWidget *button,
GtkWidget *dialog; GtkWidget *dialog;
GtkColorSelection *colorsel; GtkColorSelection *colorsel;
gint response; gint response;
dialog = gtk_color_selection_dialog_new ("Changing color"); dialog = gtk_color_selection_dialog_new ("Changing color");
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window)); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
colorsel = colorsel =
GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog))); GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog)));
gtk_color_selection_set_previous_color (colorsel, &color); gtk_color_selection_set_previous_color (colorsel, &color);
gtk_color_selection_set_current_color (colorsel, &color); gtk_color_selection_set_current_color (colorsel, &color);
gtk_color_selection_set_has_palette (colorsel, TRUE); gtk_color_selection_set_has_palette (colorsel, TRUE);
response = gtk_dialog_run (GTK_DIALOG (dialog)); response = gtk_dialog_run (GTK_DIALOG (dialog));
if (response == GTK_RESPONSE_OK) if (response == GTK_RESPONSE_OK)
{ {
gtk_color_selection_get_current_color (colorsel, gtk_color_selection_get_current_color (colorsel,
&color); &color);
gtk_widget_modify_bg (da, GTK_STATE_NORMAL, &color); gtk_widget_modify_bg (da, GTK_STATE_NORMAL, &color);
} }
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
} }
@ -78,13 +78,13 @@ do_colorsel (GtkWidget *do_widget)
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *button; GtkWidget *button;
GtkWidget *alignment; GtkWidget *alignment;
if (!window) if (!window)
{ {
color.red = 0; color.red = 0;
color.blue = 65535; color.blue = 65535;
color.green = 0; color.green = 0;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window), gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget)); gtk_widget_get_screen (do_widget));
@ -102,8 +102,8 @@ do_colorsel (GtkWidget *do_widget)
/* /*
* Create the color swatch area * Create the color swatch area
*/ */
frame = gtk_frame_new (NULL); frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
@ -117,16 +117,16 @@ do_colorsel (GtkWidget *do_widget)
gtk_widget_set_size_request (da, 200, 200); gtk_widget_set_size_request (da, 200, 200);
/* set the color */ /* set the color */
gtk_widget_modify_bg (da, GTK_STATE_NORMAL, &color); gtk_widget_modify_bg (da, GTK_STATE_NORMAL, &color);
gtk_container_add (GTK_CONTAINER (frame), da); gtk_container_add (GTK_CONTAINER (frame), da);
alignment = gtk_alignment_new (1.0, 0.5, 0.0, 0.0); alignment = gtk_alignment_new (1.0, 0.5, 0.0, 0.0);
button = gtk_button_new_with_mnemonic ("_Change the above color"); button = gtk_button_new_with_mnemonic ("_Change the above color");
gtk_container_add (GTK_CONTAINER (alignment), button); gtk_container_add (GTK_CONTAINER (alignment), button);
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (change_color_callback), NULL); G_CALLBACK (change_color_callback), NULL);
} }

View file

@ -1,15 +1,15 @@
/* Combo boxes /* Combo boxes
* *
* The ComboBox widget allows to select one option out of a list. * The ComboBox widget allows to select one option out of a list.
* The ComboBoxEntry additionally allows the user to enter a value * The ComboBoxEntry additionally allows the user to enter a value
* that is not in the list of options. * that is not in the list of options.
* *
* How the options are displayed is controlled by cell renderers. * How the options are displayed is controlled by cell renderers.
*/ */
#include <gtk/gtk.h> #include <gtk/gtk.h>
enum enum
{ {
PIXBUF_COL, PIXBUF_COL,
TEXT_COL TEXT_COL
@ -20,10 +20,10 @@ strip_underscore (const gchar *text)
{ {
gchar *p, *q; gchar *p, *q;
gchar *result; gchar *result;
result = g_strdup (text); result = g_strdup (text);
p = q = result; p = q = result;
while (*p) while (*p)
{ {
if (*p != '_') if (*p != '_')
{ {
@ -46,7 +46,7 @@ create_stock_icon_store (void)
GTK_STOCK_NEW, GTK_STOCK_NEW,
GTK_STOCK_CLEAR, GTK_STOCK_CLEAR,
NULL, NULL,
GTK_STOCK_OPEN GTK_STOCK_OPEN
}; };
GtkStockItem item; GtkStockItem item;
@ -58,7 +58,7 @@ create_stock_icon_store (void)
gint i; gint i;
cellview = gtk_cell_view_new (); cellview = gtk_cell_view_new ();
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING); store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
for (i = 0; i < G_N_ELEMENTS (stock_id); i++) for (i = 0; i < G_N_ELEMENTS (stock_id); i++)
@ -88,12 +88,12 @@ create_stock_icon_store (void)
} }
gtk_widget_destroy (cellview); gtk_widget_destroy (cellview);
return GTK_TREE_MODEL (store); return GTK_TREE_MODEL (store);
} }
/* A GtkCellLayoutDataFunc that demonstrates how one can control /* A GtkCellLayoutDataFunc that demonstrates how one can control
* sensitivity of rows. This particular function does nothing * sensitivity of rows. This particular function does nothing
* useful and just makes the second row insensitive. * useful and just makes the second row insensitive.
*/ */
static void static void
@ -116,7 +116,7 @@ set_sensitive (GtkCellLayout *cell_layout,
} }
/* A GtkTreeViewRowSeparatorFunc that demonstrates how rows can be /* A GtkTreeViewRowSeparatorFunc that demonstrates how rows can be
* rendered as separators. This particular function does nothing * rendered as separators. This particular function does nothing
* useful and just turns the fourth row into a separator. * useful and just turns the fourth row into a separator.
*/ */
static gboolean static gboolean
@ -141,11 +141,11 @@ create_capital_store (void)
gchar *group; gchar *group;
gchar *capital; gchar *capital;
} capitals[] = { } capitals[] = {
{ "A - B", NULL }, { "A - B", NULL },
{ NULL, "Albany" }, { NULL, "Albany" },
{ NULL, "Annapolis" }, { NULL, "Annapolis" },
{ NULL, "Atlanta" }, { NULL, "Atlanta" },
{ NULL, "Augusta" }, { NULL, "Augusta" },
{ NULL, "Austin" }, { NULL, "Austin" },
{ NULL, "Baton Rouge" }, { NULL, "Baton Rouge" },
{ NULL, "Bismarck" }, { NULL, "Bismarck" },
@ -199,13 +199,13 @@ create_capital_store (void)
{ NULL, "Trenton" }, { NULL, "Trenton" },
{ NULL, NULL } { NULL, NULL }
}; };
GtkTreeIter iter, iter2; GtkTreeIter iter, iter2;
GtkTreeStore *store; GtkTreeStore *store;
gint i; gint i;
store = gtk_tree_store_new (1, G_TYPE_STRING); store = gtk_tree_store_new (1, G_TYPE_STRING);
for (i = 0; capitals[i].group || capitals[i].capital; i++) for (i = 0; capitals[i].group || capitals[i].capital; i++)
{ {
if (capitals[i].group) if (capitals[i].group)
@ -219,7 +219,7 @@ create_capital_store (void)
gtk_tree_store_set (store, &iter2, 0, capitals[i].capital, -1); gtk_tree_store_set (store, &iter2, 0, capitals[i].capital, -1);
} }
} }
return GTK_TREE_MODEL (store); return GTK_TREE_MODEL (store);
} }
@ -338,42 +338,42 @@ do_combobox (GtkWidget *do_widget)
gtk_window_set_screen (GTK_WINDOW (window), gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget)); gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Combo boxes"); gtk_window_set_title (GTK_WINDOW (window), "Combo boxes");
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), G_CALLBACK (gtk_widget_destroyed),
&window); &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_container_set_border_width (GTK_CONTAINER (window), 10);
vbox = gtk_vbox_new (FALSE, 2); vbox = gtk_vbox_new (FALSE, 2);
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
/* A combobox demonstrating cell renderers, separators and /* A combobox demonstrating cell renderers, separators and
* insensitive rows * insensitive rows
*/ */
frame = gtk_frame_new ("Some stock icons"); frame = gtk_frame_new ("Some stock icons");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
box = gtk_vbox_new (FALSE, 0); box = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (box), 5); gtk_container_set_border_width (GTK_CONTAINER (box), 5);
gtk_container_add (GTK_CONTAINER (frame), box); gtk_container_add (GTK_CONTAINER (frame), box);
model = create_stock_icon_store (); model = create_stock_icon_store ();
combo = gtk_combo_box_new_with_model (model); combo = gtk_combo_box_new_with_model (model);
g_object_unref (model); g_object_unref (model);
gtk_container_add (GTK_CONTAINER (box), combo); gtk_container_add (GTK_CONTAINER (box), combo);
renderer = gtk_cell_renderer_pixbuf_new (); renderer = gtk_cell_renderer_pixbuf_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
"pixbuf", PIXBUF_COL, "pixbuf", PIXBUF_COL,
NULL); NULL);
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo),
renderer, renderer,
set_sensitive, set_sensitive,
NULL, NULL); NULL, NULL);
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
@ -385,11 +385,11 @@ do_combobox (GtkWidget *do_widget)
set_sensitive, set_sensitive,
NULL, NULL); NULL, NULL);
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo), gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo),
is_separator, NULL, NULL); is_separator, NULL, NULL);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0); gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
/* A combobox demonstrating trees. /* A combobox demonstrating trees.
*/ */
frame = gtk_frame_new ("Where are we ?"); frame = gtk_frame_new ("Where are we ?");
@ -398,7 +398,7 @@ do_combobox (GtkWidget *do_widget)
box = gtk_vbox_new (FALSE, 0); box = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (box), 5); gtk_container_set_border_width (GTK_CONTAINER (box), 5);
gtk_container_add (GTK_CONTAINER (frame), box); gtk_container_add (GTK_CONTAINER (frame), box);
model = create_capital_store (); model = create_capital_store ();
combo = gtk_combo_box_new_with_model (model); combo = gtk_combo_box_new_with_model (model);
g_object_unref (model); g_object_unref (model);
@ -423,21 +423,21 @@ do_combobox (GtkWidget *do_widget)
*/ */
frame = gtk_frame_new ("Editable"); frame = gtk_frame_new ("Editable");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
box = gtk_vbox_new (FALSE, 0); box = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (box), 5); gtk_container_set_border_width (GTK_CONTAINER (box), 5);
gtk_container_add (GTK_CONTAINER (frame), box); gtk_container_add (GTK_CONTAINER (frame), box);
combo = gtk_combo_box_text_new_with_entry (); combo = gtk_combo_box_text_new_with_entry ();
fill_combo_entry (combo); fill_combo_entry (combo);
gtk_container_add (GTK_CONTAINER (box), combo); gtk_container_add (GTK_CONTAINER (box), combo);
entry = g_object_new (TYPE_MASK_ENTRY, NULL); entry = g_object_new (TYPE_MASK_ENTRY, NULL);
MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$"; MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo))); gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
gtk_container_add (GTK_CONTAINER (combo), entry); gtk_container_add (GTK_CONTAINER (combo), entry);
} }
if (!gtk_widget_get_visible (window)) if (!gtk_widget_get_visible (window))
@ -445,7 +445,7 @@ do_combobox (GtkWidget *do_widget)
gtk_widget_show_all (window); gtk_widget_show_all (window);
} }
else else
{ {
gtk_widget_destroy (window); gtk_widget_destroy (window);
window = NULL; window = NULL;
} }

View file

@ -80,7 +80,7 @@ interactive_dialog_clicked (GtkButton *button,
gtk_entry_set_text (GTK_ENTRY (local_entry2), gtk_entry_get_text (GTK_ENTRY (entry2))); gtk_entry_set_text (GTK_ENTRY (local_entry2), gtk_entry_get_text (GTK_ENTRY (entry2)));
gtk_table_attach_defaults (GTK_TABLE (table), local_entry2, 1, 2, 1, 2); gtk_table_attach_defaults (GTK_TABLE (table), local_entry2, 1, 2, 1, 2);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry2); gtk_label_set_mnemonic_widget (GTK_LABEL (label), local_entry2);
gtk_widget_show_all (hbox); gtk_widget_show_all (hbox);
response = gtk_dialog_run (GTK_DIALOG (dialog)); response = gtk_dialog_run (GTK_DIALOG (dialog));
@ -103,7 +103,7 @@ do_dialog (GtkWidget *do_widget)
GtkWidget *button; GtkWidget *button;
GtkWidget *table; GtkWidget *table;
GtkWidget *label; GtkWidget *label;
if (!window) if (!window)
{ {
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@ -157,7 +157,7 @@ do_dialog (GtkWidget *do_widget)
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry1); gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry1);
label = gtk_label_new_with_mnemonic ("E_ntry 2"); label = gtk_label_new_with_mnemonic ("E_ntry 2");
gtk_table_attach_defaults (GTK_TABLE (table), gtk_table_attach_defaults (GTK_TABLE (table),
label, label,
0, 1, 1, 2); 0, 1, 1, 2);
@ -172,7 +172,7 @@ do_dialog (GtkWidget *do_widget)
gtk_widget_show_all (window); gtk_widget_show_all (window);
} }
else else
{ {
gtk_widget_destroy (window); gtk_widget_destroy (window);
window = NULL; window = NULL;
} }

View file

@ -27,7 +27,7 @@ scribble_configure_event (GtkWidget *widget,
{ {
cairo_t *cr; cairo_t *cr;
GtkAllocation allocation; GtkAllocation allocation;
gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_allocation (widget, &allocation);
if (surface) if (surface)
@ -59,7 +59,7 @@ scribble_expose_event (GtkWidget *widget,
cairo_t *cr; cairo_t *cr;
cr = gdk_cairo_create (gtk_widget_get_window (widget)); cr = gdk_cairo_create (gtk_widget_get_window (widget));
cairo_set_source_surface (cr, surface, 0, 0); cairo_set_source_surface (cr, surface, 0, 0);
gdk_cairo_rectangle (cr, &event->area); gdk_cairo_rectangle (cr, &event->area);
cairo_fill (cr); cairo_fill (cr);
@ -152,7 +152,7 @@ checkerboard_expose (GtkWidget *da,
gint i, j, xcount, ycount; gint i, j, xcount, ycount;
cairo_t *cr; cairo_t *cr;
GtkAllocation allocation; GtkAllocation allocation;
gtk_widget_get_allocation (da, &allocation); gtk_widget_get_allocation (da, &allocation);
#define CHECK_SIZE 10 #define CHECK_SIZE 10

View file

@ -6,7 +6,7 @@
* GtkCellRenderer::editing-started signal to do custom setup of the * GtkCellRenderer::editing-started signal to do custom setup of the
* editable widget. * editable widget.
* *
* The cell renderers used in this demo are GtkCellRendererText, * The cell renderers used in this demo are GtkCellRendererText,
* GtkCellRendererCombo and GtkCellRendererProgress. * GtkCellRendererCombo and GtkCellRendererProgress.
*/ */
@ -205,7 +205,7 @@ editing_started (GtkCellRenderer *cell,
const gchar *path, const gchar *path,
gpointer data) gpointer data)
{ {
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (editable), gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (editable),
separator_row, NULL, NULL); separator_row, NULL, NULL);
} }
@ -259,7 +259,7 @@ cell_edited (GtkCellRendererText *cell,
} }
static void static void
add_columns (GtkTreeView *treeview, add_columns (GtkTreeView *treeview,
GtkTreeModel *items_model, GtkTreeModel *items_model,
GtkTreeModel *numbers_model) GtkTreeModel *numbers_model)
{ {
@ -306,7 +306,7 @@ add_columns (GtkTreeView *treeview,
-1, "Yummy", renderer, -1, "Yummy", renderer,
"value", COLUMN_ITEM_YUMMY, "value", COLUMN_ITEM_YUMMY,
NULL); NULL);
} }

View file

@ -15,7 +15,7 @@ create_completion_model (void)
{ {
GtkListStore *store; GtkListStore *store;
GtkTreeIter iter; GtkTreeIter iter;
store = gtk_list_store_new (1, G_TYPE_STRING); store = gtk_list_store_new (1, G_TYPE_STRING);
/* Append one word */ /* Append one word */
@ -29,7 +29,7 @@ create_completion_model (void)
/* And another word */ /* And another word */
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, "totally", -1); gtk_list_store_set (store, &iter, 0, "totally", -1);
return GTK_TREE_MODEL (store); return GTK_TREE_MODEL (store);
} }
@ -42,7 +42,7 @@ do_entry_completion (GtkWidget *do_widget)
GtkWidget *entry; GtkWidget *entry;
GtkEntryCompletion *completion; GtkEntryCompletion *completion;
GtkTreeModel *completion_model; GtkTreeModel *completion_model;
if (!window) if (!window)
{ {
window = gtk_dialog_new_with_buttons ("GtkEntryCompletion", window = gtk_dialog_new_with_buttons ("GtkEntryCompletion",
@ -76,12 +76,12 @@ do_entry_completion (GtkWidget *do_widget)
/* Assign the completion to the entry */ /* Assign the completion to the entry */
gtk_entry_set_completion (GTK_ENTRY (entry), completion); gtk_entry_set_completion (GTK_ENTRY (entry), completion);
g_object_unref (completion); g_object_unref (completion);
/* Create a tree model and use it as the completion model */ /* Create a tree model and use it as the completion model */
completion_model = create_completion_model (); completion_model = create_completion_model ();
gtk_entry_completion_set_model (completion, completion_model); gtk_entry_completion_set_model (completion, completion_model);
g_object_unref (completion_model); g_object_unref (completion_model);
/* Use model column 0 as the text column */ /* Use model column 0 as the text column */
gtk_entry_completion_set_text_column (completion, 0); gtk_entry_completion_set_text_column (completion, 0);
} }

View file

@ -16,7 +16,7 @@ do_expander (GtkWidget *do_widget)
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *label; GtkWidget *label;
GtkWidget *expander; GtkWidget *expander;
if (!window) if (!window)
{ {
window = gtk_dialog_new_with_buttons ("GtkExpander", window = gtk_dialog_new_with_buttons ("GtkExpander",

View file

@ -5,7 +5,7 @@ typedef GtkWidget *(*GDoDemoFunc) (GtkWidget *do_widget);
typedef struct _Demo Demo; typedef struct _Demo Demo;
struct _Demo struct _Demo
{ {
gchar *title; gchar *title;
gchar *filename; gchar *filename;
@ -17,7 +17,7 @@ EOT
for $file (@ARGV) { for $file (@ARGV) {
my %demo; my %demo;
($basename = $file) =~ s/\.c$//; ($basename = $file) =~ s/\.c$//;
open INFO_FILE, $file or die "Cannot open '$file'\n"; open INFO_FILE, $file or die "Cannot open '$file'\n";
@ -46,7 +46,7 @@ foreach $href (@demos) {
$do_next = 1; $do_next = 1;
} }
} }
if ($do_next) { if ($do_next) {
next; next;
} }
@ -66,24 +66,24 @@ if (@parents) {
$i = 0; $i = 0;
for ($i = 0; $i <= $#parents; $i++) { for ($i = 0; $i <= $#parents; $i++) {
$first = 1; $first = 1;
print "\nDemo ", $child_arrays[$i], "[] = {\n"; print "\nDemo ", $child_arrays[$i], "[] = {\n";
$j = 0; $j = 0;
for ($j = 0; $j <= $#demos; $j++) { for ($j = 0; $j <= $#demos; $j++) {
$href = $demos[$j]; $href = $demos[$j];
if (!$demos[$j]) { if (!$demos[$j]) {
next; next;
} }
if ($demos[$j]{"title"} =~ m|^$parents[$i]/([-\w\s]+)$|) { if ($demos[$j]{"title"} =~ m|^$parents[$i]/([-\w\s]+)$|) {
if ($first) { if ($first) {
$first = 0; $first = 0;
} else { } else {
print ",\n"; print ",\n";
} }
print qq ( { "$1", "$demos[$j]{file}", $demos[$j]{func}, NULL }); print qq ( { "$1", "$demos[$j]{file}", $demos[$j]{func}, NULL });
# hack ... ugly # hack ... ugly
@ -94,7 +94,7 @@ if (@parents) {
print ",\n"; print ",\n";
print qq ( { NULL } ); print qq ( { NULL } );
print "\n};\n"; print "\n};\n";
} }
} }
# sort @demos # sort @demos
@ -142,17 +142,17 @@ foreach $href (@demos) {
} else { } else {
print qq ( { "$href->{title}", "$href->{file}", $href->{func}, $child_arrays[$i] }); print qq ( { "$href->{title}", "$href->{file}", $href->{func}, $child_arrays[$i] });
} }
$handled = 1; $handled = 1;
last; last;
} }
} }
} }
if ($handled) { if ($handled) {
next; next;
} }
print qq ( { "$href->{title}", "$href->{file}", $href->{func}, NULL }); print qq ( { "$href->{title}", "$href->{file}", $href->{func}, NULL });
} }

View file

@ -1,8 +1,8 @@
/* Text Widget/Hypertext /* Text Widget/Hypertext
* *
* Usually, tags modify the appearance of text in the view, e.g. making it * Usually, tags modify the appearance of text in the view, e.g. making it
* bold or colored or underlined. But tags are not restricted to appearance. * bold or colored or underlined. But tags are not restricted to appearance.
* They can also affect the behavior of mouse and key presses, as this demo * They can also affect the behavior of mouse and key presses, as this demo
* shows. * shows.
*/ */
@ -12,19 +12,19 @@
/* Inserts a piece of text into the buffer, giving it the usual /* Inserts a piece of text into the buffer, giving it the usual
* appearance of a hyperlink in a web browser: blue and underlined. * appearance of a hyperlink in a web browser: blue and underlined.
* Additionally, attaches some data on the tag, to make it recognizable * Additionally, attaches some data on the tag, to make it recognizable
* as a link. * as a link.
*/ */
static void static void
insert_link (GtkTextBuffer *buffer, insert_link (GtkTextBuffer *buffer,
GtkTextIter *iter, GtkTextIter *iter,
gchar *text, gchar *text,
gint page) gint page)
{ {
GtkTextTag *tag; GtkTextTag *tag;
tag = gtk_text_buffer_create_tag (buffer, NULL, tag = gtk_text_buffer_create_tag (buffer, NULL,
"foreground", "blue", "foreground", "blue",
"underline", PANGO_UNDERLINE_SINGLE, "underline", PANGO_UNDERLINE_SINGLE,
NULL); NULL);
g_object_set_data (G_OBJECT (tag), "page", GINT_TO_POINTER (page)); g_object_set_data (G_OBJECT (tag), "page", GINT_TO_POINTER (page));
gtk_text_buffer_insert_with_tags (buffer, iter, text, -1, tag, NULL); gtk_text_buffer_insert_with_tags (buffer, iter, text, -1, tag, NULL);
@ -34,7 +34,7 @@ insert_link (GtkTextBuffer *buffer,
* hypertext app, this method would parse a file to identify the links. * hypertext app, this method would parse a file to identify the links.
*/ */
static void static void
show_page (GtkTextBuffer *buffer, show_page (GtkTextBuffer *buffer,
gint page) gint page)
{ {
GtkTextIter iter; GtkTextIter iter;
@ -51,7 +51,7 @@ show_page (GtkTextBuffer *buffer,
} }
else if (page == 2) else if (page == 2)
{ {
gtk_text_buffer_insert (buffer, &iter, gtk_text_buffer_insert (buffer, &iter,
"A tag is an attribute that can be applied to some range of text. " "A tag is an attribute that can be applied to some range of text. "
"For example, a tag might be called \"bold\" and make the text inside " "For example, a tag might be called \"bold\" and make the text inside "
"the tag bold. However, the tag concept is more general than that; " "the tag bold. However, the tag concept is more general than that; "
@ -60,27 +60,27 @@ show_page (GtkTextBuffer *buffer,
"user can't edit it, or countless other things.\n", -1); "user can't edit it, or countless other things.\n", -1);
insert_link (buffer, &iter, "Go back", 1); insert_link (buffer, &iter, "Go back", 1);
} }
else if (page == 3) else if (page == 3)
{ {
GtkTextTag *tag; GtkTextTag *tag;
tag = gtk_text_buffer_create_tag (buffer, NULL, tag = gtk_text_buffer_create_tag (buffer, NULL,
"weight", PANGO_WEIGHT_BOLD, "weight", PANGO_WEIGHT_BOLD,
NULL); NULL);
gtk_text_buffer_insert_with_tags (buffer, &iter, "hypertext:\n", -1, tag, NULL); gtk_text_buffer_insert_with_tags (buffer, &iter, "hypertext:\n", -1, tag, NULL);
gtk_text_buffer_insert (buffer, &iter, gtk_text_buffer_insert (buffer, &iter,
"machine-readable text that is not sequential but is organized " "machine-readable text that is not sequential but is organized "
"so that related items of information are connected.\n", -1); "so that related items of information are connected.\n", -1);
insert_link (buffer, &iter, "Go back", 1); insert_link (buffer, &iter, "Go back", 1);
} }
} }
/* Looks at all tags covering the position of iter in the text view, /* Looks at all tags covering the position of iter in the text view,
* and if one of them is a link, follow it by showing the page identified * and if one of them is a link, follow it by showing the page identified
* by the data attached to it. * by the data attached to it.
*/ */
static void static void
follow_if_link (GtkWidget *text_view, follow_if_link (GtkWidget *text_view,
GtkTextIter *iter) GtkTextIter *iter)
{ {
GSList *tags = NULL, *tagp = NULL; GSList *tags = NULL, *tagp = NULL;
@ -98,7 +98,7 @@ follow_if_link (GtkWidget *text_view,
} }
} }
if (tags) if (tags)
g_slist_free (tags); g_slist_free (tags);
} }
@ -113,10 +113,10 @@ key_press_event (GtkWidget *text_view,
switch (event->keyval) switch (event->keyval)
{ {
case GDK_Return: case GDK_Return:
case GDK_KP_Enter: case GDK_KP_Enter:
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
gtk_text_buffer_get_iter_at_mark (buffer, &iter, gtk_text_buffer_get_iter_at_mark (buffer, &iter,
gtk_text_buffer_get_insert (buffer)); gtk_text_buffer_get_insert (buffer));
follow_if_link (text_view, &iter); follow_if_link (text_view, &iter);
break; break;
@ -154,7 +154,7 @@ event_after (GtkWidget *text_view,
if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end)) if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end))
return FALSE; return FALSE;
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view), gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET, GTK_TEXT_WINDOW_WIDGET,
event->x, event->y, &x, &y); event->x, event->y, &x, &y);
@ -169,7 +169,7 @@ static gboolean hovering_over_link = FALSE;
static GdkCursor *hand_cursor = NULL; static GdkCursor *hand_cursor = NULL;
static GdkCursor *regular_cursor = NULL; static GdkCursor *regular_cursor = NULL;
/* Looks at all tags covering the position (x, y) in the text view, /* Looks at all tags covering the position (x, y) in the text view,
* and if one of them is a link, change the cursor to the "hands" cursor * and if one of them is a link, change the cursor to the "hands" cursor
* typically used by web browsers. * typically used by web browsers.
*/ */
@ -183,14 +183,14 @@ set_cursor_if_appropriate (GtkTextView *text_view,
gboolean hovering = FALSE; gboolean hovering = FALSE;
gtk_text_view_get_iter_at_location (text_view, &iter, x, y); gtk_text_view_get_iter_at_location (text_view, &iter, x, y);
tags = gtk_text_iter_get_tags (&iter); tags = gtk_text_iter_get_tags (&iter);
for (tagp = tags; tagp != NULL; tagp = tagp->next) for (tagp = tags; tagp != NULL; tagp = tagp->next)
{ {
GtkTextTag *tag = tagp->data; GtkTextTag *tag = tagp->data;
gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page")); gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
if (page != 0) if (page != 0)
{ {
hovering = TRUE; hovering = TRUE;
break; break;
@ -207,11 +207,11 @@ set_cursor_if_appropriate (GtkTextView *text_view,
gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), regular_cursor); gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), regular_cursor);
} }
if (tags) if (tags)
g_slist_free (tags); g_slist_free (tags);
} }
/* Update the cursor image if the pointer moved. /* Update the cursor image if the pointer moved.
*/ */
static gboolean static gboolean
motion_notify_event (GtkWidget *text_view, motion_notify_event (GtkWidget *text_view,
@ -219,7 +219,7 @@ motion_notify_event (GtkWidget *text_view,
{ {
gint x, y; gint x, y;
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view), gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET, GTK_TEXT_WINDOW_WIDGET,
event->x, event->y, &x, &y); event->x, event->y, &x, &y);
@ -237,10 +237,10 @@ visibility_notify_event (GtkWidget *text_view,
GdkEventVisibility *event) GdkEventVisibility *event)
{ {
gint wx, wy, bx, by; gint wx, wy, bx, by;
gdk_window_get_pointer (gtk_widget_get_window (text_view), &wx, &wy, NULL); gdk_window_get_pointer (gtk_widget_get_window (text_view), &wx, &wy, NULL);
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view), gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET, GTK_TEXT_WINDOW_WIDGET,
wx, wy, &bx, &by); wx, wy, &bx, &by);
@ -262,13 +262,13 @@ do_hypertext (GtkWidget *do_widget)
hand_cursor = gdk_cursor_new (GDK_HAND2); hand_cursor = gdk_cursor_new (GDK_HAND2);
regular_cursor = gdk_cursor_new (GDK_XTERM); regular_cursor = gdk_cursor_new (GDK_XTERM);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window), gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget)); gtk_widget_get_screen (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), gtk_window_set_default_size (GTK_WINDOW (window),
450, 450); 450, 450);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window); G_CALLBACK (gtk_widget_destroyed), &window);
@ -277,17 +277,17 @@ do_hypertext (GtkWidget *do_widget)
view = gtk_text_view_new (); view = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
g_signal_connect (view, "key-press-event", g_signal_connect (view, "key-press-event",
G_CALLBACK (key_press_event), NULL); G_CALLBACK (key_press_event), NULL);
g_signal_connect (view, "event-after", g_signal_connect (view, "event-after",
G_CALLBACK (event_after), NULL); G_CALLBACK (event_after), NULL);
g_signal_connect (view, "motion-notify-event", g_signal_connect (view, "motion-notify-event",
G_CALLBACK (motion_notify_event), NULL); G_CALLBACK (motion_notify_event), NULL);
g_signal_connect (view, "visibility-notify-event", g_signal_connect (view, "visibility-notify-event",
G_CALLBACK (visibility_notify_event), NULL); G_CALLBACK (visibility_notify_event), NULL);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
sw = gtk_scrolled_window_new (NULL, NULL); sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,

View file

@ -59,11 +59,11 @@ get_democodedir (void)
* demo_find_file: * demo_find_file:
* @base: base filename * @base: base filename
* @err: location to store error, or %NULL. * @err: location to store error, or %NULL.
* *
* Looks for @base first in the current directory, then in the * Looks for @base first in the current directory, then in the
* location GTK+ where it will be installed on make install, * location GTK+ where it will be installed on make install,
* returns the first file found. * returns the first file found.
* *
* Return value: the filename, if found or %NULL * Return value: the filename, if found or %NULL
**/ **/
gchar * gchar *
@ -71,7 +71,7 @@ demo_find_file (const char *base,
GError **err) GError **err)
{ {
g_return_val_if_fail (err == NULL || *err == NULL, NULL); g_return_val_if_fail (err == NULL || *err == NULL, NULL);
if (g_file_test ("gtk-logo-rgb.gif", G_FILE_TEST_EXISTS) && if (g_file_test ("gtk-logo-rgb.gif", G_FILE_TEST_EXISTS) &&
g_file_test (base, G_FILE_TEST_EXISTS)) g_file_test (base, G_FILE_TEST_EXISTS))
return g_strdup (base); return g_strdup (base);
@ -113,17 +113,17 @@ gboolean
read_line (FILE *stream, GString *str) read_line (FILE *stream, GString *str)
{ {
int n_read = 0; int n_read = 0;
#ifdef HAVE_FLOCKFILE #ifdef HAVE_FLOCKFILE
flockfile (stream); flockfile (stream);
#endif #endif
g_string_truncate (str, 0); g_string_truncate (str, 0);
while (1) while (1)
{ {
int c; int c;
#ifdef HAVE_FLOCKFILE #ifdef HAVE_FLOCKFILE
c = getc_unlocked (stream); c = getc_unlocked (stream);
#else #else
@ -145,12 +145,12 @@ read_line (FILE *stream, GString *str)
#else #else
int next_c = getc (stream); int next_c = getc (stream);
#endif #endif
if (!(next_c == EOF || if (!(next_c == EOF ||
(c == '\r' && next_c == '\n') || (c == '\r' && next_c == '\n') ||
(c == '\n' && next_c == '\r'))) (c == '\n' && next_c == '\r')))
ungetc (next_c, stream); ungetc (next_c, stream);
goto done; goto done;
} }
default: default:
@ -534,7 +534,7 @@ load_file (const gchar *filename)
g_free (current_file); g_free (current_file);
current_file = g_strdup (filename); current_file = g_strdup (filename);
gtk_text_buffer_get_bounds (info_buffer, &start, &end); gtk_text_buffer_get_bounds (info_buffer, &start, &end);
gtk_text_buffer_delete (info_buffer, &start, &end); gtk_text_buffer_delete (info_buffer, &start, &end);
@ -565,7 +565,7 @@ load_file (const gchar *filename)
gchar *p = buffer->str; gchar *p = buffer->str;
gchar *q; gchar *q;
gchar *r; gchar *r;
switch (state) switch (state)
{ {
case 0: case 0:
@ -595,11 +595,11 @@ load_file (const gchar *filename)
gtk_text_buffer_apply_tag_by_name (info_buffer, "title", &start, &end); gtk_text_buffer_apply_tag_by_name (info_buffer, "title", &start, &end);
start = end; start = end;
state++; state++;
} }
break; break;
case 1: case 1:
/* Reading body of info section */ /* Reading body of info section */
while (g_ascii_isspace (*p)) while (g_ascii_isspace (*p))
@ -612,14 +612,14 @@ load_file (const gchar *filename)
else else
{ {
int len; int len;
while (*p == '*' || g_ascii_isspace (*p)) while (*p == '*' || g_ascii_isspace (*p))
p++; p++;
len = strlen (p); len = strlen (p);
while (g_ascii_isspace (*(p + len - 1))) while (g_ascii_isspace (*(p + len - 1)))
len--; len--;
if (len > 0) if (len > 0)
{ {
if (in_para) if (in_para)
@ -649,7 +649,7 @@ load_file (const gchar *filename)
} }
else else
break; break;
case 3: case 3:
/* Reading program body */ /* Reading program body */
gtk_text_buffer_insert (source_buffer, &start, p, -1); gtk_text_buffer_insert (source_buffer, &start, p, -1);
@ -659,7 +659,7 @@ load_file (const gchar *filename)
} }
fclose (file); fclose (file);
fontify (); fontify ();
g_string_free (buffer, TRUE); g_string_free (buffer, TRUE);
@ -677,7 +677,7 @@ row_activated_cb (GtkTreeView *tree_view,
GtkTreeModel *model; GtkTreeModel *model;
model = gtk_tree_view_get_model (tree_view); model = gtk_tree_view_get_model (tree_view);
gtk_tree_model_get_iter (model, &iter, path); gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (GTK_TREE_MODEL (model), gtk_tree_model_get (GTK_TREE_MODEL (model),
&iter, &iter,
@ -692,15 +692,15 @@ row_activated_cb (GtkTreeView *tree_view,
STYLE_COLUMN, (style == PANGO_STYLE_ITALIC ? PANGO_STYLE_NORMAL : PANGO_STYLE_ITALIC), STYLE_COLUMN, (style == PANGO_STYLE_ITALIC ? PANGO_STYLE_NORMAL : PANGO_STYLE_ITALIC),
-1); -1);
window = (func) (gtk_widget_get_toplevel (GTK_WIDGET (tree_view))); window = (func) (gtk_widget_get_toplevel (GTK_WIDGET (tree_view)));
if (window != NULL) if (window != NULL)
{ {
CallbackData *cbdata; CallbackData *cbdata;
cbdata = g_new (CallbackData, 1); cbdata = g_new (CallbackData, 1);
cbdata->model = model; cbdata->model = model;
cbdata->path = gtk_tree_path_copy (path); cbdata->path = gtk_tree_path_copy (path);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (window_closed_cb), cbdata); G_CALLBACK (window_closed_cb), cbdata);
} }
@ -739,16 +739,16 @@ create_text (GtkTextBuffer **buffer,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_SHADOW_IN); GTK_SHADOW_IN);
text_view = gtk_text_view_new (); text_view = gtk_text_view_new ();
*buffer = gtk_text_buffer_new (NULL); *buffer = gtk_text_buffer_new (NULL);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), *buffer); gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), *buffer);
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE); gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view); gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
if (is_source) if (is_source)
{ {
font_desc = pango_font_description_from_string ("monospace"); font_desc = pango_font_description_from_string ("monospace");
@ -768,7 +768,7 @@ create_text (GtkTextBuffer **buffer,
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view), gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view),
2); 2);
} }
return scrolled_window; return scrolled_window;
} }
@ -815,13 +815,13 @@ create_tree (void)
if (!children) if (!children)
continue; continue;
while (children->title) while (children->title)
{ {
GtkTreeIter child_iter; GtkTreeIter child_iter;
gtk_tree_store_append (GTK_TREE_STORE (model), &child_iter, &iter); gtk_tree_store_append (GTK_TREE_STORE (model), &child_iter, &iter);
gtk_tree_store_set (GTK_TREE_STORE (model), gtk_tree_store_set (GTK_TREE_STORE (model),
&child_iter, &child_iter,
TITLE_COLUMN, children->title, TITLE_COLUMN, children->title,
@ -829,7 +829,7 @@ create_tree (void)
FUNC_COLUMN, children->func, FUNC_COLUMN, children->func,
STYLE_COLUMN, PANGO_STYLE_NORMAL, STYLE_COLUMN, PANGO_STYLE_NORMAL,
-1); -1);
children++; children++;
} }
} }
@ -841,7 +841,7 @@ create_tree (void)
"text", TITLE_COLUMN, "text", TITLE_COLUMN,
"style", STYLE_COLUMN, "style", STYLE_COLUMN,
NULL); NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
GTK_TREE_VIEW_COLUMN (column)); GTK_TREE_VIEW_COLUMN (column));
@ -853,7 +853,7 @@ create_tree (void)
gtk_tree_view_collapse_all (GTK_TREE_VIEW (tree_view)); gtk_tree_view_collapse_all (GTK_TREE_VIEW (tree_view));
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_NEVER, GTK_POLICY_NEVER,
@ -896,7 +896,7 @@ setup_default_icon (void)
if (err) if (err)
{ {
GtkWidget *dialog; GtkWidget *dialog;
dialog = gtk_message_dialog_new (NULL, 0, dialog = gtk_message_dialog_new (NULL, 0,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, GTK_BUTTONS_CLOSE,
@ -910,7 +910,7 @@ setup_default_icon (void)
if (pixbuf) if (pixbuf)
{ {
GList *list; GList *list;
GdkPixbuf *transparent; GdkPixbuf *transparent;
/* The gtk-logo-rgb icon has a white background, make it transparent */ /* The gtk-logo-rgb icon has a white background, make it transparent */
@ -944,11 +944,11 @@ main (int argc, char **argv)
g_setenv ("GTK_IM_MODULE_FILE", "../../modules/input/immodules.cache", TRUE); g_setenv ("GTK_IM_MODULE_FILE", "../../modules/input/immodules.cache", TRUE);
} }
/* -- End of hack -- */ /* -- End of hack -- */
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
setup_default_icon (); setup_default_icon ();
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "GTK+ Code Demos"); gtk_window_set_title (GTK_WINDOW (window), "GTK+ Code Demos");
g_signal_connect_after (window, "destroy", g_signal_connect_after (window, "destroy",
@ -999,13 +999,13 @@ main (int argc, char **argv)
"foreground", "DarkGoldenrod4", "foreground", "DarkGoldenrod4",
NULL); NULL);
g_object_unref (source_buffer); g_object_unref (source_buffer);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
gtk_widget_show_all (window); gtk_widget_show_all (window);
load_file (testgtk_demos[0].filename); load_file (testgtk_demos[0].filename);
gtk_main (); gtk_main ();
return 0; return 0;

View file

@ -1,7 +1,7 @@
## Makefile for building the gtk test apps with Microsoft C ## Makefile for building the gtk test apps with Microsoft C
## Use: nmake -f makefile.msc ## Use: nmake -f makefile.msc
## There is no install target, you have to decide where and ## There is no install target, you have to decide where and
## how to install for yourself. ## how to install for yourself.
TOP = ..\..\.. TOP = ..\..\..
@ -33,7 +33,7 @@ all : \
demos.h \ demos.h \
gtk-demo.exe gtk-demo.exe
## These should be in the order you want them to appear in the ## These should be in the order you want them to appear in the
## demo app, which means alphabetized by demo title, not filename ## demo app, which means alphabetized by demo title, not filename
DEMOS = \ DEMOS = \
appwindow.c \ appwindow.c \

View file

@ -87,7 +87,7 @@ change_orientation (GtkWidget *button,
gtk_container_add (GTK_CONTAINER (box), menubar); gtk_container_add (GTK_CONTAINER (box), menubar);
gtk_box_reorder_child (GTK_BOX (box), menubar, 0); gtk_box_reorder_child (GTK_BOX (box), menubar, 0);
g_object_unref (menubar); g_object_unref (menubar);
g_object_set (menubar, g_object_set (menubar,
"pack-direction", GTK_PACK_DIRECTION_TTB, "pack-direction", GTK_PACK_DIRECTION_TTB,
NULL); NULL);
} }
@ -111,7 +111,7 @@ change_orientation (GtkWidget *button,
gtk_container_add (GTK_CONTAINER (box), menubar); gtk_container_add (GTK_CONTAINER (box), menubar);
gtk_box_reorder_child (GTK_BOX (box), menubar, 0); gtk_box_reorder_child (GTK_BOX (box), menubar, 0);
g_object_unref (menubar); g_object_unref (menubar);
g_object_set (menubar, g_object_set (menubar,
"pack-direction", GTK_PACK_DIRECTION_LTR, "pack-direction", GTK_PACK_DIRECTION_LTR,
NULL); NULL);
} }

View file

@ -256,7 +256,7 @@ gtk_rotated_bin_realize (GtkWidget *widget)
attributes.wclass = GDK_INPUT_OUTPUT; attributes.wclass = GDK_INPUT_OUTPUT;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
gdk_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); gdk_window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
gtk_widget_set_window (widget, gdk_window); gtk_widget_set_window (widget, gdk_window);
gdk_window_set_user_data (gdk_window, widget); gdk_window_set_user_data (gdk_window, widget);
@ -384,9 +384,9 @@ gtk_rotated_bin_size_request (GtkWidget *widget,
gint border_width; gint border_width;
double s, c; double s, c;
double w, h; double w, h;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
child_requisition.width = 0; child_requisition.width = 0;
child_requisition.height = 0; child_requisition.height = 0;

View file

@ -194,7 +194,7 @@ gtk_mirror_bin_realize (GtkWidget *widget)
attributes.wclass = GDK_INPUT_OUTPUT; attributes.wclass = GDK_INPUT_OUTPUT;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
gdk_window = gdk_window_new (gtk_widget_get_parent_window (widget), gdk_window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask); &attributes, attributes_mask);
gtk_widget_set_window (widget, gdk_window); gtk_widget_set_window (widget, gdk_window);
@ -309,7 +309,7 @@ gtk_mirror_bin_size_request (GtkWidget *widget,
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget); GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
GtkRequisition child_requisition; GtkRequisition child_requisition;
gint border_width; gint border_width;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
child_requisition.width = 0; child_requisition.width = 0;
@ -329,7 +329,7 @@ gtk_mirror_bin_size_allocate (GtkWidget *widget,
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget); GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
gint border_width; gint border_width;
gint w, h; gint w, h;
gtk_widget_set_allocation (widget, allocation); gtk_widget_set_allocation (widget, allocation);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));

View file

@ -63,26 +63,26 @@ create_pane_options (GtkPaned *paned,
GtkWidget *check_button; GtkWidget *check_button;
GtkWidget *child1; GtkWidget *child1;
GtkWidget *child2; GtkWidget *child2;
child1 = gtk_paned_get_child1 (paned); child1 = gtk_paned_get_child1 (paned);
child2 = gtk_paned_get_child2 (paned); child2 = gtk_paned_get_child2 (paned);
frame = gtk_frame_new (frame_label); frame = gtk_frame_new (frame_label);
gtk_container_set_border_width (GTK_CONTAINER (frame), 4); gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
table = gtk_table_new (3, 2, TRUE); table = gtk_table_new (3, 2, TRUE);
gtk_container_add (GTK_CONTAINER (frame), table); gtk_container_add (GTK_CONTAINER (frame), table);
label = gtk_label_new (label1); label = gtk_label_new (label1);
gtk_table_attach_defaults (GTK_TABLE (table), label, gtk_table_attach_defaults (GTK_TABLE (table), label,
0, 1, 0, 1); 0, 1, 0, 1);
check_button = gtk_check_button_new_with_mnemonic ("_Resize"); check_button = gtk_check_button_new_with_mnemonic ("_Resize");
gtk_table_attach_defaults (GTK_TABLE (table), check_button, gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 1, 2); 0, 1, 1, 2);
g_signal_connect (check_button, "toggled", g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_resize), child1); G_CALLBACK (toggle_resize), child1);
check_button = gtk_check_button_new_with_mnemonic ("_Shrink"); check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button, gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 2, 3); 0, 1, 2, 3);
@ -90,11 +90,11 @@ create_pane_options (GtkPaned *paned,
TRUE); TRUE);
g_signal_connect (check_button, "toggled", g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_shrink), child1); G_CALLBACK (toggle_shrink), child1);
label = gtk_label_new (label2); label = gtk_label_new (label2);
gtk_table_attach_defaults (GTK_TABLE (table), label, gtk_table_attach_defaults (GTK_TABLE (table), label,
1, 2, 0, 1); 1, 2, 0, 1);
check_button = gtk_check_button_new_with_mnemonic ("_Resize"); check_button = gtk_check_button_new_with_mnemonic ("_Resize");
gtk_table_attach_defaults (GTK_TABLE (table), check_button, gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 1, 2); 1, 2, 1, 2);
@ -102,7 +102,7 @@ create_pane_options (GtkPaned *paned,
TRUE); TRUE);
g_signal_connect (check_button, "toggled", g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_resize), child2); G_CALLBACK (toggle_resize), child2);
check_button = gtk_check_button_new_with_mnemonic ("_Shrink"); check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button, gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 2, 3); 1, 2, 2, 3);
@ -138,7 +138,7 @@ do_panes (GtkWidget *do_widget)
vbox = gtk_vbox_new (FALSE, 0); vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
vpaned = gtk_vpaned_new (); vpaned = gtk_vpaned_new ();
gtk_box_pack_start (GTK_BOX (vbox), vpaned, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), vpaned, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5); gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5);
@ -150,7 +150,7 @@ do_panes (GtkWidget *do_widget)
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_size_request (frame, 60, 60); gtk_widget_set_size_request (frame, 60, 60);
gtk_paned_add1 (GTK_PANED (hpaned), frame); gtk_paned_add1 (GTK_PANED (hpaned), frame);
button = gtk_button_new_with_mnemonic ("_Hi there"); button = gtk_button_new_with_mnemonic ("_Hi there");
gtk_container_add (GTK_CONTAINER(frame), button); gtk_container_add (GTK_CONTAINER(frame), button);

View file

@ -1,4 +1,4 @@
/* Pickers /* Pickers
* *
* These widgets are mainly intended for use in preference dialogs. * These widgets are mainly intended for use in preference dialogs.
* They allow to select colors, fonts, files and directories. * They allow to select colors, fonts, files and directories.
@ -18,14 +18,14 @@ do_pickers (GtkWidget *do_widget)
gtk_window_set_screen (GTK_WINDOW (window), gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget)); gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Pickers"); gtk_window_set_title (GTK_WINDOW (window), "Pickers");
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), G_CALLBACK (gtk_widget_destroyed),
&window); &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_container_set_border_width (GTK_CONTAINER (window), 10);
table = gtk_table_new (4, 2, FALSE); table = gtk_table_new (4, 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10); gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
gtk_table_set_row_spacings (GTK_TABLE (table), 3); gtk_table_set_row_spacings (GTK_TABLE (table), 3);
gtk_container_add (GTK_CONTAINER (window), table); gtk_container_add (GTK_CONTAINER (window), table);
@ -46,14 +46,14 @@ do_pickers (GtkWidget *do_widget)
label = gtk_label_new ("File:"); label = gtk_label_new ("File:");
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
picker = gtk_file_chooser_button_new ("Pick a File", picker = gtk_file_chooser_button_new ("Pick a File",
GTK_FILE_CHOOSER_ACTION_OPEN); GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 2, 3);
gtk_table_attach_defaults (GTK_TABLE (table), picker, 1, 2, 2, 3); gtk_table_attach_defaults (GTK_TABLE (table), picker, 1, 2, 2, 3);
label = gtk_label_new ("Folder:"); label = gtk_label_new ("Folder:");
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
picker = gtk_file_chooser_button_new ("Pick a Folder", picker = gtk_file_chooser_button_new ("Pick a Folder",
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 3, 4);
gtk_table_attach_defaults (GTK_TABLE (table), picker, 1, 2, 3, 4); gtk_table_attach_defaults (GTK_TABLE (table), picker, 1, 2, 3, 4);
@ -64,7 +64,7 @@ do_pickers (GtkWidget *do_widget)
gtk_widget_show_all (window); gtk_widget_show_all (window);
} }
else else
{ {
gtk_widget_destroy (window); gtk_widget_destroy (window);
window = NULL; window = NULL;
} }

View file

@ -71,7 +71,7 @@ load_pixbufs (GError **error)
background = gdk_pixbuf_new_from_file (filename, error); background = gdk_pixbuf_new_from_file (filename, error);
g_free (filename); g_free (filename);
if (!background) if (!background)
return FALSE; /* Note that "error" was filled with a GError */ return FALSE; /* Note that "error" was filled with a GError */
@ -83,10 +83,10 @@ load_pixbufs (GError **error)
filename = demo_find_file (image_names[i], error); filename = demo_find_file (image_names[i], error);
if (!filename) if (!filename)
return FALSE; /* Note that "error" was filled with a GError */ return FALSE; /* Note that "error" was filled with a GError */
images[i] = gdk_pixbuf_new_from_file (filename, error); images[i] = gdk_pixbuf_new_from_file (filename, error);
g_free (filename); g_free (filename);
if (!images[i]) if (!images[i])
return FALSE; /* Note that "error" was filled with a GError */ return FALSE; /* Note that "error" was filled with a GError */
} }

View file

@ -75,7 +75,7 @@ create_fancy_attr_list_for_layout (PangoLayout *layout)
for (p = text; (p = strstr (p, HEART)); p += strlen (HEART)) for (p = text; (p = strstr (p, HEART)); p += strlen (HEART))
{ {
PangoAttribute *attr; PangoAttribute *attr;
attr = pango_attr_shape_new_with_data (&ink_rect, attr = pango_attr_shape_new_with_data (&ink_rect,
&logical_rect, &logical_rect,
GUINT_TO_POINTER (g_utf8_get_char (p)), GUINT_TO_POINTER (g_utf8_get_char (p)),
@ -111,7 +111,7 @@ rotated_text_expose_event (GtkWidget *widget,
int width, height; int width, height;
double device_radius; double device_radius;
int i; int i;
gtk_widget_get_allocation (widget, &allocation); gtk_widget_get_allocation (widget, &allocation);
width = allocation.width; width = allocation.width;
@ -157,7 +157,7 @@ rotated_text_expose_event (GtkWidget *widget,
/* Inform Pango to re-layout the text with the new transformation matrix */ /* Inform Pango to re-layout the text with the new transformation matrix */
pango_cairo_update_layout (cr, layout); pango_cairo_update_layout (cr, layout);
pango_layout_get_pixel_size (layout, &width, &height); pango_layout_get_pixel_size (layout, &width, &height);
cairo_move_to (cr, - width / 2, - RADIUS * .9); cairo_move_to (cr, - width / 2, - RADIUS * .9);
pango_cairo_show_layout (cr, layout); pango_cairo_show_layout (cr, layout);
@ -172,7 +172,7 @@ rotated_text_expose_event (GtkWidget *widget,
g_object_unref (context); g_object_unref (context);
cairo_pattern_destroy (pattern); cairo_pattern_destroy (pattern);
cairo_destroy (cr); cairo_destroy (cr);
return FALSE; return FALSE;
} }
@ -188,7 +188,7 @@ do_rotated_text (GtkWidget *do_widget)
PangoAttrList *attrs; PangoAttrList *attrs;
const GdkColor white = { 0, 0xffff, 0xffff, 0xffff }; const GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window), gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget)); gtk_widget_get_screen (do_widget));

View file

@ -2,9 +2,9 @@
* *
* GtkSizeGroup provides a mechanism for grouping a number of * GtkSizeGroup provides a mechanism for grouping a number of
* widgets together so they all request the same amount of space. * widgets together so they all request the same amount of space.
* This is typically useful when you want a column of widgets to * This is typically useful when you want a column of widgets to
* have the same size, but you can't use a GtkTable widget. * have the same size, but you can't use a GtkTable widget.
* *
* Note that size groups only affect the amount of space requested, * Note that size groups only affect the amount of space requested,
* not the size that the widgets finally receive. If you want the * not the size that the widgets finally receive. If you want the
* widgets in a GtkSizeGroup to actually be the same size, you need * widgets in a GtkSizeGroup to actually be the same size, you need
@ -26,7 +26,7 @@ create_combo_box (const char **strings)
const char **str; const char **str;
combo_box = gtk_combo_box_text_new (); combo_box = gtk_combo_box_text_new ();
for (str = strings; *str; str++) for (str = strings; *str; str++)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), *str); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), *str);
@ -51,7 +51,7 @@ add_row (GtkTable *table,
0, 1, row, row + 1, 0, 1, row, row + 1,
GTK_EXPAND | GTK_FILL, 0, GTK_EXPAND | GTK_FILL, 0,
0, 0); 0, 0);
combo_box = create_combo_box (options); combo_box = create_combo_box (options);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo_box); gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo_box);
gtk_size_group_add_widget (size_group, combo_box); gtk_size_group_add_widget (size_group, combo_box);
@ -75,7 +75,7 @@ toggle_grouping (GtkToggleButton *check_button,
new_mode = GTK_SIZE_GROUP_HORIZONTAL; new_mode = GTK_SIZE_GROUP_HORIZONTAL;
else else
new_mode = GTK_SIZE_GROUP_NONE; new_mode = GTK_SIZE_GROUP_NONE;
gtk_size_group_set_mode (size_group, new_mode); gtk_size_group_set_mode (size_group, new_mode);
} }
@ -91,15 +91,15 @@ do_sizegroup (GtkWidget *do_widget)
static const char *color_options[] = { static const char *color_options[] = {
"Red", "Green", "Blue", NULL "Red", "Green", "Blue", NULL
}; };
static const char *dash_options[] = { static const char *dash_options[] = {
"Solid", "Dashed", "Dotted", NULL "Solid", "Dashed", "Dotted", NULL
}; };
static const char *end_options[] = { static const char *end_options[] = {
"Square", "Round", "Arrow", NULL "Square", "Round", "Arrow", NULL
}; };
if (!window) if (!window)
{ {
window = gtk_dialog_new_with_buttons ("GtkSizeGroup", window = gtk_dialog_new_with_buttons ("GtkSizeGroup",
@ -109,7 +109,7 @@ do_sizegroup (GtkWidget *do_widget)
GTK_RESPONSE_NONE, GTK_RESPONSE_NONE,
NULL); NULL);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE); gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "response", g_signal_connect (window, "response",
G_CALLBACK (gtk_widget_destroy), NULL); G_CALLBACK (gtk_widget_destroy), NULL);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
@ -120,7 +120,7 @@ do_sizegroup (GtkWidget *do_widget)
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
/* Create one frame holding color options /* Create one frame holding color options
*/ */
frame = gtk_frame_new ("Color Options"); frame = gtk_frame_new ("Color Options");
@ -152,7 +152,7 @@ do_sizegroup (GtkWidget *do_widget)
/* And a check button to turn grouping on and off */ /* And a check button to turn grouping on and off */
check_button = gtk_check_button_new_with_mnemonic ("_Enable grouping"); check_button = gtk_check_button_new_with_mnemonic ("_Enable grouping");
gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
g_signal_connect (check_button, "toggled", g_signal_connect (check_button, "toggled",
G_CALLBACK (toggle_grouping), size_group); G_CALLBACK (toggle_grouping), size_group);

View file

@ -35,7 +35,7 @@ stock_item_info_free (StockItemInfo *info)
g_free (info->accel_str); g_free (info->accel_str);
if (info->small_icon) if (info->small_icon)
g_object_unref (info->small_icon); g_object_unref (info->small_icon);
g_free (info); g_free (info);
} }
@ -48,7 +48,7 @@ stock_item_info_copy (StockItemInfo *src)
info->id = g_strdup (src->id); info->id = g_strdup (src->id);
info->macro = g_strdup (src->macro); info->macro = g_strdup (src->macro);
info->accel_str = g_strdup (src->accel_str); info->accel_str = g_strdup (src->accel_str);
info->item = src->item; info->item = src->item;
info->small_icon = src->small_icon; info->small_icon = src->small_icon;
@ -62,7 +62,7 @@ static GType
stock_item_info_get_type (void) stock_item_info_get_type (void)
{ {
static GType our_type = 0; static GType our_type = 0;
if (our_type == 0) if (our_type == 0)
our_type = g_boxed_type_register_static ("StockItemInfo", our_type = g_boxed_type_register_static ("StockItemInfo",
(GBoxedCopyFunc) stock_item_info_copy, (GBoxedCopyFunc) stock_item_info_copy,
@ -90,9 +90,9 @@ id_to_macro (const gchar *id)
/* gtk-foo-bar -> GTK_STOCK_FOO_BAR */ /* gtk-foo-bar -> GTK_STOCK_FOO_BAR */
macro = g_string_new (NULL); macro = g_string_new (NULL);
cp = id; cp = id;
if (strncmp (cp, "gtk-", 4) == 0) if (strncmp (cp, "gtk-", 4) == 0)
{ {
g_string_append (macro, "GTK_STOCK_"); g_string_append (macro, "GTK_STOCK_");
@ -120,7 +120,7 @@ create_model (void)
GtkListStore *store; GtkListStore *store;
GSList *ids; GSList *ids;
GSList *tmp_list; GSList *tmp_list;
store = gtk_list_store_new (2, STOCK_ITEM_INFO_TYPE, G_TYPE_STRING); store = gtk_list_store_new (2, STOCK_ITEM_INFO_TYPE, G_TYPE_STRING);
ids = gtk_stock_list_ids (); ids = gtk_stock_list_ids ();
@ -132,9 +132,9 @@ create_model (void)
GtkStockItem item; GtkStockItem item;
GtkTreeIter iter; GtkTreeIter iter;
GtkIconSet *icon_set; GtkIconSet *icon_set;
info.id = tmp_list->data; info.id = tmp_list->data;
if (gtk_stock_lookup (info.id, &item)) if (gtk_stock_lookup (info.id, &item))
{ {
info.item = item; info.item = item;
@ -173,19 +173,19 @@ create_model (void)
++i; ++i;
} }
g_free (sizes); g_free (sizes);
info.small_icon = gtk_widget_render_icon (window, info.id, info.small_icon = gtk_widget_render_icon (window, info.id,
size, size,
NULL); NULL);
if (size != GTK_ICON_SIZE_MENU) if (size != GTK_ICON_SIZE_MENU)
{ {
/* Make the result the proper size for our thumbnail */ /* Make the result the proper size for our thumbnail */
gint w, h; gint w, h;
GdkPixbuf *scaled; GdkPixbuf *scaled;
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h); gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
scaled = gdk_pixbuf_scale_simple (info.small_icon, scaled = gdk_pixbuf_scale_simple (info.small_icon,
w, h, w, h,
GDK_INTERP_BILINEAR); GDK_INTERP_BILINEAR);
@ -208,7 +208,7 @@ create_model (void)
} }
info.macro = id_to_macro (info.id); info.macro = id_to_macro (info.id);
gtk_list_store_append (store, &iter); gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, &info, 1, info.id, -1); gtk_list_store_set (store, &iter, 0, &info, 1, info.id, -1);
@ -216,10 +216,10 @@ create_model (void)
g_free (info.accel_str); g_free (info.accel_str);
if (info.small_icon) if (info.small_icon)
g_object_unref (info.small_icon); g_object_unref (info.small_icon);
tmp_list = g_slist_next (tmp_list); tmp_list = g_slist_next (tmp_list);
} }
g_slist_foreach (ids, (GFunc)g_free, NULL); g_slist_foreach (ids, (GFunc)g_free, NULL);
g_slist_free (ids); g_slist_free (ids);
@ -243,7 +243,7 @@ get_largest_size (const char *id)
for (i = 0; i < n_sizes; i++) for (i = 0; i < n_sizes; i++)
{ {
gint width, height; gint width, height;
gtk_icon_size_lookup (sizes[i], &width, &height); gtk_icon_size_lookup (sizes[i], &width, &height);
if (width * height > best_pixels) if (width * height > best_pixels)
@ -252,7 +252,7 @@ get_largest_size (const char *id)
best_pixels = width * height; best_pixels = width * height;
} }
} }
g_free (sizes); g_free (sizes);
return best_size; return best_size;
@ -265,7 +265,7 @@ selection_changed (GtkTreeSelection *selection)
StockItemDisplay *display; StockItemDisplay *display;
GtkTreeModel *model; GtkTreeModel *model;
GtkTreeIter iter; GtkTreeIter iter;
treeview = gtk_tree_selection_get_tree_view (selection); treeview = gtk_tree_selection_get_tree_view (selection);
display = g_object_get_data (G_OBJECT (treeview), "stock-display"); display = g_object_get_data (G_OBJECT (treeview), "stock-display");
@ -273,7 +273,7 @@ selection_changed (GtkTreeSelection *selection)
{ {
StockItemInfo *info; StockItemInfo *info;
gchar *str; gchar *str;
gtk_tree_model_get (model, &iter, gtk_tree_model_get (model, &iter,
0, &info, 0, &info,
-1); -1);
@ -327,15 +327,15 @@ macro_set_func_text (GtkTreeViewColumn *tree_column,
gpointer data) gpointer data)
{ {
StockItemInfo *info; StockItemInfo *info;
gtk_tree_model_get (model, iter, gtk_tree_model_get (model, iter,
0, &info, 0, &info,
-1); -1);
g_object_set (GTK_CELL_RENDERER (cell), g_object_set (GTK_CELL_RENDERER (cell),
"text", info->macro, "text", info->macro,
NULL); NULL);
stock_item_info_free (info); stock_item_info_free (info);
} }
@ -347,15 +347,15 @@ id_set_func (GtkTreeViewColumn *tree_column,
gpointer data) gpointer data)
{ {
StockItemInfo *info; StockItemInfo *info;
gtk_tree_model_get (model, iter, gtk_tree_model_get (model, iter,
0, &info, 0, &info,
-1); -1);
g_object_set (GTK_CELL_RENDERER (cell), g_object_set (GTK_CELL_RENDERER (cell),
"text", info->id, "text", info->id,
NULL); NULL);
stock_item_info_free (info); stock_item_info_free (info);
} }
@ -367,15 +367,15 @@ accel_set_func (GtkTreeViewColumn *tree_column,
gpointer data) gpointer data)
{ {
StockItemInfo *info; StockItemInfo *info;
gtk_tree_model_get (model, iter, gtk_tree_model_get (model, iter,
0, &info, 0, &info,
-1); -1);
g_object_set (GTK_CELL_RENDERER (cell), g_object_set (GTK_CELL_RENDERER (cell),
"text", info->accel_str, "text", info->accel_str,
NULL); NULL);
stock_item_info_free (info); stock_item_info_free (info);
} }
@ -387,21 +387,21 @@ label_set_func (GtkTreeViewColumn *tree_column,
gpointer data) gpointer data)
{ {
StockItemInfo *info; StockItemInfo *info;
gtk_tree_model_get (model, iter, gtk_tree_model_get (model, iter,
0, &info, 0, &info,
-1); -1);
g_object_set (GTK_CELL_RENDERER (cell), g_object_set (GTK_CELL_RENDERER (cell),
"text", info->item.label, "text", info->item.label,
NULL); NULL);
stock_item_info_free (info); stock_item_info_free (info);
} }
GtkWidget * GtkWidget *
do_stock_browser (GtkWidget *do_widget) do_stock_browser (GtkWidget *do_widget)
{ {
if (!window) if (!window)
{ {
GtkWidget *frame; GtkWidget *frame;
@ -435,13 +435,13 @@ do_stock_browser (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (hbox), sw, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), sw, FALSE, FALSE, 0);
model = create_model (); model = create_model ();
treeview = gtk_tree_view_new_with_model (model); treeview = gtk_tree_view_new_with_model (model);
g_object_unref (model); g_object_unref (model);
gtk_container_add (GTK_CONTAINER (sw), treeview); gtk_container_add (GTK_CONTAINER (sw), treeview);
column = gtk_tree_view_column_new (); column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, "Macro"); gtk_tree_view_column_set_title (column, "Macro");
@ -487,10 +487,10 @@ do_stock_browser (GtkWidget *do_widget)
id_set_func, id_set_func,
NULL, NULL,
NULL); NULL);
align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0); align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
gtk_box_pack_end (GTK_BOX (hbox), align, FALSE, FALSE, 0); gtk_box_pack_end (GTK_BOX (hbox), align, FALSE, FALSE, 0);
frame = gtk_frame_new ("Selected Item"); frame = gtk_frame_new ("Selected Item");
gtk_container_add (GTK_CONTAINER (align), frame); gtk_container_add (GTK_CONTAINER (align), frame);
@ -503,7 +503,7 @@ do_stock_browser (GtkWidget *do_widget)
"stock-display", "stock-display",
display, display,
g_free); /* free display with treeview */ g_free); /* free display with treeview */
display->type_label = gtk_label_new (NULL); display->type_label = gtk_label_new (NULL);
display->macro_label = gtk_label_new (NULL); display->macro_label = gtk_label_new (NULL);
display->id_label = gtk_label_new (NULL); display->id_label = gtk_label_new (NULL);
@ -515,7 +515,7 @@ do_stock_browser (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (vbox), display->icon_image, gtk_box_pack_start (GTK_BOX (vbox), display->icon_image,
FALSE, FALSE, 0); FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), display->label_accel_label, gtk_box_pack_start (GTK_BOX (vbox), display->label_accel_label,
FALSE, FALSE, 0); FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), display->macro_label, gtk_box_pack_start (GTK_BOX (vbox), display->macro_label,
@ -525,7 +525,7 @@ do_stock_browser (GtkWidget *do_widget)
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
g_signal_connect (selection, g_signal_connect (selection,
"changed", "changed",
G_CALLBACK (selection_changed), G_CALLBACK (selection_changed),
@ -537,7 +537,7 @@ do_stock_browser (GtkWidget *do_widget)
gtk_widget_show_all (window); gtk_widget_show_all (window);
} }
else else
{ {
gtk_widget_destroy (window); gtk_widget_destroy (window);
window = NULL; window = NULL;
} }

View file

@ -1,6 +1,6 @@
/* Text Widget/Automatic scrolling /* Text Widget/Automatic scrolling
* *
* This example demonstrates how to use the gravity of * This example demonstrates how to use the gravity of
* GtkTextMarks to keep a text view scrolled to the bottom * GtkTextMarks to keep a text view scrolled to the bottom
* while appending text. * while appending text.
*/ */
@ -20,14 +20,14 @@ scroll_to_end (GtkTextView *textview)
static int count; static int count;
buffer = gtk_text_view_get_buffer (textview); buffer = gtk_text_view_get_buffer (textview);
/* Get "end" mark. It's located at the end of buffer because /* Get "end" mark. It's located at the end of buffer because
* of right gravity * of right gravity
*/ */
mark = gtk_text_buffer_get_mark (buffer, "end"); mark = gtk_text_buffer_get_mark (buffer, "end");
gtk_text_buffer_get_iter_at_mark (buffer, &iter, mark); gtk_text_buffer_get_iter_at_mark (buffer, &iter, mark);
/* and insert some text at its position, the iter will be /* and insert some text at its position, the iter will be
* revalidated after insertion to point to the end of inserted text * revalidated after insertion to point to the end of inserted text
*/ */
spaces = g_strnfill (count++, ' '); spaces = g_strnfill (count++, ' ');
@ -43,7 +43,7 @@ scroll_to_end (GtkTextView *textview)
*/ */
gtk_text_view_scroll_mark_onscreen (textview, mark); gtk_text_view_scroll_mark_onscreen (textview, mark);
/* Emulate typewriter behavior, shift to the left if we /* Emulate typewriter behavior, shift to the left if we
* are far enough to the right. * are far enough to the right.
*/ */
if (count > 150) if (count > 150)
@ -64,7 +64,7 @@ scroll_to_bottom (GtkTextView *textview)
static int count; static int count;
buffer = gtk_text_view_get_buffer (textview); buffer = gtk_text_view_get_buffer (textview);
/* Get end iterator */ /* Get end iterator */
gtk_text_buffer_get_end_iter (buffer, &iter); gtk_text_buffer_get_end_iter (buffer, &iter);
@ -80,17 +80,17 @@ scroll_to_bottom (GtkTextView *textview)
-1); -1);
g_free (spaces); g_free (spaces);
/* Move the iterator to the beginning of line, so we don't scroll /* Move the iterator to the beginning of line, so we don't scroll
* in horizontal direction * in horizontal direction
*/ */
gtk_text_iter_set_line_offset (&iter, 0); gtk_text_iter_set_line_offset (&iter, 0);
/* and place the mark at iter. the mark will stay there after we /* and place the mark at iter. the mark will stay there after we
* insert some text at the end because it has right gravity. * insert some text at the end because it has right gravity.
*/ */
mark = gtk_text_buffer_get_mark (buffer, "scroll"); mark = gtk_text_buffer_get_mark (buffer, "scroll");
gtk_text_buffer_move_mark (buffer, mark, &iter); gtk_text_buffer_move_mark (buffer, mark, &iter);
/* Scroll the mark onscreen. /* Scroll the mark onscreen.
*/ */
gtk_text_view_scroll_mark_onscreen (textview, mark); gtk_text_view_scroll_mark_onscreen (textview, mark);
@ -116,25 +116,25 @@ setup_scroll (GtkTextView *textview,
if (to_end) if (to_end)
{ {
/* If we want to scroll to the end, including horizontal scrolling, /* If we want to scroll to the end, including horizontal scrolling,
* then we just create a mark with right gravity at the end of the * then we just create a mark with right gravity at the end of the
* buffer. It will stay at the end unless explicitely moved with * buffer. It will stay at the end unless explicitely moved with
* gtk_text_buffer_move_mark. * gtk_text_buffer_move_mark.
*/ */
gtk_text_buffer_create_mark (buffer, "end", &iter, FALSE); gtk_text_buffer_create_mark (buffer, "end", &iter, FALSE);
/* Add scrolling timeout. */ /* Add scrolling timeout. */
return g_timeout_add (50, (GSourceFunc) scroll_to_end, textview); return g_timeout_add (50, (GSourceFunc) scroll_to_end, textview);
} }
else else
{ {
/* If we want to scroll to the bottom, but not scroll horizontally, /* If we want to scroll to the bottom, but not scroll horizontally,
* then an end mark won't do the job. Just create a mark so we can * then an end mark won't do the job. Just create a mark so we can
* use it with gtk_text_view_scroll_mark_onscreen, we'll position it * use it with gtk_text_view_scroll_mark_onscreen, we'll position it
* explicitely when needed. Use left gravity so the mark stays where * explicitely when needed. Use left gravity so the mark stays where
* we put it after inserting new text. * we put it after inserting new text.
*/ */
gtk_text_buffer_create_mark (buffer, "scroll", &iter, TRUE); gtk_text_buffer_create_mark (buffer, "scroll", &iter, TRUE);
/* Add scrolling timeout. */ /* Add scrolling timeout. */
return g_timeout_add (100, (GSourceFunc) scroll_to_bottom, textview); return g_timeout_add (100, (GSourceFunc) scroll_to_bottom, textview);
} }
@ -163,7 +163,7 @@ create_text_view (GtkWidget *hbox,
timeout = setup_scroll (GTK_TEXT_VIEW (textview), to_end); timeout = setup_scroll (GTK_TEXT_VIEW (textview), to_end);
/* Remove the timeout in destroy handler, so we don't try to /* Remove the timeout in destroy handler, so we don't try to
* scroll destroyed widget. * scroll destroyed widget.
*/ */
g_signal_connect (textview, "destroy", g_signal_connect (textview, "destroy",
G_CALLBACK (remove_timeout), G_CALLBACK (remove_timeout),
@ -183,7 +183,7 @@ do_textscroll (GtkWidget *do_widget)
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window); G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
hbox = gtk_hbox_new (TRUE, 6); hbox = gtk_hbox_new (TRUE, 6);
gtk_container_add (GTK_CONTAINER (window), hbox); gtk_container_add (GTK_CONTAINER (window), hbox);

View file

@ -40,13 +40,13 @@ create_tags (GtkTextBuffer *buffer)
"weight", PANGO_WEIGHT_BOLD, "weight", PANGO_WEIGHT_BOLD,
"size", 15 * PANGO_SCALE, "size", 15 * PANGO_SCALE,
NULL); NULL);
gtk_text_buffer_create_tag (buffer, "italic", gtk_text_buffer_create_tag (buffer, "italic",
"style", PANGO_STYLE_ITALIC, NULL); "style", PANGO_STYLE_ITALIC, NULL);
gtk_text_buffer_create_tag (buffer, "bold", gtk_text_buffer_create_tag (buffer, "bold",
"weight", PANGO_WEIGHT_BOLD, NULL); "weight", PANGO_WEIGHT_BOLD, NULL);
gtk_text_buffer_create_tag (buffer, "big", gtk_text_buffer_create_tag (buffer, "big",
/* points times the PANGO_SCALE factor */ /* points times the PANGO_SCALE factor */
"size", 20 * PANGO_SCALE, NULL); "size", 20 * PANGO_SCALE, NULL);
@ -56,12 +56,12 @@ create_tags (GtkTextBuffer *buffer)
gtk_text_buffer_create_tag (buffer, "x-large", gtk_text_buffer_create_tag (buffer, "x-large",
"scale", PANGO_SCALE_X_LARGE, NULL); "scale", PANGO_SCALE_X_LARGE, NULL);
gtk_text_buffer_create_tag (buffer, "monospace", gtk_text_buffer_create_tag (buffer, "monospace",
"family", "monospace", NULL); "family", "monospace", NULL);
gtk_text_buffer_create_tag (buffer, "blue_foreground", gtk_text_buffer_create_tag (buffer, "blue_foreground",
"foreground", "blue", NULL); "foreground", "blue", NULL);
gtk_text_buffer_create_tag (buffer, "red_background", gtk_text_buffer_create_tag (buffer, "red_background",
"background", "red", NULL); "background", "red", NULL);
@ -77,7 +77,7 @@ create_tags (GtkTextBuffer *buffer)
gtk_text_buffer_create_tag (buffer, "not_editable", gtk_text_buffer_create_tag (buffer, "not_editable",
"editable", FALSE, NULL); "editable", FALSE, NULL);
gtk_text_buffer_create_tag (buffer, "word_wrap", gtk_text_buffer_create_tag (buffer, "word_wrap",
"wrap_mode", GTK_WRAP_WORD, NULL); "wrap_mode", GTK_WRAP_WORD, NULL);
@ -86,7 +86,7 @@ create_tags (GtkTextBuffer *buffer)
gtk_text_buffer_create_tag (buffer, "no_wrap", gtk_text_buffer_create_tag (buffer, "no_wrap",
"wrap_mode", GTK_WRAP_NONE, NULL); "wrap_mode", GTK_WRAP_NONE, NULL);
gtk_text_buffer_create_tag (buffer, "center", gtk_text_buffer_create_tag (buffer, "center",
"justification", GTK_JUSTIFY_CENTER, NULL); "justification", GTK_JUSTIFY_CENTER, NULL);
@ -96,10 +96,10 @@ create_tags (GtkTextBuffer *buffer)
gtk_text_buffer_create_tag (buffer, "wide_margins", gtk_text_buffer_create_tag (buffer, "wide_margins",
"left_margin", 50, "right_margin", 50, "left_margin", 50, "right_margin", 50,
NULL); NULL);
gtk_text_buffer_create_tag (buffer, "strikethrough", gtk_text_buffer_create_tag (buffer, "strikethrough",
"strikethrough", TRUE, NULL); "strikethrough", TRUE, NULL);
gtk_text_buffer_create_tag (buffer, "underline", gtk_text_buffer_create_tag (buffer, "underline",
"underline", PANGO_UNDERLINE_SINGLE, NULL); "underline", PANGO_UNDERLINE_SINGLE, NULL);
@ -110,7 +110,7 @@ create_tags (GtkTextBuffer *buffer)
"rise", 10 * PANGO_SCALE, /* 10 pixels */ "rise", 10 * PANGO_SCALE, /* 10 pixels */
"size", 8 * PANGO_SCALE, /* 8 points */ "size", 8 * PANGO_SCALE, /* 8 points */
NULL); NULL);
gtk_text_buffer_create_tag (buffer, "subscript", gtk_text_buffer_create_tag (buffer, "subscript",
"rise", -10 * PANGO_SCALE, /* 10 pixels */ "rise", -10 * PANGO_SCALE, /* 10 pixels */
"size", 8 * PANGO_SCALE, /* 8 points */ "size", 8 * PANGO_SCALE, /* 8 points */
@ -155,7 +155,7 @@ insert_text (GtkTextBuffer *buffer)
scaled = gdk_pixbuf_scale_simple (pixbuf, 32, 32, GDK_INTERP_BILINEAR); scaled = gdk_pixbuf_scale_simple (pixbuf, 32, 32, GDK_INTERP_BILINEAR);
g_object_unref (pixbuf); g_object_unref (pixbuf);
pixbuf = scaled; pixbuf = scaled;
/* get start of buffer; each insertion will revalidate the /* get start of buffer; each insertion will revalidate the
* iterator to point to just after the inserted text. * iterator to point to just after the inserted text.
*/ */
@ -165,12 +165,12 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Font styles. ", -1, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Font styles. ", -1,
"heading", NULL); "heading", NULL);
gtk_text_buffer_insert (buffer, &iter, "For example, you can have ", -1); gtk_text_buffer_insert (buffer, &iter, "For example, you can have ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"italic", -1, "italic", -1,
"italic", NULL); "italic", NULL);
gtk_text_buffer_insert (buffer, &iter, ", ", -1); gtk_text_buffer_insert (buffer, &iter, ", ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"bold", -1, "bold", -1,
"bold", NULL); "bold", NULL);
@ -192,29 +192,29 @@ insert_text (GtkTextBuffer *buffer)
"x-large", -1, "x-large", -1,
"x-large", NULL); "x-large", NULL);
gtk_text_buffer_insert (buffer, &iter, " to ensure that your program properly adapts if the user changes the default font size.\n\n", -1); gtk_text_buffer_insert (buffer, &iter, " to ensure that your program properly adapts if the user changes the default font size.\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Colors. ", -1, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Colors. ", -1,
"heading", NULL); "heading", NULL);
gtk_text_buffer_insert (buffer, &iter, "Colors such as ", -1); gtk_text_buffer_insert (buffer, &iter, "Colors such as ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"a blue foreground", -1, "a blue foreground", -1,
"blue_foreground", NULL); "blue_foreground", NULL);
gtk_text_buffer_insert (buffer, &iter, " or ", -1); gtk_text_buffer_insert (buffer, &iter, " or ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"a red background", -1, "a red background", -1,
"red_background", NULL); "red_background", NULL);
gtk_text_buffer_insert (buffer, &iter, " or even ", -1); gtk_text_buffer_insert (buffer, &iter, " or even ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"a blue foreground on red background", -1, "a blue foreground on red background", -1,
"blue_foreground", "blue_foreground",
"red_background", "red_background",
NULL); NULL);
gtk_text_buffer_insert (buffer, &iter, " (select that to read it) can be used.\n\n", -1); gtk_text_buffer_insert (buffer, &iter, " (select that to read it) can be used.\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Underline, strikethrough, and rise. ", -1, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Underline, strikethrough, and rise. ", -1,
"heading", NULL); "heading", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"Strikethrough", -1, "Strikethrough", -1,
"strikethrough", NULL); "strikethrough", NULL);
@ -224,7 +224,7 @@ insert_text (GtkTextBuffer *buffer)
"underline", NULL); "underline", NULL);
gtk_text_buffer_insert (buffer, &iter, ", ", -1); gtk_text_buffer_insert (buffer, &iter, ", ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"double underline", -1, "double underline", -1,
"double_underline", NULL); "double_underline", NULL);
gtk_text_buffer_insert (buffer, &iter, ", ", -1); gtk_text_buffer_insert (buffer, &iter, ", ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
@ -238,7 +238,7 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Images. ", -1, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Images. ", -1,
"heading", NULL); "heading", NULL);
gtk_text_buffer_insert (buffer, &iter, "The buffer can have images in it: ", -1); gtk_text_buffer_insert (buffer, &iter, "The buffer can have images in it: ", -1);
gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf); gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf); gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
@ -249,14 +249,14 @@ insert_text (GtkTextBuffer *buffer)
"heading", NULL); "heading", NULL);
gtk_text_buffer_insert (buffer, &iter, "You can adjust the amount of space before each line.\n", -1); gtk_text_buffer_insert (buffer, &iter, "You can adjust the amount of space before each line.\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"This line has a whole lot of space before it.\n", -1, "This line has a whole lot of space before it.\n", -1,
"big_gap_before_line", "wide_margins", NULL); "big_gap_before_line", "wide_margins", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", -1, "You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", -1,
"big_gap_after_line", "wide_margins", NULL); "big_gap_after_line", "wide_margins", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n", -1, "You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n", -1,
"double_spaced_line", "wide_margins", NULL); "double_spaced_line", "wide_margins", NULL);
@ -265,7 +265,7 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Editability. ", -1, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Editability. ", -1,
"heading", NULL); "heading", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n", -1, "This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n", -1,
"not_editable", NULL); "not_editable", NULL);
@ -274,19 +274,19 @@ insert_text (GtkTextBuffer *buffer)
"heading", NULL); "heading", NULL);
gtk_text_buffer_insert (buffer, &iter, gtk_text_buffer_insert (buffer, &iter,
"This line (and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", -1); "This line (and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", -1, "This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", -1,
"char_wrap", NULL); "char_wrap", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", -1, "This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", -1,
"no_wrap", NULL); "no_wrap", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Justification. ", -1, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Justification. ", -1,
"heading", NULL); "heading", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"\nThis line has center justification.\n", -1, "\nThis line has center justification.\n", -1,
"center", NULL); "center", NULL);
@ -297,18 +297,18 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", -1, "\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", -1,
"wide_margins", NULL); "wide_margins", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Internationalization. ", -1, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Internationalization. ", -1,
"heading", NULL); "heading", NULL);
gtk_text_buffer_insert (buffer, &iter, gtk_text_buffer_insert (buffer, &iter,
"You can put all sorts of Unicode text in the buffer.\n\nGerman (Deutsch S\303\274d) Gr\303\274\303\237 Gott\nGreek (\316\225\316\273\316\273\316\267\316\275\316\271\316\272\316\254) \316\223\316\265\316\271\316\254 \317\203\316\261\317\202\nHebrew \327\251\327\234\327\225\327\235\nJapanese (\346\227\245\346\234\254\350\252\236)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n", -1); "You can put all sorts of Unicode text in the buffer.\n\nGerman (Deutsch S\303\274d) Gr\303\274\303\237 Gott\nGreek (\316\225\316\273\316\273\316\267\316\275\316\271\316\272\316\254) \316\223\316\265\316\271\316\254 \317\203\316\261\317\202\nHebrew \327\251\327\234\327\225\327\235\nJapanese (\346\227\245\346\234\254\350\252\236)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n", -1);
gtk_text_buffer_insert (buffer, &iter, "Here's a word-wrapped quote in a right-to-left language:\n", -1); gtk_text_buffer_insert (buffer, &iter, "Here's a word-wrapped quote in a right-to-left language:\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "\331\210\331\202\330\257 \330\250\330\257\330\243 \330\253\331\204\330\247\330\253 \331\205\331\206 \330\243\331\203\330\253\330\261 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 \330\252\331\202\330\257\331\205\330\247 \331\201\331\212 \330\264\330\250\331\203\330\251 \330\247\331\203\330\263\331\212\331\210\331\206 \330\250\330\261\330\247\331\205\330\254\331\207\330\247 \331\203\331\205\331\206\330\270\331\205\330\247\330\252 \331\204\330\247 \330\252\330\263\330\271\331\211 \331\204\331\204\330\261\330\250\330\255\330\214 \330\253\331\205 \330\252\330\255\331\210\331\204\330\252 \331\201\331\212 \330\247\331\204\330\263\331\206\331\210\330\247\330\252 \330\247\331\204\330\256\331\205\330\263 \330\247\331\204\331\205\330\247\330\266\331\212\330\251 \330\245\331\204\331\211 \331\205\330\244\330\263\330\263\330\247\330\252 \331\205\330\247\331\204\331\212\330\251 \331\205\331\206\330\270\331\205\330\251\330\214 \331\210\330\250\330\247\330\252\330\252 \330\254\330\262\330\241\330\247 \331\205\331\206 \330\247\331\204\331\206\330\270\330\247\331\205 \330\247\331\204\331\205\330\247\331\204\331\212 \331\201\331\212 \330\250\331\204\330\257\330\247\331\206\331\207\330\247\330\214 \331\210\331\204\331\203\331\206\331\207\330\247 \330\252\330\252\330\256\330\265\330\265 \331\201\331\212 \330\256\330\257\331\205\330\251 \331\202\330\267\330\247\330\271 \330\247\331\204\331\205\330\264\330\261\331\210\330\271\330\247\330\252 \330\247\331\204\330\265\330\272\331\212\330\261\330\251. \331\210\330\243\330\255\330\257 \330\243\331\203\330\253\330\261 \331\207\330\260\331\207 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 \331\206\330\254\330\247\330\255\330\247 \331\207\331\210 \302\273\330\250\330\247\331\206\331\203\331\210\330\263\331\210\331\204\302\253 \331\201\331\212 \330\250\331\210\331\204\331\212\331\201\331\212\330\247.\n\n", -1, gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "\331\210\331\202\330\257 \330\250\330\257\330\243 \330\253\331\204\330\247\330\253 \331\205\331\206 \330\243\331\203\330\253\330\261 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 \330\252\331\202\330\257\331\205\330\247 \331\201\331\212 \330\264\330\250\331\203\330\251 \330\247\331\203\330\263\331\212\331\210\331\206 \330\250\330\261\330\247\331\205\330\254\331\207\330\247 \331\203\331\205\331\206\330\270\331\205\330\247\330\252 \331\204\330\247 \330\252\330\263\330\271\331\211 \331\204\331\204\330\261\330\250\330\255\330\214 \330\253\331\205 \330\252\330\255\331\210\331\204\330\252 \331\201\331\212 \330\247\331\204\330\263\331\206\331\210\330\247\330\252 \330\247\331\204\330\256\331\205\330\263 \330\247\331\204\331\205\330\247\330\266\331\212\330\251 \330\245\331\204\331\211 \331\205\330\244\330\263\330\263\330\247\330\252 \331\205\330\247\331\204\331\212\330\251 \331\205\331\206\330\270\331\205\330\251\330\214 \331\210\330\250\330\247\330\252\330\252 \330\254\330\262\330\241\330\247 \331\205\331\206 \330\247\331\204\331\206\330\270\330\247\331\205 \330\247\331\204\331\205\330\247\331\204\331\212 \331\201\331\212 \330\250\331\204\330\257\330\247\331\206\331\207\330\247\330\214 \331\210\331\204\331\203\331\206\331\207\330\247 \330\252\330\252\330\256\330\265\330\265 \331\201\331\212 \330\256\330\257\331\205\330\251 \331\202\330\267\330\247\330\271 \330\247\331\204\331\205\330\264\330\261\331\210\330\271\330\247\330\252 \330\247\331\204\330\265\330\272\331\212\330\261\330\251. \331\210\330\243\330\255\330\257 \330\243\331\203\330\253\330\261 \331\207\330\260\331\207 \330\247\331\204\331\205\330\244\330\263\330\263\330\247\330\252 \331\206\330\254\330\247\330\255\330\247 \331\207\331\210 \302\273\330\250\330\247\331\206\331\203\331\210\330\263\331\210\331\204\302\253 \331\201\331\212 \330\250\331\210\331\204\331\212\331\201\331\212\330\247.\n\n", -1,
"rtl_quote", NULL); "rtl_quote", NULL);
gtk_text_buffer_insert (buffer, &iter, "You can put widgets in the buffer: Here's a button: ", -1); gtk_text_buffer_insert (buffer, &iter, "You can put widgets in the buffer: Here's a button: ", -1);
gtk_text_buffer_create_child_anchor (buffer, &iter); gtk_text_buffer_create_child_anchor (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, " and a menu: ", -1); gtk_text_buffer_insert (buffer, &iter, " and a menu: ", -1);
@ -320,7 +320,7 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_insert (buffer, &iter, " finally a text entry: ", -1); gtk_text_buffer_insert (buffer, &iter, " finally a text entry: ", -1);
gtk_text_buffer_create_child_anchor (buffer, &iter); gtk_text_buffer_create_child_anchor (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, ".\n", -1); gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
gtk_text_buffer_insert (buffer, &iter, "\n\nThis demo doesn't demonstrate all the GtkTextBuffer features; it leaves out, for example: invisible/hidden text, tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...", -1); gtk_text_buffer_insert (buffer, &iter, "\n\nThis demo doesn't demonstrate all the GtkTextBuffer features; it leaves out, for example: invisible/hidden text, tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...", -1);
/* Apply word_wrap tag to whole buffer */ /* Apply word_wrap tag to whole buffer */
@ -347,7 +347,7 @@ attach_widgets (GtkTextView *text_view)
GtkTextIter iter; GtkTextIter iter;
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
int i; int i;
buffer = gtk_text_view_get_buffer (text_view); buffer = gtk_text_view_get_buffer (text_view);
gtk_text_buffer_get_start_iter (buffer, &iter); gtk_text_buffer_get_start_iter (buffer, &iter);
@ -357,7 +357,7 @@ attach_widgets (GtkTextView *text_view)
{ {
GtkTextChildAnchor *anchor; GtkTextChildAnchor *anchor;
GtkWidget *widget; GtkWidget *widget;
anchor = gtk_text_iter_get_child_anchor (&iter); anchor = gtk_text_iter_get_child_anchor (&iter);
if (i == 0) if (i == 0)
@ -420,13 +420,13 @@ do_textview (GtkWidget *do_widget)
GtkWidget *view2; GtkWidget *view2;
GtkWidget *sw; GtkWidget *sw;
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window), gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget)); gtk_widget_get_screen (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), gtk_window_set_default_size (GTK_WINDOW (window),
450, 450); 450, 450);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window); G_CALLBACK (gtk_widget_destroyed), &window);
@ -445,7 +445,7 @@ do_textview (GtkWidget *do_widget)
view1 = gtk_text_view_new (); view1 = gtk_text_view_new ();
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view1)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view1));
view2 = gtk_text_view_new_with_buffer (buffer); view2 = gtk_text_view_new_with_buffer (buffer);
sw = gtk_scrolled_window_new (NULL, NULL); sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
@ -467,7 +467,7 @@ do_textview (GtkWidget *do_widget)
attach_widgets (GTK_TEXT_VIEW (view1)); attach_widgets (GTK_TEXT_VIEW (view1));
attach_widgets (GTK_TEXT_VIEW (view2)); attach_widgets (GTK_TEXT_VIEW (view2));
gtk_widget_show_all (vpaned); gtk_widget_show_all (vpaned);
} }
@ -493,10 +493,10 @@ recursive_attach_view (int depth,
GtkWidget *event_box; GtkWidget *event_box;
GdkColor color; GdkColor color;
GtkWidget *align; GtkWidget *align;
if (depth > 4) if (depth > 4)
return; return;
child_view = gtk_text_view_new_with_buffer (gtk_text_view_get_buffer (view)); child_view = gtk_text_view_new_with_buffer (gtk_text_view_get_buffer (view));
/* Event box is to add a black border around each child view */ /* Event box is to add a black border around each child view */
@ -506,10 +506,10 @@ recursive_attach_view (int depth,
align = gtk_alignment_new (0.5, 0.5, 1.0, 1.0); align = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
gtk_container_set_border_width (GTK_CONTAINER (align), 1); gtk_container_set_border_width (GTK_CONTAINER (align), 1);
gtk_container_add (GTK_CONTAINER (event_box), align); gtk_container_add (GTK_CONTAINER (event_box), align);
gtk_container_add (GTK_CONTAINER (align), child_view); gtk_container_add (GTK_CONTAINER (align), child_view);
gtk_text_view_add_child_at_anchor (view, event_box, anchor); gtk_text_view_add_child_at_anchor (view, event_box, anchor);
recursive_attach_view (depth + 1, GTK_TEXT_VIEW (child_view), anchor); recursive_attach_view (depth + 1, GTK_TEXT_VIEW (child_view), anchor);
@ -532,7 +532,7 @@ easter_egg_callback (GtkWidget *button,
gtk_window_present (GTK_WINDOW (window)); gtk_window_present (GTK_WINDOW (window));
return; return;
} }
buffer = gtk_text_buffer_new (NULL); buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_get_start_iter (buffer, &iter); gtk_text_buffer_get_start_iter (buffer, &iter);
@ -544,9 +544,9 @@ easter_egg_callback (GtkWidget *button,
"\nDon't do this in real applications, please.\n", -1); "\nDon't do this in real applications, please.\n", -1);
view = gtk_text_view_new_with_buffer (buffer); view = gtk_text_view_new_with_buffer (buffer);
recursive_attach_view (0, GTK_TEXT_VIEW (view), anchor); recursive_attach_view (0, GTK_TEXT_VIEW (view), anchor);
g_object_unref (buffer); g_object_unref (buffer);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@ -562,7 +562,7 @@ easter_egg_callback (GtkWidget *button,
g_object_add_weak_pointer (G_OBJECT (window), window_ptr); g_object_add_weak_pointer (G_OBJECT (window), window_ptr);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 400); gtk_window_set_default_size (GTK_WINDOW (window), 300, 400);
gtk_widget_show_all (window); gtk_widget_show_all (window);
} }

View file

@ -15,7 +15,7 @@ activate_action (GtkAction *action)
static void static void
activate_radio_action (GtkAction *action, GtkRadioAction *current) activate_radio_action (GtkAction *action, GtkRadioAction *current)
{ {
g_message ("Radio action \"%s\" selected", g_message ("Radio action \"%s\" selected",
gtk_action_get_name (GTK_ACTION (current))); gtk_action_get_name (GTK_ACTION (current)));
} }
@ -27,30 +27,30 @@ static GtkActionEntry entries[] = {
{ "HelpMenu", NULL, "_Help" }, /* name, stock id, label */ { "HelpMenu", NULL, "_Help" }, /* name, stock id, label */
{ "New", GTK_STOCK_NEW, /* name, stock id */ { "New", GTK_STOCK_NEW, /* name, stock id */
"_New", "<control>N", /* label, accelerator */ "_New", "<control>N", /* label, accelerator */
"Create a new file", /* tooltip */ "Create a new file", /* tooltip */
G_CALLBACK (activate_action) }, G_CALLBACK (activate_action) },
{ "Open", GTK_STOCK_OPEN, /* name, stock id */ { "Open", GTK_STOCK_OPEN, /* name, stock id */
"_Open","<control>O", /* label, accelerator */ "_Open","<control>O", /* label, accelerator */
"Open a file", /* tooltip */ "Open a file", /* tooltip */
G_CALLBACK (activate_action) }, G_CALLBACK (activate_action) },
{ "Save", GTK_STOCK_SAVE, /* name, stock id */ { "Save", GTK_STOCK_SAVE, /* name, stock id */
"_Save","<control>S", /* label, accelerator */ "_Save","<control>S", /* label, accelerator */
"Save current file", /* tooltip */ "Save current file", /* tooltip */
G_CALLBACK (activate_action) }, G_CALLBACK (activate_action) },
{ "SaveAs", GTK_STOCK_SAVE, /* name, stock id */ { "SaveAs", GTK_STOCK_SAVE, /* name, stock id */
"Save _As...", NULL, /* label, accelerator */ "Save _As...", NULL, /* label, accelerator */
"Save to a file", /* tooltip */ "Save to a file", /* tooltip */
G_CALLBACK (activate_action) }, G_CALLBACK (activate_action) },
{ "Quit", GTK_STOCK_QUIT, /* name, stock id */ { "Quit", GTK_STOCK_QUIT, /* name, stock id */
"_Quit", "<control>Q", /* label, accelerator */ "_Quit", "<control>Q", /* label, accelerator */
"Quit", /* tooltip */ "Quit", /* tooltip */
G_CALLBACK (activate_action) }, G_CALLBACK (activate_action) },
{ "About", NULL, /* name, stock id */ { "About", NULL, /* name, stock id */
"_About", "<control>A", /* label, accelerator */ "_About", "<control>A", /* label, accelerator */
"About", /* tooltip */ "About", /* tooltip */
G_CALLBACK (activate_action) }, G_CALLBACK (activate_action) },
{ "Logo", "demo-gtk-logo", /* name, stock id */ { "Logo", "demo-gtk-logo", /* name, stock id */
NULL, NULL, /* label, accelerator */ NULL, NULL, /* label, accelerator */
"GTK+", /* tooltip */ "GTK+", /* tooltip */
G_CALLBACK (activate_action) }, G_CALLBACK (activate_action) },
}; };
@ -59,9 +59,9 @@ static guint n_entries = G_N_ELEMENTS (entries);
static GtkToggleActionEntry toggle_entries[] = { static GtkToggleActionEntry toggle_entries[] = {
{ "Bold", GTK_STOCK_BOLD, /* name, stock id */ { "Bold", GTK_STOCK_BOLD, /* name, stock id */
"_Bold", "<control>B", /* label, accelerator */ "_Bold", "<control>B", /* label, accelerator */
"Bold", /* tooltip */ "Bold", /* tooltip */
G_CALLBACK (activate_action), G_CALLBACK (activate_action),
TRUE }, /* is_active */ TRUE }, /* is_active */
}; };
static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries); static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
@ -74,13 +74,13 @@ enum {
static GtkRadioActionEntry color_entries[] = { static GtkRadioActionEntry color_entries[] = {
{ "Red", NULL, /* name, stock id */ { "Red", NULL, /* name, stock id */
"_Red", "<control>R", /* label, accelerator */ "_Red", "<control>R", /* label, accelerator */
"Blood", COLOR_RED }, /* tooltip, value */ "Blood", COLOR_RED }, /* tooltip, value */
{ "Green", NULL, /* name, stock id */ { "Green", NULL, /* name, stock id */
"_Green", "<control>G", /* label, accelerator */ "_Green", "<control>G", /* label, accelerator */
"Grass", COLOR_GREEN }, /* tooltip, value */ "Grass", COLOR_GREEN }, /* tooltip, value */
{ "Blue", NULL, /* name, stock id */ { "Blue", NULL, /* name, stock id */
"_Blue", "<control>B", /* label, accelerator */ "_Blue", "<control>B", /* label, accelerator */
"Sky", COLOR_BLUE }, /* tooltip, value */ "Sky", COLOR_BLUE }, /* tooltip, value */
}; };
static guint n_color_entries = G_N_ELEMENTS (color_entries); static guint n_color_entries = G_N_ELEMENTS (color_entries);
@ -93,18 +93,18 @@ enum {
static GtkRadioActionEntry shape_entries[] = { static GtkRadioActionEntry shape_entries[] = {
{ "Square", NULL, /* name, stock id */ { "Square", NULL, /* name, stock id */
"_Square", "<control>S", /* label, accelerator */ "_Square", "<control>S", /* label, accelerator */
"Square", SHAPE_SQUARE }, /* tooltip, value */ "Square", SHAPE_SQUARE }, /* tooltip, value */
{ "Rectangle", NULL, /* name, stock id */ { "Rectangle", NULL, /* name, stock id */
"_Rectangle", "<control>R", /* label, accelerator */ "_Rectangle", "<control>R", /* label, accelerator */
"Rectangle", SHAPE_RECTANGLE }, /* tooltip, value */ "Rectangle", SHAPE_RECTANGLE }, /* tooltip, value */
{ "Oval", NULL, /* name, stock id */ { "Oval", NULL, /* name, stock id */
"_Oval", "<control>O", /* label, accelerator */ "_Oval", "<control>O", /* label, accelerator */
"Egg", SHAPE_OVAL }, /* tooltip, value */ "Egg", SHAPE_OVAL }, /* tooltip, value */
}; };
static guint n_shape_entries = G_N_ELEMENTS (shape_entries); static guint n_shape_entries = G_N_ELEMENTS (shape_entries);
static const gchar *ui_info = static const gchar *ui_info =
"<ui>" "<ui>"
" <menubar name='MenuBar'>" " <menubar name='MenuBar'>"
" <menu action='FileMenu'>" " <menu action='FileMenu'>"
@ -144,7 +144,7 @@ GtkWidget *
do_ui_manager (GtkWidget *do_widget) do_ui_manager (GtkWidget *do_widget)
{ {
static GtkWidget *window = NULL; static GtkWidget *window = NULL;
if (!window) if (!window)
{ {
GtkWidget *box1; GtkWidget *box1;
@ -159,7 +159,7 @@ do_ui_manager (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window), gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget)); gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window); G_CALLBACK (gtk_widget_destroyed), &window);
g_signal_connect (window, "delete-event", g_signal_connect (window, "delete-event",
@ -167,29 +167,29 @@ do_ui_manager (GtkWidget *do_widget)
actions = gtk_action_group_new ("Actions"); actions = gtk_action_group_new ("Actions");
gtk_action_group_add_actions (actions, entries, n_entries, NULL); gtk_action_group_add_actions (actions, entries, n_entries, NULL);
gtk_action_group_add_toggle_actions (actions, gtk_action_group_add_toggle_actions (actions,
toggle_entries, n_toggle_entries, toggle_entries, n_toggle_entries,
NULL); NULL);
gtk_action_group_add_radio_actions (actions, gtk_action_group_add_radio_actions (actions,
color_entries, n_color_entries, color_entries, n_color_entries,
COLOR_RED, COLOR_RED,
G_CALLBACK (activate_radio_action), G_CALLBACK (activate_radio_action),
NULL); NULL);
gtk_action_group_add_radio_actions (actions, gtk_action_group_add_radio_actions (actions,
shape_entries, n_shape_entries, shape_entries, n_shape_entries,
SHAPE_OVAL, SHAPE_OVAL,
G_CALLBACK (activate_radio_action), G_CALLBACK (activate_radio_action),
NULL); NULL);
ui = gtk_ui_manager_new (); ui = gtk_ui_manager_new ();
gtk_ui_manager_insert_action_group (ui, actions, 0); gtk_ui_manager_insert_action_group (ui, actions, 0);
g_object_unref (actions); g_object_unref (actions);
gtk_window_add_accel_group (GTK_WINDOW (window), gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_ui_manager_get_accel_group (ui)); gtk_ui_manager_get_accel_group (ui));
gtk_window_set_title (GTK_WINDOW (window), "UI Manager"); gtk_window_set_title (GTK_WINDOW (window), "UI Manager");
gtk_container_set_border_width (GTK_CONTAINER (window), 0); gtk_container_set_border_width (GTK_CONTAINER (window), 0);
if (!gtk_ui_manager_add_ui_from_string (ui, ui_info, -1, &error)) if (!gtk_ui_manager_add_ui_from_string (ui, ui_info, -1, &error))
{ {
g_message ("building menus failed: %s", error->message); g_message ("building menus failed: %s", error->message);
@ -198,7 +198,7 @@ do_ui_manager (GtkWidget *do_widget)
box1 = gtk_vbox_new (FALSE, 0); box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1); gtk_container_add (GTK_CONTAINER (window), box1);
gtk_box_pack_start (GTK_BOX (box1), gtk_box_pack_start (GTK_BOX (box1),
gtk_ui_manager_get_widget (ui, "/MenuBar"), gtk_ui_manager_get_widget (ui, "/MenuBar"),
FALSE, FALSE, 0); FALSE, FALSE, 0);

View file

@ -68,7 +68,7 @@ load_pixbufs (void)
/* We pass NULL for the error return location, we don't care /* We pass NULL for the error return location, we don't care
* about the error message. * about the error message.
*/ */
background = gdk_pixbuf_new_from_file (BACKGROUND_NAME, NULL); background = gdk_pixbuf_new_from_file (BACKGROUND_NAME, NULL);
if (!background) if (!background)
return FALSE; return FALSE;
@ -90,7 +90,7 @@ static gint
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data) expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{ {
cairo_t *cr; cairo_t *cr;
cr = gdk_cairo_create (event->window); cr = gdk_cairo_create (event->window);
gdk_cairo_set_source_pixbuf (cr, frame, 0, 0); gdk_cairo_set_source_pixbuf (cr, frame, 0, 0);
gdk_cairo_rectangle (cr, &event->area); gdk_cairo_rectangle (cr, &event->area);

View file

@ -43,7 +43,7 @@ destroy_context (gpointer data)
LoadContext *lc = data; LoadContext *lc = data;
g_free (lc->filename); g_free (lc->filename);
if (lc->load_timeout) if (lc->load_timeout)
g_source_remove (lc->load_timeout); g_source_remove (lc->load_timeout);
@ -55,7 +55,7 @@ destroy_context (gpointer data)
gdk_pixbuf_loader_close (lc->pixbuf_loader, NULL); gdk_pixbuf_loader_close (lc->pixbuf_loader, NULL);
g_object_unref (lc->pixbuf_loader); g_object_unref (lc->pixbuf_loader);
} }
g_free (lc); g_free (lc);
} }
@ -70,7 +70,7 @@ get_load_context (GtkWidget *image)
{ {
lc = g_new0 (LoadContext, 1); lc = g_new0 (LoadContext, 1);
g_object_set_data_full (G_OBJECT (image), g_object_set_data_full (G_OBJECT (image),
"lc", "lc",
lc, lc,
destroy_context); destroy_context);
@ -87,7 +87,7 @@ progressive_prepared_callback (GdkPixbufLoader* loader,
GtkWidget* image; GtkWidget* image;
image = GTK_WIDGET (data); image = GTK_WIDGET (data);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
/* Avoid displaying random memory contents, since the pixbuf /* Avoid displaying random memory contents, since the pixbuf
@ -108,7 +108,7 @@ progressive_updated_callback (GdkPixbufLoader* loader,
gpointer data) gpointer data)
{ {
GtkWidget* image; GtkWidget* image;
image = GTK_WIDGET (data); image = GTK_WIDGET (data);
/* We know the pixbuf inside the GtkImage has changed, but the image /* We know the pixbuf inside the GtkImage has changed, but the image
@ -123,7 +123,7 @@ progressive_updated_callback (GdkPixbufLoader* loader,
* is gdk_pixbuf_animation_iter_on_currently_loading_frame(), but * is gdk_pixbuf_animation_iter_on_currently_loading_frame(), but
* who cares. * who cares.
*/ */
gtk_widget_queue_draw (image); gtk_widget_queue_draw (image);
} }
@ -132,27 +132,27 @@ progressive_timeout (gpointer data)
{ {
GtkWidget *image; GtkWidget *image;
LoadContext *lc; LoadContext *lc;
image = GTK_WIDGET (data); image = GTK_WIDGET (data);
lc = get_load_context (image); lc = get_load_context (image);
/* This shows off fully-paranoid error handling, so looks scary. /* This shows off fully-paranoid error handling, so looks scary.
* You could factor out the error handling code into a nice separate * You could factor out the error handling code into a nice separate
* function to make things nicer. * function to make things nicer.
*/ */
if (lc->image_stream) if (lc->image_stream)
{ {
size_t bytes_read; size_t bytes_read;
guchar buf[256]; guchar buf[256];
GError *error = NULL; GError *error = NULL;
bytes_read = fread (buf, 1, 256, lc->image_stream); bytes_read = fread (buf, 1, 256, lc->image_stream);
if (ferror (lc->image_stream)) if (ferror (lc->image_stream))
{ {
GtkWidget *dialog; GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (lc->window), dialog = gtk_message_dialog_new (GTK_WINDOW (lc->window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
@ -167,7 +167,7 @@ progressive_timeout (gpointer data)
lc->image_stream = NULL; lc->image_stream = NULL;
gtk_widget_show (dialog); gtk_widget_show (dialog);
lc->load_timeout = 0; lc->load_timeout = 0;
return FALSE; /* uninstall the timeout */ return FALSE; /* uninstall the timeout */
@ -178,7 +178,7 @@ progressive_timeout (gpointer data)
&error)) &error))
{ {
GtkWidget *dialog; GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (lc->window), dialog = gtk_message_dialog_new (GTK_WINDOW (lc->window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
@ -187,13 +187,13 @@ progressive_timeout (gpointer data)
error->message); error->message);
g_error_free (error); g_error_free (error);
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL); G_CALLBACK (gtk_widget_destroy), NULL);
fclose (lc->image_stream); fclose (lc->image_stream);
lc->image_stream = NULL; lc->image_stream = NULL;
gtk_widget_show (dialog); gtk_widget_show (dialog);
lc->load_timeout = 0; lc->load_timeout = 0;
@ -215,29 +215,29 @@ progressive_timeout (gpointer data)
&error)) &error))
{ {
GtkWidget *dialog; GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (lc->window), dialog = gtk_message_dialog_new (GTK_WINDOW (lc->window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE, GTK_BUTTONS_CLOSE,
"Failed to load image: %s", "Failed to load image: %s",
error->message); error->message);
g_error_free (error); g_error_free (error);
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL); G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog); gtk_widget_show (dialog);
g_object_unref (lc->pixbuf_loader); g_object_unref (lc->pixbuf_loader);
lc->pixbuf_loader = NULL; lc->pixbuf_loader = NULL;
lc->load_timeout = 0; lc->load_timeout = 0;
return FALSE; /* uninstall the timeout */ return FALSE; /* uninstall the timeout */
} }
g_object_unref (lc->pixbuf_loader); g_object_unref (lc->pixbuf_loader);
lc->pixbuf_loader = NULL; lc->pixbuf_loader = NULL;
} }
@ -249,7 +249,7 @@ progressive_timeout (gpointer data)
if (lc->image_stream == NULL) if (lc->image_stream == NULL)
{ {
GtkWidget *dialog; GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (lc->window), dialog = gtk_message_dialog_new (GTK_WINDOW (lc->window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_MESSAGE_ERROR,
@ -260,7 +260,7 @@ progressive_timeout (gpointer data)
g_signal_connect (dialog, "response", g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy), NULL); G_CALLBACK (gtk_widget_destroy), NULL);
gtk_widget_show (dialog); gtk_widget_show (dialog);
lc->load_timeout = 0; lc->load_timeout = 0;
@ -274,9 +274,9 @@ progressive_timeout (gpointer data)
g_object_unref (lc->pixbuf_loader); g_object_unref (lc->pixbuf_loader);
lc->pixbuf_loader = NULL; lc->pixbuf_loader = NULL;
} }
lc->pixbuf_loader = gdk_pixbuf_loader_new (); lc->pixbuf_loader = gdk_pixbuf_loader_new ();
g_signal_connect (lc->pixbuf_loader, "area_prepared", g_signal_connect (lc->pixbuf_loader, "area_prepared",
G_CALLBACK (progressive_prepared_callback), image); G_CALLBACK (progressive_prepared_callback), image);
g_signal_connect (lc->pixbuf_loader, "area_updated", g_signal_connect (lc->pixbuf_loader, "area_updated",
@ -293,7 +293,7 @@ start_progressive_loading (GtkWidget *image)
LoadContext *lc; LoadContext *lc;
lc = get_load_context (image); lc = get_load_context (image);
/* This is obviously totally contrived (we slow down loading /* This is obviously totally contrived (we slow down loading
* on purpose to show how incremental loading works). * on purpose to show how incremental loading works).
* The real purpose of incremental loading is the case where * The real purpose of incremental loading is the case where
@ -317,7 +317,7 @@ do_image (const char *filename)
GtkWidget *window; GtkWidget *window;
gchar *str, *escaped; gchar *str, *escaped;
LoadContext *lc; LoadContext *lc;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Image Loading"); gtk_window_set_title (GTK_WINDOW (window), "Image Loading");
@ -335,9 +335,9 @@ do_image (const char *filename)
str); str);
g_free (escaped); g_free (escaped);
g_free (str); g_free (str);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL); frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
/* The alignment keeps the frame from growing when users resize /* The alignment keeps the frame from growing when users resize
@ -345,7 +345,7 @@ do_image (const char *filename)
*/ */
align = gtk_alignment_new (0.5, 0.5, 0, 0); align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_container_add (GTK_CONTAINER (align), frame); gtk_container_add (GTK_CONTAINER (align), frame);
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0);
image = gtk_image_new_from_pixbuf (NULL); image = gtk_image_new_from_pixbuf (NULL);
gtk_container_add (GTK_CONTAINER (frame), image); gtk_container_add (GTK_CONTAINER (frame), image);
@ -354,12 +354,12 @@ do_image (const char *filename)
lc->window = window; lc->window = window;
lc->filename = g_strdup (filename); lc->filename = g_strdup (filename);
start_progressive_loading (image); start_progressive_loading (image);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (window, "delete_event", g_signal_connect (window, "delete_event",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
@ -378,7 +378,7 @@ do_nonprogressive (const gchar *filename)
GtkWidget *align; GtkWidget *align;
GtkWidget *window; GtkWidget *window;
gchar *str, *escaped; gchar *str, *escaped;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Animation"); gtk_window_set_title (GTK_WINDOW (window), "Animation");
@ -396,9 +396,9 @@ do_nonprogressive (const gchar *filename)
str); str);
g_free (escaped); g_free (escaped);
g_free (str); g_free (str);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL); frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
/* The alignment keeps the frame from growing when users resize /* The alignment keeps the frame from growing when users resize
@ -406,14 +406,14 @@ do_nonprogressive (const gchar *filename)
*/ */
align = gtk_alignment_new (0.5, 0.5, 0, 0); align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_container_add (GTK_CONTAINER (align), frame); gtk_container_add (GTK_CONTAINER (align), frame);
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0);
image = gtk_image_new_from_file (filename); image = gtk_image_new_from_file (filename);
gtk_container_add (GTK_CONTAINER (frame), image); gtk_container_add (GTK_CONTAINER (frame), image);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
g_signal_connect (window, "delete_event", g_signal_connect (window, "delete_event",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
@ -425,7 +425,7 @@ main (int argc,
char **argv) char **argv)
{ {
gint i; gint i;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
i = 1; i = 1;
@ -433,12 +433,12 @@ main (int argc,
{ {
do_image (argv[i]); do_image (argv[i]);
do_nonprogressive (argv[i]); do_nonprogressive (argv[i]);
++i; ++i;
} }
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -24,15 +24,15 @@ gboolean
read_line (FILE *stream, GString *str) read_line (FILE *stream, GString *str)
{ {
int n_read = 0; int n_read = 0;
flockfile (stream); flockfile (stream);
g_string_truncate (str, 0); g_string_truncate (str, 0);
while (1) while (1)
{ {
int c; int c;
c = getc_unlocked (stream); c = getc_unlocked (stream);
if (c == EOF) if (c == EOF)
@ -46,12 +46,12 @@ read_line (FILE *stream, GString *str)
case '\n': case '\n':
{ {
int next_c = getc_unlocked (stream); int next_c = getc_unlocked (stream);
if (!(next_c == EOF || if (!(next_c == EOF ||
(c == '\r' && next_c == '\n') || (c == '\r' && next_c == '\n') ||
(c == '\n' && next_c == '\r'))) (c == '\n' && next_c == '\r')))
ungetc (next_c, stream); ungetc (next_c, stream);
goto done; goto done;
} }
default: default:
@ -80,7 +80,7 @@ load_file (const gchar *filename)
g_free (current_file); g_free (current_file);
current_file = g_strdup (filename); current_file = g_strdup (filename);
gtk_text_buffer_get_bounds (info_buffer, &start, &end); gtk_text_buffer_get_bounds (info_buffer, &start, &end);
gtk_text_buffer_delete (info_buffer, &start, &end); gtk_text_buffer_delete (info_buffer, &start, &end);
@ -99,7 +99,7 @@ load_file (const gchar *filename)
{ {
gchar *p = buffer->str; gchar *p = buffer->str;
gchar *q; gchar *q;
switch (state) switch (state)
{ {
case 0: case 0:
@ -124,11 +124,11 @@ load_file (const gchar *filename)
gtk_text_buffer_apply_tag_by_name (info_buffer, "title", &start, &end); gtk_text_buffer_apply_tag_by_name (info_buffer, "title", &start, &end);
start = end; start = end;
state++; state++;
} }
break; break;
case 1: case 1:
/* Reading body of info section */ /* Reading body of info section */
while (isspace (*p)) while (isspace (*p))
@ -141,14 +141,14 @@ load_file (const gchar *filename)
else else
{ {
int len; int len;
while (*p == '*' || isspace (*p)) while (*p == '*' || isspace (*p))
p++; p++;
len = strlen (p); len = strlen (p);
while (isspace (*(p + len - 1))) while (isspace (*(p + len - 1)))
len--; len--;
if (len > 0) if (len > 0)
{ {
if (in_para) if (in_para)
@ -178,7 +178,7 @@ load_file (const gchar *filename)
} }
else else
break; break;
case 3: case 3:
/* Reading program body */ /* Reading program body */
gtk_text_buffer_insert (source_buffer, &start, p, -1); gtk_text_buffer_insert (source_buffer, &start, p, -1);
@ -231,7 +231,7 @@ button_press_event_cb (GtkTreeView *tree_view,
g_signal_stop_emission_by_name (tree_view, "button-press-event"); g_signal_stop_emission_by_name (tree_view, "button-press-event");
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
@ -266,10 +266,10 @@ create_text (GtkTextBuffer **buffer,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_SHADOW_IN); GTK_SHADOW_IN);
text_view = gtk_text_view_new (); text_view = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view); gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
*buffer = gtk_text_buffer_new (NULL); *buffer = gtk_text_buffer_new (NULL);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), *buffer); gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), *buffer);
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE); gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
@ -281,9 +281,9 @@ create_text (GtkTextBuffer **buffer,
gtk_widget_modify_font (text_view, font_desc); gtk_widget_modify_font (text_view, font_desc);
pango_font_description_free (font_desc); pango_font_description_free (font_desc);
} }
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), !is_source); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), !is_source);
return scrolled_window; return scrolled_window;
} }
@ -345,7 +345,7 @@ main (int argc, char **argv)
GtkTextTag *tag; GtkTextTag *tag;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
@ -382,10 +382,10 @@ main (int argc, char **argv)
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
gtk_widget_show_all (window); gtk_widget_show_all (window);
load_file (testgtk_demos[0].filename); load_file (testgtk_demos[0].filename);
gtk_main (); gtk_main ();
return 0; return 0;

View file

@ -15,7 +15,7 @@ int
expose_cb (GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data) expose_cb (GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
{ {
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area), "pixbuf"); pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area), "pixbuf");
if (gdk_pixbuf_get_has_alpha (pixbuf)) if (gdk_pixbuf_get_has_alpha (pixbuf))
{ {
@ -32,11 +32,11 @@ expose_cb (GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
} }
else else
{ {
gdk_draw_rgb_image (drawing_area->window, gdk_draw_rgb_image (drawing_area->window,
drawing_area->style->black_gc, drawing_area->style->black_gc,
evt->area.x, evt->area.y, evt->area.x, evt->area.y,
evt->area.width, evt->area.width,
evt->area.height, evt->area.height,
GDK_RGB_DITHER_NORMAL, GDK_RGB_DITHER_NORMAL,
gdk_pixbuf_get_pixels (pixbuf) + gdk_pixbuf_get_pixels (pixbuf) +
(evt->area.y * gdk_pixbuf_get_rowstride (pixbuf)) + (evt->area.y * gdk_pixbuf_get_rowstride (pixbuf)) +
@ -50,9 +50,9 @@ int
configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data) configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
{ {
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area), "pixbuf"); pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area), "pixbuf");
g_print ("X:%d Y:%d\n", evt->width, evt->height); g_print ("X:%d Y:%d\n", evt->width, evt->height);
if (evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf)) if (evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf))
{ {
@ -73,16 +73,16 @@ extern void pixbuf_init (void);
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
GdkWindow *root; GdkWindow *root;
GtkWidget *window; GtkWidget *window;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *drawing_area; GtkWidget *drawing_area;
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
pixbuf_init (); pixbuf_init ();
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
gdk_rgb_set_verbose (TRUE); gdk_rgb_set_verbose (TRUE);
gtk_widget_set_default_colormap (gdk_rgb_get_colormap ()); gtk_widget_set_default_colormap (gdk_rgb_get_colormap ());
@ -90,16 +90,16 @@ main (int argc, char **argv)
root = gdk_get_default_root_window (); root = gdk_get_default_root_window ();
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL, pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
0, 0, 0, 0, 150, 160); 0, 0, 0, 0, 150, 160);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "delete_event", g_signal_connect (window, "delete_event",
G_CALLBACK (close_app), NULL); G_CALLBACK (close_app), NULL);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (close_app), NULL); G_CALLBACK (close_app), NULL);
vbox = gtk_vbox_new (FALSE, 0); vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
drawing_area = gtk_drawing_area_new (); drawing_area = gtk_drawing_area_new ();
gtk_widget_set_size_request (GTK_WIDGET (drawing_area), gtk_widget_set_size_request (GTK_WIDGET (drawing_area),
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_width (pixbuf),
@ -111,7 +111,7 @@ main (int argc, char **argv)
G_CALLBACK (configure_cb), NULL); G_CALLBACK (configure_cb), NULL);
g_object_set_data (G_OBJECT (drawing_area), "pixbuf", pixbuf); g_object_set_data (G_OBJECT (drawing_area), "pixbuf", pixbuf);
gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
gtk_widget_show_all (window); gtk_widget_show_all (window);
gtk_main (); gtk_main ();
return 0; return 0;

View file

@ -124,7 +124,7 @@ keypress_check (GtkWidget *widget, GdkEventKey *evt, gpointer data)
if (pixbuf == NULL) { if (pixbuf == NULL) {
fprintf (stderr, "PIXBUF NULL\n"); fprintf (stderr, "PIXBUF NULL\n");
return; return;
} }
loader = gdk_pixbuf_loader_new (); loader = gdk_pixbuf_loader_new ();
if (!gdk_pixbuf_save_to_callback (pixbuf, save_to_loader, loader, "jpeg", if (!gdk_pixbuf_save_to_callback (pixbuf, save_to_loader, loader, "jpeg",
@ -160,7 +160,7 @@ keypress_check (GtkWidget *widget, GdkEventKey *evt, gpointer data)
if (pixbuf == NULL) { if (pixbuf == NULL) {
fprintf (stderr, "PIXBUF NULL\n"); fprintf (stderr, "PIXBUF NULL\n");
return; return;
} }
if (!gdk_pixbuf_save (pixbuf, "foo.jpg", "jpeg", if (!gdk_pixbuf_save (pixbuf, "foo.jpg", "jpeg",
&err, &err,
@ -217,7 +217,7 @@ keypress_check (GtkWidget *widget, GdkEventKey *evt, gpointer data)
return; return;
} }
if (!gdk_pixbuf_save (pixbuf, "foo.png", "png", if (!gdk_pixbuf_save (pixbuf, "foo.png", "png",
&err, &err,
"tEXt::Software", "testpixbuf-save", "tEXt::Software", "testpixbuf-save",
NULL)) { NULL)) {
@ -270,7 +270,7 @@ keypress_check (GtkWidget *widget, GdkEventKey *evt, gpointer data)
return; return;
} }
if (!gdk_pixbuf_save (pixbuf, "foo.ico", "ico", if (!gdk_pixbuf_save (pixbuf, "foo.ico", "ico",
&err, &err,
NULL)) { NULL)) {
fprintf (stderr, "%s", err->message); fprintf (stderr, "%s", err->message);
@ -312,7 +312,7 @@ expose_cb (GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
{ {
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
cairo_t *cr; cairo_t *cr;
pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area), pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area),
"pixbuf"); "pixbuf");
@ -330,10 +330,10 @@ static int
configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data) configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
{ {
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area), pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area),
"pixbuf"); "pixbuf");
g_print ("X:%d Y:%d\n", evt->width, evt->height); g_print ("X:%d Y:%d\n", evt->width, evt->height);
if (evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf)) { if (evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf)) {
GdkWindow *root; GdkWindow *root;
@ -351,28 +351,28 @@ configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
GdkWindow *root; GdkWindow *root;
GtkWidget *window; GtkWidget *window;
GtkWidget *vbox; GtkWidget *vbox;
GtkWidget *drawing_area; GtkWidget *drawing_area;
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
root = gdk_get_default_root_window (); root = gdk_get_default_root_window ();
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL, pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
0, 0, 0, 0, 150, 160); 0, 0, 0, 0, 150, 160);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "delete_event", g_signal_connect (window, "delete_event",
G_CALLBACK (close_app), NULL); G_CALLBACK (close_app), NULL);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (close_app), NULL); G_CALLBACK (close_app), NULL);
vbox = gtk_vbox_new (FALSE, 0); vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
drawing_area = gtk_drawing_area_new (); drawing_area = gtk_drawing_area_new ();
gtk_widget_set_size_request (GTK_WIDGET (drawing_area), gtk_widget_set_size_request (GTK_WIDGET (drawing_area),
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_width (pixbuf),
@ -382,12 +382,12 @@ main (int argc, char **argv)
g_signal_connect (drawing_area, "configure_event", g_signal_connect (drawing_area, "configure_event",
G_CALLBACK (configure_cb), NULL); G_CALLBACK (configure_cb), NULL);
g_signal_connect (window, "key_press_event", g_signal_connect (window, "key_press_event",
G_CALLBACK (keypress_check), drawing_area); G_CALLBACK (keypress_check), drawing_area);
g_object_set_data_full (G_OBJECT (drawing_area), "pixbuf", pixbuf, g_object_set_data_full (G_OBJECT (drawing_area), "pixbuf", pixbuf,
(GDestroyNotify) g_object_unref); (GDestroyNotify) g_object_unref);
gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
gtk_widget_show_all (window); gtk_widget_show_all (window);
gtk_main (); gtk_main ();
return 0; return 0;

View file

@ -8,7 +8,7 @@ GdkInterpType interp_type = GDK_INTERP_BILINEAR;
int overall_alpha = 255; int overall_alpha = 255;
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
GtkWidget *darea; GtkWidget *darea;
void void
set_interp_type (GtkWidget *widget, gpointer data) set_interp_type (GtkWidget *widget, gpointer data)
{ {
@ -38,7 +38,7 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
cairo_t *cr; cairo_t *cr;
gdk_window_set_back_pixmap (widget->window, NULL, FALSE); gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height); dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
gdk_pixbuf_composite_color (pixbuf, dest, gdk_pixbuf_composite_color (pixbuf, dest,
@ -57,7 +57,7 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
cairo_destroy (cr); cairo_destroy (cr);
g_object_unref (dest); g_object_unref (dest);
return TRUE; return TRUE;
} }
@ -74,7 +74,7 @@ main(int argc, char **argv)
GtkRequisition scratch_requisition; GtkRequisition scratch_requisition;
const gchar *creator; const gchar *creator;
GError *error; GError *error;
pixbuf_init (); pixbuf_init ();
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
@ -100,7 +100,7 @@ main(int argc, char **argv)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", g_signal_connect (window, "destroy",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
vbox = gtk_vbox_new (FALSE, 0); vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
@ -116,7 +116,7 @@ main(int argc, char **argv)
g_signal_connect (combo_box, "changed", g_signal_connect (combo_box, "changed",
G_CALLBACK (set_interp_type), G_CALLBACK (set_interp_type),
NULL); NULL);
alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.5); alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
@ -129,7 +129,7 @@ main(int argc, char **argv)
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (overall_alpha, 0, 255, 1, 10, 0)); adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (overall_alpha, 0, 255, 1, 10, 0));
g_signal_connect (adjustment, "value_changed", g_signal_connect (adjustment, "value_changed",
G_CALLBACK (overall_changed_cb), NULL); G_CALLBACK (overall_changed_cb), NULL);
hscale = gtk_hscale_new (adjustment); hscale = gtk_hscale_new (adjustment);
gtk_scale_set_digits (GTK_SCALE (hscale), 0); gtk_scale_set_digits (GTK_SCALE (hscale), 0);
gtk_box_pack_start (GTK_BOX (hbox), hscale, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), hscale, TRUE, TRUE, 0);
@ -149,7 +149,7 @@ main(int argc, char **argv)
gtk_window_set_default_size (GTK_WINDOW (window), gtk_window_set_default_size (GTK_WINDOW (window),
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_width (pixbuf),
scratch_requisition.height + gdk_pixbuf_get_height (pixbuf)); scratch_requisition.height + gdk_pixbuf_get_height (pixbuf));
gtk_widget_show_all (window); gtk_widget_show_all (window);
gtk_main (); gtk_main ();

View file

@ -302,7 +302,7 @@ static const char * gtk_mini_xpm[] = {
" >%$$ ", " >%$$ ",
" >= "}; " >= "};
const gchar ** xpms[] = { const gchar ** xpms[] = {
book_open_xpm, book_open_xpm,
book_closed_xpm, book_closed_xpm,
mini_page_xpm, mini_page_xpm,
@ -326,11 +326,11 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
if (gdk_pixbuf_get_has_alpha (pixbuf)) { if (gdk_pixbuf_get_has_alpha (pixbuf)) {
GdkPixbuf *dest; GdkPixbuf *dest;
cairo_t *cr; cairo_t *cr;
gdk_window_set_back_pixmap (drawing_area->window, NULL, FALSE); gdk_window_set_back_pixmap (drawing_area->window, NULL, FALSE);
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height); dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
gdk_pixbuf_composite_color (pixbuf, dest, gdk_pixbuf_composite_color (pixbuf, dest,
0, 0, event->area.width, event->area.height, 0, 0, event->area.width, event->area.height,
-event->area.x, -event->area.y, -event->area.x, -event->area.y,
@ -338,7 +338,7 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
(double) drawing_area->allocation.height / gdk_pixbuf_get_height (pixbuf), (double) drawing_area->allocation.height / gdk_pixbuf_get_height (pixbuf),
GDK_INTERP_BILINEAR, 255, GDK_INTERP_BILINEAR, 255,
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555); event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
cr = gdk_cairo_create (drawing_area->window); cr = gdk_cairo_create (drawing_area->window);
gdk_cairo_set_source_pixbuf (cr, dest, 0, 0); gdk_cairo_set_source_pixbuf (cr, dest, 0, 0);
@ -350,8 +350,8 @@ expose_func (GtkWidget *drawing_area, GdkEventExpose *event, gpointer data)
} else { } else {
gdk_draw_rgb_image (drawing_area->window, gdk_draw_rgb_image (drawing_area->window,
drawing_area->style->white_gc, drawing_area->style->white_gc,
event->area.x, event->area.y, event->area.x, event->area.y,
event->area.width, event->area.width,
event->area.height, event->area.height,
GDK_RGB_DITHER_NORMAL, GDK_RGB_DITHER_NORMAL,
gdk_pixbuf_get_pixels (pixbuf) gdk_pixbuf_get_pixels (pixbuf)
@ -366,7 +366,7 @@ config_func (GtkWidget *drawing_area, GdkEventConfigure *event, gpointer data)
{ {
#if 0 #if 0
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
pixbuf = (GdkPixbuf *)g_object_get_data (G_OBJECT (drawing_area), "pixbuf"); pixbuf = (GdkPixbuf *)g_object_get_data (G_OBJECT (drawing_area), "pixbuf");
if (((event->width) != gdk_pixbuf_get_width (pixbuf)) || if (((event->width) != gdk_pixbuf_get_width (pixbuf)) ||
@ -410,7 +410,7 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
gtk_widget_set_size_request (GTK_WIDGET (drawing_area), w, h); gtk_widget_set_size_request (GTK_WIDGET (drawing_area), w, h);
gtk_box_pack_start (GTK_BOX (temp_box), drawing_area, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (temp_box), drawing_area, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0);
g_signal_connect (drawing_area, "expose_event", g_signal_connect (drawing_area, "expose_event",
G_CALLBACK (expose_func), NULL); G_CALLBACK (expose_func), NULL);
@ -443,14 +443,14 @@ update_timeout (gpointer data)
ProgressFileStatus *status = data; ProgressFileStatus *status = data;
gboolean done; gboolean done;
GError *error; GError *error;
done = FALSE; done = FALSE;
error = NULL; error = NULL;
if (!feof (status->imagefile)) { if (!feof (status->imagefile)) {
gint nbytes; gint nbytes;
nbytes = fread (status->buf, 1, status->readlen, nbytes = fread (status->buf, 1, status->readlen,
status->imagefile); status->imagefile);
@ -460,12 +460,12 @@ update_timeout (gpointer data)
g_error_free (error); g_error_free (error);
done = TRUE; done = TRUE;
} }
} }
else else
done = TRUE; done = TRUE;
if (done) { if (done) {
/* ignoring errors, we should not do that. */ /* ignoring errors, we should not do that. */
gdk_pixbuf_loader_close (GDK_PIXBUF_LOADER (status->loader), NULL); gdk_pixbuf_loader_close (GDK_PIXBUF_LOADER (status->loader), NULL);
@ -555,7 +555,7 @@ main (int argc, char **argv)
if (argc == 1) { if (argc == 1) {
const gchar*** xpmp; const gchar*** xpmp;
GError *error = NULL; GError *error = NULL;
pixbuf = gdk_pixbuf_new_from_data (default_image, GDK_COLORSPACE_RGB, FALSE, 8, pixbuf = gdk_pixbuf_new_from_data (default_image, GDK_COLORSPACE_RGB, FALSE, 8,
DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH * 3, DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_WIDTH * 3,
NULL, NULL); NULL, NULL);
@ -581,7 +581,7 @@ main (int argc, char **argv)
pixbuf = gdk_pixbuf_new_from_inline (sizeof (gnome_foot), gnome_foot, TRUE, NULL); pixbuf = gdk_pixbuf_new_from_inline (sizeof (gnome_foot), gnome_foot, TRUE, NULL);
new_testrgb_window (pixbuf, "GNOME Foot from inlined RLE data"); new_testrgb_window (pixbuf, "GNOME Foot from inlined RLE data");
found_valid = TRUE; found_valid = TRUE;
} else { } else {
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
@ -595,7 +595,7 @@ main (int argc, char **argv)
error->message); error->message);
g_error_free (error); g_error_free (error);
} }
#if 0 #if 0
pixbuf = gdk_pixbuf_rotate (pixbuf, 10.0); pixbuf = gdk_pixbuf_rotate (pixbuf, 10.0);
#endif #endif
@ -605,7 +605,7 @@ main (int argc, char **argv)
found_valid = TRUE; found_valid = TRUE;
} }
} }
#if 1 #if 1
{ {
GtkWidget* rgb_window = NULL; GtkWidget* rgb_window = NULL;
ProgressFileStatus status; ProgressFileStatus status;
@ -618,7 +618,7 @@ main (int argc, char **argv)
status.buf = g_malloc (readlen); status.buf = g_malloc (readlen);
#if 0 #if 0
g_signal_connect (pixbuf_loader, "size_prepared", g_signal_connect (pixbuf_loader, "size_prepared",
G_CALLBACK (size_func), NULL); G_CALLBACK (size_func), NULL);
#endif #endif
@ -628,7 +628,7 @@ main (int argc, char **argv)
g_signal_connect (pixbuf_loader, "area_updated", g_signal_connect (pixbuf_loader, "area_updated",
G_CALLBACK (progressive_updated_callback), G_CALLBACK (progressive_updated_callback),
&rgb_window); &rgb_window);
status.imagefile = fopen (argv[1], "r"); status.imagefile = fopen (argv[1], "r");
g_assert (status.imagefile != NULL); g_assert (status.imagefile != NULL);

View file

@ -20,7 +20,7 @@ Ex: (module Gtk)
Ex: (module Rgb Ex: (module Rgb
(submodule-of Gdk)) (submodule-of Gdk))
modules are later referred to with a list of module names, like modules are later referred to with a list of module names, like
(Gdk Rgb) or (Gtk) (Gdk Rgb) or (Gtk)
Object and boxed type definitions automatically create a submodule. Object and boxed type definitions automatically create a submodule.
@ -58,7 +58,7 @@ Ex: (type
;; This one would be implied by the (object) def for GtkWidget I ;; This one would be implied by the (object) def for GtkWidget I
;; think - (type) is only required for types that are not implied ;; think - (type) is only required for types that are not implied
;; by other definitions, such as int/boolean/etc. ;; by other definitions, such as int/boolean/etc.
(type (type
(alias GtkWidget) (alias GtkWidget)
(in-module (Gtk)) (in-module (Gtk))
@ -94,7 +94,7 @@ stuff.
(c-name name-of-the-object-in-C) (c-name name-of-the-object-in-C)
(field (type-and-name type-alias-of-struct-field name-of-struct-field) (field (type-and-name type-alias-of-struct-field name-of-struct-field)
(access read-or-write-or-readwrite))) (access read-or-write-or-readwrite)))
Ex: (object Widget Ex: (object Widget
(in-module (Gtk)) (in-module (Gtk))
@ -111,10 +111,10 @@ An "object" declaration automatically implies the type definition:
(out-c-name pointer-to-pointer-to-c-name) (out-c-name pointer-to-pointer-to-c-name)
(inout-c-name pointer-to-c-name)) (inout-c-name pointer-to-c-name))
Ex: Ex:
(type (alias GtkWidget) (type (alias GtkWidget)
(in-c-name GtkWidget*) (in-c-name GtkWidget*)
(out-c-name GtkWidget**) (out-c-name GtkWidget**)
(inout-c-name GtkWidget*)) (inout-c-name GtkWidget*))
It also implies a module that is the name broken into parts: It also implies a module that is the name broken into parts:
@ -131,7 +131,7 @@ It also implies a module that is the name broken into parts:
(return-type return-value-type) ;; defaults to void (return-type return-value-type) ;; defaults to void
(caller-owns-return boolean-value) ;; defaults to #f (caller-owns-return boolean-value) ;; defaults to #f
(can-return-null boolean-value) ;; defaults to #t (can-return-null boolean-value) ;; defaults to #t
(parameter in-or-out-or-inout (parameter in-or-out-or-inout
(type-and-name parameter-type-alias parameter-name) (type-and-name parameter-type-alias parameter-name)
(type-parameter name-of-contained-type) ;; optional, requires parametric type (type-parameter name-of-contained-type) ;; optional, requires parametric type
(c-declaration "c-type-and-name")) ;; c-declaration only required (c-declaration "c-type-and-name")) ;; c-declaration only required
@ -144,7 +144,7 @@ Ex:
(in-module (Gdk Rgb) (in-module (Gdk Rgb)
(c-name gdk_rgb_init))) (c-name gdk_rgb_init)))
Ex: Ex:
(function new (function new
(in-module (Gdk Rgb Cmap)) (in-module (Gdk Rgb Cmap))
(is-constructor-of GdkRgbCmap) (is-constructor-of GdkRgbCmap)
@ -160,7 +160,7 @@ Ex:
(c-name gnome_config_set_set_handler) (c-name gnome_config_set_set_handler)
(parameter in (type-and-name native func) (parameter in (type-and-name native func)
(c-declaration "void (*func)(void*)")) (c-declaration "void (*func)(void*)"))
(parameter in (type-and-name gpointer data))) (parameter in (type-and-name gpointer data)))
=== ===
(method method-name (method method-name
@ -168,7 +168,7 @@ Ex:
;; retval/arg attributes as for (function), but with first parameter ;; retval/arg attributes as for (function), but with first parameter
;; omitted for non-constructors ;; omitted for non-constructors
) )
Ex: Ex:
(method set_text (method set_text
(of-object Label (Gtk)) (of-object Label (Gtk))
@ -190,7 +190,7 @@ Ex:
(readable #t) (readable #t)
(writeable #t)) (writeable #t))
=== ===
(signal signal-name (signal signal-name
(run-action bool-value) (run-action bool-value)
(run-first bool-value) (run-first bool-value)
@ -211,7 +211,7 @@ Ex:
(parameter in (type-and-name gint column)) (parameter in (type-and-name gint column))
(parameter in (type-and-name GdkEvent* event))) (parameter in (type-and-name GdkEvent* event)))
=== ===
(enum enum-name (enum enum-name
(in-module modname) (in-module modname)
(c-name name-in-c) (c-name name-in-c)
@ -238,7 +238,7 @@ Ex:
=== ===
(flags) is just like enum, but some bindings may wrap enums and flags differently. (flags) is just like enum, but some bindings may wrap enums and flags differently.
=== ===
(boxed boxed-name (boxed boxed-name
@ -268,10 +268,10 @@ An "object" declaration automatically implies the type definition:
(out-c-name pointer-to-pointer-to-c-name) (out-c-name pointer-to-pointer-to-c-name)
(inout-c-name pointer-to-c-name)) (inout-c-name pointer-to-c-name))
Ex: Ex:
(type (alias GdkPixmap) (type (alias GdkPixmap)
(in-c-name GdkPixmap*) (in-c-name GdkPixmap*)
(out-c-name GdkPixmap**) (out-c-name GdkPixmap**)
(inout-c-name GdkPixmap*)) (inout-c-name GdkPixmap*))
@ -296,9 +296,9 @@ Ex:
Implies GdkRectangle type alias: Implies GdkRectangle type alias:
(type (alias GdkRectangle) (type (alias GdkRectangle)
(in-c-name GdkRectangle*) (in-c-name GdkRectangle*)
(out-c-name GdkRectangle*) ;; note - not the same as boxed types (out-c-name GdkRectangle*) ;; note - not the same as boxed types
(inout-c-name GdkRectangle*)) (inout-c-name GdkRectangle*))
=== ===
@ -333,6 +333,6 @@ Ex:

View file

@ -22,8 +22,8 @@ gdkdnd.c divides into 4 pieces:
3) Xdnd specific code 3) Xdnd specific code
4) The public interfaces 4) The public interfaces
The code in gtkdnd.c roughly consists of three parts The code in gtkdnd.c roughly consists of three parts
1) General utility functions 1) General utility functions
2) Destination side code 2) Destination side code
3) Source side code. 3) Source side code.
@ -43,7 +43,7 @@ in the structures GtkSourceInfo and GtkDestInfo.
The GtkSourceInfo structure is created when the drag The GtkSourceInfo structure is created when the drag
begins, and persists until the drag either completes begins, and persists until the drag either completes
or times out. A pointer to it is stored in or times out. A pointer to it is stored in
dataset-data for the GdkDragContext, however there dataset-data for the GdkDragContext, however there
is no ownership. If the SourceInfo is destroyed is no ownership. If the SourceInfo is destroyed
before the context, the field is simply cleared. before the context, the field is simply cleared.
@ -95,7 +95,7 @@ void gdk_drag_find_window (GdkDragContext *context,
gboolean gdk_drag_motion (GdkDragContext *context, gboolean gdk_drag_motion (GdkDragContext *context,
GdkWindow *dest_window, GdkWindow *dest_window,
GdkDragProtocol protocol, GdkDragProtocol protocol,
gint x_root, gint x_root,
gint y_root, gint y_root,
GdkDragAction action, GdkDragAction action,
guint32 time); guint32 time);
@ -129,7 +129,7 @@ SubstructureNotifyMask on the root window, so that
it can update this list. it can update this list.
It probably would be easier to just reread the entire It probably would be easier to just reread the entire
list when one of these events occurs, instead of list when one of these events occurs, instead of
incrementally updating, but updating the list in incrementally updating, but updating the list in
sync was sort of fun code, so I did it that way ;-) sync was sort of fun code, so I did it that way ;-)
@ -144,7 +144,7 @@ the button press, which might actually be before
the XQueryPointer for the previous MotionNotify the XQueryPointer for the previous MotionNotify
event is done.) event is done.)
Probably better is doing MotionNotify compression Probably better is doing MotionNotify compression
and discarding MotionNotify events when there and discarding MotionNotify events when there
are more on the queue before the next ButtonPress/Release. are more on the queue before the next ButtonPress/Release.
@ -174,7 +174,7 @@ Because the abstraction of the drag protocol is at the GDK
level, a proxy drag from Motif to Xdnd or vice versa happens level, a proxy drag from Motif to Xdnd or vice versa happens
pretty much automatically during the drag, though the pretty much automatically during the drag, though the
drop can get complicated. For Xdnd <-> Motif, drop can get complicated. For Xdnd <-> Motif,
Motif <-> Xdnd, or Motif <-> Motif drags, it is necessary to Motif <-> Xdnd, or Motif <-> Motif drags, it is necessary to
for the Proxy to retrieve the data and pass it on to for the Proxy to retrieve the data and pass it on to
the true destination, since either the selection names the true destination, since either the selection names
differ or (Motif<->Motif), the proxy needs to know differ or (Motif<->Motif), the proxy needs to know
@ -191,7 +191,7 @@ The spec is at:
Motif: Motif:
The Motif DND protocol is best described in the The Motif DND protocol is best described in the
Hungry Programmers _Inside Lesstif_ book, available Hungry Programmers _Inside Lesstif_ book, available
from: from:

View file

@ -53,7 +53,7 @@ has_pointer_focus(W) into four cases:
T1: [(F==W || F==Descendant) => F==Ancestor]; has_pointer(W) T1: [(F==W || F==Descendant) => F==Ancestor]; has_pointer(W)
T2: [(F==W || F==Descendant) => F==PointerRoot]; has_pointer(W) T2: [(F==W || F==Descendant) => F==PointerRoot]; has_pointer(W)
T3: [(F==None || F==Other) => (F==PointerRoot || F==Ancestor)]; T3: [(F==None || F==Other) => (F==PointerRoot || F==Ancestor)];
has_pointer(W) has_pointer(W)
@ -65,11 +65,11 @@ T1:, we get a FocusOut with a mode of Ancestor or Virtual
We need to separately track has_pointer(W) to distinguish We need to separately track has_pointer(W) to distinguish
this from the case where we get these events and !has_pointer(W) this from the case where we get these events and !has_pointer(W)
T2, T3: together these are exactly the cases where we get T2, T3: together these are exactly the cases where we get
FocusIn/NotifyPointer. FocusIn/NotifyPointer.
For T4, we get an EnterNotify with the focus flag set. An For T4, we get an EnterNotify with the focus flag set. An
EnterNotify with a focus flag set will also be sent if EnterNotify with a focus flag set will also be sent if
F==W, so we have to to explicitly test for that case F==W, so we have to to explicitly test for that case
using has_focus_window(W) using has_focus_window(W)
@ -80,7 +80,7 @@ are exactly the opposite
F1: [(F==W || F==Descendant) <= F==Ancestor]; has_pointer(W) F1: [(F==W || F==Descendant) <= F==Ancestor]; has_pointer(W)
F2: [(F==W || F==Descendant) <= F==PointerRoot]; has_pointer(W) F2: [(F==W || F==Descendant) <= F==PointerRoot]; has_pointer(W)
F3: [(F==None || F==Other) <= (F==PointerRoot || F==Ancestor)]; F3: [(F==None || F==Other) <= (F==PointerRoot || F==Ancestor)];
has_pointer(W) has_pointer(W)
@ -92,11 +92,11 @@ F1: we get a FocusIn with a mode of Ancestor or Virtual
We need to separately track has_pointer(W) to distinguish We need to separately track has_pointer(W) to distinguish
this from the case we get these events and !has_pointer(W) this from the case we get these events and !has_pointer(W)
F2, F3: together these are exactly the cases where we get F2, F3: together these are exactly the cases where we get
FocusOut/NotifyPointer. FocusOut/NotifyPointer.
F4: we get an LeaveNotify with the focus flag set. An F4: we get an LeaveNotify with the focus flag set. An
LeaveNotify with a focus flag set will also be sent if LeaveNotify with a focus flag set will also be sent if
F==W, so we have to to explicitly test for that case F==W, so we have to to explicitly test for that case
using has_focus_window(W). using has_focus_window(W).
@ -104,16 +104,16 @@ F4: we get an LeaveNotify with the focus flag set. An
Modifications for keyboard grabs Modifications for keyboard grabs
================================ ================================
The above algorithm ignores keyboard grabs, which also The above algorithm ignores keyboard grabs, which also
generate focus events, and needs to be modified somewhat generate focus events, and needs to be modified somewhat
to take keyboard grabs into effect. The basic idea to take keyboard grabs into effect. The basic idea
is that for has_pointer_focus(W)/has_window_focus(W) we track is that for has_pointer_focus(W)/has_window_focus(W) we track
them ignoring grabs and ungrabs, and then supplement them ignoring grabs and ungrabs, and then supplement
that with another predicate has_focus(W) which pays that with another predicate has_focus(W) which pays
attention to grabs and ungrabs. attention to grabs and ungrabs.
Modification 1: Modification 1:
When tracking has_pointer_focus(W), ignore all Focus When tracking has_pointer_focus(W), ignore all Focus
events with a mode of NotifyGrab or NotifyUngrab. events with a mode of NotifyGrab or NotifyUngrab.
@ -129,20 +129,20 @@ Modification 1:
F=Ancestor, G=None => F=Ancestor, G=Ancestor F=Ancestor, G=None => F=Ancestor, G=Ancestor
We stop getting events, but receive no notification. We stop getting events, but receive no notification.
The case of no window manager and keyboard grabs is pretty The case of no window manager and keyboard grabs is pretty
rare in any case. rare in any case.
Modification 2: Modification 2:
When tracking has_focus_window(W), ignore all Focus When tracking has_focus_window(W), ignore all Focus
events with a mode of NotifyGrab or NotifyUngrab. events with a mode of NotifyGrab or NotifyUngrab.
Modification 3: instead of calculating focus as Modification 3: instead of calculating focus as
has_focus_window(W) || has_pointer_focus(W) has_focus_window(W) || has_pointer_focus(W)
Calculate it as Calculate it as
has_focus(W) || has_pointer_focus(W) has_focus(W) || has_pointer_focus(W)
@ -150,12 +150,12 @@ Modification 3: instead of calculating focus as
has_focus(W): F==W || F==Descendant || G=W has_focus(W): F==W || F==Descendant || G=W
Tracking has_focus(W) is done by Tracking has_focus(W) is done by
FocusIn: detail != NotifyInferior, mode != NotifyWhileGrabbed: FocusIn: detail != NotifyInferior, mode != NotifyWhileGrabbed:
set has_focus set has_focus
FocusOut: detail != NotifyInferior, mode != NotifyWhileGrabbed: FocusOut: detail != NotifyInferior, mode != NotifyWhileGrabbed:
clear has_focus clear has_focus
We still need to track has_focus_window(W) for the T4/F4 We still need to track has_focus_window(W) for the T4/F4
transitions. transitions.

View file

@ -8,16 +8,16 @@ The following files in the gdk/ subdirectory
are autogenerated: are autogenerated:
gdkkeysyms.h gdkkeysyms.h
gdkcursors.h gdkcursors.h
The following files in the gtk/ subdirectory The following files in the gtk/ subdirectory
are autogenerated: are autogenerated:
gtk.defs gtk.defs
Description of GTK+ types (and some functions) in a lisp-style Description of GTK+ types (and some functions) in a lisp-style
format. format.
gtktypebuiltins.h gtktypebuiltins.h
Header file including declarations for internal types Header file including declarations for internal types
gtktypebuiltins_vars.c gtktypebuiltins_vars.c
Variables for type values for internal types. Variables for type values for internal types.
gtktypebuiltins_ids.c gtktypebuiltins_ids.c
@ -55,7 +55,7 @@ The type definitions are generated from several sources:
GTK+ header files GTK+ header files
GDK header files GDK header files
The makeenums.pl script does a heuristic parse of The makeenums.pl script does a heuristic parse of
the header files and extracts all enumerations declarations. the header files and extracts all enumerations declarations.
It also recognizes a number of pseudo-comments in the It also recognizes a number of pseudo-comments in the
header files: header files:
@ -65,7 +65,7 @@ Two of these apply to individual enumeration values:
/*< skip >*/ /*< skip >*/
This enumeration value should be skipped. This enumeration value should be skipped.
/*< nick=NICK >*/ /*< nick=NICK >*/
The nickname for this value should NICK instead of the The nickname for this value should NICK instead of the
@ -80,7 +80,7 @@ Two of these apply to individual enumeration values:
"app" and "widget" that would normally be used. "app" and "widget" that would normally be used.
The other two apply to entire enumeration declarations. The other two apply to entire enumeration declarations.
/*< prefix=PREFIX >*/ /*< prefix=PREFIX >*/
Specifies the prefix to be removed from the enumeration Specifies the prefix to be removed from the enumeration
@ -94,20 +94,20 @@ The other two apply to entire enumeration declarations.
typedef enum /*< flags >*/ typedef enum /*< flags >*/
{ {
GDK_IM_PREEDIT_AREA = 0x0001, GDK_IM_PREEDIT_AREA = 0x0001,
GDK_IM_PREEDIT_CALLBACKS = 0x0002, GDK_IM_PREEDIT_CALLBACKS = 0x0002,
[ ... ] [ ... ]
} GdkIMStyle; } GdkIMStyle;
makeenums.pl can be run into two modes: makeenums.pl can be run into two modes:
1) Generate the gtktypebuiltins_eval.c file (this 1) Generate the gtktypebuiltins_eval.c file (this
contains arrays holding the mapping of contains arrays holding the mapping of
string <=> enumeration value) string <=> enumeration value)
2) Generate the enumeration portion of gtk.defs. 2) Generate the enumeration portion of gtk.defs.
The enumeration portion is added to the boxed type The enumeration portion is added to the boxed type
declarations in gtk-boxed.defs to create gtk.defs. declarations in gtk-boxed.defs to create gtk.defs.
The makeetypes.awk program takes the gtk.defs file, and The makeetypes.awk program takes the gtk.defs file, and
@ -130,7 +130,7 @@ by genmarshal.pl.
The format of this file is a list of lines: The format of this file is a list of lines:
<retval-type>:<arg1-type>,<arg2-type>,<arg3-type> <retval-type>:<arg1-type>,<arg2-type>,<arg3-type>
e.g.: e.g.:
BOOL:POINTER,STRING,STRING,POINTER BOOL:POINTER,STRING,STRING,POINTER

View file

@ -26,7 +26,7 @@ gtk-config takes the following flags:
--libs --libs
Prints out the linker flags necessary to link a program against GTK Prints out the linker flags necessary to link a program against GTK
--prefix[=PREFIX] --prefix[=PREFIX]
If PREFIX is specified, overrides the configured value of $prefix. If PREFIX is specified, overrides the configured value of $prefix.
(And of exec-prefix, unless --exec-prefix is also specified) (And of exec-prefix, unless --exec-prefix is also specified)
@ -35,7 +35,7 @@ gtk-config takes the following flags:
--exec-prefix[=PREFIX] --exec-prefix[=PREFIX]
If PREFIX is specified, overrides the configured value of $exec_prefix. If PREFIX is specified, overrides the configured value of $exec_prefix.
Otherwise, prints out the configured value of $exec_prefix Otherwise, prints out the configured value of $exec_prefix
You may also add to the command line a list of additional You may also add to the command line a list of additional
libraries that gtk-config should supply the CFLAGS and LIBS libraries that gtk-config should supply the CFLAGS and LIBS
for. The only currently supported library is 'gthread'. for. The only currently supported library is 'gthread'.
@ -108,17 +108,17 @@ Notes:
* The directory where the GTK libraries are installed needs * The directory where the GTK libraries are installed needs
to be found by your system's dynamic linker. to be found by your system's dynamic linker.
This is generally done by This is generally done by
editing /etc/ld.so.conf and running ldconfig editing /etc/ld.so.conf and running ldconfig
Or by: Or by:
setting the environment variable LD_LIBRARY_PATH,
or, as a last resort, setting the environment variable LD_LIBRARY_PATH,
or, as a last resort,
Giving a -R or -rpath flag (depending on your linker) when Giving a -R or -rpath flag (depending on your linker) when
running configure, for instance: running configure, for instance:
@ -135,9 +135,9 @@ Notes:
Advanced note: Advanced note:
* configure flags * configure flags
--with-gtk-prefix=PREFIX --with-gtk-prefix=PREFIX
--with-gtk-exec-prefix=PREFIX --with-gtk-exec-prefix=PREFIX
are provided to override the prefix and exec-prefix that were stored are provided to override the prefix and exec-prefix that were stored
in the gtk-config shell script by GTK's configure. You are generally in the gtk-config shell script by GTK's configure. You are generally
@ -178,7 +178,7 @@ is the AM_PATH_GTK() macro.
That command does the following: That command does the following:
If a GTK version greater than 0.99.5 is found, adds $GTK_LIBS to If a GTK version greater than 0.99.5 is found, adds $GTK_LIBS to
$LIBS and $GTK_CFLAGS to $CFLAGS. Otherwise, dies with the error $LIBS and $GTK_CFLAGS to $CFLAGS. Otherwise, dies with the error
message "Cannot find GTK: Is gtk-config in path?" message "Cannot find GTK: Is gtk-config in path?"
@ -202,7 +202,7 @@ adding the lines:
to the Makefile.am. to the Makefile.am.
To try this example out, create a new directory, add the two To try this example out, create a new directory, add the two
files above two it, and copy the testinput.c file from files above two it, and copy the testinput.c file from
the gtk/ subdirectory to the new directory. Edit the line: the gtk/ subdirectory to the new directory. Edit the line:
#include "gtk.h" #include "gtk.h"
@ -217,7 +217,7 @@ Now execute the following commands:
automake --add-missing automake --add-missing
aclocal aclocal
autoconf autoconf
You now have a package that can be built in the normal fashion You now have a package that can be built in the normal fashion
./configure ./configure

View file

@ -1,5 +1,5 @@
Information about the icon theme cache format used by GTK+ Information about the icon theme cache format used by GTK+
for more information, see the mailing list threads at for more information, see the mailing list threads at
http://mail.gnome.org/archives/gtk-devel-list/2004-April/msg00065.html http://mail.gnome.org/archives/gtk-devel-list/2004-April/msg00065.html
http://lists.freedesktop.org/archives/xdg/2004-October/005140.html http://lists.freedesktop.org/archives/xdg/2004-October/005140.html
@ -10,13 +10,13 @@ information, to reduce the amount of stating and disk seeking at
application startup, and to reduce the memory overhead if each app application startup, and to reduce the memory overhead if each app
allocates all the icon theme data separately. allocates all the icon theme data separately.
The proposal is to keep the information about the icons in the The proposal is to keep the information about the icons in the
directory tree below each icon theme directory in an mmap()able directory tree below each icon theme directory in an mmap()able
cache file (There is basically one cache file per index.theme file). cache file (There is basically one cache file per index.theme file).
The cache doesn't try to hold all information from the index.theme files The cache doesn't try to hold all information from the index.theme files
that you would need to do lookups; it turns out that with the icon theme that you would need to do lookups; it turns out that with the icon theme
specification, this isn't even sensible - you can install a specification, this isn't even sensible - you can install a
$HOME/.local/share/icons/Bluecurve/index.theme $HOME/.local/share/icons/Bluecurve/index.theme
@ -32,7 +32,7 @@ is caching of the actual image data; the file format is has an
IMAGE_DATA_OFFSET member to allow adding that compatibly. An IMAGE_DATA_OFFSET member to allow adding that compatibly. An
implementation of the caching scheme for GTK+ can be found at [2]. The implementation of the caching scheme for GTK+ can be found at [2]. The
cache generator which is included in the patch depends only on glib, and cache generator which is included in the patch depends only on glib, and
it may be a good idea to move it to freedesktop.org as well. it may be a good idea to move it to freedesktop.org as well.
Regards, Matthias Clasen Regards, Matthias Clasen
@ -41,32 +41,32 @@ Regards, Matthias Clasen
The cache file format: The cache file format:
Header: Header:
2 CARD16 MAJOR_VERSION 1 2 CARD16 MAJOR_VERSION 1
2 CARD16 MINOR_VERSION 0 2 CARD16 MINOR_VERSION 0
4 CARD32 HASH_OFFSET 4 CARD32 HASH_OFFSET
4 CARD32 DIRECTORY_LIST_OFFSET 4 CARD32 DIRECTORY_LIST_OFFSET
DirectoryList: DirectoryList:
4 CARD32 N_DIRECTORIES 4 CARD32 N_DIRECTORIES
4*N_DIRECTORIES CARD32 DIRECTORY_OFFSET 4*N_DIRECTORIES CARD32 DIRECTORY_OFFSET
Hash: Hash:
4 CARD32 N_BUCKETS 4 CARD32 N_BUCKETS
4*N_BUCKETS CARD32 ICON_OFFSET 4*N_BUCKETS CARD32 ICON_OFFSET
Icon: Icon:
4 CARD32 CHAIN_OFFSET 4 CARD32 CHAIN_OFFSET
4 CARD32 NAME_OFFSET 4 CARD32 NAME_OFFSET
4 CARD32 IMAGE_LIST_OFFSET 4 CARD32 IMAGE_LIST_OFFSET
ImageList: ImageList:
4 CARD32 N_IMAGES 4 CARD32 N_IMAGES
8*N_IMAGES Image IMAGES 8*N_IMAGES Image IMAGES
Image: Image:
2 CARD16 DIRECTORY_INDEX 2 CARD16 DIRECTORY_INDEX
2 ICON_FLAGS FLAGS 2 ICON_FLAGS FLAGS
4 CARD32 IMAGE_DATA_OFFSET 4 CARD32 IMAGE_DATA_OFFSET
ICON_FLAGS ICON_FLAGS
HAS_SUFFIX_PNG 1 HAS_SUFFIX_PNG 1
@ -111,7 +111,7 @@ DisplayNameList:
DisplayName: DisplayName:
4 CARD32 DISPLAY_LANG_OFFSET 4 CARD32 DISPLAY_LANG_OFFSET
4 CARD32 DISPLAY_NAME_OFFSET 4 CARD32 DISPLAY_NAME_OFFSET
Notes: Notes:
@ -123,7 +123,7 @@ Notes:
* All numbers are in network (big-endian) order. This is * All numbers are in network (big-endian) order. This is
necessary because the data will be stored in arch-independent necessary because the data will be stored in arch-independent
directories like /usr/share/icons or even in user's directories like /usr/share/icons or even in user's
home directories. home directories.
* The hash function is that used by g_str_hash() * The hash function is that used by g_str_hash()

View file

@ -40,7 +40,7 @@ ref_count is *always* decremented, tho. Be careful.
Remark: When writing NO_WINDOW widgets, care should be taken about Remark: When writing NO_WINDOW widgets, care should be taken about
proper referencing/unreferencing of the parent's GdkWindow proper referencing/unreferencing of the parent's GdkWindow
that is used by the widget. that is used by the widget.
GdkPixmap GdkPixmap
--------- ---------
@ -184,15 +184,15 @@ GtkOptionMenu looks like this:
option_menu = gtk_option_menu_new (); option_menu = gtk_option_menu_new ();
/* option_menu->ref_count == 1 and it is flagged as `floating'. /* option_menu->ref_count == 1 and it is flagged as `floating'.
*/ */
gtk_container_add (window, option_menu); gtk_container_add (window, option_menu);
/* option_menu->ref_count still == 1, but it is no longer `floating'. /* option_menu->ref_count still == 1, but it is no longer `floating'.
*/ */
menu = gtk_menu_new (); menu = gtk_menu_new ();
/* menu->ref_count == 1 and it is flagged as `floating'. /* menu->ref_count == 1 and it is flagged as `floating'.
*/ */
menu_item = gtk_menu_item_new_with_label ("Choose Me"); menu_item = gtk_menu_item_new_with_label ("Choose Me");
/* menu_item->ref_count == 1 and it is flagged as `floating'. /* menu_item->ref_count == 1 and it is flagged as `floating'.
*/ */
@ -200,7 +200,7 @@ GtkOptionMenu looks like this:
gtk_menu_append (GTK_MENU (menu), menu_item); gtk_menu_append (GTK_MENU (menu), menu_item);
/* menu_item->ref_count still == 1, but it is no longer `floating'. /* menu_item->ref_count still == 1, but it is no longer `floating'.
*/ */
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu); gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
/* menu->ref_count still == 1, but it is no longer `floating'. /* menu->ref_count still == 1, but it is no longer `floating'.
*/ */
@ -277,13 +277,13 @@ Example code sequences that require reference wraps:
while (slist) while (slist)
{ {
GSList *tmp; GSList *tmp;
tmp = slist; tmp = slist;
slist = slist->next; slist = slist->next;
g_object_unref (GTK_WIDGET (tmp->data)); g_object_unref (GTK_WIDGET (tmp->data));
g_slist_free_1 (tmp); g_slist_free_1 (tmp);
} }
/* Alternatively to the removal above you could just use /* Alternatively to the removal above you could just use
* gtk_list_remove_items_no_unref() which will add the additional * gtk_list_remove_items_no_unref() which will add the additional
* reference count to the widget. * reference count to the widget.

View file

@ -37,7 +37,7 @@ IGNORE_HFILES= \
# Extra files to add when scanning (relative to $srcdir) # Extra files to add when scanning (relative to $srcdir)
EXTRA_HFILES= \ EXTRA_HFILES= \
../../../gdk/x11/gdkx.h ../../../gdk/x11/gdkx.h
# CFLAGS and LDFLAGS for compiling scan program. Only needed # CFLAGS and LDFLAGS for compiling scan program. Only needed
# if $(DOC_MODULE).types is non-empty. # if $(DOC_MODULE).types is non-empty.
@ -139,7 +139,7 @@ HTML_IMAGES = \
images/umbrella.png \ images/umbrella.png \
images/ur_angle.png \ images/ur_angle.png \
images/watch.png \ images/watch.png \
images/xterm.png images/xterm.png
# Extra options to supply to gtkdoc-fixref # Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS= \ FIXXREF_OPTIONS= \

View file

@ -10,10 +10,10 @@ DOC_MODULE=gtk2
DOC_MAIN_SGML_FILE=gtk-docs.sgml DOC_MAIN_SGML_FILE=gtk-docs.sgml
# Extra options to supply to gtkdoc-scan # Extra options to supply to gtkdoc-scan
SCAN_OPTIONS=--deprecated-guards="GTK_ENABLE_BROKEN|GTK_DISABLE_DEPRECATED" SCAN_OPTIONS=--deprecated-guards="GTK_ENABLE_BROKEN|GTK_DISABLE_DEPRECATED"
# Extra options to pass to gtkdoc-scangobj # Extra options to pass to gtkdoc-scangobj
SCANGOBJ_OPTIONS=--type-init-func="gtk_type_init(0)" SCANGOBJ_OPTIONS=--type-init-func="gtk_type_init(0)"
# The directory containing the source code. Relative to $(srcdir) # The directory containing the source code. Relative to $(srcdir)
DOC_SOURCE_DIR=../../../gtk DOC_SOURCE_DIR=../../../gtk
@ -370,7 +370,7 @@ if ENABLE_MAN
man_MANS = gtk-query-immodules-2.0.1 gtk-update-icon-cache.1 gtk-builder-convert.1 man_MANS = gtk-query-immodules-2.0.1 gtk-update-icon-cache.1 gtk-builder-convert.1
%.1 : %.xml %.1 : %.xml
@XSLTPROC@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< @XSLTPROC@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
BUILT_EXTRA_DIST = $(man_MANS) BUILT_EXTRA_DIST = $(man_MANS)

View file

@ -508,7 +508,7 @@ gtk_window_expose (GtkWidget *widget,
GdkEventExpose *event) GdkEventExpose *event)
{ {
if (!gtk_widget_get_app_paintable (widget)) if (!gtk_widget_get_app_paintable (widget))
gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_NORMAL, gtk_paint_flat_box (widget->style, widget->window, GTK_STATE_NORMAL,
GTK_SHADOW_NONE, event->area, widget, "base", 0, 0, -1, -1); GTK_SHADOW_NONE, event->area, widget, "base", 0, 0, -1, -1);
if (GTK_WIDGET_CLASS (gtk_window_parent_class)->expose_event) if (GTK_WIDGET_CLASS (gtk_window_parent_class)->expose_event)

View file

@ -52,10 +52,10 @@
<glossdef> <glossdef>
<para> <para>
GTK+ contains several widgets which display data in columns, GTK+ contains several widgets which display data in columns,
e.g. the #GtkTreeView. e.g. the #GtkTreeView.
These <glossterm linkend="view-column">view columns</glossterm> in These <glossterm linkend="view-column">view columns</glossterm> in
the tree view are represented by #GtkTreeViewColumn the tree view are represented by #GtkTreeViewColumn
objects inside GTK+. They should not be confused with objects inside GTK+. They should not be confused with
<glossterm linkend="model-column">model columns</glossterm> which <glossterm linkend="model-column">model columns</glossterm> which
are used to organize the data in tree models. are used to organize the data in tree models.
</para> </para>
@ -72,10 +72,10 @@
<emphasis>parent</emphasis> of the <emphasis>child</emphasis> <emphasis>parent</emphasis> of the <emphasis>child</emphasis>
widgets. Some containers don't draw anything on their own, widgets. Some containers don't draw anything on their own,
but rather just organize their children's <glossterm but rather just organize their children's <glossterm
linkend="geometry">geometry</glossterm>; for example, #GtkVBox lays out linkend="geometry">geometry</glossterm>; for example, #GtkVBox lays out
its children vertically without painting anything on its own. Other its children vertically without painting anything on its own. Other
containers include decorative elements; for example, #GtkFrame contains containers include decorative elements; for example, #GtkFrame contains
the frame's child and a label in addition to the shaded frame it draws. the frame's child and a label in addition to the shaded frame it draws.
The base class for containers is #GtkContainer. The base class for containers is #GtkContainer.
</para> </para>
<glossseealso> <glossseealso>
@ -91,8 +91,8 @@
<para> <para>
GDK inherited the concept of display from the X window system, GDK inherited the concept of display from the X window system,
which considers a display to be the combination which considers a display to be the combination
of a keyboard, a pointing device and one or more of a keyboard, a pointing device and one or more
<glossterm linkend="screen">screens</glossterm>. <glossterm linkend="screen">screens</glossterm>.
Applications open a display to show windows and interact with the user. Applications open a display to show windows and interact with the user.
In GDK, a display is represented by a #GdkDisplay. In GDK, a display is represented by a #GdkDisplay.
</para> </para>
@ -115,7 +115,7 @@
<glossdef> <glossdef>
<para> <para>
Events are the way in which GDK informs GTK+ about external events Events are the way in which GDK informs GTK+ about external events
like pointer motion, button clicks, key presses, etc. like pointer motion, button clicks, key presses, etc.
</para> </para>
</glossdef> </glossdef>
</glossentry> </glossentry>
@ -160,9 +160,9 @@
<glossterm>model column</glossterm> <glossterm>model column</glossterm>
<glossdef> <glossdef>
<para> <para>
A column in a tree model, holding data of a certain type. A column in a tree model, holding data of a certain type.
The types which can be stored in the columns of a model The types which can be stored in the columns of a model
have to be specified when the model is constructed, see have to be specified when the model is constructed, see
e.g. gtk_list_store_new(). e.g. gtk_list_store_new().
</para> </para>
<glossseealso> <glossseealso>
@ -176,14 +176,14 @@
<glossdef> <glossdef>
<para> <para>
These widgets follow the well-known model-view pattern, which separates These widgets follow the well-known model-view pattern, which separates
the data (the model) to be displayed from the component which does the the data (the model) to be displayed from the component which does the
actual visualization (the view). Examples of this pattern in GTK+ are actual visualization (the view). Examples of this pattern in GTK+ are
the #GtkTreeView/#GtkTreeModel and #GtkTextView/#GtkTextBuffer the #GtkTreeView/#GtkTreeModel and #GtkTextView/#GtkTextBuffer
</para> </para>
<para> <para>
One important advantage of this pattern is that it is possible to One important advantage of this pattern is that it is possible to
display the same model in multiple views; another one that the display the same model in multiple views; another one that the
separation of the model allows a great deal of flexibility, as separation of the model allows a great deal of flexibility, as
demonstrated by e.g. #GtkTreeModelSort or #GtkTreeModelFilter. demonstrated by e.g. #GtkTreeModelSort or #GtkTreeModelFilter.
</para> </para>
</glossdef> </glossdef>
@ -231,8 +231,8 @@
<para> <para>
Widgets that don't own the GdkWindow on which they draw are Widgets that don't own the GdkWindow on which they draw are
called <glossterm linkend="no-window">no-window widgets</glossterm>. called <glossterm linkend="no-window">no-window widgets</glossterm>.
This can be tested with the GTK_WIDGET_NO_WINDOW() macro. Normally, This can be tested with the GTK_WIDGET_NO_WINDOW() macro. Normally,
these widgets draw on their parent's GdkWindow. these widgets draw on their parent's GdkWindow.
</para> </para>
@ -268,9 +268,9 @@
<glossterm>screen</glossterm> <glossterm>screen</glossterm>
<glossdef> <glossdef>
<para> <para>
GDK inherited the concept of screen from the X window system, GDK inherited the concept of screen from the X window system,
which considers a screen to be a rectangular area, on which which considers a screen to be a rectangular area, on which
applications may place their windows. Screens under X may have applications may place their windows. Screens under X may have
quite dissimilar <glossterm linkend="visual">visuals</glossterm>. quite dissimilar <glossterm linkend="visual">visuals</glossterm>.
Each screen can stretch across multiple physical monitors. Each screen can stretch across multiple physical monitors.
</para> </para>
@ -285,7 +285,7 @@
<glossdef> <glossdef>
<para> <para>
A style encapsulates what GTK+ needs to know in order to draw A style encapsulates what GTK+ needs to know in order to draw
a widget. Styles can be modified with a widget. Styles can be modified with
<link linkend="gtk-Resource-Files">resource files</link>. <link linkend="gtk-Resource-Files">resource files</link>.
</para> </para>
</glossdef> </glossdef>
@ -296,7 +296,7 @@
<glossdef> <glossdef>
<para> <para>
A <glossterm linkend="widget">widget</glossterm> that does not A <glossterm linkend="widget">widget</glossterm> that does not
require a <glossterm linkend="parent">parent</glossterm> container. require a <glossterm linkend="parent">parent</glossterm> container.
The only toplevel widgets in GTK+ are #GtkWindow and widgets derived from it. The only toplevel widgets in GTK+ are #GtkWindow and widgets derived from it.
</para> </para>
<glossseealso> <glossseealso>
@ -327,7 +327,7 @@
</glossseealso> </glossseealso>
</glossdef> </glossdef>
</glossentry> </glossentry>
<glossentry id="visual"> <glossentry id="visual">
<glossterm>visual</glossterm> <glossterm>visual</glossterm>
<glossdef> <glossdef>
@ -335,17 +335,17 @@
A visual describes how color information is stored in pixels. A visual describes how color information is stored in pixels.
A <glossterm linkend="screen">screen</glossterm> may support A <glossterm linkend="screen">screen</glossterm> may support
multiple visuals. On modern hardware, the most common visuals multiple visuals. On modern hardware, the most common visuals
are truecolor visuals, which store a fixed number of bits are truecolor visuals, which store a fixed number of bits
(typically 8) for the red, green and blue components of a color. (typically 8) for the red, green and blue components of a color.
</para> </para>
<para> <para>
On ancient hardware, one may still meet indexed visuals, which On ancient hardware, one may still meet indexed visuals, which
store color information as an index into a color map, or even store color information as an index into a color map, or even
monochrome visuals. monochrome visuals.
</para> </para>
</glossdef> </glossdef>
</glossentry> </glossentry>
<glossentry id="widget"> <glossentry id="widget">
<glossterm>widget</glossterm> <glossterm>widget</glossterm>
<glossdef> <glossdef>

View file

@ -51,7 +51,7 @@ its output the file specified as the second argument.
<varlistentry> <varlistentry>
<term>--root</term> <term>--root</term>
<term>-r</term> <term>-r</term>
<listitem><para>Convert only the widget named <replaceable>name</replaceable> <listitem><para>Convert only the widget named <replaceable>name</replaceable>
and its children.</para></listitem> and its children.</para></listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>

View file

@ -29,8 +29,8 @@ input method modules for GTK+ and writes it to the default cache file
location, or to <filename>stdout</filename>. location, or to <filename>stdout</filename>.
</para> </para>
<para> <para>
If called without arguments, it looks for modules in the GTK+ input method If called without arguments, it looks for modules in the GTK+ input method
module path. module path.
</para> </para>
<para> <para>
If called with arguments, it looks for the specified modules. The arguments If called with arguments, it looks for the specified modules. The arguments
@ -56,8 +56,8 @@ can be set to point GTK+ at the file.
<refsect1><title>Environment</title> <refsect1><title>Environment</title>
<para> <para>
The environment variable <link linkend="GTK_PATH"><envar>GTK_PATH</envar></link> can The environment variable <link linkend="GTK_PATH"><envar>GTK_PATH</envar></link> can
be used to prepend directories to the input method module path. be used to prepend directories to the input method module path.
</para> </para>
</refsect1> </refsect1>

View file

@ -32,11 +32,11 @@
<refsect1><title>Description</title> <refsect1><title>Description</title>
<para><command>gtk-update-icon-cache</command> creates mmap()able cache files for <para><command>gtk-update-icon-cache</command> creates mmap()able cache files for
icon themes. icon themes.
</para> </para>
<para> <para>
It expects to be given the path to a icon theme directory containing an It expects to be given the path to a icon theme directory containing an
<filename>index.theme</filename>, e.g. <filename>/usr/share/icons/hicolor</filename>, <filename>index.theme</filename>, e.g. <filename>/usr/share/icons/hicolor</filename>,
and writes a <filename>icon-theme.cache</filename> containing cached information and writes a <filename>icon-theme.cache</filename> containing cached information
about the icons in the directory tree below the given directory. about the icons in the directory tree below the given directory.
</para> </para>
@ -53,7 +53,7 @@ multiple applications, the overall memory consumption is reduced as well.
<varlistentry> <varlistentry>
<term>--force</term> <term>--force</term>
<term>-f</term> <term>-f</term>
<listitem><para>Overwrite an existing cache file even if it appears to be <listitem><para>Overwrite an existing cache file even if it appears to be
uptodate.</para></listitem> uptodate.</para></listitem>
</varlistentry> </varlistentry>
@ -63,7 +63,7 @@ multiple applications, the overall memory consumption is reduced as well.
<listitem><para>Don't check for the existence of 'index.theme' in the icon theme <listitem><para>Don't check for the existence of 'index.theme' in the icon theme
directory. Without this option, <command>gtk-update-icon-cache</command> refuses directory. Without this option, <command>gtk-update-icon-cache</command> refuses
to create an icon cache in a directory which does not appear to be the toplevel to create an icon cache in a directory which does not appear to be the toplevel
directory of an icon theme. directory of an icon theme.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>
@ -83,15 +83,15 @@ multiple applications, the overall memory consumption is reduced as well.
<varlistentry> <varlistentry>
<term>--source</term> <term>--source</term>
<term>-c</term> <term>-c</term>
<listitem><para>Output a C header file declaring a constant <listitem><para>Output a C header file declaring a constant
<replaceable>name</replaceable> with the contents of the icon <replaceable>name</replaceable> with the contents of the icon
cache.</para></listitem> cache.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>--quiet</term> <term>--quiet</term>
<term>-q</term> <term>-q</term>
<listitem><para>Turn off verbose output. <listitem><para>Turn off verbose output.
</para></listitem> </para></listitem>
</varlistentry> </varlistentry>

View file

@ -270,10 +270,10 @@ gtk_action_group_add_action_with_accel
gtk_action_group_remove_action gtk_action_group_remove_action
GtkActionEntry GtkActionEntry
gtk_action_group_add_actions gtk_action_group_add_actions
gtk_action_group_add_actions_full gtk_action_group_add_actions_full
GtkToggleActionEntry GtkToggleActionEntry
gtk_action_group_add_toggle_actions gtk_action_group_add_toggle_actions
gtk_action_group_add_toggle_actions_full gtk_action_group_add_toggle_actions_full
GtkRadioActionEntry GtkRadioActionEntry
gtk_action_group_add_radio_actions gtk_action_group_add_radio_actions
gtk_action_group_add_radio_actions_full gtk_action_group_add_radio_actions_full
@ -1358,7 +1358,7 @@ gtk_entry_set_icon_from_icon_name
gtk_entry_set_icon_from_gicon gtk_entry_set_icon_from_gicon
gtk_entry_get_icon_storage_type gtk_entry_get_icon_storage_type
gtk_entry_get_icon_pixbuf gtk_entry_get_icon_pixbuf
gtk_entry_get_icon_stock gtk_entry_get_icon_stock
gtk_entry_get_icon_name gtk_entry_get_icon_name
gtk_entry_get_icon_gicon gtk_entry_get_icon_gicon
gtk_entry_set_icon_activatable gtk_entry_set_icon_activatable
@ -2045,7 +2045,7 @@ gtk_icon_view_unset_model_drag_source
gtk_icon_view_unset_model_drag_dest gtk_icon_view_unset_model_drag_dest
gtk_icon_view_set_reorderable gtk_icon_view_set_reorderable
gtk_icon_view_get_reorderable gtk_icon_view_get_reorderable
gtk_icon_view_set_drag_dest_item gtk_icon_view_set_drag_dest_item
gtk_icon_view_get_drag_dest_item gtk_icon_view_get_drag_dest_item
gtk_icon_view_get_dest_item_at_pos gtk_icon_view_get_dest_item_at_pos
gtk_icon_view_create_drag_icon gtk_icon_view_create_drag_icon
@ -2571,8 +2571,8 @@ gtk_menu_item_set_use_underline
gtk_menu_item_set_submenu gtk_menu_item_set_submenu
gtk_menu_item_get_submenu gtk_menu_item_get_submenu
gtk_menu_item_remove_submenu gtk_menu_item_remove_submenu
gtk_menu_item_set_accel_path gtk_menu_item_set_accel_path
gtk_menu_item_get_accel_path gtk_menu_item_get_accel_path
gtk_menu_item_select gtk_menu_item_select
gtk_menu_item_deselect gtk_menu_item_deselect
gtk_menu_item_activate gtk_menu_item_activate
@ -6854,7 +6854,7 @@ gtk_print_operation_get_n_pages_to_print
gtk_print_operation_set_current_page gtk_print_operation_set_current_page
gtk_print_operation_set_use_full_page gtk_print_operation_set_use_full_page
gtk_print_operation_set_unit gtk_print_operation_set_unit
gtk_print_operation_set_export_filename gtk_print_operation_set_export_filename
gtk_print_operation_set_show_progress gtk_print_operation_set_show_progress
gtk_print_operation_set_track_print_status gtk_print_operation_set_track_print_status
gtk_print_operation_set_custom_tab_label gtk_print_operation_set_custom_tab_label
@ -6981,7 +6981,7 @@ GTK_PRINTER_GET_CLASS
<SUBSECTION Private> <SUBSECTION Private>
GtkPrinterPrivate GtkPrinterPrivate
gtk_printer_get_type gtk_printer_get_type
</SECTION> </SECTION>

View file

@ -5,7 +5,7 @@
<para role="gallery"> <para role="gallery">
<link linkend="GtkAccelLabel"> <link linkend="GtkAccelLabel">
<inlinegraphic fileref="accel-label.png" format="PNG"></inlinegraphic> <inlinegraphic fileref="accel-label.png" format="PNG"></inlinegraphic>
</link> </link>
<link linkend="GtkButton"> <link linkend="GtkButton">
<inlinegraphic fileref="button.png" format="PNG"></inlinegraphic> <inlinegraphic fileref="button.png" format="PNG"></inlinegraphic>
</link> </link>
@ -56,16 +56,16 @@
</link> </link>
<link linkend="GtkPaned"> <link linkend="GtkPaned">
<inlinegraphic fileref="panes.png" format="PNG"></inlinegraphic> <inlinegraphic fileref="panes.png" format="PNG"></inlinegraphic>
</link> </link>
<link linkend="GtkVolumeButton"> <link linkend="GtkVolumeButton">
<inlinegraphic fileref="volumebutton.png" format="PNG"></inlinegraphic> <inlinegraphic fileref="volumebutton.png" format="PNG"></inlinegraphic>
</link> </link>
<link linkend="GtkPageSetupUnixDialog"> <link linkend="GtkPageSetupUnixDialog">
<inlinegraphic fileref="pagesetupdialog.png" format="PNG"></inlinegraphic> <inlinegraphic fileref="pagesetupdialog.png" format="PNG"></inlinegraphic>
</link> </link>
<link linkend="GtkPrintUnixDialog"> <link linkend="GtkPrintUnixDialog">
<inlinegraphic fileref="printdialog.png" format="PNG"></inlinegraphic> <inlinegraphic fileref="printdialog.png" format="PNG"></inlinegraphic>
</link> </link>
<link linkend="GtkProgressBar"> <link linkend="GtkProgressBar">
<inlinegraphic fileref="progressbar.png" format="PNG"></inlinegraphic> <inlinegraphic fileref="progressbar.png" format="PNG"></inlinegraphic>
</link> </link>
@ -101,7 +101,7 @@
</link> </link>
<link linkend="GtkToolPalette"> <link linkend="GtkToolPalette">
<inlinegraphic fileref="toolpalette.png" format="PNG"></inlinegraphic> <inlinegraphic fileref="toolpalette.png" format="PNG"></inlinegraphic>
</link> </link>
<link linkend="GtkTreeView"> <link linkend="GtkTreeView">
<inlinegraphic fileref="list-and-tree.png" format="PNG"></inlinegraphic> <inlinegraphic fileref="list-and-tree.png" format="PNG"></inlinegraphic>
</link> </link>

View file

@ -3,25 +3,25 @@ This is a list of things to check when testing window size/pos functions.
gtk_widget_set_size_request(): gtk_widget_set_size_request():
- causes the widget to request the given size - causes the widget to request the given size
- for toplevel windows, changes the default-requested size if - for toplevel windows, changes the default-requested size if
no default size is set and gtk_window_resize() has not been called no default size is set and gtk_window_resize() has not been called
- passing -1 for either width or height reverts to "natural" request - passing -1 for either width or height reverts to "natural" request
in that dimension in that dimension
- passing 0 is allowed, and results in requisition of 1x1 - passing 0 is allowed, and results in requisition of 1x1
(0x0 is a permitted requisition, but equivalent to 1x1, (0x0 is a permitted requisition, but equivalent to 1x1,
we use 1x1 for implementation convenience) we use 1x1 for implementation convenience)
- causes notifies on width_request, height_request properties - causes notifies on width_request, height_request properties
gtk_window_resize(): gtk_window_resize():
- causes a configure request in all cases if the window is mapped, - causes a configure request in all cases if the window is mapped,
unless the new size is the same as the old size unless the new size is the same as the old size
- overrides the default size on map if the window is unmapped - overrides the default size on map if the window is unmapped
- allows size of 0, equivalent to 1 - allows size of 0, equivalent to 1
- clamped to geometry hints - clamped to geometry hints
gtk_window_set_default_size(): gtk_window_set_default_size():
- has no effect after the window has been mapped the first time, - has no effect after the window has been mapped the first time,
unless the window has been unrealized in which case it should unless the window has been unrealized in which case it should
have an effect have an effect
- allows size of 0, equivalent to 1 - allows size of 0, equivalent to 1
- allows size of -1 to unset the default size - allows size of -1 to unset the default size
@ -30,28 +30,28 @@ gtk_window_set_default_size():
- causes notifies on default_width, default_height properties - causes notifies on default_width, default_height properties
gtk_window_get_default_size(): gtk_window_get_default_size():
- returns the values last passed to set_default_size(), including - returns the values last passed to set_default_size(), including
-1. If set_default_size() has not been called, returns -1. -1. If set_default_size() has not been called, returns -1.
gtk_window_move(): gtk_window_move():
- always causes a configure request if the window is mapped, - always causes a configure request if the window is mapped,
unless the last configure request we sent was for the same unless the last configure request we sent was for the same
position being moved to position being moved to
- position may be negative to move windows offscreen - position may be negative to move windows offscreen
- if GTK_WIN_POS_CENTER_ALWAYS (or other future position - if GTK_WIN_POS_CENTER_ALWAYS (or other future position
constraints we may add) is in effect, the move constraints we may add) is in effect, the move
request is clamped to obey the constraints. thus request is clamped to obey the constraints. thus
calling gtk_window_move() on a CENTER_ALWAYS window calling gtk_window_move() on a CENTER_ALWAYS window
may trigger the window to bounce back to center if it may trigger the window to bounce back to center if it
wasn't there wasn't there
- overrides all GTK_WIN_POS_ except CENTER_ALWAYS - overrides all GTK_WIN_POS_ except CENTER_ALWAYS
gtk_window_get_size(): gtk_window_get_size():
- obtains the client-side known size of widget->window, - obtains the client-side known size of widget->window,
as last received from a configure event as last received from a configure event
- prior to mapping, returns the default size we will request - prior to mapping, returns the default size we will request
- between realization and mapping, computes default size - between realization and mapping, computes default size
rather than looking at widget->window up-to-date size, rather than looking at widget->window up-to-date size,
so the size will be correct after force-realizing a window so the size will be correct after force-realizing a window
gtk_window_get_position(): gtk_window_get_position():
@ -60,16 +60,16 @@ gtk_window_get_position():
- round-trips to the server to get the position; this is suboptimal - round-trips to the server to get the position; this is suboptimal
from both a race condition and speed standpoint but required to get from both a race condition and speed standpoint but required to get
window frame size window frame size
- if the window is unmapped, returns the default position we will - if the window is unmapped, returns the default position we will
request request
gtk_window_set_position(): gtk_window_set_position():
- not the inverse of get_position(), sadly - not the inverse of get_position(), sadly
- modifies the default positioning of the window - modifies the default positioning of the window
- if set to CENTER_ALWAYS and the window is mapped, results in a - if set to CENTER_ALWAYS and the window is mapped, results in a
configure request moving the window to the center, unless the configure request moving the window to the center, unless the
window was already centered window was already centered
- ignored if gtk_window_move() called, with the exception - ignored if gtk_window_move() called, with the exception
of CENTER_ALWAYS of CENTER_ALWAYS
gtk_window_parse_geometry(): gtk_window_parse_geometry():
@ -81,8 +81,8 @@ gtk_window_parse_geometry():
- calls gtk_window_set_gravity() to set the window gravity - calls gtk_window_set_gravity() to set the window gravity
gtk_window_reshow_with_initial_size(): gtk_window_reshow_with_initial_size():
- for use by GUI builders; unrealizes and re-shows the window, - for use by GUI builders; unrealizes and re-shows the window,
using default size (and also position, but position using default size (and also position, but position
is reset on any hide anyway) is reset on any hide anyway)
- window should be positioned and sized as it was on initial map, - window should be positioned and sized as it was on initial map,
barring odd window managers barring odd window managers
@ -94,22 +94,22 @@ gtk_window_set_geometry_hints():
General behavior General behavior
=== ===
- no infinite loops or nasty fighting-the-user flicker during - no infinite loops or nasty fighting-the-user flicker during
operations such as moving/resizing a window operations such as moving/resizing a window
Properties Properties
=== ===
GtkWindow::default_width, GtkWindow::default_height: GtkWindow::default_width, GtkWindow::default_height:
- default_width is -1 if unset, or >= 0 if - default_width is -1 if unset, or >= 0 if
a default width is set a default width is set
- default_height is -1 if unset, or >= 0 if - default_height is -1 if unset, or >= 0 if
a default height is set a default height is set
GtkWindow::allow_grow, GtkWindow::resizable: GtkWindow::allow_grow, GtkWindow::resizable:
- equivalent properties; changing one notifies on the other - equivalent properties; changing one notifies on the other
- if FALSE, we set the min size to the max size in the geometry - if FALSE, we set the min size to the max size in the geometry
hints. hints.
- If the app programmer has called gtk_window_set_geometry_hints() - If the app programmer has called gtk_window_set_geometry_hints()
however and set min or max size, we don't replace the hint they however and set min or max size, we don't replace the hint they
set. set.

View file

@ -82,7 +82,7 @@ GtkWidget::style_set
style->bg. (e.g., GtkListItem) style->bg. (e.g., GtkListItem)
- the widget provides windows other than widget->window. - the widget provides windows other than widget->window.
- the widget has any other stored dependencies on the style. - the widget has any other stored dependencies on the style.
Flag indications: Flag indications:

View file

@ -7,8 +7,8 @@ Subject: [gtk-list] gtktext widget internal documentation
Pete convinced me to just write up the text widget and let someone else Pete convinced me to just write up the text widget and let someone else
finish it. I'm pretty busy and have other commitments now. Sorry. I think finish it. I'm pretty busy and have other commitments now. Sorry. I think
I'm not the most qualified for some of the remaining work anyway, because I I'm not the most qualified for some of the remaining work anyway, because I
don't really know Gtk and it's event model very well. Most of the work so don't really know Gtk and it's event model very well. Most of the work so
far was possible without knowing Gtk all that well, it was simply a data far was possible without knowing Gtk all that well, it was simply a data
structure exercise (though after reading this you might say it was a fairly structure exercise (though after reading this you might say it was a fairly
complicated data structure exercise). I'm happy to answer questions. complicated data structure exercise). I'm happy to answer questions.
@ -166,7 +166,7 @@ often, the last index is treated as a newline.
length 1 unless there are no other characters in the text. That length 1 unless there are no other characters in the text. That
is, its properties are always that of the preceding character, is, its properties are always that of the preceding character,
if any. if any.
There is a fair bit of special case code to maintain this condition - There is a fair bit of special case code to maintain this condition -
which is needed so that user has control over the properties of which is needed so that user has control over the properties of
characters inserted at the last position. OWT 2/9/98 ] characters inserted at the last position. OWT 2/9/98 ]

View file

@ -32,7 +32,7 @@ the paragraph break char may be more than one byte.)
The idea of the btree is something like: The idea of the btree is something like:
------ Node (lines = 6) ------ Node (lines = 6)
/ Line 0 / Line 0
/ Line 1 / Line 1
@ -40,7 +40,7 @@ The idea of the btree is something like:
/ Line 3 / Line 3
/ Line 4 / Line 4
/ Line 5 / Line 5
Node (lines = 12) Node (lines = 12)
\ \
\---------- Node (lines = 6) \---------- Node (lines = 6)
Line 6 Line 6
@ -49,7 +49,7 @@ The idea of the btree is something like:
Line 9 Line 9
Line 10 Line 10
Line 11 Line 11
In addition to keeping aggregate line counts at each node, we count In addition to keeping aggregate line counts at each node, we count
characters, and information about the tag toggles appearing below each characters, and information about the tag toggles appearing below each
@ -59,16 +59,16 @@ Structure of a GtkTextLine
=== ===
A GtkTextLine contains a single paragraph of text. It should probably A GtkTextLine contains a single paragraph of text. It should probably
be renamed GtkTextPara someday but ah well. GtkTextLine is used for be renamed GtkTextPara someday but ah well. GtkTextLine is used for
the leaf nodes of the BTree. the leaf nodes of the BTree.
A line is a list of GtkTextLineSegment. Line segments contain the A line is a list of GtkTextLineSegment. Line segments contain the
actual data found in the text buffer. actual data found in the text buffer.
Here are the types of line segment (see gtktextsegment.h, Here are the types of line segment (see gtktextsegment.h,
gtktextchild.h, etc.): gtktextchild.h, etc.):
Character: contains a block of UTF-8 text. Character: contains a block of UTF-8 text.
Mark: marks a position in the buffer, such as a cursor. Mark: marks a position in the buffer, such as a cursor.
@ -78,13 +78,13 @@ gtktextchild.h, etc.):
range, and a toggle off at the end. (and do any range, and a toggle off at the end. (and do any
necessary merging with existing toggles, so we necessary merging with existing toggles, so we
always have the minimum number possible) always have the minimum number possible)
Child widget: stores a child widget that behaves as a single Child widget: stores a child widget that behaves as a single
Unicode character from an editing perspective. Unicode character from an editing perspective.
(well, stores a list of child widgets, one per (well, stores a list of child widgets, one per
GtkTextView displaying the buffer) GtkTextView displaying the buffer)
Image: stores a GdkPixbuf that behaves as a single Image: stores a GdkPixbuf that behaves as a single
character from an editing perspective. character from an editing perspective.
@ -96,40 +96,40 @@ The functions in the class are:
- DeleteFunc, finalizes the segment - DeleteFunc, finalizes the segment
- CleanupFunc, after modifying a line by adding/removing segments, - CleanupFunc, after modifying a line by adding/removing segments,
this function is used to try merging segments that can be merged, this function is used to try merging segments that can be merged,
e.g. two adjacent character segments with no marks or toggles e.g. two adjacent character segments with no marks or toggles
in between. in between.
- LineChangeFunc, called when a segment moves to a different line; - LineChangeFunc, called when a segment moves to a different line;
according to comments in the code this function may not be needed according to comments in the code this function may not be needed
anymore. anymore.
- SegCheckFunc, does sanity-checking when debugging is enabled. - SegCheckFunc, does sanity-checking when debugging is enabled.
Basically equivalent to assert(segment is not broken). Basically equivalent to assert(segment is not broken).
The segment class also contains two data fields: The segment class also contains two data fields:
- the name of the segment type, used for debugging - the name of the segment type, used for debugging
- a boolean flag for whether the segment has right or left - a boolean flag for whether the segment has right or left
gravity. A segment with right gravity ends up on the right of a gravity. A segment with right gravity ends up on the right of a
newly-inserted segment that's placed at the same character offset, newly-inserted segment that's placed at the same character offset,
and a segment with left gravity ends up on the left of a and a segment with left gravity ends up on the left of a
newly-inserted segment. For example the insertion cursor newly-inserted segment. For example the insertion cursor
has right gravity, because as you type new text is inserted, has right gravity, because as you type new text is inserted,
and the cursor ends up on the right. and the cursor ends up on the right.
The segment itself contains contains a header, plus some The segment itself contains contains a header, plus some
variable-length data that depends on the type of the segment. variable-length data that depends on the type of the segment.
The header contains the length of the segment in characters and in The header contains the length of the segment in characters and in
bytes. Some segments have a length of zero. Segments with nonzero bytes. Some segments have a length of zero. Segments with nonzero
length are referred to as "indexable" and would generally be length are referred to as "indexable" and would generally be
user-visible; indexable segments include text, images, and widgets. user-visible; indexable segments include text, images, and widgets.
Segments with zero length occupy positions between characters, and Segments with zero length occupy positions between characters, and
include marks and tag toggles. include marks and tag toggles.
The GtkText*Body structs are the type-specific portions of The GtkText*Body structs are the type-specific portions of
GtkTextSegment. GtkTextSegment.
Character segments have the actual character data allocated in the Character segments have the actual character data allocated in the
@ -174,14 +174,14 @@ there was some idea that a view could be any object, so there are some
that all views had to be a GtkTextLayout and so the btree does assume that all views had to be a GtkTextLayout and so the btree does assume
that from time to time. that from time to time.
The BTree maintains some per-line and per-node data that is specific The BTree maintains some per-line and per-node data that is specific
to each view. The per-line data is in GtkTextLineData and the per-node to each view. The per-line data is in GtkTextLineData and the per-node
data is in another badly-named struct called NodeData (should be data is in another badly-named struct called NodeData (should be
PerViewNodeData or something). The purpose of these is to store: PerViewNodeData or something). The purpose of these is to store:
- aggregate height, so we can calculate the Y position of each - aggregate height, so we can calculate the Y position of each
paragraph in O(log N) time, and can get the full height paragraph in O(log N) time, and can get the full height
of the buffer in O(1) time. The height is per-view since of the buffer in O(1) time. The height is per-view since
each GtkTextView may have a different size allocation. each GtkTextView may have a different size allocation.
- maximum width (the longest line), so we can calculate the width of - maximum width (the longest line), so we can calculate the width of
@ -216,13 +216,13 @@ chars_changed_stamp different from the current stamp of the BTree.
That is, you can't use an iterator after adding/removing characters. That is, you can't use an iterator after adding/removing characters.
The "segments_changed_stamp" is incremented any time we change any The "segments_changed_stamp" is incremented any time we change any
segments, and tells outstanding iterators that any pointers to segments, and tells outstanding iterators that any pointers to
GtkTextSegment that they may be holding are now invalid. For example, GtkTextSegment that they may be holding are now invalid. For example,
if you are iterating over a character segment, and insert a mark in if you are iterating over a character segment, and insert a mark in
the middle of the segment, the character segment will be split in half the middle of the segment, the character segment will be split in half
and the original segment will be freed. This increments and the original segment will be freed. This increments
segments_changed_stamp, causing your iterator to drop its current segments_changed_stamp, causing your iterator to drop its current
segment pointer and count from the beginning of the line again to find segment pointer and count from the beginning of the line again to find
the new segment. the new segment.
Iterators also cache some random information such as the current line Iterators also cache some random information such as the current line
@ -242,28 +242,28 @@ width and height) by converting the lines to a PangoLayout and using
Pango functions. GtkTextLayout is also used for visual iteration, and Pango functions. GtkTextLayout is also used for visual iteration, and
mapping visual locations to logical buffer positions. mapping visual locations to logical buffer positions.
Validating a line involves creating the GtkTextLineDisplay for that Validating a line involves creating the GtkTextLineDisplay for that
line. To save memory, GtkTextLineDisplay objects are always created line. To save memory, GtkTextLineDisplay objects are always created
transiently, we don't keep them around. transiently, we don't keep them around.
The layout has three signals: The layout has three signals:
- "invalidated" means some line was changed, so GtkTextView - "invalidated" means some line was changed, so GtkTextView
needs to install idle handlers to revalidate. needs to install idle handlers to revalidate.
- "changed" means some lines were validated, so the aggregate - "changed" means some lines were validated, so the aggregate
width/height of the BTree is now different. width/height of the BTree is now different.
- "allocate_child" means we need to size allocate a - "allocate_child" means we need to size allocate a
child widget child widget
gtk_text_layout_get_line_display() is sort of the "heart" of gtk_text_layout_get_line_display() is sort of the "heart" of
GtkTextLayout. This function validates a line. GtkTextLayout. This function validates a line.
Line validation involves: Line validation involves:
- convert any GtkTextTag on the line to PangoAttrList - convert any GtkTextTag on the line to PangoAttrList
- add the preedit string - add the preedit string
- keep track of "visible marks" (the cursor) - keep track of "visible marks" (the cursor)
@ -271,7 +271,7 @@ Line validation involves:
A given set of tags is composited to a GtkTextAttributes. (In the Tk A given set of tags is composited to a GtkTextAttributes. (In the Tk
code this was called a "style" and there are still relics of this in code this was called a "style" and there are still relics of this in
the code, such as "invalidate_cached_style()", that should be cleaned the code, such as "invalidate_cached_style()", that should be cleaned
up.) up.)
There's a single-GtkTextAttributes cache, "layout->one_style_cache", There's a single-GtkTextAttributes cache, "layout->one_style_cache",
which is used to avoid recomputing the mapping from tags to attributes which is used to avoid recomputing the mapping from tags to attributes
@ -282,8 +282,8 @@ may change the current style (such as a tag toggle), the cache has to
be dropped. be dropped.
To compute a GtkTextAttributes from the GtkTextTag that apply to a To compute a GtkTextAttributes from the GtkTextTag that apply to a
given segment, the function is _gtk_text_attributes_fill_from_tags(). given segment, the function is _gtk_text_attributes_fill_from_tags().
This "mashes" a list of tags into a single set of text attributes. This "mashes" a list of tags into a single set of text attributes.
If no tags affect a given attribute, a default set of attributes are If no tags affect a given attribute, a default set of attributes are
used. These defaults sometimes come from widget->style on the used. These defaults sometimes come from widget->style on the
GtkTextView, and sometimes come from a property of the GtkTextView GtkTextView, and sometimes come from a property of the GtkTextView
@ -292,7 +292,7 @@ such as "pixels_above_lines"
GtkTextView GtkTextView
=== ===
Once you get GtkTextLayout and GtkTextBTree the actual GtkTextView Once you get GtkTextLayout and GtkTextBTree the actual GtkTextView
widget is not that complicated. widget is not that complicated.
The main complexity is the interaction between scrolling and line The main complexity is the interaction between scrolling and line

View file

@ -27,13 +27,13 @@ create_blur_filter (int radius)
ConvFilter *filter; ConvFilter *filter;
int x, y; int x, y;
double sum; double sum;
filter = g_new0 (ConvFilter, 1); filter = g_new0 (ConvFilter, 1);
filter->size = radius * 2 + 1; filter->size = radius * 2 + 1;
filter->data = g_new (double, filter->size * filter->size); filter->data = g_new (double, filter->size * filter->size);
sum = 0.0; sum = 0.0;
for (y = 0 ; y < filter->size; y++) for (y = 0 ; y < filter->size; y++)
{ {
for (x = 0 ; x < filter->size; x++) for (x = 0 ; x < filter->size; x++)
@ -53,7 +53,7 @@ create_blur_filter (int radius)
} }
return filter; return filter;
} }
static GdkPixbuf * static GdkPixbuf *
@ -65,12 +65,12 @@ create_shadow (GdkPixbuf *src)
static ConvFilter *filter = NULL; static ConvFilter *filter = NULL;
int src_rowstride, dest_rowstride; int src_rowstride, dest_rowstride;
int src_bpp, dest_bpp; int src_bpp, dest_bpp;
guchar *src_pixels, *dest_pixels; guchar *src_pixels, *dest_pixels;
if (!filter) if (!filter)
filter = create_blur_filter (BLUR_RADIUS); filter = create_blur_filter (BLUR_RADIUS);
width = gdk_pixbuf_get_width (src) + BLUR_RADIUS * 2 + SHADOW_OFFSET; width = gdk_pixbuf_get_width (src) + BLUR_RADIUS * 2 + SHADOW_OFFSET;
height = gdk_pixbuf_get_height (src) + BLUR_RADIUS * 2 + SHADOW_OFFSET; height = gdk_pixbuf_get_height (src) + BLUR_RADIUS * 2 + SHADOW_OFFSET;
@ -78,15 +78,15 @@ create_shadow (GdkPixbuf *src)
gdk_pixbuf_get_has_alpha (src), gdk_pixbuf_get_has_alpha (src),
gdk_pixbuf_get_bits_per_sample (src), gdk_pixbuf_get_bits_per_sample (src),
width, height); width, height);
gdk_pixbuf_fill (dest, 0); gdk_pixbuf_fill (dest, 0);
src_pixels = gdk_pixbuf_get_pixels (src); src_pixels = gdk_pixbuf_get_pixels (src);
src_rowstride = gdk_pixbuf_get_rowstride (src); src_rowstride = gdk_pixbuf_get_rowstride (src);
src_bpp = gdk_pixbuf_get_has_alpha (src) ? 4 : 3; src_bpp = gdk_pixbuf_get_has_alpha (src) ? 4 : 3;
dest_pixels = gdk_pixbuf_get_pixels (dest); dest_pixels = gdk_pixbuf_get_pixels (dest);
dest_rowstride = gdk_pixbuf_get_rowstride (dest); dest_rowstride = gdk_pixbuf_get_rowstride (dest);
dest_bpp = gdk_pixbuf_get_has_alpha (dest) ? 4 : 3; dest_bpp = gdk_pixbuf_get_has_alpha (dest) ? 4 : 3;
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{ {
for (x = 0; x < width; x++) for (x = 0; x < width; x++)
@ -110,19 +110,19 @@ create_shadow (GdkPixbuf *src)
src_x * src_bpp + 0] * src_x * src_bpp + 0] *
filter->data [i * filter->size + j]; filter->data [i * filter->size + j];
sumg += src_pixels [src_y * src_rowstride + sumg += src_pixels [src_y * src_rowstride +
src_x * src_bpp + 1] * src_x * src_bpp + 1] *
filter->data [i * filter->size + j]; filter->data [i * filter->size + j];
sumb += src_pixels [src_y * src_rowstride + sumb += src_pixels [src_y * src_rowstride +
src_x * src_bpp + 2] * src_x * src_bpp + 2] *
filter->data [i * filter->size + j]; filter->data [i * filter->size + j];
if (src_bpp == 4) if (src_bpp == 4)
suma += src_pixels [src_y * src_rowstride + suma += src_pixels [src_y * src_rowstride +
src_x * src_bpp + 3] * src_x * src_bpp + 3] *
filter->data [i * filter->size + j]; filter->data [i * filter->size + j];
} }
} }
@ -132,7 +132,7 @@ create_shadow (GdkPixbuf *src)
} }
} }
return dest; return dest;
} }
@ -140,7 +140,7 @@ GdkPixbuf *
create_shadowed_pixbuf (GdkPixbuf *src) create_shadowed_pixbuf (GdkPixbuf *src)
{ {
GdkPixbuf *dest; GdkPixbuf *dest;
dest = create_shadow (src); dest = create_shadow (src);
gdk_pixbuf_composite (src, dest, gdk_pixbuf_composite (src, dest,

View file

@ -80,7 +80,7 @@ remove_shaped_area (GdkPixbuf *pixbuf,
retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf)); gdk_pixbuf_get_height (pixbuf));
gdk_pixbuf_fill (retval, 0); gdk_pixbuf_fill (retval, 0);
rectangles = XShapeGetRectangles (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), window, rectangles = XShapeGetRectangles (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), window,
ShapeBounding, &rectangle_count, &rectangle_order); ShapeBounding, &rectangle_count, &rectangle_order);

View file

@ -281,7 +281,7 @@ create_combo_box_entry (void)
GtkWidget *align; GtkWidget *align;
GtkWidget *child; GtkWidget *child;
GtkTreeModel *model; GtkTreeModel *model;
gtk_rc_parse_string ("style \"combo-box-entry-style\" {\n" gtk_rc_parse_string ("style \"combo-box-entry-style\" {\n"
" GtkComboBox::appears-as-list = 1\n" " GtkComboBox::appears-as-list = 1\n"
"}\n" "}\n"
@ -308,7 +308,7 @@ create_combo_box (void)
{ {
GtkWidget *widget; GtkWidget *widget;
GtkWidget *align; GtkWidget *align;
gtk_rc_parse_string ("style \"combo-box-style\" {\n" gtk_rc_parse_string ("style \"combo-box-style\" {\n"
" GtkComboBox::appears-as-list = 0\n" " GtkComboBox::appears-as-list = 0\n"
"}\n" "}\n"
@ -333,9 +333,9 @@ create_recent_chooser_dialog (void)
NULL, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL); NULL);
gtk_window_set_default_size (GTK_WINDOW (widget), 505, 305); gtk_window_set_default_size (GTK_WINDOW (widget), 505, 305);
info = new_widget_info ("recentchooserdialog", widget, ASIS); info = new_widget_info ("recentchooserdialog", widget, ASIS);
info->include_decorations = TRUE; info->include_decorations = TRUE;
@ -633,11 +633,11 @@ create_colorsel (void)
color.blue = 0x9595; color.blue = 0x9595;
gtk_color_selection_set_previous_color (colorsel, &color); gtk_color_selection_set_previous_color (colorsel, &color);
color.red = 0x7d7d; color.red = 0x7d7d;
color.green = 0x9393; color.green = 0x9393;
color.blue = 0xc3c3; color.blue = 0xc3c3;
gtk_color_selection_set_current_color (colorsel, &color); gtk_color_selection_set_current_color (colorsel, &color);
info = new_widget_info ("colorsel", widget, ASIS); info = new_widget_info ("colorsel", widget, ASIS);
@ -670,9 +670,9 @@ create_filesel (void)
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL); NULL);
gtk_window_set_default_size (GTK_WINDOW (widget), 505, 305); gtk_window_set_default_size (GTK_WINDOW (widget), 505, 305);
info = new_widget_info ("filechooser", widget, ASIS); info = new_widget_info ("filechooser", widget, ASIS);
info->include_decorations = TRUE; info->include_decorations = TRUE;
@ -685,7 +685,7 @@ create_print_dialog (void)
WidgetInfo *info; WidgetInfo *info;
GtkWidget *widget; GtkWidget *widget;
widget = gtk_print_unix_dialog_new ("Print Dialog", NULL); widget = gtk_print_unix_dialog_new ("Print Dialog", NULL);
gtk_widget_set_size_request (widget, 505, 350); gtk_widget_set_size_request (widget, 505, 350);
info = new_widget_info ("printdialog", widget, ASIS); info = new_widget_info ("printdialog", widget, ASIS);
info->include_decorations = TRUE; info->include_decorations = TRUE;
@ -703,7 +703,7 @@ create_page_setup_dialog (void)
page_setup = gtk_page_setup_new (); page_setup = gtk_page_setup_new ();
settings = gtk_print_settings_new (); settings = gtk_print_settings_new ();
widget = gtk_page_setup_unix_dialog_new ("Page Setup Dialog", NULL); widget = gtk_page_setup_unix_dialog_new ("Page Setup Dialog", NULL);
gtk_page_setup_unix_dialog_set_page_setup (GTK_PAGE_SETUP_UNIX_DIALOG (widget), gtk_page_setup_unix_dialog_set_page_setup (GTK_PAGE_SETUP_UNIX_DIALOG (widget),
page_setup); page_setup);
gtk_page_setup_unix_dialog_set_print_settings (GTK_PAGE_SETUP_UNIX_DIALOG (widget), gtk_page_setup_unix_dialog_set_print_settings (GTK_PAGE_SETUP_UNIX_DIALOG (widget),
@ -845,7 +845,7 @@ create_notebook (void)
widget = gtk_notebook_new (); widget = gtk_notebook_new ();
gtk_notebook_append_page (GTK_NOTEBOOK (widget), gtk_notebook_append_page (GTK_NOTEBOOK (widget),
gtk_label_new ("Notebook"), gtk_label_new ("Notebook"),
NULL); NULL);
gtk_notebook_append_page (GTK_NOTEBOOK (widget), gtk_event_box_new (), NULL); gtk_notebook_append_page (GTK_NOTEBOOK (widget), gtk_event_box_new (), NULL);
@ -883,7 +883,7 @@ create_scrolledwindow (void)
scrolledwin = gtk_scrolled_window_new (NULL, NULL); scrolledwin = gtk_scrolled_window_new (NULL, NULL);
label = gtk_label_new ("Scrolled Window"); label = gtk_label_new ("Scrolled Window");
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwin), gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwin),
label); label);
return new_widget_info ("scrolledwindow", scrolledwin, MEDIUM); return new_widget_info ("scrolledwindow", scrolledwin, MEDIUM);
@ -964,7 +964,7 @@ create_image (void)
GtkWidget *widget; GtkWidget *widget;
GtkWidget *align, *vbox; GtkWidget *align, *vbox;
widget = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, widget = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
GTK_ICON_SIZE_DND); GTK_ICON_SIZE_DND);
vbox = gtk_vbox_new (FALSE, 3); vbox = gtk_vbox_new (FALSE, 3);

View file

@ -43,7 +43,7 @@ if [ ! -d $BUILDDIR ]; then
echo "mkdir of build directory failed" echo "mkdir of build directory failed"
exit 1 exit 1
fi fi
fi fi
if ! cd $BUILDDIR; then if ! cd $BUILDDIR; then
echo "cd to build directory failed" echo "cd to build directory failed"
@ -68,7 +68,7 @@ tar cvfz $TARGETDIR/gtk-tutorial.sgml.tgz gtk-tutorial.sgml
echo "done" echo "done"
# HTML Format # HTML Format
echo -n "Formatting into HTML.... " echo -n "Formatting into HTML.... "
if [ ! -d gtk-tutorial.html ]; then if [ ! -d gtk-tutorial.html ]; then
if [ -e gtk-tutorial.html ]; then if [ -e gtk-tutorial.html ]; then
echo "ERROR: gtk-tutorial.html is not a directory" echo "ERROR: gtk-tutorial.html is not a directory"

View file

@ -272,7 +272,7 @@ GtkButton
===================== =====================
NOTE: Due to a bug that is basically unfixable in a sufficiently compatible NOTE: Due to a bug that is basically unfixable in a sufficiently compatible
NOTE: way, the button gives the space requested for focus_width and NOTE: way, the button gives the space requested for focus_width and
NOTE: focus_padding to the child (in addition to the space requested by NOTE: focus_padding to the child (in addition to the space requested by
NOTE: the child), if the button is !CAN_FOCUS. NOTE: the child), if the button is !CAN_FOCUS.

View file

@ -6,7 +6,7 @@ and should work. It consists of three parts:
I) A description of the meaning of the various flags I) A description of the meaning of the various flags
II) A list of invariants about the states of the widgets. II) A list of invariants about the states of the widgets.
(Throughout this document, we refer to the states of the (Throughout this document, we refer to the states of the
widgets by referring to the flags for GtkWidget) widgets by referring to the flags for GtkWidget)
@ -46,7 +46,7 @@ GTK_DESTROYED:
This flagged is set for a GtkObject right before its This flagged is set for a GtkObject right before its
destruction code is executed. Its main use is the destruction code is executed. Its main use is the
prevention of multiple destruction invocations. prevention of multiple destruction invocations.
GTK_FLOATING: GTK_FLOATING:
This flag reflects the fact that the holder of the This flag reflects the fact that the holder of the
initial reference count is unknown. Refer to refcounting.txt initial reference count is unknown. Refer to refcounting.txt
@ -63,7 +63,7 @@ GTK_TOPLEVEL:
Widgets without a real parent, as there are GtkWindows and Widgets without a real parent, as there are GtkWindows and
GtkMenus have this flag set throughout their lifetime. GtkMenus have this flag set throughout their lifetime.
Toplevel widgets always contain their own GdkWindow. Toplevel widgets always contain their own GdkWindow.
GTK_NO_WINDOW: GTK_NO_WINDOW:
This flag is indicative for a widget that does not provide This flag is indicative for a widget that does not provide
its own GdkWindow. Visible action (e.g. drawing) is performed its own GdkWindow. Visible action (e.g. drawing) is performed
@ -89,7 +89,7 @@ GTK_VISIBLE:
Implies that a widget is not onscreen, therefore !GTK_MAPPED. Implies that a widget is not onscreen, therefore !GTK_MAPPED.
GTK_CHILD_VISIBLE GTK_CHILD_VISIBLE
Set by gtk_widget_set_child_visible, and if FALSE indicates that Set by gtk_widget_set_child_visible, and if FALSE indicates that
the widget should not be mapped even if the parent is mapped the widget should not be mapped even if the parent is mapped
and visible. Containers like GtkNotebook use this flag. and visible. Containers like GtkNotebook use this flag.
A private flag, not a public flag, so if you need to check A private flag, not a public flag, so if you need to check
@ -120,7 +120,7 @@ GTK_HAS_FOCUS:
This flag will be set by gtk_widget_grab_focus for widgets that also This flag will be set by gtk_widget_grab_focus for widgets that also
have GTK_CAN_FOCUS set. The flag will be unset once another widget have GTK_CAN_FOCUS set. The flag will be unset once another widget
grabs the focus. grabs the focus.
GTK_CAN_DEFAULT: GTK_CAN_DEFAULT:
GTK_HAS_DEFAULT: GTK_HAS_DEFAULT:
These two flags are mostly equal in functionality to their *_FOCUS These two flags are mostly equal in functionality to their *_FOCUS
@ -157,7 +157,7 @@ GTK_USER_STYLE:
has been invoked for it. The use of this flag is to tell widgets has been invoked for it. The use of this flag is to tell widgets
which share a global user style from the ones which got a certain which share a global user style from the ones which got a certain
style assign from outside the toolkit. style assign from outside the toolkit.
GTK_RESIZE_PENDING: GTK_RESIZE_PENDING:
First, this is only valid for GtkContainers. First, this is only valid for GtkContainers.
[some of the code should move to gtkcontainer.c therefore] [some of the code should move to gtkcontainer.c therefore]
@ -196,19 +196,19 @@ GTK_IN_REPARENT:
process of getting unparented. process of getting unparented.
GTK_NEED_REQUEST: GTK_NEED_REQUEST:
This flag is set if the widget doesn't have an up to date This flag is set if the widget doesn't have an up to date
requisition. If this flag is set, we must actually emit ::size-request requisition. If this flag is set, we must actually emit ::size-request
when gtk_widget_size_request() is called. Otherwise, we can when gtk_widget_size_request() is called. Otherwise, we can
simply widget->requisition. We keep track of this all the time simply widget->requisition. We keep track of this all the time
however, widgets with this flag set are only added to the resize however, widgets with this flag set are only added to the resize
queue if they are viewable. queue if they are viewable.
GTK_NEED_ALLOCATION: GTK_NEED_ALLOCATION:
This flag is set if the widget doesn't have an up to date This flag is set if the widget doesn't have an up to date
allocation. If this flag is set, we must actually emit ::size-allocate allocation. If this flag is set, we must actually emit ::size-allocate
when gtk_widget_size_allocate() is called, even if the new allocation when gtk_widget_size_allocate() is called, even if the new allocation
is the same as the current allocation. is the same as the current allocation.
Related Macros: Related Macros:
GTK_WIDGET_DRAWABLE: GTK_WIDGET_DRAWABLE:
@ -224,7 +224,7 @@ GTK_WIDGET_IS_SENSITIVE:
II. Invariants: II. Invariants:
--------------- ---------------
This section describes various constraints on the states of This section describes various constraints on the states of
the widget: the widget:
In the following In the following
@ -236,8 +236,8 @@ In the following
1) GTK_WIDGET_DESTROYED (widget) => !GTK_WIDGET_REALIZED (widget) 1) GTK_WIDGET_DESTROYED (widget) => !GTK_WIDGET_REALIZED (widget)
=> !GTK_WIDGET_VISIBLE (widget) => !GTK_WIDGET_VISIBLE (widget)
[ The latter is not currently in place, but it should be ] [ The latter is not currently in place, but it should be ]
2) GTK_WIDGET_MAPPED (widget) => GTK_WIDGET_REALIZED (widget) 2) GTK_WIDGET_MAPPED (widget) => GTK_WIDGET_REALIZED (widget)
3) if GTK_WIDGET_TOPLEVEL (widget): 3) if GTK_WIDGET_TOPLEVEL (widget):
@ -253,15 +253,15 @@ In the following
=> GTK_WIDGET_CHILD_VISIBLE (widget) => GTK_WIDGET_CHILD_VISIBLE (widget)
=> GTK_WIDGET_REALIZED (widget) => GTK_WIDGET_REALIZED (widget)
widget->parent && GTK_WIDGET_MAPPED (widget->parent) && widget->parent && GTK_WIDGET_MAPPED (widget->parent) &&
GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_CHILD_VISIBLE GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_CHILD_VISIBLE
=> GTK_WIDGET_MAPPED (widget) => GTK_WIDGET_MAPPED (widget)
Note:, the definition Note:, the definition
[ GTK_WIDGET_DRAWABLE = GTK_WIDGET_VISIBLE && GTK_WIDGET_MAPPED [ GTK_WIDGET_DRAWABLE = GTK_WIDGET_VISIBLE && GTK_WIDGET_MAPPED
is made in gtkwidget.h, but by 3) and 5), is made in gtkwidget.h, but by 3) and 5),
GTK_WIDGET_MAPPED => GTK_WIDGET_VISIBLE GTK_WIDGET_MAPPED => GTK_WIDGET_VISIBLE
] ]
@ -277,9 +277,9 @@ How can the user control the state of a widget:
----------------------------------------------- -----------------------------------------------
(In the following, set flag means set the flag, do appropriate (In the following, set flag means set the flag, do appropriate
actions, and enforce above invariants) actions, and enforce above invariants)
gtk_widget_show: gtk_widget_show:
if !GTK_DESTROYED sets GTK_VISIBLE if !GTK_DESTROYED sets GTK_VISIBLE
gtk_widget_hide: gtk_widget_hide:
@ -295,14 +295,14 @@ gtk_widget_realize:
of a toplevel is an ERROR. of a toplevel is an ERROR.
gtk_container_add (container, widget) [ and container-specific variants ] gtk_container_add (container, widget) [ and container-specific variants ]
Sets widget->parent Sets widget->parent
gtk_container_remove (container, widget) gtk_container_remove (container, widget)
unsets widget->parent unsets widget->parent
gtk_widget_reparent (widget, new_parent) gtk_widget_reparent (widget, new_parent)
Equivalent to removing widget from old parent and adding it to Equivalent to removing widget from old parent and adding it to
the new parent, except that the widget will not be temporarily the new parent, except that the widget will not be temporarily
unrealized if both the old parent and the new parent are realized. unrealized if both the old parent and the new parent are realized.
@ -329,7 +329,7 @@ Adding to a container
When a widget is added to a container, the container: When a widget is added to a container, the container:
1) calls gtk_widget_set_parent_window (widget, window) if 1) calls gtk_widget_set_parent_window (widget, window) if
the widget is being added to something other than container->window the widget is being added to something other than container->window
2) calls gtk_widget_set_parent (widget, container) 2) calls gtk_widget_set_parent (widget, container)
@ -343,14 +343,14 @@ When a widget is removed to a container, the container:
Notes: Notes:
gtk_widget_unparent unrealizes the widget except in the gtk_widget_unparent unrealizes the widget except in the
special case GTK_IN_REPARENT is set. special case GTK_IN_REPARENT is set.
At widget creation At widget creation
------------------ ------------------
Widgets are created in an unrealized state. Widgets are created in an unrealized state.
1) The widget should allocate and initialize needed data structures 1) The widget should allocate and initialize needed data structures
@ -383,7 +383,7 @@ The Map signal
1) Set the MAPPED flag 1) Set the MAPPED flag
2) If the widget has any windows, gdk_window_show those windows 2) If the widget has any windows, gdk_window_show those windows
3) call gtk_widget_map for all child widgets that are 3) call gtk_widget_map for all child widgets that are
VISIBLE, CHILD_VISIBLE and !MAPPED. (A widget will only VISIBLE, CHILD_VISIBLE and !MAPPED. (A widget will only
be !CHILD_VISIBLE if the container set it that way, so be !CHILD_VISIBLE if the container set it that way, so
most containers will not have to check this.) most containers will not have to check this.)
@ -395,7 +395,7 @@ The Unmap signal
When a widget receives the unmap signal, it must: When a widget receives the unmap signal, it must:
1) If the widget has a window, gdk_window_hide that window, 1) If the widget has a window, gdk_window_hide that window,
2) If the widget does not have a window, unmap all child widgets 2) If the widget does not have a window, unmap all child widgets
3) Do any other functions related to taking the widget offscreen 3) Do any other functions related to taking the widget offscreen
(for instance, removing popup windows...) (for instance, removing popup windows...)
@ -436,7 +436,7 @@ Commentary:
back to the widget. (To use gtk_widget_get_data, for instance) back to the widget. (To use gtk_widget_get_data, for instance)
If it does so via a pointer in a closure (natural for If it does so via a pointer in a closure (natural for
Scheme, or Perl), then the finalization procedure will never Scheme, or Perl), then the finalization procedure will never
be called. be called.
Also, if we made that the finalization step, we would have Also, if we made that the finalization step, we would have
to propagate the GDK_DESTROY event in any case, since it is to propagate the GDK_DESTROY event in any case, since it is
@ -458,7 +458,7 @@ signal (but see the section on "Finalize" below)
The widget must handle calls to all publically accessible The widget must handle calls to all publically accessible
functions in an innocuous manner even after a "destroy" functions in an innocuous manner even after a "destroy"
signal. (A widget can assume that it will not be realized signal. (A widget can assume that it will not be realized
after a "destroy" signal is received, which may simplify after a "destroy" signal is received, which may simplify
handling this requirement) handling this requirement)
@ -496,5 +496,5 @@ not Bar.
Then gtk_foo_destroy will call gtk_widget_destroy (because Then gtk_foo_destroy will call gtk_widget_destroy (because
it was not overridden in the Bar class structure) and it was not overridden in the Bar class structure) and
gtk_widget_destroy will call gtk_object_destroy because gtk_widget_destroy will call gtk_object_destroy because
the parent_class variable referenced by gtk_foo_destroy is the the parent_class variable referenced by gtk_foo_destroy is the
static variable in gtkwidget.c: GtkObjectClass. static variable in gtkwidget.c: GtkObjectClass.

View file

@ -13,7 +13,7 @@ static GtkWidget *create_arrow_button( GtkArrowType arrow_type,
arrow = gtk_arrow_new (arrow_type, shadow_type); arrow = gtk_arrow_new (arrow_type, shadow_type);
gtk_container_add (GTK_CONTAINER (button), arrow); gtk_container_add (GTK_CONTAINER (button), arrow);
gtk_widget_show (button); gtk_widget_show (button);
gtk_widget_show (arrow); gtk_widget_show (arrow);
@ -56,17 +56,17 @@ int main( int argc,
button = create_arrow_button (GTK_ARROW_DOWN, GTK_SHADOW_OUT); button = create_arrow_button (GTK_ARROW_DOWN, GTK_SHADOW_OUT);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
button = create_arrow_button (GTK_ARROW_LEFT, GTK_SHADOW_ETCHED_IN); button = create_arrow_button (GTK_ARROW_LEFT, GTK_SHADOW_ETCHED_IN);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
button = create_arrow_button (GTK_ARROW_RIGHT, GTK_SHADOW_ETCHED_OUT); button = create_arrow_button (GTK_ARROW_RIGHT, GTK_SHADOW_ETCHED_OUT);
gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 3);
gtk_widget_show (window); gtk_widget_show (window);
/* Rest in gtk_main and wait for the fun to begin! */ /* Rest in gtk_main and wait for the fun to begin! */
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -1,6 +1,6 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
int main( int argc, int main( int argc,
char *argv[] ) char *argv[] )
{ {
@ -8,34 +8,34 @@ int main( int argc,
GtkWidget *aspect_frame; GtkWidget *aspect_frame;
GtkWidget *drawing_area; GtkWidget *drawing_area;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame"); gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
g_signal_connect (G_OBJECT (window), "destroy", g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_container_set_border_width (GTK_CONTAINER (window), 10);
/* Create an aspect_frame and add it to our toplevel window */ /* Create an aspect_frame and add it to our toplevel window */
aspect_frame = gtk_aspect_frame_new ("2x1", /* label */ aspect_frame = gtk_aspect_frame_new ("2x1", /* label */
0.5, /* center x */ 0.5, /* center x */
0.5, /* center y */ 0.5, /* center y */
2, /* xsize/ysize = 2 */ 2, /* xsize/ysize = 2 */
FALSE /* ignore child's aspect */); FALSE /* ignore child's aspect */);
gtk_container_add (GTK_CONTAINER (window), aspect_frame); gtk_container_add (GTK_CONTAINER (window), aspect_frame);
gtk_widget_show (aspect_frame); gtk_widget_show (aspect_frame);
/* Now add a child widget to the aspect frame */ /* Now add a child widget to the aspect frame */
drawing_area = gtk_drawing_area_new (); drawing_area = gtk_drawing_area_new ();
/* Ask for a 200x200 window, but the AspectFrame will give us a 200x100 /* Ask for a 200x200 window, but the AspectFrame will give us a 200x100
* window since we are forcing a 2x1 aspect ratio */ * window since we are forcing a 2x1 aspect ratio */
gtk_widget_set_size_request (drawing_area, 200, 200); gtk_widget_set_size_request (drawing_area, 200, 200);
gtk_container_add (GTK_CONTAINER (aspect_frame), drawing_area); gtk_container_add (GTK_CONTAINER (aspect_frame), drawing_area);
gtk_widget_show (drawing_area); gtk_widget_show (drawing_area);
gtk_widget_show (window); gtk_widget_show (window);
gtk_main (); gtk_main ();
return 0; return 0;

View file

@ -5,13 +5,13 @@ int main( int argc,
char *argv[] ) char *argv[] )
{ {
GtkWidget *window; GtkWidget *window;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window); gtk_widget_show (window);
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -115,6 +115,6 @@ int main( int argc,
/* Enter the event loop */ /* Enter the event loop */
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -6,7 +6,7 @@
void button_add_clicked( gpointer data ) void button_add_clicked( gpointer data )
{ {
int indx; int indx;
/* Something silly to add to the list. 4 rows of 2 columns each */ /* Something silly to add to the list. 4 rows of 2 columns each */
gchar *drink[4][2] = { { "Milk", "3 Oz" }, gchar *drink[4][2] = { { "Milk", "3 Oz" },
{ "Water", "6 l" }, { "Water", "6 l" },
@ -80,15 +80,15 @@ void selection_made( GtkWidget *clist,
int main( int argc, int main( int argc,
gchar *argv[] ) gchar *argv[] )
{ {
GtkWidget *window; GtkWidget *window;
GtkWidget *vbox, *hbox; GtkWidget *vbox, *hbox;
GtkWidget *scrolled_window, *clist; GtkWidget *scrolled_window, *clist;
GtkWidget *button_add, *button_clear, *button_hide_show; GtkWidget *button_add, *button_clear, *button_hide_show;
gchar *titles[2] = { "Ingredients", "Amount" }; gchar *titles[2] = { "Ingredients", "Amount" };
gtk_init(&argc, &argv); gtk_init(&argc, &argv);
window=gtk_window_new (GTK_WINDOW_TOPLEVEL); window=gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (GTK_WIDGET (window), 300, 150); gtk_widget_set_size_request (GTK_WIDGET (window), 300, 150);
@ -96,12 +96,12 @@ int main( int argc,
g_signal_connect (G_OBJECT (window), "destroy", g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), G_CALLBACK (gtk_main_quit),
NULL); NULL);
vbox=gtk_vbox_new (FALSE, 5); vbox=gtk_vbox_new (FALSE, 5);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_container_add (GTK_CONTAINER (window), vbox); gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show (vbox); gtk_widget_show (vbox);
/* Create a scrolled window to pack the CList widget into */ /* Create a scrolled window to pack the CList widget into */
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
@ -168,6 +168,6 @@ int main( int argc,
gtk_widget_show (window); gtk_widget_show (window);
gtk_main(); gtk_main();
return 0; return 0;
} }

View file

@ -15,7 +15,7 @@ static void color_changed_cb( GtkWidget *widget,
GdkColor ncolor; GdkColor ncolor;
gtk_color_selection_get_current_color (colorsel, &ncolor); gtk_color_selection_get_current_color (colorsel, &ncolor);
gtk_widget_modify_bg (drawingarea, GTK_STATE_NORMAL, &ncolor); gtk_widget_modify_bg (drawingarea, GTK_STATE_NORMAL, &ncolor);
} }
/* Drawingarea event handler */ /* Drawingarea event handler */
@ -56,7 +56,7 @@ static gboolean area_event( GtkWidget *widget,
if (response == GTK_RESPONSE_OK) if (response == GTK_RESPONSE_OK)
gtk_color_selection_get_current_color (colorsel, &color); gtk_color_selection_get_current_color (colorsel, &color);
else else
gtk_widget_modify_bg (drawingarea, GTK_STATE_NORMAL, &color); gtk_widget_modify_bg (drawingarea, GTK_STATE_NORMAL, &color);
gtk_widget_hide (colorseldlg); gtk_widget_hide (colorseldlg);
@ -96,7 +96,7 @@ gint main( gint argc,
g_signal_connect (GTK_OBJECT (window), "delete_event", g_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (destroy_window), (gpointer) window); GTK_SIGNAL_FUNC (destroy_window), (gpointer) window);
/* Create drawingarea, set size and catch button events */ /* Create drawingarea, set size and catch button events */
drawingarea = gtk_drawing_area_new (); drawingarea = gtk_drawing_area_new ();
@ -104,22 +104,22 @@ gint main( gint argc,
color.red = 0; color.red = 0;
color.blue = 65535; color.blue = 65535;
color.green = 0; color.green = 0;
gtk_widget_modify_bg (drawingarea, GTK_STATE_NORMAL, &color); gtk_widget_modify_bg (drawingarea, GTK_STATE_NORMAL, &color);
gtk_widget_set_size_request (GTK_WIDGET (drawingarea), 200, 200); gtk_widget_set_size_request (GTK_WIDGET (drawingarea), 200, 200);
gtk_widget_set_events (drawingarea, GDK_BUTTON_PRESS_MASK); gtk_widget_set_events (drawingarea, GDK_BUTTON_PRESS_MASK);
g_signal_connect (GTK_OBJECT (drawingarea), "event", g_signal_connect (GTK_OBJECT (drawingarea), "event",
GTK_SIGNAL_FUNC (area_event), (gpointer) drawingarea); GTK_SIGNAL_FUNC (area_event), (gpointer) drawingarea);
/* Add drawingarea to window, then show them both */ /* Add drawingarea to window, then show them both */
gtk_container_add (GTK_CONTAINER (window), drawingarea); gtk_container_add (GTK_CONTAINER (window), drawingarea);
gtk_widget_show (drawingarea); gtk_widget_show (drawingarea);
gtk_widget_show (window); gtk_widget_show (window);
/* Enter the gtk main loop (this never returns) */ /* Enter the gtk main loop (this never returns) */
gtk_main (); gtk_main ();

View file

@ -18,7 +18,7 @@ else
else else
if [ -x /usr/bin/awk ]; then if [ -x /usr/bin/awk ]; then
awk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5 awk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5
else else
if [ -x /bin/awk ]; then if [ -x /bin/awk ]; then
awk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5 awk -f extract.awk $TUTORIAL $1 $2 $3 $4 $5
else else

View file

@ -12,28 +12,28 @@ int main( int argc,
char *argv[] ) char *argv[] )
{ {
GtkWidget *filew; GtkWidget *filew;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
/* Create a new file selection widget */ /* Create a new file selection widget */
filew = gtk_file_selection_new ("File selection"); filew = gtk_file_selection_new ("File selection");
g_signal_connect (G_OBJECT (filew), "destroy", g_signal_connect (G_OBJECT (filew), "destroy",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
/* Connect the ok_button to file_ok_sel function */ /* Connect the ok_button to file_ok_sel function */
g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button), g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filew)->ok_button),
"clicked", G_CALLBACK (file_ok_sel), (gpointer) filew); "clicked", G_CALLBACK (file_ok_sel), (gpointer) filew);
/* Connect the cancel_button to destroy the widget */ /* Connect the cancel_button to destroy the widget */
g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button), g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
"clicked", G_CALLBACK (gtk_widget_destroy), "clicked", G_CALLBACK (gtk_widget_destroy),
G_OBJECT (filew)); G_OBJECT (filew));
/* Lets set the filename, as if this were a save dialog, and we are giving /* Lets set the filename, as if this were a save dialog, and we are giving
a default filename */ a default filename */
gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew), gtk_file_selection_set_filename (GTK_FILE_SELECTION(filew),
"penguin.png"); "penguin.png");
gtk_widget_show (filew); gtk_widget_show (filew);
gtk_main (); gtk_main ();
return 0; return 0;

View file

@ -14,7 +14,7 @@ static void move_button( GtkWidget *widget,
{ {
x = (x + 30) % 300; x = (x + 30) % 300;
y = (y + 50) % 300; y = (y + 50) % 300;
gtk_fixed_move (GTK_FIXED (fixed), widget, x, y); gtk_fixed_move (GTK_FIXED (fixed), widget, x, y);
} }
int main( int argc, int main( int argc,
@ -28,15 +28,15 @@ int main( int argc,
/* Initialise GTK */ /* Initialise GTK */
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
/* Create a new window */ /* Create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Fixed Container"); gtk_window_set_title (GTK_WINDOW (window), "Fixed Container");
/* Here we connect the "destroy" event to a signal handler */ /* Here we connect the "destroy" event to a signal handler */
g_signal_connect (G_OBJECT (window), "destroy", g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
/* Sets the border width of the window. */ /* Sets the border width of the window. */
gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_container_set_border_width (GTK_CONTAINER (window), 10);
@ -44,29 +44,29 @@ int main( int argc,
fixed = gtk_fixed_new (); fixed = gtk_fixed_new ();
gtk_container_add (GTK_CONTAINER (window), fixed); gtk_container_add (GTK_CONTAINER (window), fixed);
gtk_widget_show (fixed); gtk_widget_show (fixed);
for (i = 1 ; i <= 3 ; i++) { for (i = 1 ; i <= 3 ; i++) {
/* Creates a new button with the label "Press me" */ /* Creates a new button with the label "Press me" */
button = gtk_button_new_with_label ("Press me"); button = gtk_button_new_with_label ("Press me");
/* When the button receives the "clicked" signal, it will call the /* When the button receives the "clicked" signal, it will call the
* function move_button() passing it the Fixed Container as its * function move_button() passing it the Fixed Container as its
* argument. */ * argument. */
g_signal_connect (G_OBJECT (button), "clicked", g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (move_button), (gpointer) fixed); G_CALLBACK (move_button), (gpointer) fixed);
/* This packs the button into the fixed containers window. */ /* This packs the button into the fixed containers window. */
gtk_fixed_put (GTK_FIXED (fixed), button, i*50, i*50); gtk_fixed_put (GTK_FIXED (fixed), button, i*50, i*50);
/* The final step is to display this newly created widget. */ /* The final step is to display this newly created widget. */
gtk_widget_show (button); gtk_widget_show (button);
} }
/* Display the window */ /* Display the window */
gtk_widget_show (window); gtk_widget_show (window);
/* Enter the event loop */ /* Enter the event loop */
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -10,12 +10,12 @@ int main( int argc,
/* Initialise GTK */ /* Initialise GTK */
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
/* Create a new window */ /* Create a new window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Frame Example"); gtk_window_set_title (GTK_WINDOW (window), "Frame Example");
/* Here we connect the "destroy" event to a signal handler */ /* Here we connect the "destroy" event to a signal handler */
g_signal_connect (G_OBJECT (window), "destroy", g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
@ -37,12 +37,12 @@ int main( int argc,
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);
gtk_widget_show (frame); gtk_widget_show (frame);
/* Display the window */ /* Display the window */
gtk_widget_show (window); gtk_widget_show (window);
/* Enter the event loop */ /* Enter the event loop */
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -223,8 +223,8 @@ gtk_dial_realize (GtkWidget *widget)
attributes.height = widget->allocation.height; attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT; attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD; attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget) | attributes.event_mask = gtk_widget_get_events (widget) |
GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK; GDK_POINTER_MOTION_HINT_MASK;
attributes.visual = gtk_widget_get_visual (widget); attributes.visual = gtk_widget_get_visual (widget);
@ -240,7 +240,7 @@ gtk_dial_realize (GtkWidget *widget)
gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE); gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
} }
static void static void
gtk_dial_size_request (GtkWidget *widget, gtk_dial_size_request (GtkWidget *widget,
GtkRequisition *requisition) GtkRequisition *requisition)
{ {
@ -293,7 +293,7 @@ gtk_dial_expose( GtkWidget *widget,
if (event->count > 0) if (event->count > 0)
return FALSE; return FALSE;
dial = GTK_DIAL (widget); dial = GTK_DIAL (widget);
/* gdk_window_clear_area (widget->window, /* gdk_window_clear_area (widget->window,
@ -367,7 +367,7 @@ gtk_dial_expose( GtkWidget *widget,
theta = ((gfloat)i*M_PI / (18*inc/24.) - M_PI/6.); theta = ((gfloat)i*M_PI / (18*inc/24.) - M_PI/6.);
if ((theta - last) < (increment)) if ((theta - last) < (increment))
continue; continue;
last = theta; last = theta;
s = sin (theta); s = sin (theta);
@ -430,20 +430,20 @@ gtk_dial_button_press( GtkWidget *widget,
dial = GTK_DIAL (widget); dial = GTK_DIAL (widget);
/* Determine if button press was within pointer region - we /* Determine if button press was within pointer region - we
do this by computing the parallel and perpendicular distance of do this by computing the parallel and perpendicular distance of
the point where the mouse was pressed from the line passing through the point where the mouse was pressed from the line passing through
the pointer */ the pointer */
dx = event->x - widget->allocation.width / 2; dx = event->x - widget->allocation.width / 2;
dy = widget->allocation.height / 2 - event->y; dy = widget->allocation.height / 2 - event->y;
s = sin (dial->angle); s = sin (dial->angle);
c = cos (dial->angle); c = cos (dial->angle);
d_parallel = s*dy + c*dx; d_parallel = s*dy + c*dx;
d_perpendicular = fabs (s*dx - c*dy); d_perpendicular = fabs (s*dx - c*dy);
if (!dial->button && if (!dial->button &&
(d_perpendicular < dial->pointer_width/2) && (d_perpendicular < dial->pointer_width/2) &&
(d_parallel > - dial->pointer_width)) (d_parallel > - dial->pointer_width))
@ -478,7 +478,7 @@ gtk_dial_button_release( GtkWidget *widget,
if (dial->policy == GTK_UPDATE_DELAYED) if (dial->policy == GTK_UPDATE_DELAYED)
g_source_remove (dial->timer); g_source_remove (dial->timer);
if ((dial->policy != GTK_UPDATE_CONTINUOUS) && if ((dial->policy != GTK_UPDATE_CONTINUOUS) &&
(dial->old_value != dial->adjustment->value)) (dial->old_value != dial->adjustment->value))
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed"); g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
@ -598,12 +598,12 @@ static void
gtk_dial_update (GtkDial *dial) gtk_dial_update (GtkDial *dial)
{ {
gfloat new_value; gfloat new_value;
g_return_if_fail (dial != NULL); g_return_if_fail (dial != NULL);
g_return_if_fail (GTK_IS_DIAL (dial)); g_return_if_fail (GTK_IS_DIAL (dial));
new_value = dial->adjustment->value; new_value = dial->adjustment->value;
if (new_value < dial->adjustment->lower) if (new_value < dial->adjustment->lower)
new_value = dial->adjustment->lower; new_value = dial->adjustment->lower;

View file

@ -24,25 +24,25 @@ int main( int argc,
gtk_container_add (GTK_CONTAINER (window), hbox); gtk_container_add (GTK_CONTAINER (window), hbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (window), 5); gtk_container_set_border_width (GTK_CONTAINER (window), 5);
frame = gtk_frame_new ("Normal Label"); frame = gtk_frame_new ("Normal Label");
label = gtk_label_new ("This is a Normal label"); label = gtk_label_new ("This is a Normal label");
gtk_container_add (GTK_CONTAINER (frame), label); gtk_container_add (GTK_CONTAINER (frame), label);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Multi-line Label"); frame = gtk_frame_new ("Multi-line Label");
label = gtk_label_new ("This is a Multi-line label.\nSecond line\n" \ label = gtk_label_new ("This is a Multi-line label.\nSecond line\n" \
"Third line"); "Third line");
gtk_container_add (GTK_CONTAINER (frame), label); gtk_container_add (GTK_CONTAINER (frame), label);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Left Justified Label"); frame = gtk_frame_new ("Left Justified Label");
label = gtk_label_new ("This is a Left-Justified\n" \ label = gtk_label_new ("This is a Left-Justified\n" \
"Multi-line label.\nThird line"); "Multi-line label.\nThird line");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_container_add (GTK_CONTAINER (frame), label); gtk_container_add (GTK_CONTAINER (frame), label);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Right Justified Label"); frame = gtk_frame_new ("Right Justified Label");
label = gtk_label_new ("This is a Right-Justified\nMulti-line label.\n" \ label = gtk_label_new ("This is a Right-Justified\nMulti-line label.\n" \
"Fourth line, (j/k)"); "Fourth line, (j/k)");
@ -66,7 +66,7 @@ int main( int argc,
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_container_add (GTK_CONTAINER (frame), label); gtk_container_add (GTK_CONTAINER (frame), label);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Filled, wrapped label"); frame = gtk_frame_new ("Filled, wrapped label");
label = gtk_label_new ("This is an example of a line-wrapped, filled label. " \ label = gtk_label_new ("This is an example of a line-wrapped, filled label. " \
"It should be taking "\ "It should be taking "\
@ -82,7 +82,7 @@ int main( int argc,
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_container_add (GTK_CONTAINER (frame), label); gtk_container_add (GTK_CONTAINER (frame), label);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
frame = gtk_frame_new ("Underlined label"); frame = gtk_frame_new ("Underlined label");
label = gtk_label_new ("This label is underlined!\n" label = gtk_label_new ("This label is underlined!\n"
"This one is underlined in quite a funky fashion"); "This one is underlined in quite a funky fashion");
@ -91,10 +91,10 @@ int main( int argc,
"_________________________ _ _________ _ ______ __ _______ ___"); "_________________________ _ _________ _ ______ __ _______ ___");
gtk_container_add (GTK_CONTAINER (frame), label); gtk_container_add (GTK_CONTAINER (frame), label);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show_all (window); gtk_widget_show_all (window);
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -79,15 +79,15 @@ static gboolean popup_cb( GtkWidget *widget,
GtkWidget *menu ) GtkWidget *menu )
{ {
GdkEventButton *bevent = (GdkEventButton *)event; GdkEventButton *bevent = (GdkEventButton *)event;
/* Only take button presses */ /* Only take button presses */
if (event->type != GDK_BUTTON_PRESS) if (event->type != GDK_BUTTON_PRESS)
return FALSE; return FALSE;
/* Show the menu */ /* Show the menu */
gtk_menu_popup (GTK_MENU(menu), NULL, NULL, gtk_menu_popup (GTK_MENU(menu), NULL, NULL,
NULL, NULL, bevent->button, bevent->time); NULL, NULL, bevent->button, bevent->time);
return TRUE; return TRUE;
} }
@ -97,13 +97,13 @@ GtkWidget *get_popup_menu( void )
{ {
GtkItemFactory *item_factory; GtkItemFactory *item_factory;
GtkWidget *button, *menu; GtkWidget *button, *menu;
/* Same as before but don't bother with the accelerators */ /* Same as before but don't bother with the accelerators */
item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<main>", item_factory = gtk_item_factory_new (GTK_TYPE_MENU, "<main>",
NULL); NULL);
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL); gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
menu = gtk_item_factory_get_widget (item_factory, "<main>"); menu = gtk_item_factory_get_widget (item_factory, "<main>");
/* Make a button to activate the popup menu */ /* Make a button to activate the popup menu */
button = gtk_button_new_with_label ("Popup"); button = gtk_button_new_with_label ("Popup");
/* Make the menu popup when clicked */ /* Make the menu popup when clicked */
@ -120,7 +120,7 @@ GtkWidget *get_option_menu( void )
{ {
GtkItemFactory *item_factory; GtkItemFactory *item_factory;
GtkWidget *option_menu; GtkWidget *option_menu;
/* Same again, not bothering with the accelerators */ /* Same again, not bothering with the accelerators */
item_factory = gtk_item_factory_new (GTK_TYPE_OPTION_MENU, "<main>", item_factory = gtk_item_factory_new (GTK_TYPE_OPTION_MENU, "<main>",
NULL); NULL);
@ -137,10 +137,10 @@ int main( int argc,
GtkWidget *window; GtkWidget *window;
GtkWidget *main_vbox; GtkWidget *main_vbox;
GtkWidget *menubar, *option_menu, *popup_button; GtkWidget *menubar, *option_menu, *popup_button;
/* Initialize GTK */ /* Initialize GTK */
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
/* Make a window */ /* Make a window */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "destroy", g_signal_connect (G_OBJECT (window), "destroy",
@ -148,19 +148,19 @@ int main( int argc,
NULL); NULL);
gtk_window_set_title (GTK_WINDOW(window), "Item Factory"); gtk_window_set_title (GTK_WINDOW(window), "Item Factory");
gtk_widget_set_size_request (GTK_WIDGET(window), 300, 200); gtk_widget_set_size_request (GTK_WIDGET(window), 300, 200);
/* Make a vbox to put the three menus in */ /* Make a vbox to put the three menus in */
main_vbox = gtk_vbox_new (FALSE, 1); main_vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1); gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1);
gtk_container_add (GTK_CONTAINER (window), main_vbox); gtk_container_add (GTK_CONTAINER (window), main_vbox);
/* Get the three types of menu */ /* Get the three types of menu */
/* Note: all three menus are separately created, so they are not the /* Note: all three menus are separately created, so they are not the
same menu */ same menu */
menubar = get_menubar_menu (window); menubar = get_menubar_menu (window);
popup_button = get_popup_menu (); popup_button = get_popup_menu ();
option_menu = get_option_menu (); option_menu = get_option_menu ();
/* Pack it all together */ /* Pack it all together */
gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (main_vbox), popup_button, FALSE, TRUE, 0); gtk_box_pack_end (GTK_BOX (main_vbox), popup_button, FALSE, TRUE, 0);
@ -168,9 +168,9 @@ int main( int argc,
/* Show the widgets */ /* Show the widgets */
gtk_widget_show_all (window); gtk_widget_show_all (window);
/* Finished! */ /* Finished! */
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
/* Create the list of "messages" */ /* Create the list of "messages" */
static GtkWidget *create_list( void ) static GtkWidget *create_list( void )
{ {
@ -14,44 +14,44 @@ static GtkWidget *create_list( void )
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
int i; int i;
/* Create a new scrolled window, with scrollbars only if needed */ /* Create a new scrolled window, with scrollbars only if needed */
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC);
model = gtk_list_store_new (1, G_TYPE_STRING); model = gtk_list_store_new (1, G_TYPE_STRING);
tree_view = gtk_tree_view_new (); tree_view = gtk_tree_view_new ();
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
tree_view); tree_view);
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (model)); gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), GTK_TREE_MODEL (model));
gtk_widget_show (tree_view); gtk_widget_show (tree_view);
/* Add some messages to the window */ /* Add some messages to the window */
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
gchar *msg = g_strdup_printf ("Message #%d", i); gchar *msg = g_strdup_printf ("Message #%d", i);
gtk_list_store_append (GTK_LIST_STORE (model), &iter); gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), gtk_list_store_set (GTK_LIST_STORE (model),
&iter, &iter,
0, msg, 0, msg,
-1); -1);
g_free (msg); g_free (msg);
} }
cell = gtk_cell_renderer_text_new (); cell = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Messages", column = gtk_tree_view_column_new_with_attributes ("Messages",
cell, cell,
"text", 0, "text", 0,
NULL); NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
GTK_TREE_VIEW_COLUMN (column)); GTK_TREE_VIEW_COLUMN (column));
return scrolled_window; return scrolled_window;
} }
/* Add some text to our text widget - this is a callback that is invoked /* Add some text to our text widget - this is a callback that is invoked
when our window is realized. We could also force our window to be when our window is realized. We could also force our window to be
realized with gtk_widget_realize, but it would have to be part of realized with gtk_widget_realize, but it would have to be part of
@ -60,10 +60,10 @@ a hierarchy first */
static void insert_text( GtkTextBuffer *buffer ) static void insert_text( GtkTextBuffer *buffer )
{ {
GtkTextIter iter; GtkTextIter iter;
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0); gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
gtk_text_buffer_insert (buffer, &iter, gtk_text_buffer_insert (buffer, &iter,
"From: pathfinder@nasa.gov\n" "From: pathfinder@nasa.gov\n"
"To: mom@nasa.gov\n" "To: mom@nasa.gov\n"
"Subject: Made it!\n" "Subject: Made it!\n"
@ -73,7 +73,7 @@ static void insert_text( GtkTextBuffer *buffer )
"Sojourner says hi. See you soon.\n" "Sojourner says hi. See you soon.\n"
" -Path\n", -1); " -Path\n", -1);
} }
/* Create a scrolled text area that displays a "message" */ /* Create a scrolled text area that displays a "message" */
static GtkWidget *create_text( void ) static GtkWidget *create_text( void )
{ {
@ -96,7 +96,7 @@ static GtkWidget *create_text( void )
return scrolled_window; return scrolled_window;
} }
int main( int argc, int main( int argc,
char *argv[] ) char *argv[] )
{ {
@ -106,7 +106,7 @@ int main( int argc,
GtkWidget *text; GtkWidget *text;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Paned Windows"); gtk_window_set_title (GTK_WINDOW (window), "Paned Windows");
g_signal_connect (G_OBJECT (window), "destroy", g_signal_connect (G_OBJECT (window), "destroy",
@ -115,17 +115,17 @@ int main( int argc,
gtk_widget_set_size_request (GTK_WIDGET (window), 450, 400); gtk_widget_set_size_request (GTK_WIDGET (window), 450, 400);
/* create a vpaned widget and add it to our toplevel window */ /* create a vpaned widget and add it to our toplevel window */
vpaned = gtk_vpaned_new (); vpaned = gtk_vpaned_new ();
gtk_container_add (GTK_CONTAINER (window), vpaned); gtk_container_add (GTK_CONTAINER (window), vpaned);
gtk_widget_show (vpaned); gtk_widget_show (vpaned);
/* Now create the contents of the two halves of the window */ /* Now create the contents of the two halves of the window */
list = create_list (); list = create_list ();
gtk_paned_add1 (GTK_PANED (vpaned), list); gtk_paned_add1 (GTK_PANED (vpaned), list);
gtk_widget_show (list); gtk_widget_show (list);
text = create_text (); text = create_text ();
gtk_paned_add2 (GTK_PANED (vpaned), text); gtk_paned_add2 (GTK_PANED (vpaned), text);
gtk_widget_show (text); gtk_widget_show (text);

View file

@ -14,38 +14,38 @@ static gboolean progress_timeout( gpointer data )
{ {
ProgressData *pdata = (ProgressData *)data; ProgressData *pdata = (ProgressData *)data;
gdouble new_val; gdouble new_val;
if (pdata->activity_mode) if (pdata->activity_mode)
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (pdata->pbar)); gtk_progress_bar_pulse (GTK_PROGRESS_BAR (pdata->pbar));
else else
{ {
/* Calculate the value of the progress bar using the /* Calculate the value of the progress bar using the
* value range set in the adjustment object */ * value range set in the adjustment object */
new_val = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (pdata->pbar)) + 0.01; new_val = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (pdata->pbar)) + 0.01;
if (new_val > 1.0) if (new_val > 1.0)
new_val = 0.0; new_val = 0.0;
/* Set the new value */ /* Set the new value */
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (pdata->pbar), new_val); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (pdata->pbar), new_val);
} }
/* As this is a timeout function, return TRUE so that it /* As this is a timeout function, return TRUE so that it
* continues to get called */ * continues to get called */
return TRUE; return TRUE;
} }
/* Callback that toggles the text display within the progress bar trough */ /* Callback that toggles the text display within the progress bar trough */
static void toggle_show_text( GtkWidget *widget, static void toggle_show_text( GtkWidget *widget,
ProgressData *pdata ) ProgressData *pdata )
{ {
const gchar *text; const gchar *text;
text = gtk_progress_bar_get_text (GTK_PROGRESS_BAR (pdata->pbar)); text = gtk_progress_bar_get_text (GTK_PROGRESS_BAR (pdata->pbar));
if (text && *text) if (text && *text)
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (pdata->pbar), ""); gtk_progress_bar_set_text (GTK_PROGRESS_BAR (pdata->pbar), "");
else else
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (pdata->pbar), "some text"); gtk_progress_bar_set_text (GTK_PROGRESS_BAR (pdata->pbar), "some text");
} }
@ -54,24 +54,24 @@ static void toggle_activity_mode( GtkWidget *widget,
ProgressData *pdata ) ProgressData *pdata )
{ {
pdata->activity_mode = !pdata->activity_mode; pdata->activity_mode = !pdata->activity_mode;
if (pdata->activity_mode) if (pdata->activity_mode)
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (pdata->pbar)); gtk_progress_bar_pulse (GTK_PROGRESS_BAR (pdata->pbar));
else else
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (pdata->pbar), 0.0); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (pdata->pbar), 0.0);
} }
/* Callback that toggles the orientation of the progress bar */ /* Callback that toggles the orientation of the progress bar */
static void toggle_orientation( GtkWidget *widget, static void toggle_orientation( GtkWidget *widget,
ProgressData *pdata ) ProgressData *pdata )
{ {
switch (gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (pdata->pbar))) { switch (gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (pdata->pbar))) {
case GTK_PROGRESS_LEFT_TO_RIGHT: case GTK_PROGRESS_LEFT_TO_RIGHT:
gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (pdata->pbar), gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (pdata->pbar),
GTK_PROGRESS_RIGHT_TO_LEFT); GTK_PROGRESS_RIGHT_TO_LEFT);
break; break;
case GTK_PROGRESS_RIGHT_TO_LEFT: case GTK_PROGRESS_RIGHT_TO_LEFT:
gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (pdata->pbar), gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (pdata->pbar),
GTK_PROGRESS_LEFT_TO_RIGHT); GTK_PROGRESS_LEFT_TO_RIGHT);
break; break;
default:; default:;
@ -79,7 +79,7 @@ static void toggle_orientation( GtkWidget *widget,
} }
} }
/* Clean up allocated memory and remove the timer */ /* Clean up allocated memory and remove the timer */
static void destroy_progress( GtkWidget *widget, static void destroy_progress( GtkWidget *widget,
ProgressData *pdata) ProgressData *pdata)
@ -106,7 +106,7 @@ int main( int argc,
/* Allocate memory for the data that is passed to the callbacks */ /* Allocate memory for the data that is passed to the callbacks */
pdata = g_malloc (sizeof (ProgressData)); pdata = g_malloc (sizeof (ProgressData));
pdata->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); pdata->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_resizable (GTK_WINDOW (pdata->window), TRUE); gtk_window_set_resizable (GTK_WINDOW (pdata->window), TRUE);
@ -120,7 +120,7 @@ int main( int argc,
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10); gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
gtk_container_add (GTK_CONTAINER (pdata->window), vbox); gtk_container_add (GTK_CONTAINER (pdata->window), vbox);
gtk_widget_show (vbox); gtk_widget_show (vbox);
/* Create a centering alignment object */ /* Create a centering alignment object */
align = gtk_alignment_new (0.5, 0.5, 0, 0); align = gtk_alignment_new (0.5, 0.5, 0, 0);
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 5); gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 5);
@ -193,6 +193,6 @@ int main( int argc,
gtk_widget_show (pdata->window); gtk_widget_show (pdata->window);
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -75,7 +75,7 @@ static void draw_brush( GtkWidget *widget,
TRUE, TRUE,
update_rect.x, update_rect.y, update_rect.x, update_rect.y,
update_rect.width, update_rect.height); update_rect.width, update_rect.height);
gtk_widget_queue_draw_area (widget, gtk_widget_queue_draw_area (widget,
update_rect.x, update_rect.y, update_rect.x, update_rect.y,
update_rect.width, update_rect.height); update_rect.width, update_rect.height);
} }
@ -103,10 +103,10 @@ static gboolean motion_notify_event( GtkWidget *widget,
y = event->y; y = event->y;
state = event->state; state = event->state;
} }
if (state & GDK_BUTTON1_MASK && pixmap != NULL) if (state & GDK_BUTTON1_MASK && pixmap != NULL)
draw_brush (widget, x, y); draw_brush (widget, x, y);
return TRUE; return TRUE;
} }
@ -115,7 +115,7 @@ void quit ()
exit (0); exit (0);
} }
int main( int argc, int main( int argc,
char *argv[] ) char *argv[] )
{ {
GtkWidget *window; GtkWidget *window;

View file

@ -89,7 +89,7 @@ draw_brush (GtkWidget *widget, GdkInputSource source,
gdk_draw_rectangle (pixmap, gc, TRUE, gdk_draw_rectangle (pixmap, gc, TRUE,
update_rect.x, update_rect.y, update_rect.x, update_rect.y,
update_rect.width, update_rect.height); update_rect.width, update_rect.height);
gtk_widget_queue_draw_area (widget, gtk_widget_queue_draw_area (widget,
update_rect.x, update_rect.y, update_rect.x, update_rect.y,
update_rect.width, update_rect.height); update_rect.width, update_rect.height);
} }
@ -104,7 +104,7 @@ static gboolean
button_press_event (GtkWidget *widget, GdkEventButton *event) button_press_event (GtkWidget *widget, GdkEventButton *event)
{ {
print_button_press (event->device); print_button_press (event->device);
if (event->button == 1 && pixmap != NULL) { if (event->button == 1 && pixmap != NULL) {
gdouble pressure; gdouble pressure;
gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure); gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure);
@ -121,7 +121,7 @@ motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
gdouble pressure; gdouble pressure;
GdkModifierType state; GdkModifierType state;
if (event->is_hint) if (event->is_hint)
{ {
gdk_device_get_state (event->device, event->window, NULL, &state); gdk_device_get_state (event->device, event->window, NULL, &state);
gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_X, &x); gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_X, &x);
@ -135,10 +135,10 @@ motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure); gdk_event_get_axis ((GdkEvent *)event, GDK_AXIS_PRESSURE, &pressure);
state = event->state; state = event->state;
} }
if (state & GDK_BUTTON1_MASK && pixmap != NULL) if (state & GDK_BUTTON1_MASK && pixmap != NULL)
draw_brush (widget, event->device->source, x, y, pressure); draw_brush (widget, event->device->source, x, y, pressure);
return TRUE; return TRUE;
} }

View file

@ -17,9 +17,9 @@ int main( int argc,
GtkWidget *button; GtkWidget *button;
char buffer[32]; char buffer[32];
int i, j; int i, j;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
/* Create a new dialog window for the scrolled window to be /* Create a new dialog window for the scrolled window to be
* packed into. */ * packed into. */
window = gtk_dialog_new (); window = gtk_dialog_new ();
@ -28,36 +28,36 @@ int main( int argc,
gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example"); gtk_window_set_title (GTK_WINDOW (window), "GtkScrolledWindow example");
gtk_container_set_border_width (GTK_CONTAINER (window), 0); gtk_container_set_border_width (GTK_CONTAINER (window), 0);
gtk_widget_set_size_request (window, 300, 300); gtk_widget_set_size_request (window, 300, 300);
/* create a new scrolled window. */ /* create a new scrolled window. */
scrolled_window = gtk_scrolled_window_new (NULL, NULL); scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10); gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 10);
/* the policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS. /* the policy is one of GTK_POLICY AUTOMATIC, or GTK_POLICY_ALWAYS.
* GTK_POLICY_AUTOMATIC will automatically decide whether you need * GTK_POLICY_AUTOMATIC will automatically decide whether you need
* scrollbars, whereas GTK_POLICY_ALWAYS will always leave the scrollbars * scrollbars, whereas GTK_POLICY_ALWAYS will always leave the scrollbars
* there. The first one is the horizontal scrollbar, the second, * there. The first one is the horizontal scrollbar, the second,
* the vertical. */ * the vertical. */
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
/* The dialog window is created with a vbox packed into it. */ /* The dialog window is created with a vbox packed into it. */
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)->vbox), scrolled_window, gtk_box_pack_start (GTK_BOX (GTK_DIALOG(window)->vbox), scrolled_window,
TRUE, TRUE, 0); TRUE, TRUE, 0);
gtk_widget_show (scrolled_window); gtk_widget_show (scrolled_window);
/* create a table of 10 by 10 squares. */ /* create a table of 10 by 10 squares. */
table = gtk_table_new (10, 10, FALSE); table = gtk_table_new (10, 10, FALSE);
/* set the spacing to 10 on x and 10 on y */ /* set the spacing to 10 on x and 10 on y */
gtk_table_set_row_spacings (GTK_TABLE (table), 10); gtk_table_set_row_spacings (GTK_TABLE (table), 10);
gtk_table_set_col_spacings (GTK_TABLE (table), 10); gtk_table_set_col_spacings (GTK_TABLE (table), 10);
/* pack the table into the scrolled window */ /* pack the table into the scrolled window */
gtk_scrolled_window_add_with_viewport ( gtk_scrolled_window_add_with_viewport (
GTK_SCROLLED_WINDOW (scrolled_window), table); GTK_SCROLLED_WINDOW (scrolled_window), table);
gtk_widget_show (table); gtk_widget_show (table);
/* this simply creates a grid of toggle buttons on the table /* this simply creates a grid of toggle buttons on the table
* to demonstrate the scrolled window. */ * to demonstrate the scrolled window. */
for (i = 0; i < 10; i++) for (i = 0; i < 10; i++)
@ -68,26 +68,26 @@ int main( int argc,
i, i+1, j, j+1); i, i+1, j, j+1);
gtk_widget_show (button); gtk_widget_show (button);
} }
/* Add a "close" button to the bottom of the dialog */ /* Add a "close" button to the bottom of the dialog */
button = gtk_button_new_with_label ("close"); button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (G_OBJECT (button), "clicked", g_signal_connect_swapped (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_widget_destroy), G_CALLBACK (gtk_widget_destroy),
G_OBJECT (window)); G_OBJECT (window));
/* this makes it so the button is the default. */ /* this makes it so the button is the default. */
gtk_widget_set_can_default (button, TRUE); gtk_widget_set_can_default (button, TRUE);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0);
/* This grabs this button to be the default button. Simply hitting /* This grabs this button to be the default button. Simply hitting
* the "Enter" key will cause this button to activate. */ * the "Enter" key will cause this button to activate. */
gtk_widget_grab_default (button); gtk_widget_grab_default (button);
gtk_widget_show (button); gtk_widget_show (button);
gtk_widget_show (window); gtk_widget_show (window);
gtk_main(); gtk_main();
return 0; return 0;
} }

View file

@ -44,34 +44,34 @@ int main( int argc,
FILE *infile; FILE *infile;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (window, 600, 500); gtk_widget_set_size_request (window, 600, 500);
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE); gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
g_signal_connect (G_OBJECT (window), "destroy", g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (close_application), G_CALLBACK (close_application),
NULL); NULL);
gtk_window_set_title (GTK_WINDOW (window), "Text Widget Example"); gtk_window_set_title (GTK_WINDOW (window), "Text Widget Example");
gtk_container_set_border_width (GTK_CONTAINER (window), 0); gtk_container_set_border_width (GTK_CONTAINER (window), 0);
box1 = gtk_vbox_new (FALSE, 0); box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1); gtk_container_add (GTK_CONTAINER (window), box1);
gtk_widget_show (box1); gtk_widget_show (box1);
box2 = gtk_vbox_new (FALSE, 10); box2 = gtk_vbox_new (FALSE, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10); gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
gtk_widget_show (box2); gtk_widget_show (box2);
table = gtk_table_new (2, 2, FALSE); table = gtk_table_new (2, 2, FALSE);
gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2); gtk_table_set_row_spacing (GTK_TABLE (table), 0, 2);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2); gtk_table_set_col_spacing (GTK_TABLE (table), 0, 2);
gtk_box_pack_start (GTK_BOX (box2), table, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box2), table, TRUE, TRUE, 0);
gtk_widget_show (table); gtk_widget_show (table);
/* Create the GtkText widget */ /* Create the GtkText widget */
text = gtk_text_new (NULL, NULL); text = gtk_text_new (NULL, NULL);
gtk_text_set_editable (GTK_TEXT (text), TRUE); gtk_text_set_editable (GTK_TEXT (text), TRUE);
@ -104,7 +104,7 @@ int main( int argc,
/* Freeze the text widget, ready for multiple updates */ /* Freeze the text widget, ready for multiple updates */
gtk_text_freeze (GTK_TEXT (text)); gtk_text_freeze (GTK_TEXT (text));
/* Insert some colored text */ /* Insert some colored text */
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL, gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
"Supports ", -1); "Supports ", -1);
@ -114,31 +114,31 @@ int main( int argc,
"text and different ", -1); "text and different ", -1);
gtk_text_insert (GTK_TEXT (text), fixed_font, &text->style->black, NULL, gtk_text_insert (GTK_TEXT (text), fixed_font, &text->style->black, NULL,
"fonts\n\n", -1); "fonts\n\n", -1);
/* Load the file text.c into the text window */ /* Load the file text.c into the text window */
infile = fopen ("text.c", "r"); infile = fopen ("text.c", "r");
if (infile) { if (infile) {
char buffer[1024]; char buffer[1024];
int nchars; int nchars;
while (1) while (1)
{ {
nchars = fread (buffer, 1, 1024, infile); nchars = fread (buffer, 1, 1024, infile);
gtk_text_insert (GTK_TEXT (text), fixed_font, NULL, gtk_text_insert (GTK_TEXT (text), fixed_font, NULL,
NULL, buffer, nchars); NULL, buffer, nchars);
if (nchars < 1024) if (nchars < 1024)
break; break;
} }
fclose (infile); fclose (infile);
} }
/* Thaw the text widget, allowing the updates to become visible */ /* Thaw the text widget, allowing the updates to become visible */
gtk_text_thaw (GTK_TEXT (text)); gtk_text_thaw (GTK_TEXT (text));
hbox = gtk_hbutton_box_new (); hbox = gtk_hbutton_box_new ();
gtk_box_pack_start (GTK_BOX (box2), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox); gtk_widget_show (hbox);
@ -164,7 +164,7 @@ int main( int argc,
gtk_container_set_border_width (GTK_CONTAINER (box2), 10); gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
gtk_widget_show (box2); gtk_widget_show (box2);
button = gtk_button_new_with_label ("close"); button = gtk_button_new_with_label ("close");
g_signal_connect (G_OBJECT (button), "clicked", g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (close_application), G_CALLBACK (close_application),
@ -177,6 +177,6 @@ int main( int argc,
gtk_widget_show (window); gtk_widget_show (window);
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -62,13 +62,13 @@ tictactoe_get_type (void)
static void static void
tictactoe_class_init (TictactoeClass *klass) tictactoe_class_init (TictactoeClass *klass)
{ {
tictactoe_signals[TICTACTOE_SIGNAL] = g_signal_new ("tictactoe", tictactoe_signals[TICTACTOE_SIGNAL] = g_signal_new ("tictactoe",
G_TYPE_FROM_CLASS (klass), G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (TictactoeClass, tictactoe), G_STRUCT_OFFSET (TictactoeClass, tictactoe),
NULL, NULL,
NULL, NULL,
g_cclosure_marshal_VOID__VOID, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
@ -79,14 +79,14 @@ static void
tictactoe_init (Tictactoe *ttt) tictactoe_init (Tictactoe *ttt)
{ {
gint i,j; gint i,j;
gtk_table_resize (GTK_TABLE (ttt), 3, 3); gtk_table_resize (GTK_TABLE (ttt), 3, 3);
gtk_table_set_homogeneous (GTK_TABLE (ttt), TRUE); gtk_table_set_homogeneous (GTK_TABLE (ttt), TRUE);
for (i=0;i<3; i++) for (i=0;i<3; i++)
for (j=0;j<3; j++) { for (j=0;j<3; j++) {
ttt->buttons[i][j] = gtk_toggle_button_new (); ttt->buttons[i][j] = gtk_toggle_button_new ();
gtk_table_attach_defaults (GTK_TABLE (ttt), ttt->buttons[i][j], gtk_table_attach_defaults (GTK_TABLE (ttt), ttt->buttons[i][j],
i, i+1, j, j+1); i, i+1, j, j+1);
g_signal_connect (G_OBJECT (ttt->buttons[i][j]), "toggled", g_signal_connect (G_OBJECT (ttt->buttons[i][j]), "toggled",
G_CALLBACK (tictactoe_toggle), (gpointer) ttt); G_CALLBACK (tictactoe_toggle), (gpointer) ttt);
@ -101,7 +101,7 @@ tictactoe_new ()
return GTK_WIDGET (g_object_new (tictactoe_get_type (), NULL)); return GTK_WIDGET (g_object_new (tictactoe_get_type (), NULL));
} }
void void
tictactoe_clear (Tictactoe *ttt) tictactoe_clear (Tictactoe *ttt)
{ {
int i,j; int i,j;
@ -109,7 +109,7 @@ tictactoe_clear (Tictactoe *ttt)
for (i = 0; i<3; i++) for (i = 0; i<3; i++)
for (j = 0; j<3; j++) for (j = 0; j<3; j++)
{ {
g_signal_handlers_block_matched (G_OBJECT (ttt->buttons[i][j]), g_signal_handlers_block_matched (G_OBJECT (ttt->buttons[i][j]),
G_SIGNAL_MATCH_DATA, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, ttt); 0, 0, NULL, NULL, ttt);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ttt->buttons[i][j]), gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ttt->buttons[i][j]),
@ -141,15 +141,15 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt)
for (i = 0; i<3; i++) for (i = 0; i<3; i++)
{ {
success = success && success = success &&
GTK_TOGGLE_BUTTON (ttt->buttons[rwins[k][i]][cwins[k][i]])->active; GTK_TOGGLE_BUTTON (ttt->buttons[rwins[k][i]][cwins[k][i]])->active;
found = found || found = found ||
ttt->buttons[rwins[k][i]][cwins[k][i]] == widget; ttt->buttons[rwins[k][i]][cwins[k][i]] == widget;
} }
if (success && found) if (success && found)
{ {
g_signal_emit (G_OBJECT (ttt), g_signal_emit (G_OBJECT (ttt),
tictactoe_signals[TICTACTOE_SIGNAL], 0); tictactoe_signals[TICTACTOE_SIGNAL], 0);
break; break;
} }

View file

@ -40,7 +40,7 @@ typedef struct _TictactoeClass TictactoeClass;
struct _Tictactoe struct _Tictactoe
{ {
GtkTable table; GtkTable table;
GtkWidget *buttons[3][3]; GtkWidget *buttons[3][3];
}; };

View file

@ -15,20 +15,20 @@ int main( int argc,
{ {
GtkWidget *window; GtkWidget *window;
GtkWidget *ttt; GtkWidget *ttt;
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame"); gtk_window_set_title (GTK_WINDOW (window), "Aspect Frame");
g_signal_connect (G_OBJECT (window), "destroy", g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (exit), NULL); G_CALLBACK (exit), NULL);
gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_container_set_border_width (GTK_CONTAINER (window), 10);
ttt = tictactoe_new (); ttt = tictactoe_new ();
gtk_container_add (GTK_CONTAINER (window), ttt); gtk_container_add (GTK_CONTAINER (window), ttt);
gtk_widget_show (ttt); gtk_widget_show (ttt);
@ -37,9 +37,9 @@ int main( int argc,
G_CALLBACK (win), NULL); G_CALLBACK (win), NULL);
gtk_widget_show (window); gtk_widget_show (window);
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -41,7 +41,7 @@ static void cb_select_child (GtkWidget *root_tree, GtkWidget *child,
static void cb_selection_changed( GtkWidget *tree ) static void cb_selection_changed( GtkWidget *tree )
{ {
GList *i; GList *i;
g_print ("selection_change called for tree %p\n", tree); g_print ("selection_change called for tree %p\n", tree);
g_print ("selected objects are:\n"); g_print ("selected objects are:\n");
@ -85,7 +85,7 @@ int main( int argc,
gtk_widget_set_size_request (scrolled_win, 150, 200); gtk_widget_set_size_request (scrolled_win, 150, 200);
gtk_container_add (GTK_CONTAINER (window), scrolled_win); gtk_container_add (GTK_CONTAINER (window), scrolled_win);
gtk_widget_show (scrolled_win); gtk_widget_show (scrolled_win);
/* Create the root tree */ /* Create the root tree */
tree = gtk_tree_new (); tree = gtk_tree_new ();
g_print ("root tree is %p\n", tree); g_print ("root tree is %p\n", tree);
@ -132,13 +132,13 @@ int main( int argc,
subtree); subtree);
/* This is still necessary if you want these signals to be called /* This is still necessary if you want these signals to be called
for the subtree's children. Note that selection_change will be for the subtree's children. Note that selection_change will be
signalled for the root tree regardless. */ signalled for the root tree regardless. */
g_signal_connect (G_OBJECT (subtree), "select_child", g_signal_connect (G_OBJECT (subtree), "select_child",
G_CALLBACK (cb_select_child), subtree); G_CALLBACK (cb_select_child), subtree);
g_signal_connect (G_OBJECT (subtree), "unselect_child", g_signal_connect (G_OBJECT (subtree), "unselect_child",
G_CALLBACK (cb_unselect_child), subtree); G_CALLBACK (cb_unselect_child), subtree);
/* This has absolutely no effect, because it is completely ignored /* This has absolutely no effect, because it is completely ignored
in subtrees */ in subtrees */
gtk_tree_set_selection_mode (GTK_TREE (subtree), gtk_tree_set_selection_mode (GTK_TREE (subtree),
GTK_SELECTION_SINGLE); GTK_SELECTION_SINGLE);

View file

@ -137,7 +137,7 @@ int main (int argc,
GdkBitmap *mask; GdkBitmap *mask;
GtkStyle *style; GtkStyle *style;
GdkGC *gc; GdkGC *gc;
/* Create the main window, and attach delete_event signal to terminate /* Create the main window, and attach delete_event signal to terminate
* the application. Note that the main window will not have a titlebar * the application. Note that the main window will not have a titlebar
* since we're making it a popup. */ * since we're making it a popup. */
@ -165,10 +165,10 @@ int main (int argc,
/* This masks out everything except for the image itself */ /* This masks out everything except for the image itself */
gtk_widget_shape_combine_mask (window, mask, 0, 0); gtk_widget_shape_combine_mask (window, mask, 0, 0);
/* show the window */ /* show the window */
gtk_widget_show (window); gtk_widget_show (window);
gtk_main (); gtk_main ();
return 0; return 0;
} }

View file

@ -6,6 +6,6 @@ includedir=@includedir@
Name: Gail Name: Gail
Description: GNOME Accessibility Implementation Library Description: GNOME Accessibility Implementation Library
Version: @VERSION@ Version: @VERSION@
Requires: atk gtk+-2.0 Requires: atk gtk+-2.0
Libs: ${pc_top_builddir}/${pcfiledir}/modules/other/gail/libgail.la ${pc_top_builddir}/${pcfiledir}/modules/other/gail/libgail-util/libgailutil.la Libs: ${pc_top_builddir}/${pcfiledir}/modules/other/gail/libgail.la ${pc_top_builddir}/${pcfiledir}/modules/other/gail/libgail-util/libgailutil.la
Cflags: -I${pc_top_builddir}/${pcfiledir}/modules/other/gail Cflags: -I${pc_top_builddir}/${pcfiledir}/modules/other/gail

View file

@ -366,7 +366,7 @@ gdkenumtypes.c: @REBUILD@ $(gdk_public_h_sources) gdkenumtypes.c.template
&& cp xgen-getc gdkenumtypes.c \ && cp xgen-getc gdkenumtypes.c \
&& rm -f xgen-getc && rm -f xgen-getc
# #
# Marshaller generation # Marshaller generation
# #
gdkmarshalers.h: @REBUILD@ gdkmarshalers.list gdkmarshalers.h: @REBUILD@ gdkmarshalers.list

View file

@ -11,10 +11,10 @@ AM_CPPFLAGS = \
-I$(top_builddir)/gdk \ -I$(top_builddir)/gdk \
-DG_DISABLE_DEPRECATED \ -DG_DISABLE_DEPRECATED \
@GTK_DEBUG_FLAGS@ \ @GTK_DEBUG_FLAGS@ \
@GDK_DEP_CFLAGS@ @GDK_DEP_CFLAGS@
LDADDS = \ LDADDS = \
@GDK_DEP_LIBS@ @GDK_DEP_LIBS@
noinst_LTLIBRARIES = libgdk-directfb.la noinst_LTLIBRARIES = libgdk-directfb.la
@ -55,6 +55,6 @@ libgdkinclude_HEADERS = \
gdkprivate-directfb.h gdkprivate-directfb.h
EXTRA_DIST += AUTHORS README TODO EXTRA_DIST += AUTHORS README TODO
-include $(top_srcdir)/git.mk -include $(top_srcdir)/git.mk

View file

@ -1201,14 +1201,14 @@ gdk_directfb_draw_pixbuf (GdkDrawable *drawable,
GdkDrawableImplDirectFB *impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable); GdkDrawableImplDirectFB *impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
pb_n_channels = gdk_pixbuf_get_n_channels (pixbuf); pb_n_channels = gdk_pixbuf_get_n_channels (pixbuf);
pb_bits_per_sample = gdk_pixbuf_get_bits_per_sample (pixbuf); pb_bits_per_sample = gdk_pixbuf_get_bits_per_sample (pixbuf);
g_return_if_fail (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB); g_return_if_fail (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
g_return_if_fail (pb_n_channels == 3 || pb_n_channels == 4); g_return_if_fail (pb_n_channels == 3 || pb_n_channels == 4);
g_return_if_fail (pb_bits_per_sample == 8); g_return_if_fail (pb_bits_per_sample == 8);
g_return_if_fail (drawable != NULL); g_return_if_fail (drawable != NULL);
pb_width = gdk_pixbuf_get_width (pixbuf); pb_width = gdk_pixbuf_get_width (pixbuf);
@ -1216,11 +1216,11 @@ gdk_directfb_draw_pixbuf (GdkDrawable *drawable,
pb_pixels = gdk_pixbuf_get_pixels (pixbuf); pb_pixels = gdk_pixbuf_get_pixels (pixbuf);
pb_rowstride = gdk_pixbuf_get_rowstride (pixbuf); pb_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
if (width == -1) if (width == -1)
width = pb_width; width = pb_width;
if (height == -1) if (height == -1)
height = pb_height; height = pb_height;
g_return_if_fail (width >= 0 && height >= 0); g_return_if_fail (width >= 0 && height >= 0);
g_return_if_fail (src_x >= 0 && src_x + width <= pb_width); g_return_if_fail (src_x >= 0 && src_x + width <= pb_width);
g_return_if_fail (src_y >= 0 && src_y + height <= pb_height); g_return_if_fail (src_y >= 0 && src_y + height <= pb_height);
@ -1422,7 +1422,7 @@ gdk_directfb_draw_pixbuf (GdkDrawable *drawable,
pb_pixels = gdk_pixbuf_get_pixels (pixbuf); pb_pixels = gdk_pixbuf_get_pixels (pixbuf);
pb_rowstride = gdk_pixbuf_get_rowstride (pixbuf); pb_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
} }
if (pb_n_channels == 4) if (pb_n_channels == 4)
{ {
guchar *buf = pb_pixels + src_y * pb_rowstride + src_x * 4; guchar *buf = pb_pixels + src_y * pb_rowstride + src_x * 4;

View file

@ -62,9 +62,9 @@ void
_gdk_init_input_core (void) _gdk_init_input_core (void)
{ {
GdkDisplay *display = GDK_DISPLAY_OBJECT (_gdk_display); GdkDisplay *display = GDK_DISPLAY_OBJECT (_gdk_display);
_gdk_core_pointer = g_object_new (GDK_TYPE_DEVICE, NULL); _gdk_core_pointer = g_object_new (GDK_TYPE_DEVICE, NULL);
_gdk_core_pointer->name = "Core Pointer"; _gdk_core_pointer->name = "Core Pointer";
_gdk_core_pointer->source = GDK_SOURCE_MOUSE; _gdk_core_pointer->source = GDK_SOURCE_MOUSE;
_gdk_core_pointer->mode = GDK_MODE_SCREEN; _gdk_core_pointer->mode = GDK_MODE_SCREEN;

View file

@ -21,7 +21,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog * file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with * files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#include "config.h" #include "config.h"
@ -98,7 +98,7 @@ gdk_arg_debug_cb (const char *key, const char *value, gpointer user_data, GError
if (debug_value == 0 && value != NULL && strcmp (value, "") != 0) if (debug_value == 0 && value != NULL && strcmp (value, "") != 0)
{ {
g_set_error (error, g_set_error (error,
G_OPTION_ERROR, G_OPTION_ERROR_FAILED, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
_("Error parsing option --gdk-debug")); _("Error parsing option --gdk-debug"));
return FALSE; return FALSE;
@ -118,7 +118,7 @@ gdk_arg_no_debug_cb (const char *key, const char *value, gpointer user_data, GEr
if (debug_value == 0 && value != NULL && strcmp (value, "") != 0) if (debug_value == 0 && value != NULL && strcmp (value, "") != 0)
{ {
g_set_error (error, g_set_error (error,
G_OPTION_ERROR, G_OPTION_ERROR_FAILED, G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
_("Error parsing option --gdk-no-debug")); _("Error parsing option --gdk-no-debug"));
return FALSE; return FALSE;
@ -160,20 +160,20 @@ static const GOptionEntry gdk_args[] = {
/* Description of --screen=SCREEN in --help output */ N_("X screen to use"), /* Description of --screen=SCREEN in --help output */ N_("X screen to use"),
/* Placeholder in --screen=SCREEN in --help output */ N_("SCREEN") }, /* Placeholder in --screen=SCREEN in --help output */ N_("SCREEN") },
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
{ "gdk-debug", 0, 0, G_OPTION_ARG_CALLBACK, gdk_arg_debug_cb, { "gdk-debug", 0, 0, G_OPTION_ARG_CALLBACK, gdk_arg_debug_cb,
/* Description of --gdk-debug=FLAGS in --help output */ N_("GDK debugging flags to set"), /* Description of --gdk-debug=FLAGS in --help output */ N_("GDK debugging flags to set"),
/* Placeholder in --gdk-debug=FLAGS in --help output */ N_("FLAGS") }, /* Placeholder in --gdk-debug=FLAGS in --help output */ N_("FLAGS") },
{ "gdk-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, gdk_arg_no_debug_cb, { "gdk-no-debug", 0, 0, G_OPTION_ARG_CALLBACK, gdk_arg_no_debug_cb,
/* Description of --gdk-no-debug=FLAGS in --help output */ N_("GDK debugging flags to unset"), /* Description of --gdk-no-debug=FLAGS in --help output */ N_("GDK debugging flags to unset"),
/* Placeholder in --gdk-no-debug=FLAGS in --help output */ N_("FLAGS") }, /* Placeholder in --gdk-no-debug=FLAGS in --help output */ N_("FLAGS") },
#endif #endif
{ NULL } { NULL }
}; };
/** /**
* gdk_add_option_entries_libgtk_only: * gdk_add_option_entries_libgtk_only:
* @group: An option group. * @group: An option group.
* *
* Appends gdk option entries to the passed in option group. This is * Appends gdk option entries to the passed in option group. This is
* not public API and must not be used by applications. * not public API and must not be used by applications.
**/ **/
@ -195,7 +195,7 @@ gdk_pre_parse_libgtk_only (void)
gdk_progclass = g_strdup (g_get_prgname ()); gdk_progclass = g_strdup (g_get_prgname ());
if (gdk_progclass && gdk_progclass[0]) if (gdk_progclass && gdk_progclass[0])
gdk_progclass[0] = g_ascii_toupper (gdk_progclass[0]); gdk_progclass[0] = g_ascii_toupper (gdk_progclass[0]);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
{ {
gchar *debug_string = getenv("GDK_DEBUG"); gchar *debug_string = getenv("GDK_DEBUG");
@ -216,15 +216,15 @@ gdk_pre_parse_libgtk_only (void)
/* Do any setup particular to the windowing system /* Do any setup particular to the windowing system
*/ */
_gdk_windowing_init (); _gdk_windowing_init ();
} }
/** /**
* gdk_parse_args: * gdk_parse_args:
* @argc: the number of command line arguments. * @argc: the number of command line arguments.
* @argv: (inout) (array length=argc): the array of command line arguments. * @argv: (inout) (array length=argc): the array of command line arguments.
* *
* Parse command line arguments, and store for future * Parse command line arguments, and store for future
* use by calls to gdk_display_open(). * use by calls to gdk_display_open().
* *
@ -248,13 +248,13 @@ gdk_parse_args (int *argc,
return; return;
gdk_pre_parse_libgtk_only (); gdk_pre_parse_libgtk_only ();
option_context = g_option_context_new (NULL); option_context = g_option_context_new (NULL);
g_option_context_set_ignore_unknown_options (option_context, TRUE); g_option_context_set_ignore_unknown_options (option_context, TRUE);
g_option_context_set_help_enabled (option_context, FALSE); g_option_context_set_help_enabled (option_context, FALSE);
option_group = g_option_group_new (NULL, NULL, NULL, NULL, NULL); option_group = g_option_group_new (NULL, NULL, NULL, NULL, NULL);
g_option_context_set_main_group (option_context, option_group); g_option_context_set_main_group (option_context, option_group);
g_option_group_add_entries (option_group, gdk_args); g_option_group_add_entries (option_group, gdk_args);
g_option_group_add_entries (option_group, _gdk_windowing_args); g_option_group_add_entries (option_group, _gdk_windowing_args);
@ -271,7 +271,7 @@ gdk_parse_args (int *argc,
GDK_NOTE (MISC, g_message ("progname: \"%s\"", g_get_prgname ())); GDK_NOTE (MISC, g_message ("progname: \"%s\"", g_get_prgname ()));
} }
/** /**
* gdk_get_display_arg_name: * gdk_get_display_arg_name:
* *
* Gets the display name specified in the command line arguments passed * Gets the display name specified in the command line arguments passed
@ -298,13 +298,13 @@ gdk_get_display_arg_name (void)
/** /**
* gdk_display_open_default_libgtk_only: * gdk_display_open_default_libgtk_only:
* *
* Opens the default display specified by command line arguments or * Opens the default display specified by command line arguments or
* environment variables, sets it as the default display, and returns * environment variables, sets it as the default display, and returns
* it. gdk_parse_args must have been called first. If the default * it. gdk_parse_args must have been called first. If the default
* display has previously been set, simply returns that. An internal * display has previously been set, simply returns that. An internal
* function that should not be used by applications. * function that should not be used by applications.
* *
* Return value: the default display, if it could be opened, * Return value: the default display, if it could be opened,
* otherwise %NULL. * otherwise %NULL.
**/ **/
@ -314,7 +314,7 @@ gdk_display_open_default_libgtk_only (void)
GdkDisplay *display; GdkDisplay *display;
g_return_val_if_fail (gdk_initialized, NULL); g_return_val_if_fail (gdk_initialized, NULL);
display = gdk_display_get_default (); display = gdk_display_get_default ();
if (display) if (display)
return display; return display;
@ -325,14 +325,14 @@ gdk_display_open_default_libgtk_only (void)
{ {
g_free (_gdk_display_arg_name); g_free (_gdk_display_arg_name);
_gdk_display_arg_name = g_strdup (_gdk_display_name); _gdk_display_arg_name = g_strdup (_gdk_display_name);
display = gdk_display_open (_gdk_display_name); display = gdk_display_open (_gdk_display_name);
} }
if (display) if (display)
gdk_display_manager_set_default_display (gdk_display_manager_get (), gdk_display_manager_set_default_display (gdk_display_manager_get (),
display); display);
return display; return display;
} }
@ -459,7 +459,7 @@ gdk_threads_impl_unlock (void)
/** /**
* gdk_threads_init: * gdk_threads_init:
* *
* Initializes GDK so that it can be used from multiple threads * Initializes GDK so that it can be used from multiple threads
* in conjunction with gdk_threads_enter() and gdk_threads_leave(). * in conjunction with gdk_threads_enter() and gdk_threads_leave().
* g_thread_init() must be called previous to this function. * g_thread_init() must be called previous to this function.
@ -560,7 +560,7 @@ gdk_threads_dispatch_free (gpointer data)
* removed from the list of event sources and will not be called again. * removed from the list of event sources and will not be called again.
* *
* This variant of g_idle_add_full() calls @function with the GDK lock * This variant of g_idle_add_full() calls @function with the GDK lock
* held. It can be thought of a MT-safe version for GTK+ widgets for the * held. It can be thought of a MT-safe version for GTK+ widgets for the
* following use case, where you have to worry about idle_callback() * following use case, where you have to worry about idle_callback()
* running in thread A and accessing @self after it has been finalized * running in thread A and accessing @self after it has been finalized
* in thread B: * in thread B:
@ -627,13 +627,13 @@ gdk_threads_add_idle_full (gint priority,
* @function: function to call * @function: function to call
* @data: data to pass to @function * @data: data to pass to @function
* *
* A wrapper for the common usage of gdk_threads_add_idle_full() * A wrapper for the common usage of gdk_threads_add_idle_full()
* assigning the default priority, #G_PRIORITY_DEFAULT_IDLE. * assigning the default priority, #G_PRIORITY_DEFAULT_IDLE.
* *
* See gdk_threads_add_idle_full(). * See gdk_threads_add_idle_full().
* *
* Return value: the ID (greater than 0) of the event source. * Return value: the ID (greater than 0) of the event source.
* *
* Since: 2.12 * Since: 2.12
*/ */
guint guint
@ -656,8 +656,8 @@ gdk_threads_add_idle (GSourceFunc function,
* @notify: (allow-none): function to call when the timeout is removed, or %NULL * @notify: (allow-none): function to call when the timeout is removed, or %NULL
* *
* Sets a function to be called at regular intervals holding the GDK lock, * Sets a function to be called at regular intervals holding the GDK lock,
* with the given priority. The function is called repeatedly until it * with the given priority. The function is called repeatedly until it
* returns %FALSE, at which point the timeout is automatically destroyed * returns %FALSE, at which point the timeout is automatically destroyed
* and the function will not be called again. The @notify function is * and the function will not be called again. The @notify function is
* called when the timeout is destroyed. The first call to the * called when the timeout is destroyed. The first call to the
* function will be at the end of the first @interval. * function will be at the end of the first @interval.
@ -668,39 +668,39 @@ gdk_threads_add_idle (GSourceFunc function,
* timeout is recalculated based on the current time and the given interval * timeout is recalculated based on the current time and the given interval
* (it does not try to 'catch up' time lost in delays). * (it does not try to 'catch up' time lost in delays).
* *
* This variant of g_timeout_add_full() can be thought of a MT-safe version * This variant of g_timeout_add_full() can be thought of a MT-safe version
* for GTK+ widgets for the following use case: * for GTK+ widgets for the following use case:
* *
* |[ * |[
* static gboolean timeout_callback (gpointer data) * static gboolean timeout_callback (gpointer data)
* { * {
* SomeWidget *self = data; * SomeWidget *self = data;
* *
* /&ast; do stuff with self &ast;/ * /&ast; do stuff with self &ast;/
* *
* self->timeout_id = 0; * self->timeout_id = 0;
* *
* return FALSE; * return FALSE;
* } * }
* *
* static void some_widget_do_stuff_later (SomeWidget *self) * static void some_widget_do_stuff_later (SomeWidget *self)
* { * {
* self->timeout_id = g_timeout_add (timeout_callback, self) * self->timeout_id = g_timeout_add (timeout_callback, self)
* } * }
* *
* static void some_widget_finalize (GObject *object) * static void some_widget_finalize (GObject *object)
* { * {
* SomeWidget *self = SOME_WIDGET (object); * SomeWidget *self = SOME_WIDGET (object);
* *
* if (self->timeout_id) * if (self->timeout_id)
* g_source_remove (self->timeout_id); * g_source_remove (self->timeout_id);
* *
* G_OBJECT_CLASS (parent_class)->finalize (object); * G_OBJECT_CLASS (parent_class)->finalize (object);
* } * }
* ]| * ]|
* *
* Return value: the ID (greater than 0) of the event source. * Return value: the ID (greater than 0) of the event source.
* *
* Since: 2.12 * Since: 2.12
*/ */
guint guint
@ -719,10 +719,10 @@ gdk_threads_add_timeout_full (gint priority,
dispatch->data = data; dispatch->data = data;
dispatch->destroy = notify; dispatch->destroy = notify;
return g_timeout_add_full (priority, return g_timeout_add_full (priority,
interval, interval,
gdk_threads_dispatch, gdk_threads_dispatch,
dispatch, dispatch,
gdk_threads_dispatch_free); gdk_threads_dispatch_free);
} }
@ -733,11 +733,11 @@ gdk_threads_add_timeout_full (gint priority,
* @function: function to call * @function: function to call
* @data: data to pass to @function * @data: data to pass to @function
* *
* A wrapper for the common usage of gdk_threads_add_timeout_full() * A wrapper for the common usage of gdk_threads_add_timeout_full()
* assigning the default priority, #G_PRIORITY_DEFAULT. * assigning the default priority, #G_PRIORITY_DEFAULT.
* *
* See gdk_threads_add_timeout_full(). * See gdk_threads_add_timeout_full().
* *
* Return value: the ID (greater than 0) of the event source. * Return value: the ID (greater than 0) of the event source.
* *
* Since: 2.12 * Since: 2.12
@ -766,7 +766,7 @@ gdk_threads_add_timeout (guint interval,
* a good idea to use this function if you don't need finer granularity. * a good idea to use this function if you don't need finer granularity.
* *
* Return value: the ID (greater than 0) of the event source. * Return value: the ID (greater than 0) of the event source.
* *
* Since: 2.14 * Since: 2.14
*/ */
guint guint
@ -785,10 +785,10 @@ gdk_threads_add_timeout_seconds_full (gint priority,
dispatch->data = data; dispatch->data = data;
dispatch->destroy = notify; dispatch->destroy = notify;
return g_timeout_add_seconds_full (priority, return g_timeout_add_seconds_full (priority,
interval, interval,
gdk_threads_dispatch, gdk_threads_dispatch,
dispatch, dispatch,
gdk_threads_dispatch_free); gdk_threads_dispatch_free);
} }
@ -798,11 +798,11 @@ gdk_threads_add_timeout_seconds_full (gint priority,
* @function: function to call * @function: function to call
* @data: data to pass to @function * @data: data to pass to @function
* *
* A wrapper for the common usage of gdk_threads_add_timeout_seconds_full() * A wrapper for the common usage of gdk_threads_add_timeout_seconds_full()
* assigning the default priority, #G_PRIORITY_DEFAULT. * assigning the default priority, #G_PRIORITY_DEFAULT.
* *
* For details, see gdk_threads_add_timeout_full(). * For details, see gdk_threads_add_timeout_full().
* *
* Return value: the ID (greater than 0) of the event source. * Return value: the ID (greater than 0) of the event source.
* *
* Since: 2.14 * Since: 2.14

View file

@ -159,7 +159,7 @@ GType gdk_rectangle_get_type (void) G_GNUC_CONST;
#define GDK_TYPE_RECTANGLE (gdk_rectangle_get_type ()) #define GDK_TYPE_RECTANGLE (gdk_rectangle_get_type ())
/* Conversion functions between wide char and multibyte strings. /* Conversion functions between wide char and multibyte strings.
*/ */
#ifndef GDK_DISABLE_DEPRECATED #ifndef GDK_DISABLE_DEPRECATED
gchar *gdk_wcstombs (const GdkWChar *src); gchar *gdk_wcstombs (const GdkWChar *src);

View file

@ -167,12 +167,12 @@ gdk_app_launch_context_set_screen (GdkAppLaunchContext *context,
* @desktop: the number of a workspace, or -1 * @desktop: the number of a workspace, or -1
* *
* Sets the workspace on which applications will be launched when * Sets the workspace on which applications will be launched when
* using this context when running under a window manager that * using this context when running under a window manager that
* supports multiple workspaces, as described in the * supports multiple workspaces, as described in the
* <ulink url="http://www.freedesktop.org/Standards/wm-spec">Extended * <ulink url="http://www.freedesktop.org/Standards/wm-spec">Extended
* Window Manager Hints</ulink>. * Window Manager Hints</ulink>.
* *
* When the workspace is not specified or @desktop is set to -1, * When the workspace is not specified or @desktop is set to -1,
* it is up to the window manager to pick one, typically it will * it is up to the window manager to pick one, typically it will
* be the current workspace. * be the current workspace.
* *
@ -193,7 +193,7 @@ gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context,
* @timestamp: a timestamp * @timestamp: a timestamp
* *
* Sets the timestamp of @context. The timestamp should ideally * Sets the timestamp of @context. The timestamp should ideally
* be taken from the event that triggered the launch. * be taken from the event that triggered the launch.
* *
* Window managers can use this information to avoid moving the * Window managers can use this information to avoid moving the
* focus to the newly launched application when the user is busy * focus to the newly launched application when the user is busy
@ -248,15 +248,15 @@ gdk_app_launch_context_set_icon (GdkAppLaunchContext *context,
* @context: a #GdkAppLaunchContext * @context: a #GdkAppLaunchContext
* @icon_name: (allow-none): an icon name, or %NULL * @icon_name: (allow-none): an icon name, or %NULL
* *
* Sets the icon for applications that are launched with this context. * Sets the icon for applications that are launched with this context.
* The @icon_name will be interpreted in the same way as the Icon field * The @icon_name will be interpreted in the same way as the Icon field
* in desktop files. See also gdk_app_launch_context_set_icon(). * in desktop files. See also gdk_app_launch_context_set_icon().
* *
* If both @icon and @icon_name are set, the @icon_name takes priority. * If both @icon and @icon_name are set, the @icon_name takes priority.
* If neither @icon or @icon_name is set, the icon is taken from either * If neither @icon or @icon_name is set, the icon is taken from either
* the file that is passed to launched application or from the #GAppInfo * the file that is passed to launched application or from the #GAppInfo
* for the launched application itself. * for the launched application itself.
* *
* Since: 2.14 * Since: 2.14
*/ */
void void

View file

@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit /* GDK - The GIMP Drawing Kit
* Copyright (C) 2005 Red Hat, Inc. * Copyright (C) 2005 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -33,18 +33,18 @@ gdk_ensure_surface_flush (gpointer surface)
/** /**
* gdk_cairo_create: * gdk_cairo_create:
* @drawable: a #GdkDrawable * @drawable: a #GdkDrawable
* *
* Creates a Cairo context for drawing to @drawable. * Creates a Cairo context for drawing to @drawable.
* *
* <note><para> * <note><para>
* Note that due to double-buffering, Cairo contexts created * Note that due to double-buffering, Cairo contexts created
* in a GTK+ expose event handler cannot be cached and reused * in a GTK+ expose event handler cannot be cached and reused
* between different expose events. * between different expose events.
* </para></note> * </para></note>
* *
* Return value: A newly created Cairo context. Free with * Return value: A newly created Cairo context. Free with
* cairo_destroy() when you are done drawing. * cairo_destroy() when you are done drawing.
* *
* Since: 2.8 * Since: 2.8
**/ **/
cairo_t * cairo_t *
@ -53,7 +53,7 @@ gdk_cairo_create (GdkDrawable *drawable)
static const cairo_user_data_key_t key; static const cairo_user_data_key_t key;
cairo_surface_t *surface; cairo_surface_t *surface;
cairo_t *cr; cairo_t *cr;
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL); g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
surface = _gdk_drawable_ref_cairo_surface (drawable); surface = _gdk_drawable_ref_cairo_surface (drawable);
@ -61,7 +61,7 @@ gdk_cairo_create (GdkDrawable *drawable)
if (GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip) if (GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip)
GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip (drawable, cr); GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip (drawable, cr);
/* Ugly workaround for GTK not ensuring to flush surfaces before /* Ugly workaround for GTK not ensuring to flush surfaces before
* directly accessing the drawable backed by the surface. Not visible * directly accessing the drawable backed by the surface. Not visible
* on X11 (where flushing is a no-op). For details, see * on X11 (where flushing is a no-op). For details, see
@ -104,7 +104,7 @@ gdk_cairo_reset_clip (cairo_t *cr,
* gdk_cairo_set_source_color: * gdk_cairo_set_source_color:
* @cr: a #cairo_t * @cr: a #cairo_t
* @color: a #GdkColor * @color: a #GdkColor
* *
* Sets the specified #GdkColor as the source color of @cr. * Sets the specified #GdkColor as the source color of @cr.
* *
* Since: 2.8 * Since: 2.8
@ -115,7 +115,7 @@ gdk_cairo_set_source_color (cairo_t *cr,
{ {
g_return_if_fail (cr != NULL); g_return_if_fail (cr != NULL);
g_return_if_fail (color != NULL); g_return_if_fail (color != NULL);
cairo_set_source_rgb (cr, cairo_set_source_rgb (cr,
color->red / 65535., color->red / 65535.,
color->green / 65535., color->green / 65535.,
@ -126,7 +126,7 @@ gdk_cairo_set_source_color (cairo_t *cr,
* gdk_cairo_rectangle: * gdk_cairo_rectangle:
* @cr: a #cairo_t * @cr: a #cairo_t
* @rectangle: a #GdkRectangle * @rectangle: a #GdkRectangle
* *
* Adds the given rectangle to the current path of @cr. * Adds the given rectangle to the current path of @cr.
* *
* Since: 2.8 * Since: 2.8
@ -147,7 +147,7 @@ gdk_cairo_rectangle (cairo_t *cr,
* gdk_cairo_region: * gdk_cairo_region:
* @cr: a #cairo_t * @cr: a #cairo_t
* @region: a #GdkRegion * @region: a #GdkRegion
* *
* Adds the given region to the current path of @cr. * Adds the given region to the current path of @cr.
* *
* Since: 2.8 * Since: 2.8
@ -179,7 +179,7 @@ gdk_cairo_region (cairo_t *cr,
* @pixbuf: a #GdkPixbuf * @pixbuf: a #GdkPixbuf
* @pixbuf_x: X coordinate of location to place upper left corner of @pixbuf * @pixbuf_x: X coordinate of location to place upper left corner of @pixbuf
* @pixbuf_y: Y coordinate of location to place upper left corner of @pixbuf * @pixbuf_y: Y coordinate of location to place upper left corner of @pixbuf
* *
* Sets the given pixbuf as the source pattern for the Cairo context. * Sets the given pixbuf as the source pattern for the Cairo context.
* The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned * The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
* so that the origin of @pixbuf is @pixbuf_x, @pixbuf_y * so that the origin of @pixbuf is @pixbuf_x, @pixbuf_y
@ -232,14 +232,14 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
if (n_channels == 3) if (n_channels == 3)
{ {
guchar *end = p + 3 * width; guchar *end = p + 3 * width;
while (p < end) while (p < end)
{ {
#if G_BYTE_ORDER == G_LITTLE_ENDIAN #if G_BYTE_ORDER == G_LITTLE_ENDIAN
q[0] = p[2]; q[0] = p[2];
q[1] = p[1]; q[1] = p[1];
q[2] = p[0]; q[2] = p[0];
#else #else
q[1] = p[0]; q[1] = p[0];
q[2] = p[1]; q[2] = p[1];
q[3] = p[2]; q[3] = p[2];
@ -252,7 +252,7 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
{ {
guchar *end = p + 4 * width; guchar *end = p + 4 * width;
guint t1,t2,t3; guint t1,t2,t3;
#define MULT(d,c,a,t) G_STMT_START { t = c * a + 0x80; d = ((t >> 8) + t) >> 8; } G_STMT_END #define MULT(d,c,a,t) G_STMT_START { t = c * a + 0x80; d = ((t >> 8) + t) >> 8; } G_STMT_END
while (p < end) while (p < end)
@ -262,17 +262,17 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
MULT(q[1], p[1], p[3], t2); MULT(q[1], p[1], p[3], t2);
MULT(q[2], p[0], p[3], t3); MULT(q[2], p[0], p[3], t3);
q[3] = p[3]; q[3] = p[3];
#else #else
q[0] = p[3]; q[0] = p[3];
MULT(q[1], p[0], p[3], t1); MULT(q[1], p[0], p[3], t1);
MULT(q[2], p[1], p[3], t2); MULT(q[2], p[1], p[3], t2);
MULT(q[3], p[2], p[3], t3); MULT(q[3], p[2], p[3], t3);
#endif #endif
p += 4; p += 4;
q += 4; q += 4;
} }
#undef MULT #undef MULT
} }
@ -291,7 +291,7 @@ out:
* @pixmap: a #GdkPixmap * @pixmap: a #GdkPixmap
* @pixmap_x: X coordinate of location to place upper left corner of @pixmap * @pixmap_x: X coordinate of location to place upper left corner of @pixmap
* @pixmap_y: Y coordinate of location to place upper left corner of @pixmap * @pixmap_y: Y coordinate of location to place upper left corner of @pixmap
* *
* Sets the given pixmap as the source pattern for the Cairo context. * Sets the given pixmap as the source pattern for the Cairo context.
* The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned * The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
* so that the origin of @pixmap is @pixmap_x, @pixmap_y * so that the origin of @pixmap is @pixmap_x, @pixmap_y
@ -309,7 +309,7 @@ gdk_cairo_set_source_pixmap (cairo_t *cr,
double pixmap_y) double pixmap_y)
{ {
cairo_surface_t *surface; cairo_surface_t *surface;
surface = _gdk_drawable_ref_cairo_surface (GDK_DRAWABLE (pixmap)); surface = _gdk_drawable_ref_cairo_surface (GDK_DRAWABLE (pixmap));
cairo_set_source_surface (cr, surface, pixmap_x, pixmap_y); cairo_set_source_surface (cr, surface, pixmap_x, pixmap_y);
cairo_surface_destroy (surface); cairo_surface_destroy (surface);

View file

@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit /* GDK - The GIMP Drawing Kit
* Copyright (C) 2005 Red Hat, Inc. * Copyright (C) 2005 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public

View file

@ -21,7 +21,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog * file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with * files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/ */
#include "config.h" #include "config.h"
@ -66,9 +66,9 @@ gdk_colormap_unref (GdkColormap *cmap)
/** /**
* gdk_colormap_get_visual: * gdk_colormap_get_visual:
* @colormap: a #GdkColormap. * @colormap: a #GdkColormap.
* *
* Returns the visual for which a given colormap was created. * Returns the visual for which a given colormap was created.
* *
* Return value: the visual of the colormap. * Return value: the visual of the colormap.
**/ **/
GdkVisual * GdkVisual *
@ -84,11 +84,11 @@ gdk_colormap_get_visual (GdkColormap *colormap)
* @colormap: a #GdkColormap. * @colormap: a #GdkColormap.
* @colors: the new color values. * @colors: the new color values.
* @ncolors: the number of colors to change. * @ncolors: the number of colors to change.
* *
* Changes the value of the first @ncolors colors in * Changes the value of the first @ncolors colors in
* a private colormap. This function is obsolete and * a private colormap. This function is obsolete and
* should not be used. See gdk_color_change(). * should not be used. See gdk_color_change().
**/ **/
void void
gdk_colors_store (GdkColormap *colormap, gdk_colors_store (GdkColormap *colormap,
GdkColor *colors, GdkColor *colors,
@ -110,17 +110,17 @@ gdk_colors_store (GdkColormap *colormap,
/** /**
* gdk_color_copy: * gdk_color_copy:
* @color: a #GdkColor. * @color: a #GdkColor.
* *
* Makes a copy of a color structure. The result * Makes a copy of a color structure. The result
* must be freed using gdk_color_free(). * must be freed using gdk_color_free().
* *
* Return value: a copy of @color. * Return value: a copy of @color.
**/ **/
GdkColor* GdkColor*
gdk_color_copy (const GdkColor *color) gdk_color_copy (const GdkColor *color)
{ {
GdkColor *new_color; GdkColor *new_color;
g_return_val_if_fail (color != NULL, NULL); g_return_val_if_fail (color != NULL, NULL);
new_color = g_slice_new (GdkColor); new_color = g_slice_new (GdkColor);
@ -131,8 +131,8 @@ gdk_color_copy (const GdkColor *color)
/** /**
* gdk_color_free: * gdk_color_free:
* @color: a #GdkColor. * @color: a #GdkColor.
* *
* Frees a color structure created with * Frees a color structure created with
* gdk_color_copy(). * gdk_color_copy().
**/ **/
void void
@ -147,10 +147,10 @@ gdk_color_free (GdkColor *color)
* gdk_color_white: * gdk_color_white:
* @colormap: a #GdkColormap. * @colormap: a #GdkColormap.
* @color: the location to store the color. * @color: the location to store the color.
* *
* Returns the white color for a given colormap. The resulting * Returns the white color for a given colormap. The resulting
* value has already allocated been allocated. * value has already allocated been allocated.
* *
* Return value: %TRUE if the allocation succeeded. * Return value: %TRUE if the allocation succeeded.
**/ **/
gboolean gboolean
@ -179,10 +179,10 @@ gdk_color_white (GdkColormap *colormap,
* gdk_color_black: * gdk_color_black:
* @colormap: a #GdkColormap. * @colormap: a #GdkColormap.
* @color: the location to store the color. * @color: the location to store the color.
* *
* Returns the black color for a given colormap. The resulting * Returns the black color for a given colormap. The resulting
* value has already been allocated. * value has already been allocated.
* *
* Return value: %TRUE if the allocation succeeded. * Return value: %TRUE if the allocation succeeded.
**/ **/
gboolean gboolean
@ -224,7 +224,7 @@ gdk_color_black (GdkColormap *colormap,
* existing colors if the color cannot be allocated as requested. * existing colors if the color cannot be allocated as requested.
* *
* Allocates a single color from a colormap. * Allocates a single color from a colormap.
* *
* Return value: %TRUE if the allocation succeeded. * Return value: %TRUE if the allocation succeeded.
**/ **/
gboolean gboolean
@ -244,11 +244,11 @@ gdk_colormap_alloc_color (GdkColormap *colormap,
/** /**
* gdk_color_alloc: * gdk_color_alloc:
* @colormap: a #GdkColormap. * @colormap: a #GdkColormap.
* @color: The color to allocate. On return, the * @color: The color to allocate. On return, the
* <structfield>pixel</structfield> field will be filled in. * <structfield>pixel</structfield> field will be filled in.
* *
* Allocates a single color from a colormap. * Allocates a single color from a colormap.
* *
* Return value: %TRUE if the allocation succeeded. * Return value: %TRUE if the allocation succeeded.
* *
* Deprecated: 2.2: Use gdk_colormap_alloc_color() instead. * Deprecated: 2.2: Use gdk_colormap_alloc_color() instead.
@ -267,10 +267,10 @@ gdk_color_alloc (GdkColormap *colormap,
/** /**
* gdk_color_hash: * gdk_color_hash:
* @colora: a #GdkColor. * @colora: a #GdkColor.
* *
* A hash function suitable for using for a hash * A hash function suitable for using for a hash
* table that stores #GdkColor's. * table that stores #GdkColor's.
* *
* Return value: The hash function applied to @colora * Return value: The hash function applied to @colora
**/ **/
guint guint
@ -286,9 +286,9 @@ gdk_color_hash (const GdkColor *colora)
* gdk_color_equal: * gdk_color_equal:
* @colora: a #GdkColor. * @colora: a #GdkColor.
* @colorb: another #GdkColor. * @colorb: another #GdkColor.
* *
* Compares two colors. * Compares two colors.
* *
* Return value: %TRUE if the two colors compare equal * Return value: %TRUE if the two colors compare equal
**/ **/
gboolean gboolean
@ -307,7 +307,7 @@ GType
gdk_color_get_type (void) gdk_color_get_type (void)
{ {
static GType our_type = 0; static GType our_type = 0;
if (our_type == 0) if (our_type == 0)
our_type = g_boxed_type_register_static (g_intern_static_string ("GdkColor"), our_type = g_boxed_type_register_static (g_intern_static_string ("GdkColor"),
(GBoxedCopyFunc)gdk_color_copy, (GBoxedCopyFunc)gdk_color_copy,
@ -332,7 +332,7 @@ gdk_color_get_type (void)
* red, green, and blue components of the color, respectively. (White * red, green, and blue components of the color, respectively. (White
* in the four forms is '&num;fff' '&num;ffffff' '&num;fffffffff' and * in the four forms is '&num;fff' '&num;ffffff' '&num;fffffffff' and
* '&num;ffffffffffff') * '&num;ffffffffffff')
* *
* Return value: %TRUE if the parsing succeeded. * Return value: %TRUE if the parsing succeeded.
**/ **/
gboolean gboolean
@ -382,10 +382,10 @@ gdk_color_to_string (const GdkColor *color)
/** /**
* gdk_colormap_get_system: * gdk_colormap_get_system:
* *
* Gets the system's default colormap for the default screen. (See * Gets the system's default colormap for the default screen. (See
* gdk_colormap_get_system_for_screen ()) * gdk_colormap_get_system_for_screen ())
* *
* Return value: the default colormap. * Return value: the default colormap.
**/ **/
GdkColormap* GdkColormap*

Some files were not shown because too many files have changed in this diff Show more