Commit d777b5b4 authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld

Fixes #124373, Murray Cumming.

Mon Nov 17 00:11:21 2003  Kristian Rietveld  <kris@gtk.org>

	Fixes #124373, Murray Cumming.

	* gtk/gtkcombobox.[ch] (gtk_combo_box_class_init): the model property
	is no longer construct only,
	(gtk_combo_box_unset_model), (gtk_combo_box_set_model_internal),
	(gtk_combo_box_menu_fill): new functions,
	(gtk_combo_box_menu_setup), (gtk_combo_box_menu_destroy),
	(gtk_combo_box_menu_row_*), (gtk_combo_box_list_setup),
	(gtk_combo_box_list_destroy): updated,
	(gtk_combo_box_new), (gtk_combo_box_new_with_model): new/changed
	functions,
	(gtk_combo_box_set_model): is now public, updated,
	(gtk_combo_box_get_model): small update.

	* gtk/gtkcomboboxentry.[ch] (gtk_combo_box_entry_class_init): the
	text_column property is no longer construct only,
	(gtk_combo_box_entry_set_text_column): now public,
	(gtk_combo_box_entry_new), (gtk_combo_box_entry_new_with_model):
	new/changed functions.

	* tests/testcombo.c: updated.
parent 01d2e366
Mon Nov 17 00:11:21 2003 Kristian Rietveld <kris@gtk.org>
Fixes #124373, Murray Cumming.
* gtk/gtkcombobox.[ch] (gtk_combo_box_class_init): the model property
is no longer construct only,
(gtk_combo_box_unset_model), (gtk_combo_box_set_model_internal),
(gtk_combo_box_menu_fill): new functions,
(gtk_combo_box_menu_setup), (gtk_combo_box_menu_destroy),
(gtk_combo_box_menu_row_*), (gtk_combo_box_list_setup),
(gtk_combo_box_list_destroy): updated,
(gtk_combo_box_new), (gtk_combo_box_new_with_model): new/changed
functions,
(gtk_combo_box_set_model): is now public, updated,
(gtk_combo_box_get_model): small update.
* gtk/gtkcomboboxentry.[ch] (gtk_combo_box_entry_class_init): the
text_column property is no longer construct only,
(gtk_combo_box_entry_set_text_column): now public,
(gtk_combo_box_entry_new), (gtk_combo_box_entry_new_with_model):
new/changed functions.
* tests/testcombo.c: updated.
Sun Nov 16 22:50:58 2003 Matthias Clasen <maclas@gmx.de>
Reinstate fixes for (#124212, Marco Pesenti Gritti):
......
Mon Nov 17 00:11:21 2003 Kristian Rietveld <kris@gtk.org>
Fixes #124373, Murray Cumming.
* gtk/gtkcombobox.[ch] (gtk_combo_box_class_init): the model property
is no longer construct only,
(gtk_combo_box_unset_model), (gtk_combo_box_set_model_internal),
(gtk_combo_box_menu_fill): new functions,
(gtk_combo_box_menu_setup), (gtk_combo_box_menu_destroy),
(gtk_combo_box_menu_row_*), (gtk_combo_box_list_setup),
(gtk_combo_box_list_destroy): updated,
(gtk_combo_box_new), (gtk_combo_box_new_with_model): new/changed
functions,
(gtk_combo_box_set_model): is now public, updated,
(gtk_combo_box_get_model): small update.
* gtk/gtkcomboboxentry.[ch] (gtk_combo_box_entry_class_init): the
text_column property is no longer construct only,
(gtk_combo_box_entry_set_text_column): now public,
(gtk_combo_box_entry_new), (gtk_combo_box_entry_new_with_model):
new/changed functions.
* tests/testcombo.c: updated.
Sun Nov 16 22:50:58 2003 Matthias Clasen <maclas@gmx.de>
Reinstate fixes for (#124212, Marco Pesenti Gritti):
......
Mon Nov 17 00:11:21 2003 Kristian Rietveld <kris@gtk.org>
Fixes #124373, Murray Cumming.
* gtk/gtkcombobox.[ch] (gtk_combo_box_class_init): the model property
is no longer construct only,
(gtk_combo_box_unset_model), (gtk_combo_box_set_model_internal),
(gtk_combo_box_menu_fill): new functions,
(gtk_combo_box_menu_setup), (gtk_combo_box_menu_destroy),
(gtk_combo_box_menu_row_*), (gtk_combo_box_list_setup),
(gtk_combo_box_list_destroy): updated,
(gtk_combo_box_new), (gtk_combo_box_new_with_model): new/changed
functions,
(gtk_combo_box_set_model): is now public, updated,
(gtk_combo_box_get_model): small update.
* gtk/gtkcomboboxentry.[ch] (gtk_combo_box_entry_class_init): the
text_column property is no longer construct only,
(gtk_combo_box_entry_set_text_column): now public,
(gtk_combo_box_entry_new), (gtk_combo_box_entry_new_with_model):
new/changed functions.
* tests/testcombo.c: updated.
Sun Nov 16 22:50:58 2003 Matthias Clasen <maclas@gmx.de>
Reinstate fixes for (#124212, Marco Pesenti Gritti):
......
Mon Nov 17 00:11:21 2003 Kristian Rietveld <kris@gtk.org>
Fixes #124373, Murray Cumming.
* gtk/gtkcombobox.[ch] (gtk_combo_box_class_init): the model property
is no longer construct only,
(gtk_combo_box_unset_model), (gtk_combo_box_set_model_internal),
(gtk_combo_box_menu_fill): new functions,
(gtk_combo_box_menu_setup), (gtk_combo_box_menu_destroy),
(gtk_combo_box_menu_row_*), (gtk_combo_box_list_setup),
(gtk_combo_box_list_destroy): updated,
(gtk_combo_box_new), (gtk_combo_box_new_with_model): new/changed
functions,
(gtk_combo_box_set_model): is now public, updated,
(gtk_combo_box_get_model): small update.
* gtk/gtkcomboboxentry.[ch] (gtk_combo_box_entry_class_init): the
text_column property is no longer construct only,
(gtk_combo_box_entry_set_text_column): now public,
(gtk_combo_box_entry_new), (gtk_combo_box_entry_new_with_model):
new/changed functions.
* tests/testcombo.c: updated.
Sun Nov 16 22:50:58 2003 Matthias Clasen <maclas@gmx.de>
Reinstate fixes for (#124212, Marco Pesenti Gritti):
......
Mon Nov 17 00:11:21 2003 Kristian Rietveld <kris@gtk.org>
Fixes #124373, Murray Cumming.
* gtk/gtkcombobox.[ch] (gtk_combo_box_class_init): the model property
is no longer construct only,
(gtk_combo_box_unset_model), (gtk_combo_box_set_model_internal),
(gtk_combo_box_menu_fill): new functions,
(gtk_combo_box_menu_setup), (gtk_combo_box_menu_destroy),
(gtk_combo_box_menu_row_*), (gtk_combo_box_list_setup),
(gtk_combo_box_list_destroy): updated,
(gtk_combo_box_new), (gtk_combo_box_new_with_model): new/changed
functions,
(gtk_combo_box_set_model): is now public, updated,
(gtk_combo_box_get_model): small update.
* gtk/gtkcomboboxentry.[ch] (gtk_combo_box_entry_class_init): the
text_column property is no longer construct only,
(gtk_combo_box_entry_set_text_column): now public,
(gtk_combo_box_entry_new), (gtk_combo_box_entry_new_with_model):
new/changed functions.
* tests/testcombo.c: updated.
Sun Nov 16 22:50:58 2003 Matthias Clasen <maclas@gmx.de>
Reinstate fixes for (#124212, Marco Pesenti Gritti):
......
This diff is collapsed.
......@@ -62,7 +62,8 @@ struct _GtkComboBoxClass
/* construction */
GType gtk_combo_box_get_type (void);
GtkWidget *gtk_combo_box_new (GtkTreeModel *model);
GtkWidget *gtk_combo_box_new (void);
GtkWidget *gtk_combo_box_new_with_model (GtkTreeModel *model);
/* grids */
void gtk_combo_box_set_wrap_width (GtkComboBox *combo_box,
......@@ -77,11 +78,13 @@ gint gtk_combo_box_get_active (GtkComboBox *combo_box);
void gtk_combo_box_set_active (GtkComboBox *combo_box,
gint index);
gboolean gtk_combo_box_get_active_iter (GtkComboBox *combo_box,
GtkTreeIter *iter);
GtkTreeIter *iter);
void gtk_combo_box_set_active_iter (GtkComboBox *combo_box,
GtkTreeIter *iter);
GtkTreeIter *iter);
/* getters and setters */
void gtk_combo_box_set_model (GtkComboBox *combo_box,
GtkTreeModel *model);
GtkTreeModel *gtk_combo_box_get_model (GtkComboBox *combo_box);
/* convenience -- text */
......
......@@ -51,8 +51,6 @@ static void gtk_combo_box_entry_active_changed (GtkComboBox *combo_b
gpointer user_data);
static void gtk_combo_box_entry_contents_changed (GtkEntry *entry,
gpointer user_data);
static void gtk_combo_box_entry_set_text_column (GtkComboBoxEntry *entry_box,
gint text_column);
enum
......@@ -108,7 +106,7 @@ gtk_combo_box_entry_class_init (GtkComboBoxEntryClass *klass)
-1,
G_MAXINT,
-1,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_READWRITE));
g_type_class_add_private ((GObjectClass *) klass,
sizeof (GtkComboBoxEntryPrivate));
......@@ -228,33 +226,34 @@ gtk_combo_box_entry_contents_changed (GtkEntry *entry,
NULL);
}
static void
gtk_combo_box_entry_set_text_column (GtkComboBoxEntry *entry_box,
gint text_column)
{
g_return_if_fail (text_column >= 0);
g_return_if_fail (text_column < gtk_tree_model_get_n_columns (gtk_combo_box_get_model (GTK_COMBO_BOX (entry_box))));
g_return_if_fail (entry_box->priv->text_column == -1);
entry_box->priv->text_column = text_column;
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (entry_box),
entry_box->priv->text_renderer,
"text", text_column,
NULL);
}
/* public API */
/**
* gtk_combo_box_entry_new:
*
* Creates a new #GtkComboBoxEntry which has a #GtkEntry as child. After
* construction, you should set a model using gtk_combo_box_set_model() and a
* text_column * using gtk_combo_box_entry_set_text_column().
*
* Return value: A new #GtkComboBoxEntry.
*
* Since: 2.4
*/
GtkWidget *
gtk_combo_box_entry_new (void)
{
return GTK_WIDGET (g_object_new (gtk_combo_box_entry_get_type (), NULL));
}
/**
* gtk_combo_box_entry_new_with_model:
* @model: A #GtkTreeModel.
* @text_column: A column in @model to get the strings from.
*
* Creates a new #GtkComboBoxEntry which has a #GtkEntry as child and a list
* of strings as popup. You can get the #GtkEntry from a #GtkComboBoxEntry
* using GTK_ENTRY (GTK_BIN (combo_box_entry)->child). To add and remove
* strings from the list, just modify @model using it's data manipulation
* strings from the list, just modify @model using its data manipulation
* API.
*
* Return value: A new #GtkComboBoxEntry.
......@@ -262,8 +261,8 @@ gtk_combo_box_entry_set_text_column (GtkComboBoxEntry *entry_box,
* Since: 2.4
*/
GtkWidget *
gtk_combo_box_entry_new (GtkTreeModel *model,
gint text_column)
gtk_combo_box_entry_new_with_model (GtkTreeModel *model,
gint text_column)
{
GtkWidget *ret;
......@@ -279,12 +278,37 @@ gtk_combo_box_entry_new (GtkTreeModel *model,
return ret;
}
/**
* gtk_combo_box_entry_set_text_column:
* @entry_box: A #GtkComboBoxEntry.
* @text_column: A column in @model to get the strings from.
*
* Sets the model column which @entry_box should use to get strings from
* to be @text_column.
*
* Since: 2.4.
*/
void
gtk_combo_box_entry_set_text_column (GtkComboBoxEntry *entry_box,
gint text_column)
{
g_return_if_fail (text_column >= 0);
g_return_if_fail (text_column < gtk_tree_model_get_n_columns (gtk_combo_box_get_model (GTK_COMBO_BOX (entry_box))));
g_return_if_fail (entry_box->priv->text_column == -1);
entry_box->priv->text_column = text_column;
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (entry_box),
entry_box->priv->text_renderer,
"text", text_column,
NULL);
}
/**
* gtk_combo_box_entry_get_text_column:
* @entry_box: A #GtkComboBoxEntry.
*
* Returns the column which @entry_box is using to get the strings from.
* This is the same column which got passed during construction.
*
* Return value: A column in the data source model of @entry_box.
*
......
......@@ -57,9 +57,12 @@ struct _GtkComboBoxEntryClass
GType gtk_combo_box_entry_get_type (void);
GtkWidget *gtk_combo_box_entry_new (GtkTreeModel *model,
GtkWidget *gtk_combo_box_entry_new (void);
GtkWidget *gtk_combo_box_entry_new_with_model (GtkTreeModel *model,
gint text_column);
void gtk_combo_box_entry_set_text_column (GtkComboBoxEntry *entry_box,
gint text_column);
gint gtk_combo_box_entry_get_text_column (GtkComboBoxEntry *entry_box);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment