aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-01-13 23:54:58 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-01-15 03:58:29 +0800
commit0af3ff804c0d71c76fd63f0a2a152cac7de64863 (patch)
treee80b7e357654f0dcc3cef08e1d2d459b9cf45d85
parent7087e222f8422470c44ce2ecd5c598fefd2315fc (diff)
downloadgsoc2013-evolution-0af3ff804c0d71c76fd63f0a2a152cac7de64863.tar
gsoc2013-evolution-0af3ff804c0d71c76fd63f0a2a152cac7de64863.tar.gz
gsoc2013-evolution-0af3ff804c0d71c76fd63f0a2a152cac7de64863.tar.bz2
gsoc2013-evolution-0af3ff804c0d71c76fd63f0a2a152cac7de64863.tar.lz
gsoc2013-evolution-0af3ff804c0d71c76fd63f0a2a152cac7de64863.tar.xz
gsoc2013-evolution-0af3ff804c0d71c76fd63f0a2a152cac7de64863.tar.zst
gsoc2013-evolution-0af3ff804c0d71c76fd63f0a2a152cac7de64863.zip
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.
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c4
-rw-r--r--calendar/gui/e-calendar-view.c2
-rw-r--r--calendar/gui/e-meeting-time-sel.c7
-rw-r--r--e-util/gtk-compat.h5
-rw-r--r--plugins/mark-all-read/mark-all-read.c5
-rw-r--r--shell/e-shell-content.c13
-rw-r--r--shell/e-shell-sidebar.c9
-rw-r--r--shell/e-shell-switcher.c9
-rw-r--r--widgets/misc/e-attachment-button.c5
-rw-r--r--widgets/misc/e-cell-renderer-combo.c5
-rw-r--r--widgets/misc/e-combo-cell-editable.c2
-rw-r--r--widgets/misc/e-dateedit.c8
-rw-r--r--widgets/table/e-cell-combo.c2
-rw-r--r--widgets/table/e-cell-date-edit.c2
14 files changed, 52 insertions, 26 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index d071e9bab6..4ca2dd624b 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -2706,8 +2706,8 @@ init_all (EContactEditor *editor)
/* with so many scrolled windows, we need to
do some manual sizing */
- gtk_widget_size_request (
- e_builder_get_widget (editor->builder, "vbox-size-leader"), &tab_req);
+ gtk_widget_get_preferred_size (
+ e_builder_get_widget (editor->builder, "vbox-size-leader"), &tab_req, NULL);
gtk_widget_set_size_request (
e_builder_get_widget (editor->builder, "scrolledwindow-size-leader"),
tab_req.width, tab_req.height + 8);
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 13ea437f2f..868b411a10 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -1740,7 +1740,7 @@ e_calendar_view_move_tip (GtkWidget *widget, gint x, gint y)
screen = gtk_widget_get_screen (widget);
- gtk_widget_size_request (widget, &requisition);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
w = requisition.width;
h = requisition.height;
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index 4b2ccfc67f..8b6f36da6b 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -46,6 +46,9 @@
#include "e-meeting-list-view.h"
#include "e-meeting-time-sel-item.h"
+/* backward-compatibility cruft */
+#include "e-util/gtk-compat.h"
+
#define E_MEETING_TIME_SELECTOR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_MEETING_TIME_SELECTOR, EMeetingTimeSelectorPrivate))
@@ -1741,7 +1744,7 @@ e_meeting_time_selector_options_menu_position_callback (GtkMenu *menu,
*y += allocation.y + allocation.height - 2;
/* Now make sure we are on the screen. */
- gtk_widget_size_request (mts->options_menu, &menu_requisition);
+ gtk_widget_get_preferred_size (mts->options_menu, &menu_requisition, NULL);
max_x = MAX (0, gdk_screen_width () - menu_requisition.width);
max_y = MAX (0, gdk_screen_height () - menu_requisition.height);
*x = CLAMP (*x, 0, max_x);
@@ -1794,7 +1797,7 @@ e_meeting_time_selector_autopick_menu_position_callback (GtkMenu *menu,
*y += allocation.y + allocation.height - 2;
/* Now make sure we are on the screen. */
- gtk_widget_size_request (mts->autopick_menu, &menu_requisition);
+ gtk_widget_get_preferred_size (mts->autopick_menu, &menu_requisition, NULL);
max_x = MAX (0, gdk_screen_width () - menu_requisition.width);
max_y = MAX (0, gdk_screen_height () - menu_requisition.height);
*x = CLAMP (*x, 0, max_x);
diff --git a/e-util/gtk-compat.h b/e-util/gtk-compat.h
index bbee3717cf..f67a9e2c8b 100644
--- a/e-util/gtk-compat.h
+++ b/e-util/gtk-compat.h
@@ -5,6 +5,11 @@
/* Provide a GTK+ compatibility layer. */
+#if !GTK_CHECK_VERSION (2,91,0) /* approximately */
+#define gtk_widget_get_preferred_size(widget, minimum_size, natural_size) \
+ (gtk_widget_size_request ((widget), ((minimum_size))))
+#endif
+
#if !GTK_CHECK_VERSION (2,23,0)
#define gtk_combo_box_text_new gtk_combo_box_new_text
#define gtk_combo_box_text_append_text gtk_combo_box_append_text
diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c
index 62b8102d9d..6e527d653c 100644
--- a/plugins/mark-all-read/mark-all-read.c
+++ b/plugins/mark-all-read/mark-all-read.c
@@ -38,6 +38,9 @@
#include <shell/e-shell-view.h>
#include <shell/e-shell-window.h>
+/* backward-compatibility cruft */
+#include "e-util/gtk-compat.h"
+
#define PRIMARY_TEXT \
N_("Also mark messages in subfolders?")
#define SECONDARY_TEXT \
@@ -79,7 +82,7 @@ box_mapped_cb (GtkWidget *box,
/* In order to get decent line wrapping we need to wait until the
* box containing the buttons is mapped, and then resize the label
* to the same width as the box. */
- gtk_widget_size_request (box, &requisition);
+ gtk_widget_get_preferred_size (box, &requisition, NULL);
gtk_widget_set_size_request (label, requisition.width, -1);
}
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 62cfdd4176..a97c095947 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -44,6 +44,9 @@
#include "e-shell-view.h"
#include "e-shell-window-actions.h"
+/* backward-compatibility cruft */
+#include "e-util/gtk-compat.h"
+
#define E_SHELL_CONTENT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_SHELL_CONTENT, EShellContentPrivate))
@@ -226,16 +229,16 @@ shell_content_size_request (GtkWidget *widget,
requisition->height = 0;
child = gtk_bin_get_child (GTK_BIN (widget));
- gtk_widget_size_request (child, requisition);
+ gtk_widget_get_preferred_size (child, requisition, NULL);
- gtk_widget_size_request (priv->alert_bar, &child_requisition);
+ gtk_widget_get_preferred_size (priv->alert_bar, &child_requisition, NULL);
requisition->width = MAX (requisition->width, child_requisition.width);
requisition->height += child_requisition.height;
if (priv->searchbar == NULL)
return;
- gtk_widget_size_request (priv->searchbar, &child_requisition);
+ gtk_widget_get_preferred_size (priv->searchbar, &child_requisition, NULL);
requisition->width = MAX (requisition->width, child_requisition.width);
requisition->height += child_requisition.height;
}
@@ -267,7 +270,7 @@ shell_content_size_allocate (GtkWidget *widget,
child_allocation.y += child_requisition.height;
if (gtk_widget_get_visible (child))
- gtk_widget_size_request (child, &child_requisition);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
else
child_requisition.height = 0;
@@ -282,7 +285,7 @@ shell_content_size_allocate (GtkWidget *widget,
child_allocation.y += child_requisition.height;
if (child != NULL)
- gtk_widget_size_request (child, &child_requisition);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
else
child_requisition.height = 0;
diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c
index a7cb28e803..e460d30100 100644
--- a/shell/e-shell-sidebar.c
+++ b/shell/e-shell-sidebar.c
@@ -31,6 +31,9 @@
#include <e-util/e-unicode.h>
#include <shell/e-shell-view.h>
+/* backward-compatibility cruft */
+#include "e-util/gtk-compat.h"
+
#define E_SHELL_SIDEBAR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_SHELL_SIDEBAR, EShellSidebarPrivate))
@@ -233,10 +236,10 @@ shell_sidebar_size_request (GtkWidget *widget,
requisition->height = 0;
child = gtk_bin_get_child (GTK_BIN (widget));
- gtk_widget_size_request (child, requisition);
+ gtk_widget_get_preferred_size (child, requisition, NULL);
child = priv->event_box;
- gtk_widget_size_request (child, &child_requisition);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
requisition->width = MAX (requisition->width, child_requisition.width);
requisition->height += child_requisition.height;
}
@@ -255,7 +258,7 @@ shell_sidebar_size_allocate (GtkWidget *widget,
gtk_widget_set_allocation (widget, allocation);
child = priv->event_box;
- gtk_widget_size_request (child, &child_requisition);
+ gtk_widget_get_preferred_size (child, &child_requisition, NULL);
child_allocation.x = allocation->x;
child_allocation.y = allocation->y;
diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c
index fec943c021..6dbcc86fb1 100644
--- a/shell/e-shell-switcher.c
+++ b/shell/e-shell-switcher.c
@@ -30,6 +30,9 @@
#include <glib/gi18n.h>
#include <e-util/e-extensible.h>
+/* backward-compatibility cruft */
+#include "e-util/gtk-compat.h"
+
#define E_SHELL_SWITCHER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_SHELL_SWITCHER, EShellSwitcherPrivate))
@@ -100,7 +103,7 @@ shell_switcher_layout_actions (EShellSwitcher *switcher)
GtkWidget *widget = p->data;
GtkRequisition requisition;
- gtk_widget_size_request (widget, &requisition);
+ gtk_widget_get_preferred_size (widget, &requisition, NULL);
max_height = MAX (max_height, requisition.height);
max_width = MAX (max_width, requisition.width);
}
@@ -261,7 +264,7 @@ shell_switcher_size_request (GtkWidget *widget,
child = gtk_bin_get_child (GTK_BIN (widget));
if (child != NULL)
- gtk_widget_size_request (child, requisition);
+ gtk_widget_get_preferred_size (child, requisition, NULL);
if (!priv->toolbar_visible)
return;
@@ -270,7 +273,7 @@ shell_switcher_size_request (GtkWidget *widget,
GtkWidget *widget = iter->data;
GtkRequisition child_requisition;
- gtk_widget_size_request (widget, &child_requisition);
+ gtk_widget_get_preferred_size (widget, &child_requisition, NULL);
child_requisition.width += H_PADDING;
child_requisition.height += V_PADDING;
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 (
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c
index d4ba4f31e3..6e1eb5ca80 100644
--- a/widgets/table/e-cell-combo.c
+++ b/widgets/table/e-cell-combo.c
@@ -447,7 +447,7 @@ e_cell_combo_get_popup_pos (ECellCombo *ecc,
widget = gtk_scrolled_window_get_vscrollbar (popup);
gtk_widget_get_child_requisition (widget, &requisition);
- gtk_widget_size_request (ecc->popup_tree_view, &list_requisition);
+ gtk_widget_get_preferred_size (ecc->popup_tree_view, &list_requisition, NULL);
min_height = MIN (list_requisition.height, requisition.height);
if (!gtk_tree_model_iter_n_children (gtk_tree_view_get_model (GTK_TREE_VIEW (ecc->popup_tree_view)), NULL))
list_requisition.height += E_CELL_COMBO_LIST_EMPTY_HEIGHT;
diff --git a/widgets/table/e-cell-date-edit.c b/widgets/table/e-cell-date-edit.c
index 73a5d946b2..005f7a63e4 100644
--- a/widgets/table/e-cell-date-edit.c
+++ b/widgets/table/e-cell-date-edit.c
@@ -688,7 +688,7 @@ e_cell_date_edit_get_popup_pos (ECellDateEdit *ecde,
the vertical scrollbar in case we need to show that. */
screen_width = gdk_screen_width ();
- gtk_widget_size_request (ecde->popup_window, &popup_requisition);
+ gtk_widget_get_preferred_size (ecde->popup_window, &popup_requisition, NULL);
/* Calculate the desired width. */
*width = popup_requisition.width;