[evolution/gtk3: 26/47] Remaining changes for deprecated size_request



commit b01fcc34246a4ee8d9a972709ec65f8db1e8dab4
Author: Vibha Yadav <yvibha novell com>
Date:   Mon Dec 13 16:39:24 2010 +0530

    Remaining changes for deprecated size_request
    
    Using get_preferred_width/height instead of deprecated size_request

 calendar/gui/weekday-picker.c       |   24 +++++++++++++++++++-----
 modules/mail/e-mail-shell-sidebar.c |   20 +++++++++++++++-----
 widgets/misc/e-calendar.c           |   26 --------------------------
 widgets/misc/e-map.c                |    2 +-
 widgets/table/e-table.c             |    4 ++--
 5 files changed, 37 insertions(+), 39 deletions(-)
---
diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c
index c2165f6..4499372 100644
--- a/calendar/gui/weekday-picker.c
+++ b/calendar/gui/weekday-picker.c
@@ -219,8 +219,9 @@ weekday_picker_realize (GtkWidget *widget)
 }
 
 static void
-weekday_picker_size_request (GtkWidget *widget,
-                             GtkRequisition *requisition)
+weekday_picker_get_preferred_width (GtkWidget *widget,
+                             	    gint *minimum_width,
+				    gint *natural_width)
 {
 	WeekdayPicker *wp;
 	WeekdayPickerPrivate *priv;
@@ -228,8 +229,20 @@ weekday_picker_size_request (GtkWidget *widget,
 	wp = WEEKDAY_PICKER (widget);
 	priv = wp->priv;
 
-	requisition->width = (priv->max_letter_width + 2 * PADDING + 1) * 7 + 1;
-	requisition->height = (priv->font_ascent + priv->font_descent + 2 * PADDING + 2);
+	*minimum_width = *natural_width = (priv->max_letter_width + 2 * PADDING + 1) * 7 + 1;
+}
+static void
+weekday_picker_get_preferred_height (GtkWidget *widget,
+                             	    gint *minimum_height,
+				    gint *natural_height)
+{
+	WeekdayPicker *wp;
+	WeekdayPickerPrivate *priv;
+
+	wp = WEEKDAY_PICKER (widget);
+	priv = wp->priv;
+
+	*minimum_height = *natural_height = (priv->font_ascent + priv->font_descent + 2 * PADDING + 2);
 }
 
 static void
@@ -346,7 +359,8 @@ weekday_picker_class_init (WeekdayPickerClass *class)
 
 	widget_class = GTK_WIDGET_CLASS (class);
 	widget_class->realize = weekday_picker_realize;
-	widget_class->size_request = weekday_picker_size_request;
+	widget_class->get_preferred_width = weekday_picker_get_preferred_width;
+	widget_class->get_preferred_height = weekday_picker_get_preferred_height;
 	widget_class->size_allocate = weekday_picker_size_allocate;
 	widget_class->style_set = weekday_picker_style_set;
 	widget_class->focus = weekday_picker_focus;
diff --git a/modules/mail/e-mail-shell-sidebar.c b/modules/mail/e-mail-shell-sidebar.c
index 2b24aae..7c538de 100644
--- a/modules/mail/e-mail-shell-sidebar.c
+++ b/modules/mail/e-mail-shell-sidebar.c
@@ -231,8 +231,17 @@ guess_screen_width (EMailShellSidebar *sidebar)
 }
 
 static void
