diff options
author | Ryan Lortie <desrt@desrt.ca> | 2010-11-30 00:07:08 -0500 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2010-11-30 00:29:16 -0500 |
commit | 922324553be10f847d4bdc3a177e641887a2921d (patch) | |
tree | c9b18f335d864524e8be87af43738d53f6aac974 /demos | |
parent | 781d4faf4c6423e6db0f4442bfb3ed4db855e158 (diff) | |
download | gtk+-922324553be10f847d4bdc3a177e641887a2921d.tar.gz |
Bug 619148 - "active ID" properties (GtkComboBox)
Based on a patch by Matthias, add an "active-id" property for
GtkComboBox and add some convenience API for GtkComboBoxText.
Also, add a test case to gtk-demo.
Diffstat (limited to 'demos')
-rw-r--r-- | demos/gtk-demo/combobox.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/demos/gtk-demo/combobox.c b/demos/gtk-demo/combobox.c index b0f45d310d..308242b109 100644 --- a/demos/gtk-demo/combobox.c +++ b/demos/gtk-demo/combobox.c @@ -437,7 +437,26 @@ do_combobox (GtkWidget *do_widget) gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo))); gtk_container_add (GTK_CONTAINER (combo), entry); - + + /* A combobox with string IDs */ + frame = gtk_frame_new ("String IDs"); + gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); + + box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); + gtk_container_set_border_width (GTK_CONTAINER (box), 5); + gtk_container_add (GTK_CONTAINER (frame), box); + + combo = gtk_combo_box_text_new (); + gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "never", "Not visible"); + gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "when-active", "Visible when active"); + gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "always", "Always visible"); + gtk_container_add (GTK_CONTAINER (box), combo); + + entry = gtk_entry_new (); + g_object_bind_property (combo, "active-id", + entry, "text", + G_BINDING_BIDIRECTIONAL); + gtk_container_add (GTK_CONTAINER (box), entry); } if (!gtk_widget_get_visible (window)) |