summaryrefslogtreecommitdiff
path: root/libgnome-control-center
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-11-08 14:07:47 +0100
committerRodrigo Moya <rodrigo@gnome-db.org>2010-11-08 14:07:47 +0100
commitf5f5aac5c065e5be0d5c080ffa1c075423c4cef7 (patch)
treef6874d8507df538608148c6f0a6a0e67050e9516 /libgnome-control-center
parent55a02383f2790f432db8bcd00e2dd630db75d3b9 (diff)
Prepare for size_request removal in GTK3
https://bugzilla.gnome.org/show_bug.cgi?id=633321
Diffstat (limited to 'libgnome-control-center')
-rw-r--r--libgnome-control-center/cc-panel.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/libgnome-control-center/cc-panel.c b/libgnome-control-center/cc-panel.c
index dd9b8cd78..9cb5da500 100644
--- a/libgnome-control-center/cc-panel.c
+++ b/libgnome-control-center/cc-panel.c
@@ -124,26 +124,31 @@ cc_panel_finalize (GObject *object)
}
static void
-cc_panel_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+cc_panel_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
GtkBin *bin = GTK_BIN (widget);
GtkWidget *child;
- guint border_width;
+
+ *minimum = *natural = 0;
if ((child = gtk_bin_get_child (bin)))
- {
- GtkRequisition child_requisition;
+ gtk_widget_get_preferred_width (child, minimum, natural);
+}
- gtk_widget_size_request (child, &child_requisition);
+static void
+cc_panel_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkBin *bin = GTK_BIN (widget);
+ GtkWidget *child;
- requisition->width = child_requisition.width;
- requisition->height = child_requisition.height;
- }
+ *minimum = *natural = 0;
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- requisition->width += 2 * border_width;
- requisition->height += 2 * border_width;
+ if ((child = gtk_bin_get_child (bin)))
+ gtk_widget_get_preferred_height (child, minimum, natural);
}
static void
@@ -151,18 +156,11 @@ cc_panel_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkAllocation child_allocation;
- guint border_width;
gtk_widget_set_allocation (widget, allocation);
-
child_allocation = *allocation;
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- child_allocation.width -= 2 * border_width;
- child_allocation.height -= 2 * border_width;
-
gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)),
&child_allocation);
}
@@ -178,9 +176,12 @@ cc_panel_class_init (CcPanelClass *klass)
object_class->set_property = cc_panel_set_property;
object_class->finalize = cc_panel_finalize;
- widget_class->size_request = cc_panel_size_request;
+ widget_class->get_preferred_width = cc_panel_get_preferred_width;
+ widget_class->get_preferred_height = cc_panel_get_preferred_height;
widget_class->size_allocate = cc_panel_size_allocate;
+ gtk_container_class_handle_border_width (GTK_CONTAINER_CLASS (klass));
+
g_type_class_add_private (klass, sizeof (CcPanelPrivate));
pspec = g_param_spec_object ("shell",