[gtk+/treeview-refactor] Remove size_request from GtkTable
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/treeview-refactor] Remove size_request from GtkTable
- Date: Sat, 30 Oct 2010 08:33:31 +0000 (UTC)
commit f3d5e20cff2ce5b225955f98691d5194f463c70b
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 27 09:32:42 2010 -0400
Remove size_request from GtkTable
gtk/gtktable.c | 50 ++++++++++++++++++++++++++++++++++++++------------
1 files changed, 38 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index 80cf51a..47e94e8 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -74,8 +74,12 @@ enum
static void gtk_table_finalize (GObject *object);
-static void gtk_table_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
+static void gtk_table_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
+static void gtk_table_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural);
static void gtk_table_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_table_compute_expand (GtkWidget *widget,
@@ -134,7 +138,8 @@ gtk_table_class_init (GtkTableClass *class)
gobject_class->get_property = gtk_table_get_property;
gobject_class->set_property = gtk_table_set_property;
- widget_class->size_request = gtk_table_size_request;
+ widget_class->get_preferred_width = gtk_table_get_preferred_width;
+ widget_class->get_preferred_height = gtk_table_get_preferred_height;
widget_class->size_allocate = gtk_table_size_allocate;
widget_class->compute_expand = gtk_table_compute_expand;
@@ -969,31 +974,52 @@ gtk_table_finalize (GObject *object)
}
static void
-gtk_table_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+gtk_table_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
GtkTable *table = GTK_TABLE (widget);
GtkTablePrivate *priv = table->priv;
gint row, col;
- requisition->width = 0;
- requisition->height = 0;
-
gtk_table_size_request_init (table);
gtk_table_size_request_pass1 (table);
gtk_table_size_request_pass2 (table);
gtk_table_size_request_pass3 (table);
gtk_table_size_request_pass2 (table);
+ *minimum = 0;
+
for (col = 0; col < priv->ncols; col++)
- requisition->width += priv->cols[col].requisition;
+ *minimum += priv->cols[col].requisition;
for (col = 0; col + 1 < priv->ncols; col++)
- requisition->width += priv->cols[col].spacing;
+ *minimum += priv->cols[col].spacing;
+ *natural = *minimum;
+}
+
+static void
+gtk_table_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkTable *table = GTK_TABLE (widget);
+ GtkTablePrivate *priv = table->priv;
+ gint row, col;
+
+ gtk_table_size_request_init (table);
+ gtk_table_size_request_pass1 (table);
+ gtk_table_size_request_pass2 (table);
+ gtk_table_size_request_pass3 (table);
+ gtk_table_size_request_pass2 (table);
+
+ *minimum = 0;
for (row = 0; row < priv->nrows; row++)
- requisition->height += priv->rows[row].requisition;
+ *minimum += priv->rows[row].requisition;
for (row = 0; row + 1 < priv->nrows; row++)
- requisition->height += priv->rows[row].spacing;
+ *minimum += priv->rows[row].spacing;
+
+ *natural = *minimum;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]