aboutsummaryrefslogtreecommitdiffstats
path: root/shell
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
parenta2f59fe0fc9e1b8737759ecb884bca18fa8defe3 (diff)
downloadgsoc2013-evolution-b7c2f49973b93c2e80bed6f10c534af17b757c04.tar
gsoc2013-evolution-b7c2f49973b93c2e80bed6f10c534af17b757c04.tar.gz
gsoc2013-evolution-b7c2f49973b93c2e80bed6f10c534af17b757c04.tar.bz2
gsoc2013-evolution-b7c2f49973b93c2e80bed6f10c534af17b757c04.tar.lz
gsoc2013-evolution-b7c2f49973b93c2e80bed6f10c534af17b757c04.tar.xz
gsoc2013-evolution-b7c2f49973b93c2e80bed6f10c534af17b757c04.tar.zst
gsoc2013-evolution-b7c2f49973b93c2e80bed6f10c534af17b757c04.zip
Adapt size_request vfuncs to latest gtk+-3.0 API.
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-content.c50
-rw-r--r--shell/e-shell-meego.c2
-rw-r--r--shell/e-shell-sidebar.c42
-rw-r--r--shell/e-shell-switcher.c62
4 files changed, 118 insertions, 38 deletions
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 38b62738be..586b706859 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -213,31 +213,54 @@ shell_content_constructed (GObject *object)
}
static void
-shell_content_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+shell_content_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
EShellContentPrivate *priv;
- GtkRequisition child_requisition;
+ gint min, nat;
+ gint child_min, child_nat;
GtkWidget *child;
priv = E_SHELL_CONTENT_GET_PRIVATE (widget);
- requisition->width = 0;
- requisition->height = 0;
+ *minimum = *natural = 0;
child = gtk_bin_get_child (GTK_BIN (widget));
- gtk_widget_get_preferred_size (child, requisition, NULL);
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
+ gtk_widget_get_preferred_width (priv->alert_bar, &min, &nat);
+
+ *minimum = MAX (min, child_min);
+ *natural = MAX (nat, child_nat);
+
+ if (priv->searchbar == NULL)
+ return;
+
+ gtk_widget_get_preferred_width (priv->searchbar, &min, &nat);
+ *minimum = MAX (*minimum, min);
+ *natural = MAX (*natural, nat);
+}
- gtk_widget_get_preferred_size (priv->alert_bar, &child_requisition, NULL);
- requisition->width = MAX (requisition->width, child_requisition.width);
- requisition->height += child_requisition.height;
+static void
+shell_content_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ EShellContentPrivate *priv;
+ gint min, nat;
+ GtkWidget *child;
+
+ priv = E_SHELL_CONTENT_GET_PRIVATE (widget);
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ gtk_widget_get_preferred_height (child, minimum, natural);
if (priv->searchbar == NULL)
return;
- gtk_widget_get_preferred_size (priv->searchbar, &child_requisition, NULL);
- requisition->width = MAX (requisition->width, child_requisition.width);
- requisition->height += child_requisition.height;
+ gtk_widget_get_preferred_height (priv->searchbar, &min, &nat);
+ *minimum += min;
+ *natural += nat;
}
static void
@@ -398,7 +421,8 @@ e_shell_content_class_init (EShellContentClass *class)
object_class->constructed = shell_content_constructed;
widget_class = GTK_WIDGET_CLASS (class);
- widget_class->size_request = shell_content_size_request;
+ widget_class->get_preferred_width = shell_content_get_preferred_width;
+ widget_class->get_preferred_height = shell_content_get_preferred_height;
widget_class->size_allocate = shell_content_size_allocate;
container_class = GTK_CONTAINER_CLASS (class);
diff --git a/shell/e-shell-meego.c b/shell/e-shell-meego.c
index 29c7f293fd..51a2da9cf1 100644
--- a/shell/e-shell-meego.c
+++ b/shell/e-shell-meego.c
@@ -106,7 +106,7 @@ e_shell_detect_meego (gboolean *is_meego,
&dummy_t, &dummy_i, &dummy_l, &dummy_l,
&moblin_string);
- gdk_error_trap_pop ();
+ gdk_error_trap_pop_ignored ();
}
if (moblin_string) {
diff --git a/shell/e-shell-sidebar.c b/shell/e-shell-sidebar.c
index 5aa16e019d..618910a600 100644
--- a/shell/e-shell-sidebar.c
+++ b/shell/e-shell-sidebar.c
@@ -220,25 +220,44 @@ shell_sidebar_constructed (GObject *object)
}
static void
-shell_sidebar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+shell_sidebar_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
EShellSidebarPrivate *priv;
- GtkRequisition child_requisition;
+ gint child_min, child_nat;
GtkWidget *child;
priv = E_SHELL_SIDEBAR_GET_PRIVATE (widget);
- requisition->width = 0;
- requisition->height = 0;
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ gtk_widget_get_preferred_width (child, minimum, natural);
+
+ child = priv->event_box;
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
+ *minimum = MAX (*minimum, child_min);
+ *natural = MAX (*natural, child_nat);
+}
+
+static void
+shell_sidebar_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ EShellSidebarPrivate *priv;
+ gint child_min, child_nat;
+ GtkWidget *child;
+
+ priv = E_SHELL_SIDEBAR_GET_PRIVATE (widget);
child = gtk_bin_get_child (GTK_BIN (widget));
- gtk_widget_get_preferred_size (child, requisition, NULL);
+ gtk_widget_get_preferred_height (child, minimum, natural);
child = priv->event_box;
- gtk_widget_get_preferred_size (child, &child_requisition, NULL);
- requisition->width = MAX (requisition->width, child_requisition.width);
- requisition->height += child_requisition.height;
+ gtk_widget_get_preferred_height (child, &child_min, &child_nat);
+
+ *minimum += child_min;
+ *natural += child_nat;
}
static void
@@ -283,7 +302,7 @@ shell_sidebar_forall (GtkContainer *container,
priv = E_SHELL_SIDEBAR_GET_PRIVATE (container);
- if (include_internals)
+ if (include_internals && callback_data)
callback (priv->event_box, callback_data);
/* Chain up to parent's forall() method. */
@@ -308,7 +327,8 @@ e_shell_sidebar_class_init (EShellSidebarClass *class)
object_class->constructed = shell_sidebar_constructed;
widget_class = GTK_WIDGET_CLASS (class);
- widget_class->size_request = shell_sidebar_size_request;
+ widget_class->get_preferred_width = shell_sidebar_get_preferred_width;
+ widget_class->get_preferred_height = shell_sidebar_get_preferred_height;
widget_class->size_allocate = shell_sidebar_size_allocate;
container_class = GTK_CONTAINER_CLASS (class);
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;