]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcombobox.c
Use gtk_box_new() instead gtk_[v|h]box_new()
[~andy/gtk] / gtk / gtkcombobox.c
index 64023569e3d63f8e064bf889833dc8775d812eb7..d36990ea8b38e280e08eff85f72dd336f27c33d4 100644 (file)
@@ -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,};
@@ -951,23 +948,6 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
                                                      -1, G_MAXINT, -1,
                                                      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:
     *
@@ -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;
@@ -3059,10 +3030,10 @@ gtk_combo_box_menu_setup (GtkComboBox *combo_box,
       gtk_widget_set_parent (priv->button,
                              gtk_widget_get_parent (child));
 
-      priv->box = gtk_hbox_new (FALSE, 0);
+      priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
       gtk_container_add (GTK_CONTAINER (priv->button), priv->box);
 
-      priv->separator = gtk_vseparator_new ();
+      priv->separator = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
       gtk_container_add (GTK_CONTAINER (priv->box), priv->separator);
 
       priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE);
@@ -4911,6 +4882,23 @@ gtk_combo_box_new_with_model (GtkTreeModel *model)
   return GTK_WIDGET (combo_box);
 }
 
+/**
+ * gtk_combo_box_new_with_model_and_entry:
+ *
+ * Creates a new empty #GtkComboBox with an entry
+ * and with the model initialized to @model.
+ *
+ * Return value: A new #GtkComboBox
+ */
+GtkWidget *
+gtk_combo_box_new_with_model_and_entry (GtkTreeModel *model)
+{
+  return g_object_new (GTK_TYPE_COMBO_BOX,
+                       "has-entry", TRUE,
+                       "model", model,
+                       NULL);
+}
+
 /**
  * gtk_combo_box_get_wrap_width:
  * @combo_box: A #GtkComboBox
@@ -5900,14 +5888,14 @@ gtk_combo_box_set_title (GtkComboBox *combo_box,
  * @combo_box: a #GtkComboBox
  * @fixed: whether to use a fixed popup width
  *
- * Specifies whether the popup's width should be a fixed width matching 
- * the allocated width of the combo box.
+ * Specifies whether the popup's width should be a fixed width
+ * matching the allocated width of the combo box.
  *
  * Since: 3.0
  **/
 void
 gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box,
-                                    gboolean     fixed)
+                                     gboolean     fixed)
 {
   g_return_if_fail (GTK_IS_COMBO_BOX (combo_box));
 
@@ -5923,9 +5911,11 @@ gtk_combo_box_set_popup_fixed_width (GtkComboBox *combo_box,
  * gtk_combo_box_get_popup_fixed_width:
  * @combo_box: a #GtkComboBox
  *
- * Gets whether the popup uses a fixed width matching 
+ * Gets whether the popup uses a fixed width matching
  * the allocated width of the combo box.
  *
+ * Returns: %TRUE if the popup uses a fixed width
+ *
  * Since: 3.0
  **/
 gboolean
@@ -6573,7 +6563,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 +6592,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;
-}