aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-switcher.c
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@gnome-db.org>2010-12-10 20:15:27 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-01-25 23:37:16 +0800
commitb7c2f49973b93c2e80bed6f10c534af17b757c04 (patch)
tree938da8b0b636884610fa745542cb85f100fc8331 /shell/e-shell-switcher.c
parenta2f59fe0fc9e1b8737759ecb884bca18fa8defe3 (diff)
downloadgsoc2013-evolution-b7c2f49973b93c2e80bed6f10c534af17b757c04.tar.gz
gsoc2013-evolution-b7c2f49973b93c2e80bed6f10c534af17b757c04.tar.zst
gsoc2013-evolution-b7c2f49973b93c2e80bed6f10c534af17b757c04.zip
Adapt size_request vfuncs to latest gtk+-3.0 API.
Diffstat (limited to 'shell/e-shell-switcher.c')
-rw-r--r--shell/e-shell-switcher.c62
1 files changed, 49 insertions, 13 deletions
diff --git a/shell/e-shell-switcher.c b/shell/e-shell-switcher.c
index 2d2d13c153..f785054c08 100644
--- a/shell/e-shell-switcher.c
+++ b/shell/e-shell-switcher.c
@@ -247,8 +247,9 @@ shell_switcher_dispose (GObject *object)
}
static void
-shell_switcher_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+shell_switcher_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
EShellSwitcherPrivate *priv;
GtkWidget *child;
@@ -256,28 +257,62 @@ shell_switcher_size_request (GtkWidget *widget,
priv = E_SHELL_SWITCHER_GET_PRIVATE (widget);
- requisition->width = 0;
- requisition->height = 0;
+ *minimum = *natural = 0;
child = gtk_bin_get_child (GTK_BIN (widget));
if (child != NULL)
- gtk_widget_get_preferred_size (child, requisition, NULL);
+ gtk_widget_get_preferred_width (child, minimum, natural);
+
+ if (!priv->toolbar_visible)
+ return;
+
+ for (iter = priv->proxies; iter != NULL; iter = iter->next) {
+ GtkWidget *widget_proxy = iter->data;
+ gint child_min, child_nat;
+
+ gtk_widget_get_preferred_width (
+ widget_proxy, &child_min, &child_nat);
+
+ child_min += H_PADDING;
+ child_nat += H_PADDING;
+
+ *minimum = MAX (*minimum, child_min);
+ *natural = MAX (*natural, child_nat);
+ }
+}
+
+static void
+shell_switcher_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ EShellSwitcherPrivate *priv;
+ GtkWidget *child;
+ GList *iter;
+
+ priv = E_SHELL_SWITCHER_GET_PRIVATE (widget);
+
+ *minimum = *natural = 0;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ if (child != NULL)
+ gtk_widget_get_preferred_height (child, minimum, natural);
if (!priv->toolbar_visible)
return;
for (iter = priv->proxies; iter != NULL; iter = iter->next) {
GtkWidget *widget = iter->data;
- GtkRequisition child_requisition;
+ gint child_min, child_nat;
- gtk_widget_get_preferred_size (widget, &child_requisition, NULL);
+ gtk_widget_get_preferred_height (
+ widget, &child_min, &child_nat);
- child_requisition.width += H_PADDING;
- child_requisition.height += V_PADDING;
+ child_min += V_PADDING;
+ child_nat += V_PADDING;
- requisition->width = MAX (
- requisition->width, child_requisition.width);
- requisition->height += child_requisition.height;
+ *minimum += child_min;
+ *natural += child_nat;
}
}
@@ -451,7 +486,8 @@ e_shell_switcher_class_init (EShellSwitcherClass *class)
object_class->dispose = shell_switcher_dispose;
widget_class = GTK_WIDGET_CLASS (class);
- widget_class->size_request = shell_switcher_size_request;
+ widget_class->get_preferred_width = shell_switcher_get_preferred_width;
+ widget_class->get_preferred_height = shell_switcher_get_preferred_height;
widget_class->size_allocate = shell_switcher_size_allocate;
widget_class->screen_changed = shell_switcher_screen_changed;