[gnome-settings-daemon] Prepare for the demise of size_request



commit f18a902253836ca0e833ba92b5a0883ae5e882f6
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Nov 8 21:04:13 2010 +0000

    Prepare for the demise of size_request
    
    https://bugzilla.gnome.org/show_bug.cgi?id=633320

 plugins/common/gsd-osd-window.c |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/plugins/common/gsd-osd-window.c b/plugins/common/gsd-osd-window.c
index 64719dd..24182ad 100644
--- a/plugins/common/gsd-osd-window.c
+++ b/plugins/common/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]