[gtk+/combo-refactor: 48/49] Removed GtkComboBoxPrivate->minimum/natural_width members.



commit 75e5f3021dbe6718f5e686d233ef7644cb82f096
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Mon Dec 6 21:40:33 2010 +0900

    Removed GtkComboBoxPrivate->minimum/natural_width members.
    
    And updated gtk_combo_box_list_position() which is still waiting
    for GtkTreeView to report natural width in order to properly do
    non fixed width dropdown menus.

 gtk/gtkcombobox.c |   29 +++++------------------------
 1 files changed, 5 insertions(+), 24 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index f60ebce..5d8f208 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -123,9 +123,6 @@ struct _GtkComboBoxPrivate
   guint scroll_timer;
   guint resize_idle_id;
 
-  gint  minimum_width;
-  gint  natural_width;
-
   /* For "has-entry" specific behavior we track
    * an automated cell renderer and text column */
   gint  text_column;
@@ -1017,9 +1014,6 @@ gtk_combo_box_init (GtkComboBox *combo_box)
                                                  GtkComboBoxPrivate);
   priv = combo_box->priv;
 
-  priv->minimum_width = 0;
-  priv->natural_width = 0;
-
   priv->wrap_width = 0;
 
   priv->active = -1;
@@ -1896,10 +1890,6 @@ gtk_combo_box_list_position (GtkComboBox *combo_box,
   gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
 				  hpolicy, vpolicy);
 
-  /* XXX This set_size_request call is part of the hack outlined below and can 
-   * go away once height-for-width is implemented on treeviews. */
-  gtk_widget_set_size_request (priv->tree_view, -1, -1);
-
   if (combo_box->priv->popup_fixed_width)
     {
       gtk_widget_get_preferred_size (priv->scrolled_window, &popup_req, NULL);
@@ -1913,25 +1903,16 @@ gtk_combo_box_list_position (GtkComboBox *combo_box,
     }
   else
     {
-      if (priv->natural_width > *width)
+      /* XXX This code depends on treeviews properly reporting their natural width
+       * list-mode menus won't fill up to their natural width until then */
+      gtk_widget_get_preferred_size (priv->scrolled_window, NULL, &popup_req);
+
+      if (popup_req.width > *width)
 	{
 	  hpolicy = GTK_POLICY_NEVER;
 	  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->scrolled_window),
 					  hpolicy, vpolicy);
 
-
-	  /* XXX Currently we set the size-request on the internal treeview to be
-	   * the natural width of the cells, this hack can go away once our
-	   * treeview does height-for-width properly (i.e. just adjust *width
-	   * here to be the natural width request of the scrolled-window). 
-	   *
-	   * I can't tell why the magic number 5 is needed here (i.e. without it 
-	   * treeviews are left ellipsizing) , however it this all should be
-	   * removed with height-for-width treeviews.
-	   */
-	  gtk_widget_set_size_request (priv->tree_view, priv->natural_width + 5, -1);
-	  gtk_widget_get_preferred_size (priv->scrolled_window, NULL, &popup_req);
-
 	  *width = popup_req.width;
 	}
     }



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