misc. properties
- From: Michael Meeks <michael ximian com>
- To: Owen Taylor <otaylor redhat com>
- Cc: Gtk Hackers <gtk-devel-list gnome org>
- Subject: misc. properties
- Date: Tue, 9 Oct 2001 04:32:46 -0400 (EDT)
Hi there,
I attach a patch to add 'enable_empty' and 'value_in_list'
properties to GtkCombo - which are noticably absent ( currently
working on libglade2 and don't want to add evil widget specific
hacks ); may I commit ?
Also I'm somewhat concerned that GtkEntry doesn't have a
'text' property; but it doesn't seem quite clear to me where to add it
- if at all. So; is this a feature ? should such a property be
registered against the GtkEditable interface ? should
g_param_spec_pool_lookup be traversing up the interface hierarchy for
registered interfaces - it doesn't seem to do that currently, but
perhaps I'm missing something.
In short - what is to be done for the best ?
Regards,
Michael.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.2370
diff -u -r1.2370 ChangeLog
--- ChangeLog 2001/10/08 21:54:16 1.2370
+++ ChangeLog 2001/10/09 08:31:59
@@ -1,3 +1,10 @@
+2001-10-10 Michael Meeks <michael ximian com>
+
+ * gtk/gtkcombo.c (gtk_combo_class_init): add enable_empty
+ and value_in_list properties.
+ (gtk_combo_set_value_in_list): notify change.
+ (gtk_combo_set_property, gtk_combo_get_property): impl. prop.
+
2001-10-08 Matthias Clasen <matthiasc poet de>
* gtk/gtkselection.c: s/succesfully/successfully/g
Index: gtk/gtkcombo.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcombo.c,v
retrieving revision 1.54
diff -u -r1.54 gtkcombo.c
--- gtk/gtkcombo.c 2001/08/11 20:27:36 1.54
+++ gtk/gtkcombo.c 2001/10/09 08:32:00
@@ -51,7 +51,9 @@
PROP_0,
PROP_ENABLE_ARROW_KEYS,
PROP_ENABLE_ARROWS_ALWAYS,
- PROP_CASE_SENSITIVE
+ PROP_CASE_SENSITIVE,
+ PROP_ENABLE_EMPTY,
+ PROP_VALUE_IN_LIST
};
static void gtk_combo_class_init (GtkComboClass *klass);
@@ -148,6 +150,22 @@
_("Whether list item matching is case sensitive"),
FALSE,
G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_ENABLE_EMPTY,
+ g_param_spec_boolean ("enable_empty",
+ _("Allow empty field"),
+ _("Whether the entry may be empty"),
+ TRUE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
+
+ g_object_class_install_property (gobject_class,
+ PROP_VALUE_IN_LIST,
+ g_param_spec_boolean ("value_in_list",
+ _("Restrict to listed"),
+ _("Whether to allow a value not in the list to be entered"),
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_WRITABLE));
oclass->destroy = gtk_combo_destroy;
@@ -876,6 +894,8 @@
combo->value_in_list = val;
combo->ok_if_empty = ok_if_empty;
+ g_object_notify (G_OBJECT (combo), "value_in_list");
+ g_object_notify (G_OBJECT (combo), "enable_empty");
}
void
@@ -1032,6 +1052,14 @@
/* This call does the notification */
gtk_combo_set_case_sensitive (combo, g_value_get_boolean (value));
break;
+ case PROP_ENABLE_EMPTY:
+ combo->ok_if_empty = g_value_get_boolean (value);
+ g_object_notify (G_OBJECT (combo), "enable_empty");
+ break;
+ case PROP_VALUE_IN_LIST:
+ combo->value_in_list = g_value_get_boolean (value);
+ g_object_notify (G_OBJECT (combo), "value_in_list");
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1057,6 +1085,12 @@
break;
case PROP_CASE_SENSITIVE:
g_value_set_boolean (value, combo->case_sensitive);
+ break;
+ case PROP_ENABLE_EMPTY:
+ g_value_set_boolean (value, combo->ok_if_empty);
+ break;
+ case PROP_VALUE_IN_LIST:
+ g_value_set_boolean (value, combo->value_in_list);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
--
mmeeks gnu org <><, Pseudo Engineer, itinerant idiot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]