summaryrefslogtreecommitdiff
path: root/tests/prop-editor.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2001-11-23 21:46:44 +0000
committerOwen Taylor <otaylor@src.gnome.org>2001-11-23 21:46:44 +0000
commit2936c8e9423cc28555dbe56877a315d16b7f7d8f (patch)
tree986279438d9adf88cbd8c88b0ae067ad0bc06107 /tests/prop-editor.c
parent393c47573ea197e2026133ec79eae7a02880b0d7 (diff)
downloadgtk+-2936c8e9423cc28555dbe56877a315d16b7f7d8f.tar.gz
Version 1.3.11 Require GLib-1.3.11, Pango-0.22, ATK-0.7. Restore toGTK_1_3_11
Thu Nov 22 15:01:03 2001 Owen Taylor <otaylor@redhat.com> * Version 1.3.11 * configure.in (ATK_REQUIRED_VERSION): Require GLib-1.3.11, Pango-0.22, ATK-0.7. * tests/prop-editor.c (property_widget): Restore to working as well as it did before. * gtk/gtklistitem.h: Mark deprecated since it is an integral part of GtkList. * demos/gtk-demo/demo-common.h: New header file, for a common functions not important to the meat of the demos. * demos/gtk-demo/main.c (demo_ifind_file): Add a utility function to search for a file used by the demo. * demos/*.c: Use demo_find_file.
Diffstat (limited to 'tests/prop-editor.c')
-rw-r--r--tests/prop-editor.c84
1 files changed, 41 insertions, 43 deletions
diff --git a/tests/prop-editor.c b/tests/prop-editor.c
index 3617335e92..0d0b3ff060 100644
--- a/tests/prop-editor.c
+++ b/tests/prop-editor.c
@@ -456,11 +456,10 @@ property_widget (GObject *object, GParamSpec *spec, gboolean can_modify)
GtkWidget *prop_edit;
GtkAdjustment *adj;
gchar *msg;
-
-#if 0
- switch (G_PARAM_SPEC_TYPE (spec))
+ GType type = G_PARAM_SPEC_TYPE (spec);
+
+ if (type == G_TYPE_PARAM_INT)
{
- case G_TYPE_PARAM_INT:
adj = GTK_ADJUSTMENT (gtk_adjustment_new (G_PARAM_SPEC_INT (spec)->default_value,
G_PARAM_SPEC_INT (spec)->minimum,
G_PARAM_SPEC_INT (spec)->maximum,
@@ -478,17 +477,17 @@ property_widget (GObject *object, GParamSpec *spec, gboolean can_modify)
if (can_modify)
connect_controller (G_OBJECT (adj), "value_changed",
object, spec->name, (GtkSignalFunc) int_modified);
- break;
-
- case G_TYPE_PARAM_UINT:
+ }
+ else if (type == G_TYPE_PARAM_UINT)
+ {
adj = GTK_ADJUSTMENT (
- gtk_adjustment_new (G_PARAM_SPEC_UINT (spec)->default_value,
- G_PARAM_SPEC_UINT (spec)->minimum,
- G_PARAM_SPEC_UINT (spec)->maximum,
- 1,
- MAX ((G_PARAM_SPEC_UINT (spec)->maximum -
- G_PARAM_SPEC_UINT (spec)->minimum) / 10, 1),
- 0.0));
+ gtk_adjustment_new (G_PARAM_SPEC_UINT (spec)->default_value,
+ G_PARAM_SPEC_UINT (spec)->minimum,
+ G_PARAM_SPEC_UINT (spec)->maximum,
+ 1,
+ MAX ((G_PARAM_SPEC_UINT (spec)->maximum -
+ G_PARAM_SPEC_UINT (spec)->minimum) / 10, 1),
+ 0.0));
prop_edit = gtk_spin_button_new (adj, 1.0, 0);
@@ -499,9 +498,10 @@ property_widget (GObject *object, GParamSpec *spec, gboolean can_modify)
if (can_modify)
connect_controller (G_OBJECT (adj), "value_changed",
object, spec->name, (GtkSignalFunc) uint_modified);
- break;
-
- case G_TYPE_PARAM_FLOAT:
+ }
+ else if (type == G_TYPE_PARAM_FLOAT)
+ {
+
adj = GTK_ADJUSTMENT (gtk_adjustment_new (G_PARAM_SPEC_FLOAT (spec)->default_value,
G_PARAM_SPEC_FLOAT (spec)->minimum,
G_PARAM_SPEC_FLOAT (spec)->maximum,
@@ -519,9 +519,9 @@ property_widget (GObject *object, GParamSpec *spec, gboolean can_modify)
if (can_modify)
connect_controller (G_OBJECT (adj), "value_changed",
object, spec->name, (GtkSignalFunc) float_modified);
- break;
-
- case G_TYPE_PARAM_DOUBLE:
+ }
+ else if (type == G_TYPE_PARAM_DOUBLE)
+ {
adj = GTK_ADJUSTMENT (gtk_adjustment_new (G_PARAM_SPEC_DOUBLE (spec)->default_value,
G_PARAM_SPEC_DOUBLE (spec)->minimum,
G_PARAM_SPEC_DOUBLE (spec)->maximum,
@@ -539,9 +539,9 @@ property_widget (GObject *object, GParamSpec *spec, gboolean can_modify)
if (can_modify)
connect_controller (G_OBJECT (adj), "value_changed",
object, spec->name, (GtkSignalFunc) double_modified);
- break;
-
- case G_TYPE_PARAM_STRING:
+ }
+ else if (type == G_TYPE_PARAM_STRING)
+ {
prop_edit = gtk_entry_new ();
g_object_connect_property (object, spec->name,
@@ -551,9 +551,9 @@ property_widget (GObject *object, GParamSpec *spec, gboolean can_modify)
if (can_modify)
connect_controller (G_OBJECT (prop_edit), "changed",
object, spec->name, (GtkSignalFunc) string_modified);
- break;
-
- case G_TYPE_PARAM_BOOLEAN:
+ }
+ else if (type == G_TYPE_PARAM_BOOLEAN)
+ {
prop_edit = gtk_toggle_button_new_with_label ("");
g_object_connect_property (object, spec->name,
@@ -563,9 +563,9 @@ property_widget (GObject *object, GParamSpec *spec, gboolean can_modify)
if (can_modify)
connect_controller (G_OBJECT (prop_edit), "toggled",
object, spec->name, (GtkSignalFunc) bool_modified);
- break;
-
- case G_TYPE_PARAM_ENUM:
+ }
+ else if (type == G_TYPE_PARAM_ENUM)
+ {
{
GtkWidget *menu;
GEnumClass *eclass;
@@ -603,9 +603,9 @@ property_widget (GObject *object, GParamSpec *spec, gboolean can_modify)
connect_controller (G_OBJECT (prop_edit), "changed",
object, spec->name, (GtkSignalFunc) enum_modified);
}
- break;
-
- case G_TYPE_PARAM_UNICHAR:
+ }
+ else if (type == G_TYPE_PARAM_UNICHAR)
+ {
prop_edit = gtk_entry_new ();
gtk_entry_set_max_length (GTK_ENTRY (prop_edit), 1);
@@ -616,33 +616,31 @@ property_widget (GObject *object, GParamSpec *spec, gboolean can_modify)
if (can_modify)
connect_controller (G_OBJECT (prop_edit), "changed",
object, spec->name, (GtkSignalFunc) unichar_modified);
- break;
-
- case G_TYPE_PARAM_POINTER:
+ }
+ else if (type == G_TYPE_PARAM_POINTER)
+ {
prop_edit = gtk_label_new ("");
g_object_connect_property (object, spec->name,
GTK_SIGNAL_FUNC (pointer_changed),
prop_edit, G_OBJECT (prop_edit));
- break;
-
- case G_TYPE_PARAM_OBJECT:
+ }
+ else if (type == G_TYPE_PARAM_OBJECT)
+ {
prop_edit = gtk_label_new ("");
g_object_connect_property (object, spec->name,
GTK_SIGNAL_FUNC (object_changed),
prop_edit, G_OBJECT (prop_edit));
- break;
-
-
- default:
+ }
+ else
+ {
msg = g_strdup_printf ("uneditable property type: %s",
g_type_name (G_PARAM_SPEC_TYPE (spec)));
prop_edit = gtk_label_new (msg);
g_free (msg);
gtk_misc_set_alignment (GTK_MISC (prop_edit), 0.0, 0.5);
}
-#endif
return prop_edit;
}