[gtk+] Revert the id-column patch



commit 7651c231e0c6295e8aaa8de23931004ddfdd288b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Oct 23 19:28:05 2010 +0200

    Revert the id-column patch
    
    It didn't quite turn out as I wanted it.
    I'll put it in bug 619148 for now.

 NEWS                                 |    1 -
 docs/reference/gtk/gtk3-sections.txt |    5 +--
 gtk/gtk.symbols                      |    3 -
 gtk/gtkcombobox.c                    |   80 +---------------------------------
 gtk/gtkcombobox.h                    |    3 -
 gtk/gtkcomboboxtext.c                |   34 +-------------
 gtk/gtkcomboboxtext.h                |    4 --
 7 files changed, 5 insertions(+), 125 deletions(-)
---
diff --git a/NEWS b/NEWS
index 1e3da04..55d0b95 100644
--- a/NEWS
+++ b/NEWS
@@ -13,7 +13,6 @@ Overview of Changes from GTK+ 2.91.1 to 2.91.2
  - Popups can be wider than the combo box itself
  - The deprecated GtkComboBoxEntry subclass has been removed
  - The deprecated combo box text convenience API has been removed
- - Numeric IDs can be associated with model values
 
 * GtkRecentManager changes:
  - Store xbel file in XDG_USER_DATA
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index da659d1..e420b4e 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -804,8 +804,6 @@ gtk_combo_box_get_button_sensitivity
 gtk_combo_box_get_has_entry
 gtk_combo_box_set_entry_text_column
 gtk_combo_box_get_entry_text_column
-gtk_combo_box_set_id_column
-gtk_combo_box_get_id_column
 <SUBSECTION Standard>
 GTK_TYPE_COMBO_BOX
 GTK_COMBO_BOX
@@ -825,9 +823,8 @@ GtkComboBoxText
 gtk_combo_box_text_new
 gtk_combo_box_text_new_with_entry
 gtk_combo_box_text_append_text
-gtk_combo_box_text_prepend_text
 gtk_combo_box_text_insert_text
-gtk_combo_box_text_insert_text_with_id
+gtk_combo_box_text_prepend_text
 gtk_combo_box_text_remove
 gtk_combo_box_text_remove_all
 gtk_combo_box_text_get_active_text
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 0ee0e31..6a297bb 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -801,7 +801,6 @@ gtk_combo_box_get_column_span_column
 gtk_combo_box_get_entry_text_column
 gtk_combo_box_get_focus_on_click
 gtk_combo_box_get_has_entry
-gtk_combo_box_get_id_column
 gtk_combo_box_get_model
 gtk_combo_box_get_popup_accessible
 gtk_combo_box_get_popup_fixed_width
@@ -823,7 +822,6 @@ gtk_combo_box_set_add_tearoffs
 gtk_combo_box_set_column_span_column
 gtk_combo_box_set_entry_text_column
 gtk_combo_box_set_focus_on_click
-gtk_combo_box_set_id_column
 gtk_combo_box_set_model
 gtk_combo_box_set_popup_fixed_width
 gtk_combo_box_set_row_separator_func
@@ -840,7 +838,6 @@ gtk_combo_box_text_append_text
 gtk_combo_box_text_get_active_text
 gtk_combo_box_text_get_type G_GNUC_CONST
 gtk_combo_box_text_insert_text
-gtk_combo_box_text_insert_text_with_id
 gtk_combo_box_text_new
 gtk_combo_box_text_new_with_entry
 gtk_combo_box_text_prepend_text
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 6402356..9329792 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -143,8 +143,6 @@ struct _GtkComboBoxPrivate
   gint  text_column;
   GtkCellRenderer *text_renderer;
 
-  gint id_column;
-
   GSList *cells;
 
   guint popup_in_progress : 1;
@@ -247,8 +245,7 @@ enum {
   PROP_EDITING_CANCELED,
   PROP_HAS_ENTRY,
   PROP_ENTRY_TEXT_COLUMN,
-  PROP_POPUP_FIXED_WIDTH,
-  PROP_ID_COLUMN
+  PROP_POPUP_FIXED_WIDTH
 };
 
 static guint combo_box_signals[LAST_SIGNAL] = {0,};
