[gtk+/scrollable] Added gtk_scrollable_set/get_min_display_width/height().
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/scrollable] Added gtk_scrollable_set/get_min_display_width/height().
- Date: Tue, 19 Oct 2010 06:48:59 +0000 (UTC)
commit d850ee01254273abe32117edc6e888426a2c356b
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Tue Oct 19 15:33:47 2010 +0900
Added gtk_scrollable_set/get_min_display_width/height().
Added properties and accessors for "min-display-width" and "min-display-height",
added them as properties as they should be useful in GtkBuilder setups,
made all scrollable classes support them and made GtkScrolledWindow consult
the values. Update gtk/tests/treeview-scrolling.c which still doesnt pass.
gtk/gtkiconview.c | 24 +++++++-
gtk/gtklayout.c | 25 ++++++++
gtk/gtkscrollable.c | 122 ++++++++++++++++++++++++++++++++++++++++
gtk/gtkscrollable.h | 20 ++++--
gtk/gtkscrolledwindow.c | 44 +++++++++++----
gtk/gtktextview.c | 27 +++++++++-
gtk/gtktoolpalette.c | 26 ++++++++-
gtk/gtktreeprivate.h | 2 +
gtk/gtktreeview.c | 21 +++++++-
gtk/gtkviewport.c | 24 ++++++++
gtk/tests/treeview-scrolling.c | 3 +-
11 files changed, 314 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 962b78b..8a99c72 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -130,6 +130,8 @@ struct _GtkIconViewPrivate
GtkAdjustment *hadjustment;
GtkAdjustment *vadjustment;
+ gint min_display_width;
+ gint min_display_height;
guint layout_idle_id;
@@ -238,7 +240,9 @@ enum
/* For scrollable interface */
PROP_HADJUSTMENT,
- PROP_VADJUSTMENT
+ PROP_VADJUSTMENT,
+ PROP_MIN_DISPLAY_WIDTH,
+ PROP_MIN_DISPLAY_HEIGHT
};
/* GObject vfuncs */
@@ -791,7 +795,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_MIN_DISPLAY_WIDTH, "min-display-width");
+ g_object_class_override_property (gobject_class, PROP_MIN_DISPLAY_HEIGHT, "min-display-height");
/* Style properties */
@@ -1123,6 +1128,9 @@ gtk_icon_view_init (GtkIconView *icon_view)
icon_view->priv->margin = 6;
icon_view->priv->item_padding = 6;
+ icon_view->priv->min_display_width = -1;
+ icon_view->priv->min_display_height = -1;
+
icon_view->priv->draw_focus = TRUE;
}
@@ -1202,6 +1210,12 @@ 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_MIN_DISPLAY_WIDTH:
+ icon_view->priv->min_display_width = g_value_get_int (value);
+ break;
+ case PROP_MIN_DISPLAY_HEIGHT:
+ icon_view->priv->min_display_height = g_value_get_int (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1274,6 +1288,12 @@ gtk_icon_view_get_property (GObject *object,
case PROP_VADJUSTMENT:
g_value_set_object (value, icon_view->priv->vadjustment);
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ g_value_set_int (value, icon_view->priv->min_display_width);
+ break;
+ case PROP_MIN_DISPLAY_HEIGHT:
+ g_value_set_int (value, icon_view->priv->min_display_height);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c
index 36a6ab1..1a4a536 100644
--- a/gtk/gtklayout.c
+++ b/gtk/gtklayout.c
@@ -52,6 +52,9 @@ struct _GtkLayoutPrivate
GtkAdjustment *hadjustment;
GtkAdjustment *vadjustment;
+ gint min_display_width;
+ gint min_display_height;
+
/* Properties */
GdkVisibilityState visibility;
@@ -75,6 +78,8 @@ enum {
PROP_0,
PROP_HADJUSTMENT,
PROP_VADJUSTMENT,
+ PROP_MIN_DISPLAY_WIDTH,
+ PROP_MIN_DISPLAY_HEIGHT,
PROP_WIDTH,
PROP_HEIGHT
};
@@ -623,6 +628,12 @@ gtk_layout_class_init (GtkLayoutClass *class)
g_object_class_override_property (gobject_class,
PROP_VADJUSTMENT,
"vadjustment");
+ g_object_class_override_property (gobject_class,
+ PROP_MIN_DISPLAY_WIDTH,
+ "min-display-width");
+ g_object_class_override_property (gobject_class,
+ PROP_MIN_DISPLAY_HEIGHT,
+ "min-display-height");
g_object_class_install_property (gobject_class,
PROP_WIDTH,
@@ -674,6 +685,12 @@ gtk_layout_get_property (GObject *object,
case PROP_VADJUSTMENT:
g_value_set_object (value, priv->vadjustment);
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ g_value_set_int (value, priv->min_display_width);
+ break;
+ case PROP_MIN_DISPLAY_HEIGHT:
+ g_value_set_int (value, priv->min_display_height);
+ break;
case PROP_WIDTH:
g_value_set_uint (value, priv->width);
break;
@@ -705,6 +722,12 @@ gtk_layout_set_property (GObject *object,
gtk_layout_set_vadjustment (layout,
(GtkAdjustment*) g_value_get_object (value));
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ priv->min_display_width = g_value_get_int (value);
+ break;
+ case PROP_MIN_DISPLAY_HEIGHT:
+ priv->min_display_height = g_value_get_int (value);
+ break;
case PROP_WIDTH:
gtk_layout_set_size (layout, g_value_get_uint (value),
priv->height);
@@ -788,6 +811,8 @@ gtk_layout_init (GtkLayout *layout)
priv->hadjustment = NULL;
priv->vadjustment = NULL;
+ priv->min_display_width = -1;
+ priv->min_display_height = -1;
priv->bin_window = NULL;
diff --git a/gtk/gtkscrollable.c b/gtk/gtkscrollable.c
index 0017c33..3fbca8e 100644
--- a/gtk/gtkscrollable.c
+++ b/gtk/gtkscrollable.c
@@ -108,6 +108,41 @@ gtk_scrollable_default_init (GtkScrollableInterface *iface)
GTK_TYPE_ADJUSTMENT,
GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_interface_install_property (iface, pspec);
+
+
+ /**
+ * GtkScrollable:min-display-width:
+ *
+ * Minimum width to display in the parent scrolled window, this
+ * can be greater or less than the scrollable widget's real minimum
+ * width.
+ *
+ * Since: 3.0
+ */
+ pspec = g_param_spec_int ("min-display-width",
+ P_("Minimum Display Width"),
+ P_("Minimum width to display in the parent scrolled window"),
+ -1, G_MAXINT, -1,
+ GTK_PARAM_READWRITE);
+ g_object_interface_install_property (iface, pspec);
+
+
+ /**
+ * GtkScrollable:min-display-height:
+ *
+ * Minimum height to display in the parent scrolled window, this
+ * can be greater or less than the scrollable widget's real minimum
+ * height.
+ *
+ * Since: 3.0
+ */
+ pspec = g_param_spec_int ("min-display-height",
+ P_("Minimum Display Height"),
+ P_("Minimum height to display in the parent scrolled window"),
+ -1, G_MAXINT, -1,
+ GTK_PARAM_READWRITE);
+ g_object_interface_install_property (iface, pspec);
+
}
/**
@@ -205,3 +240,90 @@ gtk_scrollable_set_vadjustment (GtkScrollable *scrollable,
g_object_set (scrollable, "vadjustment", vadjustment, NULL);
}
+
+
+/**
+ * gtk_scrollable_get_min_display_width:
+ * @scrollable: a #GtkScrollable
+ *
+ * Retrieves the minimum width of content to display in the
+ * parent scrolled window.
+ *
+ * Return value: The minimum display width.
+ *
+ * Since: 3.0
+ **/
+gint
+gtk_scrollable_get_min_display_width (GtkScrollable *scrollable)
+{
+ gint width;
+
+ g_return_val_if_fail (GTK_IS_SCROLLABLE (scrollable), NULL);
+
+ g_object_get (scrollable, "min-display-width", &width, NULL);
+
+ return width;
+}
+
+/**
+ * gtk_scrollable_set_min_display_width:
+ * @scrollable: a #GtkScrollable
+ * @width: the minimum width of scrollable content to display
+ *
+ * Sets the minimum width of content to display in the parent scrolled window,
+ * this can be greater or less than the scrollable widget's real minimum
+ * width.
+ *
+ * Since: 3.0
+ **/
+void
+gtk_scrollable_set_min_display_width (GtkScrollable *scrollable,
+ gint width)
+{
+ g_return_if_fail (GTK_IS_SCROLLABLE (scrollable));
+
+ g_object_set (scrollable, "min-display-width", width, NULL);
+}
+
+/**
+ * gtk_scrollable_get_min_display_height:
+ * @scrollable: a #GtkScrollable
+ *
+ * Retrieves the minimum height of content to display in the
+ * parent scrolled window.
+ *
+ * Return value: The minimum display height.
+ *
+ * Since: 3.0
+ **/
+gint
+gtk_scrollable_get_min_display_height (GtkScrollable *scrollable)
+{
+ gint height;
+
+ g_return_val_if_fail (GTK_IS_SCROLLABLE (scrollable), NULL);
+
+ g_object_get (scrollable, "min-display-height", &height, NULL);
+
+ return height;
+}
+
+/**
+ * gtk_scrollable_set_min_display_height:
+ * @scrollable: a #GtkScrollable
+ * @height: the minimum height of scrollable content to display
+ *
+ * Sets the minimum height of content to display in the parent scrolled window,
+ * this can be greater or less than the scrollable widget's real minimum
+ * height.
+ *
+ * Since: 3.0
+ **/
+void
+gtk_scrollable_set_min_display_height (GtkScrollable *scrollable,
+ gint height)
+{
+ g_return_if_fail (GTK_IS_SCROLLABLE (scrollable));
+
+ g_object_set (scrollable, "min-display-height", height, NULL);
+}
diff --git a/gtk/gtkscrollable.h b/gtk/gtkscrollable.h
index 7b334a9..5be38d0 100644
--- a/gtk/gtkscrollable.h
+++ b/gtk/gtkscrollable.h
@@ -42,13 +42,19 @@ struct _GtkScrollableInterface
};
/* Public API */
-GType gtk_scrollable_get_type (void) G_GNUC_CONST;
-GtkAdjustment *gtk_scrollable_get_hadjustment (GtkScrollable *scrollable);
-void gtk_scrollable_set_hadjustment (GtkScrollable *scrollable,
- GtkAdjustment *hadjustment);
-GtkAdjustment *gtk_scrollable_get_vadjustment (GtkScrollable *scrollable);
-void gtk_scrollable_set_vadjustment (GtkScrollable *scrollable,
- GtkAdjustment *vadjustment);
+GType gtk_scrollable_get_type (void) G_GNUC_CONST;
+GtkAdjustment *gtk_scrollable_get_hadjustment (GtkScrollable *scrollable);
+void gtk_scrollable_set_hadjustment (GtkScrollable *scrollable,
+ GtkAdjustment *hadjustment);
+GtkAdjustment *gtk_scrollable_get_vadjustment (GtkScrollable *scrollable);
+void gtk_scrollable_set_vadjustment (GtkScrollable *scrollable,
+ GtkAdjustment *vadjustment);
+gint gtk_scrollable_get_min_display_width (GtkScrollable *scrollable);
+void gtk_scrollable_set_min_display_width (GtkScrollable *scrollable,
+ gint width);
+gint gtk_scrollable_get_min_display_height (GtkScrollable *scrollable);
+void gtk_scrollable_set_min_display_height (GtkScrollable *scrollable,
+ gint height);
G_END_DECLS
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 48b0d41..92cdc57 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -2034,9 +2034,20 @@ gtk_scrolled_window_get_preferred_size (GtkWidget *widget,
}
else
{
- /* Always ask for at least enough to fit the scrollbars */
- minimum_req.width += vscrollbar_requisition.width;
- natural_req.width += vscrollbar_requisition.width;
+ gint min_display_width =
+ gtk_scrollable_get_min_display_width (GTK_SCROLLABLE (child));
+
+ if (min_display_width > 0)
+ {
+ minimum_req.width += min_display_width;
+ natural_req.width += min_display_width;
+ extra_width = -1;
+ }
+ else
+ {
+ minimum_req.width += vscrollbar_requisition.width;
+ natural_req.width += vscrollbar_requisition.width;
+ }
}
}
else /* GTK_ORIENTATION_VERTICAL */
@@ -2052,9 +2063,20 @@ gtk_scrolled_window_get_preferred_size (GtkWidget *widget,
}
else
{
- /* Always ask for at least enough to fit the scrollbars */
- minimum_req.height += hscrollbar_requisition.height;
- natural_req.height += hscrollbar_requisition.height;
+ gint min_display_height =
+ gtk_scrollable_get_min_display_height (GTK_SCROLLABLE (child));
+
+ if (min_display_height > 0)
+ {
+ minimum_req.height += min_display_height;
+ natural_req.height += min_display_height;
+ extra_height = -1;
+ }
+ else
+ {
+ minimum_req.height += vscrollbar_requisition.height;
+ natural_req.height += vscrollbar_requisition.height;
+ }
}
}
}
@@ -2073,14 +2095,14 @@ gtk_scrolled_window_get_preferred_size (GtkWidget *widget,
{
minimum_req.height = MAX (minimum_req.height, vscrollbar_requisition.height);
natural_req.height = MAX (natural_req.height, vscrollbar_requisition.height);
- if (!extra_height || priv->vscrollbar_policy == GTK_POLICY_ALWAYS)
+ if (!extra_width || priv->vscrollbar_policy == GTK_POLICY_ALWAYS)
extra_width = scrollbar_spacing + vscrollbar_requisition.width;
}
- minimum_req.width += extra_width;
- minimum_req.height += extra_height;
- natural_req.width += extra_width;
- natural_req.height += extra_height;
+ minimum_req.width += MAX (0, extra_width);
+ minimum_req.height += MAX (0, extra_height);
+ natural_req.width += MAX (0, extra_width);
+ natural_req.height += MAX (0, extra_height);
if (priv->shadow_type != GTK_SHADOW_NONE)
{
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index fb2391a..699abf5 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -128,6 +128,8 @@ struct _GtkTextViewPrivate
GtkAdjustment *hadjustment;
GtkAdjustment *vadjustment;
+ gint min_display_width;
+ gint min_display_height;
gint xoffset; /* Offsets between widget coordinates and buffer coordinates */
gint yoffset;
@@ -259,7 +261,9 @@ enum
PROP_ACCEPTS_TAB,
PROP_IM_MODULE,
PROP_HADJUSTMENT,
- PROP_VADJUSTMENT
+ PROP_VADJUSTMENT,
+ PROP_MIN_DISPLAY_WIDTH,
+ PROP_MIN_DISPLAY_HEIGHT
};
static void gtk_text_view_finalize (GObject *object);
@@ -784,6 +788,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_MIN_DISPLAY_WIDTH, "min-display-width");
+ g_object_class_override_property (gobject_class, PROP_MIN_DISPLAY_HEIGHT, "min-display-height");
/*
* Style properties
@@ -1399,6 +1405,9 @@ gtk_text_view_init (GtkTextView *text_view)
priv->pending_place_cursor_button = 0;
+ priv->min_display_width = -1;
+ priv->min_display_height = -1;
+
/* We handle all our own redrawing */
gtk_widget_set_redraw_on_allocate (widget, FALSE);
}
@@ -3103,6 +3112,14 @@ gtk_text_view_set_property (GObject *object,
gtk_text_view_set_vadjustment (text_view, g_value_get_object (value));
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ priv->min_display_width = g_value_get_int (value);
+ break;
+
+ case PROP_MIN_DISPLAY_HEIGHT:
+ priv->min_display_height = g_value_get_int (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -3191,6 +3208,14 @@ gtk_text_view_get_property (GObject *object,
g_value_set_object (value, priv->vadjustment);
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ g_value_set_int (value, priv->min_display_width);
+ break;
+
+ case PROP_MIN_DISPLAY_HEIGHT:
+ g_value_set_int (value, priv->min_display_height);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index cbc77c6..0359fcf 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -122,7 +122,9 @@ enum
PROP_ORIENTATION,
PROP_TOOLBAR_STYLE,
PROP_HADJUSTMENT,
- PROP_VADJUSTMENT
+ PROP_VADJUSTMENT,
+ PROP_MIN_DISPLAY_WIDTH,
+ PROP_MIN_DISPLAY_HEIGHT
};
enum
@@ -148,6 +150,8 @@ struct _GtkToolPalettePrivate
GtkAdjustment *hadjustment;
GtkAdjustment *vadjustment;
+ gint min_display_width;
+ gint min_display_height;
GtkIconSize icon_size;
gboolean icon_size_set;
@@ -207,6 +211,8 @@ gtk_tool_palette_init (GtkToolPalette *palette)
palette->priv->orientation = DEFAULT_ORIENTATION;
palette->priv->style = DEFAULT_TOOLBAR_STYLE;
palette->priv->style_set = FALSE;
+ palette->priv->min_display_width = -1;
+ palette->priv->min_display_height = -1;
palette->priv->text_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
}
@@ -276,6 +282,14 @@ gtk_tool_palette_set_property (GObject *object,
gtk_tool_palette_set_vadjustment (palette, g_value_get_object (value));
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ palette->priv->min_display_width = g_value_get_int (value);
+ break;
+
+ case PROP_MIN_DISPLAY_HEIGHT:
+ palette->priv->min_display_height = g_value_get_int (value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -316,6 +330,14 @@ gtk_tool_palette_get_property (GObject *object,
g_value_set_object (value, palette->priv->vadjustment);
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ g_value_set_int (value, palette->priv->min_display_width);
+ break;
+
+ case PROP_MIN_DISPLAY_HEIGHT:
+ g_value_set_int (value, palette->priv->min_display_height);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1000,6 +1022,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_MIN_DISPLAY_WIDTH, "min-display-width");
+ g_object_class_override_property (oclass, PROP_MIN_DISPLAY_HEIGHT, "min-display-height");
/**
* GtkToolPalette:icon-size:
diff --git a/gtk/gtktreeprivate.h b/gtk/gtktreeprivate.h
index 8b18e7f..0519db7 100644
--- a/gtk/gtktreeprivate.h
+++ b/gtk/gtktreeprivate.h
@@ -102,6 +102,8 @@ struct _GtkTreeViewPrivate
/* Adjustments */
GtkAdjustment *hadjustment;
GtkAdjustment *vadjustment;
+ gint min_display_width;
+ gint min_display_height;
/* Sub windows */
GdkWindow *bin_window;
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 36f6280..8a3342c 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -145,7 +145,9 @@ enum {
PROP_RUBBER_BANDING,
PROP_ENABLE_GRID_LINES,
PROP_ENABLE_TREE_LINES,
- PROP_TOOLTIP_COLUMN
+ PROP_TOOLTIP_COLUMN,
+ PROP_MIN_DISPLAY_WIDTH,
+ PROP_MIN_DISPLAY_HEIGHT
};
/* object signals */
@@ -569,6 +571,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_MIN_DISPLAY_WIDTH, "min-display-width");
+ g_object_class_override_property (o_class, PROP_MIN_DISPLAY_HEIGHT, "min-display-height");
g_object_class_install_property (o_class,
PROP_HEADERS_VISIBLE,
@@ -1334,6 +1338,9 @@ gtk_tree_view_init (GtkTreeView *tree_view)
tree_view->priv->event_last_x = -10000;
tree_view->priv->event_last_y = -10000;
+
+ tree_view->priv->min_display_width = -1;
+ tree_view->priv->min_display_height = -1;
}
@@ -1410,6 +1417,12 @@ gtk_tree_view_set_property (GObject *object,
case PROP_TOOLTIP_COLUMN:
gtk_tree_view_set_tooltip_column (tree_view, g_value_get_int (value));
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ tree_view->priv->min_display_width = g_value_get_int (value);
+ break;
+ case PROP_MIN_DISPLAY_HEIGHT:
+ tree_view->priv->min_display_height = g_value_get_int (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1485,6 +1498,12 @@ gtk_tree_view_get_property (GObject *object,
case PROP_TOOLTIP_COLUMN:
g_value_set_int (value, tree_view->priv->tooltip_column);
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ g_value_set_int (value, tree_view->priv->min_display_width);
+ break;
+ case PROP_MIN_DISPLAY_HEIGHT:
+ g_value_set_int (value, tree_view->priv->min_display_height);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 4c14a96..1362df7 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -59,6 +59,8 @@ struct _GtkViewportPrivate
{
GtkAdjustment *hadjustment;
GtkAdjustment *vadjustment;
+ gint min_display_width;
+ gint min_display_height;
GtkShadowType shadow_type;
GdkWindow *bin_window;
@@ -69,6 +71,8 @@ enum {
PROP_0,
PROP_HADJUSTMENT,
PROP_VADJUSTMENT,
+ PROP_MIN_DISPLAY_WIDTH,
+ PROP_MIN_DISPLAY_HEIGHT,
PROP_SHADOW_TYPE
};
@@ -140,6 +144,12 @@ gtk_viewport_class_init (GtkViewportClass *class)
g_object_class_override_property (gobject_class,
PROP_VADJUSTMENT,
"vadjustment");
+ g_object_class_override_property (gobject_class,
+ PROP_MIN_DISPLAY_WIDTH,
+ "min-display-width");
+ g_object_class_override_property (gobject_class,
+ PROP_MIN_DISPLAY_HEIGHT,
+ "min-display-height");
g_object_class_install_property (gobject_class,
PROP_SHADOW_TYPE,
@@ -171,6 +181,12 @@ gtk_viewport_set_property (GObject *object,
case PROP_VADJUSTMENT:
gtk_viewport_set_vadjustment (viewport, g_value_get_object (value));
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ viewport->priv->min_display_width = g_value_get_int (value);
+ break;
+ case PROP_MIN_DISPLAY_HEIGHT:
+ viewport->priv->min_display_height = g_value_get_int (value);
+ break;
case PROP_SHADOW_TYPE:
gtk_viewport_set_shadow_type (viewport, g_value_get_enum (value));
break;
@@ -197,6 +213,12 @@ gtk_viewport_get_property (GObject *object,
case PROP_VADJUSTMENT:
g_value_set_object (value, priv->vadjustment);
break;
+ case PROP_MIN_DISPLAY_WIDTH:
+ g_value_set_int (value, priv->min_display_width);
+ break;
+ case PROP_MIN_DISPLAY_HEIGHT:
+ g_value_set_int (value, priv->min_display_height);
+ break;
case PROP_SHADOW_TYPE:
g_value_set_enum (value, priv->shadow_type);
break;
@@ -226,6 +248,8 @@ gtk_viewport_init (GtkViewport *viewport)
priv->bin_window = NULL;
priv->hadjustment = NULL;
priv->vadjustment = NULL;
+ priv->min_display_width = -1;
+ priv->min_display_height = -1;
}
/**
diff --git a/gtk/tests/treeview-scrolling.c b/gtk/tests/treeview-scrolling.c
index ade2228..e6d11ac 100644
--- a/gtk/tests/treeview-scrolling.c
+++ b/gtk/tests/treeview-scrolling.c
@@ -125,7 +125,8 @@ scroll_fixture_setup (ScrollFixture *fixture,
fixture->tree_view = gtk_tree_view_new_with_model (model);
g_object_unref (model);
- gtk_widget_set_size_request (fixture->tree_view, VIEW_WIDTH, VIEW_HEIGHT);
+ gtk_scrollable_set_min_display_width (fixture->tree_view, VIEW_WIDTH);
+ gtk_scrollable_set_min_display_height (fixture->tree_view, VIEW_HEIGHT);
renderer = gtk_cell_renderer_text_new ();
g_object_set (renderer, "editable", TRUE, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]