forked from AuroraMiddleware/gtk
Merge branch 'master' into treeview-refactor
This commit is contained in:
commit
8679563247
21
NEWS
21
NEWS
@ -22,17 +22,32 @@ Overview of Changes from GTK+ 2.91.1 to 2.91.2
|
||||
|
||||
* GtkIconView allows tree models (ignoring anything below the root level)
|
||||
|
||||
* GtkProgressBar, GtkSpinButton and GtkEntry no longer have their own
|
||||
input-output window
|
||||
* GtkProgressBar, GtkSpinButton, GtkEntry and GtkCalendar no longer have
|
||||
their own input-output window
|
||||
|
||||
* gtk_widget_hide_all() has been removed
|
||||
|
||||
* GtkGrid: A legacy-free, height-for-width grid container
|
||||
|
||||
* GDK gained a GdkRGBA color struct containing 4 doubles, and various
|
||||
GdkColor APIs have GdkRGBA counterparts now.
|
||||
|
||||
* Bugs fixed:
|
||||
632381 438318 632538 632539 632677 632736 324899 524304 617174
|
||||
324899 GtkComboBoxText needs API to remove all items
|
||||
438318 Deprecate and remove hide_all()
|
||||
524304 Use XDG_USER_DATA to store the recent files
|
||||
617174 gtkrecentinfo & GIcon
|
||||
632381 gtk_combo_box_text_new_with_entry() adds two text cell renderers
|
||||
632538 Move setting property registration in gtksettings.c
|
||||
632539 Do not install gtkprivate.h
|
||||
632677 restore copyright header
|
||||
632736 change the window class of entry from INPUT_OUTPUT to INPUT_ONLY
|
||||
632936 gtkcellrenderer gdkrgba changes not correct
|
||||
|
||||
* Translation updates:
|
||||
Arabic
|
||||
Galician
|
||||
Hebrew
|
||||
Japanese
|
||||
Norwegian bokmål
|
||||
Spanish
|
||||
|
@ -20,7 +20,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
m4_define([gtk_major_version], [2])
|
||||
m4_define([gtk_minor_version], [91])
|
||||
m4_define([gtk_micro_version], [2])
|
||||
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)])
|
||||
|
@ -117,7 +117,7 @@ main (int argc, char *argv[])
|
||||
</para>
|
||||
|
||||
<para>
|
||||
One the other hand, GApplication supports passing entire
|
||||
On the other hand, GApplication supports passing entire
|
||||
commandlines to the running instance, which reduces the need
|
||||
for user-defined commands. And GDBus makes it very easy to
|
||||
implement D-Bus interfaces for communication between
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <gdk/gdkproperty.h>
|
||||
#include <gdk/gdkrectangle.h>
|
||||
#include <gdk/gdkrgba.h>
|
||||
#include <gdk/gdkscreen.h>
|
||||
#include <gdk/gdkselection.h>
|
||||
#include <gdk/gdkspawn.h>
|
||||
|
@ -290,6 +290,7 @@ gdk_cairo_create
|
||||
gdk_cairo_reset_clip
|
||||
gdk_cairo_get_clip_rectangle
|
||||
gdk_cairo_set_source_color
|
||||
gdk_cairo_set_source_rgba
|
||||
gdk_cairo_set_source_pixbuf
|
||||
gdk_cairo_set_source_window
|
||||
gdk_cairo_rectangle
|
||||
@ -310,6 +311,18 @@ gdk_color_to_string
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_RGBA_H__)
|
||||
#if IN_FILE(__GDK_RGBA_H__)
|
||||
gdk_rgba_copy
|
||||
gdk_rgba_equal
|
||||
gdk_rgba_free
|
||||
gdk_rgba_get_type
|
||||
gdk_rgba_hash
|
||||
gdk_rgba_parse
|
||||
gdk_rgba_to_string
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_CURSOR_H__)
|
||||
#if IN_FILE(__GDK_CURSOR_C__)
|
||||
gdk_cursor_get_type G_GNUC_CONST
|
||||
@ -571,6 +584,7 @@ gdk_window_get_width
|
||||
gdk_window_has_native
|
||||
gdk_window_set_background
|
||||
gdk_window_set_background_pattern
|
||||
gdk_window_set_background_rgba
|
||||
gdk_window_set_cursor
|
||||
gdk_window_shape_combine_region
|
||||
gdk_window_set_child_shapes
|
||||
|
@ -269,9 +269,15 @@ gdk_rgba_equal (gconstpointer p1,
|
||||
gchar *
|
||||
gdk_rgba_to_string (GdkRGBA *rgba)
|
||||
{
|
||||
return g_strdup_printf ("rgba(%f,%f,%f,%f)",
|
||||
CLAMP (rgba->red, 0, 1),
|
||||
CLAMP (rgba->green, 0, 1),
|
||||
CLAMP (rgba->blue, 0, 1),
|
||||
CLAMP (rgba->alpha, 0, 1));
|
||||
gchar red[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
gchar green[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
gchar blue[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
gchar alpha[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
|
||||
g_ascii_dtostr (red, G_ASCII_DTOSTR_BUF_SIZE, CLAMP (rgba->red, 0, 1));
|
||||
g_ascii_dtostr (green, G_ASCII_DTOSTR_BUF_SIZE, CLAMP (rgba->green, 0, 1));
|
||||
g_ascii_dtostr (blue, G_ASCII_DTOSTR_BUF_SIZE, CLAMP (rgba->blue, 0, 1));
|
||||
g_ascii_dtostr (alpha, G_ASCII_DTOSTR_BUF_SIZE, CLAMP (rgba->alpha, 0, 1));
|
||||
|
||||
return g_strdup_printf ("rgba(%s,%s,%s,%s)", red, green, blue, alpha);
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ include $(top_srcdir)/Makefile.decl
|
||||
|
||||
NULL=
|
||||
|
||||
# check_PROGRAMS=check-gdk-cairo
|
||||
check_PROGRAMS=
|
||||
TESTS=$(check_PROGRAMS)
|
||||
TESTS_ENVIRONMENT=GDK_PIXBUF_MODULE_FILE=$(top_builddir)/gdk-pixbuf/loaders.cache
|
||||
noinst_PROGRAMS = $(TEST_PROGS)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
$(GDK_DEP_CFLAGS) \
|
||||
@ -13,15 +10,19 @@ AM_CPPFLAGS=\
|
||||
-I$(top_builddir)/gdk \
|
||||
$(NULL)
|
||||
|
||||
check_gdk_cairo_SOURCES=\
|
||||
check-gdk-cairo.c \
|
||||
$(NULL)
|
||||
check_gdk_cairo_LDADD=\
|
||||
progs_ldadd = \
|
||||
$(GDK_DEP_LIBS) \
|
||||
$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
|
||||
$(top_builddir)/gdk/libgdk-$(gdktarget)-$(GTK_API_VERSION).la \
|
||||
$(NULL)
|
||||
|
||||
#TEST_PROGS += check-gdk-cairo
|
||||
check_gdk_cairo_SOURCES = check-gdk-cairo.c
|
||||
check_gdk_cairo_LDADD = $(progs_ldadd)
|
||||
|
||||
TEST_PROGS += gdk-color
|
||||
gdk_color_SOURCES = gdk-color.c
|
||||
gdk_color_LDADD = $(progs_ldadd)
|
||||
|
||||
CLEANFILES = \
|
||||
cairosurface.png \
|
||||
gdksurface.png
|
||||
|
100
gdk/tests/gdk-color.c
Normal file
100
gdk/tests/gdk-color.c
Normal file
@ -0,0 +1,100 @@
|
||||
#include <locale.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
static void
|
||||
test_color_parse (void)
|
||||
{
|
||||
GdkRGBA color;
|
||||
GdkRGBA expected;
|
||||
gboolean res;
|
||||
|
||||
res = gdk_rgba_parse ("foo", &color);
|
||||
g_assert (!res);
|
||||
|
||||
res = gdk_rgba_parse ("", &color);
|
||||
g_assert (!res);
|
||||
|
||||
expected.red = 0.4;
|
||||
expected.green = 0.3;
|
||||
expected.blue = 0.2;
|
||||
expected.alpha = 0.1;
|
||||
res = gdk_rgba_parse ("rgba(0.4,0.3,0.2,0.1)", &color);
|
||||
g_assert (res);
|
||||
g_assert (gdk_rgba_equal (&color, &expected));
|
||||
|
||||
res = gdk_rgba_parse ("rgba ( 0.4 , 0.3 , 0.2 , 0.1 )", &color);
|
||||
g_assert (res);
|
||||
g_assert (gdk_rgba_equal (&color, &expected));
|
||||
|
||||
expected.red = 0.4;
|
||||
expected.green = 0.3;
|
||||
expected.blue = 0.2;
|
||||
expected.alpha = 1.0;
|
||||
res = gdk_rgba_parse ("rgb(0.4,0.3,0.2)", &color);
|
||||
g_assert (res);
|
||||
g_assert (gdk_rgba_equal (&color, &expected));
|
||||
|
||||
expected.red = 1.0;
|
||||
expected.green = 0.0;
|
||||
expected.blue = 0.0;
|
||||
expected.alpha = 1.0;
|
||||
res = gdk_rgba_parse ("red", &color);
|
||||
g_assert (res);
|
||||
g_assert (gdk_rgba_equal (&color, &expected));
|
||||
|
||||
expected.red = 0.0;
|
||||
expected.green = 0x8080 / 65535.;
|
||||
expected.blue = 1.0;
|
||||
expected.alpha = 1.0;
|
||||
res = gdk_rgba_parse ("#0080ff", &color);
|
||||
g_assert (res);
|
||||
g_assert (gdk_rgba_equal (&color, &expected));
|
||||
}
|
||||
|
||||
static void
|
||||
test_color_to_string (void)
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
GdkRGBA out;
|
||||
gchar *res;
|
||||
gchar *res_de;
|
||||
gchar *res_en;
|
||||
gchar *orig;
|
||||
|
||||
rgba.red = 1.0;
|
||||
rgba.green = 0.5;
|
||||
rgba.blue = 0.1;
|
||||
rgba.alpha = 1.0;
|
||||
|
||||
orig = g_strdup (setlocale (LC_ALL, NULL));
|
||||
res = gdk_rgba_to_string (&rgba);
|
||||
gdk_rgba_parse (res, &out);
|
||||
g_assert (gdk_rgba_equal (&rgba, &out));
|
||||
|
||||
setlocale (LC_ALL, "de_DE.utf-8");
|
||||
res_de = gdk_rgba_to_string (&rgba);
|
||||
g_assert_cmpstr (res, ==, res_de);
|
||||
|
||||
setlocale (LC_ALL, "en_US.utf-8");
|
||||
res_en = gdk_rgba_to_string (&rgba);
|
||||
g_assert_cmpstr (res, ==, res_en);
|
||||
|
||||
g_free (res);
|
||||
g_free (res_de);
|
||||
g_free (res_en);
|
||||
|
||||
setlocale (LC_ALL, orig);
|
||||
g_free (orig);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
gdk_init (&argc, &argv);
|
||||
|
||||
g_test_add_func ("/color/parse", test_color_parse);
|
||||
g_test_add_func ("/color/to-string", test_color_to_string);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
@ -681,6 +681,7 @@ gtk_cell_view_new_with_markup
|
||||
gtk_cell_view_new_with_pixbuf
|
||||
gtk_cell_view_new_with_text
|
||||
gtk_cell_view_set_background_color
|
||||
gtk_cell_view_set_background_rgba
|
||||
gtk_cell_view_set_displayed_row
|
||||
gtk_cell_view_set_model
|
||||
#endif
|
||||
@ -749,6 +750,7 @@ gtk_clipboard_wait_is_target_available
|
||||
#if IN_FILE(__GTK_COLOR_BUTTON_C__)
|
||||
gtk_color_button_get_alpha
|
||||
gtk_color_button_get_color
|
||||
gtk_color_button_get_rgba
|
||||
gtk_color_button_get_title
|
||||
gtk_color_button_get_type G_GNUC_CONST
|
||||
gtk_color_button_get_use_alpha
|
||||
@ -757,6 +759,7 @@ gtk_color_button_new_with_color
|
||||
gtk_color_button_new_with_rgba
|
||||
gtk_color_button_set_alpha
|
||||
gtk_color_button_set_color
|
||||
gtk_color_button_set_rgba
|
||||
gtk_color_button_set_title
|
||||
gtk_color_button_set_use_alpha
|
||||
#endif
|
||||
@ -766,10 +769,12 @@ gtk_color_button_set_use_alpha
|
||||
#if IN_FILE(__GTK_COLOR_SELECTION_C__)
|
||||
gtk_color_selection_get_current_alpha
|
||||
gtk_color_selection_get_current_color
|
||||
gtk_color_selection_get_current_rgba
|
||||
gtk_color_selection_get_has_opacity_control
|
||||
gtk_color_selection_get_has_palette
|
||||
gtk_color_selection_get_previous_alpha
|
||||
gtk_color_selection_get_previous_color
|
||||
gtk_color_selection_get_previous_rgba
|
||||
gtk_color_selection_get_type G_GNUC_CONST
|
||||
gtk_color_selection_is_adjusting
|
||||
gtk_color_selection_new
|
||||
@ -778,10 +783,12 @@ gtk_color_selection_palette_to_string
|
||||
gtk_color_selection_set_change_palette_with_screen_hook
|
||||
gtk_color_selection_set_current_alpha
|
||||
gtk_color_selection_set_current_color
|
||||
gtk_color_selection_set_current_rgba
|
||||
gtk_color_selection_set_has_opacity_control
|
||||
gtk_color_selection_set_has_palette
|
||||
gtk_color_selection_set_previous_alpha
|
||||
gtk_color_selection_set_previous_color
|
||||
gtk_color_selection_set_previous_rgba
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -239,7 +239,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <errno.h> /* errno */
|
||||
#include <stdlib.h> /* strtol, strtoul */
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* strlen */
|
||||
|
||||
#include "gtkbuilder.h"
|
||||
@ -1451,9 +1451,9 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
||||
case G_TYPE_LONG:
|
||||
{
|
||||
long l;
|
||||
gchar *endptr;
|
||||
gchar *endptr = NULL;
|
||||
errno = 0;
|
||||
l = strtol (string, &endptr, 0);
|
||||
l = g_ascii_strtoll (string, &endptr, 0);
|
||||
if (errno || endptr == string)
|
||||
{
|
||||
g_set_error (error,
|
||||
@ -1474,9 +1474,9 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
||||
case G_TYPE_ULONG:
|
||||
{
|
||||
gulong ul;
|
||||
gchar *endptr;
|
||||
gchar *endptr = NULL;
|
||||
errno = 0;
|
||||
ul = strtoul (string, &endptr, 0);
|
||||
ul = g_ascii_strtoull (string, &endptr, 0);
|
||||
if (errno || endptr == string)
|
||||
{
|
||||
g_set_error (error,
|
||||
@ -1520,7 +1520,7 @@ gtk_builder_value_from_string_type (GtkBuilder *builder,
|
||||
case G_TYPE_DOUBLE:
|
||||
{
|
||||
gdouble d;
|
||||
gchar *endptr;
|
||||
gchar *endptr = NULL;
|
||||
errno = 0;
|
||||
d = g_ascii_strtod (string, &endptr);
|
||||
if (errno || endptr == string)
|
||||
@ -1676,8 +1676,10 @@ _gtk_builder_enum_from_string (GType type,
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
value = strtoul (string, &endptr, 0);
|
||||
if (endptr != string) /* parsed a number */
|
||||
endptr = NULL;
|
||||
errno = 0;
|
||||
value = g_ascii_strtoull (string, &endptr, 0);
|
||||
if (errno == 0 && endptr != string) /* parsed a number */
|
||||
*enum_value = value;
|
||||
else
|
||||
{
|
||||
@ -1724,8 +1726,10 @@ _gtk_builder_flags_from_string (GType type,
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
value = strtoul (string, &endptr, 0);
|
||||
if (endptr != string) /* parsed a number */
|
||||
endptr = NULL;
|
||||
errno = 0;
|
||||
value = g_ascii_strtoull (string, &endptr, 0);
|
||||
if (errno == 0 && endptr != string) /* parsed a number */
|
||||
*flags_value = value;
|
||||
else
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -335,9 +335,9 @@ attributes_text_element (GMarkupParseContext *context,
|
||||
if (!parser_data->attr_name)
|
||||
return;
|
||||
|
||||
errno = 0;
|
||||
string = g_strndup (text, text_len);
|
||||
l = strtol (string, &endptr, 0);
|
||||
errno = 0;
|
||||
l = g_ascii_strtoll (string, &endptr, 0);
|
||||
if (errno || endptr == string)
|
||||
{
|
||||
g_set_error (error,
|
||||
|
@ -506,9 +506,12 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
case PROP_CELL_BACKGROUND_GDK:
|
||||
{
|
||||
GdkColor *color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
color = g_value_get_boxed (value);
|
||||
if (color)
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
|
||||
rgba.red = color->red / 65535.;
|
||||
rgba.green = color->green / 65535.;
|
||||
rgba.blue = color->blue / 65535.;
|
||||
@ -516,6 +519,11 @@ gtk_cell_renderer_set_property (GObject *object,
|
||||
|
||||
set_cell_bg_color (cell, &rgba);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_cell_bg_color (cell, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROP_CELL_BACKGROUND_RGBA:
|
||||
set_cell_bg_color (cell, g_value_get_boxed (value));
|
||||
|
@ -1206,29 +1206,47 @@ gtk_cell_renderer_text_set_property (GObject *object,
|
||||
case PROP_BACKGROUND_GDK:
|
||||
{
|
||||
GdkColor *color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
color = g_value_get_boxed (value);
|
||||
if (color)
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
|
||||
rgba.red = color->red / 65535.;
|
||||
rgba.green = color->green / 65535.;
|
||||
rgba.blue = color->blue / 65535.;
|
||||
rgba.alpha = 1;
|
||||
|
||||
set_bg_color (celltext, &rgba);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_bg_color (celltext, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_FOREGROUND_GDK:
|
||||
{
|
||||
GdkColor *color;
|
||||
GdkRGBA rgba;
|
||||
|
||||
color = g_value_get_boxed (value);
|
||||
if (color)
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
|
||||
rgba.red = color->red / 65535.;
|
||||
rgba.green = color->green / 65535.;
|
||||
rgba.blue = color->blue / 65535.;
|
||||
rgba.alpha = 1;
|
||||
|
||||
set_fg_color (celltext, &rgba);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_fg_color (celltext, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_BACKGROUND_RGBA:
|
||||
|
@ -1357,7 +1357,7 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable,
|
||||
}
|
||||
|
||||
ad = get_response_data (GTK_WIDGET (object), TRUE);
|
||||
ad->response_id = atoi (item->response_id);
|
||||
ad->response_id = g_ascii_strtoll (item->response_id, NULL, 10);
|
||||
|
||||
if (GTK_IS_BUTTON (object))
|
||||
signal_id = g_signal_lookup ("clicked", GTK_TYPE_BUTTON);
|
||||
|
@ -541,6 +541,21 @@ typedef enum
|
||||
GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT
|
||||
} GtkSizeRequestMode;
|
||||
|
||||
/**
|
||||
* GtkScrollablePolicy:
|
||||
* @GTK_SCROLL_MINIMUM: Scrollable adjustments are based on the minimum size
|
||||
* @GTK_SCROLL_NATURAL: Scrollable adjustments are based on the natural size
|
||||
*
|
||||
* Defines the policy to be used in a scrollable widget when updating
|
||||
* the scrolled window adjustments in a given orientation.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GTK_SCROLL_MINIMUM = 0,
|
||||
GTK_SCROLL_NATURAL
|
||||
} GtkScrollablePolicy;
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
|
@ -205,6 +205,11 @@ struct _GtkIconViewPrivate
|
||||
guint shift_pressed : 1;
|
||||
|
||||
guint draw_focus : 1;
|
||||
|
||||
/* GtkScrollablePolicy needs to be checked when
|
||||
* driving the scrollable adjustment values */
|
||||
guint hscroll_policy : 1;
|
||||
guint vscroll_policy : 1;
|
||||
};
|
||||
|
||||
/* Signals */
|
||||
@ -243,7 +248,9 @@ enum
|
||||
|
||||
/* For scrollable interface */
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_HSCROLL_POLICY,
|
||||
PROP_VSCROLL_POLICY
|
||||
};
|
||||
|
||||
/* GObject vfuncs */
|
||||
@ -796,6 +803,8 @@ gtk_icon_view_class_init (GtkIconViewClass *klass)
|
||||
/* Scrollable interface properties */
|
||||
g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_HSCROLL_POLICY, "hscroll-policy");
|
||||
g_object_class_override_property (gobject_class, PROP_VSCROLL_POLICY, "vscroll-policy");
|
||||
|
||||
/* Style properties */
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
@ -1205,6 +1214,14 @@ gtk_icon_view_set_property (GObject *object,
|
||||
case PROP_VADJUSTMENT:
|
||||
gtk_icon_view_set_vadjustment (icon_view, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
icon_view->priv->hscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (icon_view));
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
icon_view->priv->vscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (icon_view));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@ -1277,6 +1294,12 @@ gtk_icon_view_get_property (GObject *object,
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, icon_view->priv->vadjustment);
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, icon_view->priv->hscroll_policy);
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
g_value_set_enum (value, icon_view->priv->vscroll_policy);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -53,6 +53,11 @@ struct _GtkLayoutPrivate
|
||||
GtkAdjustment *hadjustment;
|
||||
GtkAdjustment *vadjustment;
|
||||
|
||||
/* GtkScrollablePolicy needs to be checked when
|
||||
* driving the scrollable adjustment values */
|
||||
guint hscroll_policy : 1;
|
||||
guint vscroll_policy : 1;
|
||||
|
||||
/* Properties */
|
||||
|
||||
GdkVisibilityState visibility;
|
||||
@ -76,6 +81,8 @@ enum {
|
||||
PROP_0,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_HSCROLL_POLICY,
|
||||
PROP_VSCROLL_POLICY,
|
||||
PROP_WIDTH,
|
||||
PROP_HEIGHT
|
||||
};
|
||||
@ -620,6 +627,8 @@ gtk_layout_class_init (GtkLayoutClass *class)
|
||||
/* Scrollable interface */
|
||||
g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_HSCROLL_POLICY, "hscroll-policy");
|
||||
g_object_class_override_property (gobject_class, PROP_VSCROLL_POLICY, "vscroll-policy");
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_WIDTH,
|
||||
@ -671,6 +680,12 @@ gtk_layout_get_property (GObject *object,
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, priv->vadjustment);
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, priv->hscroll_policy);
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
g_value_set_enum (value, priv->vscroll_policy);
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
g_value_set_uint (value, priv->width);
|
||||
break;
|
||||
@ -702,6 +717,14 @@ gtk_layout_set_property (GObject *object,
|
||||
gtk_layout_set_vadjustment (layout,
|
||||
(GtkAdjustment*) g_value_get_object (value));
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
priv->hscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (layout));
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
priv->vscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (layout));
|
||||
break;
|
||||
case PROP_WIDTH:
|
||||
gtk_layout_set_size (layout, g_value_get_uint (value),
|
||||
priv->height);
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkscrollable.h"
|
||||
#include "gtktypeutils.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
@ -106,6 +107,38 @@ gtk_scrollable_default_init (GtkScrollableInterface *iface)
|
||||
GTK_TYPE_ADJUSTMENT,
|
||||
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* GtkScrollable:hscroll-policy:
|
||||
*
|
||||
* Determines whether horizontal scrolling should commence once the scrollable
|
||||
* widget is allocated less than it's minimum width or less than it's natural width.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
pspec = g_param_spec_enum ("hscroll-policy",
|
||||
P_("Horizontal Scrollable Policy"),
|
||||
P_("How the size of the content should be determined"),
|
||||
GTK_TYPE_SCROLLABLE_POLICY,
|
||||
GTK_SCROLL_MINIMUM,
|
||||
GTK_PARAM_READWRITE);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
|
||||
/**
|
||||
* GtkScrollable:vscroll-policy:
|
||||
*
|
||||
* Determines whether vertical scrolling should commence once the scrollable
|
||||
* widget is allocated less than it's minimum height or less than it's natural height.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
pspec = g_param_spec_enum ("vscroll-policy",
|
||||
P_("Vertical Scrollable Policy"),
|
||||
P_("How the size of the content should be determined"),
|
||||
GTK_TYPE_SCROLLABLE_POLICY,
|
||||
GTK_SCROLL_MINIMUM,
|
||||
GTK_PARAM_READWRITE);
|
||||
g_object_interface_install_property (iface, pspec);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -203,3 +236,88 @@ gtk_scrollable_set_vadjustment (GtkScrollable *scrollable,
|
||||
|
||||
g_object_set (scrollable, "vadjustment", vadjustment, NULL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gtk_scrollable_get_hscroll_policy:
|
||||
* @scrollable: a #GtkScrollable
|
||||
*
|
||||
* Gets the horizontal #GtkScrollablePolicy.
|
||||
*
|
||||
* Return value: The horizontal #GtkScrollablePolicy.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
GtkScrollablePolicy
|
||||
gtk_scrollable_get_hscroll_policy (GtkScrollable *scrollable)
|
||||
{
|
||||
GtkScrollablePolicy policy;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_SCROLLABLE (scrollable), GTK_SCROLL_MINIMUM);
|
||||
|
||||
g_object_get (scrollable, "hscroll-policy", &policy, NULL);
|
||||
|
||||
return policy;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_scrollable_set_hscroll_policy:
|
||||
* @scrollable: a #GtkScrollable
|
||||
* @policy: the horizontal #GtkScrollablePolicy
|
||||
*
|
||||
* Sets the #GtkScrollablePolicy to determine whether
|
||||
* horizontal scrolling should commence below minimum or
|
||||
* below natural width.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_scrollable_set_hscroll_policy (GtkScrollable *scrollable,
|
||||
GtkScrollablePolicy policy)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_SCROLLABLE (scrollable));
|
||||
|
||||
g_object_set (scrollable, "hscroll-policy", policy, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_scrollable_get_vscroll_policy:
|
||||
* @scrollable: a #GtkScrollable
|
||||
*
|
||||
* Gets the vertical #GtkScrollablePolicy.
|
||||
*
|
||||
* Return value: The vertical #GtkScrollablePolicy.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
GtkScrollablePolicy
|
||||
gtk_scrollable_get_vscroll_policy (GtkScrollable *scrollable)
|
||||
{
|
||||
GtkScrollablePolicy policy;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_SCROLLABLE (scrollable), GTK_SCROLL_MINIMUM);
|
||||
|
||||
g_object_get (scrollable, "vscroll-policy", &policy, NULL);
|
||||
|
||||
return policy;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_scrollable_set_vscroll_policy:
|
||||
* @scrollable: a #GtkScrollable
|
||||
* @policy: the vertical #GtkScrollablePolicy
|
||||
*
|
||||
* Sets the #GtkScrollablePolicy to determine whether
|
||||
* vertical scrolling should commence below minimum or
|
||||
* below natural height.
|
||||
*
|
||||
* Since: 3.0
|
||||
**/
|
||||
void
|
||||
gtk_scrollable_set_vscroll_policy (GtkScrollable *scrollable,
|
||||
GtkScrollablePolicy policy)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_SCROLLABLE (scrollable));
|
||||
|
||||
g_object_set (scrollable, "vscroll-policy", policy, NULL);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define __GTK_SCROLLABLE_H__
|
||||
|
||||
#include <gtk/gtkadjustment.h>
|
||||
#include <gtk/gtkenums.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -49,6 +50,12 @@ void gtk_scrollable_set_hadjustment (GtkScrollable *scrollable,
|
||||
GtkAdjustment *gtk_scrollable_get_vadjustment (GtkScrollable *scrollable);
|
||||
void gtk_scrollable_set_vadjustment (GtkScrollable *scrollable,
|
||||
GtkAdjustment *vadjustment);
|
||||
GtkScrollablePolicy gtk_scrollable_get_hscroll_policy (GtkScrollable *scrollable);
|
||||
void gtk_scrollable_set_hscroll_policy (GtkScrollable *scrollable,
|
||||
GtkScrollablePolicy policy);
|
||||
GtkScrollablePolicy gtk_scrollable_get_vscroll_policy (GtkScrollable *scrollable);
|
||||
void gtk_scrollable_set_vscroll_policy (GtkScrollable *scrollable,
|
||||
GtkScrollablePolicy policy);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -1460,8 +1460,6 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||
gint sb_width;
|
||||
gint sb_height;
|
||||
|
||||
|
||||
|
||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
|
||||
g_return_if_fail (allocation != NULL);
|
||||
|
||||
@ -1491,8 +1489,8 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
gint child_min_width;
|
||||
gint child_min_height;
|
||||
gint child_scroll_width;
|
||||
gint child_scroll_height;
|
||||
gboolean previous_hvis;
|
||||
gboolean previous_vvis;
|
||||
guint count = 0;
|
||||
@ -1509,41 +1507,50 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||
/* Determine scrollbar visibility first via hfw apis */
|
||||
if (gtk_widget_get_request_mode (child) == GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH)
|
||||
{
|
||||
gtk_widget_get_preferred_width (child, &child_min_width, NULL);
|
||||
if (gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (child)) == GTK_SCROLL_MINIMUM)
|
||||
gtk_widget_get_preferred_width (child, &child_scroll_width, NULL);
|
||||
else
|
||||
gtk_widget_get_preferred_width (child, NULL, &child_scroll_width);
|
||||
|
||||
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
||||
{
|
||||
/* First try without a vertical scrollbar if the content will fit the height
|
||||
* given the extra width of the scrollbar */
|
||||
gtk_widget_get_preferred_height_for_width (child, allocation->width,
|
||||
&child_min_height, NULL);
|
||||
if (gtk_scrollable_get_vscroll_policy (GTK_SCROLLABLE (child)) == GTK_SCROLL_MINIMUM)
|
||||
gtk_widget_get_preferred_height_for_width (child,
|
||||
MAX (allocation->width, child_scroll_width),
|
||||
&child_scroll_height, NULL);
|
||||
else
|
||||
gtk_widget_get_preferred_height_for_width (child,
|
||||
MAX (allocation->width, child_scroll_width),
|
||||
NULL, &child_scroll_height);
|
||||
|
||||
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
||||
{
|
||||
/* Does the content height fit the allocation height ? */
|
||||
priv->vscrollbar_visible = child_min_height > allocation->height;
|
||||
priv->vscrollbar_visible = child_scroll_height > allocation->height;
|
||||
|
||||
/* Does the content width fit the allocation with minus a possible scrollbar ? */
|
||||
priv->hscrollbar_visible =
|
||||
child_min_width > allocation->width -
|
||||
child_scroll_width > allocation->width -
|
||||
(priv->vscrollbar_visible ? sb_width + sb_spacing : 0);
|
||||
|
||||
/* Now that we've guessed the hscrollbar, does the content height fit
|
||||
* the possible new allocation height ? */
|
||||
priv->vscrollbar_visible =
|
||||
child_min_height > allocation->height -
|
||||
child_scroll_height > allocation->height -
|
||||
(priv->hscrollbar_visible ? sb_height + sb_spacing : 0);
|
||||
|
||||
/* Now that we've guessed the vscrollbar, does the content width fit
|
||||
* the possible new allocation width ? */
|
||||
priv->hscrollbar_visible =
|
||||
child_min_width > allocation->width -
|
||||
child_scroll_width > allocation->width -
|
||||
(priv->vscrollbar_visible ? sb_width + sb_spacing : 0);
|
||||
}
|
||||
else /* priv->hscrollbar_policy != GTK_POLICY_AUTOMATIC */
|
||||
{
|
||||
priv->hscrollbar_visible = priv->hscrollbar_policy != GTK_POLICY_NEVER;
|
||||
priv->vscrollbar_visible = child_min_height > allocation->height -
|
||||
priv->vscrollbar_visible = child_scroll_height > allocation->height -
|
||||
(priv->hscrollbar_visible ? sb_height + sb_spacing : 0);
|
||||
}
|
||||
}
|
||||
@ -1553,7 +1560,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
||||
priv->hscrollbar_visible =
|
||||
child_min_width > allocation->width -
|
||||
child_scroll_width > allocation->width -
|
||||
(priv->vscrollbar_visible ? 0 : sb_width + sb_spacing);
|
||||
else
|
||||
priv->hscrollbar_visible = priv->hscrollbar_policy != GTK_POLICY_NEVER;
|
||||
@ -1561,41 +1568,50 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT */
|
||||
{
|
||||
gtk_widget_get_preferred_height (child, &child_min_height, NULL);
|
||||
if (gtk_scrollable_get_vscroll_policy (GTK_SCROLLABLE (child)) == GTK_SCROLL_MINIMUM)
|
||||
gtk_widget_get_preferred_height (child, &child_scroll_height, NULL);
|
||||
else
|
||||
gtk_widget_get_preferred_height (child, NULL, &child_scroll_height);
|
||||
|
||||
if (priv->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
||||
{
|
||||
/* First try without a horizontal scrollbar if the content will fit the width
|
||||
* given the extra height of the scrollbar */
|
||||
gtk_widget_get_preferred_width_for_height (child, allocation->height,
|
||||
&child_min_width, NULL);
|
||||
if (gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (child)) == GTK_SCROLL_MINIMUM)
|
||||
gtk_widget_get_preferred_width_for_height (child,
|
||||
MAX (allocation->height, child_scroll_height),
|
||||
&child_scroll_width, NULL);
|
||||
else
|
||||
gtk_widget_get_preferred_width_for_height (child,
|
||||
MAX (allocation->height, child_scroll_height),
|
||||
NULL, &child_scroll_width);
|
||||
|
||||
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
||||
{
|
||||
/* Does the content width fit the allocation width ? */
|
||||
priv->hscrollbar_visible = child_min_width > allocation->width;
|
||||
priv->hscrollbar_visible = child_scroll_width > allocation->width;
|
||||
|
||||
/* Does the content height fit the allocation with minus a possible scrollbar ? */
|
||||
priv->vscrollbar_visible =
|
||||
child_min_height > allocation->height -
|
||||
child_scroll_height > allocation->height -
|
||||
(priv->hscrollbar_visible ? sb_height + sb_spacing : 0);
|
||||
|
||||
/* Now that we've guessed the vscrollbar, does the content width fit
|
||||
* the possible new allocation width ? */
|
||||
priv->hscrollbar_visible =
|
||||
child_min_width > allocation->width -
|
||||
child_scroll_width > allocation->width -
|
||||
(priv->vscrollbar_visible ? sb_width + sb_spacing : 0);
|
||||
|
||||
/* Now that we've guessed the hscrollbar, does the content height fit
|
||||
* the possible new allocation height ? */
|
||||
priv->vscrollbar_visible =
|
||||
child_min_height > allocation->height -
|
||||
child_scroll_height > allocation->height -
|
||||
(priv->hscrollbar_visible ? sb_height + sb_spacing : 0);
|
||||
}
|
||||
else /* priv->vscrollbar_policy != GTK_POLICY_AUTOMATIC */
|
||||
{
|
||||
priv->vscrollbar_visible = priv->vscrollbar_policy != GTK_POLICY_NEVER;
|
||||
priv->hscrollbar_visible = child_min_width > allocation->width -
|
||||
priv->hscrollbar_visible = child_scroll_width > allocation->width -
|
||||
(priv->vscrollbar_visible ? sb_width + sb_spacing : 0);
|
||||
}
|
||||
}
|
||||
@ -1605,7 +1621,7 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (priv->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
|
||||
priv->vscrollbar_visible =
|
||||
child_min_height > allocation->height -
|
||||
child_scroll_height > allocation->height -
|
||||
(priv->hscrollbar_visible ? 0 : sb_height + sb_spacing);
|
||||
else
|
||||
priv->vscrollbar_visible = priv->vscrollbar_policy != GTK_POLICY_NEVER;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "gdk-pixbuf/gdk-pixdata.h"
|
||||
#include "gtktextbufferserialize.h"
|
||||
@ -113,9 +114,10 @@ deserialize_value (const gchar *str,
|
||||
gchar *tmp;
|
||||
int v;
|
||||
|
||||
v = strtol (str, &tmp, 10);
|
||||
errno = 0;
|
||||
v = g_ascii_strtoll (str, &tmp, 10);
|
||||
|
||||
if (tmp == NULL || tmp == str)
|
||||
if (errno || tmp == NULL || tmp == str)
|
||||
return FALSE;
|
||||
|
||||
g_value_set_int (value, v);
|
||||
@ -143,26 +145,32 @@ deserialize_value (const gchar *str,
|
||||
gchar *tmp;
|
||||
|
||||
old = str;
|
||||
color.red = strtol (old, &tmp, 16);
|
||||
tmp = NULL;
|
||||
errno = 0;
|
||||
color.red = g_ascii_strtoll (old, &tmp, 16);
|
||||
|
||||
if (tmp == NULL || tmp == old)
|
||||
if (errno || tmp == old)
|
||||
return FALSE;
|
||||
|
||||
old = tmp;
|
||||
if (*old++ != ':')
|
||||
return FALSE;
|
||||
|
||||
color.green = strtol (old, &tmp, 16);
|
||||
if (tmp == NULL || tmp == old)
|
||||
tmp = NULL;
|
||||
errno = 0;
|
||||
color.green = g_ascii_strtoll (old, &tmp, 16);
|
||||
if (errno || tmp == old)
|
||||
return FALSE;
|
||||
|
||||
old = tmp;
|
||||
if (*old++ != ':')
|
||||
return FALSE;
|
||||
|
||||
color.blue = strtol (old, &tmp, 16);
|
||||
tmp = NULL;
|
||||
errno = 0;
|
||||
color.blue = g_ascii_strtoll (old, &tmp, 16);
|
||||
|
||||
if (tmp == NULL || tmp == old || *tmp != '\0')
|
||||
if (errno || tmp == old || *tmp != '\0')
|
||||
return FALSE;
|
||||
|
||||
g_value_set_boxed (value, &color);
|
||||
@ -836,9 +844,11 @@ check_id_or_name (GMarkupParseContext *context,
|
||||
has_id = TRUE;
|
||||
|
||||
/* Try parsing the integer */
|
||||
*id = strtol (attribute_values[i], &tmp, 10);
|
||||
tmp = NULL;
|
||||
errno = 0;
|
||||
*id = g_ascii_strtoll (attribute_values[i], &tmp, 10);
|
||||
|
||||
if (tmp == NULL || tmp == attribute_values[i])
|
||||
if (errno || tmp == attribute_values[i])
|
||||
{
|
||||
set_error (error, context,
|
||||
G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
|
||||
@ -1291,9 +1301,11 @@ parse_tag_element (GMarkupParseContext *context,
|
||||
}
|
||||
}
|
||||
|
||||
prio = strtol (priority, &tmp, 10);
|
||||
tmp = NULL;
|
||||
errno = 0;
|
||||
prio = g_ascii_strtoll (priority, &tmp, 10);
|
||||
|
||||
if (tmp == NULL || tmp == priority)
|
||||
if (errno || tmp == priority)
|
||||
{
|
||||
set_error (error, context,
|
||||
G_MARKUP_ERROR, G_MARKUP_ERROR_PARSE,
|
||||
|
@ -210,6 +210,11 @@ struct _GtkTextViewPrivate
|
||||
guint mouse_cursor_obscured : 1;
|
||||
|
||||
guint scroll_after_paste : 1;
|
||||
|
||||
/* GtkScrollablePolicy needs to be checked when
|
||||
* driving the scrollable adjustment values */
|
||||
guint hscroll_policy : 1;
|
||||
guint vscroll_policy : 1;
|
||||
};
|
||||
|
||||
struct _GtkTextPendingScroll
|
||||
@ -260,7 +265,9 @@ enum
|
||||
PROP_ACCEPTS_TAB,
|
||||
PROP_IM_MODULE,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_HSCROLL_POLICY,
|
||||
PROP_VSCROLL_POLICY
|
||||
};
|
||||
|
||||
static void gtk_text_view_finalize (GObject *object);
|
||||
@ -773,6 +780,8 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
/* GtkScrollable interface */
|
||||
g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_HSCROLL_POLICY, "hscroll-policy");
|
||||
g_object_class_override_property (gobject_class, PROP_VSCROLL_POLICY, "vscroll-policy");
|
||||
|
||||
/*
|
||||
* Style properties
|
||||
@ -3092,6 +3101,16 @@ gtk_text_view_set_property (GObject *object,
|
||||
gtk_text_view_set_vadjustment (text_view, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_HSCROLL_POLICY:
|
||||
priv->hscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (text_view));
|
||||
break;
|
||||
|
||||
case PROP_VSCROLL_POLICY:
|
||||
priv->vscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (text_view));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -3180,6 +3199,14 @@ gtk_text_view_get_property (GObject *object,
|
||||
g_value_set_object (value, priv->vadjustment);
|
||||
break;
|
||||
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, priv->hscroll_policy);
|
||||
break;
|
||||
|
||||
case PROP_VSCROLL_POLICY:
|
||||
g_value_set_enum (value, priv->vscroll_policy);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -122,7 +122,9 @@ enum
|
||||
PROP_ORIENTATION,
|
||||
PROP_TOOLBAR_STYLE,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_HSCROLL_POLICY,
|
||||
PROP_VSCROLL_POLICY
|
||||
};
|
||||
|
||||
enum
|
||||
@ -163,6 +165,11 @@ struct _GtkToolPalettePrivate
|
||||
gulong settings_connection;
|
||||
|
||||
guint drag_source : 2;
|
||||
|
||||
/* GtkScrollablePolicy needs to be checked when
|
||||
* driving the scrollable adjustment values */
|
||||
guint hscroll_policy : 1;
|
||||
guint vscroll_policy : 1;
|
||||
};
|
||||
|
||||
struct _GtkToolPaletteDragData
|
||||
@ -276,6 +283,16 @@ gtk_tool_palette_set_property (GObject *object,
|
||||
gtk_tool_palette_set_vadjustment (palette, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_HSCROLL_POLICY:
|
||||
palette->priv->hscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (palette));
|
||||
break;
|
||||
|
||||
case PROP_VSCROLL_POLICY:
|
||||
palette->priv->vscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (palette));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -316,6 +333,14 @@ gtk_tool_palette_get_property (GObject *object,
|
||||
g_value_set_object (value, palette->priv->vadjustment);
|
||||
break;
|
||||
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, palette->priv->hscroll_policy);
|
||||
break;
|
||||
|
||||
case PROP_VSCROLL_POLICY:
|
||||
g_value_set_enum (value, palette->priv->vscroll_policy);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -956,6 +981,8 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
|
||||
|
||||
g_object_class_override_property (oclass, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (oclass, PROP_VADJUSTMENT, "vadjustment");
|
||||
g_object_class_override_property (oclass, PROP_HSCROLL_POLICY, "hscroll-policy");
|
||||
g_object_class_override_property (oclass, PROP_VSCROLL_POLICY, "vscroll-policy");
|
||||
|
||||
/**
|
||||
* GtkToolPalette:icon-size:
|
||||
|
@ -302,6 +302,11 @@ struct _GtkTreeViewPrivate
|
||||
|
||||
/* Whether our key press handler is to avoid sending an unhandled binding to the search entry */
|
||||
guint search_entry_avoid_unhandled_binding : 1;
|
||||
|
||||
/* GtkScrollablePolicy needs to be checked when
|
||||
* driving the scrollable adjustment values */
|
||||
guint hscroll_policy : 1;
|
||||
guint vscroll_policy : 1;
|
||||
};
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
@ -131,6 +131,8 @@ enum {
|
||||
PROP_MODEL,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_HSCROLL_POLICY,
|
||||
PROP_VSCROLL_POLICY,
|
||||
PROP_HEADERS_VISIBLE,
|
||||
PROP_HEADERS_CLICKABLE,
|
||||
PROP_EXPANDER_COLUMN,
|
||||
@ -570,6 +572,8 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
|
||||
|
||||
g_object_class_override_property (o_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (o_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
g_object_class_override_property (o_class, PROP_HSCROLL_POLICY, "hscroll-policy");
|
||||
g_object_class_override_property (o_class, PROP_VSCROLL_POLICY, "vscroll-policy");
|
||||
|
||||
g_object_class_install_property (o_class,
|
||||
PROP_HEADERS_VISIBLE,
|
||||
@ -1366,6 +1370,14 @@ gtk_tree_view_set_property (GObject *object,
|
||||
case PROP_VADJUSTMENT:
|
||||
gtk_tree_view_set_vadjustment (tree_view, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
tree_view->priv->hscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
tree_view->priv->vscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
|
||||
break;
|
||||
case PROP_HEADERS_VISIBLE:
|
||||
gtk_tree_view_set_headers_visible (tree_view, g_value_get_boolean (value));
|
||||
break;
|
||||
@ -1441,6 +1453,12 @@ gtk_tree_view_get_property (GObject *object,
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, tree_view->priv->vadjustment);
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, tree_view->priv->hscroll_policy);
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
g_value_set_enum (value, tree_view->priv->vscroll_policy);
|
||||
break;
|
||||
case PROP_HEADERS_VISIBLE:
|
||||
g_value_set_boolean (value, gtk_tree_view_get_headers_visible (tree_view));
|
||||
break;
|
||||
|
@ -66,14 +66,19 @@ struct _GtkViewportPrivate
|
||||
|
||||
GdkWindow *bin_window;
|
||||
GdkWindow *view_window;
|
||||
|
||||
/* GtkScrollablePolicy needs to be checked when
|
||||
* driving the scrollable adjustment values */
|
||||
guint hscroll_policy : 1;
|
||||
guint vscroll_policy : 1;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_MIN_DISPLAY_WIDTH,
|
||||
PROP_MIN_DISPLAY_HEIGHT,
|
||||
PROP_HSCROLL_POLICY,
|
||||
PROP_VSCROLL_POLICY,
|
||||
PROP_SHADOW_TYPE
|
||||
};
|
||||
|
||||
@ -141,6 +146,8 @@ gtk_viewport_class_init (GtkViewportClass *class)
|
||||
/* GtkScrollable implementation */
|
||||
g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
g_object_class_override_property (gobject_class, PROP_HSCROLL_POLICY, "hscroll-policy");
|
||||
g_object_class_override_property (gobject_class, PROP_VSCROLL_POLICY, "vscroll-policy");
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SHADOW_TYPE,
|
||||
@ -172,6 +179,14 @@ gtk_viewport_set_property (GObject *object,
|
||||
case PROP_VADJUSTMENT:
|
||||
gtk_viewport_set_vadjustment (viewport, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
viewport->priv->hscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (viewport));
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
viewport->priv->vscroll_policy = g_value_get_enum (value);
|
||||
gtk_widget_queue_resize (GTK_WIDGET (viewport));
|
||||
break;
|
||||
case PROP_SHADOW_TYPE:
|
||||
gtk_viewport_set_shadow_type (viewport, g_value_get_enum (value));
|
||||
break;
|
||||
@ -198,6 +213,12 @@ gtk_viewport_get_property (GObject *object,
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, priv->vadjustment);
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, priv->hscroll_policy);
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
g_value_set_enum (value, priv->vscroll_policy);
|
||||
break;
|
||||
case PROP_SHADOW_TYPE:
|
||||
g_value_set_enum (value, priv->shadow_type);
|
||||
break;
|
||||
@ -414,13 +435,23 @@ viewport_set_hadjustment_values (GtkViewport *viewport,
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
gint minimum_width;
|
||||
gint minimum_width, natural_width;
|
||||
gint scroll_height;
|
||||
|
||||
if (viewport->priv->vscroll_policy == GTK_SCROLL_MINIMUM)
|
||||
gtk_widget_get_preferred_height (child, &scroll_height, NULL);
|
||||
else
|
||||
gtk_widget_get_preferred_height (child, NULL, &scroll_height);
|
||||
|
||||
gtk_widget_get_preferred_width_for_height (child,
|
||||
view_allocation.height,
|
||||
MAX (view_allocation.height, scroll_height),
|
||||
&minimum_width,
|
||||
NULL);
|
||||
&natural_width);
|
||||
|
||||
if (viewport->priv->hscroll_policy == GTK_SCROLL_MINIMUM)
|
||||
hadjustment->upper = MAX (minimum_width, view_allocation.width);
|
||||
else
|
||||
hadjustment->upper = MAX (natural_width, view_allocation.width);
|
||||
}
|
||||
else
|
||||
hadjustment->upper = view_allocation.width;
|
||||
@ -456,14 +487,23 @@ viewport_set_vadjustment_values (GtkViewport *viewport,
|
||||
child = gtk_bin_get_child (bin);
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
gint minimum_height;
|
||||
gint minimum_height, natural_height;
|
||||
gint scroll_width;
|
||||
|
||||
if (viewport->priv->hscroll_policy == GTK_SCROLL_MINIMUM)
|
||||
gtk_widget_get_preferred_width (child, &scroll_width, NULL);
|
||||
else
|
||||
gtk_widget_get_preferred_width (child, NULL, &scroll_width);
|
||||
|
||||
gtk_widget_get_preferred_height_for_width (child,
|
||||
view_allocation.width,
|
||||
MAX (view_allocation.width, scroll_width),
|
||||
&minimum_height,
|
||||
NULL);
|
||||
&natural_height);
|
||||
|
||||
if (viewport->priv->vscroll_policy == GTK_SCROLL_MINIMUM)
|
||||
vadjustment->upper = MAX (minimum_height, view_allocation.height);
|
||||
else
|
||||
vadjustment->upper = MAX (natural_height, view_allocation.height);
|
||||
}
|
||||
else
|
||||
vadjustment->upper = view_allocation.height;
|
||||
|
@ -531,9 +531,10 @@ extract_time_from_startup_id (const gchar* startup_id)
|
||||
/* Skip past the "_TIME" part */
|
||||
timestr += 5;
|
||||
|
||||
end = NULL;
|
||||
errno = 0;
|
||||
timestamp = strtoul (timestr, &end, 0);
|
||||
if (end != timestr && errno == 0)
|
||||
timestamp = g_ascii_strtoull (timestr, &end, 0);
|
||||
if (errno == 0 && end != timestr)
|
||||
retval = timestamp;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,6 @@ gtk/gtkcolorbutton.c
|
||||
gtk/gtkcolorsel.c
|
||||
gtk/gtkcolorseldialog.c
|
||||
gtk/gtkcombobox.c
|
||||
gtk/gtkcomboboxentry.c
|
||||
gtk/gtkcontainer.c
|
||||
gtk/gtkcustompaperunixdialog.c
|
||||
gtk/gtkdialog.c
|
||||
|
2051
po-properties/es.po
2051
po-properties/es.po
File diff suppressed because it is too large
Load Diff
1016
po-properties/gl.po
1016
po-properties/gl.po
File diff suppressed because it is too large
Load Diff
4
po/ar.po
4
po/ar.po
@ -2107,7 +2107,6 @@ msgid "_Cancel"
|
||||
msgstr "أل_غِ"
|
||||
|
||||
#: gtk/gtkstock.c:326
|
||||
#, fuzzy
|
||||
msgctxt "Stock label"
|
||||
msgid "_CD-ROM"
|
||||
msgstr "ا_سطوانة"
|
||||
@ -2246,7 +2245,6 @@ msgid "_Up"
|
||||
msgstr "ف_وق"
|
||||
|
||||
#: gtk/gtkstock.c:360
|
||||
#, fuzzy
|
||||
msgctxt "Stock label"
|
||||
msgid "_Hard Disk"
|
||||
msgstr "قرص _صلب"
|
||||
@ -3898,7 +3896,7 @@ msgid "Printer '%s' is out of paper."
|
||||
msgstr "نفذ الورق من الطابعة '%s'."
|
||||
|
||||
#: modules/printbackends/cups/gtkprintbackendcups.c:1686
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
msgid "Printer '%s' is currently offline."
|
||||
msgstr "الطابعة '%s' غير متصلة حاليا."
|
||||
|
||||
|
@ -93,7 +93,8 @@ noinst_PROGRAMS = $(TEST_PROGS) \
|
||||
testtooltips \
|
||||
testexpand \
|
||||
testexpander \
|
||||
testvolumebutton
|
||||
testvolumebutton \
|
||||
testscrolledwindow
|
||||
|
||||
if USE_X11
|
||||
noinst_PROGRAMS += testerrors
|
||||
@ -177,6 +178,7 @@ testactions_DEPENDENCIES = $(TEST_DEPS)
|
||||
testgrouping_DEPENDENCIES = $(TEST_DEPS)
|
||||
testtooltips_DEPENDENCIES = $(TEST_DEPS)
|
||||
testvolumebutton_DEPENDENCIES = $(TEST_DEPS)
|
||||
testscrolledwindow_DEPENDENCIES = $(TEST_DEPS)
|
||||
testwindows_DEPENDENCIES = $(TEST_DEPS)
|
||||
testexpand_DEPENDENCIES = $(TEST_DEPS)
|
||||
testexpander_DEPENDENCIES = $(TEST_DEPS)
|
||||
@ -249,6 +251,7 @@ testactions_LDADD = $(LDADDS)
|
||||
testgrouping_LDADD = $(LDADDS)
|
||||
testtooltips_LDADD = $(LDADDS)
|
||||
testvolumebutton_LDADD = $(LDADDS)
|
||||
testscrolledwindow_LDADD = $(LDADDS)
|
||||
testwindows_LDADD = $(LDADDS)
|
||||
testexpand_LDADD = $(LDADDS)
|
||||
testexpander_LDADD = $(LDADDS)
|
||||
@ -355,6 +358,9 @@ testrecentchoosermenu_SOURCES = \
|
||||
testvolumebutton_SOURCES = \
|
||||
testvolumebutton.c
|
||||
|
||||
testscrolledwindow_SOURCES = \
|
||||
testscrolledwindow.c
|
||||
|
||||
testoffscreen_SOURCES = \
|
||||
gtkoffscreenbox.c \
|
||||
gtkoffscreenbox.h \
|
||||
|
@ -158,9 +158,17 @@ calendar_day_selected_double_click (GtkWidget *widget,
|
||||
CalendarData *data)
|
||||
{
|
||||
char buffer[256] = "day_selected_double_click: ";
|
||||
guint day;
|
||||
|
||||
calendar_date_to_string (data, buffer+27, 256-27);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
gtk_calendar_get_date (GTK_CALENDAR (data->window),
|
||||
NULL, NULL, &day);
|
||||
|
||||
if (gtk_calendar_get_day_is_marked (GTK_CALENDAR (data->window), day))
|
||||
gtk_calendar_unmark_day (GTK_CALENDAR (data->window), day);
|
||||
else
|
||||
gtk_calendar_mark_day (GTK_CALENDAR (data->window), day);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -664,6 +672,9 @@ int main(int argc,
|
||||
{
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
if (g_getenv ("GTK_RTL"))
|
||||
gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
|
||||
|
||||
create_calendar();
|
||||
|
||||
gtk_main();
|
||||
|
165
tests/testscrolledwindow.c
Normal file
165
tests/testscrolledwindow.c
Normal file
@ -0,0 +1,165 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
static void
|
||||
horizontal_policy_changed (GtkComboBox *combo_box,
|
||||
GtkViewport *viewport)
|
||||
{
|
||||
GtkScrollablePolicy policy = gtk_combo_box_get_active (combo_box);
|
||||
|
||||
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (viewport), policy);
|
||||
}
|
||||
|
||||
static void
|
||||
vertical_policy_changed (GtkComboBox *combo_box,
|
||||
GtkViewport *viewport)
|
||||
{
|
||||
GtkScrollablePolicy policy = gtk_combo_box_get_active (combo_box);
|
||||
|
||||
gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (viewport), policy);
|
||||
}
|
||||
|
||||
static void
|
||||
label_flip_changed (GtkComboBox *combo_box,
|
||||
GtkLabel *label)
|
||||
{
|
||||
gint active = gtk_combo_box_get_active (combo_box);
|
||||
|
||||
if (active == 0)
|
||||
gtk_label_set_angle (label, 0.0);
|
||||
else
|
||||
gtk_label_set_angle (label, 90.0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
scrollable_policy (void)
|
||||
{
|
||||
GtkWidget *window, *swindow, *hbox, *vbox, *frame, *cntl;
|
||||
GtkWidget *viewport, *label, *expander, *widget;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
vbox = gtk_vbox_new (FALSE, 6);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (hbox);
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
|
||||
|
||||
frame = gtk_frame_new ("Scrolled Window");
|
||||
gtk_widget_show (frame);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
swindow = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_widget_show (swindow);
|
||||
gtk_container_add (GTK_CONTAINER (frame), swindow);
|
||||
|
||||
viewport = gtk_viewport_new (NULL, NULL);
|
||||
label = gtk_label_new ("Here is a wrapping label with a minimum width-chars of 40 and "
|
||||
"a natural max-width-chars of 100 to demonstrate the usage of "
|
||||
"scrollable widgets \"hscroll-policy\" and \"vscroll-policy\" "
|
||||
"properties. Note also that when playing with the window height, "
|
||||
"one can observe that the vscrollbar disappears as soon as there "
|
||||
"is enough height to fit the content vertically if the window were "
|
||||
"to be allocated a width without a vscrollbar present");
|
||||
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
gtk_label_set_width_chars (GTK_LABEL (label), 40);
|
||||
gtk_label_set_max_width_chars (GTK_LABEL (label), 100);
|
||||
|
||||
gtk_widget_show (label);
|
||||
gtk_widget_show (viewport);
|
||||
gtk_container_add (GTK_CONTAINER (viewport), label);
|
||||
gtk_container_add (GTK_CONTAINER (swindow), viewport);
|
||||
|
||||
/* Add controls here */
|
||||
expander = gtk_expander_new ("Controls");
|
||||
gtk_expander_set_expanded (GTK_EXPANDER (expander), TRUE);
|
||||
cntl = gtk_vbox_new (FALSE, 2);
|
||||
gtk_widget_show (cntl);
|
||||
gtk_widget_show (expander);
|
||||
gtk_container_add (GTK_CONTAINER (expander), cntl);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 0);
|
||||
|
||||
/* Add Horizontal policy control here */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
widget = gtk_label_new ("hscroll-policy");
|
||||
gtk_widget_show (widget);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
|
||||
|
||||
widget = gtk_combo_box_text_new ();
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Minimum");
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Natural");
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (cntl), hbox, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect (G_OBJECT (widget), "changed",
|
||||
G_CALLBACK (horizontal_policy_changed), viewport);
|
||||
|
||||
/* Add Vertical policy control here */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
widget = gtk_label_new ("vscroll-policy");
|
||||
gtk_widget_show (widget);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
|
||||
|
||||
widget = gtk_combo_box_text_new ();
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Minimum");
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Natural");
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (cntl), hbox, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect (G_OBJECT (widget), "changed",
|
||||
G_CALLBACK (vertical_policy_changed), viewport);
|
||||
|
||||
|
||||
/* Add Label orientation control here */
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
widget = gtk_label_new ("label-flip");
|
||||
gtk_widget_show (widget);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
|
||||
|
||||
widget = gtk_combo_box_text_new ();
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Horizontal");
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Vertical");
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (cntl), hbox, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect (G_OBJECT (widget), "changed",
|
||||
G_CALLBACK (label_flip_changed), label);
|
||||
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
gtk_init (NULL, NULL);
|
||||
|
||||
scrollable_policy ();
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user