aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
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 /widgets/misc
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 'widgets/misc')
-rw-r--r--widgets/misc/e-calendar.c44
-rw-r--r--widgets/misc/e-map.c26
-rw-r--r--widgets/misc/e-menu-tool-button.c27
3 files changed, 70 insertions, 27 deletions
diff --git a/widgets/misc/e-calendar.c b/widgets/misc/e-calendar.c
index d835ba89ae..c21a6a4547 100644
--- a/widgets/misc/e-calendar.c
+++ b/widgets/misc/e-calendar.c
@@ -69,8 +69,12 @@ 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);
+static void e_calendar_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height);
static void e_calendar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static gint e_calendar_drag_motion (GtkWidget *widget,
@@ -115,7 +119,8 @@ e_calendar_class_init (ECalendarClass *class)
widget_class->realize = e_calendar_realize;
widget_class->style_set = e_calendar_style_set;
- widget_class->size_request = e_calendar_size_request;
+ widget_class->get_preferred_width = e_calendar_get_preferred_width;
+ widget_class->get_preferred_height = e_calendar_get_preferred_height;
widget_class->size_allocate = e_calendar_size_allocate;
widget_class->drag_motion = e_calendar_drag_motion;
widget_class->drag_leave = e_calendar_drag_leave;
@@ -281,26 +286,37 @@ e_calendar_style_set (GtkWidget *widget,
}
static void
-e_calendar_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+e_calendar_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
ECalendar *cal;
GtkStyle *style;
- gint col_width, row_height, width, height;
+ gint col_width;
cal = E_CALENDAR (widget);
style = gtk_widget_get_style (GTK_WIDGET (cal));
- g_object_get ((cal->calitem),
- "row_height", &row_height,
- "column_width", &col_width,
- NULL);
+ g_object_get ((cal->calitem), "column_width", &col_width, NULL);
- height = row_height * cal->min_rows;
- width = col_width * cal->min_cols;
+ *minimum = *natural = col_width * cal->min_cols + style->xthickness * 2;
+}
+
+static void
+e_calendar_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ ECalendar *cal;
+ GtkStyle *style;
+ gint row_height;
+
+ cal = E_CALENDAR (widget);
+ style = gtk_widget_get_style (GTK_WIDGET (cal));
+
+ g_object_get ((cal->calitem), "row_height", &row_height, NULL);
- requisition->width = width + style->xthickness * 2;
- requisition->height = height + style->ythickness * 2;
+ *minimum = *natural = row_height * cal->min_rows + style->ythickness * 2;
}
static void
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
index 89ca22b76a..842d396c7e 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -388,20 +388,35 @@ e_map_unrealize (GtkWidget *widget)
}
static void
-e_map_size_request (GtkWidget *widget, GtkRequisition *requisition)
+e_map_get_preferred_width (GtkWidget *widget, gint *minimum, gint *natural)
{
EMap *map;
g_return_if_fail (widget != NULL);
g_return_if_fail (E_IS_MAP (widget));
- g_return_if_fail (requisition != NULL);
map = E_MAP (widget);
/* TODO: Put real sizes here. */
- requisition->width = gdk_pixbuf_get_width (map->priv->map_pixbuf);
- requisition->height = gdk_pixbuf_get_height (map->priv->map_pixbuf);
+ *minimum = *natural = gdk_pixbuf_get_width (map->priv->map_pixbuf);
+}
+
+static void
+e_map_get_preferred_height (GtkWidget *widget, gint *minimum, gint *natural)
+{
+ EMap *view;
+ EMapPrivate *priv;
+
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (E_IS_MAP (widget));
+
+ view = E_MAP (widget);
+ priv = view->priv;
+
+ /* TODO: Put real sizes here. */
+
+ *minimum = *natural = gdk_pixbuf_get_height (priv->map_pixbuf);
}
static void
@@ -621,7 +636,8 @@ e_map_class_init (EMapClass *class)
widget_class = GTK_WIDGET_CLASS (class);
widget_class->realize = e_map_realize;
widget_class->unrealize = e_map_unrealize;
- widget_class->size_request = e_map_size_request;
+ widget_class->get_preferred_height = e_map_get_preferred_height;
+ widget_class->get_preferred_width = e_map_get_preferred_width;
widget_class->size_allocate = e_map_size_allocate;
widget_class->button_press_event = e_map_button_press;
widget_class->button_release_event = e_map_button_release;
diff --git a/widgets/misc/e-menu-tool-button.c b/widgets/misc/e-menu-tool-button.c
index 612ed801f2..628fdea55d 100644
--- a/widgets/misc/e-menu-tool-button.c
+++ b/widgets/misc/e-menu-tool-button.c
@@ -100,14 +100,23 @@ menu_tool_button_update_button (GtkToolButton *tool_button)
}
static void
-menu_tool_button_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+menu_tool_button_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
{
- gint minimum_width;
+ GTK_WIDGET_CLASS (e_menu_tool_button_parent_class)->
+ get_preferred_height (widget, minimal_height, natural_height);
+}
+
+static void
+menu_tool_button_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ gint minimum_width, min_height, nat_height;
- /* Chain up to parent's size_request() method. */
GTK_WIDGET_CLASS (e_menu_tool_button_parent_class)->
- size_request (widget, requisition);
+ get_preferred_width (widget, minimal_width, natural_width);
/* XXX This is a hack. This widget is only used for the New
* button in the main window toolbar. The New button is
@@ -117,8 +126,9 @@ menu_tool_button_size_request (GtkWidget *widget,
*
* We can't go hard-coding a width, but we -can- use a
* heuristic based on the toolbar button height. */
- minimum_width = requisition->height * 2;
- requisition->width = MAX (minimum_width, requisition->width);
+ menu_tool_button_get_preferred_height (widget, &min_height, &nat_height);
+ minimum_width = min_height * 2;
+ *minimal_width = *natural_width = MAX (minimum_width, *minimal_width);
}
static void
@@ -141,7 +151,8 @@ e_menu_tool_button_class_init (EMenuToolButtonClass *class)
GtkToolButtonClass *tool_button_class;
widget_class = GTK_WIDGET_CLASS (class);
- widget_class->size_request = menu_tool_button_size_request;
+ widget_class->get_preferred_height = menu_tool_button_get_preferred_height;
+ widget_class->get_preferred_width = menu_tool_button_get_preferred_width;
tool_button_class = GTK_TOOL_BUTTON_CLASS (class);
tool_button_class->clicked = menu_tool_button_clicked;