]> Pileus Git - ~andy/gtk/commitdiff
Simplify, only create a new setup if appearance actually changed.
authorMatthias Clasen <maclas@gmx.de>
Fri, 27 Feb 2004 20:41:14 +0000 (20:41 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 27 Feb 2004 20:41:14 +0000 (20:41 +0000)
Fri Feb 27 21:42:28 2004  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkcombobox.c (gtk_combo_box_relayout):
* gtk/gtkcombobox.c (gtk_combo_box_style_set): Simplify, only
create a new setup if appearance actually changed.
* gtk/gtkcombobox.c (gtk_combo_box_cell_layout_clear):
* gtk/gtkcombobox.c (gtk_combo_box_get_cell_info): Make
these more robust.  (#127623, Damon Chaplin)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcombobox.c

index 8d73c8e6211f3fb9bcd9a2ce57f91f64b8433478..6187b603fa067ed336b473a9c6a3d09d9b1e9c66 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Fri Feb 27 21:42:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_relayout): 
+       * gtk/gtkcombobox.c (gtk_combo_box_style_set): Simplify, only 
+       create a new setup if appearance actually changed.
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_clear): 
+       * gtk/gtkcombobox.c (gtk_combo_box_get_cell_info): Make 
+       these more robust.  (#127623, Damon Chaplin)
+
 Fri Feb 27 15:06:00 2004  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkfilechooser.c (gtk_file_chooser_class_init): remove
index 8d73c8e6211f3fb9bcd9a2ce57f91f64b8433478..6187b603fa067ed336b473a9c6a3d09d9b1e9c66 100644 (file)
@@ -1,3 +1,12 @@
+Fri Feb 27 21:42:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_relayout): 
+       * gtk/gtkcombobox.c (gtk_combo_box_style_set): Simplify, only 
+       create a new setup if appearance actually changed.
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_clear): 
+       * gtk/gtkcombobox.c (gtk_combo_box_get_cell_info): Make 
+       these more robust.  (#127623, Damon Chaplin)
+
 Fri Feb 27 15:06:00 2004  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkfilechooser.c (gtk_file_chooser_class_init): remove
index 8d73c8e6211f3fb9bcd9a2ce57f91f64b8433478..6187b603fa067ed336b473a9c6a3d09d9b1e9c66 100644 (file)
@@ -1,3 +1,12 @@
+Fri Feb 27 21:42:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_relayout): 
+       * gtk/gtkcombobox.c (gtk_combo_box_style_set): Simplify, only 
+       create a new setup if appearance actually changed.
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_clear): 
+       * gtk/gtkcombobox.c (gtk_combo_box_get_cell_info): Make 
+       these more robust.  (#127623, Damon Chaplin)
+
 Fri Feb 27 15:06:00 2004  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkfilechooser.c (gtk_file_chooser_class_init): remove
index 8d73c8e6211f3fb9bcd9a2ce57f91f64b8433478..6187b603fa067ed336b473a9c6a3d09d9b1e9c66 100644 (file)
@@ -1,3 +1,12 @@
+Fri Feb 27 21:42:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_relayout): 
+       * gtk/gtkcombobox.c (gtk_combo_box_style_set): Simplify, only 
+       create a new setup if appearance actually changed.
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_clear): 
+       * gtk/gtkcombobox.c (gtk_combo_box_get_cell_info): Make 
+       these more robust.  (#127623, Damon Chaplin)
+
 Fri Feb 27 15:06:00 2004  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkfilechooser.c (gtk_file_chooser_class_init): remove
index 8d73c8e6211f3fb9bcd9a2ce57f91f64b8433478..6187b603fa067ed336b473a9c6a3d09d9b1e9c66 100644 (file)
@@ -1,3 +1,12 @@
+Fri Feb 27 21:42:28 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_relayout): 
+       * gtk/gtkcombobox.c (gtk_combo_box_style_set): Simplify, only 
+       create a new setup if appearance actually changed.
+       * gtk/gtkcombobox.c (gtk_combo_box_cell_layout_clear): 
+       * gtk/gtkcombobox.c (gtk_combo_box_get_cell_info): Make 
+       these more robust.  (#127623, Damon Chaplin)
+
 Fri Feb 27 15:06:00 2004  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtkfilechooser.c (gtk_file_chooser_class_init): remove
index 23956a1a871796dfd39720000b60f577d67dffb4..9c67cac92c3daacc28282ca1ac3b0a20897e7100 100644 (file)
@@ -580,21 +580,23 @@ gtk_combo_box_style_set (GtkWidget *widget,
   /* TRUE is windows style */
   if (appearance)
     {
+      /* Destroy all the menu mode widgets, if they exist. */
       if (GTK_IS_MENU (combo_box->priv->popup_widget))
-        gtk_combo_box_menu_destroy (combo_box);
-      else
-       gtk_combo_box_unset_model (combo_box);
-  
-      gtk_combo_box_list_setup (combo_box);
+       gtk_combo_box_menu_destroy (combo_box);
+
+      /* Create the list mode widgets, if they don't already exist. */
+      if (!GTK_IS_TREE_VIEW (combo_box->priv->tree_view))
+       gtk_combo_box_list_setup (combo_box);
     }
   else
     {
+      /* Destroy all the list mode widgets, if they exist. */
       if (GTK_IS_TREE_VIEW (combo_box->priv->tree_view))
-        gtk_combo_box_list_destroy (combo_box);
-      else
-       gtk_combo_box_unset_model (combo_box);
-  
-      gtk_combo_box_menu_setup (combo_box, TRUE);
+       gtk_combo_box_list_destroy (combo_box);
+
+      /* Create the menu mode widgets, if they don't already exist. */
+      if (!GTK_IS_MENU (combo_box->priv->popup_widget))
+       gtk_combo_box_menu_setup (combo_box, TRUE);
     }
 }
 
@@ -661,7 +663,7 @@ gtk_combo_box_get_cell_info (GtkComboBox     *combo_box,
     {
       ComboCellInfo *info = (ComboCellInfo *)i->data;
 
-      if (info->cell == cell)
+      if (info && info->cell == cell)
         return info;
     }
 
@@ -1395,6 +1397,9 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
 {
   GtkWidget *box;
 
+  /* Unset any existing model. */
+  gtk_combo_box_unset_model (combo_box);
+
   if (combo_box->priv->cell_view)
     {
       combo_box->priv->button = gtk_toggle_button_new ();
@@ -1649,8 +1654,6 @@ gtk_combo_box_relayout (GtkComboBox *combo_box)
   /* ensure we are in menu style */
   if (combo_box->priv->tree_view)
     gtk_combo_box_list_destroy (combo_box);
-  else
-    gtk_combo_box_unset_model (combo_box);
 
   menu = combo_box->priv->popup_widget;
 
@@ -1835,6 +1838,9 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
   GSList *i;
   GtkTreeSelection *sel;
 
+  /* Unset any existing model. */
+  gtk_combo_box_unset_model (combo_box);
+
   combo_box->priv->button = gtk_toggle_button_new ();
   gtk_widget_set_parent (combo_box->priv->button,
                          GTK_BIN (combo_box)->child->parent);
@@ -2260,6 +2266,7 @@ gtk_combo_box_cell_layout_clear (GtkCellLayout *layout)
       gtk_combo_box_cell_layout_clear_attributes (layout, info->cell);
       g_object_unref (G_OBJECT (info->cell));
       g_free (info);
+      i->data = NULL;
     }
   g_slist_free (combo_box->priv->cells);
   combo_box->priv->cells = NULL;