[gnome-session] fail-whale: Sanitize size request code



commit ec4e99ab4d4ee8aee6be4d822149d923328632cb
Author: Benjamin Otte <otte redhat com>
Date:   Wed Dec 4 03:35:45 2013 +0100

    fail-whale: Sanitize size request code
    
    Code that implements get_preferred_width/height should always also
    implement the height-for-width versions.

 gnome-session/gsm-fail-whale-dialog.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/gnome-session/gsm-fail-whale-dialog.c b/gnome-session/gsm-fail-whale-dialog.c
index dc4ac94..f967953 100644
--- a/gnome-session/gsm-fail-whale-dialog.c
+++ b/gnome-session/gsm-fail-whale-dialog.c
@@ -204,6 +204,19 @@ gsm_fail_whale_dialog_get_preferred_width (GtkWidget *widget,
 }
 
 static void
+gsm_fail_whale_dialog_get_preferred_width_for_height (GtkWidget *widget,
+                                                      gint       for_height,
+                                                      gint      *minimal_width,
+                                                      gint      *natural_width)
+{
+        GtkRequisition requisition;
+
+        gsm_fail_whale_dialog_size_request (widget, &requisition);
+
+        *minimal_width = *natural_width = requisition.width;
+}
+
+static void
 gsm_fail_whale_dialog_get_preferred_height (GtkWidget *widget,
                                             gint      *minimal_height,
                                             gint      *natural_height)
@@ -216,6 +229,19 @@ gsm_fail_whale_dialog_get_preferred_height (GtkWidget *widget,
 }
 
 static void
+gsm_fail_whale_dialog_get_preferred_height_for_width (GtkWidget *widget,
+                                                      gint       for_width,
+                                                      gint      *minimal_height,
+                                                      gint      *natural_height)
+{
+        GtkRequisition requisition;
+
+        gsm_fail_whale_dialog_size_request (widget, &requisition);
+
+        *minimal_height = *natural_height = requisition.height;
+}
+
+static void
 gsm_fail_whale_dialog_class_init (GsmFailWhaleDialogClass *klass)
 {
         GtkWidgetClass *widget_class;
@@ -226,6 +252,8 @@ gsm_fail_whale_dialog_class_init (GsmFailWhaleDialogClass *klass)
         widget_class->unrealize = gsm_fail_whale_dialog_unrealize;
         widget_class->get_preferred_width = gsm_fail_whale_dialog_get_preferred_width;
         widget_class->get_preferred_height = gsm_fail_whale_dialog_get_preferred_height;
+        widget_class->get_preferred_width_for_height = gsm_fail_whale_dialog_get_preferred_width_for_height;
+        widget_class->get_preferred_height_for_width = gsm_fail_whale_dialog_get_preferred_height_for_width;
 
         g_type_class_add_private (klass, sizeof (GsmFailWhaleDialogPrivate));
 }


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