GtkWidget *combo_box;
const char **str;
- combo_box = gtk_combo_box_new_text ();
+ combo_box = gtk_combo_box_text_new ();
for (str = strings; *str; str++)
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), *str);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), *str);
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
}
else if (i == 1)
{
- widget = gtk_combo_box_new_text ();
+ widget = gtk_combo_box_text_new ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "Option 1");
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "Option 2");
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "Option 3");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 1");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 2");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Option 3");
}
else if (i == 2)
{
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
- combo_box = gtk_combo_box_new_text ();
+ combo_box = gtk_combo_box_text_new ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "NEAREST");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "BILINEAR");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "TILES");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "HYPER");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), "NEAREST");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), "BILINEAR");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), "TILES");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), "HYPER");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 1);
"}\n"
"widget_class \"GtkComboBox\" style \"combo-box-style\"\n" );
- widget = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (widget), "Combo Box");
+ widget = gtk_combo_box_text_new ();
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), "Combo Box");
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_container_add (GTK_CONTAINER (align), widget);
* not restricted to a flat list, it can be a real tree, and the popup will
* reflect the tree structure.
*
- * In addition to the model-view API, GtkComboBox offers a simple API which
- * is suitable for text-only combo boxes, and hides the complexity of
- * managing the data in a model. It consists of the functions
- * gtk_combo_box_new_text(), gtk_combo_box_append_text(),
- * gtk_combo_box_insert_text(), gtk_combo_box_prepend_text(),
- * gtk_combo_box_remove_text() and gtk_combo_box_get_active_text().
+ * For a simple list of textual choices, the model-view API of GtkComboBox
+ * can be a bit overwhelming. In this case, #GtkComboBoxText offers a
+ * simple alternative.
*/
* @combo_box: A #GtkComboBox constructed with gtk_combo_box_new_text()
*
* 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() and with
- * #GtkComboBoxEntry<!-- -->s.
+ * is selected.
*
* Returns: a newly allocated string containing the currently active text.
* Must be freed with g_free().
#include "gtkcellrenderertext.h"
#include "gtkcheckmenuitem.h"
#include "gtkclipboard.h"
-#include "gtkcombobox.h"
+#include "gtkcomboboxtext.h"
#include "gtkentry.h"
#include "gtkexpander.h"
#include "gtkfilechooserprivate.h"
GtkCellRenderer *cell;
GList *cells;
- impl->filter_combo = gtk_combo_box_new_text ();
+ impl->filter_combo = gtk_combo_box_text_new ();
gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (impl->filter_combo), FALSE);
/* Get the combo's text renderer and set ellipsize parameters */
if (!name)
name = "Untitled filter"; /* Place-holder, doesn't need to be marked for translation */
- gtk_combo_box_append_text (GTK_COMBO_BOX (impl->filter_combo), name);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (impl->filter_combo), name);
if (!g_slist_find (impl->filters, impl->current_filter))
set_current_filter (impl, filter);
0, 1, 3, 4, GTK_FILL, 0,
0, 0);
- combo = gtk_combo_box_new_text ();
+ combo = gtk_combo_box_text_new ();
priv->page_set_combo = combo;
gtk_widget_show (combo);
gtk_table_attach (GTK_TABLE (table), combo,
0, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
/* In enum order */
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("All sheets"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Even sheets"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Odd sheets"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("All sheets"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Even sheets"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Odd sheets"));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
label = gtk_label_new_with_mnemonic (_("Sc_ale:"));
0, 1, 4, 5,
GTK_FILL, 0, 0, 0);
- combo = gtk_combo_box_new_text ();
+ combo = gtk_combo_box_text_new ();
priv->orientation_combo = GTK_WIDGET (combo);
gtk_table_attach (GTK_TABLE (table), combo,
1, 2, 4, 5, GTK_FILL, 0,
0, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
/* In enum order */
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Portrait"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Landscape"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Reverse portrait"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Reverse landscape"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Portrait"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Landscape"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Reverse portrait"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Reverse landscape"));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
gtk_widget_set_sensitive (combo, FALSE);
gtk_widget_show (combo);
#include "gtkcellrenderertext.h"
#include "gtkcheckmenuitem.h"
#include "gtkclipboard.h"
-#include "gtkcombobox.h"
+#include "gtkcomboboxtext.h"
#include "gtkentry.h"
#include "gtkeventbox.h"
#include "gtkexpander.h"
impl->filter_combo_hbox = gtk_hbox_new (FALSE, 12);
- impl->filter_combo = gtk_combo_box_new_text ();
+ impl->filter_combo = gtk_combo_box_text_new ();
gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (impl->filter_combo), FALSE);
g_signal_connect (impl->filter_combo, "changed",
G_CALLBACK (filter_combo_changed_cb), impl);
name = gtk_recent_filter_get_name (filter);
if (!name)
name = _("Untitled filter");
-
- gtk_combo_box_append_text (GTK_COMBO_BOX (impl->filter_combo), name);
-
+
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (impl->filter_combo), name);
+
if (!g_slist_find (impl->filters, impl->current_filter))
set_current_filter (impl, filter);
GEnumClass *eclass;
gint j;
- prop_edit = gtk_combo_box_new_text ();
+ prop_edit = gtk_combo_box_text_new ();
eclass = G_ENUM_CLASS (g_type_class_ref (spec->value_type));
j = 0;
while (j < eclass->n_values)
{
- gtk_combo_box_append_text (GTK_COMBO_BOX (prop_edit),
- eclass->values[j].value_name);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (prop_edit),
+ eclass->values[j].value_name);
++j;
}
NULL};
static void
-populate_combo_with (GtkComboBox *combo, const char** elements)
+populate_combo_with (GtkComboBoxText *combo, const char** elements)
{
int i;
for (i = 0; elements[i] != NULL; i++) {
- gtk_combo_box_append_text (combo, elements[i]);
+ gtk_combo_box_text_append_text (combo, elements[i]);
}
- gtk_combo_box_set_active (combo, 0);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
}
static void
-combo_changed_cb (GtkComboBox *combo,
+combo_changed_cb (GtkComboBoxText *combo,
gpointer user_data)
{
char *text;
int i;
- text = gtk_combo_box_get_active_text (combo);
+ text = gtk_combo_box_text_get_active_text (combo);
for (i = 0; styles[i]; i++) {
if (g_str_equal (text, styles[i])) {
}
static void
-combo_types_changed_cb (GtkComboBox *combo,
+combo_types_changed_cb (GtkComboBoxText *combo,
GtkWidget **buttons)
{
int i;
GtkWidget *old_parent, *new_parent;
GtkButtonBoxStyle style;
- text = gtk_combo_box_get_active_text (combo);
+ text = gtk_combo_box_text_get_active_text (combo);
if (g_str_equal (text, "GtkHButtonBox")) {
old_parent = vbbox;
hbox = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- combo_types = gtk_combo_box_new_text ();
- populate_combo_with (GTK_COMBO_BOX (combo_types), types);
+ combo_types = gtk_combo_box_text_new ();
+ populate_combo_with (GTK_COMBO_BOX_TEXT (combo_types), types);
g_signal_connect (G_OBJECT (combo_types), "changed", G_CALLBACK (combo_types_changed_cb), buttons);
gtk_box_pack_start (GTK_BOX (hbox), combo_types, TRUE, TRUE, 0);
- combo_styles = gtk_combo_box_new_text ();
- populate_combo_with (GTK_COMBO_BOX (combo_styles), styles);
+ combo_styles = gtk_combo_box_text_new ();
+ populate_combo_with (GTK_COMBO_BOX_TEXT (combo_styles), styles);
g_signal_connect (G_OBJECT (combo_styles), "changed", G_CALLBACK (combo_changed_cb), NULL);
gtk_box_pack_start (GTK_BOX (hbox), combo_styles, TRUE, TRUE, 0);
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_add (GTK_CONTAINER (window), vbox);
- combo = gtk_combo_box_new_text ();
+ combo = gtk_combo_box_text_new ();
scale = gtk_hscale_new_with_range (0, 360, 1);
label = gtk_label_new ("This label may be ellipsized\nto make it fit.");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "NONE");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "START");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "MIDDLE");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "END");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "NONE");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "START");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "MIDDLE");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "END");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
GtkWidget *omenu;
gint i;
- omenu = gtk_combo_box_new_text ();
+ omenu = gtk_combo_box_text_new ();
g_signal_connect (omenu, "changed",
G_CALLBACK (func), data);
for (i = 0; i < num_items; i++)
- gtk_combo_box_append_text (GTK_COMBO_BOX (omenu), items[i]);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), items[i]);
gtk_combo_box_set_active (GTK_COMBO_BOX (omenu), history);
GDK_KEY_F3,
0,
GTK_ACCEL_VISIBLE);
-
- optionmenu = gtk_combo_box_new_text ();
+
+ optionmenu = gtk_combo_box_text_new ();
gtk_combo_box_set_active (GTK_COMBO_BOX (optionmenu), 3);
gtk_box_pack_start (GTK_BOX (box2), optionmenu, TRUE, TRUE, 0);
gtk_widget_show (optionmenu);
"only one screen on the current display");
gtk_widget_set_sensitive (radio_scr, FALSE);
}
- combo_dpy = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_dpy), "diabolo:0.0");
+ combo_dpy = gtk_combo_box_text_new ();
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_dpy), "diabolo:0.0");
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (combo_dpy))),
"<hostname>:<X Server Num>.<Screen Num>");
window,
G_CONNECT_SWAPPED);
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
- om = gtk_combo_box_new_text ();
+
+ om = gtk_combo_box_text_new ();
i = 0;
while (i < 10)
{
};
g_assert (names[i]);
- gtk_combo_box_append_text (GTK_COMBO_BOX (om), names[i]);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (om), names[i]);
++i;
}
gtk_box_pack_end (GTK_BOX (vbox), om, FALSE, FALSE, 0);
- om = gtk_combo_box_new_text ();
+ om = gtk_combo_box_text_new ();
i = 0;
while (i < 5)
{
};
g_assert (names[i]);
- gtk_combo_box_append_text (GTK_COMBO_BOX (om), names[i]);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (om), names[i]);
++i;
}
label = gtk_label_new ("This label may be ellipsized\nto make it fit.");
gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
- combo = gtk_combo_box_new_text ();
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "NONE");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "START");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "MIDDLE");
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), "END");
+ combo = gtk_combo_box_text_new ();
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "NONE");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "START");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "MIDDLE");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "END");
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
button = gtk_check_button_new_with_mnemonic ("_Check button");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- cb = gtk_combo_box_new_text ();
+ cb = gtk_combo_box_text_new ();
entry = gtk_entry_new ();
gtk_widget_show (entry);
gtk_container_add (GTK_CONTAINER (cb), entry);
- gtk_combo_box_append_text (GTK_COMBO_BOX (cb), "item0");
- gtk_combo_box_append_text (GTK_COMBO_BOX (cb), "item1");
- gtk_combo_box_append_text (GTK_COMBO_BOX (cb), "item1");
- gtk_combo_box_append_text (GTK_COMBO_BOX (cb), "item2");
- gtk_combo_box_append_text (GTK_COMBO_BOX (cb), "item2");
- gtk_combo_box_append_text (GTK_COMBO_BOX (cb), "item2");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb), "item0");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb), "item1");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb), "item1");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb), "item2");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb), "item2");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cb), "item2");
gtk_entry_set_text (GTK_ENTRY (entry), "hello world ♥ foo");
gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
gtk_box_pack_start (GTK_BOX (vbox), cb, TRUE, TRUE, 0);
static GtkWidget *
create_combo_box (void)
{
- GtkComboBox *combo_box = GTK_COMBO_BOX (gtk_combo_box_new_text ());
+ GtkComboBoxText *combo_box = GTK_COMBO_BOX_TEXT (gtk_combo_box_text_new ());
- gtk_combo_box_append_text (combo_box, "This");
- gtk_combo_box_append_text (combo_box, "Is");
- gtk_combo_box_append_text (combo_box, "A");
- gtk_combo_box_append_text (combo_box, "ComboBox");
+ gtk_combo_box_text_append_text (combo_box, "This");
+ gtk_combo_box_text_append_text (combo_box, "Is");
+ gtk_combo_box_text_append_text (combo_box, "A");
+ gtk_combo_box_text_append_text (combo_box, "ComboBox");
return GTK_WIDGET (combo_box);
}
checkbox = gtk_check_button_new_with_mnemonic("_Set Toolbar Style:");
g_signal_connect (checkbox, "toggled", G_CALLBACK (set_toolbar_style_toggled), toolbar);
gtk_box_pack_start (GTK_BOX (hbox1), checkbox, FALSE, FALSE, 0);
-
- option_menu = gtk_combo_box_new_text ();
+
+ option_menu = gtk_combo_box_text_new ();
gtk_widget_set_sensitive (option_menu, FALSE);
g_object_set_data (G_OBJECT (checkbox), "option-menu", option_menu);
for (i = 0; i < G_N_ELEMENTS (toolbar_styles); i++)
- gtk_combo_box_append_text (GTK_COMBO_BOX (option_menu), toolbar_styles[i]);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), toolbar_styles[i]);
gtk_combo_box_set_active (GTK_COMBO_BOX (option_menu),
gtk_toolbar_get_style (GTK_TOOLBAR (toolbar)));
gtk_box_pack_start (GTK_BOX (hbox2), option_menu, FALSE, FALSE, 0);
g_signal_connect (checkbox, "toggled", G_CALLBACK (set_icon_size_toggled), toolbar);
gtk_box_pack_start (GTK_BOX (hbox2), checkbox, FALSE, FALSE, 0);
- option_menu = gtk_combo_box_new_text ();
+ option_menu = gtk_combo_box_text_new ();
g_object_set_data (G_OBJECT (checkbox), "option-menu", option_menu);
gtk_widget_set_sensitive (option_menu, FALSE);
- gtk_combo_box_append_text (GTK_COMBO_BOX (option_menu), "small toolbar");
- gtk_combo_box_append_text (GTK_COMBO_BOX (option_menu), "large toolbar");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), "small toolbar");
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), "large toolbar");
gtk_box_pack_start (GTK_BOX (hbox2), option_menu, FALSE, FALSE, 0);
g_signal_connect (option_menu, "changed",
GList *list;
GList *columns;
- str = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo_box));
+ str = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo_box));
if (!str)
return;
gtk_container_add (GTK_CONTAINER (window), vbox);
/* Option menu contents */
- combo_box = gtk_combo_box_new_text ();
-
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), NO_EXPAND);
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), SINGLE_EXPAND);
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), MULTI_EXPAND);
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), LAST_EXPAND);
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), BORDER_EXPAND);
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), ALL_EXPAND);
+ combo_box = gtk_combo_box_text_new ();
+
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), NO_EXPAND);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), SINGLE_EXPAND);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), MULTI_EXPAND);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), LAST_EXPAND);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), BORDER_EXPAND);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), ALL_EXPAND);
gtk_box_pack_start (GTK_BOX (vbox), combo_box, FALSE, FALSE, 0);
GDK_ACTION_MOVE | GDK_ACTION_COPY);
/* Model menu */
- combo_box = gtk_combo_box_new_text ();
+ combo_box = gtk_combo_box_text_new ();
for (i = 0; i < MODEL_LAST; i++)
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), model_names[i]);
-
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), model_names[i]);
+
gtk_table_attach (GTK_TABLE (table), combo_box,
0, 1, 0, 1,
0, 0,
tv);
/* Columns menu */
- combo_box = gtk_combo_box_new_text ();
+ combo_box = gtk_combo_box_text_new ();
for (i = 0; i < COLUMNS_LAST; i++)
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), column_type_names[i]);
-
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), column_type_names[i]);
+
gtk_table_attach (GTK_TABLE (table), combo_box,
0, 1, 1, 2,
0, 0,