@@ -952,23 +949,6 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
 						      GTK_PARAM_READWRITE));
 
    /**
-    * GtkComboBox:id-column:
-    *
-    * The column in the combo box's model that provides numeric
-    * IDs for the values in the model, if != -1.
-    *
-    * Since: 3.0
-    */
-   g_object_class_install_property (object_class,
-                                    PROP_ID_COLUMN,
-                                    g_param_spec_int ("id-column",
-                                                      P_("ID Column"),
-                                                      P_("The column in the combo box's model that provides "
-                                                      "numeric IDs for the values in the model"),
-                                                      -1, G_MAXINT, -1,
-                                                      GTK_PARAM_READWRITE));
-
-   /**
     * GtkComboBox:popup-fixed-width:
     *
     * Whether the popup's width should be a fixed width matching the
@@ -1097,7 +1077,6 @@ gtk_combo_box_init (GtkComboBox *combo_box)
 
   priv->text_column = -1;
   priv->text_renderer = NULL;
-  priv->id_column = -1;
 
   gtk_combo_box_check_appearance (combo_box);
 }
@@ -1189,10 +1168,6 @@ gtk_combo_box_set_property (GObject      *object,
       gtk_combo_box_set_entry_text_column (combo_box, g_value_get_int (value));
       break;
 
-    case PROP_ID_COLUMN:
-      gtk_combo_box_set_id_column (combo_box, g_value_get_int (value));
-      break;
-
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1270,10 +1245,6 @@ gtk_combo_box_get_property (GObject    *object,
 	g_value_set_int (value, priv->text_column);
 	break;
 
-      case PROP_ID_COLUMN:
-        g_value_set_int (value, priv->id_column);
-        break;
-
       default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -6573,7 +6544,7 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget,
 
 	  xpad = 2 * (border_width + cell_style->xthickness);
 	  ypad = 2 * (border_width + cell_style->ythickness);
-        }
+	}
 
       size -= but_width;
       size -= 2 * focus_width;
@@ -6602,50 +6573,3 @@ gtk_combo_box_get_preferred_height_for_width (GtkWidget *widget,
   if (natural_size)
     *natural_size = nat_height;
 }
-
-/**
- * gtk_combo_box_set_id_column:
- * @combo_box: A #GtkComboBox
- * @id_column: A column in @model to get numeric IDs for values from
- *
- * Sets the model column which @combo_box should use to get numeric IDs
- * for values from. The column @id_column in the model of @combo_box
- * must be of type %G_TYPE_INT.
- *
- * Since: 3.0
- */
-void
-gtk_combo_box_set_id_column (GtkComboBox *combo_box,
-                             gint         id_column)
-{
-  GtkComboBoxPrivate *priv = combo_box->priv;
-  GtkTreeModel *model;
-
-  g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
-
-  model = gtk_combo_box_get_model (combo_box);
-
-  g_return_if_fail (id_column >= 0);
-  g_return_if_fail (model == NULL || id_column < gtk_tree_model_get_n_columns (model));
-
-  priv->id_column = id_column;
-}
-
-/**
- * gtk_combo_box_get_id_column:
- * @combo_box: A #GtkComboBox
- *
- * Returns the column which @combo_box is using to get numeric IDs
- * for values from.
- *
- * Return value: A column in the data source model of @combo_box.
- *
- * Since: 3.0
- */
-gint
-gtk_combo_box_get_id_column (GtkComboBox *combo_box)
-{
-  g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), 0);
-
-  return combo_box->priv->id_column;
-}
diff --git a/gtk/gtkcombobox.h b/gtk/gtkcombobox.h
index ac256a7..c5b6a3c 100644
--- a/gtk/gtkcombobox.h
+++ b/gtk/gtkcombobox.h
@@ -133,9 +133,6 @@ void          gtk_combo_box_popup_for_device (GtkComboBox     *combo_box,
 void          gtk_combo_box_popdown          (GtkComboBox     *combo_box);
 AtkObject*    gtk_combo_box_get_popup_accessible (GtkComboBox *combo_box);
 
-gint          gtk_combo_box_get_id_column        (GtkComboBox *combo_box);
-void          gtk_combo_box_set_id_column        (GtkComboBox *combo_box,
-                                                  gint         id_column);
 
 G_END_DECLS
 
diff --git a/gtk/gtkcomboboxtext.c b/gtk/gtkcomboboxtext.c
index d8df72f..db3a4e8 100644
--- a/gtk/gtkcomboboxtext.c
+++ b/gtk/gtkcomboboxtext.c
@@ -72,7 +72,7 @@ gtk_combo_box_text_init (GtkComboBoxText *combo_box)
 {
   GtkListStore *store;
 
-  store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
+  store = gtk_list_store_new (1, G_TYPE_STRING);
   gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
   g_object_unref (store);
 }
@@ -102,7 +102,6 @@ gtk_combo_box_text_new (void)
 {
   return g_object_new (GTK_TYPE_COMBO_BOX_TEXT,
                        "entry-text-column", 0,
-                       "id-column", 1,
                        NULL);
 }
 
@@ -122,7 +121,6 @@ gtk_combo_box_text_new_with_entry (void)
   return g_object_new (GTK_TYPE_COMBO_BOX_TEXT,
                        "has-entry", TRUE,
                        "entry-text-column", 0,
-                       "id-column", 1,
                        NULL);
 }
 
