From 2485ba3936c9fdd4e185393d49c34dae7ba1f49d Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 13 Jan 2011 10:54:58 -0500 Subject: Fudge gtk_widget_get_preferred_size() for gtk2. Easy enough to fake gtk_widget_get_preferred_size() in gtk2 using gtk_widget_size_request(). Reduces diff noise with gtk3 branch. --- widgets/misc/e-attachment-button.c | 5 ++++- widgets/misc/e-cell-renderer-combo.c | 5 ++++- widgets/misc/e-combo-cell-editable.c | 2 +- widgets/misc/e-dateedit.c | 8 ++++---- 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'widgets/misc') diff --git a/widgets/misc/e-attachment-button.c b/widgets/misc/e-attachment-button.c index 77bab884c9..19af142ac7 100644 --- a/widgets/misc/e-attachment-button.c +++ b/widgets/misc/e-attachment-button.c @@ -23,6 +23,9 @@ #include "e-attachment-button.h" +/* backward-compatibility cruft */ +#include "e-util/gtk-compat.h" + #define E_ATTACHMENT_BUTTON_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ ((obj), E_TYPE_ATTACHMENT_BUTTON, EAttachmentButtonPrivate)) @@ -93,7 +96,7 @@ attachment_button_menu_position (GtkMenu *menu, widget = GTK_WIDGET (button); toggle_button = button->priv->toggle_button; - gtk_widget_size_request (GTK_WIDGET (menu), &menu_requisition); + gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_requisition, NULL); window = gtk_widget_get_parent_window (widget); screen = gtk_widget_get_screen (GTK_WIDGET (menu)); diff --git a/widgets/misc/e-cell-renderer-combo.c b/widgets/misc/e-cell-renderer-combo.c index a2b65b27be..03156f1801 100644 --- a/widgets/misc/e-cell-renderer-combo.c +++ b/widgets/misc/e-cell-renderer-combo.c @@ -27,6 +27,9 @@ #include "e-combo-cell-editable.h" #include "e-cell-renderer-combo.h" +/* backward-compatibility cruft */ +#include "e-util/gtk-compat.h" + enum { PROP_0, PROP_LIST @@ -102,7 +105,7 @@ ecrc_get_size (GtkCellRenderer *cell, GtkWidget *widget, GdkRectangle *cell_area btn = gtk_button_new (); gtk_container_add (GTK_CONTAINER (btn), gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE)); - gtk_widget_size_request (btn, &req); + gtk_widget_get_preferred_size (btn, &req, NULL); *width += req.width; gtk_widget_destroy (btn); } diff --git a/widgets/misc/e-combo-cell-editable.c b/widgets/misc/e-combo-cell-editable.c index aa514630ee..613fc7b2f6 100644 --- a/widgets/misc/e-combo-cell-editable.c +++ b/widgets/misc/e-combo-cell-editable.c @@ -215,7 +215,7 @@ position_popup (EComboCellEditable *ecce, gint x, gint y, gint offset) GtkRequisition req; gtk_widget_realize (ecce->priv->popup); - gtk_widget_size_request (ecce->priv->popup, &req); + gtk_widget_get_preferred_size (ecce->priv->popup, &req, NULL); if (req.height > gdk_screen_height () - y) { y -= (offset + req.height); diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c index d0b9b7ea8f..098825a321 100644 --- a/widgets/misc/e-dateedit.c +++ b/widgets/misc/e-dateedit.c @@ -1411,12 +1411,12 @@ position_date_popup (EDateEdit *dedit) GtkRequisition cal_req, button_req; gint screen_width, screen_height; - gtk_widget_size_request (dedit->priv->cal_popup, &cal_req); + gtk_widget_get_preferred_size (dedit->priv->cal_popup, &cal_req, NULL); - gtk_widget_size_request (dedit->priv->date_button, &button_req); + gtk_widget_get_preferred_size (dedit->priv->date_button, &button_req, NULL); bwidth = button_req.width; - gtk_widget_size_request ( - gtk_widget_get_parent (dedit->priv->date_button), &button_req); + gtk_widget_get_preferred_size ( + gtk_widget_get_parent (dedit->priv->date_button), &button_req, NULL); bheight = button_req.height; gtk_widget_translate_coordinates ( -- cgit v1.2.3