[gtk+] gtk: remove GtkWidget::size-request



commit bc0e6b2b2189c973cd415724d842020763b9dee6
Author: Michael Natterer <mitch gimp org>
Date:   Fri Nov 19 19:38:48 2010 +0100

    gtk: remove GtkWidget::size-request
    
    Fixes Bug 633324 - Stop invoking size-request completely

 gtk/gtksizerequest.c |   41 +++--------------------------------------
 gtk/gtkwidget.c      |   34 ----------------------------------
 gtk/gtkwidget.h      |    2 --
 3 files changed, 3 insertions(+), 74 deletions(-)
---
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index b20f03d..ab24948 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -105,29 +105,6 @@ get_cached_size (SizeRequestCache  *cache,
 }
 
 
-extern guint _size_request_signal_id;
-static void
-do_size_request (GtkWidget      *widget,
-		 GtkRequisition *requisition)
-{
-  GtkWidgetClass *widget_class = g_type_class_peek (GTK_TYPE_WIDGET);
-
-  if (GTK_WIDGET_GET_CLASS (widget)->size_request != widget_class->size_request)
-    g_warning ("%s implements GtkWidgetClass::size_request which is deprecated and "
-	       "will be removed in the next release",
-	       G_OBJECT_TYPE_NAME (widget));
-
-  if (g_signal_has_handler_pending (widget, _size_request_signal_id, 0, TRUE))
-    g_warning ("A %s (%p) has handler(s) connected to the GtkWidgetClass::size-request signal which is "
-	       "deprecated and will be removed in the next release",
-	       G_OBJECT_TYPE_NAME (widget), widget);
-
-  /* Now we dont bother caching the deprecated "size-request" returns,
-   * just unconditionally invoke here just in case we run into legacy stuff */
-  gtk_widget_ensure_style (widget);
-  g_signal_emit_by_name (widget, "size-request", requisition);
-}
-
 #ifndef G_DISABLE_CHECKS
 static GQuark recursion_check_quark = 0;
 #endif /* G_DISABLE_CHECKS */
@@ -225,17 +202,13 @@ compute_size_for_orientation (GtkWidget         *widget,
 
   if (!found_in_cache)
     {
-      GtkRequisition requisition = { 0, 0 };
-      gint min_size = 0, nat_size = 0;
-      gint requisition_size;
+      gint min_size = 0;
+      gint nat_size = 0;
 
-      /* Unconditional size request runs but is often unhandled. */
-      do_size_request (widget, &requisition);
+      gtk_widget_ensure_style (widget);
 
       if (orientation == GTK_SIZE_GROUP_HORIZONTAL)
         {
-          requisition_size = requisition.width;
-
           if (for_size < 0)
             {
 	      push_recursion_check (widget, orientation, for_size);
@@ -266,8 +239,6 @@ compute_size_for_orientation (GtkWidget         *widget,
         }
       else
         {
-          requisition_size = requisition.height;
-
           if (for_size < 0)
             {
 	      push_recursion_check (widget, orientation, for_size);
@@ -303,12 +274,6 @@ compute_size_for_orientation (GtkWidget         *widget,
                      G_OBJECT_TYPE_NAME (widget), widget, min_size, nat_size);
         }
 
-      /* Support for dangling "size-request" signal implementations on
-       * legacy widgets
-       */
-      min_size = MAX (min_size, requisition_size);
-      nat_size = MAX (nat_size, requisition_size);
-
       cached_size->minimum_size = min_size;
       cached_size->natural_size = nat_size;
       cached_size->for_size     = for_size;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 1c3955b..aca9989 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -381,7 +381,6 @@ enum {
   UNMAP,
   REALIZE,
   UNREALIZE,
-  SIZE_REQUEST,
   SIZE_ALLOCATE,
   STATE_CHANGED,
   PARENT_SET,
@@ -517,8 +516,6 @@ static void	gtk_widget_real_map		 (GtkWidget	    *widget);
 static void	gtk_widget_real_unmap		 (GtkWidget	    *widget);
 static void	gtk_widget_real_realize		 (GtkWidget	    *widget);
 static void	gtk_widget_real_unrealize	 (GtkWidget	    *widget);
-static void	gtk_widget_real_size_request	 (GtkWidget	    *widget,
-						  GtkRequisition    *requisition);
 static void	gtk_widget_real_size_allocate	 (GtkWidget	    *widget,
                                                   GtkAllocation	    *allocation);
 static void	gtk_widget_real_style_set        (GtkWidget         *widget,
@@ -655,9 +652,6 @@ static guint            composite_child_stack = 0;
 static GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR;
 static GParamSpecPool  *style_property_spec_pool = NULL;
 
-/* XXX Temporarily here to fire warnings from gtksizerequest.c */
-guint _size_request_signal_id = 0;
-
 static GQuark		quark_property_parser = 0;
 static GQuark		quark_aux_info = 0;
 static GQuark		quark_accel_path = 0;
@@ -813,7 +807,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
   klass->unmap = gtk_widget_real_unmap;
   klass->realize = gtk_widget_real_realize;
   klass->unrealize = gtk_widget_real_unrealize;
-  klass->size_request = gtk_widget_real_size_request;
   klass->size_allocate = gtk_widget_real_size_allocate;
   klass->get_preferred_width = gtk_widget_real_get_width;
   klass->get_preferred_height = gtk_widget_real_get_height;
@@ -1411,25 +1404,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
 		  G_TYPE_NONE, 0);
 
   /**
-   * GtkWidget::size-request:
-   * @widget: the object which received the signal.
-   * @requisition:
-   *
-   * Deprecated: 3.0: Either implement
-   * <link linkend="geometry-management">height-for-width geometry management</link> or
-   * use gtk_widget_set_size_request() instead of handling this signal.
-   */
-  _size_request_signal_id = widget_signals[SIZE_REQUEST] =
-    g_signal_new (I_("size-request"),
-		  G_TYPE_FROM_CLASS (gobject_class),
-		  G_SIGNAL_RUN_FIRST,
-		  G_STRUCT_OFFSET (GtkWidgetClass, size_request),
-		  NULL, NULL,
-		  _gtk_marshal_VOID__BOXED,
-		  G_TYPE_NONE, 1,
-		  GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE);
-
-  /**
    * GtkWidget::size-allocate:
    * @widget: the object which received the signal.
    * @allocation:
@@ -9882,14 +9856,6 @@ gtk_widget_real_unrealize (GtkWidget *widget)
 }
 
 static void
-gtk_widget_real_size_request (GtkWidget         *widget,
-			      GtkRequisition    *requisition)
-{
-  requisition->width  = 0;
-  requisition->height = 0;
-}
-
-static void
 gtk_widget_real_adjust_size_request (GtkWidget         *widget,
                                      GtkOrientation     orientation,
                                      gint              *minimum_size,
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index ee1d571..8a566df 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -219,8 +219,6 @@ struct _GtkWidgetClass
   void (* unmap)	       (GtkWidget        *widget);
   void (* realize)	       (GtkWidget        *widget);
   void (* unrealize)	       (GtkWidget        *widget);
-  void (* size_request)	       (GtkWidget        *widget,
-				GtkRequisition   *requisition);
   void (* size_allocate)       (GtkWidget        *widget,
 				GtkAllocation    *allocation);
   void (* state_changed)       (GtkWidget        *widget,



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