summaryrefslogtreecommitdiff
path: root/src/glade-property-class.c
diff options
context:
space:
mode:
authorChema Celorio <chema@celorio.com>2001-07-11 04:34:59 +0000
committerJose Maria Celorio <chema@src.gnome.org>2001-07-11 04:34:59 +0000
commit9f2a507b76ba2d90e60696edc302ea4ed9a398f9 (patch)
treea107444010d41934930055c1deeb65a701f37e3e /src/glade-property-class.c
parentd020721f4224cc13069bd484bf1d41a1861f415f (diff)
downloadglade-9f2a507b76ba2d90e60696edc302ea4ed9a398f9.tar.gz
implement. (glade_gtk_option_menu_set_items): impl.
001-07-10 Chema Celorio <chema@celorio.com> * src/glade-gtk.c (glade_gtk_entry_set_text): implement. (glade_gtk_option_menu_set_items): impl. (glade_gtk_progress_bar_set_format): impl. * src/glade-editor.c (glade_editor_property_changed_text_view): implement. We can now use entries or GtkTextView for text properties 2001-07-09 Chema Celorio <chema@celorio.com> * widgets/*.xml: add props to several widgets * src/glade-placeholder.c (glade_placeholder_add): handle GtkHandleBox too * src/glade-widget-class.c (glade_widget_class_add_virtual_methods): handle GtkFrame too * src/glade-editor.c (glade_editor_property_changed_numeric): remove g_print's * src/glade-property-class.c (glade_property_get_parameters_text): imlement (glade_property_class_get_parameters_from_spec): and use here. We now load default text values. * widgets/gtkprogressbar.xml: add "text" which is the format * src/glade-project-window.c (glade_project_window_query_properties): set the default response
Diffstat (limited to 'src/glade-property-class.c')
-rw-r--r--src/glade-property-class.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/glade-property-class.c b/src/glade-property-class.c
index 2dffd8e2..dd6e5b98 100644
--- a/src/glade-property-class.c
+++ b/src/glade-property-class.c
@@ -315,6 +315,27 @@ glade_property_get_parameters_numeric (GParamSpec *spec,
}
static GList *
+glade_property_get_parameters_text (GParamSpec *spec,
+ GladePropertyClass *class)
+{
+ GladeParameter *parameter;
+ GList *list = NULL;
+
+ g_return_val_if_fail (G_IS_PARAM_SPEC_STRING (spec), NULL);
+
+ if (G_PARAM_SPEC_STRING (spec)->default_value != NULL) {
+ /* Get the default value */
+ parameter = glade_parameter_new ();
+ parameter->key = g_strdup ("Default");
+ parameter->value = g_strdup (G_PARAM_SPEC_STRING (spec)->default_value);
+
+ list = g_list_prepend (list, parameter);
+ }
+
+ return list;
+}
+
+static GList *
glade_property_get_parameters_choice (GParamSpec *spec,
GladePropertyClass *class)
{
@@ -360,20 +381,18 @@ glade_property_class_get_parameters_from_spec (GParamSpec *spec,
switch (class->type) {
case GLADE_PROPERTY_TYPE_CHOICE:
- parameters = glade_property_get_parameters_choice (spec,
- class);
+ parameters = glade_property_get_parameters_choice (spec, class);
break;
case GLADE_PROPERTY_TYPE_TEXT:
+ parameters = glade_property_get_parameters_text (spec, class);
break;
case GLADE_PROPERTY_TYPE_INTEGER:
case GLADE_PROPERTY_TYPE_FLOAT:
case GLADE_PROPERTY_TYPE_DOUBLE:
- parameters = glade_property_get_parameters_numeric (spec,
- class);
+ parameters = glade_property_get_parameters_numeric (spec, class);
break;
case GLADE_PROPERTY_TYPE_BOOLEAN:
- parameters = glade_property_get_parameters_boolean (spec,
- class);
+ parameters = glade_property_get_parameters_boolean (spec, class);
break;
case GLADE_PROPERTY_TYPE_OTHER_WIDGETS:
break;
@@ -419,6 +438,12 @@ glade_property_class_new_from_param_spec (const gchar *name,
class->tooltip = g_strdup (spec->blurb);
class->type = glade_property_class_get_type_from_spec (spec);
+ if (class->type == GLADE_PROPERTY_TYPE_ERROR) {
+ g_warning ("Could not create the \"%s\" property for the \"%s\" class\n",
+ name, widget_class->name);
+ return NULL;
+ }
+
if (class->type == GLADE_PROPERTY_TYPE_CHOICE)
class->choices = glade_property_class_get_choices_from_spec (spec);
@@ -451,9 +476,6 @@ glade_property_class_get_set_function (GladePropertyClass *class, const gchar *f
g_assert (class->set_function);
- g_print ("Got the %s function for %s\n",
- function_name, class->name);
-
return TRUE;
}