2005-04-01 Matthias Clasen <mclasen@redhat.com>
Make gtk_combo_box_get_active_text do the right thing for
GtkComboBoxEntry (#171373, Robert Staudinger)
* gtk/gtkcombobox.h: Add a get_active_text vfunc.
* gtk/gtkcombobox.c (gtk_combo_box_real_get_active_text): And
implement it here.
* gtk/gtkcomboboxentry.c (gtk_combo_box_entry_get_active_text):
Implement get_active_text by always returning the content of
the entry.
+2005-04-01 Matthias Clasen <mclasen@redhat.com>
+
+ Make gtk_combo_box_get_active_text do the right thing for
+ GtkComboBoxEntry (#171373, Robert Staudinger)
+
+ * gtk/gtkcombobox.h: Add a get_active_text vfunc.
+
+ * gtk/gtkcombobox.c (gtk_combo_box_real_get_active_text): And
+ implement it here.
+
+ * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_get_active_text):
+ Implement get_active_text by always returning the content of
+ the entry.
+
2005-03-31 Sven Neumann <sven@gimp.org>
Merged from gtk-2-6:
2005-03-31 Sven Neumann <sven@gimp.org>
Merged from gtk-2-6:
+2005-04-01 Matthias Clasen <mclasen@redhat.com>
+
+ Make gtk_combo_box_get_active_text do the right thing for
+ GtkComboBoxEntry (#171373, Robert Staudinger)
+
+ * gtk/gtkcombobox.h: Add a get_active_text vfunc.
+
+ * gtk/gtkcombobox.c (gtk_combo_box_real_get_active_text): And
+ implement it here.
+
+ * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_get_active_text):
+ Implement get_active_text by always returning the content of
+ the entry.
+
2005-03-31 Sven Neumann <sven@gimp.org>
Merged from gtk-2-6:
2005-03-31 Sven Neumann <sven@gimp.org>
Merged from gtk-2-6:
+2005-04-01 Matthias Clasen <mclasen@redhat.com>
+
+ Make gtk_combo_box_get_active_text do the right thing for
+ GtkComboBoxEntry (#171373, Robert Staudinger)
+
+ * gtk/gtkcombobox.h: Add a get_active_text vfunc.
+
+ * gtk/gtkcombobox.c (gtk_combo_box_real_get_active_text): And
+ implement it here.
+
+ * gtk/gtkcomboboxentry.c (gtk_combo_box_entry_get_active_text):
+ Implement get_active_text by always returning the content of
+ the entry.
+
2005-03-31 Sven Neumann <sven@gimp.org>
Merged from gtk-2-6:
2005-03-31 Sven Neumann <sven@gimp.org>
Merged from gtk-2-6:
gpointer data);
static void gtk_combo_box_check_appearance (GtkComboBox *combo_box);
gpointer data);
static void gtk_combo_box_check_appearance (GtkComboBox *combo_box);
+static gchar * gtk_combo_box_real_get_active_text (GtkComboBox *combo_box);
/* listening to the model */
static void gtk_combo_box_model_row_inserted (GtkTreeModel *model,
/* listening to the model */
static void gtk_combo_box_model_row_inserted (GtkTreeModel *model,
binding_set = gtk_binding_set_by_class (klass);
binding_set = gtk_binding_set_by_class (klass);
+ klass->get_active_text = gtk_combo_box_real_get_active_text;
+
container_class = (GtkContainerClass *)klass;
container_class->forall = gtk_combo_box_forall;
container_class->add = gtk_combo_box_add;
container_class = (GtkContainerClass *)klass;
container_class->forall = gtk_combo_box_forall;
container_class->add = gtk_combo_box_add;
*
* Returns the currently active string in @combo_box or %NULL if none
* is selected. Note that you can only use this function with combo
*
* Returns the currently active string in @combo_box or %NULL if none
* is selected. Note that you can only use this function with combo
- * boxes constructed with gtk_combo_box_new_text().
+ * boxes constructed with gtk_combo_box_new_text() and with
+ * #GtkComboBoxEntry<!-- -->s.
*
* Returns: a newly allocated string containing the currently active text.
*
*
* Returns: a newly allocated string containing the currently active text.
*
*/
gchar *
gtk_combo_box_get_active_text (GtkComboBox *combo_box)
*/
gchar *
gtk_combo_box_get_active_text (GtkComboBox *combo_box)
+{
+ GtkComboBoxClass *class;
+
+ g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), NULL);
+
+ class = GTK_COMBO_BOX_GET_CLASS (combo_box);
+
+ if (class->get_active_text)
+ return (* class->get_active_text) (combo_box);
+
+ return NULL;
+}
+
+static gchar *
+gtk_combo_box_real_get_active_text (GtkComboBox *combo_box)
{
GtkTreeIter iter;
gchar *text = NULL;
{
GtkTreeIter iter;
gchar *text = NULL;
- g_return_val_if_fail (GTK_IS_COMBO_BOX (combo_box), NULL);
g_return_val_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model), NULL);
if (gtk_combo_box_get_active_iter (combo_box, &iter))
g_return_val_if_fail (GTK_IS_LIST_STORE (combo_box->priv->model), NULL);
if (gtk_combo_box_get_active_iter (combo_box, &iter))
/* signals */
void (* changed) (GtkComboBox *combo_box);
/* signals */
void (* changed) (GtkComboBox *combo_box);
+ /* vfuncs */
+ gchar * (* get_active_text) (GtkComboBox *combo_box);
+
/* Padding for future expansion */
void (*_gtk_reserved0) (void);
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
/* Padding for future expansion */
void (*_gtk_reserved0) (void);
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
- void (*_gtk_reserved3) (void);
GValue *value,
GParamSpec *pspec);
GValue *value,
GParamSpec *pspec);
+static gchar *gtk_combo_box_entry_get_active_text (GtkComboBox *combo_box);
static void gtk_combo_box_entry_active_changed (GtkComboBox *combo_box,
gpointer user_data);
static void gtk_combo_box_entry_contents_changed (GtkEntry *entry,
static void gtk_combo_box_entry_active_changed (GtkComboBox *combo_box,
gpointer user_data);
static void gtk_combo_box_entry_contents_changed (GtkEntry *entry,
{
GObjectClass *object_class;
GtkWidgetClass *widget_class;
{
GObjectClass *object_class;
GtkWidgetClass *widget_class;
+ GtkComboBoxClass *combo_class;
+
object_class = (GObjectClass *)klass;
object_class->set_property = gtk_combo_box_entry_set_property;
object_class->get_property = gtk_combo_box_entry_get_property;
object_class = (GObjectClass *)klass;
object_class->set_property = gtk_combo_box_entry_set_property;
object_class->get_property = gtk_combo_box_entry_get_property;
widget_class = (GtkWidgetClass *)klass;
widget_class->mnemonic_activate = gtk_combo_box_entry_mnemonic_activate;
widget_class = (GtkWidgetClass *)klass;
widget_class->mnemonic_activate = gtk_combo_box_entry_mnemonic_activate;
+ combo_class = (GtkComboBoxClass *)klass;
+ combo_class->get_active_text = gtk_combo_box_entry_get_active_text;
+
g_object_class_install_property (object_class,
PROP_TEXT_COLUMN,
g_param_spec_int ("text-column",
g_object_class_install_property (object_class,
PROP_TEXT_COLUMN,
g_param_spec_int ("text-column",
+static gchar *
+gtk_combo_box_entry_get_active_text (GtkComboBox *combo_box)
+{
+ GtkComboBoxEntry *combo = GTK_COMBO_BOX_ENTRY (combo_box);
+
+ if (combo->priv->entry)
+ return g_strdup (gtk_entry_get_text (combo->priv->entry));
+
+ return NULL;
+}
+
#define __GTK_COMBO_BOX_ENTRY_C__
#include "gtkaliasdef.c"
#define __GTK_COMBO_BOX_ENTRY_C__
#include "gtkaliasdef.c"