-mail_shell_sidebar_size_request (GtkWidget *widget,
-                                 GtkRequisition *requisition)
+mail_shell_sidebar_get_preferred_height (GtkWidget *widget,
+					 gint *minimum_height,
+					 gint *natural_height)
+{
+	GTK_WIDGET_CLASS (parent_class)->get_preferred_height (widget, minimum_height, natural_height);
+}
+
+static void
+mail_shell_sidebar_get_preferred_width (GtkWidget *widget,
+					gint *minimum_width,
+					gint *natural_width)
 {
 	/* We override the normal size-request handler so that we can
 	 * spit out a treeview with a suitable width.  We measure the
@@ -258,7 +267,7 @@ mail_shell_sidebar_size_request (GtkWidget *widget,
 
 	sidebar = E_MAIL_SHELL_SIDEBAR (widget);
 
-	GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
+	GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, minimum_width, natural_width);
 
 	/* This string is a mockup only; it doesn't need to be translated */
 	layout = gtk_widget_create_pango_layout (
@@ -274,7 +283,7 @@ mail_shell_sidebar_size_request (GtkWidget *widget,
 	border = 2 * style->xthickness + 4;
 	sidebar_width = ink_rect.width + border;
 	sidebar_width = MIN (sidebar_width, screen_width / 4);
-	requisition->width = MAX (requisition->width, sidebar_width);
+	*minimum_width = *natural_width = MAX (*natural_width, sidebar_width);
 }
 
 static guint32
@@ -305,7 +314,8 @@ mail_shell_sidebar_class_init (EMailShellSidebarClass *class)
 	object_class->constructed = mail_shell_sidebar_constructed;
 
 	widget_class = GTK_WIDGET_CLASS (class);
-	widget_class->size_request = mail_shell_sidebar_size_request;
+	widget_class->get_preferred_width = mail_shell_sidebar_get_preferred_width;
+	widget_class->get_preferred_height = mail_shell_sidebar_get_preferred_height;
 
 	shell_sidebar_class = E_SHELL_SIDEBAR_CLASS (class);
 	shell_sidebar_class->check_state = mail_shell_sidebar_check_state;
diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c
index 091b5f9..c21a6a4 100644
--- a/widgets/misc/e-calendar.c
+++ b/widgets/misc/e-calendar.c
@@ -69,8 +69,6 @@ static void e_calendar_dispose		(GObject	*object);
 static void e_calendar_realize		(GtkWidget	*widget);
 static void e_calendar_style_set	(GtkWidget	*widget,
 					 GtkStyle	*previous_style);
-static void e_calendar_size_request	(GtkWidget      *widget,
-					 GtkRequisition *requisition);
 static void e_calendar_get_preferred_width (GtkWidget *widget,
 					    gint      *minimal_width,
 					    gint      *natural_width);
@@ -322,30 +320,6 @@ e_calendar_get_preferred_height (GtkWidget *widget,
 }
 
 static void
-e_calendar_get_preferred_width (GtkWidget *widget,
-				gint      *minimal_width,
-				gint      *natural_width)
-{
-	GtkRequisition requisition;
-
-	e_calendar_size_request (widget, &requisition);
-
-	*minimal_width = *natural_width = requisition.width;
-}
-
-static void
-e_calendar_get_preferred_height (GtkWidget *widget,
-				 gint      *minimal_height,
-				 gint      *natural_height)
-{
-	GtkRequisition requisition;
-
-	e_calendar_size_request (widget, &requisition);
-
-	*minimal_height = *natural_height = requisition.height;
-}
-
-static void
 e_calendar_size_allocate	(GtkWidget	*widget,
 				 GtkAllocation	*allocation)
 {
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
index 9c20faa..5465b18 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -455,7 +455,7 @@ e_map_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural)
 
 	/* TODO: Put real sizes here. */
 
-	*minimum = *natural = gdk_pixbuf_get_width (priv->map_pixbuf);
+	*minimum = *natural = gdk_pixbuf_get_width (map->priv->map_pixbuf);
 }
 
 static void
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 1002b1f..4e47490 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -225,7 +225,7 @@ current_search_col (ETable *et)
 	return et->current_search_col;
 }
 
-static_void
+static void
 et_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural)
 {
 	ETable *et = E_TABLE (widget);
@@ -236,7 +236,7 @@ et_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural)
         }
 }
 
-static_void
+static void
 et_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural)
 {
         GTK_WIDGET_CLASS (e_table_parent_class)->get_preferred_height (widget, minimum, natural);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]