[totem] Prepare for the demise of size_request
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] Prepare for the demise of size_request
- Date: Fri, 29 Oct 2010 16:21:13 +0000 (UTC)
commit 9ee03e0fd8a9d575c0b2bf6f1d9a3da3521472e3
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 29 17:17:28 2010 +0100
Prepare for the demise of size_request
The size_request vfunc is going away in GTK3.
This patch prepares totem for that.
https://bugzilla.gnome.org/show_bug.cgi?id=633409
src/backend/bacon-video-widget-gst-0.10.c | 19 +++++++++++++----
src/gsd-osd-window.c | 31 +++++++++++++++++++++++-----
2 files changed, 39 insertions(+), 11 deletions(-)
---
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index e73d47a..80cdc01 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -906,11 +906,19 @@ bacon_video_widget_button_release (GtkWidget *widget, GdkEventButton *event)
}
static void
-bacon_video_widget_size_request (GtkWidget * widget,
- GtkRequisition * requisition)
+bacon_video_widget_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
- requisition->width = 240;
- requisition->height = 180;
+ *minimum = *natural = 240;
+}
+
+static void
+bacon_video_widget_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ *minimum = *natural = 180;
}
static void
@@ -1001,7 +1009,8 @@ bacon_video_widget_class_init (BaconVideoWidgetClass * klass)
g_type_class_add_private (object_class, sizeof (BaconVideoWidgetPrivate));
/* GtkWidget */
- widget_class->size_request = bacon_video_widget_size_request;
+ widget_class->get_preferred_width = bacon_video_widget_get_preferred_width;
+ widget_class->get_preferred_height = bacon_video_widget_get_preferred_height;
widget_class->size_allocate = bacon_video_widget_size_allocate;
widget_class->realize = bacon_video_widget_realize;
widget_class->unrealize = bacon_video_widget_unrealize;
diff --git a/src/gsd-osd-window.c b/src/gsd-osd-window.c
index 64719dd..24182ad 100644
--- a/src/gsd-osd-window.c
+++ b/src/gsd-osd-window.c
@@ -417,19 +417,37 @@ gsd_osd_window_style_set (GtkWidget *widget,
}
static void
-gsd_osd_window_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+gsd_osd_window_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
GtkStyle *style;
- GTK_WIDGET_CLASS (gsd_osd_window_parent_class)->size_request (widget, requisition);
+ GTK_WIDGET_CLASS (gsd_osd_window_parent_class)->get_preferred_width (widget, minimum, natural);
/* See the comment in gsd_osd_window_style_set() for why we add the thickness here */
style = gtk_widget_get_style (widget);
- requisition->width += style->xthickness;
- requisition->height += style->ythickness;
+ *minimum += style->xthickness;
+ *natural += style->xthickness;
+}
+
+static void
+gsd_osd_window_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkStyle *style;
+
+ GTK_WIDGET_CLASS (gsd_osd_window_parent_class)->get_preferred_height (widget, minimum, natural);
+
+ /* See the comment in gsd_osd_window_style_set() for why we add the thickness here */
+
+ style = gtk_widget_get_style (widget);
+
+ *minimum += style->ythickness;
+ *natural += style->ythickness;
}
static GObject *
@@ -464,7 +482,8 @@ gsd_osd_window_class_init (GsdOsdWindowClass *klass)
widget_class->hide = gsd_osd_window_real_hide;
widget_class->realize = gsd_osd_window_real_realize;
widget_class->style_set = gsd_osd_window_style_set;
- widget_class->size_request = gsd_osd_window_size_request;
+ widget_class->get_preferred_width = gsd_osd_window_get_preferred_width;
+ widget_class->get_preferred_height = gsd_osd_window_get_preferred_height;
widget_class->draw = gsd_osd_window_draw;
signals[DRAW_WHEN_COMPOSITED] = g_signal_new ("draw-when-composited",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]