@@ -173,27 +171,6 @@ gtk_combo_box_text_insert_text (GtkComboBoxText *combo_box,
                                 gint             position,
                                 const gchar     *text)
 {
-  gtk_combo_box_text_insert_text_with_id (combo_box, position, text, 0);
-}
-
-/**
- * gtk_combo_box_text_insert_text_with_id:
- * @combo_box: A #GtkComboBoxText
- * @position: An index to insert @text
- * @text: A string
- * @id: a numeric ID for this value
- *
- * Inserts @text at @position in the list of strings stored in @combo_box,
- * and sets its numeric ID to @id. See #GtkComboBox::id-column.
- *
- * Since: 3.0
- */
-void
-gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box,
-                                        gint             position,
-                                        const gchar     *text,
-                                        gint             id)
-{
   GtkListStore *store;
   GtkTreeIter iter;
   gint text_column;
@@ -209,18 +186,11 @@ gtk_combo_box_text_insert_text_with_id (GtkComboBoxText *combo_box,
   text_column = gtk_combo_box_get_entry_text_column (GTK_COMBO_BOX (combo_box));
   column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), text_column);
   g_return_if_fail (column_type == G_TYPE_STRING);
-  id_column = gtk_combo_box_get_id_column (GTK_COMBO_BOX (combo_box));
-  if (id_column != -1)
-    {
-      column_type = gtk_tree_model_get_column_type (GTK_TREE_MODEL (store), id_column);
-      g_return_if_fail (column_type == G_TYPE_INT);
-    }
 
   gtk_list_store_insert (store, &iter, position);
-  gtk_list_store_set (store, &iter, text_column, text, id_column, id, -1);
+  gtk_list_store_set (store, &iter, text_column, text, -1);
 }
 
-
 /**
  * gtk_combo_box_text_remove:
  * @combo_box: A #GtkComboBox
diff --git a/gtk/gtkcomboboxtext.h b/gtk/gtkcomboboxtext.h
index 7322e45..50ebcb5 100644
--- a/gtk/gtkcomboboxtext.h
+++ b/gtk/gtkcomboboxtext.h
@@ -72,10 +72,6 @@ void          gtk_combo_box_text_remove          (GtkComboBoxText     *combo_box
 void          gtk_combo_box_text_remove_all      (GtkComboBoxText     *combo_box);
 gchar        *gtk_combo_box_text_get_active_text (GtkComboBoxText     *combo_box);
 
-void          gtk_combo_box_text_insert_text_with_id (GtkComboBoxText     *combo_box,
-                                                      gint                 position,
-                                                      const gchar         *text,
-                                                      gint                 id);
 
 G_END_DECLS
 



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