Compare commits
99 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 923bf3c625 | |||
| d36604ae41 | |||
| 48d73e164e | |||
| 09f41f5000 | |||
| b645bb9e02 | |||
| 350757e78c | |||
| 6810564f42 | |||
| f02dedde6d | |||
| f6890e3b35 | |||
| 23fa53f1bc | |||
| de3cc27706 | |||
| 362127c33c | |||
| b6fc50c855 | |||
| 6abc52a29d | |||
| 21594f5574 | |||
| ed33a20b29 | |||
| 2b3de3dd75 | |||
| bc42bca9dd | |||
| 0532056349 | |||
| 2901695dfd | |||
| 1fe7308dd1 | |||
| b9a27c2636 | |||
| 1d4cba6876 | |||
| 69a0611391 | |||
| bb362f754a | |||
| c98ebe3165 | |||
| 2accf2fd21 | |||
| 67632a578b | |||
| d87dbd66d6 | |||
| 3f20ccd710 | |||
| a27e748586 | |||
| de280cc5c8 | |||
| b521039fc3 | |||
| 97dc802ec3 | |||
| cf0ab196fe | |||
| 7b8d2096a2 | |||
| 766b97cf5a | |||
| 0135c33e48 | |||
| 8eed87383d | |||
| a70f5ff12a | |||
| 20bc246960 | |||
| a01a4df697 | |||
| 9ae398f60e | |||
| a12a583c99 | |||
| 9a4122a130 | |||
| c981ddf92f | |||
| beb617c206 | |||
| c7a0a513f5 | |||
| 4b16b875db | |||
| dccfd423ca | |||
| 8da1c40d72 | |||
| a85fac7145 | |||
| 4d7bbd058e | |||
| 5bf51be576 | |||
| 3302114358 | |||
| 961ab2e5c1 | |||
| b1277f32de | |||
| 4bcf3e59d5 | |||
| 597a24edf6 | |||
| d2cd949ca1 | |||
| 64b8f4e039 | |||
| 47db0f0020 | |||
| 5964109ef3 | |||
| ac0ed81b6f | |||
| ffd12347be | |||
| fc2b45cb50 | |||
| 79c9a7ec5e | |||
| b89a059967 | |||
| fc72a20782 | |||
| 6748d421b6 | |||
| 87a46136b3 | |||
| 47c00c7ad4 | |||
| ce4382e444 | |||
| 74f03f97b1 | |||
| c0c10b993a | |||
| 127e8d8a1b | |||
| 9816a939b7 | |||
| 1b5b4812b9 | |||
| b20c7555fe | |||
| 33ff8e3488 | |||
| b2a5e870df | |||
| 42efae2d47 | |||
| 6919f989f7 | |||
| 82e9821dd8 | |||
| 1113402c7b | |||
| 2d2a6d2bf4 | |||
| 6fb824a0b3 | |||
| 26ae475590 | |||
| 3b35e523fd | |||
| 6c6f1b3dcd | |||
| 30c5e6fe7a | |||
| fda93a2977 | |||
| 151e5c58a8 | |||
| 32baa433b7 | |||
| b00d7d6585 | |||
| 954890278f | |||
| c07c77a489 | |||
| 85641efa08 | |||
| c43a02ba55 |
+1
-1
@@ -176,7 +176,7 @@ DISTCLEANFILES = \
|
||||
config.lt
|
||||
|
||||
distclean-local:
|
||||
if test $(srdcir) = .; then :; else \
|
||||
if test "$(srcdir)" = "."; then :; else \
|
||||
rm -f ChangeLog; \
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,3 +1,74 @@
|
||||
Overview of Changes from GTK+ 2.17.1 to 2.17.2
|
||||
==============================================
|
||||
|
||||
* GtkInfoBar: A new widget to show a transient 'message area'
|
||||
inside a content pane. The API is similar to GtkDialog and
|
||||
supports theming for different message types (warnings,
|
||||
errors, etc)
|
||||
|
||||
* GtkFileChooser:
|
||||
- Improve path bar by ellipsizing long names and preventing
|
||||
vertical size changes
|
||||
- Backup files are now hidden by default
|
||||
- GTK+ remembers the file chooser sorting state now
|
||||
|
||||
* GtkButtonBox: Implements the GtkOrientable interface now.
|
||||
|
||||
* Printing:
|
||||
- GTK+ supports printing an application-defined 'selection' now,
|
||||
in addition to usual page ranges.
|
||||
|
||||
* Changes that are relevant for theme authors:
|
||||
- The new GtkInfoBar widget uses symbolic colors for theming
|
||||
its background color depending on the message type. By default,
|
||||
it uses the same background color as tooltips. This can be turned
|
||||
off with style property.
|
||||
- The GTK+ file chooser (as well as nautilus and other users of GIO
|
||||
icon information) can now show different icons for xdg user dirs.
|
||||
The icon names are folder-documents, folder-download, folder-music,
|
||||
folder-pictures, folder-publicshare, folder-templates, folder-videos,
|
||||
with an automatic fallback to the standard folder icon.
|
||||
|
||||
* Bugs fixed:
|
||||
584021 titchy leak
|
||||
579590 gtk_entry_set_icon_from_stock should warn when invalid st...
|
||||
584125 GtkAssistant asserts if last page is GTK_ASSISTANT_PAGE_C...
|
||||
171416 Resume editing if name of new folder is "Type name of new...
|
||||
420335 Page assignment when printing 4 pages to a sheet
|
||||
161670 Bad behaviour from gtk_file_chooser_set_filename
|
||||
327152 Long names in the FileChooserDialog directory buttons sho...
|
||||
355851 File Dialog shows Backup Files
|
||||
390312 Gtk grabs keyboard on DND
|
||||
486839 Filechooser 'Places' items should not move up and down th...
|
||||
562335 Deprecate gtk_tree_view_column_get_cell_renderers and gtk...
|
||||
565317 Resulting image of GtkCellRendererPixbuf depends on order...
|
||||
565998 configure script doesn't check for cairo-xlib.pc
|
||||
580079 Better configure detection of Xinerama on Solaris
|
||||
580511 gdk_x11_atom_to_xatom_for_display translates GDK_NONE as ...
|
||||
580560 Backspace key does not go to the parent directory
|
||||
584598 GtkButtonBox silently ignores gtk_orientable_set_orientation
|
||||
584637 Missing conditionals for X11 shape extension in GdkWindow
|
||||
584805 GtkEntryCompletion selection reset when calling gtk_entry...
|
||||
584832 Duplicate the exec string returned by gtk_recent_info_get...
|
||||
585024 some gtksettings properties need extra initialisation
|
||||
585371 Add additional sizes to the font selector
|
||||
585791 use g_*gettext instead of *gettext directly
|
||||
562579 [Patch] Remove error dialog when directory does not exist
|
||||
344519 custom print ranges
|
||||
484922 Should remember the sort state of columns
|
||||
555344 consider adding a message area widget
|
||||
|
||||
* Updated translations:
|
||||
Danish
|
||||
Brazilian Portuguese
|
||||
Estonian
|
||||
Oriya
|
||||
Bengali India
|
||||
Norwegian bokmål
|
||||
Hindi
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes from GTK+ 2.17.0 to 2.17.1
|
||||
==============================================
|
||||
|
||||
|
||||
+65
-67
@@ -12,7 +12,7 @@ AC_PREREQ(2.54)
|
||||
|
||||
m4_define([gtk_major_version], [2])
|
||||
m4_define([gtk_minor_version], [17])
|
||||
m4_define([gtk_micro_version], [1])
|
||||
m4_define([gtk_micro_version], [3])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
@@ -378,6 +378,19 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
|
||||
pango >= pango_required_version dnl
|
||||
cairo >= cairo_required_version])
|
||||
|
||||
## In addition to checking that cairo is present, we also need to
|
||||
## check that the correct cairo backend is there. E.g. if the GDK
|
||||
## target is win32 we need the cairo-win32 backend and so on.
|
||||
cairo_backend=$gdktarget
|
||||
|
||||
# GDK calls the xlib backend "x11," cairo calls it "xlib." Other
|
||||
# backend names are identical.
|
||||
if test "x$cairo_backend" = "xx11"; then
|
||||
cairo_backend=xlib
|
||||
fi
|
||||
PKG_CHECK_MODULES(CAIRO_BACKEND,
|
||||
[cairo-$cairo_backend >= cairo_required_version])
|
||||
|
||||
if test "$os_win32" != yes; then
|
||||
# libtool option to control which symbols are exported
|
||||
# right now, symbols starting with _ are not exported
|
||||
@@ -1424,9 +1437,8 @@ if test "x$gdktarget" = "xx11"; then
|
||||
|
||||
# Check for shaped window extension
|
||||
|
||||
AC_CHECK_FUNC(XShapeCombineMask,
|
||||
AC_DEFINE(HAVE_SHAPE_EXT, 1,
|
||||
[Define to 1 if the XShape extension is available]))
|
||||
AC_CHECK_FUNC(XShapeCombineMask, :,
|
||||
[AC_MSG_ERROR([Shape extension not found, check your development headers])])
|
||||
|
||||
# X SYNC check
|
||||
gtk_save_CFLAGS="$CFLAGS"
|
||||
@@ -1492,54 +1504,55 @@ if test "x$gdktarget" = "xx11"; then
|
||||
gtk_save_cppflags="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $x_cflags"
|
||||
|
||||
case "$host" in
|
||||
*-*-solaris*)
|
||||
# Check for solaris
|
||||
AC_MSG_CHECKING(for Xinerama support on Solaris)
|
||||
# Check for XFree
|
||||
AC_MSG_CHECKING(for Xinerama support on XFree86)
|
||||
|
||||
have_solaris_xinerama=false
|
||||
AC_CHECK_FUNC(XineramaGetInfo,
|
||||
[AC_CHECK_HEADER(X11/extensions/xinerama.h,
|
||||
[have_solaris_xinerama=true], :,
|
||||
[#include <X11/Xlib.h>])])
|
||||
|
||||
if $have_solaris_xinerama ; then
|
||||
AC_DEFINE(HAVE_SOLARIS_XINERAMA, 1,
|
||||
[Define to 1 if solaris xinerama is available])
|
||||
AC_DEFINE(HAVE_XINERAMA, 1,
|
||||
[Define to 1 if xinerama is available])
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Check for XFree
|
||||
AC_MSG_CHECKING(for Xinerama support on XFree86)
|
||||
|
||||
have_xfree_xinerama=false
|
||||
if $PKG_CONFIG --exists xinerama ; then
|
||||
have_xfree_xinerama=true
|
||||
X_PACKAGES="$X_PACKAGES xinerama"
|
||||
else
|
||||
AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
|
||||
[AC_CHECK_HEADER(X11/extensions/Xinerama.h,
|
||||
[GTK_ADD_LIB(x_extra_libs,Xinerama)
|
||||
have_xfree_xinerama=true], :,
|
||||
[#include <X11/Xlib.h>])])
|
||||
fi
|
||||
have_xfree_xinerama=false
|
||||
if $PKG_CONFIG --exists xinerama ; then
|
||||
have_xfree_xinerama=true
|
||||
X_PACKAGES="$X_PACKAGES xinerama"
|
||||
else
|
||||
AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
|
||||
[AC_CHECK_HEADER(X11/extensions/Xinerama.h,
|
||||
[GTK_ADD_LIB(x_extra_libs,Xinerama)
|
||||
have_xfree_xinerama=true], :,
|
||||
[#include <X11/Xlib.h>])])
|
||||
fi
|
||||
|
||||
if $have_xfree_xinerama ; then
|
||||
AC_DEFINE(HAVE_XFREE_XINERAMA, 1,
|
||||
[Define to 1 if XFree Xinerama is available])
|
||||
AC_DEFINE(HAVE_XINERAMA, 1,
|
||||
[Define to 1 is Xinerama is available])
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if $have_xfree_xinerama ; then
|
||||
AC_DEFINE(HAVE_XFREE_XINERAMA, 1,
|
||||
[Define to 1 if XFree Xinerama is available])
|
||||
AC_DEFINE(HAVE_XINERAMA, 1,
|
||||
[Define to 1 is Xinerama is available])
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
case "$host" in
|
||||
*-*-solaris*)
|
||||
# Check for solaris
|
||||
AC_MSG_CHECKING(for Xinerama support on Solaris)
|
||||
|
||||
have_solaris_xinerama=false
|
||||
AC_CHECK_FUNC(XineramaGetInfo,
|
||||
[AC_CHECK_HEADER(X11/extensions/xinerama.h,
|
||||
[have_solaris_xinerama=true], :,
|
||||
[#include <X11/Xlib.h>])])
|
||||
|
||||
if $have_solaris_xinerama ; then
|
||||
AC_DEFINE(HAVE_SOLARIS_XINERAMA, 1,
|
||||
[Define to 1 if solaris xinerama is available])
|
||||
AC_DEFINE(HAVE_XINERAMA, 1,
|
||||
[Define to 1 if xinerama is available])
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
# set up things for XInput
|
||||
@@ -1645,18 +1658,7 @@ if test "x$gdktarget" = "xdirectfb"; then
|
||||
DIRECTFB_REQUIRED_VERSION=1.0.0
|
||||
AC_MSG_CHECKING(for DirectFB)
|
||||
|
||||
if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb && $PKG_CONFIG --exists cairo-directfb ; then
|
||||
AC_MSG_RESULT(found)
|
||||
GDK_EXTRA_CFLAGS="`$PKG_CONFIG --cflags cairo-directfb` $GDK_EXTRA_CFLAGS"
|
||||
GDK_EXTRA_LIBS="`$PKG_CONFIG --libs cairo-directfb` $GDK_EXTRA_LIBS"
|
||||
else
|
||||
AC_MSG_ERROR([
|
||||
*** DirectFB $DIRECTFB_REQUIRED_VERSION or newer and the cairo backend
|
||||
*** are required. The latest version of DirectFB is always available
|
||||
*** from http://www.directfb.org/.
|
||||
])
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(DIRECTFB, [directfb >= $DIRECTFB_REQUIRED_VERSION])
|
||||
AM_CONDITIONAL(USE_DIRECTFB, true)
|
||||
else
|
||||
AM_CONDITIONAL(USE_DIRECTFB, false)
|
||||
@@ -1700,13 +1702,9 @@ fi
|
||||
CFLAGS="$saved_cflags"
|
||||
LDFLAGS="$saved_ldflags"
|
||||
|
||||
GDK_PACKAGES="$PANGO_PACKAGES gio-2.0"
|
||||
if test "x$gdktarget" = "xx11"; then
|
||||
GDK_PACKAGES="$GDK_PACKAGES $X_PACKAGES cairo-xlib"
|
||||
fi
|
||||
GDK_PACKAGES="$PANGO_PACKAGES gio-2.0 $X_PACKAGES cairo-$cairo_backend"
|
||||
GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
|
||||
GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS"
|
||||
|
||||
#
|
||||
# If we aren't writing explicit dependencies, then don't put the extra libraries we need
|
||||
# into the pkg-config files
|
||||
|
||||
@@ -30,6 +30,7 @@ demos = \
|
||||
pickers.c \
|
||||
pixbufs.c \
|
||||
printing.c \
|
||||
resolution_independence.c \
|
||||
rotated_text.c \
|
||||
search_entry.c \
|
||||
sizegroup.c \
|
||||
|
||||
+108
-89
@@ -8,6 +8,8 @@
|
||||
#include "demo-common.h"
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *infobar = NULL;
|
||||
static GtkWidget *messagelabel = NULL;
|
||||
|
||||
static void
|
||||
activate_action (GtkAction *action)
|
||||
@@ -16,7 +18,7 @@ activate_action (GtkAction *action)
|
||||
const gchar *typename = G_OBJECT_TYPE_NAME (action);
|
||||
|
||||
GtkWidget *dialog;
|
||||
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
@@ -29,7 +31,7 @@ activate_action (GtkAction *action)
|
||||
"response",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
NULL);
|
||||
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
@@ -41,37 +43,32 @@ activate_radio_action (GtkAction *action, GtkRadioAction *current)
|
||||
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (current));
|
||||
gint value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (current));
|
||||
|
||||
if (active)
|
||||
if (active)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"You activated radio action: \"%s\" of type \"%s\".\n"
|
||||
"Current value: %d",
|
||||
name, typename, value);
|
||||
gchar *text;
|
||||
|
||||
/* Close dialog on user response */
|
||||
g_signal_connect (dialog,
|
||||
"response",
|
||||
G_CALLBACK (gtk_widget_destroy),
|
||||
NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
text = g_strdup_printf ("You activated radio action: \"%s\" of type \"%s\".\n"
|
||||
"Current value: %d",
|
||||
name, typename, value);
|
||||
gtk_label_set_text (GTK_LABEL (messagelabel), text);
|
||||
gtk_info_bar_set_message_type (GTK_INFO_BAR (infobar), (GtkMessageType)value);
|
||||
gtk_widget_show (infobar);
|
||||
g_free (text);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
activate_email (GtkAboutDialog *about,
|
||||
const gchar *link,
|
||||
gpointer data)
|
||||
{
|
||||
g_print ("send mail to %s\n", link);
|
||||
gchar *text;
|
||||
text = g_strdup_printf ("send mail to %s", link);
|
||||
g_print ("%s\n", text);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
activate_url (GtkAboutDialog *about,
|
||||
const gchar *link,
|
||||
gpointer data)
|
||||
@@ -147,12 +144,12 @@ about_cb (GtkAction *action,
|
||||
g_object_unref (transparent);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
GtkAction action;
|
||||
} ToolMenuAction;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
GtkActionClass parent_class;
|
||||
} ToolMenuActionClass;
|
||||
@@ -179,30 +176,30 @@ static GtkActionEntry entries[] = {
|
||||
{ "HelpMenu", NULL, "_Help" }, /* name, stock id, label */
|
||||
{ "New", GTK_STOCK_NEW, /* name, stock id */
|
||||
"_New", "<control>N", /* label, accelerator */
|
||||
"Create a new file", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
"Create a new file", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
{ "File1", NULL, /* name, stock id */
|
||||
"File1", NULL, /* label, accelerator */
|
||||
"File1", NULL, /* label, accelerator */
|
||||
"Open first file", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
G_CALLBACK (activate_action) },
|
||||
{ "Save", GTK_STOCK_SAVE, /* name, stock id */
|
||||
"_Save","<control>S", /* label, accelerator */
|
||||
"_Save","<control>S", /* label, accelerator */
|
||||
"Save current file", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
{ "SaveAs", GTK_STOCK_SAVE, /* name, stock id */
|
||||
"Save _As...", NULL, /* label, accelerator */
|
||||
"Save _As...", NULL, /* label, accelerator */
|
||||
"Save to a file", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
{ "Quit", GTK_STOCK_QUIT, /* name, stock id */
|
||||
"_Quit", "<control>Q", /* label, accelerator */
|
||||
"_Quit", "<control>Q", /* label, accelerator */
|
||||
"Quit", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
{ "About", NULL, /* name, stock id */
|
||||
"_About", "<control>A", /* label, accelerator */
|
||||
"About", /* tooltip */
|
||||
"_About", "<control>A", /* label, accelerator */
|
||||
"About", /* tooltip */
|
||||
G_CALLBACK (about_cb) },
|
||||
{ "Logo", "demo-gtk-logo", /* name, stock id */
|
||||
NULL, NULL, /* label, accelerator */
|
||||
NULL, NULL, /* label, accelerator */
|
||||
"GTK+", /* tooltip */
|
||||
G_CALLBACK (activate_action) },
|
||||
};
|
||||
@@ -211,9 +208,9 @@ static guint n_entries = G_N_ELEMENTS (entries);
|
||||
|
||||
static GtkToggleActionEntry toggle_entries[] = {
|
||||
{ "Bold", GTK_STOCK_BOLD, /* name, stock id */
|
||||
"_Bold", "<control>B", /* label, accelerator */
|
||||
"_Bold", "<control>B", /* label, accelerator */
|
||||
"Bold", /* tooltip */
|
||||
G_CALLBACK (activate_action),
|
||||
G_CALLBACK (activate_action),
|
||||
TRUE }, /* is_active */
|
||||
};
|
||||
static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
|
||||
@@ -226,13 +223,13 @@ enum {
|
||||
|
||||
static GtkRadioActionEntry color_entries[] = {
|
||||
{ "Red", NULL, /* name, stock id */
|
||||
"_Red", "<control>R", /* label, accelerator */
|
||||
"_Red", "<control>R", /* label, accelerator */
|
||||
"Blood", COLOR_RED }, /* tooltip, value */
|
||||
{ "Green", NULL, /* name, stock id */
|
||||
"_Green", "<control>G", /* label, accelerator */
|
||||
"_Green", "<control>G", /* label, accelerator */
|
||||
"Grass", COLOR_GREEN }, /* tooltip, value */
|
||||
{ "Blue", NULL, /* name, stock id */
|
||||
"_Blue", "<control>B", /* label, accelerator */
|
||||
"_Blue", "<control>B", /* label, accelerator */
|
||||
"Sky", COLOR_BLUE }, /* tooltip, value */
|
||||
};
|
||||
static guint n_color_entries = G_N_ELEMENTS (color_entries);
|
||||
@@ -245,18 +242,18 @@ enum {
|
||||
|
||||
static GtkRadioActionEntry shape_entries[] = {
|
||||
{ "Square", NULL, /* name, stock id */
|
||||
"_Square", "<control>S", /* label, accelerator */
|
||||
"_Square", "<control>S", /* label, accelerator */
|
||||
"Square", SHAPE_SQUARE }, /* tooltip, value */
|
||||
{ "Rectangle", NULL, /* name, stock id */
|
||||
"_Rectangle", "<control>R", /* label, accelerator */
|
||||
"_Rectangle", "<control>R", /* label, accelerator */
|
||||
"Rectangle", SHAPE_RECTANGLE }, /* tooltip, value */
|
||||
{ "Oval", NULL, /* name, stock id */
|
||||
"_Oval", "<control>O", /* label, accelerator */
|
||||
"Egg", SHAPE_OVAL }, /* tooltip, value */
|
||||
"_Oval", "<control>O", /* label, accelerator */
|
||||
"Egg", SHAPE_OVAL }, /* tooltip, value */
|
||||
};
|
||||
static guint n_shape_entries = G_N_ELEMENTS (shape_entries);
|
||||
|
||||
static const gchar *ui_info =
|
||||
static const gchar *ui_info =
|
||||
"<ui>"
|
||||
" <menubar name='MenuBar'>"
|
||||
" <menu action='FileMenu'>"
|
||||
@@ -288,7 +285,7 @@ static const gchar *ui_info =
|
||||
" <toolitem action='Open'>"
|
||||
" <menu action='OpenMenu'>"
|
||||
" <menuitem action='File1'/>"
|
||||
" </menu>"
|
||||
" </menu>"
|
||||
" </toolitem>"
|
||||
" <toolitem action='Quit'/>"
|
||||
" <separator action='Sep1'/>"
|
||||
@@ -308,7 +305,7 @@ static void
|
||||
register_stock_icons (void)
|
||||
{
|
||||
static gboolean registered = FALSE;
|
||||
|
||||
|
||||
if (!registered)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
@@ -320,12 +317,12 @@ register_stock_icons (void)
|
||||
"_GTK!",
|
||||
0, 0, NULL }
|
||||
};
|
||||
|
||||
|
||||
registered = TRUE;
|
||||
|
||||
/* Register our stock items */
|
||||
gtk_stock_add (items, G_N_ELEMENTS (items));
|
||||
|
||||
|
||||
/* Add our custom icon factory to the list of defaults */
|
||||
factory = gtk_icon_factory_new ();
|
||||
gtk_icon_factory_add_default (factory);
|
||||
@@ -350,7 +347,7 @@ register_stock_icons (void)
|
||||
|
||||
/* The gtk-logo-rgb icon has a white background, make it transparent */
|
||||
transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
|
||||
|
||||
|
||||
icon_set = gtk_icon_set_new_from_pixbuf (transparent);
|
||||
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
|
||||
gtk_icon_set_unref (icon_set);
|
||||
@@ -359,7 +356,7 @@ register_stock_icons (void)
|
||||
}
|
||||
else
|
||||
g_warning ("failed to load GTK logo for toolbar");
|
||||
|
||||
|
||||
/* Drop our reference to the factory, GTK will hold a reference. */
|
||||
g_object_unref (factory);
|
||||
}
|
||||
@@ -373,9 +370,9 @@ update_statusbar (GtkTextBuffer *buffer,
|
||||
gint row, col;
|
||||
gint count;
|
||||
GtkTextIter iter;
|
||||
|
||||
gtk_statusbar_pop (statusbar, 0); /* clear any previous message,
|
||||
* underflow is allowed
|
||||
|
||||
gtk_statusbar_pop (statusbar, 0); /* clear any previous message,
|
||||
* underflow is allowed
|
||||
*/
|
||||
|
||||
count = gtk_text_buffer_get_char_count (buffer);
|
||||
@@ -409,21 +406,21 @@ update_resize_grip (GtkWidget *widget,
|
||||
GdkEventWindowState *event,
|
||||
GtkStatusbar *statusbar)
|
||||
{
|
||||
if (event->changed_mask & (GDK_WINDOW_STATE_MAXIMIZED |
|
||||
if (event->changed_mask & (GDK_WINDOW_STATE_MAXIMIZED |
|
||||
GDK_WINDOW_STATE_FULLSCREEN))
|
||||
{
|
||||
gboolean maximized;
|
||||
|
||||
maximized = event->new_window_state & (GDK_WINDOW_STATE_MAXIMIZED |
|
||||
maximized = event->new_window_state & (GDK_WINDOW_STATE_MAXIMIZED |
|
||||
GDK_WINDOW_STATE_FULLSCREEN);
|
||||
gtk_statusbar_set_has_resize_grip (statusbar, !maximized);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
GtkWidget *
|
||||
do_appwindow (GtkWidget *do_widget)
|
||||
{
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *table;
|
||||
@@ -438,10 +435,10 @@ do_appwindow (GtkWidget *do_widget)
|
||||
GError *error = NULL;
|
||||
|
||||
register_stock_icons ();
|
||||
|
||||
|
||||
/* Create the toplevel window
|
||||
*/
|
||||
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
@@ -453,15 +450,15 @@ do_appwindow (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
table = gtk_table_new (1, 4, FALSE);
|
||||
|
||||
table = gtk_table_new (1, 5, FALSE);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), table);
|
||||
|
||||
|
||||
/* Create the menubar and toolbar
|
||||
*/
|
||||
|
||||
|
||||
action_group = gtk_action_group_new ("AppWindowActions");
|
||||
open_action = g_object_new (tool_menu_action_get_type (),
|
||||
open_action = g_object_new (tool_menu_action_get_type (),
|
||||
"name", "Open",
|
||||
"label", "_Open",
|
||||
"tooltip", "Open a file",
|
||||
@@ -469,30 +466,30 @@ do_appwindow (GtkWidget *do_widget)
|
||||
NULL);
|
||||
gtk_action_group_add_action (action_group, open_action);
|
||||
g_object_unref (open_action);
|
||||
gtk_action_group_add_actions (action_group,
|
||||
entries, n_entries,
|
||||
gtk_action_group_add_actions (action_group,
|
||||
entries, n_entries,
|
||||
window);
|
||||
gtk_action_group_add_toggle_actions (action_group,
|
||||
toggle_entries, n_toggle_entries,
|
||||
gtk_action_group_add_toggle_actions (action_group,
|
||||
toggle_entries, n_toggle_entries,
|
||||
NULL);
|
||||
gtk_action_group_add_radio_actions (action_group,
|
||||
color_entries, n_color_entries,
|
||||
gtk_action_group_add_radio_actions (action_group,
|
||||
color_entries, n_color_entries,
|
||||
COLOR_RED,
|
||||
G_CALLBACK (activate_radio_action),
|
||||
G_CALLBACK (activate_radio_action),
|
||||
NULL);
|
||||
gtk_action_group_add_radio_actions (action_group,
|
||||
shape_entries, n_shape_entries,
|
||||
gtk_action_group_add_radio_actions (action_group,
|
||||
shape_entries, n_shape_entries,
|
||||
SHAPE_SQUARE,
|
||||
G_CALLBACK (activate_radio_action),
|
||||
G_CALLBACK (activate_radio_action),
|
||||
NULL);
|
||||
|
||||
merge = gtk_ui_manager_new ();
|
||||
g_object_set_data_full (G_OBJECT (window), "ui-manager", merge,
|
||||
g_object_set_data_full (G_OBJECT (window), "ui-manager", merge,
|
||||
g_object_unref);
|
||||
gtk_ui_manager_insert_action_group (merge, action_group, 0);
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window),
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window),
|
||||
gtk_ui_manager_get_accel_group (merge));
|
||||
|
||||
|
||||
if (!gtk_ui_manager_add_ui_from_string (merge, ui_info, -1, &error))
|
||||
{
|
||||
g_message ("building menus failed: %s", error->message);
|
||||
@@ -502,7 +499,7 @@ do_appwindow (GtkWidget *do_widget)
|
||||
bar = gtk_ui_manager_get_widget (merge, "/MenuBar");
|
||||
gtk_widget_show (bar);
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
bar,
|
||||
bar,
|
||||
/* X direction */ /* Y direction */
|
||||
0, 1, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, 0,
|
||||
@@ -511,7 +508,7 @@ do_appwindow (GtkWidget *do_widget)
|
||||
bar = gtk_ui_manager_get_widget (merge, "/ToolBar");
|
||||
gtk_widget_show (bar);
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
bar,
|
||||
bar,
|
||||
/* X direction */ /* Y direction */
|
||||
0, 1, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, 0,
|
||||
@@ -520,6 +517,25 @@ do_appwindow (GtkWidget *do_widget)
|
||||
/* Create document
|
||||
*/
|
||||
|
||||
infobar = gtk_info_bar_new ();
|
||||
gtk_widget_set_no_show_all (infobar, TRUE);
|
||||
messagelabel = gtk_label_new ("");
|
||||
gtk_widget_show (messagelabel);
|
||||
gtk_box_pack_start (GTK_BOX (gtk_info_bar_get_content_area (GTK_INFO_BAR (infobar))),
|
||||
messagelabel,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_info_bar_add_button (GTK_INFO_BAR (infobar),
|
||||
GTK_STOCK_OK, GTK_RESPONSE_OK);
|
||||
g_signal_connect (infobar, "response",
|
||||
G_CALLBACK (gtk_widget_hide), NULL);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
infobar,
|
||||
/* X direction */ /* Y direction */
|
||||
0, 1, 2, 3,
|
||||
GTK_EXPAND | GTK_FILL, 0,
|
||||
0, 0);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
@@ -528,20 +544,21 @@ do_appwindow (GtkWidget *do_widget)
|
||||
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_IN);
|
||||
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
sw,
|
||||
/* X direction */ /* Y direction */
|
||||
0, 1, 2, 3,
|
||||
0, 1, 3, 4,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
|
||||
0, 0);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
200, 200);
|
||||
|
||||
GTK_SIZE_ONE_TWELFTH_EM (200),
|
||||
GTK_SIZE_ONE_TWELFTH_EM (200));
|
||||
|
||||
contents = gtk_text_view_new ();
|
||||
gtk_widget_grab_focus (contents);
|
||||
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw),
|
||||
contents);
|
||||
|
||||
@@ -551,7 +568,7 @@ do_appwindow (GtkWidget *do_widget)
|
||||
gtk_table_attach (GTK_TABLE (table),
|
||||
statusbar,
|
||||
/* X direction */ /* Y direction */
|
||||
0, 1, 3, 4,
|
||||
0, 1, 4, 5,
|
||||
GTK_EXPAND | GTK_FILL, 0,
|
||||
0, 0);
|
||||
|
||||
@@ -570,12 +587,12 @@ do_appwindow (GtkWidget *do_widget)
|
||||
statusbar,
|
||||
0);
|
||||
|
||||
g_signal_connect_object (window,
|
||||
"window_state_event",
|
||||
g_signal_connect_object (window,
|
||||
"window_state_event",
|
||||
G_CALLBACK (update_resize_grip),
|
||||
statusbar,
|
||||
0);
|
||||
|
||||
|
||||
update_statusbar (buffer, GTK_STATUSBAR (statusbar));
|
||||
}
|
||||
|
||||
@@ -584,9 +601,11 @@ do_appwindow (GtkWidget *do_widget)
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
infobar = NULL;
|
||||
messagelabel = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
|
||||
@@ -58,14 +58,32 @@ on_entry_changed (GtkWidget *widget, gpointer data)
|
||||
gtk_assistant_set_page_complete (assistant, current_page, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
on_unit_changed (GtkWidget *assistant,
|
||||
gpointer user_data)
|
||||
{
|
||||
int n;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *page;
|
||||
|
||||
/* update icons on all pages */
|
||||
for (n = 0; n < 3; n++)
|
||||
{
|
||||
page = gtk_assistant_get_nth_page (GTK_ASSISTANT (assistant), n);
|
||||
pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
|
||||
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), page, pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
create_page1 (GtkWidget *assistant)
|
||||
{
|
||||
GtkWidget *box, *label, *entry;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
box = gtk_hbox_new (FALSE, 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
|
||||
box = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
label = gtk_label_new ("You must fill out this entry to continue:");
|
||||
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
|
||||
@@ -91,8 +109,8 @@ create_page2 (GtkWidget *assistant)
|
||||
GtkWidget *box, *checkbutton;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
box = gtk_vbox_new (12, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
|
||||
box = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
|
||||
"even if you do not check this");
|
||||
@@ -134,7 +152,7 @@ do_assistant (GtkWidget *do_widget)
|
||||
{
|
||||
assistant = gtk_assistant_new ();
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (assistant), -1, 300);
|
||||
gtk_window_set_default_size (GTK_WINDOW (assistant), -1, GTK_SIZE_ONE_TWELFTH_EM (300));
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (assistant),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
@@ -151,6 +169,10 @@ do_assistant (GtkWidget *do_widget)
|
||||
G_CALLBACK (on_assistant_apply), NULL);
|
||||
g_signal_connect (G_OBJECT (assistant), "prepare",
|
||||
G_CALLBACK (on_assistant_prepare), NULL);
|
||||
|
||||
/* need to reset the header pixbufs to correct size when the units change */
|
||||
g_signal_connect (G_OBJECT (assistant), "unit-changed",
|
||||
G_CALLBACK (on_unit_changed), NULL);
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (assistant))
|
||||
|
||||
+24
-24
@@ -6,10 +6,10 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *
|
||||
create_bbox (gint horizontal,
|
||||
char *title,
|
||||
gint spacing,
|
||||
gint layout)
|
||||
create_bbox (gint horizontal,
|
||||
char *title,
|
||||
GtkSize spacing,
|
||||
gint layout)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *bbox;
|
||||
@@ -22,7 +22,7 @@ create_bbox (gint horizontal,
|
||||
else
|
||||
bbox = gtk_vbutton_box_new ();
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (bbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (frame), bbox);
|
||||
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout);
|
||||
@@ -61,56 +61,56 @@ do_button_box (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
main_vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), main_vbox);
|
||||
|
||||
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, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_add (GTK_CONTAINER (frame_horz), vbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "Spread", 40, GTK_BUTTONBOX_SPREAD),
|
||||
create_bbox (TRUE, "Spread", GTK_SIZE_ONE_TWELFTH_EM (40), GTK_BUTTONBOX_SPREAD),
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "Edge", 40, GTK_BUTTONBOX_EDGE),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (TRUE, "Edge", GTK_SIZE_ONE_TWELFTH_EM (40), GTK_BUTTONBOX_EDGE),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "Start", 40, GTK_BUTTONBOX_START),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (TRUE, "Start", GTK_SIZE_ONE_TWELFTH_EM (40), GTK_BUTTONBOX_START),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
create_bbox (TRUE, "End", 40, GTK_BUTTONBOX_END),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (TRUE, "End", GTK_SIZE_ONE_TWELFTH_EM (40), GTK_BUTTONBOX_END),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
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, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_add (GTK_CONTAINER (frame_vert), hbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "Spread", 30, GTK_BUTTONBOX_SPREAD),
|
||||
create_bbox (FALSE, "Spread", GTK_SIZE_ONE_TWELFTH_EM (30), GTK_BUTTONBOX_SPREAD),
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "Edge", 30, GTK_BUTTONBOX_EDGE),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (FALSE, "Edge", GTK_SIZE_ONE_TWELFTH_EM (30), GTK_BUTTONBOX_EDGE),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "Start", 30, GTK_BUTTONBOX_START),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (FALSE, "Start", GTK_SIZE_ONE_TWELFTH_EM (30), GTK_BUTTONBOX_START),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox),
|
||||
create_bbox (FALSE, "End", 30, GTK_BUTTONBOX_END),
|
||||
TRUE, TRUE, 5);
|
||||
create_bbox (FALSE, "End", GTK_SIZE_ONE_TWELFTH_EM (30), GTK_BUTTONBOX_END),
|
||||
TRUE, TRUE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
|
||||
@@ -354,8 +354,8 @@ create_frame (ChangeDisplayInfo *info,
|
||||
|
||||
*frame = gtk_frame_new (title);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (*frame), hbox);
|
||||
|
||||
scrollwin = gtk_scrolled_window_new (NULL, NULL);
|
||||
@@ -372,7 +372,7 @@ create_frame (ChangeDisplayInfo *info,
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (*tree_view));
|
||||
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
|
||||
|
||||
*button_vbox = gtk_vbox_new (FALSE, 5);
|
||||
*button_vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), *button_vbox, FALSE, FALSE, 0);
|
||||
|
||||
if (!info->size_group)
|
||||
@@ -611,15 +611,15 @@ do_changedisplay (GtkWidget *do_widget)
|
||||
"Change", GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400);
|
||||
gtk_window_set_default_size (GTK_WINDOW (info->window), GTK_SIZE_ONE_TWELFTH_EM (300), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
|
||||
g_signal_connect (info->window, "response",
|
||||
G_CALLBACK (response_cb), info);
|
||||
g_signal_connect (info->window, "destroy",
|
||||
G_CALLBACK (destroy_cb), &info);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->window)->vbox), vbox,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
@@ -207,7 +207,7 @@ do_clipboard (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
@@ -215,8 +215,8 @@ do_clipboard (GtkWidget *do_widget)
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the first entry */
|
||||
@@ -232,8 +232,8 @@ do_clipboard (GtkWidget *do_widget)
|
||||
label = gtk_label_new ("\"Paste\" will paste the text from the clipboard to the entry");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the second entry */
|
||||
@@ -249,8 +249,8 @@ do_clipboard (GtkWidget *do_widget)
|
||||
label = gtk_label_new ("Images can be transferred via the clipboard, too");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
/* Create the first image */
|
||||
|
||||
@@ -87,10 +87,10 @@ do_colorsel (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
/*
|
||||
@@ -108,7 +108,7 @@ do_colorsel (GtkWidget *do_widget)
|
||||
G_CALLBACK (expose_event_callback), NULL);
|
||||
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 200, 200);
|
||||
gtk_widget_set_size_request (da, GTK_SIZE_ONE_TWELFTH_EM (200), GTK_SIZE_ONE_TWELFTH_EM (200));
|
||||
/* set the color */
|
||||
gtk_widget_modify_bg (da, GTK_STATE_NORMAL, &color);
|
||||
|
||||
|
||||
+13
-16
@@ -11,8 +11,10 @@
|
||||
|
||||
enum
|
||||
{
|
||||
PIXBUF_COL,
|
||||
TEXT_COL
|
||||
STOCK_ID_COL,
|
||||
TEXT_COL,
|
||||
|
||||
NUM_COLUMNS,
|
||||
};
|
||||
|
||||
static gchar *
|
||||
@@ -50,7 +52,6 @@ create_stock_icon_store (void)
|
||||
};
|
||||
|
||||
GtkStockItem item;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *cellview;
|
||||
GtkTreeIter iter;
|
||||
GtkListStore *store;
|
||||
@@ -59,29 +60,25 @@ create_stock_icon_store (void)
|
||||
|
||||
cellview = gtk_cell_view_new ();
|
||||
|
||||
store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING);
|
||||
store = gtk_list_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (stock_id); i++)
|
||||
{
|
||||
if (stock_id[i])
|
||||
{
|
||||
pixbuf = gtk_widget_render_icon (cellview, stock_id[i],
|
||||
GTK_ICON_SIZE_BUTTON, NULL);
|
||||
gtk_stock_lookup (stock_id[i], &item);
|
||||
gtk_stock_lookup (stock_id[i], &item);
|
||||
label = strip_underscore (item.label);
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
PIXBUF_COL, pixbuf,
|
||||
STOCK_ID_COL, stock_id[i],
|
||||
TEXT_COL, label,
|
||||
-1);
|
||||
g_object_unref (pixbuf);
|
||||
g_free (label);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
PIXBUF_COL, NULL,
|
||||
TEXT_COL, "separator",
|
||||
-1);
|
||||
}
|
||||
@@ -343,9 +340,9 @@ do_combobox (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
/* A combobox demonstrating cell renderers, separators and
|
||||
@@ -355,7 +352,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, 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), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
|
||||
model = create_stock_icon_store ();
|
||||
@@ -366,7 +363,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer,
|
||||
"pixbuf", PIXBUF_COL,
|
||||
"stock-id", STOCK_ID_COL,
|
||||
NULL);
|
||||
|
||||
gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo),
|
||||
@@ -396,7 +393,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, 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), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
|
||||
model = create_capital_store ();
|
||||
@@ -425,7 +422,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, 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), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
|
||||
combo = gtk_combo_box_entry_new_text ();
|
||||
|
||||
@@ -148,8 +148,9 @@
|
||||
</accessibility>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="default_height">250</property>
|
||||
<property name="default_width">440</property>
|
||||
<!-- 100 mm = 10 cm ~= 4 inches -->
|
||||
<property name="default_height">100 mm</property>
|
||||
<property name="default_width">36.6667em</property>
|
||||
<property name="title">GtkBuilder demo</property>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox1">
|
||||
|
||||
+11
-11
@@ -51,16 +51,16 @@ interactive_dialog_clicked (GtkButton *button,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
NULL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
stock = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), stock, FALSE, FALSE, 0);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
|
||||
label = gtk_label_new_with_mnemonic ("_Entry 1");
|
||||
gtk_table_attach_defaults (GTK_TABLE (table),
|
||||
@@ -112,17 +112,17 @@ do_dialog (GtkWidget *do_widget)
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Dialogs");
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
frame = gtk_frame_new ("Dialogs");
|
||||
gtk_container_add (GTK_CONTAINER (window), frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
|
||||
/* Standard message dialog */
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
button = gtk_button_new_with_mnemonic ("_Message Dialog");
|
||||
g_signal_connect (button, "clicked",
|
||||
@@ -132,7 +132,7 @@ do_dialog (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), gtk_hseparator_new (), FALSE, FALSE, 0);
|
||||
|
||||
/* Interactive dialog*/
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
vbox2 = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
@@ -143,8 +143,8 @@ do_dialog (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), table, FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new_with_mnemonic ("_Entry 1");
|
||||
|
||||
@@ -245,10 +245,10 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
/*
|
||||
@@ -266,7 +266,7 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 100, 100);
|
||||
gtk_widget_set_size_request (da, GTK_SIZE_ONE_TWELFTH_EM (100), GTK_SIZE_ONE_TWELFTH_EM (100));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
@@ -288,7 +288,7 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 100, 100);
|
||||
gtk_widget_set_size_request (da, GTK_SIZE_ONE_TWELFTH_EM (100), GTK_SIZE_ONE_TWELFTH_EM (100));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
|
||||
@@ -328,11 +328,11 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Shopping list");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
@@ -365,7 +365,7 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
gtk_container_add (GTK_CONTAINER (sw), treeview);
|
||||
|
||||
/* some buttons */
|
||||
hbox = gtk_hbox_new (TRUE, 4);
|
||||
hbox = gtk_hbox_new (TRUE, GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("Add item");
|
||||
@@ -378,7 +378,7 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
G_CALLBACK (remove_item), treeview);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 320, 200);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (320), GTK_SIZE_ONE_TWELFTH_EM (200));
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
|
||||
@@ -58,9 +58,9 @@ do_entry_completion (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing <b>total</b> or <b>gnome</b> for example.");
|
||||
|
||||
@@ -32,9 +32,9 @@ do_expander (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
label = gtk_label_new ("Expander demo. Click on the triangle for details.");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
@@ -267,7 +267,7 @@ do_hypertext (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
450, 450);
|
||||
GTK_SIZE_ONE_TWELFTH_EM (450), GTK_SIZE_ONE_TWELFTH_EM (450));
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
@@ -263,7 +263,7 @@ do_iconview (GtkWidget *do_widget)
|
||||
GError *error;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (650), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
|
||||
@@ -332,10 +332,10 @@ do_images (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (cleanup_callback), NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
|
||||
@@ -173,9 +173,9 @@ do_list_store (GtkWidget *do_widget)
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).");
|
||||
@@ -206,7 +206,7 @@ do_list_store (GtkWidget *do_widget)
|
||||
add_columns (GTK_TREE_VIEW (treeview));
|
||||
|
||||
/* finish & show */
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 280, 250);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (280), GTK_SIZE_ONE_TWELFTH_EM (250));
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
|
||||
@@ -764,9 +764,9 @@ create_text (GtkTextBuffer **buffer,
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view),
|
||||
GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view),
|
||||
2);
|
||||
GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view),
|
||||
2);
|
||||
GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
}
|
||||
|
||||
return scrolled_window;
|
||||
@@ -792,7 +792,7 @@ create_tree (void)
|
||||
|
||||
gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection),
|
||||
GTK_SELECTION_BROWSE);
|
||||
gtk_widget_set_size_request (tree_view, 200, -1);
|
||||
gtk_widget_set_size_request (tree_view, GTK_SIZE_ONE_TWELFTH_EM (200), -1);
|
||||
|
||||
/* this code only supports 1 level of children. If we
|
||||
* want more we probably have to use a recursing function.
|
||||
@@ -946,6 +946,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
/* -- End of hack -- */
|
||||
|
||||
gtk_enable_resolution_independence ();
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
setup_default_icon ();
|
||||
@@ -969,7 +970,7 @@ main (int argc, char **argv)
|
||||
gtk_label_new_with_mnemonic ("_Info"));
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "title",
|
||||
"font", "Sans 18",
|
||||
"scale", PANGO_SCALE_XX_LARGE,
|
||||
NULL);
|
||||
g_object_unref (info_buffer);
|
||||
|
||||
@@ -999,9 +1000,9 @@ main (int argc, char **argv)
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
"foreground", "DarkGoldenrod4",
|
||||
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), GTK_SIZE_ONE_TWELFTH_EM (600), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
|
||||
|
||||
@@ -179,8 +179,8 @@ do_menus (GtkWidget *do_widget)
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
box2 = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ create_pane_options (GtkPaned *paned,
|
||||
GtkWidget *check_button;
|
||||
|
||||
frame = gtk_frame_new (frame_label);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (frame), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
|
||||
table = gtk_table_new (3, 2, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
@@ -138,14 +138,14 @@ do_panes (GtkWidget *do_widget)
|
||||
|
||||
vpaned = gtk_vpaned_new ();
|
||||
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), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
hpaned = gtk_hpaned_new ();
|
||||
gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
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, GTK_SIZE_ONE_TWELFTH_EM (60), GTK_SIZE_ONE_TWELFTH_EM (60));
|
||||
gtk_paned_add1 (GTK_PANED (hpaned), frame);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Hi there");
|
||||
@@ -153,12 +153,12 @@ do_panes (GtkWidget *do_widget)
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_size_request (frame, 80, 60);
|
||||
gtk_widget_set_size_request (frame, GTK_SIZE_ONE_TWELFTH_EM (80), GTK_SIZE_ONE_TWELFTH_EM (60));
|
||||
gtk_paned_add2 (GTK_PANED (hpaned), frame);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
|
||||
gtk_widget_set_size_request (frame, 60, 80);
|
||||
gtk_widget_set_size_request (frame, GTK_SIZE_ONE_TWELFTH_EM (60), GTK_SIZE_ONE_TWELFTH_EM (80));
|
||||
gtk_paned_add2 (GTK_PANED (vpaned), frame);
|
||||
|
||||
/* Now create toggle buttons to control sizing */
|
||||
|
||||
@@ -18,19 +18,20 @@ do_pickers (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Pickers");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
table = gtk_table_new (4, 2, FALSE);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
|
||||
gtk_table_set_col_spacing (GTK_TABLE (table), 0, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (3));
|
||||
gtk_container_add (GTK_CONTAINER (window), table);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
|
||||
label = gtk_label_new ("Color:");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
/* Resolution Independence
|
||||
*
|
||||
* This demonstates resolution independence features available since
|
||||
* version 2.14 of GTK+. Use the slider to change the effective DPI
|
||||
* per monitor. Note that the changes will only affect windows from
|
||||
* this process.
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
#include "config.h"
|
||||
#include "demo-common.h"
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWindowGroup *window_group = NULL;
|
||||
static GtkWidget *hscale;
|
||||
static GtkWidget *label;
|
||||
static GtkWidget *button;
|
||||
static gdouble button_dpi;
|
||||
|
||||
#define INCHES_TO_MM 25.4
|
||||
|
||||
#define MIN_DPI 24.0
|
||||
#define MAX_DPI 480.0
|
||||
#define STEP_DPI 1.0
|
||||
|
||||
static void
|
||||
update (void)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
gint monitor_num;
|
||||
char *plug_name;
|
||||
char *s;
|
||||
gdouble dpi;
|
||||
char *font_name;
|
||||
GtkSettings *settings;
|
||||
int width_mm;
|
||||
int height_mm;
|
||||
GdkRectangle geometry;
|
||||
|
||||
plug_name = NULL;
|
||||
font_name = NULL;
|
||||
width_mm = -1;
|
||||
height_mm = -1;
|
||||
geometry.x = -1;
|
||||
geometry.y = -1;
|
||||
geometry.width = -1;
|
||||
geometry.height = -1;
|
||||
|
||||
screen = gtk_window_get_screen (GTK_WINDOW (window));
|
||||
monitor_num = gtk_widget_get_monitor_num (window);
|
||||
if (screen != NULL && monitor_num >= 0)
|
||||
{
|
||||
plug_name = gdk_screen_get_monitor_plug_name (screen, monitor_num);
|
||||
width_mm = gdk_screen_get_monitor_width_mm (screen, monitor_num);
|
||||
height_mm = gdk_screen_get_monitor_height_mm (screen, monitor_num);
|
||||
gdk_screen_get_monitor_geometry (screen, monitor_num, &geometry);
|
||||
}
|
||||
if (screen != NULL)
|
||||
settings = gtk_settings_get_for_screen (screen);
|
||||
else
|
||||
settings = gtk_settings_get_default ();
|
||||
g_object_get (settings, "gtk-font-name", &font_name, NULL);
|
||||
|
||||
s = g_strdup_printf ("Monitor %d (%s) @ %dx%d+%d+%d\n"
|
||||
"%d mm x %d mm\n"
|
||||
"DPI: %.1f x %.1f\n"
|
||||
"Font \"%s\"\n"
|
||||
"1 em -> %g pixels\n"
|
||||
"1 mm -> %g pixels",
|
||||
monitor_num,
|
||||
plug_name != NULL ? plug_name : "unknown name",
|
||||
geometry.width, geometry.height, geometry.x, geometry.y,
|
||||
width_mm, height_mm,
|
||||
INCHES_TO_MM * geometry.width / width_mm,
|
||||
INCHES_TO_MM * geometry.height / height_mm,
|
||||
font_name,
|
||||
gtk_size_to_pixel_double (screen, monitor_num, gtk_size_em (1.0)),
|
||||
gtk_size_to_pixel_double (screen, monitor_num, gtk_size_mm (1.0)));
|
||||
gtk_label_set_text (GTK_LABEL (label), s);
|
||||
g_free (s);
|
||||
|
||||
button_dpi = MIN (INCHES_TO_MM * geometry.width / width_mm,
|
||||
INCHES_TO_MM * geometry.height / height_mm);
|
||||
s = g_strdup_printf ("Set DPI to %.1f", button_dpi);
|
||||
gtk_button_set_label (GTK_BUTTON (button), s);
|
||||
g_free (s);
|
||||
|
||||
dpi = -1;
|
||||
if (screen != NULL)
|
||||
{
|
||||
dpi = gdk_screen_get_resolution_for_monitor (screen, monitor_num);
|
||||
gtk_range_set_value (GTK_RANGE (hscale), dpi);
|
||||
}
|
||||
|
||||
g_free (plug_name);
|
||||
g_free (font_name);
|
||||
}
|
||||
|
||||
static void
|
||||
window_mapped (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
update ();
|
||||
}
|
||||
|
||||
static void
|
||||
unit_changed (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
update ();
|
||||
}
|
||||
|
||||
static void
|
||||
monitor_num_notify (GtkWindow *window, GParamSpec *psec, gpointer user_data)
|
||||
{
|
||||
g_debug ("notify::monitor-num");
|
||||
update ();
|
||||
}
|
||||
|
||||
static void
|
||||
update_value (void)
|
||||
{
|
||||
gdouble slider_value;
|
||||
|
||||
slider_value = gtk_range_get_value (GTK_RANGE (hscale));
|
||||
if (slider_value >= MIN_DPI && slider_value <= MAX_DPI)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
gint monitor_num;
|
||||
|
||||
screen = gtk_window_get_screen (GTK_WINDOW (window));
|
||||
monitor_num = gtk_widget_get_monitor_num (window);
|
||||
if (screen != NULL && monitor_num >= 0)
|
||||
{
|
||||
gdk_screen_set_resolution_for_monitor (screen, monitor_num, slider_value);
|
||||
g_signal_emit_by_name (screen, "monitors-changed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean is_pressed = FALSE;
|
||||
|
||||
static gboolean
|
||||
hscale_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
||||
{
|
||||
is_pressed = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
hscale_button_release_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
||||
{
|
||||
is_pressed = FALSE;
|
||||
update_value ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
hscale_value_changed (GtkRange *range, gpointer user_data)
|
||||
{
|
||||
if (!is_pressed)
|
||||
update_value ();
|
||||
}
|
||||
|
||||
static char *
|
||||
hscale_format_value (GtkScale *scale, gdouble value, gpointer user_data)
|
||||
{
|
||||
return g_strdup_printf ("%g DPI", value);
|
||||
}
|
||||
|
||||
static void
|
||||
dpi_button_clicked (GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_range_set_value (GTK_RANGE (hscale), button_dpi);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_resolution_independence (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
|
||||
if (window != NULL)
|
||||
goto have_window;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Resolution Independence");
|
||||
gtk_window_set_icon_name (GTK_WINDOW (window), "gtk-fullscreen");
|
||||
|
||||
g_signal_connect (G_OBJECT (window), "map", G_CALLBACK (window_mapped), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "notify::monitor-num", G_CALLBACK (monitor_num_notify), NULL);
|
||||
g_signal_connect (G_OBJECT (window), "unit-changed", G_CALLBACK (unit_changed), NULL);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, gtk_size_em (1));
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||
|
||||
hscale = gtk_hscale_new_with_range (MIN_DPI, MAX_DPI, STEP_DPI);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hscale, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect (G_OBJECT (hscale), "value-changed", G_CALLBACK (hscale_value_changed), NULL);
|
||||
g_signal_connect (G_OBJECT (hscale), "button-press-event", G_CALLBACK (hscale_button_press_event), NULL);
|
||||
g_signal_connect (G_OBJECT (hscale), "button-release-event", G_CALLBACK (hscale_button_release_event), NULL);
|
||||
g_signal_connect (G_OBJECT (hscale), "format-value", G_CALLBACK (hscale_format_value), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), gtk_size_em (1));
|
||||
gtk_widget_set_size_request (window, GTK_SIZE_ONE_TWELFTH_EM (500), -1);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
|
||||
button = gtk_button_new ();
|
||||
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (dpi_button_clicked), NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
/* avoid dialogs (e.g. printing) grabbing focus from us */
|
||||
if (window_group == NULL)
|
||||
window_group = gtk_window_group_new ();
|
||||
gtk_window_group_add_window (window_group, GTK_WINDOW (window));
|
||||
|
||||
/* make sure we're on top */
|
||||
gtk_window_set_keep_above (GTK_WINDOW (window), TRUE);
|
||||
|
||||
have_window:
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
{
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -189,7 +189,8 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Rotated Text");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 4 * RADIUS, 2 * RADIUS);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
gtk_size_em ((4 * RADIUS)), gtk_size_em ((4 * RADIUS)));
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
box = gtk_hbox_new (TRUE, 0);
|
||||
@@ -207,7 +208,6 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
G_CALLBACK (rotated_text_expose_event), NULL);
|
||||
|
||||
/* And a label */
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
|
||||
@@ -115,9 +115,9 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 5);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
|
||||
@@ -127,9 +127,9 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 5);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
|
||||
add_row (GTK_TABLE (table), 0, size_group, "_Foreground", color_options);
|
||||
@@ -141,9 +141,9 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), 5);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
|
||||
add_row (GTK_TABLE (table), 0, size_group, "_Dashing", dash_options);
|
||||
|
||||
@@ -420,12 +420,12 @@ do_stock_browser (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Stock Icons and Items");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), -1, 500);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), -1, GTK_SIZE_ONE_TWELFTH_EM (500));
|
||||
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 8);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
@@ -494,8 +494,8 @@ do_stock_browser (GtkWidget *do_widget)
|
||||
frame = gtk_frame_new ("Selected Item");
|
||||
gtk_container_add (GTK_CONTAINER (align), frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
|
||||
display = g_new (StockItemDisplay, 1);
|
||||
|
||||
@@ -182,9 +182,9 @@ do_textscroll (GtkWidget *do_widget)
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (600), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
|
||||
hbox = gtk_hbox_new (TRUE, 6);
|
||||
hbox = gtk_hbox_new (TRUE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
create_text_view (hbox, TRUE);
|
||||
|
||||
+13
-10
@@ -114,7 +114,7 @@ create_tags (GtkTextBuffer *buffer)
|
||||
"justification", GTK_JUSTIFY_RIGHT, NULL);
|
||||
|
||||
gtk_text_buffer_create_tag (buffer, "wide_margins",
|
||||
"left_margin", 50, "right_margin", 50,
|
||||
"left_margin", GTK_SIZE_ONE_TWELFTH_EM (50), "right_margin", GTK_SIZE_ONE_TWELFTH_EM (50),
|
||||
NULL);
|
||||
|
||||
gtk_text_buffer_create_tag (buffer, "strikethrough",
|
||||
@@ -139,9 +139,9 @@ create_tags (GtkTextBuffer *buffer)
|
||||
gtk_text_buffer_create_tag (buffer, "rtl_quote",
|
||||
"wrap_mode", GTK_WRAP_WORD,
|
||||
"direction", GTK_TEXT_DIR_RTL,
|
||||
"indent", 30,
|
||||
"left_margin", 20,
|
||||
"right_margin", 20,
|
||||
"indent", GTK_SIZE_ONE_TWELFTH_EM (30),
|
||||
"left_margin", GTK_SIZE_ONE_TWELFTH_EM (20),
|
||||
"right_margin", GTK_SIZE_ONE_TWELFTH_EM (20),
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -173,7 +173,10 @@ insert_text (GtkTextBuffer *buffer)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
scaled = gdk_pixbuf_scale_simple (pixbuf, 32, 32, GDK_INTERP_BILINEAR);
|
||||
scaled = gdk_pixbuf_scale_simple (pixbuf,
|
||||
gtk_size_to_pixel (NULL, 0, GTK_SIZE_ONE_TWELFTH_EM (32)),
|
||||
gtk_size_to_pixel (NULL, 0, GTK_SIZE_ONE_TWELFTH_EM (32)),
|
||||
GDK_INTERP_BILINEAR);
|
||||
g_object_unref (pixbuf);
|
||||
pixbuf = scaled;
|
||||
|
||||
@@ -409,7 +412,7 @@ attach_widgets (GtkTextView *text_view)
|
||||
{
|
||||
widget = gtk_hscale_new (NULL);
|
||||
gtk_range_set_range (GTK_RANGE (widget), 0, 100);
|
||||
gtk_widget_set_size_request (widget, 70, -1);
|
||||
gtk_widget_set_size_request (widget, GTK_SIZE_ONE_TWELFTH_EM (70), -1);
|
||||
}
|
||||
else if (i == 3)
|
||||
{
|
||||
@@ -454,7 +457,7 @@ do_textview (GtkWidget *do_widget)
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
450, 450);
|
||||
GTK_SIZE_ONE_TWELFTH_EM (450), GTK_SIZE_ONE_TWELFTH_EM (450));
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
@@ -463,7 +466,7 @@ do_textview (GtkWidget *do_widget)
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
vpaned = gtk_vpaned_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER(vpaned), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_container_add (GTK_CONTAINER (window), vpaned);
|
||||
|
||||
/* For convenience, we just use the autocreated buffer from
|
||||
@@ -534,7 +537,7 @@ recursive_attach_view (int depth,
|
||||
gtk_widget_modify_bg (event_box, GTK_STATE_NORMAL, &color);
|
||||
|
||||
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), GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (event_box), align);
|
||||
gtk_container_add (GTK_CONTAINER (align), child_view);
|
||||
@@ -590,7 +593,7 @@ easter_egg_callback (GtkWidget *button,
|
||||
window_ptr = &window;
|
||||
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), GTK_SIZE_ONE_TWELFTH_EM (300), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ add_columns (GtkTreeView *treeview)
|
||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), GTK_SIZE_ONE_TWELFTH_EM (50));
|
||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||
|
||||
/* havoc column */
|
||||
@@ -313,7 +313,7 @@ add_columns (GtkTreeView *treeview)
|
||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), GTK_SIZE_ONE_TWELFTH_EM (50));
|
||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||
|
||||
/* tim column */
|
||||
@@ -336,7 +336,7 @@ add_columns (GtkTreeView *treeview)
|
||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), GTK_SIZE_ONE_TWELFTH_EM (50));
|
||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||
|
||||
/* owen column */
|
||||
@@ -358,7 +358,7 @@ add_columns (GtkTreeView *treeview)
|
||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), GTK_SIZE_ONE_TWELFTH_EM (50));
|
||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||
|
||||
/* dave column */
|
||||
@@ -380,7 +380,7 @@ add_columns (GtkTreeView *treeview)
|
||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||
gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column),
|
||||
GTK_TREE_VIEW_COLUMN_FIXED);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), 50);
|
||||
gtk_tree_view_column_set_fixed_width (GTK_TREE_VIEW_COLUMN (column), GTK_SIZE_ONE_TWELFTH_EM (50));
|
||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||
}
|
||||
|
||||
@@ -402,8 +402,8 @@ do_tree_store (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
@@ -435,7 +435,7 @@ do_tree_store (GtkWidget *do_widget)
|
||||
/* expand all rows after the treeview widget has been realized */
|
||||
g_signal_connect (treeview, "realize",
|
||||
G_CALLBACK (gtk_tree_view_expand_all), NULL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), GTK_SIZE_ONE_TWELFTH_EM (50), GTK_SIZE_ONE_TWELFTH_EM (400));
|
||||
}
|
||||
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
|
||||
@@ -204,7 +204,7 @@ do_ui_manager (GtkWidget *do_widget)
|
||||
FALSE, FALSE, 0);
|
||||
|
||||
label = gtk_label_new ("Type\n<alt>\nto start");
|
||||
gtk_widget_set_size_request (label, 200, 200);
|
||||
gtk_widget_set_size_request (label, GTK_SIZE_ONE_TWELFTH_EM (200), GTK_SIZE_ONE_TWELFTH_EM (200));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (box1), label, TRUE, TRUE, 0);
|
||||
|
||||
@@ -213,8 +213,8 @@ do_ui_manager (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
|
||||
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
box2 = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), GTK_SIZE_ONE_TWELFTH_EM (10));
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
|
||||
|
||||
button = gtk_button_new_with_label ("close");
|
||||
|
||||
@@ -225,8 +225,12 @@ gdk_screen_broadcast_client_message
|
||||
gdk_screen_get_setting
|
||||
gdk_screen_get_font_options
|
||||
gdk_screen_set_font_options
|
||||
gdk_screen_get_font_options_for_monitor
|
||||
gdk_screen_set_font_options_for_monitor
|
||||
gdk_screen_get_resolution
|
||||
gdk_screen_set_resolution
|
||||
gdk_screen_get_resolution_for_monitor
|
||||
gdk_screen_set_resolution_for_monitor
|
||||
gdk_screen_get_active_window
|
||||
gdk_screen_get_window_stack
|
||||
<SUBSECTION Spawning>
|
||||
@@ -874,6 +878,7 @@ gdk_pango_renderer_set_stipple
|
||||
gdk_pango_renderer_set_override_color
|
||||
gdk_pango_context_get
|
||||
gdk_pango_context_get_for_screen
|
||||
gdk_pango_context_get_for_screen_for_monitor
|
||||
gdk_pango_context_set_colormap
|
||||
GdkPangoAttrEmbossed
|
||||
GdkPangoAttrEmbossColor
|
||||
|
||||
@@ -345,7 +345,10 @@ HTML_IMAGES = \
|
||||
$(srcdir)/images/layout-rlbt.png \
|
||||
$(srcdir)/images/layout-rltb.png \
|
||||
$(srcdir)/images/layout-tblr.png \
|
||||
$(srcdir)/images/layout-tbrl.png
|
||||
$(srcdir)/images/layout-tbrl.png \
|
||||
$(srcdir)/images/gtk-ri-file-chooser-size-6.png \
|
||||
$(srcdir)/images/gtk-ri-file-chooser-size-12.png \
|
||||
$(srcdir)/images/gtk-ri-file-chooser-size-24.png
|
||||
|
||||
# Extra options to supply to gtkdoc-fixref
|
||||
FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html \
|
||||
|
||||
@@ -126,6 +126,7 @@ that is, GUI components such as #GtkButton or #GtkTextView.
|
||||
<xi:include href="xml/gtktypeutils.xml" />
|
||||
<xi:include href="xml/gtktesting.xml" />
|
||||
<xi:include href="xml/filesystem.xml" />
|
||||
<xi:include href="xml/gtksize.xml" />
|
||||
</part>
|
||||
|
||||
<part id="gtkobjects">
|
||||
@@ -159,6 +160,7 @@ that is, GUI components such as #GtkButton or #GtkTextView.
|
||||
<xi:include href="xml/gtklabel.xml" />
|
||||
<xi:include href="xml/gtkprogressbar.xml" />
|
||||
<xi:include href="xml/gtkstatusbar.xml" />
|
||||
<xi:include href="xml/gtkinfobar.xml" />
|
||||
<xi:include href="xml/gtkstatusicon.xml" />
|
||||
</chapter>
|
||||
|
||||
|
||||
@@ -328,6 +328,7 @@ GtkAlignment
|
||||
gtk_alignment_new
|
||||
gtk_alignment_set
|
||||
gtk_alignment_get_padding
|
||||
gtk_alignment_get_padding_unit
|
||||
gtk_alignment_set_padding
|
||||
<SUBSECTION Standard>
|
||||
GTK_ALIGNMENT
|
||||
@@ -471,9 +472,11 @@ gtk_box_pack_end_defaults
|
||||
gtk_box_get_homogeneous
|
||||
gtk_box_set_homogeneous
|
||||
gtk_box_get_spacing
|
||||
gtk_box_get_spacing_unit
|
||||
gtk_box_set_spacing
|
||||
gtk_box_reorder_child
|
||||
gtk_box_query_child_packing
|
||||
gtk_box_query_child_packing_unit
|
||||
gtk_box_set_child_packing
|
||||
<SUBSECTION Standard>
|
||||
GTK_BOX
|
||||
@@ -1033,6 +1036,7 @@ gtk_container_unset_focus_chain
|
||||
gtk_container_class_find_child_property
|
||||
gtk_container_class_install_child_property
|
||||
gtk_container_class_list_child_properties
|
||||
gtk_container_get_border_width_unit
|
||||
<SUBSECTION Standard>
|
||||
GTK_CONTAINER
|
||||
GTK_IS_CONTAINER
|
||||
@@ -1414,6 +1418,7 @@ gtk_expander_set_expanded
|
||||
gtk_expander_get_expanded
|
||||
gtk_expander_set_spacing
|
||||
gtk_expander_get_spacing
|
||||
gtk_expander_get_spacing_unit
|
||||
gtk_expander_set_label
|
||||
gtk_expander_get_label
|
||||
gtk_expander_set_use_underline
|
||||
@@ -1931,14 +1936,19 @@ gtk_icon_view_set_columns
|
||||
gtk_icon_view_get_columns
|
||||
gtk_icon_view_set_item_width
|
||||
gtk_icon_view_get_item_width
|
||||
gtk_icon_view_get_item_width_unit
|
||||
gtk_icon_view_set_spacing
|
||||
gtk_icon_view_get_spacing
|
||||
gtk_icon_view_get_spacing_unit
|
||||
gtk_icon_view_set_row_spacing
|
||||
gtk_icon_view_get_row_spacing
|
||||
gtk_icon_view_get_row_spacing_unit
|
||||
gtk_icon_view_set_column_spacing
|
||||
gtk_icon_view_get_column_spacing
|
||||
gtk_icon_view_get_column_spacing_unit
|
||||
gtk_icon_view_set_margin
|
||||
gtk_icon_view_get_margin
|
||||
gtk_icon_view_get_margin_unit
|
||||
gtk_icon_view_select_path
|
||||
gtk_icon_view_unselect_path
|
||||
gtk_icon_view_path_is_selected
|
||||
@@ -2016,6 +2026,7 @@ gtk_image_set
|
||||
gtk_image_get
|
||||
gtk_image_set_pixel_size
|
||||
gtk_image_get_pixel_size
|
||||
gtk_image_get_pixel_size_unit
|
||||
<SUBSECTION Standard>
|
||||
GTK_IMAGE
|
||||
GTK_IS_IMAGE
|
||||
@@ -2588,6 +2599,37 @@ GTK_MESSAGE_DIALOG_GET_CLASS
|
||||
gtk_message_dialog_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkinfobar</FILE>
|
||||
<TITLE>GtkInfoBar</TITLE>
|
||||
GtkInfoBar
|
||||
gtk_info_bar_new
|
||||
gtk_info_bar_new_with_buttons
|
||||
gtk_info_bar_set_contents
|
||||
gtk_info_bar_add_action_widget
|
||||
gtk_info_bar_add_button
|
||||
gtk_info_bar_add_buttons
|
||||
gtk_info_bar_set_response_sensitive
|
||||
gtk_info_bar_set_default_response
|
||||
gtk_info_bar_response
|
||||
gtk_info_bar_set_message_type
|
||||
gtk_info_bar_get_message_type
|
||||
gtk_info_bar_get_action_area
|
||||
gtk_info_bar_get_content_area
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_INFO_BAR
|
||||
GTK_INFO_BAR
|
||||
GTK_INFO_BAR_CLASS
|
||||
GTK_IS_INFO_BAR
|
||||
GTK_IS_INFO_BAR_CLASS
|
||||
GTK_INFO_BAR_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_info_bar_get_type
|
||||
GtkMessageAreaPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmisc</FILE>
|
||||
<TITLE>GtkMisc</TITLE>
|
||||
@@ -2596,6 +2638,7 @@ gtk_misc_set_alignment
|
||||
gtk_misc_set_padding
|
||||
gtk_misc_get_alignment
|
||||
gtk_misc_get_padding
|
||||
gtk_misc_get_padding_unit
|
||||
<SUBSECTION Standard>
|
||||
GTK_MISC
|
||||
GTK_IS_MISC
|
||||
@@ -3599,10 +3642,14 @@ gtk_table_set_row_spacings
|
||||
gtk_table_set_col_spacings
|
||||
gtk_table_set_homogeneous
|
||||
gtk_table_get_default_row_spacing
|
||||
gtk_table_get_default_row_spacing_unit
|
||||
gtk_table_get_homogeneous
|
||||
gtk_table_get_row_spacing
|
||||
gtk_table_get_row_spacing_unit
|
||||
gtk_table_get_col_spacing
|
||||
gtk_table_get_col_spacing_unit
|
||||
gtk_table_get_default_col_spacing
|
||||
gtk_table_get_default_col_spacing_unit
|
||||
<SUBSECTION Standard>
|
||||
GTK_TABLE
|
||||
GTK_IS_TABLE
|
||||
@@ -3982,18 +4029,24 @@ gtk_text_view_set_overwrite
|
||||
gtk_text_view_get_overwrite
|
||||
gtk_text_view_set_pixels_above_lines
|
||||
gtk_text_view_get_pixels_above_lines
|
||||
gtk_text_view_get_pixels_above_lines_unit
|
||||
gtk_text_view_set_pixels_below_lines
|
||||
gtk_text_view_get_pixels_below_lines
|
||||
gtk_text_view_get_pixels_below_lines_unit
|
||||
gtk_text_view_set_pixels_inside_wrap
|
||||
gtk_text_view_get_pixels_inside_wrap
|
||||
gtk_text_view_get_pixels_inside_wrap_unit
|
||||
gtk_text_view_set_justification
|
||||
gtk_text_view_get_justification
|
||||
gtk_text_view_set_left_margin
|
||||
gtk_text_view_get_left_margin
|
||||
gtk_text_view_get_left_margin_unit
|
||||
gtk_text_view_set_right_margin
|
||||
gtk_text_view_get_right_margin
|
||||
gtk_text_view_get_right_margin_unit
|
||||
gtk_text_view_set_indent
|
||||
gtk_text_view_get_indent
|
||||
gtk_text_view_get_indent_unit
|
||||
gtk_text_view_set_tabs
|
||||
gtk_text_view_get_tabs
|
||||
gtk_text_view_set_accepts_tab
|
||||
@@ -4718,6 +4771,7 @@ gtk_tree_view_column_set_cell_data_func
|
||||
gtk_tree_view_column_clear_attributes
|
||||
gtk_tree_view_column_set_spacing
|
||||
gtk_tree_view_column_get_spacing
|
||||
gtk_tree_view_column_get_spacing_unit
|
||||
gtk_tree_view_column_set_visible
|
||||
gtk_tree_view_column_get_visible
|
||||
gtk_tree_view_column_set_resizable
|
||||
@@ -4726,11 +4780,14 @@ gtk_tree_view_column_set_sizing
|
||||
gtk_tree_view_column_get_sizing
|
||||
gtk_tree_view_column_get_width
|
||||
gtk_tree_view_column_get_fixed_width
|
||||
gtk_tree_view_column_get_fixed_width_unit
|
||||
gtk_tree_view_column_set_fixed_width
|
||||
gtk_tree_view_column_set_min_width
|
||||
gtk_tree_view_column_get_min_width
|
||||
gtk_tree_view_column_get_min_width_unit
|
||||
gtk_tree_view_column_set_max_width
|
||||
gtk_tree_view_column_get_max_width
|
||||
gtk_tree_view_column_get_max_width_unit
|
||||
gtk_tree_view_column_clicked
|
||||
gtk_tree_view_column_set_title
|
||||
gtk_tree_view_column_get_title
|
||||
@@ -4779,6 +4836,7 @@ GtkTreeViewMappingFunc
|
||||
GtkTreeViewSearchEqualFunc
|
||||
gtk_tree_view_new
|
||||
gtk_tree_view_get_level_indentation
|
||||
gtk_tree_view_get_level_indentation_unit
|
||||
gtk_tree_view_get_show_expanders
|
||||
gtk_tree_view_set_level_indentation
|
||||
gtk_tree_view_set_show_expanders
|
||||
@@ -4953,13 +5011,17 @@ GtkCellRendererMode
|
||||
GtkCellRenderer
|
||||
GtkCellRendererClass
|
||||
gtk_cell_renderer_get_size
|
||||
gtk_cell_renderer_get_size_unit
|
||||
gtk_cell_renderer_render
|
||||
gtk_cell_renderer_activate
|
||||
gtk_cell_renderer_start_editing
|
||||
gtk_cell_renderer_editing_canceled
|
||||
gtk_cell_renderer_stop_editing
|
||||
gtk_cell_renderer_get_fixed_size
|
||||
gtk_cell_renderer_get_fixed_size_unit
|
||||
gtk_cell_renderer_set_fixed_size
|
||||
gtk_cell_renderer_get_tree_view_column
|
||||
gtk_cell_renderer_get_tree_view
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_CELL_RENDERER
|
||||
@@ -5494,6 +5556,15 @@ gtk_widget_set_has_tooltip
|
||||
gtk_widget_trigger_tooltip_query
|
||||
gtk_widget_get_snapshot
|
||||
gtk_widget_get_window
|
||||
gtk_widget_get_monitor_num
|
||||
gtk_widget_get_size_request_unit
|
||||
gtk_widget_size_to_pixel
|
||||
gtk_widget_size_to_pixel_double
|
||||
gtk_widget_style_get_property_unit
|
||||
gtk_widget_style_get_unit_valist
|
||||
gtk_widget_style_get_unit
|
||||
gtk_widget_get_unit_valist
|
||||
gtk_widget_get_unit
|
||||
<SUBSECTION>
|
||||
gtk_requisition_copy
|
||||
gtk_requisition_free
|
||||
@@ -5580,6 +5651,7 @@ gtk_window_get_deletable
|
||||
gtk_window_get_default_icon_list
|
||||
gtk_window_get_default_icon_name
|
||||
gtk_window_get_default_size
|
||||
gtk_window_get_default_size_unit
|
||||
gtk_window_get_destroy_with_parent
|
||||
gtk_window_get_frame_dimensions
|
||||
gtk_window_get_has_frame
|
||||
@@ -5615,6 +5687,7 @@ gtk_window_set_icon_name
|
||||
gtk_window_set_auto_startup_notification
|
||||
gtk_window_get_opacity
|
||||
gtk_window_set_opacity
|
||||
gtk_window_get_monitor_num
|
||||
<SUBSECTION Standard>
|
||||
GTK_WINDOW
|
||||
GTK_IS_WINDOW
|
||||
@@ -5783,6 +5856,9 @@ gtk_style_set_font
|
||||
gtk_style_get_style_property
|
||||
gtk_style_get_valist
|
||||
gtk_style_get
|
||||
gtk_style_get_style_property_unit
|
||||
gtk_style_get_unit_valist
|
||||
gtk_style_get_unit
|
||||
gtk_draw_hline
|
||||
gtk_draw_vline
|
||||
gtk_draw_shadow
|
||||
@@ -6459,7 +6535,10 @@ gtk_icon_set_ref
|
||||
gtk_icon_set_render_icon
|
||||
gtk_icon_set_unref
|
||||
gtk_icon_size_lookup
|
||||
gtk_icon_size_lookup_unit
|
||||
gtk_icon_size_lookup_for_settings
|
||||
gtk_icon_size_lookup_for_settings_for_monitor
|
||||
gtk_icon_size_lookup_for_settings_unit
|
||||
gtk_icon_size_register
|
||||
gtk_icon_size_register_alias
|
||||
gtk_icon_size_from_name
|
||||
@@ -6533,6 +6612,10 @@ gtk_print_operation_set_defer_drawing
|
||||
gtk_print_operation_get_status
|
||||
gtk_print_operation_get_status_string
|
||||
gtk_print_operation_is_finished
|
||||
gtk_print_operation_set_support_selection
|
||||
gtk_print_operation_get_support_selection
|
||||
gtk_print_operation_set_has_selection
|
||||
gtk_print_operation_get_has_selection
|
||||
gtk_print_run_page_setup_dialog
|
||||
GtkPageSetupDoneFunc
|
||||
gtk_print_run_page_setup_dialog_async
|
||||
@@ -6577,8 +6660,13 @@ gtk_print_unix_dialog_set_settings
|
||||
gtk_print_unix_dialog_get_settings
|
||||
gtk_print_unix_dialog_get_selected_printer
|
||||
gtk_print_unix_dialog_add_custom_tab
|
||||
gtk_print_unix_dialog_set_support_selection
|
||||
gtk_print_unix_dialog_get_support_selection
|
||||
gtk_print_unix_dialog_set_has_selection
|
||||
gtk_print_unix_dialog_get_has_selection
|
||||
GtkPrintCapabilities
|
||||
gtk_print_unix_dialog_set_manual_capabilities
|
||||
gtk_print_unix_dialog_get_manual_capabilities
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_PRINT_UNIX_DIALOG
|
||||
@@ -6996,3 +7084,31 @@ GTK_TYPE_ORIENTABLE
|
||||
<SUBSECTION Private>
|
||||
gtk_orientable_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Units</TITLE>
|
||||
<FILE>gtksize</FILE>
|
||||
GtkSize
|
||||
GtkUSize
|
||||
GtkSizeUnit
|
||||
gtk_size_em
|
||||
gtk_size_mm
|
||||
gtk_size_get_em
|
||||
gtk_size_get_mm
|
||||
GTK_SIZE_ONE_TWELFTH_EM
|
||||
GTK_SIZE_MAXPIXEL
|
||||
GTK_SIZE_MINPIXEL
|
||||
gtk_size_get_unit
|
||||
gtk_size_to_pixel
|
||||
gtk_size_to_pixel_double
|
||||
gtk_size_to_string
|
||||
gtk_param_spec_size
|
||||
gtk_value_set_size
|
||||
gtk_value_get_size
|
||||
gtk_value_size_skip_conversion
|
||||
gtk_param_spec_usize
|
||||
gtk_value_set_usize
|
||||
gtk_value_get_usize
|
||||
gtk_value_usize_skip_conversion
|
||||
gtk_enable_resolution_independence
|
||||
</SECTION>
|
||||
|
||||
@@ -81,6 +81,7 @@ gtk_image_menu_item_get_type
|
||||
gtk_im_context_get_type
|
||||
gtk_im_context_simple_get_type
|
||||
gtk_im_multicontext_get_type
|
||||
gtk_info_bar_get_type
|
||||
gtk_input_dialog_get_type
|
||||
gtk_invisible_get_type
|
||||
gtk_item_factory_get_type
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 135 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -449,6 +449,8 @@ Returns the #GtkWidget that the menu is attached to.
|
||||
A user function supplied when calling gtk_menu_popup() which controls the
|
||||
positioning of the menu when it is displayed. The function sets the @x
|
||||
and @y parameters to the coordinates where the menu is to be drawn.
|
||||
To make the menu appear on a different monitor than the mouse pointer,
|
||||
gtk_menu_set_monitor() must be called.
|
||||
</para>
|
||||
|
||||
@menu: a #GtkMenu.
|
||||
|
||||
@@ -213,6 +213,11 @@ Printing support was added in GTK+ 2.10.
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintOperation:has-selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintOperation:job-name ##### -->
|
||||
<para>
|
||||
|
||||
@@ -243,6 +248,11 @@ Printing support was added in GTK+ 2.10.
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintOperation:support-selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintOperation:track-print-status ##### -->
|
||||
<para>
|
||||
|
||||
@@ -530,6 +540,42 @@ The #GQuark used for #GtkPrintError errors.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_operation_set_support_selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@op:
|
||||
@support_selection:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_operation_get_support_selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@op:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_operation_set_has_selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@op:
|
||||
@has_selection:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_operation_get_has_selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@op:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_run_page_setup_dialog ##### -->
|
||||
<para>
|
||||
|
||||
|
||||
@@ -717,6 +717,7 @@ multiple pages per sheet.
|
||||
@GTK_PRINT_PAGES_ALL:
|
||||
@GTK_PRINT_PAGES_CURRENT:
|
||||
@GTK_PRINT_PAGES_RANGES:
|
||||
@GTK_PRINT_PAGES_SELECTION:
|
||||
|
||||
<!-- ##### MACRO GTK_PRINT_SETTINGS_PRINT_PAGES ##### -->
|
||||
<para>
|
||||
|
||||
@@ -90,6 +90,16 @@ The GtkPrintUnixDialog implementation of the GtkBuildable interface exposes its
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintUnixDialog:has-selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintUnixDialog:manual-capabilities ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintUnixDialog:page-setup ##### -->
|
||||
<para>
|
||||
|
||||
@@ -105,6 +115,11 @@ The GtkPrintUnixDialog implementation of the GtkBuildable interface exposes its
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkPrintUnixDialog:support-selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_unix_dialog_new ##### -->
|
||||
<para>
|
||||
|
||||
@@ -188,6 +203,42 @@ The GtkPrintUnixDialog implementation of the GtkBuildable interface exposes its
|
||||
@tab_label:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_unix_dialog_set_support_selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@dialog:
|
||||
@support_selection:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_unix_dialog_get_support_selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@dialog:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_unix_dialog_set_has_selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@dialog:
|
||||
@has_selection:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_unix_dialog_get_has_selection ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@dialog:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### ENUM GtkPrintCapabilities ##### -->
|
||||
<para>
|
||||
An enum for specifying which features the print dialog should offer.
|
||||
@@ -220,3 +271,12 @@ formats are supported.
|
||||
@capabilities:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_print_unix_dialog_get_manual_capabilities ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@dialog:
|
||||
@Returns:
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,35 @@ Sharing settings between applications
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
GtkSettings provide a mechanism to share global settings between applications.
|
||||
On the X window system, this sharing is realized by an <ulink href="http://www.freedesktop.org/wiki/Specifications/xsettings-spec">XSettings</ulink>
|
||||
manager that is usually part of the desktop environment, along with utilities
|
||||
that let the user change these settings. In the absence of an Xsettings manager,
|
||||
settings can also be specified in RC files.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Applications can override system-wide settings with gtk_settings_set_string_property(),
|
||||
gtk_settings_set_long_property(), etc. This should be restricted to special
|
||||
cases though; GtkSettings are not meant as an application configuration
|
||||
facility. When doing so, you need to be aware that settings that are specific
|
||||
to individual widgets may not be available before the widget type has been
|
||||
realized at least once. The following example demonstrates a way to do this:
|
||||
<informalexample><programlisting>
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* make sure the type is realized &ast/
|
||||
g_type_class_unref (g_type_class_ref (GTK_TYPE_IMAGE_MENU_ITEM));
|
||||
|
||||
g_object_set (gtk_settings_get_default (), "gtk-menu-images", FALSE, NULL);
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
There is one GtkSettings instance per screen. It can be obtained with
|
||||
gtk_settings_get_for_screen(), but in many cases, it is more convenient
|
||||
to use gtk_widget_get_settings(). gtk_settings_get_default() returns the
|
||||
GtkSettings instance for the default screen.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Units
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GtkSize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### TYPEDEF GtkUSize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ENUM GtkSizeUnit ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_SIZE_UNIT_PIXEL:
|
||||
@GTK_SIZE_UNIT_EM:
|
||||
@GTK_SIZE_UNIT_MM:
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_em ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@em:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_mm ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@mm:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_get_em ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_get_mm ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_SIZE_ONE_TWELFTH_EM ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_SIZE_MAXPIXEL ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_SIZE_MINPIXEL ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_get_unit ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_to_pixel ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@screen:
|
||||
@monitor_num:
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_to_pixel_double ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@screen:
|
||||
@monitor_num:
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_size_to_string ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_param_spec_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@nick:
|
||||
@blurb:
|
||||
@minimum:
|
||||
@maximum:
|
||||
@default_value:
|
||||
@flags:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_set_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@v_size:
|
||||
@widget:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_get_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_size_skip_conversion ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_param_spec_usize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@nick:
|
||||
@blurb:
|
||||
@minimum:
|
||||
@maximum:
|
||||
@default_value:
|
||||
@flags:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_set_usize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@v_size:
|
||||
@widget:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_get_usize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_value_usize_skip_conversion ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@value:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_enable_resolution_independence ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
@@ -2459,7 +2459,7 @@ gdk_pixbuf_format_get_description (GdkPixbufFormat *format)
|
||||
domain = format->domain;
|
||||
else
|
||||
domain = GETTEXT_PACKAGE;
|
||||
description = dgettext (domain, format->description);
|
||||
description = g_dgettext (domain, format->description);
|
||||
|
||||
return g_strdup (description);
|
||||
}
|
||||
|
||||
@@ -428,9 +428,10 @@ gdk_pixbuf_from_pixdata (const GdkPixdata *pixdata,
|
||||
{
|
||||
g_set_error (error, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
||||
ngettext("failed to allocate image buffer of %u byte",
|
||||
"failed to allocate image buffer of %u bytes",
|
||||
pixdata->rowstride * pixdata->height),
|
||||
g_dngettext(GETTEXT_PACKAGE,
|
||||
"failed to allocate image buffer of %u byte",
|
||||
"failed to allocate image buffer of %u bytes",
|
||||
pixdata->rowstride * pixdata->height),
|
||||
pixdata->rowstride * pixdata->height);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -889,6 +889,7 @@ gdk_pango_attr_embossed_new
|
||||
gdk_pango_attr_stipple_new
|
||||
gdk_pango_context_get
|
||||
gdk_pango_context_get_for_screen
|
||||
gdk_pango_context_get_for_screen_for_monitor
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
gdk_pango_context_set_colormap
|
||||
#endif
|
||||
@@ -1008,8 +1009,12 @@ gdk_screen_get_monitor_at_point
|
||||
gdk_screen_get_monitor_at_window
|
||||
gdk_screen_set_font_options
|
||||
gdk_screen_get_font_options
|
||||
gdk_screen_set_font_options_for_monitor
|
||||
gdk_screen_get_font_options_for_monitor
|
||||
gdk_screen_set_resolution
|
||||
gdk_screen_get_resolution
|
||||
gdk_screen_get_resolution_for_monitor
|
||||
gdk_screen_set_resolution_for_monitor
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1496,5 +1496,41 @@ gdk_pango_context_get_for_screen (GdkScreen *screen)
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pango_context_get_for_screen_for_monitor:
|
||||
* @screen: the #GdkScreen for which the context is to be created.
|
||||
* @monitor_num: monitor number or -1 to use default monitor
|
||||
*
|
||||
* Like gdk_pango_context_get_for_screen() but also takes a monitor
|
||||
* number.
|
||||
*
|
||||
* Return value: a new #PangoContext for @screen
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
PangoContext *
|
||||
gdk_pango_context_get_for_screen_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
PangoFontMap *fontmap;
|
||||
PangoContext *context;
|
||||
const cairo_font_options_t *options;
|
||||
double dpi;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
fontmap = pango_cairo_font_map_get_default ();
|
||||
|
||||
context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
|
||||
|
||||
options = gdk_screen_get_font_options_for_monitor (screen, monitor_num);
|
||||
pango_cairo_context_set_font_options (context, options);
|
||||
|
||||
dpi = gdk_screen_get_resolution_for_monitor (screen, monitor_num);
|
||||
pango_cairo_context_set_resolution (context, dpi);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
#define __GDK_PANGO_C__
|
||||
#include "gdkaliasdef.c"
|
||||
|
||||
@@ -104,6 +104,9 @@ void gdk_pango_renderer_set_override_color (GdkPangoRenderer *gdk_renderer,
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
PangoContext *gdk_pango_context_get_for_screen_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num);
|
||||
|
||||
PangoContext *gdk_pango_context_get_for_screen (GdkScreen *screen);
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
PangoContext *gdk_pango_context_get (void);
|
||||
|
||||
@@ -428,6 +428,25 @@ gdk_screen_set_font_options (GdkScreen *screen,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_set_font_options_for_monitor:
|
||||
* @screen: a #GdkScreen
|
||||
* @options: a #cairo_font_options_t, or %NULL to unset any
|
||||
* previously set default font options.
|
||||
*
|
||||
* Like gdk_screen_set_font_options() but per monitor.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
void
|
||||
gdk_screen_set_font_options_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
const cairo_font_options_t *options)
|
||||
{
|
||||
/* TODO: need to implement per-monitor font options */
|
||||
return gdk_screen_set_font_options (screen, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_get_font_options:
|
||||
* @screen: a #GdkScreen
|
||||
@@ -447,6 +466,26 @@ gdk_screen_get_font_options (GdkScreen *screen)
|
||||
return screen->font_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_get_font_options_for_monitor:
|
||||
* @screen: a #GdkScreen
|
||||
* @monitor_num: monitor number or -1 for default monitor
|
||||
*
|
||||
* Like gdk_screen_get_font_options() but per monitor.
|
||||
*
|
||||
* Return value: the current font options, or %NULL if no default
|
||||
* font options have been set.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
const cairo_font_options_t *
|
||||
gdk_screen_get_font_options_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
/* TODO: need to implement per-monitor font options */
|
||||
return gdk_screen_get_font_options (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_set_resolution:
|
||||
* @screen: a #GdkScreen
|
||||
@@ -497,6 +536,50 @@ gdk_screen_get_resolution (GdkScreen *screen)
|
||||
return screen->resolution;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_get_resolution_for_monitor:
|
||||
* @screen: a #GdkScreen
|
||||
* @monitor_num: monitor number or -1 for default monitor
|
||||
*
|
||||
* Like gdk_screen_get_resolution() but per monitor.
|
||||
*
|
||||
* Returns: the current resolution or -1 if no resolution has been
|
||||
* set.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
gdouble
|
||||
gdk_screen_get_resolution_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
#if 0
|
||||
/* Nifty trick to test RI - monitor 0 will have 3 times the user configured DPI */
|
||||
return (monitor_num == 0 ? 3.0 : 1.0) * gdk_screen_get_resolution (screen);
|
||||
#endif
|
||||
/* TODO: need to implement per-monitor resolution */
|
||||
return gdk_screen_get_resolution (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_set_resolution_for_monitor:
|
||||
* @screen: a #GdkScreen
|
||||
* @monitor_num: monitor number
|
||||
* @dpi: the resolution in "dots per inch". (Physical inches aren't actually
|
||||
* involved; the terminology is conventional.)
|
||||
*
|
||||
* Like gdk_screen_set_resolution() but per monitor.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
void
|
||||
gdk_screen_set_resolution_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
gdouble dpi)
|
||||
{
|
||||
/* TODO: need to implement per-monitor resolution */
|
||||
gdk_screen_set_resolution (screen, dpi);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_screen_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
|
||||
@@ -118,10 +118,23 @@ void gdk_screen_set_font_options (GdkScreen
|
||||
const cairo_font_options_t *options);
|
||||
const cairo_font_options_t *gdk_screen_get_font_options (GdkScreen *screen);
|
||||
|
||||
void gdk_screen_set_font_options_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
const cairo_font_options_t *options);
|
||||
const cairo_font_options_t *gdk_screen_get_font_options_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num);
|
||||
|
||||
void gdk_screen_set_resolution (GdkScreen *screen,
|
||||
gdouble dpi);
|
||||
gdouble gdk_screen_get_resolution (GdkScreen *screen);
|
||||
|
||||
gdouble gdk_screen_get_resolution_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num);
|
||||
|
||||
void gdk_screen_set_resolution_for_monitor (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
gdouble dpi);
|
||||
|
||||
GdkWindow *gdk_screen_get_active_window (GdkScreen *screen);
|
||||
GList *gdk_screen_get_window_stack (GdkScreen *screen);
|
||||
|
||||
|
||||
@@ -312,10 +312,10 @@ _gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
|
||||
else if (files_count == 1)
|
||||
description = g_strdup_printf (_("Opening %s"), get_display_name (files->data));
|
||||
else
|
||||
description = g_strdup_printf (dngettext (GETTEXT_PACKAGE,
|
||||
"Opening %d Item",
|
||||
"Opening %d Items",
|
||||
files_count), files_count);
|
||||
description = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
|
||||
"Opening %d Item",
|
||||
"Opening %d Items",
|
||||
files_count), files_count);
|
||||
|
||||
icon_name = NULL;
|
||||
if (priv->icon_name)
|
||||
|
||||
@@ -50,9 +50,7 @@
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XCOMPOSITE
|
||||
#include <X11/extensions/Xcomposite.h>
|
||||
@@ -161,10 +159,8 @@ gdk_display_open (const gchar *display_name)
|
||||
XClassHint *class_hint;
|
||||
gulong pid;
|
||||
gint i;
|
||||
#if defined(HAVE_XFIXES) || defined(HAVE_SHAPE_EXT)
|
||||
gint ignore;
|
||||
gint maj, min;
|
||||
#endif
|
||||
|
||||
xdisplay = XOpenDisplay (display_name);
|
||||
if (!xdisplay)
|
||||
@@ -282,7 +278,7 @@ gdk_display_open (const gchar *display_name)
|
||||
|
||||
display_x11->have_shapes = FALSE;
|
||||
display_x11->have_input_shapes = FALSE;
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
|
||||
if (XShapeQueryExtension (GDK_DISPLAY_XDISPLAY (display), &ignore, &ignore))
|
||||
{
|
||||
display_x11->have_shapes = TRUE;
|
||||
@@ -291,7 +287,6 @@ gdk_display_open (const gchar *display_name)
|
||||
display_x11->have_input_shapes = (maj == 1 && min >= 1);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
display_x11->trusted_client = TRUE;
|
||||
{
|
||||
|
||||
+16
-13
@@ -173,37 +173,40 @@ lookup_cached_xatom (GdkDisplay *display,
|
||||
/**
|
||||
* gdk_x11_atom_to_xatom_for_display:
|
||||
* @display: A #GdkDisplay
|
||||
* @atom: A #GdkAtom
|
||||
*
|
||||
* @atom: A #GdkAtom, or %GDK_NONE
|
||||
*
|
||||
* Converts from a #GdkAtom to the X atom for a #GdkDisplay
|
||||
* with the same string value.
|
||||
*
|
||||
* Return value: the X atom corresponding to @atom.
|
||||
* with the same string value. The special value %GDK_NONE
|
||||
* is converted to %None.
|
||||
*
|
||||
* Return value: the X atom corresponding to @atom, or %None
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
Atom
|
||||
gdk_x11_atom_to_xatom_for_display (GdkDisplay *display,
|
||||
GdkAtom atom)
|
||||
gdk_x11_atom_to_xatom_for_display (GdkDisplay *display,
|
||||
GdkAtom atom)
|
||||
{
|
||||
Atom xatom = None;
|
||||
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), None);
|
||||
g_return_val_if_fail (atom != GDK_NONE, None);
|
||||
|
||||
if (atom == GDK_NONE)
|
||||
return None;
|
||||
|
||||
if (display->closed)
|
||||
return None;
|
||||
|
||||
|
||||
xatom = lookup_cached_xatom (display, atom);
|
||||
|
||||
|
||||
if (!xatom)
|
||||
{
|
||||
char *name;
|
||||
|
||||
|
||||
g_return_val_if_fail (ATOM_TO_INDEX (atom) < virtual_atom_array->len, None);
|
||||
|
||||
name = g_ptr_array_index (virtual_atom_array, ATOM_TO_INDEX (atom));
|
||||
|
||||
|
||||
xatom = XInternAtom (GDK_DISPLAY_XDISPLAY (display), name, FALSE);
|
||||
insert_atom_pair (display, atom, xatom);
|
||||
}
|
||||
|
||||
@@ -736,7 +736,10 @@ init_randr13 (GdkScreen *screen)
|
||||
randr12_compat |= !g_strcmp0(output->name, "default");
|
||||
|
||||
if (output->connection == RR_Disconnected)
|
||||
continue;
|
||||
{
|
||||
XRRFreeOutputInfo (output);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (output->crtc)
|
||||
{
|
||||
|
||||
+9
-21
@@ -57,9 +57,7 @@
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XCOMPOSITE
|
||||
#include <X11/extensions/Xcomposite.h>
|
||||
@@ -2285,7 +2283,7 @@ gdk_window_set_modal_hint (GdkWindow *window,
|
||||
if (GDK_WINDOW_IS_MAPPED (window))
|
||||
gdk_wmspec_change_state (modal, window,
|
||||
gdk_atom_intern_static_string ("_NET_WM_STATE_MODAL"),
|
||||
NULL);
|
||||
GDK_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2319,8 +2317,8 @@ gdk_window_set_skip_taskbar_hint (GdkWindow *window,
|
||||
|
||||
if (GDK_WINDOW_IS_MAPPED (window))
|
||||
gdk_wmspec_change_state (skips_taskbar, window,
|
||||
gdk_atom_intern_static_string ("_NET_WM_STATE_SKIP_TASKBAR"),
|
||||
NULL);
|
||||
gdk_atom_intern_static_string ("_NET_WM_STATE_SKIP_TASKBAR"),
|
||||
GDK_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2357,7 +2355,7 @@ gdk_window_set_skip_pager_hint (GdkWindow *window,
|
||||
if (GDK_WINDOW_IS_MAPPED (window))
|
||||
gdk_wmspec_change_state (skips_pager, window,
|
||||
gdk_atom_intern_static_string ("_NET_WM_STATE_SKIP_PAGER"),
|
||||
NULL);
|
||||
GDK_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3641,8 +3639,7 @@ do_shape_combine_mask (GdkWindow *window,
|
||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||
Pixmap pixmap;
|
||||
gint xoffset, yoffset;
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
|
||||
@@ -3680,7 +3677,6 @@ do_shape_combine_mask (GdkWindow *window,
|
||||
pixmap,
|
||||
ShapeSet);
|
||||
}
|
||||
#endif /* HAVE_SHAPE_EXT */
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3739,8 +3735,7 @@ do_shape_combine_region (GdkWindow *window,
|
||||
{
|
||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||
gint xoffset, yoffset;
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
|
||||
@@ -3782,7 +3777,6 @@ do_shape_combine_region (GdkWindow *window,
|
||||
|
||||
g_free (xrects);
|
||||
}
|
||||
#endif /* HAVE_SHAPE_EXT */
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4353,7 +4347,7 @@ gdk_window_stick (GdkWindow *window)
|
||||
/* Request stick during viewport scroll */
|
||||
gdk_wmspec_change_state (TRUE, window,
|
||||
gdk_atom_intern_static_string ("_NET_WM_STATE_STICKY"),
|
||||
NULL);
|
||||
GDK_NONE);
|
||||
|
||||
/* Request desktop 0xFFFFFFFF */
|
||||
memset (&xclient, 0, sizeof (xclient));
|
||||
@@ -4404,7 +4398,7 @@ gdk_window_unstick (GdkWindow *window)
|
||||
/* Request unstick from viewport */
|
||||
gdk_wmspec_change_state (FALSE, window,
|
||||
gdk_atom_intern_static_string ("_NET_WM_STATE_STICKY"),
|
||||
NULL);
|
||||
GDK_NONE);
|
||||
|
||||
move_to_current_desktop (window);
|
||||
}
|
||||
@@ -4904,8 +4898,6 @@ gdk_window_set_functions (GdkWindow *window,
|
||||
gdk_window_set_mwm_hints (window, &hints);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
|
||||
/*
|
||||
* propagate the shapes from all child windows of a GDK window to the parent
|
||||
* window. Shamelessly ripped from Enlightenment's code
|
||||
@@ -5219,13 +5211,10 @@ gdk_propagate_shapes (Display *disp,
|
||||
g_free (spans);
|
||||
}
|
||||
|
||||
#endif /* HAVE_SHAPE_EXT */
|
||||
|
||||
static inline void
|
||||
do_child_shapes (GdkWindow *window,
|
||||
gboolean merge)
|
||||
{
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
if (!GDK_WINDOW_DESTROYED (window) &&
|
||||
gdk_display_supports_shapes (GDK_WINDOW_DISPLAY (window)))
|
||||
{
|
||||
@@ -5234,7 +5223,6 @@ do_child_shapes (GdkWindow *window,
|
||||
merge,
|
||||
ShapeBounding);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -5253,7 +5241,7 @@ static inline void
|
||||
do_child_input_shapes (GdkWindow *window,
|
||||
gboolean merge)
|
||||
{
|
||||
#if defined(HAVE_SHAPE_EXT) && defined(ShapeInput)
|
||||
#if defined(ShapeInput)
|
||||
if (!GDK_WINDOW_DESTROYED (window) &&
|
||||
gdk_display_supports_shapes (GDK_WINDOW_DISPLAY (window)))
|
||||
{
|
||||
|
||||
@@ -230,6 +230,7 @@ gtk_public_h_sources = \
|
||||
gtkimcontextsimple.h \
|
||||
gtkimmodule.h \
|
||||
gtkimmulticontext.h \
|
||||
gtkinfobar.h \
|
||||
gtkinputdialog.h \
|
||||
gtkinvisible.h \
|
||||
gtkitem.h \
|
||||
@@ -284,6 +285,7 @@ gtk_public_h_sources = \
|
||||
gtkseparatortoolitem.h \
|
||||
gtkshow.h \
|
||||
gtksettings.h \
|
||||
gtksize.h \
|
||||
gtksizegroup.h \
|
||||
gtksocket.h \
|
||||
gtkspinbutton.h \
|
||||
@@ -486,6 +488,7 @@ gtk_base_c_sources = \
|
||||
gtkimcontextsimple.c \
|
||||
gtkimmodule.c \
|
||||
gtkimmulticontext.c \
|
||||
gtkinfobar.c \
|
||||
gtkinputdialog.c \
|
||||
gtkinvisible.c \
|
||||
gtkitem.c \
|
||||
@@ -547,6 +550,7 @@ gtk_base_c_sources = \
|
||||
gtkseparatormenuitem.c \
|
||||
gtkseparatortoolitem.c \
|
||||
gtksettings.c \
|
||||
gtksize.c \
|
||||
gtksizegroup.c \
|
||||
gtkshow.c \
|
||||
gtksocket.c \
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
#include <gtk/gtkimcontext.h>
|
||||
#include <gtk/gtkimcontextsimple.h>
|
||||
#include <gtk/gtkimmulticontext.h>
|
||||
#include <gtk/gtkinfobar.h>
|
||||
#include <gtk/gtkinputdialog.h>
|
||||
#include <gtk/gtkinvisible.h>
|
||||
#include <gtk/gtkitem.h>
|
||||
@@ -163,6 +164,7 @@
|
||||
#include <gtk/gtkseparatortoolitem.h>
|
||||
#include <gtk/gtksettings.h>
|
||||
#include <gtk/gtkshow.h>
|
||||
#include <gtk/gtksize.h>
|
||||
#include <gtk/gtksizegroup.h>
|
||||
#include <gtk/gtksocket.h>
|
||||
#include <gtk/gtkspinbutton.h>
|
||||
|
||||
+101
@@ -266,6 +266,7 @@ gtk_adjustment_value_changed
|
||||
#if IN_HEADER(__GTK_ALIGNMENT_H__)
|
||||
#if IN_FILE(__GTK_ALIGNMENT_C__)
|
||||
gtk_alignment_get_padding
|
||||
gtk_alignment_get_padding_unit
|
||||
gtk_alignment_get_type G_GNUC_CONST
|
||||
gtk_alignment_new
|
||||
gtk_alignment_set
|
||||
@@ -470,6 +471,7 @@ gtk_bin_get_type G_GNUC_CONST
|
||||
#if IN_FILE(__GTK_BOX_C__)
|
||||
gtk_box_get_homogeneous
|
||||
gtk_box_get_spacing
|
||||
gtk_box_get_spacing_unit
|
||||
gtk_box_get_type G_GNUC_CONST
|
||||
gtk_box_pack_end
|
||||
gtk_box_pack_start
|
||||
@@ -478,6 +480,7 @@ gtk_box_pack_end_defaults
|
||||
gtk_box_pack_start_defaults
|
||||
#endif
|
||||
gtk_box_query_child_packing
|
||||
gtk_box_query_child_packing_unit
|
||||
gtk_box_reorder_child
|
||||
gtk_box_set_child_packing
|
||||
gtk_box_set_homogeneous
|
||||
@@ -625,12 +628,16 @@ gtk_cell_renderer_activate
|
||||
gtk_cell_renderer_editing_canceled
|
||||
#endif
|
||||
gtk_cell_renderer_get_fixed_size
|
||||
gtk_cell_renderer_get_fixed_size_unit
|
||||
gtk_cell_renderer_get_size
|
||||
gtk_cell_renderer_get_size_unit
|
||||
gtk_cell_renderer_get_type G_GNUC_CONST
|
||||
gtk_cell_renderer_render
|
||||
gtk_cell_renderer_set_fixed_size
|
||||
gtk_cell_renderer_start_editing
|
||||
gtk_cell_renderer_stop_editing
|
||||
gtk_cell_renderer_get_tree_view_column
|
||||
gtk_cell_renderer_get_tree_view
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -690,7 +697,9 @@ gtk_cell_renderer_toggle_set_radio
|
||||
|
||||
#if IN_HEADER(__GTK_CELL_VIEW_H__)
|
||||
#if IN_FILE(__GTK_CELL_VIEW_C__)
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
gtk_cell_view_get_cell_renderers
|
||||
#endif
|
||||
gtk_cell_view_get_displayed_row
|
||||
gtk_cell_view_get_model
|
||||
gtk_cell_view_get_size_of_row
|
||||
@@ -1006,6 +1015,7 @@ gtk_container_set_focus_vadjustment
|
||||
gtk_container_set_reallocate_redraws
|
||||
gtk_container_set_resize_mode
|
||||
gtk_container_unset_focus_chain
|
||||
gtk_container_get_border_width_unit
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1432,6 +1442,7 @@ gtk_expander_get_expanded
|
||||
gtk_expander_get_label
|
||||
gtk_expander_get_label_widget
|
||||
gtk_expander_get_spacing
|
||||
gtk_expander_get_spacing_unit
|
||||
gtk_expander_get_type G_GNUC_CONST
|
||||
gtk_expander_get_use_markup
|
||||
gtk_expander_get_use_underline
|
||||
@@ -1814,6 +1825,7 @@ gtk_hseparator_new
|
||||
#if IN_FILE(__GTK_HSV_C__)
|
||||
gtk_hsv_get_color
|
||||
gtk_hsv_get_metrics
|
||||
gtk_hsv_get_metrics_unit
|
||||
gtk_hsv_get_type G_GNUC_CONST
|
||||
gtk_hsv_is_adjusting
|
||||
gtk_hsv_new
|
||||
@@ -1836,7 +1848,10 @@ gtk_icon_factory_remove_default
|
||||
gtk_icon_size_from_name
|
||||
gtk_icon_size_get_name
|
||||
gtk_icon_size_lookup
|
||||
gtk_icon_size_lookup_unit
|
||||
gtk_icon_size_lookup_for_settings
|
||||
gtk_icon_size_lookup_for_settings_for_monitor
|
||||
gtk_icon_size_lookup_for_settings_unit
|
||||
gtk_icon_size_register
|
||||
gtk_icon_size_register_alias
|
||||
gtk_icon_set_add_source
|
||||
@@ -1950,10 +1965,13 @@ gtk_icon_theme_set_search_path_utf8
|
||||
#if IN_HEADER(__GTK_ICON_VIEW_H__)
|
||||
#if IN_FILE(__GTK_ICON_VIEW_C__)
|
||||
gtk_icon_view_get_column_spacing
|
||||
gtk_icon_view_get_column_spacing_unit
|
||||
gtk_icon_view_get_columns
|
||||
gtk_icon_view_get_cursor
|
||||
gtk_icon_view_get_item_width
|
||||
gtk_icon_view_get_item_width_unit
|
||||
gtk_icon_view_get_margin
|
||||
gtk_icon_view_get_margin_unit
|
||||
gtk_icon_view_get_markup_column
|
||||
gtk_icon_view_get_model
|
||||
gtk_icon_view_get_orientation
|
||||
@@ -1962,9 +1980,11 @@ gtk_icon_view_get_item_at_pos
|
||||
gtk_icon_view_convert_widget_to_bin_window_coords
|
||||
gtk_icon_view_get_pixbuf_column
|
||||
gtk_icon_view_get_row_spacing
|
||||
gtk_icon_view_get_row_spacing_unit
|
||||
gtk_icon_view_get_selected_items
|
||||
gtk_icon_view_get_selection_mode
|
||||
gtk_icon_view_get_spacing
|
||||
gtk_icon_view_get_spacing_unit
|
||||
gtk_icon_view_get_text_column
|
||||
gtk_icon_view_get_type G_GNUC_CONST
|
||||
gtk_icon_view_get_visible_range
|
||||
@@ -2022,6 +2042,7 @@ gtk_image_get_icon_set
|
||||
gtk_image_get_image
|
||||
gtk_image_get_pixbuf
|
||||
gtk_image_get_pixel_size
|
||||
gtk_image_get_pixel_size_unit
|
||||
gtk_image_get_pixmap
|
||||
gtk_image_get_stock
|
||||
gtk_image_get_gicon
|
||||
@@ -2533,6 +2554,7 @@ gtk_message_dialog_get_image
|
||||
#if IN_FILE(__GTK_MISC_C__)
|
||||
gtk_misc_get_alignment
|
||||
gtk_misc_get_padding
|
||||
gtk_misc_get_padding_unit
|
||||
gtk_misc_get_type G_GNUC_CONST
|
||||
gtk_misc_set_alignment
|
||||
gtk_misc_set_padding
|
||||
@@ -2986,6 +3008,10 @@ gtk_print_operation_is_finished
|
||||
gtk_print_operation_cancel
|
||||
gtk_print_operation_draw_page_finish
|
||||
gtk_print_operation_set_defer_drawing
|
||||
gtk_print_operation_set_support_selection
|
||||
gtk_print_operation_get_support_selection
|
||||
gtk_print_operation_set_has_selection
|
||||
gtk_print_operation_get_has_selection
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -3110,6 +3136,11 @@ gtk_print_unix_dialog_get_settings
|
||||
gtk_print_unix_dialog_get_selected_printer
|
||||
gtk_print_unix_dialog_add_custom_tab
|
||||
gtk_print_unix_dialog_set_manual_capabilities
|
||||
gtk_print_unix_dialog_get_manual_capabilities
|
||||
gtk_print_unix_dialog_set_support_selection
|
||||
gtk_print_unix_dialog_get_support_selection
|
||||
gtk_print_unix_dialog_set_has_selection
|
||||
gtk_print_unix_dialog_get_has_selection
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -3762,10 +3793,14 @@ gtk_stock_set_translate_func
|
||||
gtk_table_attach
|
||||
gtk_table_attach_defaults
|
||||
gtk_table_get_col_spacing
|
||||
gtk_table_get_col_spacing_unit
|
||||
gtk_table_get_default_col_spacing
|
||||
gtk_table_get_default_col_spacing_unit
|
||||
gtk_table_get_default_row_spacing
|
||||
gtk_table_get_default_row_spacing_unit
|
||||
gtk_table_get_homogeneous
|
||||
gtk_table_get_row_spacing
|
||||
gtk_table_get_row_spacing_unit
|
||||
gtk_table_get_type G_GNUC_CONST
|
||||
gtk_table_new
|
||||
gtk_table_resize
|
||||
@@ -4113,18 +4148,24 @@ gtk_text_view_get_cursor_visible
|
||||
gtk_text_view_get_default_attributes
|
||||
gtk_text_view_get_editable
|
||||
gtk_text_view_get_indent
|
||||
gtk_text_view_get_indent_unit
|
||||
gtk_text_view_get_iter_at_location
|
||||
gtk_text_view_get_iter_at_position
|
||||
gtk_text_view_get_iter_location
|
||||
gtk_text_view_get_justification
|
||||
gtk_text_view_get_left_margin
|
||||
gtk_text_view_get_left_margin_unit
|
||||
gtk_text_view_get_line_at_y
|
||||
gtk_text_view_get_line_yrange
|
||||
gtk_text_view_get_overwrite
|
||||
gtk_text_view_get_pixels_above_lines
|
||||
gtk_text_view_get_pixels_above_lines_unit
|
||||
gtk_text_view_get_pixels_below_lines
|
||||
gtk_text_view_get_pixels_below_lines_unit
|
||||
gtk_text_view_get_pixels_inside_wrap
|
||||
gtk_text_view_get_pixels_inside_wrap_unit
|
||||
gtk_text_view_get_right_margin
|
||||
gtk_text_view_get_right_margin_unit
|
||||
gtk_text_view_get_tabs
|
||||
gtk_text_view_get_type G_GNUC_CONST
|
||||
gtk_text_view_get_visible_rect
|
||||
@@ -4593,12 +4634,17 @@ gtk_tree_view_column_clear_attributes
|
||||
gtk_tree_view_column_clicked
|
||||
gtk_tree_view_column_focus_cell
|
||||
gtk_tree_view_column_get_alignment
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
gtk_tree_view_column_get_cell_renderers
|
||||
#endif
|
||||
gtk_tree_view_column_get_clickable
|
||||
gtk_tree_view_column_get_expand
|
||||
gtk_tree_view_column_get_fixed_width
|
||||
gtk_tree_view_column_get_fixed_width_unit
|
||||
gtk_tree_view_column_get_max_width
|
||||
gtk_tree_view_column_get_max_width_unit
|
||||
gtk_tree_view_column_get_min_width
|
||||
gtk_tree_view_column_get_min_width_unit
|
||||
gtk_tree_view_column_get_reorderable
|
||||
gtk_tree_view_column_get_resizable
|
||||
gtk_tree_view_column_get_sizing
|
||||
@@ -4606,6 +4652,7 @@ gtk_tree_view_column_get_sort_column_id
|
||||
gtk_tree_view_column_get_sort_indicator
|
||||
gtk_tree_view_column_get_sort_order
|
||||
gtk_tree_view_column_get_spacing
|
||||
gtk_tree_view_column_get_spacing_unit
|
||||
gtk_tree_view_column_get_title
|
||||
gtk_tree_view_column_get_tree_view
|
||||
gtk_tree_view_column_get_type G_GNUC_CONST
|
||||
@@ -4674,6 +4721,7 @@ gtk_tree_view_get_headers_visible
|
||||
gtk_tree_view_get_hover_expand
|
||||
gtk_tree_view_get_hover_selection
|
||||
gtk_tree_view_get_level_indentation
|
||||
gtk_tree_view_get_level_indentation_unit
|
||||
gtk_tree_view_get_model
|
||||
gtk_tree_view_get_path_at_pos
|
||||
gtk_tree_view_get_reorderable
|
||||
@@ -5020,6 +5068,15 @@ gtk_widget_unmap
|
||||
gtk_widget_unparent
|
||||
gtk_widget_unrealize
|
||||
gtk_widget_get_window
|
||||
gtk_widget_get_monitor_num
|
||||
gtk_widget_get_size_request_unit
|
||||
gtk_widget_size_to_pixel
|
||||
gtk_widget_size_to_pixel_double
|
||||
gtk_widget_style_get_property_unit
|
||||
gtk_widget_style_get_unit_valist
|
||||
gtk_widget_style_get_unit
|
||||
gtk_widget_get_unit_valist
|
||||
gtk_widget_get_unit
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -5042,6 +5099,7 @@ gtk_window_get_default_widget
|
||||
gtk_window_get_default_icon_list
|
||||
gtk_window_get_default_icon_name
|
||||
gtk_window_get_default_size
|
||||
gtk_window_get_default_size_unit
|
||||
gtk_window_get_destroy_with_parent
|
||||
gtk_window_get_focus
|
||||
gtk_window_get_focus_on_map
|
||||
@@ -5144,6 +5202,7 @@ gtk_window_stick
|
||||
gtk_window_unfullscreen
|
||||
gtk_window_unmaximize
|
||||
gtk_window_unstick
|
||||
gtk_window_get_monitor_num
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -5155,6 +5214,48 @@ gtk_win32_embed_widget_get_type G_GNUC_CONST
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GTK_SIZE_H__)
|
||||
#if IN_FILE(__GTK_SIZE_C__)
|
||||
gtk_enable_resolution_independence
|
||||
gtk_size_em
|
||||
gtk_size_mm
|
||||
gtk_size_get_unit
|
||||
gtk_size_get_em
|
||||
gtk_size_get_mm
|
||||
gtk_size_to_pixel
|
||||
gtk_size_to_pixel_double
|
||||
gtk_size_to_string
|
||||
gtk_param_size_get_type G_GNUC_CONST
|
||||
gtk_param_spec_size
|
||||
gtk_value_set_size
|
||||
gtk_value_get_size
|
||||
gtk_value_size_skip_conversion
|
||||
gtk_param_usize_get_type G_GNUC_CONST
|
||||
gtk_param_spec_usize
|
||||
gtk_value_set_usize
|
||||
gtk_value_get_usize
|
||||
gtk_value_usize_skip_conversion
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GTK_INFO_BAR_H__)
|
||||
#if IN_FILE(__GTK_INFO_BAR_C__)
|
||||
gtk_info_bar_get_type G_GNUC_CONST
|
||||
gtk_info_bar_new
|
||||
gtk_info_bar_new_with_buttons
|
||||
gtk_info_bar_get_action_area
|
||||
gtk_info_bar_get_content_area
|
||||
gtk_info_bar_add_action_widget
|
||||
gtk_info_bar_add_button
|
||||
gtk_info_bar_add_buttons
|
||||
gtk_info_bar_set_response_sensitive
|
||||
gtk_info_bar_set_default_response
|
||||
gtk_info_bar_response
|
||||
gtk_info_bar_set_message_type
|
||||
gtk_info_bar_get_message_type
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef INCLUDE_VARIABLES
|
||||
gtk_binary_age
|
||||
gtk_interface_age
|
||||
|
||||
+15
-15
@@ -489,15 +489,15 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
priv->wrap_license = FALSE;
|
||||
|
||||
gtk_dialog_set_has_separator (dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
/* Widgets */
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 8);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (8));
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (dialog->vbox), vbox, TRUE, TRUE, 0);
|
||||
|
||||
priv->logo_image = gtk_image_new ();
|
||||
@@ -2127,12 +2127,12 @@ display_credits_dialog (GtkWidget *button,
|
||||
NULL);
|
||||
credits_dialog = GTK_DIALOG (dialog);
|
||||
gtk_dialog_set_has_separator (credits_dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (credits_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog->action_area), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (credits_dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (credits_dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
priv->credits_dialog = dialog;
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 260);
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), GTK_SIZE_ONE_TWELFTH_EM (360), GTK_SIZE_ONE_TWELFTH_EM (260));
|
||||
gtk_dialog_set_default_response (credits_dialog, GTK_RESPONSE_CANCEL);
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog),
|
||||
@@ -2145,7 +2145,7 @@ display_credits_dialog (GtkWidget *button,
|
||||
&(priv->credits_dialog));
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (notebook), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE, TRUE, 0);
|
||||
|
||||
if (priv->authors != NULL)
|
||||
@@ -2204,12 +2204,12 @@ display_license_dialog (GtkWidget *button,
|
||||
NULL);
|
||||
licence_dialog = GTK_DIALOG (dialog);
|
||||
gtk_dialog_set_has_separator (licence_dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (licence_dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (licence_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (licence_dialog->action_area), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (licence_dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (licence_dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (licence_dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
priv->license_dialog = dialog;
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), 420, 320);
|
||||
gtk_window_set_default_size (GTK_WINDOW (dialog), GTK_SIZE_ONE_TWELFTH_EM (420), GTK_SIZE_ONE_TWELFTH_EM (320));
|
||||
gtk_dialog_set_default_response (licence_dialog, GTK_RESPONSE_CANCEL);
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog),
|
||||
@@ -2222,7 +2222,7 @@ display_license_dialog (GtkWidget *button,
|
||||
&(priv->license_dialog));
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (sw), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (sw), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
|
||||
+80
-53
@@ -48,10 +48,10 @@ enum {
|
||||
|
||||
struct _GtkAlignmentPrivate
|
||||
{
|
||||
guint padding_top;
|
||||
guint padding_bottom;
|
||||
guint padding_left;
|
||||
guint padding_right;
|
||||
GtkUSize padding_top;
|
||||
GtkUSize padding_bottom;
|
||||
GtkUSize padding_left;
|
||||
GtkUSize padding_right;
|
||||
};
|
||||
|
||||
static void gtk_alignment_size_request (GtkWidget *widget,
|
||||
@@ -132,13 +132,11 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TOP_PADDING,
|
||||
g_param_spec_uint("top-padding",
|
||||
P_("Top Padding"),
|
||||
P_("The padding to insert at the top of the widget."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize("top-padding",
|
||||
P_("Top Padding"),
|
||||
P_("The padding to insert at the top of the widget."),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkAlignment:bottom-padding:
|
||||
@@ -149,13 +147,11 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BOTTOM_PADDING,
|
||||
g_param_spec_uint("bottom-padding",
|
||||
P_("Bottom Padding"),
|
||||
P_("The padding to insert at the bottom of the widget."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize("bottom-padding",
|
||||
P_("Bottom Padding"),
|
||||
P_("The padding to insert at the bottom of the widget."),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkAlignment:left-padding:
|
||||
@@ -166,13 +162,11 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LEFT_PADDING,
|
||||
g_param_spec_uint("left-padding",
|
||||
P_("Left Padding"),
|
||||
P_("The padding to insert at the left of the widget."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize("left-padding",
|
||||
P_("Left Padding"),
|
||||
P_("The padding to insert at the left of the widget."),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkAlignment:right-padding:
|
||||
@@ -183,13 +177,11 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_RIGHT_PADDING,
|
||||
g_param_spec_uint("right-padding",
|
||||
P_("Right Padding"),
|
||||
P_("The padding to insert at the right of the widget."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize("right-padding",
|
||||
P_("Right Padding"),
|
||||
P_("The padding to insert at the right of the widget."),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkAlignmentPrivate));
|
||||
}
|
||||
@@ -279,7 +271,7 @@ gtk_alignment_set_property (GObject *object,
|
||||
/* Padding: */
|
||||
case PROP_TOP_PADDING:
|
||||
gtk_alignment_set_padding (alignment,
|
||||
g_value_get_uint (value),
|
||||
gtk_value_get_usize (value),
|
||||
priv->padding_bottom,
|
||||
priv->padding_left,
|
||||
priv->padding_right);
|
||||
@@ -287,7 +279,7 @@ gtk_alignment_set_property (GObject *object,
|
||||
case PROP_BOTTOM_PADDING:
|
||||
gtk_alignment_set_padding (alignment,
|
||||
priv->padding_top,
|
||||
g_value_get_uint (value),
|
||||
gtk_value_get_usize (value),
|
||||
priv->padding_left,
|
||||
priv->padding_right);
|
||||
break;
|
||||
@@ -295,7 +287,7 @@ gtk_alignment_set_property (GObject *object,
|
||||
gtk_alignment_set_padding (alignment,
|
||||
priv->padding_top,
|
||||
priv->padding_bottom,
|
||||
g_value_get_uint (value),
|
||||
gtk_value_get_usize (value),
|
||||
priv->padding_right);
|
||||
break;
|
||||
case PROP_RIGHT_PADDING:
|
||||
@@ -303,7 +295,7 @@ gtk_alignment_set_property (GObject *object,
|
||||
priv->padding_top,
|
||||
priv->padding_bottom,
|
||||
priv->padding_left,
|
||||
g_value_get_uint (value));
|
||||
gtk_value_get_usize (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -341,16 +333,16 @@ gtk_alignment_get_property (GObject *object,
|
||||
|
||||
/* Padding: */
|
||||
case PROP_TOP_PADDING:
|
||||
g_value_set_uint (value, priv->padding_top);
|
||||
gtk_value_set_usize (value, priv->padding_top, alignment);
|
||||
break;
|
||||
case PROP_BOTTOM_PADDING:
|
||||
g_value_set_uint (value, priv->padding_bottom);
|
||||
gtk_value_set_usize (value, priv->padding_bottom, alignment);
|
||||
break;
|
||||
case PROP_LEFT_PADDING:
|
||||
g_value_set_uint (value, priv->padding_left);
|
||||
gtk_value_set_usize (value, priv->padding_left, alignment);
|
||||
break;
|
||||
case PROP_RIGHT_PADDING:
|
||||
g_value_set_uint (value, priv->padding_right);
|
||||
gtk_value_set_usize (value, priv->padding_right, alignment);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -431,8 +423,8 @@ gtk_alignment_size_request (GtkWidget *widget,
|
||||
requisition->height += child_requisition.height;
|
||||
|
||||
/* Request extra space for the padding: */
|
||||
requisition->width += (priv->padding_left + priv->padding_right);
|
||||
requisition->height += (priv->padding_top + priv->padding_bottom);
|
||||
requisition->width += (gtk_widget_size_to_pixel (widget, priv->padding_left) + gtk_widget_size_to_pixel (widget, priv->padding_right));
|
||||
requisition->height += (gtk_widget_size_to_pixel (widget, priv->padding_top) + gtk_widget_size_to_pixel (widget, priv->padding_bottom));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,8 +455,8 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
||||
border_width = GTK_CONTAINER (alignment)->border_width;
|
||||
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (widget);
|
||||
padding_horizontal = priv->padding_left + priv->padding_right;
|
||||
padding_vertical = priv->padding_top + priv->padding_bottom;
|
||||
padding_horizontal = gtk_widget_size_to_pixel (widget, priv->padding_left) + gtk_widget_size_to_pixel (widget, priv->padding_right);
|
||||
padding_vertical = gtk_widget_size_to_pixel (widget, priv->padding_top) + gtk_widget_size_to_pixel (widget, priv->padding_bottom);
|
||||
|
||||
width = MAX (1, allocation->width - padding_horizontal - 2 * border_width);
|
||||
height = MAX (1, allocation->height - padding_vertical - 2 * border_width);
|
||||
@@ -484,11 +476,11 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
||||
child_allocation.height = height;
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||
child_allocation.x = (1.0 - alignment->xalign) * (width - child_allocation.width) + allocation->x + border_width + priv->padding_right;
|
||||
child_allocation.x = (1.0 - alignment->xalign) * (width - child_allocation.width) + allocation->x + border_width + gtk_widget_size_to_pixel (widget, priv->padding_right);
|
||||
else
|
||||
child_allocation.x = alignment->xalign * (width - child_allocation.width) + allocation->x + border_width + priv->padding_left;
|
||||
child_allocation.x = alignment->xalign * (width - child_allocation.width) + allocation->x + border_width + gtk_widget_size_to_pixel (widget, priv->padding_left);
|
||||
|
||||
child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + border_width + priv->padding_top;
|
||||
child_allocation.y = alignment->yalign * (height - child_allocation.height) + allocation->y + border_width + gtk_widget_size_to_pixel (widget, priv->padding_top);
|
||||
|
||||
gtk_widget_size_allocate (bin->child, &child_allocation);
|
||||
}
|
||||
@@ -511,10 +503,10 @@ gtk_alignment_size_allocate (GtkWidget *widget,
|
||||
*/
|
||||
void
|
||||
gtk_alignment_set_padding (GtkAlignment *alignment,
|
||||
guint padding_top,
|
||||
guint padding_bottom,
|
||||
guint padding_left,
|
||||
guint padding_right)
|
||||
GtkUSize padding_top,
|
||||
GtkUSize padding_bottom,
|
||||
GtkUSize padding_left,
|
||||
GtkUSize padding_right)
|
||||
{
|
||||
GtkAlignmentPrivate *priv;
|
||||
|
||||
@@ -562,8 +554,9 @@ gtk_alignment_set_padding (GtkAlignment *alignment,
|
||||
* @padding_left: location to store the padding for the left of the widget, or %NULL
|
||||
* @padding_right: location to store the padding for the right of the widget, or %NULL
|
||||
*
|
||||
* Gets the padding on the different sides of the widget.
|
||||
* See gtk_alignment_set_padding ().
|
||||
* Gets the padding in pixels on the different sides of the widget.
|
||||
* See gtk_alignment_set_padding (). Use gtk_alignment_get_padding_unit() to
|
||||
* preserve units.
|
||||
*
|
||||
* Since: 2.4
|
||||
*/
|
||||
@@ -578,6 +571,40 @@ gtk_alignment_get_padding (GtkAlignment *alignment,
|
||||
|
||||
g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
|
||||
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (alignment);
|
||||
if(padding_top)
|
||||
*padding_top = gtk_widget_size_to_pixel (alignment, priv->padding_top);
|
||||
if(padding_bottom)
|
||||
*padding_bottom = gtk_widget_size_to_pixel (alignment, priv->padding_bottom);
|
||||
if(padding_left)
|
||||
*padding_left = gtk_widget_size_to_pixel (alignment, priv->padding_left);
|
||||
if(padding_right)
|
||||
*padding_right = gtk_widget_size_to_pixel (alignment, priv->padding_right);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_alignment_get_padding_unit:
|
||||
* @alignment: a #GtkAlignment
|
||||
* @padding_top: location to store the padding for the top of the widget, or %NULL
|
||||
* @padding_bottom: location to store the padding for the bottom of the widget, or %NULL
|
||||
* @padding_left: location to store the padding for the left of the widget, or %NULL
|
||||
* @padding_right: location to store the padding for the right of the widget, or %NULL
|
||||
*
|
||||
* Like gtk_alignment_get_padding() but preserves the unit.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
void
|
||||
gtk_alignment_get_padding_unit (GtkAlignment *alignment,
|
||||
GtkUSize *padding_top,
|
||||
GtkUSize *padding_bottom,
|
||||
GtkUSize *padding_left,
|
||||
GtkUSize *padding_right)
|
||||
{
|
||||
GtkAlignmentPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_ALIGNMENT (alignment));
|
||||
|
||||
priv = GTK_ALIGNMENT_GET_PRIVATE (alignment);
|
||||
if(padding_top)
|
||||
*padding_top = priv->padding_top;
|
||||
|
||||
+10
-4
@@ -77,10 +77,10 @@ void gtk_alignment_set (GtkAlignment *alignment,
|
||||
gfloat yscale);
|
||||
|
||||
void gtk_alignment_set_padding (GtkAlignment *alignment,
|
||||
guint padding_top,
|
||||
guint padding_bottom,
|
||||
guint padding_left,
|
||||
guint padding_right);
|
||||
GtkUSize padding_top,
|
||||
GtkUSize padding_bottom,
|
||||
GtkUSize padding_left,
|
||||
GtkUSize padding_right);
|
||||
|
||||
void gtk_alignment_get_padding (GtkAlignment *alignment,
|
||||
guint *padding_top,
|
||||
@@ -88,6 +88,12 @@ void gtk_alignment_get_padding (GtkAlignment *alignment,
|
||||
guint *padding_left,
|
||||
guint *padding_right);
|
||||
|
||||
void gtk_alignment_get_padding_unit (GtkAlignment *alignment,
|
||||
GtkUSize *padding_top,
|
||||
GtkUSize *padding_bottom,
|
||||
GtkUSize *padding_left,
|
||||
GtkUSize *padding_right);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
|
||||
+12
-5
@@ -31,7 +31,7 @@
|
||||
#include "gtkintl.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
#define MIN_ARROW_SIZE 15
|
||||
#define MIN_ARROW_SIZE GTK_SIZE_ONE_TWELFTH_EM(15)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@@ -50,7 +50,8 @@ static void gtk_arrow_get_property (GObject *object,
|
||||
GParamSpec *pspec);
|
||||
static gboolean gtk_arrow_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
|
||||
static void gtk_arrow_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
|
||||
G_DEFINE_TYPE (GtkArrow, gtk_arrow, GTK_TYPE_MISC)
|
||||
|
||||
@@ -68,6 +69,7 @@ gtk_arrow_class_init (GtkArrowClass *class)
|
||||
gobject_class->get_property = gtk_arrow_get_property;
|
||||
|
||||
widget_class->expose_event = gtk_arrow_expose;
|
||||
widget_class->size_request = gtk_arrow_size_request;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ARROW_TYPE,
|
||||
@@ -148,9 +150,6 @@ gtk_arrow_init (GtkArrow *arrow)
|
||||
{
|
||||
GTK_WIDGET_SET_FLAGS (arrow, GTK_NO_WINDOW);
|
||||
|
||||
GTK_WIDGET (arrow)->requisition.width = MIN_ARROW_SIZE + GTK_MISC (arrow)->xpad * 2;
|
||||
GTK_WIDGET (arrow)->requisition.height = MIN_ARROW_SIZE + GTK_MISC (arrow)->ypad * 2;
|
||||
|
||||
arrow->arrow_type = GTK_ARROW_RIGHT;
|
||||
arrow->shadow_type = GTK_SHADOW_OUT;
|
||||
}
|
||||
@@ -200,6 +199,14 @@ gtk_arrow_set (GtkArrow *arrow,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_arrow_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkArrow *arrow = GTK_ARROW (widget);
|
||||
requisition->width = gtk_widget_size_to_pixel (arrow, MIN_ARROW_SIZE) + GTK_MISC (arrow)->xpad * 2;
|
||||
requisition->height = gtk_widget_size_to_pixel (arrow, MIN_ARROW_SIZE) + GTK_MISC (arrow)->ypad * 2;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_arrow_expose (GtkWidget *widget,
|
||||
|
||||
+35
-40
@@ -46,8 +46,8 @@
|
||||
|
||||
#define GTK_ASSISTANT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_ASSISTANT, GtkAssistantPrivate))
|
||||
|
||||
#define HEADER_SPACING 12
|
||||
#define ACTION_AREA_SPACING 12
|
||||
#define HEADER_SPACING GTK_SIZE_ONE_TWELFTH_EM(12)
|
||||
#define ACTION_AREA_SPACING GTK_SIZE_ONE_TWELFTH_EM(12)
|
||||
|
||||
typedef struct _GtkAssistantPage GtkAssistantPage;
|
||||
|
||||
@@ -217,7 +217,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
* @assistant: the #GtkAssistant
|
||||
* @page: the current page
|
||||
*
|
||||
* The ::prepared signal is emitted when a new page is set as the assistant's
|
||||
* The ::prepare signal is emitted when a new page is set as the assistant's
|
||||
* current page, before making the new page visible. A handler for this signal
|
||||
* can do any preparation which are necessary before showing @page.
|
||||
*
|
||||
@@ -237,14 +237,14 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
* @assistant: the @GtkAssistant
|
||||
*
|
||||
* The ::apply signal is emitted when the apply button is clicked. The default
|
||||
* behavior of the #GtkAssistant is to switch to the page after the current page,
|
||||
* unless the current page is the last one.
|
||||
* behavior of the #GtkAssistant is to switch to the page after the current
|
||||
* page, unless the current page is the last one.
|
||||
*
|
||||
* A handler for the ::apply signal should carry out the actions for which the
|
||||
* wizard has collected data. If the action takes a long time to complete, you
|
||||
* might consider to put a page of type GTK_ASSISTANT_PAGE_PROGRESS after the
|
||||
* confirmation page and handle this operation within the ::prepare signal of
|
||||
* the progress page.
|
||||
* A handler for the ::apply signal should carry out the actions for which
|
||||
* the wizard has collected data. If the action takes a long time to complete,
|
||||
* you might consider to put a page of type %GTK_ASSISTANT_PAGE_PROGRESS
|
||||
* after the confirmation page and handle this operation within the
|
||||
* #GtkAssistant::prepare signal of the progress page.
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
@@ -263,7 +263,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
*
|
||||
* The ::close signal is emitted either when the close button of
|
||||
* a summary page is clicked, or when the apply button in the last
|
||||
* page in the flow (of type GTK_ASSISTANT_PAGE_CONFIRM) is clicked.
|
||||
* page in the flow (of type %GTK_ASSISTANT_PAGE_CONFIRM) is clicked.
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
@@ -277,26 +277,22 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("header-padding",
|
||||
P_("Header Padding"),
|
||||
P_("Number of pixels around the header."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
6,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("header-padding",
|
||||
P_("Header Padding"),
|
||||
P_("Number of pixels around the header."),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (6),
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("content-padding",
|
||||
P_("Content Padding"),
|
||||
P_("Number of pixels around the content pages."),
|
||||
0,
|
||||
G_MAXINT,
|
||||
1,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("content-padding",
|
||||
P_("Content Padding"),
|
||||
P_("Number of pixels around the content pages."),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (1),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkAssistant:page-type:
|
||||
*
|
||||
* The type of the assistant page.
|
||||
* The type of the assistant page.
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
@@ -312,7 +308,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
/**
|
||||
* GtkAssistant:title:
|
||||
*
|
||||
* The title that is displayed in the page header.
|
||||
* The title that is displayed in the page header.
|
||||
*
|
||||
* If title and header-image are both %NULL, no header is displayed.
|
||||
*
|
||||
@@ -346,7 +342,7 @@ gtk_assistant_class_init (GtkAssistantClass *class)
|
||||
/**
|
||||
* GtkAssistant:header-image:
|
||||
*
|
||||
* The image that is displayed next to the page.
|
||||
* The image that is displayed next to the page.
|
||||
*
|
||||
* Set this to %NULL to make the sidebar disappear.
|
||||
*
|
||||
@@ -430,14 +426,12 @@ compute_last_button_state (GtkAssistant *assistant)
|
||||
page_info = g_list_nth_data (priv->pages, page_num);
|
||||
|
||||
count++;
|
||||
|
||||
g_assert (page_info);
|
||||
}
|
||||
|
||||
/* make the last button visible if we can skip multiple
|
||||
* pages and end on a confirmation or summary page
|
||||
* pages and end on a confirmation or summary page
|
||||
*/
|
||||
if (count > 1 &&
|
||||
if (count > 1 && page_info &&
|
||||
(page_info->type == GTK_ASSISTANT_PAGE_CONFIRM ||
|
||||
page_info->type == GTK_ASSISTANT_PAGE_SUMMARY))
|
||||
{
|
||||
@@ -729,7 +723,8 @@ gtk_assistant_init (GtkAssistant *assistant)
|
||||
priv = assistant->priv = GTK_ASSISTANT_GET_PRIVATE (assistant);
|
||||
|
||||
gtk_container_set_reallocate_redraws (GTK_CONTAINER (assistant), TRUE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (assistant), 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (assistant),
|
||||
GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
@@ -746,7 +741,7 @@ gtk_assistant_init (GtkAssistant *assistant)
|
||||
gtk_widget_show (priv->sidebar_image);
|
||||
|
||||
/* Action area */
|
||||
priv->action_area = gtk_hbox_new (FALSE, 6);
|
||||
priv->action_area = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
|
||||
assistant->close = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
|
||||
assistant->apply = gtk_button_new_from_stock (GTK_STOCK_APPLY);
|
||||
@@ -1106,7 +1101,7 @@ gtk_assistant_size_request (GtkWidget *widget,
|
||||
|
||||
if (page->header_image)
|
||||
{
|
||||
w += gdk_pixbuf_get_width (page->header_image) + HEADER_SPACING;
|
||||
w += gdk_pixbuf_get_width (page->header_image) + gtk_widget_size_to_pixel (widget, HEADER_SPACING);
|
||||
h = MAX (h, gdk_pixbuf_get_height (page->header_image));
|
||||
}
|
||||
|
||||
@@ -1127,7 +1122,7 @@ gtk_assistant_size_request (GtkWidget *widget,
|
||||
|
||||
gtk_widget_size_request (priv->action_area, &child_requisition);
|
||||
width = MAX (width, child_requisition.width);
|
||||
height += child_requisition.height + ACTION_AREA_SPACING;
|
||||
height += child_requisition.height + gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING);
|
||||
|
||||
width += GTK_CONTAINER (widget)->border_width * 2 + content_padding * 2;
|
||||
height += GTK_CONTAINER (widget)->border_width * 2 + content_padding * 2;
|
||||
@@ -1198,7 +1193,7 @@ gtk_assistant_size_allocate (GtkWidget *widget,
|
||||
priv->header_image->allocation.height + 2 * header_padding + content_padding;
|
||||
child_allocation.width = allocation->width - 2 * GTK_CONTAINER (widget)->border_width - 2 * content_padding;
|
||||
child_allocation.height = allocation->height - 2 * GTK_CONTAINER (widget)->border_width -
|
||||
priv->header_image->allocation.height - 2 * header_padding - ACTION_AREA_SPACING - priv->action_area->allocation.height - 2 * content_padding;
|
||||
priv->header_image->allocation.height - 2 * header_padding - gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING) - priv->action_area->allocation.height - 2 * content_padding;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (priv->sidebar_image))
|
||||
{
|
||||
@@ -1329,7 +1324,7 @@ assistant_paint_colored_box (GtkWidget *widget)
|
||||
border_width,
|
||||
border_width,
|
||||
widget->allocation.width - 2 * border_width,
|
||||
widget->allocation.height - priv->action_area->allocation.height - 2 * border_width - ACTION_AREA_SPACING);
|
||||
widget->allocation.height - priv->action_area->allocation.height - 2 * border_width - gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING));
|
||||
cairo_fill (cr);
|
||||
|
||||
/* content box */
|
||||
@@ -1350,7 +1345,7 @@ assistant_paint_colored_box (GtkWidget *widget)
|
||||
priv->header_image->allocation.height + content_padding + 2 * header_padding + border_width,
|
||||
content_width,
|
||||
widget->allocation.height - 2 * border_width - priv->action_area->allocation.height -
|
||||
priv->header_image->allocation.height - 2 * content_padding - 2 * header_padding - ACTION_AREA_SPACING);
|
||||
priv->header_image->allocation.height - 2 * content_padding - 2 * header_padding - gtk_widget_size_to_pixel (widget, ACTION_AREA_SPACING));
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
@@ -2174,7 +2169,7 @@ gtk_assistant_set_page_complete (GtkAssistant *assistant,
|
||||
* @assistant: a #GtkAssistant
|
||||
* @page: a page of @assistant
|
||||
*
|
||||
* Gets whether @page is complete..
|
||||
* Gets whether @page is complete.
|
||||
*
|
||||
* Return value: %TRUE if @page is complete.
|
||||
*
|
||||
|
||||
+387
-46
@@ -26,6 +26,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "gtkbbox.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkalias.h"
|
||||
@@ -48,6 +49,10 @@ static void gtk_button_box_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_button_box_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static void gtk_button_box_set_child_property (GtkContainer *container,
|
||||
GtkWidget *child,
|
||||
guint property_id,
|
||||
@@ -59,9 +64,9 @@ static void gtk_button_box_get_child_property (GtkContainer *container,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
#define DEFAULT_CHILD_MIN_WIDTH 85
|
||||
#define DEFAULT_CHILD_MIN_HEIGHT 27
|
||||
#define DEFAULT_CHILD_IPAD_X 4
|
||||
#define DEFAULT_CHILD_MIN_WIDTH GTK_SIZE_ONE_TWELFTH_EM(85)
|
||||
#define DEFAULT_CHILD_MIN_HEIGHT GTK_SIZE_ONE_TWELFTH_EM(27)
|
||||
#define DEFAULT_CHILD_IPAD_X GTK_SIZE_ONE_TWELFTH_EM(4)
|
||||
#define DEFAULT_CHILD_IPAD_Y 0
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (GtkButtonBox, gtk_button_box, GTK_TYPE_BOX)
|
||||
@@ -80,6 +85,9 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
|
||||
gobject_class->set_property = gtk_button_box_set_property;
|
||||
gobject_class->get_property = gtk_button_box_get_property;
|
||||
|
||||
widget_class->size_request = gtk_button_box_size_request;
|
||||
widget_class->size_allocate = gtk_button_box_size_allocate;
|
||||
|
||||
container_class->set_child_property = gtk_button_box_set_child_property;
|
||||
container_class->get_child_property = gtk_button_box_get_child_property;
|
||||
|
||||
@@ -87,40 +95,32 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
|
||||
* libgobject allows that.
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-min-width",
|
||||
P_("Minimum child width"),
|
||||
P_("Minimum width of buttons inside the box"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_CHILD_MIN_WIDTH,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-min-width",
|
||||
P_("Minimum child width"),
|
||||
P_("Minimum width of buttons inside the box"),
|
||||
0, G_MAXINT, DEFAULT_CHILD_MIN_WIDTH,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-min-height",
|
||||
P_("Minimum child height"),
|
||||
P_("Minimum height of buttons inside the box"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_CHILD_MIN_HEIGHT,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-min-height",
|
||||
P_("Minimum child height"),
|
||||
P_("Minimum height of buttons inside the box"),
|
||||
0, G_MAXINT, DEFAULT_CHILD_MIN_HEIGHT,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-internal-pad-x",
|
||||
P_("Child internal width padding"),
|
||||
P_("Amount to increase child's size on either side"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_CHILD_IPAD_X,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-internal-pad-x",
|
||||
P_("Child internal width padding"),
|
||||
P_("Amount to increase child's size on either side"),
|
||||
0, G_MAXINT, DEFAULT_CHILD_IPAD_X,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-internal-pad-y",
|
||||
P_("Child internal height padding"),
|
||||
P_("Amount to increase child's size on the top and bottom"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_CHILD_IPAD_Y,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-internal-pad-y",
|
||||
P_("Child internal height padding"),
|
||||
P_("Amount to increase child's size on the top and bottom"),
|
||||
0, G_MAXINT, DEFAULT_CHILD_IPAD_Y,
|
||||
GTK_PARAM_READABLE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LAYOUT_STYLE,
|
||||
g_param_spec_enum ("layout-style",
|
||||
@@ -142,7 +142,7 @@ gtk_button_box_class_init (GtkButtonBoxClass *class)
|
||||
static void
|
||||
gtk_button_box_init (GtkButtonBox *button_box)
|
||||
{
|
||||
GTK_BOX (button_box)->spacing = 0;
|
||||
gtk_box_set_spacing (GTK_BOX (button_box), 0);
|
||||
button_box->child_min_width = GTK_BUTTONBOX_DEFAULT;
|
||||
button_box->child_min_height = GTK_BUTTONBOX_DEFAULT;
|
||||
button_box->child_ipad_x = GTK_BUTTONBOX_DEFAULT;
|
||||
@@ -228,7 +228,7 @@ gtk_button_box_get_child_property (GtkContainer *container,
|
||||
|
||||
void
|
||||
gtk_button_box_set_child_size (GtkButtonBox *widget,
|
||||
gint width, gint height)
|
||||
GtkSize width, GtkSize height)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
|
||||
|
||||
@@ -238,7 +238,7 @@ gtk_button_box_set_child_size (GtkButtonBox *widget,
|
||||
|
||||
void
|
||||
gtk_button_box_set_child_ipadding (GtkButtonBox *widget,
|
||||
gint ipad_x, gint ipad_y)
|
||||
GtkSize ipad_x, GtkSize ipad_y)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
|
||||
|
||||
@@ -273,8 +273,8 @@ gtk_button_box_get_child_size (GtkButtonBox *widget,
|
||||
g_return_if_fail (width != NULL);
|
||||
g_return_if_fail (height != NULL);
|
||||
|
||||
*width = widget->child_min_width;
|
||||
*height = widget->child_min_height;
|
||||
*width = gtk_widget_size_to_pixel (widget, widget->child_min_width);
|
||||
*height = gtk_widget_size_to_pixel (widget, widget->child_min_height);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -285,8 +285,8 @@ gtk_button_box_get_child_ipadding (GtkButtonBox *widget,
|
||||
g_return_if_fail (ipad_x != NULL);
|
||||
g_return_if_fail (ipad_y != NULL);
|
||||
|
||||
*ipad_x = widget->child_ipad_x;
|
||||
*ipad_y = widget->child_ipad_y;
|
||||
*ipad_x = gtk_widget_size_to_pixel (widget, widget->child_ipad_x);
|
||||
*ipad_y = gtk_widget_size_to_pixel (widget, widget->child_ipad_y);
|
||||
}
|
||||
|
||||
GtkButtonBoxStyle
|
||||
@@ -425,14 +425,14 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
|
||||
"child-internal-pad-y", &ipad_y_default,
|
||||
NULL);
|
||||
|
||||
child_min_width = bbox->child_min_width != GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_min_width : width_default;
|
||||
child_min_height = bbox->child_min_height !=GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_min_height : height_default;
|
||||
ipad_x = bbox->child_ipad_x != GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_ipad_x : ipad_x_default;
|
||||
ipad_y = bbox->child_ipad_y != GTK_BUTTONBOX_DEFAULT
|
||||
? bbox->child_ipad_y : ipad_y_default;
|
||||
child_min_width = gtk_widget_size_to_pixel (widget, bbox->child_min_width) != GTK_BUTTONBOX_DEFAULT
|
||||
? gtk_widget_size_to_pixel (widget, bbox->child_min_width) : width_default;
|
||||
child_min_height = gtk_widget_size_to_pixel (widget, bbox->child_min_height) !=GTK_BUTTONBOX_DEFAULT
|
||||
? gtk_widget_size_to_pixel (widget, bbox->child_min_height) : height_default;
|
||||
ipad_x = gtk_widget_size_to_pixel (widget, bbox->child_ipad_x) != GTK_BUTTONBOX_DEFAULT
|
||||
? gtk_widget_size_to_pixel (widget, bbox->child_ipad_x) : ipad_x_default;
|
||||
ipad_y = gtk_widget_size_to_pixel (widget, bbox->child_ipad_y) != GTK_BUTTONBOX_DEFAULT
|
||||
? gtk_widget_size_to_pixel (widget, bbox->child_ipad_y) : ipad_y_default;
|
||||
|
||||
nchildren = 0;
|
||||
nsecondaries = 0;
|
||||
@@ -471,5 +471,346 @@ _gtk_button_box_child_requisition (GtkWidget *widget,
|
||||
*height = needed_height;
|
||||
}
|
||||
|
||||
/* this is a kludge function to support the deprecated
|
||||
* gtk_[vh]button_box_set_layout_default() just in case anyone is still
|
||||
* using it (why?)
|
||||
*/
|
||||
static GtkButtonBoxStyle
|
||||
gtk_button_box_kludge_get_layout_default (GtkButtonBox *widget)
|
||||
{
|
||||
GtkOrientation orientation;
|
||||
|
||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
return gtk_hbutton_box_get_layout_default ();
|
||||
else
|
||||
return gtk_vbutton_box_get_layout_default ();
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_box_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition)
|
||||
{
|
||||
GtkBox *box;
|
||||
GtkButtonBox *bbox;
|
||||
gint nvis_children;
|
||||
gint child_width;
|
||||
gint child_height;
|
||||
gint spacing;
|
||||
GtkButtonBoxStyle layout;
|
||||
GtkOrientation orientation;
|
||||
|
||||
box = GTK_BOX (widget);
|
||||
bbox = GTK_BUTTON_BOX (widget);
|
||||
|
||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
|
||||
spacing = box->spacing;
|
||||
layout = bbox->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
|
||||
? bbox->layout_style : gtk_button_box_kludge_get_layout_default (GTK_BUTTON_BOX (widget));
|
||||
|
||||
_gtk_button_box_child_requisition (widget,
|
||||
&nvis_children,
|
||||
NULL,
|
||||
&child_width,
|
||||
&child_height);
|
||||
|
||||
if (nvis_children == 0)
|
||||
{
|
||||
requisition->width = 0;
|
||||
requisition->height = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (layout)
|
||||
{
|
||||
case GTK_BUTTONBOX_SPREAD:
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
requisition->width =
|
||||
nvis_children*child_width + ((nvis_children+1)*spacing);
|
||||
else
|
||||
requisition->height =
|
||||
nvis_children*child_height + ((nvis_children+1)*spacing);
|
||||
|
||||
break;
|
||||
case GTK_BUTTONBOX_EDGE:
|
||||
case GTK_BUTTONBOX_START:
|
||||
case GTK_BUTTONBOX_END:
|
||||
case GTK_BUTTONBOX_CENTER:
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
requisition->width =
|
||||
nvis_children*child_width + ((nvis_children-1)*spacing);
|
||||
else
|
||||
requisition->height =
|
||||
nvis_children*child_height + ((nvis_children-1)*spacing);
|
||||
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
requisition->height = child_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
requisition->width = child_width;
|
||||
}
|
||||
}
|
||||
|
||||
requisition->width += GTK_CONTAINER (box)->border_width * 2;
|
||||
requisition->height += GTK_CONTAINER (box)->border_width * 2;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_button_box_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkBox *base_box;
|
||||
GtkButtonBox *box;
|
||||
GtkBoxChild *child;
|
||||
GList *children;
|
||||
GtkAllocation child_allocation;
|
||||
gint nvis_children;
|
||||
gint n_secondaries;
|
||||
gint child_width;
|
||||
gint child_height;
|
||||
gint x = 0;
|
||||
gint y = 0;
|
||||
gint secondary_x = 0;
|
||||
gint secondary_y = 0;
|
||||
gint width;
|
||||
gint height;
|
||||
gint childspace;
|
||||
gint childspacing = 0;
|
||||
GtkButtonBoxStyle layout;
|
||||
gint spacing;
|
||||
GtkOrientation orientation;
|
||||
|
||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
|
||||
base_box = GTK_BOX (widget);
|
||||
box = GTK_BUTTON_BOX (widget);
|
||||
spacing = base_box->spacing;
|
||||
layout = box->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
|
||||
? box->layout_style : gtk_button_box_kludge_get_layout_default (GTK_BUTTON_BOX (widget));
|
||||
_gtk_button_box_child_requisition (widget,
|
||||
&nvis_children,
|
||||
&n_secondaries,
|
||||
&child_width,
|
||||
&child_height);
|
||||
widget->allocation = *allocation;
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
width = allocation->width - GTK_CONTAINER (box)->border_width*2;
|
||||
else
|
||||
height = allocation->height - GTK_CONTAINER (box)->border_width*2;
|
||||
|
||||
switch (layout)
|
||||
{
|
||||
case GTK_BUTTONBOX_SPREAD:
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
childspacing = (width - (nvis_children * child_width))
|
||||
/ (nvis_children + 1);
|
||||
x = allocation->x + GTK_CONTAINER (box)->border_width
|
||||
+ childspacing;
|
||||
secondary_x = x + ((nvis_children - n_secondaries)
|
||||
* (child_width + childspacing));
|
||||
}
|
||||
else
|
||||
{
|
||||
childspacing = (height - (nvis_children * child_height))
|
||||
/ (nvis_children + 1);
|
||||
y = allocation->y + GTK_CONTAINER (box)->border_width
|
||||
+ childspacing;
|
||||
secondary_y = y + ((nvis_children - n_secondaries)
|
||||
* (child_height + childspacing));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GTK_BUTTONBOX_EDGE:
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
if (nvis_children >= 2)
|
||||
{
|
||||
childspacing = (width - (nvis_children * child_width))
|
||||
/ (nvis_children - 1);
|
||||
x = allocation->x + GTK_CONTAINER (box)->border_width;
|
||||
secondary_x = x + ((nvis_children - n_secondaries)
|
||||
* (child_width + childspacing));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* one or zero children, just center */
|
||||
childspacing = width;
|
||||
x = secondary_x = allocation->x
|
||||
+ (allocation->width - child_width) / 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nvis_children >= 2)
|
||||
{
|
||||
childspacing = (height - (nvis_children*child_height))
|
||||
/ (nvis_children-1);
|
||||
y = allocation->y + GTK_CONTAINER (box)->border_width;
|
||||
secondary_y = y + ((nvis_children - n_secondaries)
|
||||
* (child_height + childspacing));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* one or zero children, just center */
|
||||
childspacing = height;
|
||||
y = secondary_y = allocation->y
|
||||
+ (allocation->height - child_height) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GTK_BUTTONBOX_START:
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
childspacing = spacing;
|
||||
x = allocation->x + GTK_CONTAINER (box)->border_width;
|
||||
secondary_x = allocation->x + allocation->width
|
||||
- child_width * n_secondaries
|
||||
- spacing * (n_secondaries - 1)
|
||||
- GTK_CONTAINER (box)->border_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
childspacing = spacing;
|
||||
y = allocation->y + GTK_CONTAINER (box)->border_width;
|
||||
secondary_y = allocation->y + allocation->height
|
||||
- child_height * n_secondaries
|
||||
- spacing * (n_secondaries - 1)
|
||||
- GTK_CONTAINER (box)->border_width;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GTK_BUTTONBOX_END:
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
childspacing = spacing;
|
||||
x = allocation->x + allocation->width
|
||||
- child_width * (nvis_children - n_secondaries)
|
||||
- spacing * (nvis_children - n_secondaries - 1)
|
||||
- GTK_CONTAINER (box)->border_width;
|
||||
secondary_x = allocation->x + GTK_CONTAINER (box)->border_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
childspacing = spacing;
|
||||
y = allocation->y + allocation->height
|
||||
- child_height * (nvis_children - n_secondaries)
|
||||
- spacing * (nvis_children - n_secondaries - 1)
|
||||
- GTK_CONTAINER (box)->border_width;
|
||||
secondary_y = allocation->y + GTK_CONTAINER (box)->border_width;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GTK_BUTTONBOX_CENTER:
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
childspacing = spacing;
|
||||
x = allocation->x +
|
||||
(allocation->width
|
||||
- (child_width * (nvis_children - n_secondaries)
|
||||
+ spacing * (nvis_children - n_secondaries - 1)))/2
|
||||
+ (n_secondaries * child_width + n_secondaries * spacing)/2;
|
||||
secondary_x = allocation->x + GTK_CONTAINER (box)->border_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
childspacing = spacing;
|
||||
y = allocation->y +
|
||||
(allocation->height
|
||||
- (child_height * (nvis_children - n_secondaries)
|
||||
+ spacing * (nvis_children - n_secondaries - 1)))/2
|
||||
+ (n_secondaries * child_height + n_secondaries * spacing)/2;
|
||||
secondary_y = allocation->y + GTK_CONTAINER (box)->border_width;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
break;
|
||||
}
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
y = allocation->y + (allocation->height - child_height) / 2;
|
||||
childspace = child_width + childspacing;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = allocation->x + (allocation->width - child_width) / 2;
|
||||
childspace = child_height + childspacing;
|
||||
}
|
||||
|
||||
children = GTK_BOX (box)->children;
|
||||
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
children = children->next;
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (child->widget))
|
||||
{
|
||||
child_allocation.width = child_width;
|
||||
child_allocation.height = child_height;
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
child_allocation.y = y;
|
||||
|
||||
if (child->is_secondary)
|
||||
{
|
||||
child_allocation.x = secondary_x;
|
||||
secondary_x += childspace;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.x = x;
|
||||
x += childspace;
|
||||
}
|
||||
|
||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
||||
child_allocation.x = (allocation->x + allocation->width)
|
||||
- (child_allocation.x + child_width - allocation->x);
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.x = x;
|
||||
|
||||
if (child->is_secondary)
|
||||
{
|
||||
child_allocation.y = secondary_y;
|
||||
secondary_y += childspace;
|
||||
}
|
||||
else
|
||||
{
|
||||
child_allocation.y = y;
|
||||
y += childspace;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_size_allocate (child->widget, &child_allocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define __GTK_BUTTON_BOX_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+9
-8
@@ -52,10 +52,10 @@ typedef struct _GtkButtonBoxClass GtkButtonBoxClass;
|
||||
struct _GtkButtonBox
|
||||
{
|
||||
GtkBox box;
|
||||
gint GSEAL (child_min_width);
|
||||
gint GSEAL (child_min_height);
|
||||
gint GSEAL (child_ipad_x);
|
||||
gint GSEAL (child_ipad_y);
|
||||
GtkSize GSEAL (child_min_width);
|
||||
GtkSize GSEAL (child_min_height);
|
||||
GtkSize GSEAL (child_ipad_x);
|
||||
GtkSize GSEAL (child_ipad_y);
|
||||
GtkButtonBoxStyle GSEAL (layout_style);
|
||||
};
|
||||
|
||||
@@ -81,17 +81,18 @@ void gtk_button_box_set_child_secondary (GtkButtonBox *widget,
|
||||
#define gtk_button_box_get_spacing(b) gtk_box_get_spacing (GTK_BOX (b))
|
||||
|
||||
void gtk_button_box_set_child_size (GtkButtonBox *widget,
|
||||
gint min_width,
|
||||
gint min_height);
|
||||
GtkSize min_width,
|
||||
GtkSize min_height);
|
||||
void gtk_button_box_set_child_ipadding (GtkButtonBox *widget,
|
||||
gint ipad_x,
|
||||
gint ipad_y);
|
||||
GtkSize ipad_x,
|
||||
GtkSize ipad_y);
|
||||
void gtk_button_box_get_child_size (GtkButtonBox *widget,
|
||||
gint *min_width,
|
||||
gint *min_height);
|
||||
void gtk_button_box_get_child_ipadding (GtkButtonBox *widget,
|
||||
gint *ipad_x,
|
||||
gint *ipad_y);
|
||||
/* no unit getters because these functions are deprecated already */
|
||||
#endif
|
||||
|
||||
/* Internal method - do not use. */
|
||||
|
||||
+220
-45
@@ -48,7 +48,6 @@ enum {
|
||||
CHILD_PROP_POSITION
|
||||
};
|
||||
|
||||
|
||||
typedef struct _GtkBoxPrivate GtkBoxPrivate;
|
||||
|
||||
struct _GtkBoxPrivate
|
||||
@@ -56,10 +55,16 @@ struct _GtkBoxPrivate
|
||||
GtkOrientation orientation;
|
||||
guint default_expand : 1;
|
||||
guint spacing_set : 1;
|
||||
GtkSize spacing_unit;
|
||||
GHashTable *child_map;
|
||||
};
|
||||
|
||||
#define GTK_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_BOX, GtkBoxPrivate))
|
||||
typedef struct
|
||||
{
|
||||
GtkUSize padding_unit;
|
||||
} GtkBoxChildPrivate;
|
||||
|
||||
#define GTK_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_BOX, GtkBoxPrivate))
|
||||
|
||||
static void gtk_box_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@@ -94,24 +99,55 @@ static void gtk_box_get_child_property (GtkContainer *container,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static GType gtk_box_child_type (GtkContainer *container);
|
||||
|
||||
static void gtk_box_finalize (GObject *object);
|
||||
static void gtk_box_unit_changed (GtkWidget *widget);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GtkBox, gtk_box, GTK_TYPE_CONTAINER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
|
||||
NULL));
|
||||
|
||||
static void
|
||||
add_priv_child (GtkBox *box, GtkBoxChild *child, GtkBoxChildPrivate *priv_child)
|
||||
{
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
g_hash_table_insert (priv->child_map, child, priv_child);
|
||||
}
|
||||
|
||||
static GtkBoxChildPrivate *
|
||||
get_priv_child (GtkBox *box, GtkBoxChild *child)
|
||||
{
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxChildPrivate *priv_child;
|
||||
|
||||
priv_child = g_hash_table_lookup (priv->child_map, child);
|
||||
if (G_UNLIKELY (priv_child == NULL))
|
||||
g_warning ("GtkBox: No private child for child; the application is munging box->child directly!");
|
||||
|
||||
return priv_child;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_priv_child (GtkBox *box, GtkBoxChild *child)
|
||||
{
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
if (G_UNLIKELY (!g_hash_table_remove (priv->child_map, child)))
|
||||
g_warning ("GtkBox: No private child for child; the application is munging box->child directly!");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_class_init (GtkBoxClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (class);
|
||||
|
||||
object_class->set_property = gtk_box_set_property;
|
||||
object_class->get_property = gtk_box_get_property;
|
||||
|
||||
gobject_class->set_property = gtk_box_set_property;
|
||||
gobject_class->get_property = gtk_box_get_property;
|
||||
gobject_class->finalize = gtk_box_finalize;
|
||||
|
||||
widget_class->size_request = gtk_box_size_request;
|
||||
widget_class->size_allocate = gtk_box_size_allocate;
|
||||
widget_class->unit_changed = gtk_box_unit_changed;
|
||||
|
||||
container_class->add = gtk_box_add;
|
||||
container_class->remove = gtk_box_remove;
|
||||
@@ -120,21 +156,19 @@ gtk_box_class_init (GtkBoxClass *class)
|
||||
container_class->set_child_property = gtk_box_set_child_property;
|
||||
container_class->get_child_property = gtk_box_get_child_property;
|
||||
|
||||
g_object_class_override_property (object_class,
|
||||
g_object_class_override_property (gobject_class,
|
||||
PROP_ORIENTATION,
|
||||
"orientation");
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SPACING,
|
||||
g_param_spec_int ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("The amount of space between children"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
gtk_param_spec_size ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("The amount of space between children"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_HOMOGENEOUS,
|
||||
g_param_spec_boolean ("homogeneous",
|
||||
P_("Homogeneous"),
|
||||
@@ -158,11 +192,11 @@ gtk_box_class_init (GtkBoxClass *class)
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_container_class_install_child_property (container_class,
|
||||
CHILD_PROP_PADDING,
|
||||
g_param_spec_uint ("padding",
|
||||
P_("Padding"),
|
||||
P_("Extra space to put between the child and its neighbors, in pixels"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize ("padding",
|
||||
P_("Padding"),
|
||||
P_("Extra space to put between the child and its neighbors, in pixels"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_container_class_install_child_property (container_class,
|
||||
CHILD_PROP_PACK_TYPE,
|
||||
g_param_spec_enum ("pack-type",
|
||||
@@ -178,13 +212,25 @@ gtk_box_class_init (GtkBoxClass *class)
|
||||
-1, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GtkBoxPrivate));
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkBoxPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_finalize (GObject *object)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (object);
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
|
||||
/* TODO: should check that hash table is empty */
|
||||
g_hash_table_unref (priv->child_map);
|
||||
|
||||
G_OBJECT_CLASS (gtk_box_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_init (GtkBox *box)
|
||||
{
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW);
|
||||
gtk_widget_set_redraw_on_allocate (GTK_WIDGET (box), FALSE);
|
||||
@@ -193,9 +239,14 @@ gtk_box_init (GtkBox *box)
|
||||
box->spacing = 0;
|
||||
box->homogeneous = FALSE;
|
||||
|
||||
private->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
private->default_expand = FALSE;
|
||||
private->spacing_set = FALSE;
|
||||
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
priv->default_expand = FALSE;
|
||||
priv->spacing_set = FALSE;
|
||||
priv->spacing_unit = 0;
|
||||
priv->child_map = g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
g_free);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -214,7 +265,7 @@ gtk_box_set_property (GObject *object,
|
||||
gtk_widget_queue_resize (GTK_WIDGET (box));
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
gtk_box_set_spacing (box, g_value_get_int (value));
|
||||
gtk_box_set_spacing (box, gtk_value_get_size (value));
|
||||
break;
|
||||
case PROP_HOMOGENEOUS:
|
||||
gtk_box_set_homogeneous (box, g_value_get_boolean (value));
|
||||
@@ -232,15 +283,15 @@ gtk_box_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (object);
|
||||
GtkBoxPrivate *private = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ORIENTATION:
|
||||
g_value_set_enum (value, private->orientation);
|
||||
g_value_set_enum (value, priv->orientation);
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
g_value_set_int (value, box->spacing);
|
||||
gtk_value_set_size (value, priv->spacing_unit, box);
|
||||
break;
|
||||
case PROP_HOMOGENEOUS:
|
||||
g_value_set_boolean (value, box->homogeneous);
|
||||
@@ -650,7 +701,7 @@ gtk_box_set_child_property (GtkContainer *container,
|
||||
child,
|
||||
expand,
|
||||
fill,
|
||||
g_value_get_uint (value),
|
||||
gtk_value_get_usize (value),
|
||||
pack_type);
|
||||
break;
|
||||
case CHILD_PROP_PACK_TYPE:
|
||||
@@ -702,7 +753,7 @@ gtk_box_get_child_property (GtkContainer *container,
|
||||
g_value_set_boolean (value, fill);
|
||||
break;
|
||||
case CHILD_PROP_PADDING:
|
||||
g_value_set_uint (value, padding);
|
||||
gtk_value_set_usize (value, padding, container);
|
||||
break;
|
||||
case CHILD_PROP_PACK_TYPE:
|
||||
g_value_set_enum (value, pack_type);
|
||||
@@ -731,10 +782,11 @@ gtk_box_pack (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding,
|
||||
GtkUSize padding,
|
||||
GtkPackType pack_type)
|
||||
{
|
||||
GtkBoxChild *child_info;
|
||||
GtkBoxChildPrivate *priv_child_info;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
@@ -742,13 +794,17 @@ gtk_box_pack (GtkBox *box,
|
||||
|
||||
child_info = g_new (GtkBoxChild, 1);
|
||||
child_info->widget = child;
|
||||
child_info->padding = padding;
|
||||
child_info->padding = gtk_widget_size_to_pixel (box, padding);
|
||||
child_info->expand = expand ? TRUE : FALSE;
|
||||
child_info->fill = fill ? TRUE : FALSE;
|
||||
child_info->pack = pack_type;
|
||||
child_info->is_secondary = FALSE;
|
||||
|
||||
priv_child_info = g_new (GtkBoxChildPrivate, 1);
|
||||
priv_child_info->padding_unit = padding;
|
||||
|
||||
box->children = g_list_append (box->children, child_info);
|
||||
add_priv_child (box, child_info, priv_child_info);
|
||||
|
||||
gtk_widget_freeze_child_notify (child);
|
||||
|
||||
@@ -813,7 +869,7 @@ gtk_box_pack_start (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding)
|
||||
GtkUSize padding)
|
||||
{
|
||||
gtk_box_pack (box, child, expand, fill, padding, GTK_PACK_START);
|
||||
}
|
||||
@@ -845,7 +901,7 @@ gtk_box_pack_end (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding)
|
||||
GtkUSize padding)
|
||||
{
|
||||
gtk_box_pack (box, child, expand, fill, padding, GTK_PACK_END);
|
||||
}
|
||||
@@ -945,15 +1001,19 @@ gtk_box_get_homogeneous (GtkBox *box)
|
||||
*/
|
||||
void
|
||||
gtk_box_set_spacing (GtkBox *box,
|
||||
gint spacing)
|
||||
GtkSize spacing)
|
||||
{
|
||||
GtkBoxPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
|
||||
if (spacing != box->spacing)
|
||||
{
|
||||
box->spacing = spacing;
|
||||
_gtk_box_set_spacing_set (box, TRUE);
|
||||
priv = GTK_BOX_GET_PRIVATE (box);
|
||||
|
||||
if (spacing != priv->spacing_unit)
|
||||
{
|
||||
box->spacing = gtk_widget_size_to_pixel (box, spacing);
|
||||
priv->spacing_unit = spacing;
|
||||
_gtk_box_set_spacing_set (box, TRUE);
|
||||
g_object_notify (G_OBJECT (box), "spacing");
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (box));
|
||||
@@ -1001,6 +1061,28 @@ _gtk_box_get_spacing_set (GtkBox *box)
|
||||
return private->spacing_set;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_box_get_spacing_unit:
|
||||
* @box: a #GtkBox
|
||||
*
|
||||
* Like gtk_box_get_spacing() but preserves the unit.
|
||||
*
|
||||
* Return value: spacing between children
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
GtkSize
|
||||
gtk_box_get_spacing_unit (GtkBox *box)
|
||||
{
|
||||
GtkBoxPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_BOX (box), 0);
|
||||
|
||||
priv = GTK_BOX_GET_PRIVATE (box);
|
||||
|
||||
return priv->spacing_unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_box_reorder_child:
|
||||
* @box: a #GtkBox
|
||||
@@ -1112,6 +1194,64 @@ gtk_box_query_child_packing (GtkBox *box,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_box_query_child_packing_unit:
|
||||
* @box: a #GtkBox
|
||||
* @child: the #GtkWidget of the child to query
|
||||
* @expand: pointer to return location for #GtkBox:expand child property
|
||||
* @fill: pointer to return location for #GtkBox:fill child property
|
||||
* @padding: pointer to return location for #GtkBox:padding child property
|
||||
* @pack_type: pointer to return location for #GtkBox:pack-type child property
|
||||
*
|
||||
* Like gtk_box_query_child_packing_unit() but preserves units.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
void
|
||||
gtk_box_query_child_packing_unit (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean *expand,
|
||||
gboolean *fill,
|
||||
GtkUSize *padding,
|
||||
GtkPackType *pack_type)
|
||||
{
|
||||
GList *list;
|
||||
GtkBoxChild *child_info = NULL;
|
||||
GtkBoxChildPrivate *priv_child_info = NULL;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
|
||||
list = box->children;
|
||||
while (list)
|
||||
{
|
||||
child_info = list->data;
|
||||
if (child_info->widget == child)
|
||||
break;
|
||||
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
if (list)
|
||||
{
|
||||
priv_child_info = get_priv_child (box, child_info);
|
||||
|
||||
if (expand)
|
||||
*expand = child_info->expand;
|
||||
if (fill)
|
||||
*fill = child_info->fill;
|
||||
if (padding)
|
||||
{
|
||||
if (priv_child_info != NULL)
|
||||
*padding = priv_child_info->padding_unit;
|
||||
else
|
||||
*padding = child_info->padding;
|
||||
}
|
||||
if (pack_type)
|
||||
*pack_type = child_info->pack;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_box_set_child_packing:
|
||||
* @box: a #GtkBox
|
||||
@@ -1128,11 +1268,12 @@ gtk_box_set_child_packing (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding,
|
||||
GtkUSize padding,
|
||||
GtkPackType pack_type)
|
||||
{
|
||||
GList *list;
|
||||
GtkBoxChild *child_info = NULL;
|
||||
GtkBoxChildPrivate *priv_child_info = NULL;
|
||||
|
||||
g_return_if_fail (GTK_IS_BOX (box));
|
||||
g_return_if_fail (GTK_IS_WIDGET (child));
|
||||
@@ -1150,11 +1291,15 @@ gtk_box_set_child_packing (GtkBox *box,
|
||||
gtk_widget_freeze_child_notify (child);
|
||||
if (list)
|
||||
{
|
||||
priv_child_info = get_priv_child (box, child_info);
|
||||
|
||||
child_info->expand = expand != FALSE;
|
||||
gtk_widget_child_notify (child, "expand");
|
||||
child_info->fill = fill != FALSE;
|
||||
gtk_widget_child_notify (child, "fill");
|
||||
child_info->padding = padding;
|
||||
child_info->padding = gtk_widget_size_to_pixel (box, padding);
|
||||
if (priv_child_info != NULL)
|
||||
priv_child_info->padding_unit = padding;
|
||||
gtk_widget_child_notify (child, "padding");
|
||||
if (pack_type == GTK_PACK_END)
|
||||
child_info->pack = GTK_PACK_END;
|
||||
@@ -1212,6 +1357,8 @@ gtk_box_remove (GtkContainer *container,
|
||||
was_visible = GTK_WIDGET_VISIBLE (widget);
|
||||
gtk_widget_unparent (widget);
|
||||
|
||||
remove_priv_child (box, child);
|
||||
|
||||
box->children = g_list_remove_link (box->children, children);
|
||||
g_list_free (children);
|
||||
g_free (child);
|
||||
@@ -1260,5 +1407,33 @@ gtk_box_forall (GtkContainer *container,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_box_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkBox *box = GTK_BOX (widget);
|
||||
GtkBoxPrivate *priv = GTK_BOX_GET_PRIVATE (box);
|
||||
GtkBoxChild *child;
|
||||
GtkBoxChildPrivate *priv_child;
|
||||
GList *children;
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_box_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_box_parent_class)->unit_changed (widget);
|
||||
|
||||
box->spacing = gtk_widget_size_to_pixel (box, priv->spacing_unit);
|
||||
|
||||
children = box->children;
|
||||
while (children != NULL)
|
||||
{
|
||||
child = children->data;
|
||||
priv_child = get_priv_child (box, child);
|
||||
|
||||
if (priv_child != NULL)
|
||||
child->padding = gtk_widget_size_to_pixel (box, priv_child->padding_unit);
|
||||
|
||||
children = children->next;
|
||||
}
|
||||
}
|
||||
|
||||
#define __GTK_BOX_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+20
-14
@@ -76,22 +76,21 @@ struct _GtkBoxChild
|
||||
};
|
||||
|
||||
|
||||
GType gtk_box_get_type (void) G_GNUC_CONST;
|
||||
GType gtk_box_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget* _gtk_box_new (GtkOrientation orientation,
|
||||
gboolean homogeneous,
|
||||
gint spacing);
|
||||
|
||||
void gtk_box_pack_start (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding);
|
||||
void gtk_box_pack_end (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding);
|
||||
|
||||
void gtk_box_pack_start (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
GtkUSize padding);
|
||||
void gtk_box_pack_end (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
GtkUSize padding);
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
void gtk_box_pack_start_defaults (GtkBox *box,
|
||||
GtkWidget *widget);
|
||||
@@ -103,8 +102,9 @@ void gtk_box_set_homogeneous (GtkBox *box,
|
||||
gboolean homogeneous);
|
||||
gboolean gtk_box_get_homogeneous (GtkBox *box);
|
||||
void gtk_box_set_spacing (GtkBox *box,
|
||||
gint spacing);
|
||||
GtkSize spacing);
|
||||
gint gtk_box_get_spacing (GtkBox *box);
|
||||
GtkSize gtk_box_get_spacing_unit (GtkBox *box);
|
||||
|
||||
void gtk_box_reorder_child (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
@@ -116,11 +116,17 @@ void gtk_box_query_child_packing (GtkBox *box,
|
||||
gboolean *fill,
|
||||
guint *padding,
|
||||
GtkPackType *pack_type);
|
||||
void gtk_box_query_child_packing_unit (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean *expand,
|
||||
gboolean *fill,
|
||||
GtkUSize *padding,
|
||||
GtkPackType *pack_type);
|
||||
void gtk_box_set_child_packing (GtkBox *box,
|
||||
GtkWidget *child,
|
||||
gboolean expand,
|
||||
gboolean fill,
|
||||
guint padding,
|
||||
GtkUSize padding,
|
||||
GtkPackType pack_type);
|
||||
|
||||
/* internal API */
|
||||
|
||||
@@ -1152,6 +1152,51 @@ gtk_builder_value_from_string (GtkBuilder *builder,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* GtkParamSpecUnit, GtkParamSpecUUnit have fundamental types
|
||||
* G_TYPE_INT resp. G_TYPE_UINT so cannot handle in the switch;
|
||||
* do it separately
|
||||
*/
|
||||
if (GTK_IS_PARAM_SPEC_SIZE (pspec) || GTK_IS_PARAM_SPEC_USIZE (pspec))
|
||||
{
|
||||
gdouble val;
|
||||
GtkSize size;
|
||||
gchar *endptr;
|
||||
|
||||
errno = 0;
|
||||
val = strtod (string, &endptr);
|
||||
if (errno != 0 || endptr == string)
|
||||
{
|
||||
g_set_error (error,
|
||||
GTK_BUILDER_ERROR,
|
||||
GTK_BUILDER_ERROR_INVALID_VALUE,
|
||||
"Could not parse %s `%s'",
|
||||
GTK_IS_PARAM_SPEC_SIZE (pspec) ? "GtkSize" : "GtkUSize",
|
||||
string);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (g_str_has_suffix (string, "em"))
|
||||
size = gtk_size_em (val);
|
||||
else if (g_str_has_suffix (string, "mm"))
|
||||
size = gtk_size_mm (val);
|
||||
else
|
||||
size = (gint) val;
|
||||
|
||||
if (GTK_IS_PARAM_SPEC_SIZE (pspec))
|
||||
{
|
||||
g_value_init (value, G_TYPE_INT);
|
||||
gtk_value_size_skip_conversion (value);
|
||||
gtk_value_set_size (value, size, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_value_init (value, G_TYPE_UINT);
|
||||
gtk_value_usize_skip_conversion (value);
|
||||
gtk_value_set_usize (value, size, NULL);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return gtk_builder_value_from_string_type (builder,
|
||||
G_PARAM_SPEC_VALUE_TYPE (pspec),
|
||||
string, value, error);
|
||||
|
||||
+1
-35
@@ -893,40 +893,6 @@ start_element (GMarkupParseContext *context,
|
||||
element_name);
|
||||
}
|
||||
|
||||
/* This function is taken from gettext.h
|
||||
* GNU gettext uses '\004' to separate context and msgid in .mo files.
|
||||
*/
|
||||
static const char *
|
||||
_dpgettext (const char *domain,
|
||||
const char *msgctxt,
|
||||
const char *msgid)
|
||||
{
|
||||
size_t msgctxt_len = strlen (msgctxt) + 1;
|
||||
size_t msgid_len = strlen (msgid) + 1;
|
||||
const char *translation;
|
||||
char* msg_ctxt_id;
|
||||
|
||||
msg_ctxt_id = g_alloca (msgctxt_len + msgid_len);
|
||||
|
||||
memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1);
|
||||
msg_ctxt_id[msgctxt_len - 1] = '\004';
|
||||
memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len);
|
||||
|
||||
translation = g_dgettext (domain, msg_ctxt_id);
|
||||
|
||||
if (translation == msg_ctxt_id)
|
||||
{
|
||||
/* try the old way of doing message contexts, too */
|
||||
msg_ctxt_id[msgctxt_len - 1] = '|';
|
||||
translation = g_dgettext (domain, msg_ctxt_id);
|
||||
|
||||
if (translation == msg_ctxt_id)
|
||||
return msgid;
|
||||
}
|
||||
|
||||
return translation;
|
||||
}
|
||||
|
||||
gchar *
|
||||
_gtk_builder_parser_translate (const gchar *domain,
|
||||
const gchar *context,
|
||||
@@ -935,7 +901,7 @@ _gtk_builder_parser_translate (const gchar *domain,
|
||||
const char *s;
|
||||
|
||||
if (context)
|
||||
s = _dpgettext (domain, context, text);
|
||||
s = g_dpgettext2 (domain, context, text);
|
||||
else
|
||||
s = g_dgettext (domain, text);
|
||||
|
||||
|
||||
+63
-34
@@ -41,9 +41,32 @@
|
||||
#include "gtkintl.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
static const GtkBorder default_default_border = { 1, 1, 1, 1 };
|
||||
static const GtkBorder default_default_outside_border = { 0, 0, 0, 0 };
|
||||
static const GtkBorder default_inner_border = { 1, 1, 1, 1 };
|
||||
static void
|
||||
set_default_default_border (GtkWidget *widget, GtkBorder *border)
|
||||
{
|
||||
border->left = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->right = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->top = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->bottom = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
}
|
||||
|
||||
static void
|
||||
set_default_default_outside_border (GtkWidget *widget, GtkBorder *border)
|
||||
{
|
||||
border->left = 0;
|
||||
border->right = 0;
|
||||
border->top = 0;
|
||||
border->bottom = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
set_default_inner_border (GtkWidget *widget, GtkBorder *border)
|
||||
{
|
||||
border->left = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->right = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->top = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
border->bottom = gtk_widget_size_to_pixel (widget, GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
}
|
||||
|
||||
/* Time out before giving up on getting a key release when animating
|
||||
* the close button.
|
||||
@@ -442,21 +465,17 @@ gtk_button_class_init (GtkButtonClass *klass)
|
||||
GTK_TYPE_BORDER,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-displacement-x",
|
||||
P_("Child X Displacement"),
|
||||
P_("How far in the x direction to move the child when the button is depressed"),
|
||||
G_MININT,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-displacement-x",
|
||||
P_("Child X Displacement"),
|
||||
P_("How far in the x direction to move the child when the button is depressed"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("child-displacement-y",
|
||||
P_("Child Y Displacement"),
|
||||
P_("How far in the y direction to move the child when the button is depressed"),
|
||||
G_MININT,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("child-displacement-y",
|
||||
P_("Child Y Displacement"),
|
||||
P_("How far in the y direction to move the child when the button is depressed"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkButton:displace-focus:
|
||||
@@ -495,13 +514,11 @@ gtk_button_class_init (GtkButtonClass *klass)
|
||||
* Since: 2.10
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("image-spacing",
|
||||
P_("Image spacing"),
|
||||
P_("Spacing in pixels between the image and label"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
2,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("image-spacing",
|
||||
P_("Image spacing"),
|
||||
P_("Spacing in pixels between the image and label"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (2),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkSettings::gtk-button-images:
|
||||
@@ -933,7 +950,7 @@ gtk_button_construct_child (GtkButton *button)
|
||||
GtkWidget *align;
|
||||
GtkWidget *image = NULL;
|
||||
gchar *label_text = NULL;
|
||||
gint image_spacing;
|
||||
GtkSize image_spacing;
|
||||
|
||||
if (!button->constructed)
|
||||
return;
|
||||
@@ -941,9 +958,9 @@ gtk_button_construct_child (GtkButton *button)
|
||||
if (!button->label_text && !priv->image)
|
||||
return;
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (button),
|
||||
"image-spacing", &image_spacing,
|
||||
NULL);
|
||||
gtk_widget_style_get_unit (GTK_WIDGET (button),
|
||||
"image-spacing", &image_spacing,
|
||||
NULL);
|
||||
|
||||
if (priv->image && !priv->image_is_stock)
|
||||
{
|
||||
@@ -1241,9 +1258,9 @@ gtk_button_update_image_spacing (GtkButton *button)
|
||||
child = GTK_BIN (child)->child;
|
||||
if (GTK_IS_BOX (child))
|
||||
{
|
||||
gtk_widget_style_get (GTK_WIDGET (button),
|
||||
"image-spacing", &spacing,
|
||||
NULL);
|
||||
gtk_widget_style_get_unit (GTK_WIDGET (button),
|
||||
"image-spacing", &spacing,
|
||||
NULL);
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (child), spacing);
|
||||
}
|
||||
@@ -1273,11 +1290,15 @@ gtk_button_get_props (GtkButton *button,
|
||||
|
||||
if (tmp_border)
|
||||
{
|
||||
tmp_border->left = gtk_widget_size_to_pixel (widget, tmp_border->left);
|
||||
tmp_border->right = gtk_widget_size_to_pixel (widget, tmp_border->right);
|
||||
tmp_border->top = gtk_widget_size_to_pixel (widget, tmp_border->top);
|
||||
tmp_border->bottom = gtk_widget_size_to_pixel (widget, tmp_border->bottom);
|
||||
*default_border = *tmp_border;
|
||||
gtk_border_free (tmp_border);
|
||||
}
|
||||
else
|
||||
*default_border = default_default_border;
|
||||
set_default_default_border (widget, default_border);
|
||||
}
|
||||
|
||||
if (default_outside_border)
|
||||
@@ -1286,11 +1307,15 @@ gtk_button_get_props (GtkButton *button,
|
||||
|
||||
if (tmp_border)
|
||||
{
|
||||
tmp_border->left = gtk_widget_size_to_pixel (widget, tmp_border->left);
|
||||
tmp_border->right = gtk_widget_size_to_pixel (widget, tmp_border->right);
|
||||
tmp_border->top = gtk_widget_size_to_pixel (widget, tmp_border->top);
|
||||
tmp_border->bottom = gtk_widget_size_to_pixel (widget, tmp_border->bottom);
|
||||
*default_outside_border = *tmp_border;
|
||||
gtk_border_free (tmp_border);
|
||||
}
|
||||
else
|
||||
*default_outside_border = default_default_outside_border;
|
||||
set_default_default_outside_border (widget, default_outside_border);
|
||||
}
|
||||
|
||||
if (inner_border)
|
||||
@@ -1299,11 +1324,15 @@ gtk_button_get_props (GtkButton *button,
|
||||
|
||||
if (tmp_border)
|
||||
{
|
||||
tmp_border->left = gtk_widget_size_to_pixel (widget, tmp_border->left);
|
||||
tmp_border->right = gtk_widget_size_to_pixel (widget, tmp_border->right);
|
||||
tmp_border->top = gtk_widget_size_to_pixel (widget, tmp_border->top);
|
||||
tmp_border->bottom = gtk_widget_size_to_pixel (widget, tmp_border->bottom);
|
||||
*inner_border = *tmp_border;
|
||||
gtk_border_free (tmp_border);
|
||||
}
|
||||
else
|
||||
*inner_border = default_inner_border;
|
||||
set_default_inner_border (widget, inner_border);
|
||||
}
|
||||
|
||||
if (interior_focus)
|
||||
|
||||
+183
-38
@@ -43,6 +43,9 @@ typedef struct _GtkCellRendererPrivate GtkCellRendererPrivate;
|
||||
struct _GtkCellRendererPrivate
|
||||
{
|
||||
GdkColor cell_background;
|
||||
GtkUSize xpad_unit;
|
||||
GtkUSize ypad_unit;
|
||||
GtkTreeViewColumn *column;
|
||||
};
|
||||
|
||||
|
||||
@@ -79,6 +82,8 @@ G_DEFINE_ABSTRACT_TYPE (GtkCellRenderer, gtk_cell_renderer, GTK_TYPE_OBJECT)
|
||||
static void
|
||||
gtk_cell_renderer_init (GtkCellRenderer *cell)
|
||||
{
|
||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
||||
|
||||
cell->mode = GTK_CELL_RENDERER_MODE_INERT;
|
||||
cell->visible = TRUE;
|
||||
cell->width = -1;
|
||||
@@ -87,6 +92,8 @@ gtk_cell_renderer_init (GtkCellRenderer *cell)
|
||||
cell->yalign = 0.5;
|
||||
cell->xpad = 0;
|
||||
cell->ypad = 0;
|
||||
priv->xpad_unit = 0;
|
||||
priv->ypad_unit = 0;
|
||||
cell->sensitive = TRUE;
|
||||
cell->is_expander = FALSE;
|
||||
cell->is_expanded = FALSE;
|
||||
@@ -217,43 +224,35 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_XPAD,
|
||||
g_param_spec_uint ("xpad",
|
||||
P_("xpad"),
|
||||
P_("The xpad"),
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize ("xpad",
|
||||
P_("xpad"),
|
||||
P_("The xpad"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_YPAD,
|
||||
g_param_spec_uint ("ypad",
|
||||
P_("ypad"),
|
||||
P_("The ypad"),
|
||||
0,
|
||||
G_MAXUINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize ("ypad",
|
||||
P_("ypad"),
|
||||
P_("The ypad"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_WIDTH,
|
||||
g_param_spec_int ("width",
|
||||
P_("width"),
|
||||
P_("The fixed width"),
|
||||
-1,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("width",
|
||||
P_("width"),
|
||||
P_("The fixed width"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_HEIGHT,
|
||||
g_param_spec_int ("height",
|
||||
P_("height"),
|
||||
P_("The fixed height"),
|
||||
-1,
|
||||
G_MAXINT,
|
||||
-1,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("height",
|
||||
P_("height"),
|
||||
P_("The fixed height"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_IS_EXPANDER,
|
||||
@@ -336,16 +335,16 @@ gtk_cell_renderer_get_property (GObject *object,
|
||||
g_value_set_float (value, cell->yalign);
|
||||
break;
|
||||
case PROP_XPAD:
|
||||
g_value_set_uint (value, cell->xpad);
|
||||
gtk_value_set_usize (value, priv->xpad_unit, gtk_cell_renderer_get_tree_view (cell));
|
||||
break;
|
||||
case PROP_YPAD:
|
||||
g_value_set_uint (value, cell->ypad);
|
||||
gtk_value_set_usize (value, priv->ypad_unit, gtk_cell_renderer_get_tree_view (cell));
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
g_value_set_int (value, cell->width);
|
||||
gtk_value_set_size (value, cell->width, gtk_cell_renderer_get_tree_view (cell));
|
||||
break;
|
||||
case PROP_HEIGHT:
|
||||
g_value_set_int (value, cell->height);
|
||||
gtk_value_set_size (value, cell->height, gtk_cell_renderer_get_tree_view (cell));
|
||||
break;
|
||||
case PROP_IS_EXPANDER:
|
||||
g_value_set_boolean (value, cell->is_expander);
|
||||
@@ -382,6 +381,7 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkCellRenderer *cell = GTK_CELL_RENDERER (object);
|
||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (object);
|
||||
|
||||
switch (param_id)
|
||||
{
|
||||
@@ -404,16 +404,18 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
cell->yalign = g_value_get_float (value);
|
||||
break;
|
||||
case PROP_XPAD:
|
||||
cell->xpad = g_value_get_uint (value);
|
||||
priv->xpad_unit = gtk_value_get_usize (value);
|
||||
cell->xpad = gtk_widget_size_to_pixel (gtk_cell_renderer_get_tree_view (cell), priv->xpad_unit);
|
||||
break;
|
||||
case PROP_YPAD:
|
||||
cell->ypad = g_value_get_uint (value);
|
||||
priv->ypad_unit = gtk_value_get_usize (value);
|
||||
cell->ypad = gtk_widget_size_to_pixel (gtk_cell_renderer_get_tree_view (cell), priv->ypad_unit);
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
cell->width = g_value_get_int (value);
|
||||
cell->width = gtk_value_get_size (value);
|
||||
break;
|
||||
case PROP_HEIGHT:
|
||||
cell->height = g_value_get_int (value);
|
||||
cell->height = gtk_value_get_size (value);
|
||||
break;
|
||||
case PROP_IS_EXPANDER:
|
||||
cell->is_expander = g_value_get_boolean (value);
|
||||
@@ -492,6 +494,9 @@ set_cell_bg_color (GtkCellRenderer *cell,
|
||||
*
|
||||
* Please note that the values set in @width and @height, as well as those
|
||||
* in @x_offset and @y_offset are inclusive of the xpad and ypad properties.
|
||||
*
|
||||
* Returns values in pixels. To preserve the units use
|
||||
* gtk_cell_renderer_get_size_unit().
|
||||
**/
|
||||
void
|
||||
gtk_cell_renderer_get_size (GtkCellRenderer *cell,
|
||||
@@ -508,6 +513,59 @@ gtk_cell_renderer_get_size (GtkCellRenderer *cell,
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size != NULL);
|
||||
|
||||
if (width && cell->width != -1)
|
||||
{
|
||||
real_width = NULL;
|
||||
*width = gtk_widget_size_to_pixel (widget, cell->width);
|
||||
}
|
||||
if (height && cell->height != -1)
|
||||
{
|
||||
real_height = NULL;
|
||||
*height = gtk_widget_size_to_pixel (widget, cell->height);
|
||||
}
|
||||
|
||||
GTK_CELL_RENDERER_GET_CLASS (cell)->get_size (cell,
|
||||
widget,
|
||||
(GdkRectangle *) cell_area,
|
||||
x_offset,
|
||||
y_offset,
|
||||
real_width,
|
||||
real_height);
|
||||
if (real_width)
|
||||
*real_width = gtk_widget_size_to_pixel (widget, *real_width);
|
||||
if (real_height)
|
||||
*real_height = gtk_widget_size_to_pixel (widget, *real_height);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_renderer_get_size_unit:
|
||||
* @cell: a #GtkCellRenderer
|
||||
* @widget: the widget the renderer is rendering to
|
||||
* @cell_area: The area a cell will be allocated, or %NULL
|
||||
* @x_offset: location to return x offset of cell relative to @cell_area, or %NULL
|
||||
* @y_offset: location to return y offset of cell relative to @cell_area, or %NULL
|
||||
* @width: location to return width needed to render a cell, or %NULL
|
||||
* @height: location to return height needed to render a cell, or %NULL
|
||||
*
|
||||
* Like gtk_cell_renderer_get_size() but preserves the units.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
void
|
||||
gtk_cell_renderer_get_size_unit (GtkCellRenderer *cell,
|
||||
GtkWidget *widget,
|
||||
const GdkRectangle *cell_area,
|
||||
gint *x_offset,
|
||||
gint *y_offset,
|
||||
GtkSize *width,
|
||||
GtkSize *height)
|
||||
{
|
||||
gint *real_width = width;
|
||||
gint *real_height = height;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (GTK_CELL_RENDERER_GET_CLASS (cell)->get_size != NULL);
|
||||
|
||||
if (width && cell->width != -1)
|
||||
{
|
||||
real_width = NULL;
|
||||
@@ -689,8 +747,8 @@ gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
|
||||
**/
|
||||
void
|
||||
gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
|
||||
gint width,
|
||||
gint height)
|
||||
GtkSize width,
|
||||
GtkSize height)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
g_return_if_fail (width >= -1 && height >= -1);
|
||||
@@ -722,6 +780,9 @@ gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
|
||||
* @height: location to fill in with the fixed height of the widget, or %NULL
|
||||
*
|
||||
* Fills in @width and @height with the appropriate size of @cell.
|
||||
*
|
||||
* Returns values in pixels. To preserve the units use
|
||||
* gtk_cell_renderer_get_fixed_size_unit().
|
||||
**/
|
||||
void
|
||||
gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
|
||||
@@ -730,6 +791,29 @@ gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
|
||||
if (width)
|
||||
(* width) = gtk_widget_size_to_pixel (gtk_cell_renderer_get_tree_view (cell), cell->width);
|
||||
if (height)
|
||||
(* height) = gtk_widget_size_to_pixel (gtk_cell_renderer_get_tree_view (cell), cell->height);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_renderer_get_fixed_size_unit:
|
||||
* @cell: A #GtkCellRenderer
|
||||
* @width: location to fill in with the fixed width of the widget, or %NULL
|
||||
* @height: location to fill in with the fixed height of the widget, or %NULL
|
||||
*
|
||||
* Like gtk_cell_renderer_get_fixed_size_unit() but preserves the unit information.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
void
|
||||
gtk_cell_renderer_get_fixed_size_unit (GtkCellRenderer *cell,
|
||||
GtkSize *width,
|
||||
GtkSize *height)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER (cell));
|
||||
|
||||
if (width)
|
||||
(* width) = cell->width;
|
||||
if (height)
|
||||
@@ -787,5 +871,66 @@ gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_cell_renderer_set_tree_view_column (GtkCellRenderer *cell,
|
||||
GtkTreeViewColumn *column)
|
||||
{
|
||||
GtkCellRendererPrivate *priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
||||
priv->column = column;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_renderer_get_tree_view_column:
|
||||
* @cell: A #GtkCellRenderer
|
||||
*
|
||||
* Gets the #GtkTreeViewColumn wherein @cell has been
|
||||
* inserted. Returns %NULL if @cell is currently not inserted into any
|
||||
* tree column.
|
||||
*
|
||||
* Returns: the #GtkTreeViewColumn that @cell has been inserted into,
|
||||
* %NULL otherwise
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
GtkTreeViewColumn *
|
||||
gtk_cell_renderer_get_tree_view_column (GtkCellRenderer *cell)
|
||||
{
|
||||
GtkCellRendererPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
|
||||
|
||||
priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
||||
|
||||
return priv->column;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_renderer_get_tree_view:
|
||||
* @cell: A #GtkCellRenderer
|
||||
*
|
||||
* Gets the #GtkTreeView wherein the column that @cell has been
|
||||
* inserted belongs to. Returns %NULL if @cell is currently not
|
||||
* inserted into any tree column or if the tree column is currently
|
||||
* not inserted into any tree.
|
||||
*
|
||||
* Returns: a #GtkTreeView
|
||||
*
|
||||
* Since: RIMERGE
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_cell_renderer_get_tree_view (GtkCellRenderer *cell)
|
||||
{
|
||||
GtkCellRendererPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), NULL);
|
||||
|
||||
priv = GTK_CELL_RENDERER_GET_PRIVATE (cell);
|
||||
|
||||
if (priv->column == NULL)
|
||||
return NULL;
|
||||
|
||||
return gtk_tree_view_column_get_tree_view (priv->column);
|
||||
}
|
||||
|
||||
#define __GTK_CELL_RENDERER_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+23
-6
@@ -26,6 +26,9 @@
|
||||
|
||||
#include <gtk/gtkcelleditable.h>
|
||||
|
||||
/* forward declaration */
|
||||
typedef struct _GtkTreeViewColumn GtkTreeViewColumn;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum
|
||||
@@ -62,8 +65,8 @@ struct _GtkCellRenderer
|
||||
gfloat GSEAL (xalign);
|
||||
gfloat GSEAL (yalign);
|
||||
|
||||
gint GSEAL (width);
|
||||
gint GSEAL (height);
|
||||
GtkSize GSEAL (width);
|
||||
GtkSize GSEAL (height);
|
||||
|
||||
guint16 GSEAL (xpad);
|
||||
guint16 GSEAL (ypad);
|
||||
@@ -87,8 +90,8 @@ struct _GtkCellRendererClass
|
||||
GdkRectangle *cell_area,
|
||||
gint *x_offset,
|
||||
gint *y_offset,
|
||||
gint *width,
|
||||
gint *height);
|
||||
GtkSize *width,
|
||||
GtkSize *height);
|
||||
void (* render) (GtkCellRenderer *cell,
|
||||
GdkDrawable *window,
|
||||
GtkWidget *widget,
|
||||
@@ -131,6 +134,13 @@ void gtk_cell_renderer_get_size (GtkCellRenderer *cell,
|
||||
gint *y_offset,
|
||||
gint *width,
|
||||
gint *height);
|
||||
void gtk_cell_renderer_get_size_unit (GtkCellRenderer *cell,
|
||||
GtkWidget *widget,
|
||||
const GdkRectangle *cell_area,
|
||||
gint *x_offset,
|
||||
gint *y_offset,
|
||||
GtkSize *width,
|
||||
GtkSize *height);
|
||||
void gtk_cell_renderer_render (GtkCellRenderer *cell,
|
||||
GdkWindow *window,
|
||||
GtkWidget *widget,
|
||||
@@ -153,11 +163,18 @@ GtkCellEditable *gtk_cell_renderer_start_editing (GtkCellRenderer *cell,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags);
|
||||
void gtk_cell_renderer_set_fixed_size (GtkCellRenderer *cell,
|
||||
gint width,
|
||||
gint height);
|
||||
GtkSize width,
|
||||
GtkSize height);
|
||||
void gtk_cell_renderer_get_fixed_size (GtkCellRenderer *cell,
|
||||
gint *width,
|
||||
gint *height);
|
||||
void gtk_cell_renderer_get_fixed_size_unit (GtkCellRenderer *cell,
|
||||
GtkSize *width,
|
||||
GtkSize *height);
|
||||
|
||||
GtkTreeViewColumn *gtk_cell_renderer_get_tree_view_column (GtkCellRenderer *cell);
|
||||
|
||||
GtkWidget *gtk_cell_renderer_get_tree_view (GtkCellRenderer *cell);
|
||||
|
||||
/* For use by cell renderer implementations only */
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
|
||||
+121
-41
@@ -283,39 +283,6 @@ gtk_cell_renderer_pixbuf_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unset_image_properties (GtkCellRendererPixbuf *cell)
|
||||
{
|
||||
GtkCellRendererPixbufPrivate *priv;
|
||||
|
||||
priv = GTK_CELL_RENDERER_PIXBUF_GET_PRIVATE (cell);
|
||||
|
||||
if (priv->stock_id)
|
||||
{
|
||||
g_free (priv->stock_id);
|
||||
priv->stock_id = NULL;
|
||||
g_object_notify (G_OBJECT (cell), "stock-id");
|
||||
}
|
||||
if (priv->icon_name)
|
||||
{
|
||||
g_free (priv->icon_name);
|
||||
priv->icon_name = NULL;
|
||||
g_object_notify (G_OBJECT (cell), "icon-name");
|
||||
}
|
||||
if (cell->pixbuf)
|
||||
{
|
||||
g_object_unref (cell->pixbuf);
|
||||
cell->pixbuf = NULL;
|
||||
g_object_notify (G_OBJECT (cell), "pixbuf");
|
||||
}
|
||||
if (priv->gicon)
|
||||
{
|
||||
g_object_unref (priv->gicon);
|
||||
priv->gicon = NULL;
|
||||
g_object_notify (G_OBJECT (cell), "gicon");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
||||
guint param_id,
|
||||
@@ -330,8 +297,30 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
||||
switch (param_id)
|
||||
{
|
||||
case PROP_PIXBUF:
|
||||
unset_image_properties (cellpixbuf);
|
||||
cellpixbuf->pixbuf = (GdkPixbuf *) g_value_dup_object (value);
|
||||
if (cellpixbuf->pixbuf)
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = (GdkPixbuf*) g_value_dup_object (value);
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
if (priv->stock_id)
|
||||
{
|
||||
g_free (priv->stock_id);
|
||||
priv->stock_id = NULL;
|
||||
g_object_notify (object, "stock-id");
|
||||
}
|
||||
if (priv->icon_name)
|
||||
{
|
||||
g_free (priv->icon_name);
|
||||
priv->icon_name = NULL;
|
||||
g_object_notify (object, "icon-name");
|
||||
}
|
||||
if (priv->gicon)
|
||||
{
|
||||
g_object_unref (priv->gicon);
|
||||
priv->gicon = NULL;
|
||||
g_object_notify (object, "gicon");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROP_PIXBUF_EXPANDER_OPEN:
|
||||
if (cellpixbuf->pixbuf_expander_open)
|
||||
@@ -344,8 +333,38 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
||||
cellpixbuf->pixbuf_expander_closed = (GdkPixbuf*) g_value_dup_object (value);
|
||||
break;
|
||||
case PROP_STOCK_ID:
|
||||
unset_image_properties (cellpixbuf);
|
||||
if (priv->stock_id)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
g_free (priv->stock_id);
|
||||
}
|
||||
priv->stock_id = g_value_dup_string (value);
|
||||
if (priv->stock_id)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
if (priv->icon_name)
|
||||
{
|
||||
g_free (priv->icon_name);
|
||||
priv->icon_name = NULL;
|
||||
g_object_notify (object, "icon-name");
|
||||
}
|
||||
if (priv->gicon)
|
||||
{
|
||||
g_object_unref (priv->gicon);
|
||||
priv->gicon = NULL;
|
||||
g_object_notify (object, "gicon");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROP_STOCK_SIZE:
|
||||
priv->stock_size = g_value_get_uint (value);
|
||||
@@ -355,15 +374,75 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
|
||||
priv->stock_detail = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_ICON_NAME:
|
||||
unset_image_properties (cellpixbuf);
|
||||
if (priv->icon_name)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
g_free (priv->icon_name);
|
||||
}
|
||||
priv->icon_name = g_value_dup_string (value);
|
||||
if (priv->icon_name)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
if (priv->stock_id)
|
||||
{
|
||||
g_free (priv->stock_id);
|
||||
priv->stock_id = NULL;
|
||||
g_object_notify (object, "stock-id");
|
||||
}
|
||||
if (priv->gicon)
|
||||
{
|
||||
g_object_unref (priv->gicon);
|
||||
priv->gicon = NULL;
|
||||
g_object_notify (object, "gicon");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROP_FOLLOW_STATE:
|
||||
priv->follow_state = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_GICON:
|
||||
unset_image_properties (cellpixbuf);
|
||||
if (priv->gicon)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
g_object_unref (priv->gicon);
|
||||
}
|
||||
priv->gicon = (GIcon *) g_value_dup_object (value);
|
||||
if (priv->gicon)
|
||||
{
|
||||
if (cellpixbuf->pixbuf)
|
||||
{
|
||||
g_object_unref (cellpixbuf->pixbuf);
|
||||
cellpixbuf->pixbuf = NULL;
|
||||
g_object_notify (object, "pixbuf");
|
||||
}
|
||||
if (priv->stock_id)
|
||||
{
|
||||
g_free (priv->stock_id);
|
||||
priv->stock_id = NULL;
|
||||
g_object_notify (object, "stock-id");
|
||||
}
|
||||
if (priv->icon_name)
|
||||
{
|
||||
g_free (priv->icon_name);
|
||||
priv->icon_name = NULL;
|
||||
g_object_notify (object, "icon-name");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
@@ -431,9 +510,10 @@ gtk_cell_renderer_pixbuf_create_themed_pixbuf (GtkCellRendererPixbuf *cellpixbuf
|
||||
icon_theme = gtk_icon_theme_get_for_screen (screen);
|
||||
settings = gtk_settings_get_for_screen (screen);
|
||||
|
||||
if (!gtk_icon_size_lookup_for_settings (settings,
|
||||
priv->stock_size,
|
||||
&width, &height))
|
||||
if (!gtk_icon_size_lookup_for_settings_for_monitor (settings,
|
||||
gtk_widget_get_monitor_num (widget),
|
||||
priv->stock_size,
|
||||
&width, &height))
|
||||
{
|
||||
g_warning ("Invalid icon size %u\n", priv->stock_size);
|
||||
width = height = 24;
|
||||
|
||||
+11
-12
@@ -71,7 +71,7 @@ enum {
|
||||
PROP_INDICATOR_SIZE
|
||||
};
|
||||
|
||||
#define TOGGLE_WIDTH 13
|
||||
#define TOGGLE_WIDTH GTK_SIZE_ONE_TWELFTH_EM(13)
|
||||
|
||||
static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
@@ -154,13 +154,11 @@ gtk_cell_renderer_toggle_class_init (GtkCellRendererToggleClass *class)
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_INDICATOR_SIZE,
|
||||
g_param_spec_int ("indicator-size",
|
||||
P_("Indicator size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
TOGGLE_WIDTH,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("indicator-size",
|
||||
P_("Indicator size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0, G_MAXINT, TOGGLE_WIDTH,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
|
||||
/**
|
||||
@@ -210,7 +208,8 @@ gtk_cell_renderer_toggle_get_property (GObject *object,
|
||||
g_value_set_boolean (value, celltoggle->radio);
|
||||
break;
|
||||
case PROP_INDICATOR_SIZE:
|
||||
g_value_set_int (value, priv->indicator_size);
|
||||
gtk_value_set_size (value, priv->indicator_size,
|
||||
gtk_cell_renderer_get_tree_view (GTK_CELL_RENDERER (celltoggle)));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
@@ -245,7 +244,7 @@ gtk_cell_renderer_toggle_set_property (GObject *object,
|
||||
celltoggle->radio = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_INDICATOR_SIZE:
|
||||
priv->indicator_size = g_value_get_int (value);
|
||||
priv->indicator_size = gtk_value_get_size (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
|
||||
@@ -287,8 +286,8 @@ gtk_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
||||
|
||||
priv = GTK_CELL_RENDERER_TOGGLE_GET_PRIVATE (cell);
|
||||
|
||||
calc_width = (gint) cell->xpad * 2 + priv->indicator_size;
|
||||
calc_height = (gint) cell->ypad * 2 + priv->indicator_size;
|
||||
calc_width = (gint) cell->xpad * 2 + gtk_widget_size_to_pixel (widget, priv->indicator_size);
|
||||
calc_height = (gint) cell->ypad * 2 + gtk_widget_size_to_pixel (widget, priv->indicator_size);
|
||||
|
||||
if (width)
|
||||
*width = calc_width;
|
||||
|
||||
+3
-1
@@ -1053,7 +1053,9 @@ gtk_cell_view_set_background_color (GtkCellView *cell_view,
|
||||
* g_list_free() when no longer needed.
|
||||
*
|
||||
* Since: 2.6
|
||||
*/
|
||||
*
|
||||
* Deprecated: 2.18: use gtk_cell_layout_get_cells() instead.
|
||||
**/
|
||||
GList *
|
||||
gtk_cell_view_get_cell_renderers (GtkCellView *cell_view)
|
||||
{
|
||||
|
||||
@@ -72,7 +72,9 @@ gboolean gtk_cell_view_get_size_of_row (GtkCellView *cell_v
|
||||
|
||||
void gtk_cell_view_set_background_color (GtkCellView *cell_view,
|
||||
const GdkColor *color);
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
GList *gtk_cell_view_get_cell_renderers (GtkCellView *cell_view);
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+12
-16
@@ -32,8 +32,8 @@
|
||||
#include "gtkalias.h"
|
||||
|
||||
|
||||
#define INDICATOR_SIZE 13
|
||||
#define INDICATOR_SPACING 2
|
||||
#define INDICATOR_SIZE GTK_SIZE_ONE_TWELFTH_EM(13)
|
||||
#define INDICATOR_SPACING GTK_SIZE_ONE_TWELFTH_EM(2)
|
||||
|
||||
|
||||
static void gtk_check_button_size_request (GtkWidget *widget,
|
||||
@@ -65,21 +65,17 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
|
||||
class->draw_indicator = gtk_real_check_button_draw_indicator;
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("indicator-size",
|
||||
P_("Indicator Size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
INDICATOR_SIZE,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("indicator-size",
|
||||
P_("Indicator Size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0, G_MAXINT, INDICATOR_SIZE,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("indicator-spacing",
|
||||
P_("Indicator Spacing"),
|
||||
P_("Spacing around check or radio indicator"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
INDICATOR_SPACING,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("indicator-spacing",
|
||||
P_("Indicator Spacing"),
|
||||
P_("Spacing around check or radio indicator"),
|
||||
0, G_MAXINT, INDICATOR_SPACING,
|
||||
GTK_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -117,13 +117,11 @@ gtk_check_menu_item_class_init (GtkCheckMenuItemClass *klass)
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("indicator-size",
|
||||
P_("Indicator Size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
13,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("indicator-size",
|
||||
P_("Indicator Size"),
|
||||
P_("Size of check or radio indicator"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (13),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
widget_class->expose_event = gtk_check_menu_item_expose;
|
||||
|
||||
|
||||
+23
-2
@@ -129,6 +129,7 @@ static void gtk_color_button_drag_data_received (GtkWidget *widget,
|
||||
guint32 time,
|
||||
GtkColorButton *color_button);
|
||||
|
||||
static void gtk_color_button_unit_changed (GtkWidget *widget);
|
||||
|
||||
static guint color_button_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
@@ -154,6 +155,7 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
|
||||
widget_class->realize = gtk_color_button_realize;
|
||||
widget_class->unrealize = gtk_color_button_unrealize;
|
||||
widget_class->style_set = gtk_color_button_style_set;
|
||||
widget_class->unit_changed = gtk_color_button_unit_changed;
|
||||
button_class->clicked = gtk_color_button_clicked;
|
||||
klass->color_set = NULL;
|
||||
|
||||
@@ -534,7 +536,7 @@ gtk_color_button_init (GtkColorButton *color_button)
|
||||
gtk_widget_push_composite_child ();
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.5, 1.0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (alignment), 1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (alignment), GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
gtk_container_add (GTK_CONTAINER (color_button), alignment);
|
||||
gtk_widget_show (alignment);
|
||||
|
||||
@@ -550,7 +552,9 @@ gtk_color_button_init (GtkColorButton *color_button)
|
||||
pango_layout_get_pixel_extents (layout, NULL, &rect);
|
||||
g_object_unref (layout);
|
||||
|
||||
gtk_widget_set_size_request (color_button->priv->draw_area, rect.width - 2, rect.height - 2);
|
||||
gtk_widget_set_size_request (color_button->priv->draw_area,
|
||||
GTK_SIZE_ONE_TWELFTH_EM (rect.width - 2),
|
||||
GTK_SIZE_ONE_TWELFTH_EM (rect.height - 2));
|
||||
g_signal_connect (color_button->priv->draw_area, "expose-event",
|
||||
G_CALLBACK (expose_event), color_button);
|
||||
gtk_container_add (GTK_CONTAINER (frame), color_button->priv->draw_area);
|
||||
@@ -993,5 +997,22 @@ gtk_color_button_get_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_color_button_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkColorButton *color_button = GTK_COLOR_BUTTON (widget);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
{
|
||||
if (color_button->priv->pixbuf != NULL)
|
||||
g_object_unref (color_button->priv->pixbuf);
|
||||
color_button->priv->pixbuf = NULL;
|
||||
}
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_color_button_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_color_button_parent_class)->unit_changed (widget);
|
||||
}
|
||||
|
||||
#define __GTK_COLOR_BUTTON_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+16
-14
@@ -65,8 +65,8 @@
|
||||
#define GTK_CUSTOM_PALETTE_WIDTH 10
|
||||
#define GTK_CUSTOM_PALETTE_HEIGHT 2
|
||||
|
||||
#define CUSTOM_PALETTE_ENTRY_WIDTH 20
|
||||
#define CUSTOM_PALETTE_ENTRY_HEIGHT 20
|
||||
#define CUSTOM_PALETTE_ENTRY_WIDTH GTK_SIZE_ONE_TWELFTH_EM(20)
|
||||
#define CUSTOM_PALETTE_ENTRY_HEIGHT GTK_SIZE_ONE_TWELFTH_EM(20)
|
||||
|
||||
/* The cursor for the dropper */
|
||||
#define DROPPER_WIDTH 17
|
||||
@@ -340,24 +340,26 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
|
||||
priv->default_set = FALSE;
|
||||
priv->default_alpha_set = FALSE;
|
||||
|
||||
top_hbox = gtk_hbox_new (FALSE, 12);
|
||||
top_hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_box_pack_start (GTK_BOX (colorsel), top_hbox, FALSE, FALSE, 0);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
priv->triangle_colorsel = gtk_hsv_new ();
|
||||
g_signal_connect (priv->triangle_colorsel, "changed",
|
||||
G_CALLBACK (hsv_changed), colorsel);
|
||||
gtk_hsv_set_metrics (GTK_HSV (priv->triangle_colorsel), 174, 15);
|
||||
gtk_hsv_set_metrics (GTK_HSV (priv->triangle_colorsel),
|
||||
GTK_SIZE_ONE_TWELFTH_EM (174),
|
||||
GTK_SIZE_ONE_TWELFTH_EM (15));
|
||||
gtk_box_pack_start (GTK_BOX (top_hbox), vbox, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), priv->triangle_colorsel, FALSE, FALSE, 0);
|
||||
gtk_widget_set_tooltip_text (priv->triangle_colorsel,
|
||||
_("Select the color you want from the outer ring. Select the darkness or lightness of that color using the inner triangle."));
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 6);
|
||||
hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_set_size_request (frame, -1, 30);
|
||||
gtk_widget_set_size_request (frame, -1, GTK_SIZE_ONE_TWELFTH_EM (30));
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
color_sample_new (colorsel);
|
||||
gtk_container_add (GTK_CONTAINER (frame), priv->sample_area);
|
||||
@@ -377,12 +379,12 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
|
||||
gtk_widget_set_tooltip_text (button,
|
||||
_("Click the eyedropper, then click a color anywhere on your screen to select that color."));
|
||||
|
||||
top_right_vbox = gtk_vbox_new (FALSE, 6);
|
||||
top_right_vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_box_pack_start (GTK_BOX (top_hbox), top_right_vbox, FALSE, FALSE, 0);
|
||||
table = gtk_table_new (8, 6, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (top_right_vbox), table, FALSE, FALSE, 0);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
make_label_spinbutton (colorsel, &priv->hue_spinbutton, _("_Hue:"), table, 0, 0, COLORSEL_HUE,
|
||||
_("Position on the color wheel."));
|
||||
@@ -417,7 +419,7 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
|
||||
priv->opacity_entry = gtk_entry_new ();
|
||||
gtk_widget_set_tooltip_text (priv->opacity_entry,
|
||||
_("Transparency of the color."));
|
||||
gtk_widget_set_size_request (priv->opacity_entry, 40, -1);
|
||||
gtk_widget_set_size_request (priv->opacity_entry, gtk_widget_size_to_pixel (colorsel, GTK_SIZE_ONE_TWELFTH_EM (40)), -1);
|
||||
|
||||
g_signal_connect (priv->opacity_entry, "activate",
|
||||
G_CALLBACK (opacity_entry_changed), colorsel);
|
||||
@@ -456,8 +458,8 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
|
||||
|
||||
/* Set up the palette */
|
||||
table = gtk_table_new (GTK_CUSTOM_PALETTE_HEIGHT, GTK_CUSTOM_PALETTE_WIDTH, TRUE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 1);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (1));
|
||||
for (i = 0; i < GTK_CUSTOM_PALETTE_WIDTH; i++)
|
||||
{
|
||||
for (j = 0; j < GTK_CUSTOM_PALETTE_HEIGHT; j++)
|
||||
@@ -466,7 +468,7 @@ gtk_color_selection_init (GtkColorSelection *colorsel)
|
||||
}
|
||||
}
|
||||
set_selected_palette (colorsel, 0, 0);
|
||||
priv->palette_frame = gtk_vbox_new (FALSE, 6);
|
||||
priv->palette_frame = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
label = gtk_label_new_with_mnemonic (_("_Palette:"));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (priv->palette_frame), label, FALSE, FALSE, 0);
|
||||
|
||||
@@ -132,13 +132,13 @@ gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag)
|
||||
GtkDialog *dialog = GTK_DIALOG (colorseldiag);
|
||||
|
||||
gtk_dialog_set_has_separator (dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
|
||||
colorseldiag->colorsel = gtk_color_selection_new ();
|
||||
gtk_container_set_border_width (GTK_CONTAINER (colorseldiag->colorsel), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (colorseldiag->colorsel), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
|
||||
gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION(colorseldiag->colorsel), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (colorseldiag)->vbox), colorseldiag->colorsel);
|
||||
|
||||
+20
-7
@@ -243,6 +243,7 @@ static void gtk_combo_box_add (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_combo_box_remove (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
static void gtk_combo_box_unit_changed (GtkWidget *widget);
|
||||
|
||||
static ComboCellInfo *gtk_combo_box_get_cell_info (GtkComboBox *combo_box,
|
||||
GtkCellRenderer *cell);
|
||||
@@ -499,6 +500,7 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
|
||||
widget_class->grab_focus = gtk_combo_box_grab_focus;
|
||||
widget_class->style_set = gtk_combo_box_style_set;
|
||||
widget_class->state_changed = gtk_combo_box_state_changed;
|
||||
widget_class->unit_changed = gtk_combo_box_unit_changed;
|
||||
|
||||
gtk_object_class = (GtkObjectClass *)klass;
|
||||
gtk_object_class->destroy = gtk_combo_box_destroy;
|
||||
@@ -861,13 +863,11 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
|
||||
* Since: 2.12
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("arrow-size",
|
||||
P_("Arrow Size"),
|
||||
P_("The minimum size of the arrow in the combo box"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
15,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("arrow-size",
|
||||
P_("Arrow Size"),
|
||||
P_("The minimum size of the arrow in the combo box"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (15),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkComboBox:shadow-type:
|
||||
@@ -5925,5 +5925,18 @@ gtk_combo_box_buildable_custom_tag_end (GtkBuildable *buildable,
|
||||
data);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_combo_box_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
|
||||
|
||||
gtk_combo_box_check_appearance (combo_box);
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_combo_box_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_combo_box_parent_class)->unit_changed (widget);
|
||||
}
|
||||
|
||||
|
||||
#define __GTK_COMBO_BOX_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+68
-13
@@ -58,6 +58,13 @@ enum {
|
||||
PROP_CHILD
|
||||
};
|
||||
|
||||
#define GTK_CONTAINER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_CONTAINER, GtkContainerPrivate))
|
||||
|
||||
struct _GtkContainerPrivate
|
||||
{
|
||||
GtkUSize border_width_unit;
|
||||
};
|
||||
|
||||
#define PARAM_SPEC_PARAM_ID(pspec) ((pspec)->param_id)
|
||||
#define PARAM_SPEC_SET_PARAM_ID(pspec, id) ((pspec)->param_id = (id))
|
||||
|
||||
@@ -101,6 +108,8 @@ static void gtk_container_unmap (GtkWidget *widget);
|
||||
static gchar* gtk_container_child_default_composite_name (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
|
||||
static void gtk_container_unit_changed (GtkWidget *widget);
|
||||
|
||||
/* GtkBuildable */
|
||||
static void gtk_container_buildable_init (GtkBuildableIface *iface);
|
||||
static void gtk_container_buildable_add_child (GtkBuildable *buildable,
|
||||
@@ -223,6 +232,7 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
widget_class->map = gtk_container_map;
|
||||
widget_class->unmap = gtk_container_unmap;
|
||||
widget_class->focus = gtk_container_focus;
|
||||
widget_class->unit_changed = gtk_container_unit_changed;
|
||||
|
||||
class->add = gtk_container_add_unimplemented;
|
||||
class->remove = gtk_container_remove_unimplemented;
|
||||
@@ -242,13 +252,11 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
GTK_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BORDER_WIDTH,
|
||||
g_param_spec_uint ("border-width",
|
||||
P_("Border width"),
|
||||
P_("The width of the empty border outside the containers children"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_usize ("border-width",
|
||||
P_("Border width"),
|
||||
P_("The width of the empty border outside the containers children"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_CHILD,
|
||||
g_param_spec_object ("child",
|
||||
@@ -291,6 +299,8 @@ gtk_container_class_init (GtkContainerClass *class)
|
||||
_gtk_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_WIDGET);
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkContainerPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1042,8 +1052,10 @@ gtk_container_remove_unimplemented (GtkContainer *container,
|
||||
static void
|
||||
gtk_container_init (GtkContainer *container)
|
||||
{
|
||||
GtkContainerPrivate *priv = GTK_CONTAINER_GET_PRIVATE (container);
|
||||
container->focus_child = NULL;
|
||||
container->border_width = 0;
|
||||
priv->border_width_unit = 0;
|
||||
container->need_resize = FALSE;
|
||||
container->resize_mode = GTK_RESIZE_PARENT;
|
||||
container->reallocate_redraws = FALSE;
|
||||
@@ -1079,7 +1091,7 @@ gtk_container_set_property (GObject *object,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BORDER_WIDTH:
|
||||
gtk_container_set_border_width (container, g_value_get_uint (value));
|
||||
gtk_container_set_border_width (container, gtk_value_get_usize (value));
|
||||
break;
|
||||
case PROP_RESIZE_MODE:
|
||||
gtk_container_set_resize_mode (container, g_value_get_enum (value));
|
||||
@@ -1100,11 +1112,12 @@ gtk_container_get_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkContainer *container = GTK_CONTAINER (object);
|
||||
GtkContainerPrivate *priv = GTK_CONTAINER_GET_PRIVATE (container);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_BORDER_WIDTH:
|
||||
g_value_set_uint (value, container->border_width);
|
||||
gtk_value_set_usize (value, priv->border_width_unit, container);
|
||||
break;
|
||||
case PROP_RESIZE_MODE:
|
||||
g_value_set_enum (value, container->resize_mode);
|
||||
@@ -1134,13 +1147,18 @@ gtk_container_get_property (GObject *object,
|
||||
**/
|
||||
void
|
||||
gtk_container_set_border_width (GtkContainer *container,
|
||||
guint border_width)
|
||||
GtkUSize border_width)
|
||||
{
|
||||
GtkContainerPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CONTAINER (container));
|
||||
|
||||
if (container->border_width != border_width)
|
||||
priv = GTK_CONTAINER_GET_PRIVATE (container);
|
||||
|
||||
if (priv->border_width_unit != border_width)
|
||||
{
|
||||
container->border_width = border_width;
|
||||
container->border_width = gtk_widget_size_to_pixel (container, border_width);
|
||||
priv->border_width_unit = border_width;
|
||||
g_object_notify (G_OBJECT (container), "border-width");
|
||||
|
||||
if (GTK_WIDGET_REALIZED (container))
|
||||
@@ -1152,9 +1170,11 @@ gtk_container_set_border_width (GtkContainer *container,
|
||||
* gtk_container_get_border_width:
|
||||
* @container: a #GtkContainer
|
||||
*
|
||||
* Retrieves the border width of the container. See
|
||||
* Retrieves the border width of the container in pixels. See
|
||||
* gtk_container_set_border_width().
|
||||
*
|
||||
* Use gtk_container_get_border_width_unit() to preserve units.
|
||||
*
|
||||
* Return value: the current border width
|
||||
**/
|
||||
guint
|
||||
@@ -1165,6 +1185,28 @@ gtk_container_get_border_width (GtkContainer *container)
|
||||
return container->border_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_container_get_border_width_unit:
|
||||
* @container: a #GtkContainer
|
||||
*
|
||||
* Like gtk_container_get_border_width() but preserves the unit.
|
||||
*
|
||||
* Return value: the current border width
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
GtkUSize
|
||||
gtk_container_get_border_width_unit (GtkContainer *container)
|
||||
{
|
||||
GtkContainerPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_CONTAINER (container), 0);
|
||||
|
||||
priv = GTK_CONTAINER_GET_PRIVATE (container);
|
||||
|
||||
return priv->border_width_unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_container_add:
|
||||
* @container: a #GtkContainer
|
||||
@@ -2734,5 +2776,18 @@ gtk_container_propagate_expose (GtkContainer *container,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_container_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkContainer *container = GTK_CONTAINER (widget);
|
||||
GtkContainerPrivate *priv = GTK_CONTAINER_GET_PRIVATE (container);
|
||||
|
||||
container->border_width = gtk_widget_size_to_pixel (container, priv->border_width_unit);
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (parent_class)->unit_changed (widget);
|
||||
}
|
||||
|
||||
#define __GTK_CONTAINER_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+3
-1
@@ -50,6 +50,7 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkContainer GtkContainer;
|
||||
typedef struct _GtkContainerClass GtkContainerClass;
|
||||
typedef struct _GtkContainerPrivate GtkContainerPrivate;
|
||||
|
||||
struct _GtkContainer
|
||||
{
|
||||
@@ -106,8 +107,9 @@ struct _GtkContainerClass
|
||||
|
||||
GType gtk_container_get_type (void) G_GNUC_CONST;
|
||||
void gtk_container_set_border_width (GtkContainer *container,
|
||||
guint border_width);
|
||||
GtkUSize border_width);
|
||||
guint gtk_container_get_border_width (GtkContainer *container);
|
||||
GtkUSize gtk_container_get_border_width_unit (GtkContainer *container);
|
||||
void gtk_container_add (GtkContainer *container,
|
||||
GtkWidget *widget);
|
||||
void gtk_container_remove (GtkContainer *container,
|
||||
|
||||
+30
-38
@@ -187,13 +187,11 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("content-area-border",
|
||||
P_("Content area border"),
|
||||
P_("Width of border around the main dialog area"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
2,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("content-area-border",
|
||||
P_("Content area border"),
|
||||
P_("Width of border around the main dialog area"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (2),
|
||||
GTK_PARAM_READABLE));
|
||||
/**
|
||||
* GtkDialog:content-area-spacing:
|
||||
*
|
||||
@@ -205,30 +203,24 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
||||
* Since: 2.16
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("content-area-spacing",
|
||||
P_("Content area spacing"),
|
||||
P_("Spacing between elements of the main dialog area"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("content-area-spacing",
|
||||
P_("Content area spacing"),
|
||||
P_("Spacing between elements of the main dialog area"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("button-spacing",
|
||||
P_("Button spacing"),
|
||||
P_("Spacing between buttons"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
6,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("button-spacing",
|
||||
P_("Button spacing"),
|
||||
P_("Spacing between buttons"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (6),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("action-area-border",
|
||||
P_("Action area border"),
|
||||
P_("Width of border around the button area at the bottom of the dialog"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
5,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("action-area-border",
|
||||
P_("Action area border"),
|
||||
P_("Width of border around the button area at the bottom of the dialog"),
|
||||
0, G_MAXINT, GTK_SIZE_ONE_TWELFTH_EM (5),
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
binding_set = gtk_binding_set_by_class (class);
|
||||
|
||||
@@ -238,17 +230,17 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
||||
static void
|
||||
update_spacings (GtkDialog *dialog)
|
||||
{
|
||||
gint content_area_border;
|
||||
gint content_area_spacing;
|
||||
gint button_spacing;
|
||||
gint action_area_border;
|
||||
GtkSize content_area_border;
|
||||
GtkSize content_area_spacing;
|
||||
GtkSize button_spacing;
|
||||
GtkSize action_area_border;
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (dialog),
|
||||
"content-area-border", &content_area_border,
|
||||
"content-area-spacing", &content_area_spacing,
|
||||
"button-spacing", &button_spacing,
|
||||
"action-area-border", &action_area_border,
|
||||
NULL);
|
||||
gtk_widget_style_get_unit (GTK_WIDGET (dialog),
|
||||
"content-area-border", &content_area_border,
|
||||
"content-area-spacing", &content_area_spacing,
|
||||
"button-spacing", &button_spacing,
|
||||
"action-area-border", &action_area_border,
|
||||
NULL);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox),
|
||||
content_area_border);
|
||||
|
||||
+143
-3
@@ -33,6 +33,12 @@
|
||||
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "gdk/x11/gdkx.h"
|
||||
#endif
|
||||
|
||||
#include "gtkdnd.h"
|
||||
#include "gtkiconfactory.h"
|
||||
#include "gtkicontheme.h"
|
||||
@@ -393,6 +399,139 @@ gtk_drag_get_ipc_widget (GtkWidget *widget)
|
||||
}
|
||||
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
|
||||
/*
|
||||
* We want to handle a handful of keys during DND, e.g. Escape to abort.
|
||||
* Grabbing the keyboard has the unfortunate side-effect of preventing
|
||||
* useful things such as using Alt-Tab to cycle between windows or
|
||||
* switching workspaces. Therefore, we just grab the few keys we are
|
||||
* interested in. Note that we need to put the grabs on the root window
|
||||
* in order for them to still work when the focus is moved to another
|
||||
* app/workspace.
|
||||
*
|
||||
* GDK needs a little help to successfully deliver root key events...
|
||||
*/
|
||||
|
||||
static GdkFilterReturn
|
||||
root_key_filter (GdkXEvent *xevent,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
XEvent *ev = (XEvent *)xevent;
|
||||
|
||||
if ((ev->type == KeyPress || ev->type == KeyRelease) &&
|
||||
ev->xkey.root == ev->xkey.window)
|
||||
ev->xkey.window = (Window)data;
|
||||
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
gint keysym;
|
||||
gint modifiers;
|
||||
} GrabKey;
|
||||
|
||||
static GrabKey grab_keys[] = {
|
||||
{ XK_Escape, 0 },
|
||||
{ XK_space, 0 },
|
||||
{ XK_KP_Space, 0 },
|
||||
{ XK_Return, 0 },
|
||||
{ XK_KP_Enter, 0 },
|
||||
{ XK_Up, 0 },
|
||||
{ XK_Up, Mod1Mask },
|
||||
{ XK_Down, 0 },
|
||||
{ XK_Down, Mod1Mask },
|
||||
{ XK_Left, 0 },
|
||||
{ XK_Left, Mod1Mask },
|
||||
{ XK_Right, 0 },
|
||||
{ XK_Right, Mod1Mask },
|
||||
{ XK_KP_Up, 0 },
|
||||
{ XK_KP_Up, Mod1Mask },
|
||||
{ XK_KP_Down, 0 },
|
||||
{ XK_KP_Down, Mod1Mask },
|
||||
{ XK_KP_Left, 0 },
|
||||
{ XK_KP_Left, Mod1Mask },
|
||||
{ XK_KP_Right, 0 },
|
||||
{ XK_KP_Right, Mod1Mask }
|
||||
};
|
||||
|
||||
static void
|
||||
grab_dnd_keys (GtkWidget *widget,
|
||||
guint32 time)
|
||||
{
|
||||
guint i;
|
||||
GdkWindow *window, *root;
|
||||
gint keycode;
|
||||
|
||||
window = widget->window;
|
||||
root = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
|
||||
|
||||
gdk_error_trap_push ();
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
|
||||
{
|
||||
keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (window), grab_keys[i].keysym);
|
||||
XGrabKey (GDK_WINDOW_XDISPLAY (window),
|
||||
keycode, grab_keys[i].modifiers,
|
||||
GDK_WINDOW_XID (root),
|
||||
FALSE,
|
||||
GrabModeAsync,
|
||||
GrabModeAsync);
|
||||
}
|
||||
|
||||
gdk_flush ();
|
||||
gdk_error_trap_pop ();
|
||||
|
||||
gdk_window_add_filter (NULL, root_key_filter, GDK_WINDOW_XID (window));
|
||||
}
|
||||
|
||||
static void
|
||||
ungrab_dnd_keys (GtkWidget *widget,
|
||||
guint32 time)
|
||||
{
|
||||
guint i;
|
||||
GdkWindow *window, *root;
|
||||
gint keycode;
|
||||
|
||||
window = widget->window;
|
||||
root = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
|
||||
|
||||
gdk_window_remove_filter (NULL, root_key_filter, GDK_WINDOW_XID (window));
|
||||
|
||||
gdk_error_trap_push ();
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (grab_keys); ++i)
|
||||
{
|
||||
keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (window), grab_keys[i].keysym);
|
||||
XUngrabKey (GDK_WINDOW_XDISPLAY (window),
|
||||
keycode, grab_keys[i].modifiers,
|
||||
GDK_WINDOW_XID (root));
|
||||
}
|
||||
|
||||
gdk_flush ();
|
||||
gdk_error_trap_pop ();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void
|
||||
grab_dnd_keys (GtkWidget *widget,
|
||||
guint32 time)
|
||||
{
|
||||
gdk_keyboard_grab (widget->window, FALSE, time);
|
||||
}
|
||||
|
||||
static void
|
||||
ungrab_dnd_keys (GtkWidget *widget,
|
||||
guint32 time)
|
||||
{
|
||||
gdk_display_keyboard_ungrab (gtk_widget_get_display (widget), time);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************************************
|
||||
* gtk_drag_release_ipc_widget:
|
||||
* Releases widget retrieved with gtk_drag_get_ipc_widget ()
|
||||
@@ -408,6 +547,7 @@ gtk_drag_release_ipc_widget (GtkWidget *widget)
|
||||
GdkScreen *screen = gtk_widget_get_screen (widget);
|
||||
GSList *drag_widgets = g_object_get_data (G_OBJECT (screen),
|
||||
"gtk-dnd-ipc-widgets");
|
||||
ungrab_dnd_keys (widget, GDK_CURRENT_TIME);
|
||||
if (window->group)
|
||||
gtk_window_group_remove_window (window->group, window);
|
||||
drag_widgets = g_slist_prepend (drag_widgets, widget);
|
||||
@@ -2224,8 +2364,8 @@ gtk_drag_begin_internal (GtkWidget *widget,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gdk_keyboard_grab (ipc_widget->window, FALSE, time);
|
||||
|
||||
grab_dnd_keys (ipc_widget, time);
|
||||
|
||||
/* We use a GTK grab here to override any grabs that the widget
|
||||
* we are dragging from might have held
|
||||
*/
|
||||
@@ -3965,7 +4105,7 @@ gtk_drag_end (GtkDragSourceInfo *info, guint32 time)
|
||||
info);
|
||||
|
||||
gdk_display_pointer_ungrab (display, time);
|
||||
gdk_display_keyboard_ungrab (display, time);
|
||||
ungrab_dnd_keys (info->ipc_widget, time);
|
||||
gtk_grab_remove (info->ipc_widget);
|
||||
|
||||
/* Send on a release pair to the original
|
||||
|
||||
+35
-4
@@ -68,7 +68,7 @@
|
||||
|
||||
#define GTK_ENTRY_COMPLETION_KEY "gtk-entry-completion-key"
|
||||
|
||||
#define MIN_ENTRY_WIDTH 150
|
||||
#define MIN_ENTRY_WIDTH GTK_SIZE_ONE_TWELFTH_EM(150)
|
||||
#define DRAW_TIMEOUT 20
|
||||
#define COMPLETION_TIMEOUT 300
|
||||
#define PASSWORD_HINT_MAX 8
|
||||
@@ -85,12 +85,20 @@
|
||||
((pos) == GTK_ENTRY_ICON_PRIMARY || \
|
||||
(pos) == GTK_ENTRY_ICON_SECONDARY)
|
||||
|
||||
static const GtkBorder default_inner_border = { 2, 2, 2, 2 };
|
||||
static GQuark quark_inner_border = 0;
|
||||
static GQuark quark_password_hint = 0;
|
||||
static GQuark quark_cursor_hadjustment = 0;
|
||||
static GQuark quark_capslock_feedback = 0;
|
||||
|
||||
static void
|
||||
set_default_inner_border (GtkEntry *entry, GtkBorder *border)
|
||||
{
|
||||
border->left = gtk_widget_size_to_pixel (entry, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
border->right = gtk_widget_size_to_pixel (entry, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
border->top = gtk_widget_size_to_pixel (entry, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
border->bottom = gtk_widget_size_to_pixel (entry, GTK_SIZE_ONE_TWELFTH_EM (2));
|
||||
}
|
||||
|
||||
typedef struct _GtkEntryPrivate GtkEntryPrivate;
|
||||
|
||||
#define GTK_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ENTRY, GtkEntryPrivate))
|
||||
@@ -381,6 +389,7 @@ static void gtk_entry_toggle_overwrite (GtkEntry *entry);
|
||||
static void gtk_entry_select_all (GtkEntry *entry);
|
||||
static void gtk_entry_real_activate (GtkEntry *entry);
|
||||
static gboolean gtk_entry_popup_menu (GtkWidget *widget);
|
||||
static void gtk_entry_unit_changed (GtkWidget *widget);
|
||||
|
||||
static void keymap_direction_changed (GdkKeymap *keymap,
|
||||
GtkEntry *entry);
|
||||
@@ -580,6 +589,7 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
widget_class->drag_data_delete = gtk_entry_drag_data_delete;
|
||||
|
||||
widget_class->popup_menu = gtk_entry_popup_menu;
|
||||
widget_class->unit_changed = gtk_entry_unit_changed;
|
||||
|
||||
gtk_object_class->destroy = gtk_entry_destroy;
|
||||
|
||||
@@ -2788,7 +2798,7 @@ gtk_entry_size_request (GtkWidget *widget,
|
||||
_gtk_entry_effective_inner_border (entry, &inner_border);
|
||||
|
||||
if (entry->width_chars < 0)
|
||||
requisition->width = MIN_ENTRY_WIDTH + xborder * 2 + inner_border.left + inner_border.right;
|
||||
requisition->width = gtk_widget_size_to_pixel (entry, MIN_ENTRY_WIDTH) + xborder * 2 + inner_border.left + inner_border.right;
|
||||
else
|
||||
{
|
||||
gint char_width = pango_font_metrics_get_approximate_char_width (metrics);
|
||||
@@ -2955,12 +2965,16 @@ _gtk_entry_effective_inner_border (GtkEntry *entry,
|
||||
|
||||
if (tmp_border)
|
||||
{
|
||||
tmp_border->left = gtk_widget_size_to_pixel (entry, tmp_border->left);
|
||||
tmp_border->right = gtk_widget_size_to_pixel (entry, tmp_border->right);
|
||||
tmp_border->top = gtk_widget_size_to_pixel (entry, tmp_border->top);
|
||||
tmp_border->bottom = gtk_widget_size_to_pixel (entry, tmp_border->bottom);
|
||||
*border = *tmp_border;
|
||||
gtk_border_free (tmp_border);
|
||||
return;
|
||||
}
|
||||
|
||||
*border = default_inner_border;
|
||||
set_default_inner_border (entry, border);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -6448,6 +6462,11 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry,
|
||||
icon_info->stock_id,
|
||||
GTK_ICON_SIZE_MENU,
|
||||
NULL);
|
||||
if (!icon_info->pixbuf)
|
||||
icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry),
|
||||
GTK_STOCK_MISSING_IMAGE,
|
||||
GTK_ICON_SIZE_MENU,
|
||||
NULL);
|
||||
GTK_WIDGET_STATE (entry) = state;
|
||||
break;
|
||||
|
||||
@@ -9831,5 +9850,17 @@ keymap_state_changed (GdkKeymap *keymap,
|
||||
remove_capslock_feedback (entry);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_entry_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_entry_parent_class)->unit_changed (widget);
|
||||
|
||||
gtk_entry_reset_layout (entry);
|
||||
}
|
||||
|
||||
#define __GTK_ENTRY_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
@@ -1426,9 +1426,6 @@ _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
|
||||
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (completion->priv->tree_view));
|
||||
gtk_widget_set_size_request (completion->priv->tree_view, width, items * height);
|
||||
|
||||
/* default on no match */
|
||||
completion->priv->current_selected = -1;
|
||||
|
||||
if (actions)
|
||||
{
|
||||
gtk_widget_show (completion->priv->action_view);
|
||||
@@ -1498,6 +1495,9 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion)
|
||||
|
||||
gtk_widget_show_all (completion->priv->vbox);
|
||||
|
||||
/* default on no match */
|
||||
completion->priv->current_selected = -1;
|
||||
|
||||
_gtk_entry_completion_resize_popup (completion);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (completion->priv->entry);
|
||||
|
||||
+11
-1
@@ -206,6 +206,15 @@ typedef enum
|
||||
GTK_MENU_DIR_PREV
|
||||
} GtkMenuDirectionType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_MESSAGE_OTHER
|
||||
} GtkMessageType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_PIXELS,
|
||||
@@ -485,7 +494,8 @@ typedef enum
|
||||
{
|
||||
GTK_PRINT_PAGES_ALL,
|
||||
GTK_PRINT_PAGES_CURRENT,
|
||||
GTK_PRINT_PAGES_RANGES
|
||||
GTK_PRINT_PAGES_RANGES,
|
||||
GTK_PRINT_PAGES_SELECTION
|
||||
} GtkPrintPages;
|
||||
|
||||
typedef enum
|
||||
|
||||
+40
-27
@@ -38,8 +38,8 @@
|
||||
|
||||
#define GTK_EXPANDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_EXPANDER, GtkExpanderPrivate))
|
||||
|
||||
#define DEFAULT_EXPANDER_SIZE 10
|
||||
#define DEFAULT_EXPANDER_SPACING 2
|
||||
#define DEFAULT_EXPANDER_SIZE GTK_SIZE_ONE_TWELFTH_EM(10)
|
||||
#define DEFAULT_EXPANDER_SPACING GTK_SIZE_ONE_TWELFTH_EM(2)
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -215,13 +215,11 @@ gtk_expander_class_init (GtkExpanderClass *klass)
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SPACING,
|
||||
g_param_spec_int ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("Space to put between the label and the child"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READWRITE));
|
||||
gtk_param_spec_size ("spacing",
|
||||
P_("Spacing"),
|
||||
P_("Space to put between the label and the child"),
|
||||
0, G_MAXINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LABEL_WIDGET,
|
||||
@@ -232,22 +230,18 @@ gtk_expander_class_init (GtkExpanderClass *klass)
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("expander-size",
|
||||
P_("Expander Size"),
|
||||
P_("Size of the expander arrow"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_EXPANDER_SIZE,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("expander-size",
|
||||
P_("Expander Size"),
|
||||
P_("Size of the expander arrow"),
|
||||
0, G_MAXINT, DEFAULT_EXPANDER_SIZE,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("expander-spacing",
|
||||
P_("Indicator Spacing"),
|
||||
P_("Spacing around expander arrow"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
DEFAULT_EXPANDER_SPACING,
|
||||
GTK_PARAM_READABLE));
|
||||
gtk_param_spec_size ("expander-spacing",
|
||||
P_("Indicator Spacing"),
|
||||
P_("Spacing around expander arrow"),
|
||||
0, G_MAXINT, DEFAULT_EXPANDER_SPACING,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
widget_class->activate_signal =
|
||||
g_signal_new (I_("activate"),
|
||||
@@ -330,7 +324,7 @@ gtk_expander_set_property (GObject *object,
|
||||
gtk_expander_set_use_markup (expander, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
gtk_expander_set_spacing (expander, g_value_get_int (value));
|
||||
gtk_expander_set_spacing (expander, gtk_value_get_size (value));
|
||||
break;
|
||||
case PROP_LABEL_WIDGET:
|
||||
gtk_expander_set_label_widget (expander, g_value_get_object (value));
|
||||
@@ -365,7 +359,7 @@ gtk_expander_get_property (GObject *object,
|
||||
g_value_set_boolean (value, priv->use_markup);
|
||||
break;
|
||||
case PROP_SPACING:
|
||||
g_value_set_int (value, priv->spacing);
|
||||
gtk_value_set_size (value, priv->spacing, expander);
|
||||
break;
|
||||
case PROP_LABEL_WIDGET:
|
||||
g_value_set_object (value,
|
||||
@@ -1459,7 +1453,7 @@ gtk_expander_get_expanded (GtkExpander *expander)
|
||||
**/
|
||||
void
|
||||
gtk_expander_set_spacing (GtkExpander *expander,
|
||||
gint spacing)
|
||||
GtkSize spacing)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_EXPANDER (expander));
|
||||
g_return_if_fail (spacing >= 0);
|
||||
@@ -1478,7 +1472,8 @@ gtk_expander_set_spacing (GtkExpander *expander,
|
||||
* gtk_expander_get_spacing:
|
||||
* @expander: a #GtkExpander
|
||||
*
|
||||
* Gets the value set by gtk_expander_set_spacing().
|
||||
* Gets the value set by gtk_expander_set_spacing() in pixels. Use
|
||||
* gtk_expander_get_spacing_unit() to preserve units.
|
||||
*
|
||||
* Return value: spacing between the expander and child.
|
||||
*
|
||||
@@ -1489,6 +1484,24 @@ gtk_expander_get_spacing (GtkExpander *expander)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_EXPANDER (expander), 0);
|
||||
|
||||
return gtk_widget_size_to_pixel (expander, expander->priv->spacing);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_expander_get_spacing_unit:
|
||||
* @expander: a #GtkExpander
|
||||
*
|
||||
* Like gtk_expander_set_spacing() but preserves the unit.
|
||||
*
|
||||
* Return value: spacing between the expander and child.
|
||||
*
|
||||
* Since: RIMERGE
|
||||
**/
|
||||
GtkSize
|
||||
gtk_expander_get_spacing_unit (GtkExpander *expander)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_EXPANDER (expander), 0);
|
||||
|
||||
return expander->priv->spacing;
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -71,8 +71,9 @@ gboolean gtk_expander_get_expanded (GtkExpander *expander);
|
||||
|
||||
/* Spacing between the expander/label and the child */
|
||||
void gtk_expander_set_spacing (GtkExpander *expander,
|
||||
gint spacing);
|
||||
GtkSize spacing);
|
||||
gint gtk_expander_get_spacing (GtkExpander *expander);
|
||||
GtkSize gtk_expander_get_spacing_unit (GtkExpander *expander);
|
||||
|
||||
void gtk_expander_set_label (GtkExpander *expander,
|
||||
const gchar *label);
|
||||
|
||||
@@ -232,6 +232,7 @@ static void gtk_file_chooser_button_style_set (GtkWidget *wi
|
||||
GtkStyle *old_style);
|
||||
static void gtk_file_chooser_button_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *old_screen);
|
||||
static void gtk_file_chooser_button_unit_changed (GtkWidget *widget);
|
||||
|
||||
/* Utility Functions */
|
||||
static GtkIconTheme *get_icon_theme (GtkWidget *widget);
|
||||
@@ -342,6 +343,7 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
|
||||
widget_class->map = gtk_file_chooser_button_map;
|
||||
widget_class->style_set = gtk_file_chooser_button_style_set;
|
||||
widget_class->screen_changed = gtk_file_chooser_button_screen_changed;
|
||||
widget_class->unit_changed = gtk_file_chooser_button_unit_changed;
|
||||
widget_class->mnemonic_activate = gtk_file_chooser_button_mnemonic_activate;
|
||||
|
||||
/**
|
||||
@@ -449,7 +451,7 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
|
||||
gtk_container_add (GTK_CONTAINER (button), priv->button);
|
||||
gtk_widget_show (priv->button);
|
||||
|
||||
box = gtk_hbox_new (FALSE, 4);
|
||||
box = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (4));
|
||||
gtk_container_add (GTK_CONTAINER (priv->button), box);
|
||||
gtk_widget_show (box);
|
||||
|
||||
@@ -1269,8 +1271,10 @@ change_icon_theme (GtkFileChooserButton *button)
|
||||
|
||||
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (button)));
|
||||
|
||||
if (gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU,
|
||||
&width, &height))
|
||||
if (gtk_icon_size_lookup_for_settings_for_monitor (settings,
|
||||
gtk_widget_get_monitor_num (GTK_WIDGET (button)),
|
||||
GTK_ICON_SIZE_MENU,
|
||||
&width, &height))
|
||||
priv->icon_size = MAX (width, height);
|
||||
else
|
||||
priv->icon_size = FALLBACK_ICON_SIZE;
|
||||
@@ -2916,5 +2920,16 @@ gtk_file_chooser_button_get_focus_on_click (GtkFileChooserButton *button)
|
||||
return button->priv->focus_on_click;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_button_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->unit_changed (widget);
|
||||
|
||||
if (gtk_widget_has_screen (widget))
|
||||
change_icon_theme (GTK_FILE_CHOOSER_BUTTON (widget));
|
||||
}
|
||||
|
||||
#define __GTK_FILE_CHOOSER_BUTTON_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
||||
+241
-108
@@ -145,6 +145,8 @@ typedef struct _GtkFileChooserDefaultClass GtkFileChooserDefaultClass;
|
||||
|
||||
#define MAX_LOADING_TIME 500
|
||||
|
||||
#define DEFAULT_NEW_FOLDER_NAME _("Type name of new folder")
|
||||
|
||||
struct _GtkFileChooserDefaultClass
|
||||
{
|
||||
GtkVBoxClass parent_class;
|
||||
@@ -189,14 +191,6 @@ typedef enum {
|
||||
SHORTCUT_TYPE_RECENT
|
||||
} ShortcutType;
|
||||
|
||||
/* Column numbers for the file list */
|
||||
enum {
|
||||
FILE_LIST_COL_NAME,
|
||||
FILE_LIST_COL_SIZE,
|
||||
FILE_LIST_COL_MTIME,
|
||||
FILE_LIST_COL_NUM_COLUMNS
|
||||
};
|
||||
|
||||
/* Column numbers for the search model.
|
||||
* Keep this in sync with search_setup_model()
|
||||
*/
|
||||
@@ -254,7 +248,7 @@ typedef enum {
|
||||
/* Icon size for if we can't get it from the theme */
|
||||
#define FALLBACK_ICON_SIZE 16
|
||||
|
||||
#define PREVIEW_HBOX_SPACING 12
|
||||
#define PREVIEW_HBOX_SPACING GTK_SIZE_ONE_TWELFTH_EM(12)
|
||||
#define NUM_LINES 45
|
||||
#define NUM_CHARS 60
|
||||
|
||||
@@ -284,6 +278,7 @@ static void gtk_file_chooser_default_style_set (GtkWidget *
|
||||
GtkStyle *previous_style);
|
||||
static void gtk_file_chooser_default_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *previous_screen);
|
||||
static void gtk_file_chooser_default_unit_changed (GtkWidget *widget);
|
||||
static void gtk_file_chooser_default_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
|
||||
@@ -573,6 +568,7 @@ _gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
|
||||
widget_class->style_set = gtk_file_chooser_default_style_set;
|
||||
widget_class->screen_changed = gtk_file_chooser_default_screen_changed;
|
||||
widget_class->size_allocate = gtk_file_chooser_default_size_allocate;
|
||||
widget_class->unit_changed = gtk_file_chooser_default_unit_changed;
|
||||
|
||||
signals[LOCATION_POPUP] =
|
||||
g_signal_new_class_handler (I_("location-popup"),
|
||||
@@ -804,9 +800,11 @@ _gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
|
||||
impl->pending_select_files = NULL;
|
||||
impl->location_mode = LOCATION_MODE_PATH_BAR;
|
||||
impl->operation_mode = OPERATION_MODE_BROWSE;
|
||||
impl->sort_column = FILE_LIST_COL_NAME;
|
||||
impl->sort_order = GTK_SORT_ASCENDING;
|
||||
impl->recent_manager = gtk_recent_manager_get_default ();
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (impl), 12);
|
||||
gtk_box_set_spacing (GTK_BOX (impl), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
set_file_system_backend (impl);
|
||||
|
||||
@@ -960,6 +958,9 @@ gtk_file_chooser_default_finalize (GObject *object)
|
||||
if (impl->preview_file)
|
||||
g_object_unref (impl->preview_file);
|
||||
|
||||
if (impl->browse_path_bar_size_group)
|
||||
g_object_unref (impl->browse_path_bar_size_group);
|
||||
|
||||
load_remove_timer (impl);
|
||||
|
||||
/* Free all the Models we have */
|
||||
@@ -1743,7 +1744,7 @@ shortcuts_insert_file (GtkFileChooserDefault *impl,
|
||||
gtk_tree_path_free (p);
|
||||
|
||||
cancellable = _gtk_file_system_get_info (request->impl->file_system, request->file,
|
||||
"standard::is-hidden,standard::display-name,standard::icon",
|
||||
"standard::is-hidden,standard::is-backup,standard::display-name,standard::icon",
|
||||
get_file_info_finished, request);
|
||||
|
||||
gtk_list_store_set (impl->shortcuts_model, &iter,
|
||||
@@ -2418,7 +2419,9 @@ edited_idle_cb (GtkFileChooserDefault *impl)
|
||||
|
||||
gtk_widget_set_sensitive (impl->browse_new_folder_button, TRUE);
|
||||
|
||||
if (impl->edited_new_text) /* not cancelled? */
|
||||
if (impl->edited_new_text /* not cancelled? */
|
||||
&& (strlen (impl->edited_new_text) != 0)
|
||||
&& (strcmp (impl->edited_new_text, DEFAULT_NEW_FOLDER_NAME) != 0)) /* Don't create folder if name is empty or has not been edited */
|
||||
{
|
||||
GError *error = NULL;
|
||||
GFile *file;
|
||||
@@ -3987,7 +3990,7 @@ shortcuts_pane_create (GtkFileChooserDefault *impl,
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *widget;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* Shortcuts tree */
|
||||
@@ -3997,7 +4000,7 @@ shortcuts_pane_create (GtkFileChooserDefault *impl,
|
||||
|
||||
/* Box for buttons */
|
||||
|
||||
hbox = gtk_hbox_new (TRUE, 6);
|
||||
hbox = gtk_hbox_new (TRUE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_size_group_add_widget (size_group, hbox);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
@@ -4453,35 +4456,70 @@ list_button_press_event_cb (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
OperationMode operation_mode;
|
||||
gint general_column;
|
||||
gint model_column;
|
||||
} ColumnMap;
|
||||
|
||||
/* Sigh. Each operation mode has different sort column IDs. This table
|
||||
* translates between them.
|
||||
*/
|
||||
static const ColumnMap column_map[] = {
|
||||
{ OPERATION_MODE_BROWSE, FILE_LIST_COL_NAME, FILE_LIST_COL_NAME },
|
||||
{ OPERATION_MODE_BROWSE, FILE_LIST_COL_SIZE, FILE_LIST_COL_SIZE },
|
||||
{ OPERATION_MODE_BROWSE, FILE_LIST_COL_MTIME, FILE_LIST_COL_MTIME },
|
||||
|
||||
{ OPERATION_MODE_SEARCH, FILE_LIST_COL_NAME, SEARCH_MODEL_COL_FILE },
|
||||
{ OPERATION_MODE_SEARCH, FILE_LIST_COL_SIZE, SEARCH_MODEL_COL_SIZE },
|
||||
{ OPERATION_MODE_SEARCH, FILE_LIST_COL_MTIME, SEARCH_MODEL_COL_MTIME },
|
||||
|
||||
{ OPERATION_MODE_RECENT, FILE_LIST_COL_NAME, RECENT_MODEL_COL_FILE },
|
||||
{ OPERATION_MODE_RECENT, FILE_LIST_COL_SIZE, 0 },
|
||||
{ OPERATION_MODE_RECENT, FILE_LIST_COL_MTIME, RECENT_MODEL_COL_INFO }
|
||||
};
|
||||
|
||||
static gint
|
||||
general_column_to_model_column (GtkFileChooserDefault *impl, gint general_column)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (column_map); i++)
|
||||
if (column_map[i].operation_mode == impl->operation_mode
|
||||
&& column_map[i].general_column == general_column)
|
||||
return column_map[i].model_column;
|
||||
|
||||
g_assert_not_reached ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gint
|
||||
model_column_to_general_column (GtkFileChooserDefault *impl, gint model_column)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (column_map); i++)
|
||||
if (column_map[i].operation_mode == impl->operation_mode
|
||||
&& column_map[i].model_column == model_column)
|
||||
return column_map[i].general_column;
|
||||
|
||||
g_assert_not_reached ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Sets the sort column IDs for the file list based on the operation mode */
|
||||
static void
|
||||
file_list_set_sort_column_ids (GtkFileChooserDefault *impl)
|
||||
{
|
||||
int name_id, mtime_id, size_id;
|
||||
|
||||
name_id = mtime_id = size_id = 0;
|
||||
name_id = general_column_to_model_column (impl, FILE_LIST_COL_NAME);
|
||||
mtime_id = general_column_to_model_column (impl, FILE_LIST_COL_MTIME);
|
||||
size_id = general_column_to_model_column (impl, FILE_LIST_COL_SIZE);
|
||||
|
||||
switch (impl->operation_mode)
|
||||
{
|
||||
case OPERATION_MODE_BROWSE:
|
||||
name_id = FILE_LIST_COL_NAME;
|
||||
mtime_id = FILE_LIST_COL_MTIME;
|
||||
size_id = FILE_LIST_COL_SIZE;
|
||||
break;
|
||||
case OPERATION_MODE_SEARCH:
|
||||
name_id = SEARCH_MODEL_COL_FILE;
|
||||
mtime_id = SEARCH_MODEL_COL_MTIME;
|
||||
size_id = SEARCH_MODEL_COL_SIZE;
|
||||
break;
|
||||
case OPERATION_MODE_RECENT:
|
||||
name_id = RECENT_MODEL_COL_FILE;
|
||||
mtime_id = RECENT_MODEL_COL_INFO;
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_tree_view_column_set_sort_column_id (impl->list_name_column, name_id);
|
||||
gtk_tree_view_column_set_sort_column_id (impl->list_name_column, name_id);
|
||||
gtk_tree_view_column_set_sort_column_id (impl->list_mtime_column, mtime_id);
|
||||
gtk_tree_view_column_set_sort_column_id (impl->list_size_column, size_id);
|
||||
gtk_tree_view_column_set_sort_column_id (impl->list_size_column, size_id);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -4634,7 +4672,6 @@ create_file_list (GtkFileChooserDefault *impl)
|
||||
gtk_tree_view_column_set_expand (impl->list_name_column, TRUE);
|
||||
gtk_tree_view_column_set_resizable (impl->list_name_column, TRUE);
|
||||
gtk_tree_view_column_set_title (impl->list_name_column, _("Name"));
|
||||
gtk_tree_view_column_set_sort_column_id (impl->list_name_column, FILE_LIST_COL_NAME);
|
||||
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
gtk_tree_view_column_pack_start (impl->list_name_column, renderer, FALSE);
|
||||
@@ -4664,7 +4701,6 @@ create_file_list (GtkFileChooserDefault *impl)
|
||||
gtk_tree_view_column_pack_start (column, renderer, TRUE); /* bug: it doesn't expand */
|
||||
gtk_tree_view_column_set_cell_data_func (column, renderer,
|
||||
list_size_data_func, impl, NULL);
|
||||
gtk_tree_view_column_set_sort_column_id (column, FILE_LIST_COL_SIZE);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_files_tree_view), column);
|
||||
impl->list_size_column = column;
|
||||
|
||||
@@ -4708,7 +4744,7 @@ file_pane_create (GtkFileChooserDefault *impl,
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *widget;
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (6));
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* Box for lists and preview */
|
||||
@@ -4724,13 +4760,13 @@ file_pane_create (GtkFileChooserDefault *impl,
|
||||
|
||||
/* Preview */
|
||||
|
||||
impl->preview_box = gtk_vbox_new (FALSE, 12);
|
||||
impl->preview_box = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), impl->preview_box, FALSE, FALSE, 0);
|
||||
/* Don't show preview box initially */
|
||||
|
||||
/* Filter combo */
|
||||
|
||||
impl->filter_combo_hbox = gtk_hbox_new (FALSE, 12);
|
||||
impl->filter_combo_hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
widget = filter_create (impl);
|
||||
|
||||
@@ -4852,6 +4888,7 @@ save_folder_combo_create (GtkFileChooserDefault *impl)
|
||||
NULL);
|
||||
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
g_object_set (cell, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell,
|
||||
"text", SHORTCUTS_COL_NAME,
|
||||
@@ -4882,13 +4919,13 @@ save_widgets_create (GtkFileChooserDefault *impl)
|
||||
|
||||
location_switch_to_path_bar (impl);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 12);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
|
||||
gtk_widget_show (table);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 12);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
/* Label */
|
||||
|
||||
@@ -5201,6 +5238,8 @@ location_button_create (GtkFileChooserDefault *impl)
|
||||
impl->location_button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
|
||||
"image", image,
|
||||
NULL);
|
||||
|
||||
gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->location_button);
|
||||
|
||||
g_signal_connect (impl->location_button, "toggled",
|
||||
G_CALLBACK (location_button_toggled_cb), impl);
|
||||
@@ -5216,40 +5255,43 @@ static GtkWidget *
|
||||
browse_widgets_create (GtkFileChooserDefault *impl)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hpaned;
|
||||
GtkWidget *widget;
|
||||
GtkSizeGroup *size_group;
|
||||
|
||||
/* size group is used by the [+][-] buttons and the filter combo */
|
||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
|
||||
vbox = gtk_vbox_new (FALSE, 12);
|
||||
vbox = gtk_vbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
/* Location widgets */
|
||||
hbox = gtk_hbox_new (FALSE, 12);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
impl->browse_path_bar_hbox = hbox;
|
||||
impl->browse_path_bar_hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), impl->browse_path_bar_hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (impl->browse_path_bar_hbox);
|
||||
|
||||
/* Size group that allows the path bar to be the same size between modes */
|
||||
impl->browse_path_bar_size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
|
||||
gtk_size_group_set_ignore_hidden (impl->browse_path_bar_size_group, FALSE);
|
||||
|
||||
/* Location button */
|
||||
location_button_create (impl);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), impl->location_button, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->location_button, FALSE, FALSE, 0);
|
||||
|
||||
/* Path bar */
|
||||
|
||||
impl->browse_path_bar = create_path_bar (impl);
|
||||
g_signal_connect (impl->browse_path_bar, "path-clicked", G_CALLBACK (path_bar_clicked), impl);
|
||||
gtk_widget_show_all (impl->browse_path_bar);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), impl->browse_path_bar, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_path_bar, TRUE, TRUE, 0);
|
||||
|
||||
/* Create Folder */
|
||||
impl->browse_new_folder_button = gtk_button_new_with_mnemonic (_("Create Fo_lder"));
|
||||
g_signal_connect (impl->browse_new_folder_button, "clicked",
|
||||
G_CALLBACK (new_folder_button_clicked), impl);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), impl->browse_new_folder_button, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_new_folder_button, FALSE, FALSE, 0);
|
||||
|
||||
/* Box for the location label and entry */
|
||||
|
||||
impl->location_entry_box = gtk_hbox_new (FALSE, 12);
|
||||
impl->location_entry_box = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), impl->location_entry_box, FALSE, FALSE, 0);
|
||||
|
||||
impl->location_label = gtk_label_new_with_mnemonic (_("_Location:"));
|
||||
@@ -5850,7 +5892,10 @@ change_icon_theme (GtkFileChooserDefault *impl)
|
||||
|
||||
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (impl)));
|
||||
|
||||
if (gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, &width, &height))
|
||||
if (gtk_icon_size_lookup_for_settings_for_monitor (settings,
|
||||
gtk_widget_get_monitor_num (GTK_WIDGET (impl)),
|
||||
GTK_ICON_SIZE_MENU,
|
||||
&width, &height))
|
||||
impl->icon_size = MAX (width, height);
|
||||
else
|
||||
impl->icon_size = FALLBACK_ICON_SIZE;
|
||||
@@ -6008,6 +6053,35 @@ get_is_file_filtered (GtkFileChooserDefault *impl,
|
||||
return !result;
|
||||
}
|
||||
|
||||
static void
|
||||
set_sort_column (GtkFileChooserDefault *impl)
|
||||
{
|
||||
GtkTreeSortable *sortable;
|
||||
|
||||
switch (impl->operation_mode)
|
||||
{
|
||||
case OPERATION_MODE_BROWSE:
|
||||
sortable = GTK_TREE_SORTABLE (impl->sort_model);
|
||||
break;
|
||||
|
||||
case OPERATION_MODE_SEARCH:
|
||||
sortable = GTK_TREE_SORTABLE (impl->search_model_sort);
|
||||
break;
|
||||
|
||||
case OPERATION_MODE_RECENT:
|
||||
sortable = GTK_TREE_SORTABLE (impl->recent_model_sort);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_tree_sortable_set_sort_column_id (sortable,
|
||||
general_column_to_model_column (impl, impl->sort_column),
|
||||
impl->sort_order);
|
||||
}
|
||||
|
||||
static void
|
||||
settings_load (GtkFileChooserDefault *impl)
|
||||
{
|
||||
@@ -6016,6 +6090,8 @@ settings_load (GtkFileChooserDefault *impl)
|
||||
gboolean show_hidden;
|
||||
gboolean expand_folders;
|
||||
gboolean show_size_column;
|
||||
gint sort_column;
|
||||
GtkSortType sort_order;
|
||||
|
||||
settings = _gtk_file_chooser_settings_new ();
|
||||
|
||||
@@ -6023,6 +6099,8 @@ settings_load (GtkFileChooserDefault *impl)
|
||||
show_hidden = _gtk_file_chooser_settings_get_show_hidden (settings);
|
||||
expand_folders = _gtk_file_chooser_settings_get_expand_folders (settings);
|
||||
show_size_column = _gtk_file_chooser_settings_get_show_size_column (settings);
|
||||
sort_column = _gtk_file_chooser_settings_get_sort_column (settings);
|
||||
sort_order = _gtk_file_chooser_settings_get_sort_order (settings);
|
||||
|
||||
g_object_unref (settings);
|
||||
|
||||
@@ -6037,6 +6115,10 @@ settings_load (GtkFileChooserDefault *impl)
|
||||
impl->show_size_column = show_size_column;
|
||||
if (impl->list_size_column)
|
||||
gtk_tree_view_column_set_visible (impl->list_size_column, show_size_column);
|
||||
|
||||
impl->sort_column = sort_column;
|
||||
impl->sort_order = sort_order;
|
||||
set_sort_column (impl);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -6075,6 +6157,8 @@ settings_save (GtkFileChooserDefault *impl)
|
||||
_gtk_file_chooser_settings_set_show_hidden (settings, gtk_file_chooser_get_show_hidden (GTK_FILE_CHOOSER (impl)));
|
||||
_gtk_file_chooser_settings_set_expand_folders (settings, impl->expand_folders);
|
||||
_gtk_file_chooser_settings_set_show_size_column (settings, impl->show_size_column);
|
||||
_gtk_file_chooser_settings_set_sort_column (settings, impl->sort_column);
|
||||
_gtk_file_chooser_settings_set_sort_order (settings, impl->sort_order);
|
||||
|
||||
save_dialog_geometry (impl, settings);
|
||||
|
||||
@@ -6089,7 +6173,6 @@ static void
|
||||
gtk_file_chooser_default_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkFileChooserDefault *impl;
|
||||
char *current_working_dir;
|
||||
|
||||
impl = GTK_FILE_CHOOSER_DEFAULT (widget);
|
||||
|
||||
@@ -6296,10 +6379,15 @@ static void
|
||||
list_sort_column_changed_cb (GtkTreeSortable *sortable,
|
||||
GtkFileChooserDefault *impl)
|
||||
{
|
||||
gint sort_column_id;
|
||||
GtkSortType sort_type;
|
||||
|
||||
if (gtk_tree_sortable_get_sort_column_id (sortable, NULL, &sort_type))
|
||||
impl->list_sort_ascending = (sort_type == GTK_SORT_ASCENDING);
|
||||
if (gtk_tree_sortable_get_sort_column_id (sortable, &sort_column_id, &sort_type))
|
||||
{
|
||||
impl->list_sort_ascending = (sort_type == GTK_SORT_ASCENDING);
|
||||
impl->sort_column = model_column_to_general_column (impl, sort_column_id);
|
||||
impl->sort_order = sort_type;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -6343,7 +6431,7 @@ load_set_model (GtkFileChooserDefault *impl)
|
||||
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->sort_model), FILE_LIST_COL_SIZE, size_sort_func, impl, NULL);
|
||||
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->sort_model), FILE_LIST_COL_MTIME, mtime_sort_func, impl, NULL);
|
||||
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (impl->sort_model), NULL, NULL, NULL);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->sort_model), FILE_LIST_COL_NAME, GTK_SORT_ASCENDING);
|
||||
set_sort_column (impl);
|
||||
impl->list_sort_ascending = TRUE;
|
||||
profile_msg (" gtk_tree_model_sort_new_with_model end", NULL);
|
||||
|
||||
@@ -6501,7 +6589,8 @@ show_and_select_files_finished_loading (GtkFolder *folder,
|
||||
if (info)
|
||||
{
|
||||
if (!have_hidden)
|
||||
have_hidden = g_file_info_get_is_hidden (info);
|
||||
have_hidden = g_file_info_get_is_hidden (info)
|
||||
|| g_file_info_get_is_backup (info);
|
||||
|
||||
if (!have_filtered)
|
||||
have_filtered = (! _gtk_file_info_consider_as_directory (info)) &&
|
||||
@@ -6604,7 +6693,7 @@ show_and_select_files (GtkFileChooserDefault *impl,
|
||||
|
||||
impl->show_and_select_files_cancellable =
|
||||
_gtk_file_system_get_folder (impl->file_system, parent_file,
|
||||
"standard::is-hidden,standard::type,standard::name,standard::content-type",
|
||||
"standard::is-hidden,standard::is-backup,standard::type,standard::name,standard::content-type",
|
||||
show_and_select_files_get_folder_cb, info);
|
||||
|
||||
profile_end ("end", NULL);
|
||||
@@ -7035,13 +7124,14 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Error and bail out, ignoring "not found" errors since they're useless:
|
||||
/* Error and bail out, ignoring "not found" errors since they're useless:
|
||||
* they only happen when a program defaults to a folder that has been (re)moved.
|
||||
*/
|
||||
if (!g_error_matches (data->original_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
error_changing_folder_dialog (impl, data->original_file, data->original_error);
|
||||
error_changing_folder_dialog (impl, data->original_file, data->original_error);
|
||||
else
|
||||
g_error_free (data->original_error);
|
||||
|
||||
g_object_unref (data->original_file);
|
||||
|
||||
goto out;
|
||||
@@ -7050,7 +7140,13 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
|
||||
|
||||
if (data->original_file)
|
||||
{
|
||||
error_changing_folder_dialog (impl, data->original_file, data->original_error);
|
||||
/* Error and bail out, ignoring "not found" errors since they're useless:
|
||||
* they only happen when a program defaults to a folder that has been (re)moved.
|
||||
*/
|
||||
if (!g_error_matches (data->original_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
error_changing_folder_dialog (impl, data->original_file, data->original_error);
|
||||
else
|
||||
g_error_free (data->original_error);
|
||||
|
||||
g_object_unref (data->original_file);
|
||||
}
|
||||
@@ -7935,6 +8031,8 @@ gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser)
|
||||
return g_slist_reverse (list);
|
||||
}
|
||||
|
||||
/* RI TODO: find_good_size_from_style() probably needs to be removed; just use em's instead */
|
||||
|
||||
/* Guesses a size based upon font sizes */
|
||||
static void
|
||||
find_good_size_from_style (GtkWidget *widget,
|
||||
@@ -8001,7 +8099,7 @@ gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed,
|
||||
GTK_WIDGET_VISIBLE (impl->preview_widget))
|
||||
{
|
||||
gtk_widget_size_request (impl->preview_box, &req);
|
||||
*default_width += PREVIEW_HBOX_SPACING + req.width;
|
||||
*default_width += gtk_widget_size_to_pixel (impl, PREVIEW_HBOX_SPACING) + req.width;
|
||||
}
|
||||
|
||||
if (impl->extra_widget &&
|
||||
@@ -9290,9 +9388,7 @@ search_setup_model (GtkFileChooserDefault *impl)
|
||||
SEARCH_MODEL_COL_SIZE,
|
||||
search_column_size_sort_func,
|
||||
impl, NULL);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->search_model_sort),
|
||||
SEARCH_MODEL_COL_MTIME,
|
||||
GTK_SORT_DESCENDING);
|
||||
set_sort_column (impl);
|
||||
|
||||
/* EB: setting the model here will make the hits list update feel
|
||||
* more "alive" than setting the model at the end of the search
|
||||
@@ -9393,12 +9489,20 @@ static void
|
||||
search_setup_widgets (GtkFileChooserDefault *impl)
|
||||
{
|
||||
GtkWidget *label;
|
||||
GtkWidget *image;
|
||||
|
||||
impl->search_hbox = gtk_hbox_new (FALSE, 12);
|
||||
impl->search_hbox = gtk_hbox_new (FALSE, GTK_SIZE_ONE_TWELFTH_EM (12));
|
||||
|
||||
/* Image */
|
||||
|
||||
image = gtk_image_new_from_stock (GTK_STOCK_FIND, GTK_ICON_SIZE_BUTTON);
|
||||
gtk_size_group_add_widget (GTK_SIZE_GROUP (impl->browse_path_bar_size_group), image);
|
||||
gtk_box_pack_start (GTK_BOX (impl->search_hbox), image, FALSE, FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
/* Label */
|
||||
|
||||
label = gtk_label_new_with_mnemonic (_("_Search:"));
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup_with_mnemonic (GTK_LABEL (label), _("<b>_Search:</b>"));
|
||||
gtk_box_pack_start (GTK_BOX (impl->search_hbox), label, FALSE, FALSE, 0);
|
||||
|
||||
/* Entry */
|
||||
@@ -9450,6 +9554,35 @@ search_setup_widgets (GtkFileChooserDefault *impl)
|
||||
/* FMQ: hide the filter combo? */
|
||||
}
|
||||
|
||||
/* Stops running operations like populating the browse model, searches, and the recent-files model */
|
||||
static void
|
||||
stop_operation (GtkFileChooserDefault *impl, OperationMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case OPERATION_MODE_BROWSE:
|
||||
stop_loading_and_clear_list_model (impl);
|
||||
break;
|
||||
|
||||
case OPERATION_MODE_SEARCH:
|
||||
search_stop_searching (impl, FALSE);
|
||||
search_clear_model (impl, TRUE);
|
||||
|
||||
gtk_widget_destroy (impl->search_hbox);
|
||||
impl->search_hbox = NULL;
|
||||
impl->search_entry = NULL;
|
||||
break;
|
||||
|
||||
case OPERATION_MODE_RECENT:
|
||||
recent_stop_loading (impl);
|
||||
recent_clear_model (impl, TRUE);
|
||||
|
||||
gtk_widget_destroy (impl->recent_hbox);
|
||||
impl->recent_hbox = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Main entry point to the searching functions; this gets called when the user
|
||||
* activates the Search shortcut.
|
||||
*/
|
||||
@@ -9467,21 +9600,7 @@ search_activate (GtkFileChooserDefault *impl)
|
||||
previous_mode = impl->operation_mode;
|
||||
impl->operation_mode = OPERATION_MODE_SEARCH;
|
||||
|
||||
switch (previous_mode)
|
||||
{
|
||||
case OPERATION_MODE_RECENT:
|
||||
recent_stop_loading (impl);
|
||||
recent_clear_model (impl, TRUE);
|
||||
break;
|
||||
|
||||
case OPERATION_MODE_BROWSE:
|
||||
stop_loading_and_clear_list_model (impl);
|
||||
break;
|
||||
|
||||
case OPERATION_MODE_SEARCH:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
stop_operation (impl, previous_mode);
|
||||
|
||||
g_assert (impl->search_hbox == NULL);
|
||||
g_assert (impl->search_entry == NULL);
|
||||
@@ -9572,6 +9691,9 @@ recent_switch_to_browse_mode (GtkFileChooserDefault *impl)
|
||||
recent_stop_loading (impl);
|
||||
recent_clear_model (impl, TRUE);
|
||||
|
||||
gtk_widget_destroy (impl->recent_hbox);
|
||||
impl->recent_hbox = NULL;
|
||||
|
||||
gtk_widget_show (impl->browse_path_bar);
|
||||
gtk_widget_show (impl->browse_new_folder_button);
|
||||
|
||||
@@ -9797,9 +9919,7 @@ recent_setup_model (GtkFileChooserDefault *impl)
|
||||
RECENT_MODEL_COL_INFO,
|
||||
recent_column_mtime_sort_func,
|
||||
impl, NULL);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->recent_model_sort),
|
||||
RECENT_MODEL_COL_INFO,
|
||||
GTK_SORT_DESCENDING);
|
||||
set_sort_column (impl);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
@@ -10103,9 +10223,29 @@ recent_should_respond (GtkFileChooserDefault *impl)
|
||||
static void
|
||||
recent_hide_entry (GtkFileChooserDefault *impl)
|
||||
{
|
||||
GtkWidget *label;
|
||||
GtkWidget *image;
|
||||
|
||||
impl->recent_hbox = gtk_hbox_new (FALSE, 12);
|
||||
|
||||
/* Image */
|
||||
image = gtk_image_new_from_icon_name ("document-open-recent", GTK_ICON_SIZE_BUTTON);
|
||||
gtk_size_group_add_widget (impl->browse_path_bar_size_group, image);
|
||||
gtk_box_pack_start (GTK_BOX (impl->recent_hbox), image, FALSE, FALSE, GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
/* Label */
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup_with_mnemonic (GTK_LABEL (label), _("<b>Recently Used</b>"));
|
||||
gtk_box_pack_start (GTK_BOX (impl->recent_hbox), label, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_hide (impl->browse_path_bar);
|
||||
gtk_widget_hide (impl->browse_new_folder_button);
|
||||
|
||||
/* Box for recent widgets */
|
||||
gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->recent_hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show_all (impl->recent_hbox);
|
||||
|
||||
/* Hide the location widgets temporarily */
|
||||
if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
|
||||
impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
|
||||
{
|
||||
@@ -10128,25 +10268,7 @@ recent_activate (GtkFileChooserDefault *impl)
|
||||
previous_mode = impl->operation_mode;
|
||||
impl->operation_mode = OPERATION_MODE_RECENT;
|
||||
|
||||
switch (previous_mode)
|
||||
{
|
||||
case OPERATION_MODE_SEARCH:
|
||||
search_stop_searching (impl, FALSE);
|
||||
search_clear_model (impl, TRUE);
|
||||
|
||||
gtk_widget_destroy (impl->search_hbox);
|
||||
impl->search_hbox = NULL;
|
||||
impl->search_entry = NULL;
|
||||
break;
|
||||
|
||||
case OPERATION_MODE_BROWSE:
|
||||
stop_loading_and_clear_list_model (impl);
|
||||
break;
|
||||
|
||||
case OPERATION_MODE_RECENT:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
stop_operation (impl, previous_mode);
|
||||
|
||||
recent_hide_entry (impl);
|
||||
|
||||
@@ -10403,7 +10525,7 @@ shortcuts_activate_volume (GtkFileChooserDefault *impl,
|
||||
|
||||
if (!_gtk_file_system_volume_is_mounted (volume))
|
||||
{
|
||||
GtkMountOperation *mount_op;
|
||||
GMountOperation *mount_op;
|
||||
|
||||
set_busy_cursor (impl, TRUE);
|
||||
|
||||
@@ -11026,7 +11148,7 @@ list_name_data_func (GtkTreeViewColumn *tree_column,
|
||||
if (!info)
|
||||
{
|
||||
g_object_set (cell,
|
||||
"text", _("Type name of new folder"),
|
||||
"text", DEFAULT_NEW_FOLDER_NAME,
|
||||
"sensitive", TRUE,
|
||||
"ellipsize", PANGO_ELLIPSIZE_NONE,
|
||||
NULL);
|
||||
@@ -11746,3 +11868,14 @@ search_model_sort_new (GtkFileChooserDefault *impl,
|
||||
|
||||
return GTK_TREE_MODEL (model);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_file_chooser_default_unit_changed (GtkWidget *widget)
|
||||
{
|
||||
/* must chain up */
|
||||
if (GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->unit_changed != NULL)
|
||||
GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->unit_changed (widget);
|
||||
|
||||
if (gtk_widget_has_screen (widget))
|
||||
change_icon_theme (GTK_FILE_CHOOSER_DEFAULT (widget));
|
||||
}
|
||||
|
||||
@@ -90,9 +90,9 @@ gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog)
|
||||
dialog->priv->response_requested = FALSE;
|
||||
|
||||
gtk_dialog_set_has_separator (fc_dialog, FALSE);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog), 5);
|
||||
gtk_box_set_spacing (GTK_BOX (fc_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog->action_area), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_set_spacing (GTK_BOX (fc_dialog->vbox), GTK_SIZE_ONE_TWELFTH_EM (2)); /* 2 * 5 + 2 = 12 */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (fc_dialog->action_area), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
|
||||
/* We do a signal connection here rather than overriding the method in
|
||||
* class_init because GtkDialog::response is a RUN_LAST signal. We want *our*
|
||||
@@ -278,7 +278,7 @@ gtk_file_chooser_dialog_constructor (GType type,
|
||||
g_signal_connect (priv->widget, "response-requested",
|
||||
G_CALLBACK (file_chooser_widget_response_requested), object);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->widget), 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->widget), GTK_SIZE_ONE_TWELFTH_EM (5));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show (priv->widget);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "gtkrecentmanager.h"
|
||||
#include "gtksearchengine.h"
|
||||
#include "gtkquery.h"
|
||||
#include "gtksizegroup.h"
|
||||
#include "gtktreemodelsort.h"
|
||||
#include "gtktreestore.h"
|
||||
#include "gtktreeview.h"
|
||||
@@ -181,6 +182,7 @@ struct _GtkFileChooserDefault
|
||||
GtkWidget *browse_files_popup_menu_size_column_item;
|
||||
GtkWidget *browse_new_folder_button;
|
||||
GtkWidget *browse_path_bar_hbox;
|
||||
GtkSizeGroup *browse_path_bar_size_group;
|
||||
GtkWidget *browse_path_bar;
|
||||
|
||||
GtkFileSystemModel *browse_files_model;
|
||||
@@ -196,6 +198,7 @@ struct _GtkFileChooserDefault
|
||||
GtkTreeModelSort *search_model_sort;
|
||||
|
||||
/* OPERATION_MODE_RECENT */
|
||||
GtkWidget *recent_hbox;
|
||||
GtkRecentManager *recent_manager;
|
||||
GtkListStore *recent_model;
|
||||
guint load_recent_id;
|
||||
@@ -279,6 +282,9 @@ struct _GtkFileChooserDefault
|
||||
gulong toplevel_set_focus_id;
|
||||
GtkWidget *toplevel_last_focus_widget;
|
||||
|
||||
gint sort_column;
|
||||
GtkSortType sort_order;
|
||||
|
||||
#if 0
|
||||
GdkDragContext *shortcuts_drag_context;
|
||||
GSource *shortcuts_drag_outside_idle;
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
#define GEOMETRY_Y_KEY "GeometryY"
|
||||
#define GEOMETRY_WIDTH_KEY "GeometryWidth"
|
||||
#define GEOMETRY_HEIGHT_KEY "GeometryHeight"
|
||||
#define SORT_COLUMN_KEY "SortColumn"
|
||||
#define SORT_ORDER_KEY "SortOrder"
|
||||
|
||||
#define COLUMN_NAME_STRING "name"
|
||||
#define COLUMN_MTIME_STRING "modified"
|
||||
#define COLUMN_SIZE_STRING "size"
|
||||
#define SORT_ASCENDING_STRING "ascending"
|
||||
#define SORT_DESCENDING_STRING "descending"
|
||||
|
||||
#define MODE_PATH_BAR "path-bar"
|
||||
#define MODE_FILENAME_ENTRY "filename-entry"
|
||||
@@ -104,6 +112,7 @@ ensure_settings_read (GtkFileChooserSettings *settings)
|
||||
GError *error;
|
||||
GKeyFile *key_file;
|
||||
gchar *location_mode_str, *filename;
|
||||
gchar *sort_column, *sort_order;
|
||||
gboolean value;
|
||||
|
||||
if (settings->settings_read)
|
||||
@@ -129,6 +138,8 @@ ensure_settings_read (GtkFileChooserSettings *settings)
|
||||
if (!g_key_file_has_group (key_file, SETTINGS_GROUP))
|
||||
goto out;
|
||||
|
||||
/* Location mode */
|
||||
|
||||
location_mode_str = g_key_file_get_string (key_file, SETTINGS_GROUP,
|
||||
LOCATION_MODE_KEY, NULL);
|
||||
if (location_mode_str)
|
||||
@@ -144,6 +155,8 @@ ensure_settings_read (GtkFileChooserSettings *settings)
|
||||
g_free (location_mode_str);
|
||||
}
|
||||
|
||||
/* Show hidden */
|
||||
|
||||
value = g_key_file_get_boolean (key_file, SETTINGS_GROUP,
|
||||
SHOW_HIDDEN_KEY, &error);
|
||||
if (error)
|
||||
@@ -151,6 +164,8 @@ ensure_settings_read (GtkFileChooserSettings *settings)
|
||||
else
|
||||
settings->show_hidden = value != FALSE;
|
||||
|
||||
/* Expand folders */
|
||||
|
||||
value = g_key_file_get_boolean (key_file, SETTINGS_GROUP,
|
||||
EXPAND_FOLDERS_KEY, &error);
|
||||
if (error)
|
||||
@@ -158,6 +173,8 @@ ensure_settings_read (GtkFileChooserSettings *settings)
|
||||
else
|
||||
settings->expand_folders = value != FALSE;
|
||||
|
||||
/* Show size column */
|
||||
|
||||
value = g_key_file_get_boolean (key_file, SETTINGS_GROUP,
|
||||
SHOW_SIZE_COLUMN_KEY, &error);
|
||||
if (error)
|
||||
@@ -165,11 +182,49 @@ ensure_settings_read (GtkFileChooserSettings *settings)
|
||||
else
|
||||
settings->show_size_column = value != FALSE;
|
||||
|
||||
/* Geometry */
|
||||
|
||||
get_int_key (key_file, SETTINGS_GROUP, GEOMETRY_X_KEY, &settings->geometry_x);
|
||||
get_int_key (key_file, SETTINGS_GROUP, GEOMETRY_Y_KEY, &settings->geometry_y);
|
||||
get_int_key (key_file, SETTINGS_GROUP, GEOMETRY_WIDTH_KEY, &settings->geometry_width);
|
||||
get_int_key (key_file, SETTINGS_GROUP, GEOMETRY_HEIGHT_KEY, &settings->geometry_height);
|
||||
|
||||
/* Sort column */
|
||||
|
||||
sort_column = g_key_file_get_string (key_file, SETTINGS_GROUP,
|
||||
SORT_COLUMN_KEY, NULL);
|
||||
if (sort_column)
|
||||
{
|
||||
if (EQ (COLUMN_NAME_STRING, sort_column))
|
||||
settings->sort_column = FILE_LIST_COL_NAME;
|
||||
else if (EQ (COLUMN_MTIME_STRING, sort_column))
|
||||
settings->sort_column = FILE_LIST_COL_MTIME;
|
||||
else if (EQ (COLUMN_SIZE_STRING, sort_column))
|
||||
settings->sort_column = FILE_LIST_COL_SIZE;
|
||||
else
|
||||
g_warning ("Unknown sort column name '%s' encountered in filechooser settings",
|
||||
sort_column);
|
||||
|
||||
g_free (sort_column);
|
||||
}
|
||||
|
||||
/* Sort order */
|
||||
|
||||
sort_order = g_key_file_get_string (key_file, SETTINGS_GROUP,
|
||||
SORT_ORDER_KEY, NULL);
|
||||
if (sort_order)
|
||||
{
|
||||
if (EQ (SORT_ASCENDING_STRING, sort_order))
|
||||
settings->sort_order = GTK_SORT_ASCENDING;
|
||||
else if (EQ (SORT_DESCENDING_STRING, sort_order))
|
||||
settings->sort_order = GTK_SORT_DESCENDING;
|
||||
else
|
||||
g_warning ("Unknown sort column order '%s' encountered in filechooser settings",
|
||||
sort_order);
|
||||
|
||||
g_free (sort_order);
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
g_key_file_free (key_file);
|
||||
@@ -189,6 +244,8 @@ static void
|
||||
_gtk_file_chooser_settings_init (GtkFileChooserSettings *settings)
|
||||
{
|
||||
settings->location_mode = LOCATION_MODE_PATH_BAR;
|
||||
settings->sort_order = GTK_SORT_ASCENDING;
|
||||
settings->sort_column = FILE_LIST_COL_NAME;
|
||||
settings->show_hidden = FALSE;
|
||||
settings->expand_folders = FALSE;
|
||||
settings->show_size_column = FALSE;
|
||||
@@ -288,6 +345,34 @@ _gtk_file_chooser_settings_set_geometry (GtkFileChooserSettings *settings,
|
||||
settings->geometry_height = height;
|
||||
}
|
||||
|
||||
gint
|
||||
_gtk_file_chooser_settings_get_sort_column (GtkFileChooserSettings *settings)
|
||||
{
|
||||
ensure_settings_read (settings);
|
||||
return settings->sort_column;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_file_chooser_settings_set_sort_column (GtkFileChooserSettings *settings,
|
||||
gint sort_column)
|
||||
{
|
||||
settings->sort_column = sort_column;
|
||||
}
|
||||
|
||||
GtkSortType
|
||||
_gtk_file_chooser_settings_get_sort_order (GtkFileChooserSettings *settings)
|
||||
{
|
||||
ensure_settings_read (settings);
|
||||
return settings->sort_order;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_file_chooser_settings_set_sort_order (GtkFileChooserSettings *settings,
|
||||
GtkSortType sort_order)
|
||||
{
|
||||
settings->sort_order = sort_order;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_file_chooser_settings_save (GtkFileChooserSettings *settings,
|
||||
GError **error)
|
||||
@@ -296,6 +381,8 @@ _gtk_file_chooser_settings_save (GtkFileChooserSettings *settings,
|
||||
gchar *filename;
|
||||
gchar *dirname;
|
||||
gchar *contents;
|
||||
gchar *sort_column;
|
||||
gchar *sort_order;
|
||||
gsize len;
|
||||
gboolean retval;
|
||||
GKeyFile *key_file;
|
||||
@@ -317,6 +404,40 @@ _gtk_file_chooser_settings_save (GtkFileChooserSettings *settings,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (settings->sort_column)
|
||||
{
|
||||
case FILE_LIST_COL_NAME:
|
||||
sort_column = COLUMN_NAME_STRING;
|
||||
break;
|
||||
|
||||
case FILE_LIST_COL_MTIME:
|
||||
sort_column = COLUMN_MTIME_STRING;
|
||||
break;
|
||||
|
||||
case FILE_LIST_COL_SIZE:
|
||||
sort_column = COLUMN_SIZE_STRING;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
sort_column = NULL;
|
||||
}
|
||||
|
||||
switch (settings->sort_order)
|
||||
{
|
||||
case GTK_SORT_ASCENDING:
|
||||
sort_order = SORT_ASCENDING_STRING;
|
||||
break;
|
||||
|
||||
case GTK_SORT_DESCENDING:
|
||||
sort_order = SORT_DESCENDING_STRING;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
sort_order = NULL;
|
||||
}
|
||||
|
||||
key_file = g_key_file_new ();
|
||||
|
||||
/* Initialise with the on-disk keyfile, so we keep unknown options */
|
||||
@@ -338,6 +459,10 @@ _gtk_file_chooser_settings_save (GtkFileChooserSettings *settings,
|
||||
GEOMETRY_WIDTH_KEY, settings->geometry_width);
|
||||
g_key_file_set_integer (key_file, SETTINGS_GROUP,
|
||||
GEOMETRY_HEIGHT_KEY, settings->geometry_height);
|
||||
g_key_file_set_string (key_file, SETTINGS_GROUP,
|
||||
SORT_COLUMN_KEY, sort_column);
|
||||
g_key_file_set_string (key_file, SETTINGS_GROUP,
|
||||
SORT_ORDER_KEY, sort_order);
|
||||
|
||||
contents = g_key_file_to_data (key_file, &len, error);
|
||||
g_key_file_free (key_file);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user