mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 23:10:22 +00:00
Use the new GtkComboBoxText API
Also remove mentions of the old text convenience API from the docs,
and point to GtkComboBoxText instead.
(cherry picked from commit e7f51ef6a4
)
This commit is contained in:
parent
406c9c9c68
commit
b68d58c0b1
@ -25,10 +25,10 @@ create_combo_box (const char **strings)
|
||||
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);
|
||||
|
||||
|
@ -371,11 +371,11 @@ attach_widgets (GtkTextView *text_view)
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
@ -104,12 +104,12 @@ main(int argc, char **argv)
|
||||
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);
|
||||
|
||||
|
@ -314,8 +314,8 @@ create_combo_box (void)
|
||||
"}\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);
|
||||
|
@ -53,6 +53,32 @@
|
||||
#include "gtktreeprivate.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtkcombobox
|
||||
* @Short_description: A widget used to choose from a list of items
|
||||
* @Title: GtkComboBox
|
||||
* @See_also: #GtkComboBoxEntry, #GtkTreeModel, #GtkCellRenderer
|
||||
*
|
||||
* A GtkComboBox is a widget that allows the user to choose from a list of
|
||||
* valid choices. The GtkComboBox displays the selected choice. When
|
||||
* activated, the GtkComboBox displays a popup which allows the user to
|
||||
* make a new choice. The style in which the selected value is displayed,
|
||||
* and the style of the popup is determined by the current theme. It may
|
||||
* be similar to a Windows-style combo box.
|
||||
*
|
||||
* The GtkComboBox uses the model-view pattern; the list of valid choices
|
||||
* is specified in the form of a tree model, and the display of the choices
|
||||
* can be adapted to the data in the model by using cell renderers, as you
|
||||
* would in a tree view. This is possible since GtkComboBox implements the
|
||||
* #GtkCellLayout interface. The tree model holding the valid choices is
|
||||
* not restricted to a flat list, it can be a real tree, and the popup will
|
||||
* reflect the tree structure.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* WELCOME, to THE house of evil code */
|
||||
|
||||
typedef struct _ComboCellInfo ComboCellInfo;
|
||||
@ -5428,9 +5454,7 @@ gtk_combo_box_remove_text (GtkComboBox *combo_box,
|
||||
* @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().
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "gtkcellrenderertext.h"
|
||||
#include "gtkcheckmenuitem.h"
|
||||
#include "gtkclipboard.h"
|
||||
#include "gtkcombobox.h"
|
||||
#include "gtkcomboboxtext.h"
|
||||
#include "gtkentry.h"
|
||||
#include "gtkexpander.h"
|
||||
#include "gtkfilechooserprivate.h"
|
||||
@ -2425,7 +2425,10 @@ renderer_editing_canceled_cb (GtkCellRendererText *cell_renderer_text,
|
||||
static GtkWidget *
|
||||
filter_create (GtkFileChooserDefault *impl)
|
||||
{
|
||||
impl->filter_combo = gtk_combo_box_new_text ();
|
||||
GtkCellRenderer *cell;
|
||||
GList *cells;
|
||||
|
||||
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",
|
||||
@ -7688,7 +7691,7 @@ gtk_file_chooser_default_add_filter (GtkFileChooser *chooser,
|
||||
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);
|
||||
|
@ -3356,7 +3356,7 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
|
||||
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,
|
||||
@ -3364,9 +3364,9 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
|
||||
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:"));
|
||||
@ -3478,17 +3478,17 @@ create_page_setup_page (GtkPrintUnixDialog *dialog)
|
||||
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);
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "gtkcellrenderertext.h"
|
||||
#include "gtkcheckmenuitem.h"
|
||||
#include "gtkclipboard.h"
|
||||
#include "gtkcombobox.h"
|
||||
#include "gtkcomboboxtext.h"
|
||||
#include "gtkentry.h"
|
||||
#include "gtkeventbox.h"
|
||||
#include "gtkexpander.h"
|
||||
@ -473,7 +473,7 @@ gtk_recent_chooser_default_constructor (GType type,
|
||||
|
||||
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);
|
||||
@ -1296,9 +1296,9 @@ gtk_recent_chooser_default_add_filter (GtkRecentChooser *chooser,
|
||||
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);
|
||||
|
||||
|
@ -822,15 +822,15 @@ property_widget (GObject *object,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -38,25 +38,25 @@ static const char* types[] = { "GtkHButtonBox",
|
||||
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])) {
|
||||
@ -77,7 +77,7 @@ reparent_widget (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
combo_types_changed_cb (GtkComboBox *combo,
|
||||
combo_types_changed_cb (GtkComboBoxText *combo,
|
||||
GtkWidget **buttons)
|
||||
{
|
||||
int i;
|
||||
@ -85,7 +85,7 @@ combo_types_changed_cb (GtkComboBox *combo,
|
||||
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;
|
||||
@ -156,13 +156,13 @@ main (int argc,
|
||||
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);
|
||||
|
||||
|
@ -40,7 +40,7 @@ combo_changed_cb (GtkWidget *combo,
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window, *vbox, *hbox, *label, *combo;
|
||||
GtkWidget *window, *vbox, *hbox, *label, *combo, *scale;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
@ -48,15 +48,15 @@ main (int argc, char *argv[])
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
|
||||
vbox = gtk_vbox_new (0, FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
hbox = gtk_hbox_new (0, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
|
||||
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_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");
|
||||
|
||||
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);
|
||||
g_signal_connect (combo, "changed", G_CALLBACK (combo_changed_cb), label);
|
||||
|
@ -117,7 +117,7 @@ build_option_menu (gchar *items[],
|
||||
GSList *group;
|
||||
gint i;
|
||||
|
||||
omenu = gtk_option_menu_new ();
|
||||
omenu = gtk_combo_box_text_new ();
|
||||
g_signal_connect (omenu, "changed",
|
||||
G_CALLBACK (func), data);
|
||||
|
||||
@ -125,14 +125,7 @@ build_option_menu (gchar *items[],
|
||||
group = NULL;
|
||||
|
||||
for (i = 0; i < num_items; i++)
|
||||
{
|
||||
menu_item = gtk_radio_menu_item_new_with_label (group, items[i]);
|
||||
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_item));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
|
||||
if (i == history)
|
||||
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE);
|
||||
gtk_widget_show (menu_item);
|
||||
}
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (omenu), items[i]);
|
||||
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), history);
|
||||
@ -8483,14 +8476,10 @@ create_display_screen (GtkWidget *widget)
|
||||
"only one screen on the current display");
|
||||
gtk_widget_set_sensitive (radio_scr, FALSE);
|
||||
}
|
||||
combo_dpy = gtk_combo_new ();
|
||||
if (!valid_display_list)
|
||||
valid_display_list = g_list_append (valid_display_list, "diabolo:0.0");
|
||||
|
||||
gtk_combo_set_popdown_strings (GTK_COMBO (combo_dpy), valid_display_list);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (combo_dpy)->entry),
|
||||
"<hostname>:<X Server Num>.<Screen Num>");
|
||||
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>");
|
||||
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), radio_dpy, 0, 1, 0, 1);
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), radio_scr, 0, 1, 1, 2);
|
||||
@ -11128,9 +11117,8 @@ window_controls (GtkWidget *window)
|
||||
window,
|
||||
G_CONNECT_SWAPPED);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
|
||||
om = gtk_combo_box_text_new ();
|
||||
i = 0;
|
||||
while (i < 10)
|
||||
{
|
||||
@ -11150,10 +11138,7 @@ window_controls (GtkWidget *window)
|
||||
};
|
||||
|
||||
g_assert (names[i]);
|
||||
|
||||
mi = gtk_menu_item_new_with_label (names[i]);
|
||||
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (om), names[i]);
|
||||
|
||||
++i;
|
||||
}
|
||||
@ -11172,8 +11157,7 @@ window_controls (GtkWidget *window)
|
||||
gtk_box_pack_end (GTK_BOX (vbox), om, FALSE, FALSE, 0);
|
||||
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
om = gtk_combo_box_text_new ();
|
||||
i = 0;
|
||||
while (i < 5)
|
||||
{
|
||||
@ -11188,10 +11172,7 @@ window_controls (GtkWidget *window)
|
||||
};
|
||||
|
||||
g_assert (names[i]);
|
||||
|
||||
mi = gtk_menu_item_new_with_label (names[i]);
|
||||
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (om), names[i]);
|
||||
|
||||
++i;
|
||||
}
|
||||
|
@ -208,11 +208,11 @@ create_widgets (void)
|
||||
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);
|
||||
|
||||
@ -234,14 +234,19 @@ create_widgets (void)
|
||||
button = gtk_check_button_new_with_mnemonic ("_Check button");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
cb = gtk_combo_new ();
|
||||
cbitems = g_list_append (cbitems, "item0");
|
||||
cbitems = g_list_append (cbitems, "item1 item1");
|
||||
cbitems = g_list_append (cbitems, "item2 item2 item2");
|
||||
gtk_combo_set_popdown_strings (GTK_COMBO (cb), cbitems);
|
||||
gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (cb)->entry), "hello world ♥ foo");
|
||||
gtk_editable_select_region (GTK_EDITABLE (GTK_COMBO (cb)->entry),
|
||||
0, -1);
|
||||
cb = gtk_combo_box_text_new ();
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_show (entry);
|
||||
gtk_container_add (GTK_CONTAINER (cb), entry);
|
||||
|
||||
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);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
|
@ -198,12 +198,12 @@ create_menubar (GtkWindow *window)
|
||||
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);
|
||||
}
|
||||
|
@ -551,23 +551,16 @@ main (gint argc, gchar **argv)
|
||||
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_option_menu_new();
|
||||
|
||||
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);
|
||||
|
||||
menu = gtk_menu_new();
|
||||
for (i = 0; i < G_N_ELEMENTS (toolbar_styles); i++)
|
||||
{
|
||||
GtkWidget *menuitem;
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label (toolbar_styles[i]);
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
}
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (option_menu),
|
||||
GTK_TOOLBAR (toolbar)->style);
|
||||
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 (option_menu, "changed",
|
||||
G_CALLBACK (change_toolbar_style), toolbar);
|
||||
@ -576,21 +569,12 @@ main (gint argc, gchar **argv)
|
||||
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_option_menu_new();
|
||||
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);
|
||||
menu = gtk_menu_new();
|
||||
menuitem = gtk_menu_item_new_with_label ("small toolbar");
|
||||
g_object_set_data (G_OBJECT (menuitem), "value-id", GINT_TO_POINTER (GTK_ICON_SIZE_SMALL_TOOLBAR));
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
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");
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("large toolbar");
|
||||
g_object_set_data (G_OBJECT (menuitem), "value-id", GINT_TO_POINTER (GTK_ICON_SIZE_LARGE_TOOLBAR));
|
||||
gtk_container_add (GTK_CONTAINER (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), option_menu, FALSE, FALSE, 0);
|
||||
g_signal_connect (option_menu, "changed",
|
||||
G_CALLBACK (icon_size_history_changed), toolbar);
|
||||
|
@ -98,7 +98,7 @@ combo_box_changed (GtkComboBox *combo_box,
|
||||
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;
|
||||
|
||||
@ -182,14 +182,14 @@ main (int argc, char **argv)
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
/* Option menu contents */
|
||||
combo_box = gtk_combo_box_new_text ();
|
||||
combo_box = gtk_combo_box_text_new ();
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
|
@ -704,7 +704,7 @@ main (int argc,
|
||||
GtkWidget *sw;
|
||||
GtkWidget *tv;
|
||||
GtkWidget *table;
|
||||
GtkWidget *om;
|
||||
GtkWidget *combo_box;
|
||||
GtkWidget *menu;
|
||||
GtkTreeModel *model;
|
||||
gint i;
|
||||
@ -756,77 +756,34 @@ main (int argc,
|
||||
GDK_ACTION_MOVE | GDK_ACTION_COPY);
|
||||
|
||||
/* Model menu */
|
||||
combo_box = gtk_combo_box_text_new ();
|
||||
for (i = 0; i < MODEL_LAST; i++)
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), model_names[i]);
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
i = 0;
|
||||
while (i < MODEL_LAST)
|
||||
{
|
||||
GtkWidget *mi;
|
||||
const char *name;
|
||||
|
||||
name = model_names[i];
|
||||
|
||||
mi = gtk_menu_item_new_with_label (name);
|
||||
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
|
||||
|
||||
#if 0
|
||||
window = create_prop_editor (G_OBJECT (models[i]));
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window),
|
||||
name);
|
||||
#endif
|
||||
|
||||
++i;
|
||||
}
|
||||
gtk_widget_show_all (menu);
|
||||
|
||||
om = gtk_option_menu_new ();
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (om), menu);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), om,
|
||||
gtk_table_attach (GTK_TABLE (table), combo_box,
|
||||
0, 1, 0, 1,
|
||||
0, 0,
|
||||
0, 0);
|
||||
|
||||
g_signal_connect (om,
|
||||
g_signal_connect (combo_box,
|
||||
"changed",
|
||||
G_CALLBACK (model_selected),
|
||||
tv);
|
||||
|
||||
/* Columns menu */
|
||||
combo_box = gtk_combo_box_text_new ();
|
||||
for (i = 0; i < COLUMNS_LAST; i++)
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo_box), column_type_names[i]);
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
i = 0;
|
||||
while (i < COLUMNS_LAST)
|
||||
{
|
||||
GtkWidget *mi;
|
||||
const char *name;
|
||||
|
||||
name = column_type_names[i];
|
||||
|
||||
mi = gtk_menu_item_new_with_label (name);
|
||||
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), mi);
|
||||
|
||||
++i;
|
||||
}
|
||||
gtk_widget_show_all (menu);
|
||||
|
||||
om = gtk_option_menu_new ();
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (om), menu);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), om,
|
||||
gtk_table_attach (GTK_TABLE (table), combo_box,
|
||||
0, 1, 1, 2,
|
||||
0, 0,
|
||||
0, 0);
|
||||
|
||||
set_columns_type (GTK_TREE_VIEW (tv), COLUMNS_LOTS);
|
||||
gtk_option_menu_set_history (GTK_OPTION_MENU (om), COLUMNS_LOTS);
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), COLUMNS_LOTS);
|
||||
|
||||
g_signal_connect (om,
|
||||
g_signal_connect (combo_box,
|
||||
"changed",
|
||||
G_CALLBACK (columns_selected),
|
||||
tv);
|
||||
|
Loading…
Reference in New Issue
Block a user