]> saetta.ns0.it Git - libgtkform/commitdiff
Changed functions namespace from form to gtk_form.
authorAndrea Zagli <azagli@libero.it>
Sun, 26 Jul 2009 15:03:37 +0000 (17:03 +0200)
committerAndrea Zagli <azagli@libero.it>
Sun, 26 Jul 2009 15:03:37 +0000 (17:03 +0200)
Changed objects prefix from Form to GtkForm.

32 files changed:
src/field.c
src/field.h
src/fieldboolean.c
src/fieldboolean.h
src/fielddatetime.c
src/fielddatetime.h
src/fieldfloat.c
src/fieldfloat.h
src/fieldinteger.c
src/fieldinteger.h
src/fieldtext.c
src/fieldtext.h
src/form.c
src/form.h
src/key.c
src/key.h
src/widget.c
src/widget.h
src/widgetcheck.c
src/widgetcheck.h
src/widgetcombobox.c
src/widgetcombobox.h
src/widgetentry.c
src/widgetentry.h
src/widgetlabel.c
src/widgetlabel.h
src/widgetspin.c
src/widgetspin.h
src/widgettextview.c
src/widgettextview.h
test/main.c
test/test.glade

index f99b56e46a416d013695e758c28386221a43b829..10cf34c35f3922e44b289729d908591766491154 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "widget.h"
@@ -28,22 +28,22 @@ enum
        PROP_WIDGET
 };
 
-static void form_field_class_init (FormFieldClass *klass);
-static void form_field_init (FormField *form_field);
+static void gtk_form_field_class_init (GtkFormFieldClass *klass);
+static void gtk_form_field_init (GtkFormField *gtk_form_field);
 
-static void form_field_set_property (GObject *object,
+static void gtk_form_field_set_property (GObject *object,
                                      guint property_id,
                                      const GValue *value,
                                      GParamSpec *pspec);
-static void form_field_get_property (GObject *object,
+static void gtk_form_field_get_property (GObject *object,
                                      guint property_id,
                                      GValue *value,
                                      GParamSpec *pspec);
 
-#define FORM_FIELD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD, FormFieldPrivate))
+#define GTK_FORM_FIELD_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_FIELD, GtkFormFieldPrivate))
 
-typedef struct _FormFieldPrivate FormFieldPrivate;
-struct _FormFieldPrivate
+typedef struct _GtkFormFieldPrivate GtkFormFieldPrivate;
+struct _GtkFormFieldPrivate
        {
                gchar *field;
                gboolean is_key;
@@ -51,45 +51,19 @@ struct _FormFieldPrivate
 
                GdaDataModel *dm;
 
-               FormWidget *widget;
+               GtkFormWidget *widget;
        };
 
 
-GType
-form_field_get_type (void)
-{
-       static GType form_field_type = 0;
-
-       if (!form_field_type)
-               {
-                       static const GTypeInfo form_field_info =
-                       {
-                               sizeof (FormFieldClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_field_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormField),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_field_init,
-                               NULL
-                       };
-
-                       form_field_type = g_type_register_static (G_TYPE_OBJECT, "FormField",
-                                                                 &form_field_info, 0);
-    }
-
-       return form_field_type;
-}
+G_DEFINE_TYPE (GtkFormField, gtk_form_field, G_TYPE_OBJECT)
 
 static void
-form_field_class_init (FormFieldClass *klass)
+gtk_form_field_class_init (GtkFormFieldClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
-       object_class->set_property = form_field_set_property;
-       object_class->get_property = form_field_get_property;
+       object_class->set_property = gtk_form_field_set_property;
+       object_class->get_property = gtk_form_field_get_property;
 
        klass->get_value_stringify = NULL;
        klass->get_value = NULL;
@@ -111,40 +85,40 @@ form_field_class_init (FormFieldClass *klass)
 
        g_object_class_install_property (object_class, PROP_WIDGET,
                                         g_param_spec_object ("form-widget",
-                                                             "FormWidget",
-                                                             "The FormWidget",
-                                                                                                                                                                                                                               TYPE_FORM_WIDGET,
+                                                             "GtkFormWidget",
+                                                             "The GtkFormWidget",
+                                                                                                                                                                                                                               TYPE_GTK_FORM_WIDGET,
                                                              G_PARAM_READWRITE));
 
-       g_type_class_add_private (object_class, sizeof (FormFieldPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormFieldPrivate));
 }
 
 static void
-form_field_init (FormField *form_field)
+gtk_form_field_init (GtkFormField *gtk_form_field)
 {
 }
 
 /**
- * form_field_new:
+ * gtk_form_field_new:
  *
- * Returns: the newly created #FormField.
+ * Returns: the newly created #GtkFormField.
  */
-FormField
-*form_field_new ()
+GtkFormField
+*gtk_form_field_new ()
 {
-       return g_object_new (TYPE_FORM_FIELD, NULL);
+       return g_object_new (TYPE_GTK_FORM_FIELD, NULL);
 }
 
 /**
- * form_field_new_from_form_widget:
+ * gtk_form_field_new_from_gtk_form_widget:
  * @fwidget:
  *
- * Returns: the newly created #FormField.
+ * Returns: the newly created #GtkFormField.
  */
-FormField
-*form_field_new_from_form_widget (FormWidget *fwidget)
+GtkFormField
+*gtk_form_field_new_from_gtk_form_widget (GtkFormWidget *fwidget)
 {
-       FormField *f = form_field_new ();
+       GtkFormField *f = gtk_form_field_new ();
 
        g_object_set (G_OBJECT (f),
                      "form-widget", fwidget,
@@ -154,116 +128,116 @@ FormField
 }
 
 /**
- * form_field_get_field_name:
+ * gtk_form_field_get_field_name:
  * @field:
  *
  * Returns: the field's name.
  */
 const gchar
-*form_field_get_field_name (FormField *field)
+*gtk_form_field_get_field_name (GtkFormField *field)
 {
-       FormFieldPrivate *priv = FORM_FIELD_GET_PRIVATE (field);
+       GtkFormFieldPrivate *priv = GTK_FORM_FIELD_GET_PRIVATE (field);
 
        return (const gchar *)g_strdup (priv->field);
 }
 
 /**
- * form_field_get_form_widget:
+ * gtk_form_field_get_gtk_form_widget:
  * @field:
  *
- * Return: the associated #FormWidget.
+ * Return: the associated #GtkFormWidget.
  */
-FormWidget
-*form_field_get_form_widget (FormField *field)
+GtkFormWidget
+*gtk_form_field_get_gtk_form_widget (GtkFormField *field)
 {
-       FormFieldPrivate *priv = FORM_FIELD_GET_PRIVATE (field);
+       GtkFormFieldPrivate *priv = GTK_FORM_FIELD_GET_PRIVATE (field);
 
-       return (FormWidget *)priv->widget;
+       return (GtkFormWidget *)priv->widget;
 }
 
 /**
- * form_field_get_value_stringify:
+ * gtk_form_field_get_value_stringify:
  * @field:
  *
  */
 const gchar
-*form_field_get_value_stringify (FormField *field)
+*gtk_form_field_get_value_stringify (GtkFormField *field)
 {
-       FORM_FIELD_GET_CLASS (field)->get_value_stringify (field);
+       GTK_FORM_FIELD_GET_CLASS (field)->get_value_stringify (field);
 }
 
 /**
- * form_field_get_value:
+ * gtk_form_field_get_value:
  * @field:
  *
  */
 const GValue
-*form_field_get_value (FormField *field)
+*gtk_form_field_get_value (GtkFormField *field)
 {
-       FORM_FIELD_GET_CLASS (field)->get_value (field);
+       GTK_FORM_FIELD_GET_CLASS (field)->get_value (field);
 }
 
 /**
- * form_field_get_value_sql:
+ * gtk_form_field_get_value_sql:
  * @field:
  *
  */
 const gchar
-*form_field_get_value_sql (FormField *field)
+*gtk_form_field_get_value_sql (GtkFormField *field)
 {
-       FORM_FIELD_GET_CLASS (field)->get_value_sql (field);
+       GTK_FORM_FIELD_GET_CLASS (field)->get_value_sql (field);
 }
 
 /**
- * form_field_clear:
+ * gtk_form_field_clear:
  * @field:
  *
  */
 gboolean
-form_field_clear (FormField *field)
+gtk_form_field_clear (GtkFormField *field)
 {
-       FORM_FIELD_GET_CLASS (field)->clear (field);
+       GTK_FORM_FIELD_GET_CLASS (field)->clear (field);
 }
 
 /**
- * form_field_is_empty:
+ * gtk_form_field_is_empty:
  * @field:
  *
  */
 gboolean
-form_field_is_empty (FormField *field)
+gtk_form_field_is_empty (GtkFormField *field)
 {
-       FORM_FIELD_GET_CLASS (field)->is_empty (field);
+       GTK_FORM_FIELD_GET_CLASS (field)->is_empty (field);
 }
 
 /**
- * form_field_set_from_datamodel:
+ * gtk_form_field_set_from_datamodel:
  * @field:
  * @dm:
  * @row:
  *
  */
 gboolean
-form_field_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+gtk_form_field_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row)
 {
-       FormFieldPrivate *priv = FORM_FIELD_GET_PRIVATE (field);
+       GtkFormFieldPrivate *priv = GTK_FORM_FIELD_GET_PRIVATE (field);
 
        if (priv->field != NULL && strcmp (priv->field, "") != 0)
                {
-                       FORM_FIELD_GET_CLASS (field)->set_from_datamodel (field, dm, row);
+                       GTK_FORM_FIELD_GET_CLASS (field)->set_from_datamodel (field, dm, row);
                }
 }
 
 /* PRIVATE */
 static void
-form_field_set_property (GObject *object,
+gtk_form_field_set_property (GObject *object,
                          guint property_id,
                          const GValue *value,
                          GParamSpec *pspec)
 {
-       FormField *field = (FormField *)object;
+       GtkFormField *field = (GtkFormField *)object;
 
-       FormFieldPrivate *priv = FORM_FIELD_GET_PRIVATE (field);
+       GtkFormFieldPrivate *priv = GTK_FORM_FIELD_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -290,19 +264,19 @@ form_field_set_property (GObject *object,
 }
 
 static void
-form_field_get_property (GObject *object,
+gtk_form_field_get_property (GObject *object,
                          guint property_id,
                          GValue *value,
                          GParamSpec *pspec)
 {
-       FormField *field = (FormField *)object;
+       GtkFormField *field = (GtkFormField *)object;
 
-       FormFieldPrivate *priv = FORM_FIELD_GET_PRIVATE (field);
+       GtkFormFieldPrivate *priv = GTK_FORM_FIELD_GET_PRIVATE (field);
 
        switch (property_id)
                {
                        case PROP_FIELD:
-                               g_value_set_string (value, form_field_get_field_name (field));
+                               g_value_set_string (value, gtk_form_field_get_field_name (field));
                                break;
 
                        case PROP_OBLIGATORY:
index 2de69648313beea835e38093fe484b15b6bf78c2..d4c7027f161a5f3edba38a23bea5f7a8f2bef4e6 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_FIELD_H__
-#define __LIBFORM_FIELD_H__
+#ifndef __LIBGTK_FORM_FIELD_H__
+#define __LIBGTK_FORM_FIELD_H__
 
 #include <glib.h>
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_FIELD                 (form_field_get_type ())
-#define FORM_FIELD(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD, FormField))
-#define FORM_FIELD_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD, FormFieldClass))
-#define IS_FORM_FIELD(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD))
-#define IS_FORM_FIELD_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD))
-#define FORM_FIELD_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD, FormFieldClass))
+#define TYPE_GTK_FORM_FIELD                 (gtk_form_field_get_type ())
+#define GTK_FORM_FIELD(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_FIELD, GtkFormField))
+#define GTK_FORM_FIELD_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_FIELD, GtkFormFieldClass))
+#define IS_GTK_FORM_FIELD(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_FIELD))
+#define IS_GTK_FORM_FIELD_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_FIELD))
+#define GTK_FORM_FIELD_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_FIELD, GtkFormFieldClass))
 
 
-typedef struct _FormField FormField;
-typedef struct _FormFieldClass FormFieldClass;
+typedef struct _GtkFormField GtkFormField;
+typedef struct _GtkFormFieldClass GtkFormFieldClass;
 
-struct _FormField
+struct _GtkFormField
        {
                GObject parent;
        };
 
-struct _FormFieldClass
+struct _GtkFormFieldClass
        {
                GObjectClass parent_class;
 
-               const gchar *(*get_value_stringify) (FormField *field);
-               const GValue *(*get_value) (FormField *field);
-               const gchar *(*get_value_sql) (FormField *field);
+               const gchar *(*get_value_stringify) (GtkFormField *field);
+               const GValue *(*get_value) (GtkFormField *field);
+               const gchar *(*get_value_sql) (GtkFormField *field);
 
-               gboolean (*clear) (FormField *field);
-               gboolean (*is_empty) (FormField *field);
-               gboolean (*set_from_datamodel) (FormField *field, GdaDataModel *dm, gint row);
+               gboolean (*clear) (GtkFormField *field);
+               gboolean (*is_empty) (GtkFormField *field);
+               gboolean (*set_from_datamodel) (GtkFormField *field, GdaDataModel *dm, gint row);
        };
 
-GType form_field_get_type (void) G_GNUC_CONST;
+GType gtk_form_field_get_type (void) G_GNUC_CONST;
 
-FormField *form_field_new (void);
-FormField *form_field_new_from_form_widget (FormWidget *fwidget);
+GtkFormField *gtk_form_field_new (void);
+GtkFormField *gtk_form_field_new_from_gtk_form_widget (GtkFormWidget *fwidget);
 
-const gchar *form_field_get_field_name (FormField *field);
-FormWidget *form_field_get_form_widget (FormField *field);
+const gchar *gtk_form_field_get_field_name (GtkFormField *field);
+GtkFormWidget *gtk_form_field_get_gtk_form_widget (GtkFormField *field);
 
-const gchar *form_field_get_value_stringify (FormField *field);
-const GValue *form_field_get_value (FormField *field);
-const gchar *form_field_get_value_sql (FormField *field);
+const gchar *gtk_form_field_get_value_stringify (GtkFormField *field);
+const GValue *gtk_form_field_get_value (GtkFormField *field);
+const gchar *gtk_form_field_get_value_sql (GtkFormField *field);
 
-gboolean form_field_clear (FormField *field);
+gboolean gtk_form_field_clear (GtkFormField *field);
 
-gboolean form_field_is_empty (FormField *field);
+gboolean gtk_form_field_is_empty (GtkFormField *field);
 
-gboolean form_field_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+gboolean gtk_form_field_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_FIELD_H__ */
+#endif /* __LIBGTK_FORM_FIELD_H__ */
index 4f36f7187aa5aa1c75ba990476b90b819d32b6ed..952992e200477621ab0627e55fc716d1c53e402f 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <string.h>
@@ -27,74 +27,48 @@ enum
        PROP_DEFAULT
 };
 
-static void form_field_boolean_class_init (FormFieldBooleanClass *klass);
-static void form_field_boolean_init (FormFieldBoolean *form_field);
+static void gtk_form_field_boolean_class_init (GtkFormFieldBooleanClass *klass);
+static void gtk_form_field_boolean_init (GtkFormFieldBoolean *gtk_form_field);
 
-static void form_field_boolean_set_property (GObject *object,
+static void gtk_form_field_boolean_set_property (GObject *object,
                                              guint property_id,
                                              const GValue *value,
                                              GParamSpec *pspec);
-static void form_field_boolean_get_property (GObject *object,
+static void gtk_form_field_boolean_get_property (GObject *object,
                                              guint property_id,
                                              GValue *value,
                                              GParamSpec *pspec);
 
-static gboolean form_field_boolean_set_value_stringify (FormField *field, const gchar *value);
+static gboolean gtk_form_field_boolean_set_value_stringify (GtkFormField *field, const gchar *value);
 
 static gboolean check_value (const gchar *value);
 
-#define FORM_FIELD_BOOLEAN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD_BOOLEAN, FormFieldBooleanPrivate))
+#define GTK_FORM_FIELD_BOOLEAN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_FIELD_BOOLEAN, GtkFormFieldBooleanPrivate))
 
-typedef struct _FormFieldBooleanPrivate FormFieldBooleanPrivate;
-struct _FormFieldBooleanPrivate
+typedef struct _GtkFormFieldBooleanPrivate GtkFormFieldBooleanPrivate;
+struct _GtkFormFieldBooleanPrivate
        {
                gboolean default_value;
        };
 
 
-GType
-form_field_boolean_get_type (void)
-{
-       static GType form_field_boolean_type = 0;
-
-       if (!form_field_boolean_type)
-               {
-                       static const GTypeInfo form_field_boolean_info =
-                       {
-                               sizeof (FormFieldBooleanClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_field_boolean_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormFieldBoolean),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_field_boolean_init,
-                               NULL
-                       };
-
-                       form_field_boolean_type = g_type_register_static (TYPE_FORM_FIELD, "FormFieldBoolean",
-                                                                         &form_field_boolean_info, 0);
-    }
-
-       return form_field_boolean_type;
-}
+G_DEFINE_TYPE (GtkFormFieldBoolean, gtk_form_field_boolean, TYPE_GTK_FORM_FIELD)
 
 static void
-form_field_boolean_class_init (FormFieldBooleanClass *klass)
+gtk_form_field_boolean_class_init (GtkFormFieldBooleanClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormFieldClass *field_class = FORM_FIELD_CLASS (klass);
+       GtkFormFieldClass *field_class = GTK_FORM_FIELD_CLASS (klass);
 
-       object_class->set_property = form_field_boolean_set_property;
-       object_class->get_property = form_field_boolean_get_property;
+       object_class->set_property = gtk_form_field_boolean_set_property;
+       object_class->get_property = gtk_form_field_boolean_get_property;
 
-       field_class->get_value_stringify = form_field_boolean_get_value_stringify;
-       field_class->get_value = form_field_boolean_get_value;
-       field_class->get_value_sql = form_field_boolean_get_value_sql;
-       field_class->clear = form_field_boolean_clear;
-       field_class->is_empty = form_field_boolean_is_empty;
-       field_class->set_from_datamodel = form_field_boolean_set_from_datamodel;
+       field_class->get_value_stringify = gtk_form_field_boolean_get_value_stringify;
+       field_class->get_value = gtk_form_field_boolean_get_value;
+       field_class->get_value_sql = gtk_form_field_boolean_get_value_sql;
+       field_class->clear = gtk_form_field_boolean_clear;
+       field_class->is_empty = gtk_form_field_boolean_is_empty;
+       field_class->set_from_datamodel = gtk_form_field_boolean_set_from_datamodel;
 
        g_object_class_install_property (object_class, PROP_DEFAULT,
                                         g_param_spec_boolean ("default",
@@ -103,60 +77,60 @@ form_field_boolean_class_init (FormFieldBooleanClass *klass)
                                                               FALSE,
                                                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
-       g_type_class_add_private (object_class, sizeof (FormFieldBooleanPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormFieldBooleanPrivate));
 }
 
 static void
-form_field_boolean_init (FormFieldBoolean *form_field)
+gtk_form_field_boolean_init (GtkFormFieldBoolean *gtk_form_field)
 {
 }
 
 /**
- * form_field_boolean_new:
+ * gtk_form_field_boolean_new:
  *
- * Returns: the newly created #FormFieldBoolean.
+ * Returns: the newly created #GtkFormFieldBoolean.
  */
-FormField
-*form_field_boolean_new ()
+GtkFormField
+*gtk_form_field_boolean_new ()
 {
-       return g_object_new (TYPE_FORM_FIELD_BOOLEAN, NULL);
+       return g_object_new (TYPE_GTK_FORM_FIELD_BOOLEAN, NULL);
 }
 
 /**
- * form_field_boolean_get_value_stringify:
+ * gtk_form_field_boolean_get_value_stringify:
  * @field:
  *
  */
 const gchar
-*form_field_boolean_get_value_stringify (FormField *field)
+*gtk_form_field_boolean_get_value_stringify (GtkFormField *field)
 {
        const gchar *ret = NULL;
 
-       FormWidget *fw;
+       GtkFormWidget *fw;
                
        g_object_get (field,
                      "form-widget", &fw,
                      NULL);
 
-       if (IS_FORM_WIDGET (fw))
+       if (IS_GTK_FORM_WIDGET (fw))
                {
-                       ret = form_widget_get_value_stringify (fw);
+                       ret = gtk_form_widget_get_value_stringify (fw);
                }
 
        return ret;
 }
 
 /**
- * form_field_boolean_get_value:
+ * gtk_form_field_boolean_get_value:
  * @field:
  *
  */
 const GValue
-*form_field_boolean_get_value (FormField *field)
+*gtk_form_field_boolean_get_value (GtkFormField *field)
 {
        GValue *ret = NULL;
 
-       const gchar *value = form_field_boolean_get_value_stringify (field);
+       const gchar *value = gtk_form_field_boolean_get_value_stringify (field);
 
        if (value != NULL)
                {
@@ -169,15 +143,15 @@ const GValue
 }
 
 /**
- * form_field_boolean_get_value_sql:
+ * gtk_form_field_boolean_get_value_sql:
  * @field:
  *
  */
 const gchar
-*form_field_boolean_get_value_sql (FormField *field)
+*gtk_form_field_boolean_get_value_sql (GtkFormField *field)
 {
        const gchar *ret = NULL;
-       const gchar *value = form_field_boolean_get_value_stringify (field);
+       const gchar *value = gtk_form_field_boolean_get_value_stringify (field);
 
        if (value != NULL)
                {
@@ -192,29 +166,29 @@ const gchar
 }
 
 /**
- * form_field_boolean_clear:
+ * gtk_form_field_boolean_clear:
  * @field:
  *
  */
 gboolean
-form_field_boolean_clear (FormField *field)
+gtk_form_field_boolean_clear (GtkFormField *field)
 {
        gboolean ret = FALSE;
 
-       FormFieldBooleanPrivate *priv = FORM_FIELD_BOOLEAN_GET_PRIVATE (field);
+       GtkFormFieldBooleanPrivate *priv = GTK_FORM_FIELD_BOOLEAN_GET_PRIVATE (field);
 
-       ret = form_field_boolean_set_value_stringify (field, g_strdup_printf ("%d", priv->default_value));
+       ret = gtk_form_field_boolean_set_value_stringify (field, g_strdup_printf ("%d", priv->default_value));
 
        return ret;
 }
 
 /**
- * form_field_boolean_is_empty:
+ * gtk_form_field_boolean_is_empty:
  * @field:
  *
  */
 gboolean
-form_field_boolean_is_empty (FormField *field)
+gtk_form_field_boolean_is_empty (GtkFormField *field)
 {
        gboolean ret = TRUE;
 
@@ -222,24 +196,24 @@ form_field_boolean_is_empty (FormField *field)
 }
 
 /**
- * form_field_boolean_set_from_datamodel:
+ * gtk_form_field_boolean_set_from_datamodel:
  * @field:
  * @dm:
  * @row:
  *
  */
 gboolean
-form_field_boolean_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+gtk_form_field_boolean_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row)
 {
        gboolean ret = FALSE;
-       const gchar *field_name = form_field_get_field_name (field);
+       const gchar *field_name = gtk_form_field_get_field_name (field);
 
        if (dm != NULL)
                {
                        gchar *value;
 
                        value = g_strdup_printf ("%d", gdaex_data_model_get_field_value_boolean_at (dm, row, field_name));              
-                       ret = form_field_boolean_set_value_stringify (field, value);
+                       ret = gtk_form_field_boolean_set_value_stringify (field, value);
                }
 
        return ret;
@@ -247,14 +221,14 @@ form_field_boolean_set_from_datamodel (FormField *field, GdaDataModel *dm, gint
 
 /* PRIVATE */
 static void
-form_field_boolean_set_property (GObject *object,
+gtk_form_field_boolean_set_property (GObject *object,
                                  guint property_id,
                                  const GValue *value,
                                  GParamSpec *pspec)
 {
-       FormFieldBoolean *field = (FormFieldBoolean *)object;
+       GtkFormFieldBoolean *field = (GtkFormFieldBoolean *)object;
 
-       FormFieldBooleanPrivate *priv = FORM_FIELD_BOOLEAN_GET_PRIVATE (field);
+       GtkFormFieldBooleanPrivate *priv = GTK_FORM_FIELD_BOOLEAN_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -269,14 +243,14 @@ form_field_boolean_set_property (GObject *object,
 }
 
 static void
-form_field_boolean_get_property (GObject *object,
+gtk_form_field_boolean_get_property (GObject *object,
                                  guint property_id,
                                  GValue *value,
                                  GParamSpec *pspec)
 {
-       FormFieldBoolean *field = (FormFieldBoolean *)object;
+       GtkFormFieldBoolean *field = (GtkFormFieldBoolean *)object;
 
-       FormFieldBooleanPrivate *priv = FORM_FIELD_BOOLEAN_GET_PRIVATE (field);
+       GtkFormFieldBooleanPrivate *priv = GTK_FORM_FIELD_BOOLEAN_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -291,16 +265,16 @@ form_field_boolean_get_property (GObject *object,
 }
 
 static gboolean
-form_field_boolean_set_value_stringify (FormField *field, const gchar *value)
+gtk_form_field_boolean_set_value_stringify (GtkFormField *field, const gchar *value)
 {
        gboolean ret = FALSE;
-       FormWidget *fw;
+       GtkFormWidget *fw;
 
        g_object_get (field,
                      "form-widget", &fw,
                      NULL);
 
-       ret = form_widget_set_value_stringify (fw, value);
+       ret = gtk_form_widget_set_value_stringify (fw, value);
 
        return ret;
 }
index 9d87359581987b84b9e2c528e0e051e2dd480657..f47f8fcc01fb269076712d4ae586bed793a21af1 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_FIELD_BOOLEAN_H__
-#define __LIBFORM_FIELD_BOOLEAN_H__
+#ifndef __LIBGTK_FORM_FIELD_BOOLEAN_H__
+#define __LIBGTK_FORM_FIELD_BOOLEAN_H__
 
 #include <libgdaex.h>
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_FIELD_BOOLEAN                 (form_field_boolean_get_type ())
-#define FORM_FIELD_BOOLEAN(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD_BOOLEAN, FormFieldBoolean))
-#define FORM_FIELD_BOOLEAN_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD_BOOLEAN, FormFieldBooleanClass))
-#define IS_FORM_FIELD_BOOLEAN(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD_BOOLEAN))
-#define IS_FORM_FIELD_BOOLEAN_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD_BOOLEAN))
-#define FORM_FIELD_BOOLEAN_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD_BOOLEAN, FormFieldBooleanClass))
+#define TYPE_GTK_FORM_FIELD_BOOLEAN                 (gtk_form_field_boolean_get_type ())
+#define GTK_FORM_FIELD_BOOLEAN(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_FIELD_BOOLEAN, GtkFormFieldBoolean))
+#define GTK_FORM_FIELD_BOOLEAN_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_FIELD_BOOLEAN, GtkFormFieldBooleanClass))
+#define IS_GTK_FORM_FIELD_BOOLEAN(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_FIELD_BOOLEAN))
+#define IS_GTK_FORM_FIELD_BOOLEAN_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_FIELD_BOOLEAN))
+#define GTK_FORM_FIELD_BOOLEAN_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_FIELD_BOOLEAN, GtkFormFieldBooleanClass))
 
 
-typedef struct _FormFieldBoolean FormFieldBoolean;
-typedef struct _FormFieldBooleanClass FormFieldBooleanClass;
+typedef struct _GtkFormFieldBoolean GtkFormFieldBoolean;
+typedef struct _GtkFormFieldBooleanClass GtkFormFieldBooleanClass;
 
-struct _FormFieldBoolean
+struct _GtkFormFieldBoolean
        {
-               FormField parent;
+               GtkFormField parent;
        };
 
-struct _FormFieldBooleanClass
+struct _GtkFormFieldBooleanClass
        {
-               FormFieldClass parent_class;
+               GtkFormFieldClass parent_class;
        };
 
-GType form_field_boolean_get_type (void) G_GNUC_CONST;
+GType gtk_form_field_boolean_get_type (void) G_GNUC_CONST;
 
-FormField *form_field_boolean_new (void);
+GtkFormField *gtk_form_field_boolean_new (void);
 
-const gchar *form_field_boolean_get_value_stringify (FormField *field);
-const GValue *form_field_boolean_get_value (FormField *field);
-const gchar *form_field_boolean_get_value_sql (FormField *field);
+const gchar *gtk_form_field_boolean_get_value_stringify (GtkFormField *field);
+const GValue *gtk_form_field_boolean_get_value (GtkFormField *field);
+const gchar *gtk_form_field_boolean_get_value_sql (GtkFormField *field);
 
-gboolean form_field_boolean_clear (FormField *field);
+gboolean gtk_form_field_boolean_clear (GtkFormField *field);
 
-gboolean form_field_boolean_is_empty (FormField *field);
+gboolean gtk_form_field_boolean_is_empty (GtkFormField *field);
 
-gboolean form_field_boolean_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+gboolean gtk_form_field_boolean_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_FIELD_BOOLEAN_H__ */
+#endif /* __LIBGTK_FORM_FIELD_BOOLEAN_H__ */
index 28a006bfe5b215f17f25a67a56a0da3db7659f0b..452fa11a4a9a1a815b7313e6e0ce2a53ea7999f1 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <string.h>
@@ -29,75 +29,49 @@ enum
        PROP_TYPE
 };
 
-static void form_field_datetime_class_init (FormFieldDateTimeClass *klass);
-static void form_field_datetime_init (FormFieldDateTime *form_field);
+static void gtk_form_field_datetime_class_init (GtkFormFieldDateTimeClass *klass);
+static void gtk_form_field_datetime_init (GtkFormFieldDateTime *gtk_form_field);
 
-static void form_field_datetime_set_property (GObject *object,
+static void gtk_form_field_datetime_set_property (GObject *object,
                                               guint property_id,
                                               const GValue *value,
                                               GParamSpec *pspec);
-static void form_field_datetime_get_property (GObject *object,
+static void gtk_form_field_datetime_get_property (GObject *object,
                                               guint property_id,
                                               GValue *value,
                                               GParamSpec *pspec);
 
-static gboolean form_field_datetime_set_value_stringify (FormField *field, const gchar *value);
+static gboolean gtk_form_field_datetime_set_value_stringify (GtkFormField *field, const gchar *value);
 
-static gchar *form_field_get_str_format (FormField *field);
+static gchar *gtk_form_field_get_str_format (GtkFormField *field);
 
-#define FORM_FIELD_DATETIME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD_DATETIME, FormFieldDateTimePrivate))
+#define GTK_FORM_FIELD_DATETIME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_FIELD_DATETIME, GtkFormFieldDateTimePrivate))
 
-typedef struct _FormFieldDateTimePrivate FormFieldDateTimePrivate;
-struct _FormFieldDateTimePrivate
+typedef struct _GtkFormFieldDateTimePrivate GtkFormFieldDateTimePrivate;
+struct _GtkFormFieldDateTimePrivate
        {
                struct tm *default_value;
                gint type;
        };
 
 
-GType
-form_field_datetime_get_type (void)
-{
-       static GType form_field_datetime_type = 0;
-
-       if (!form_field_datetime_type)
-               {
-                       static const GTypeInfo form_field_datetime_info =
-                       {
-                               sizeof (FormFieldDateTimeClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_field_datetime_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormFieldDateTime),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_field_datetime_init,
-                               NULL
-                       };
-
-                       form_field_datetime_type = g_type_register_static (TYPE_FORM_FIELD, "FormFieldDateTime",
-                                                                          &form_field_datetime_info, 0);
-    }
-
-       return form_field_datetime_type;
-}
+G_DEFINE_TYPE (GtkFormFieldDateTime, gtk_form_field_datetime, TYPE_GTK_FORM_FIELD)
 
 static void
-form_field_datetime_class_init (FormFieldDateTimeClass *klass)
+gtk_form_field_datetime_class_init (GtkFormFieldDateTimeClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormFieldClass *field_class = FORM_FIELD_CLASS (klass);
+       GtkFormFieldClass *field_class = GTK_FORM_FIELD_CLASS (klass);
 
-       object_class->set_property = form_field_datetime_set_property;
-       object_class->get_property = form_field_datetime_get_property;
+       object_class->set_property = gtk_form_field_datetime_set_property;
+       object_class->get_property = gtk_form_field_datetime_get_property;
 
-       field_class->get_value_stringify = form_field_datetime_get_value_stringify;
-       field_class->get_value = form_field_datetime_get_value;
-       field_class->get_value_sql = form_field_datetime_get_value_sql;
-       field_class->clear = form_field_datetime_clear;
-       field_class->is_empty = form_field_datetime_is_empty;
-       field_class->set_from_datamodel = form_field_datetime_set_from_datamodel;
+       field_class->get_value_stringify = gtk_form_field_datetime_get_value_stringify;
+       field_class->get_value = gtk_form_field_datetime_get_value;
+       field_class->get_value_sql = gtk_form_field_datetime_get_value_sql;
+       field_class->clear = gtk_form_field_datetime_clear;
+       field_class->is_empty = gtk_form_field_datetime_is_empty;
+       field_class->set_from_datamodel = gtk_form_field_datetime_set_from_datamodel;
 
        g_object_class_install_property (object_class, PROP_DEFAULT,
                                         g_param_spec_pointer ("default",
@@ -111,65 +85,65 @@ form_field_datetime_class_init (FormFieldDateTimeClass *klass)
                                                           "Type",
                                                           G_MININT,
                                                           G_MAXINT,
-                                                          FORM_FIELD_DATETIME_TYPE_DATETIME,
+                                                          GTK_FORM_FIELD_DATETIME_TYPE_DATETIME,
                                                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
-       g_type_class_add_private (object_class, sizeof (FormFieldDateTimePrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormFieldDateTimePrivate));
 }
 
 static void
-form_field_datetime_init (FormFieldDateTime *form_field)
+gtk_form_field_datetime_init (GtkFormFieldDateTime *gtk_form_field)
 {
 }
 
 /**
- * form_field_datetime_new:
+ * gtk_form_field_datetime_new:
  *
- * Returns: the newly created #FormFieldDateTime.
+ * Returns: the newly created #GtkFormFieldDateTime.
  */
-FormField
-*form_field_datetime_new ()
+GtkFormField
+*gtk_form_field_datetime_new ()
 {
-       return g_object_new (TYPE_FORM_FIELD_DATETIME, NULL);
+       return g_object_new (TYPE_GTK_FORM_FIELD_DATETIME, NULL);
 }
 
 /**
- * form_field_datetime_get_value_stringify:
+ * gtk_form_field_datetime_get_value_stringify:
  * @field:
  *
  */
 const gchar
-*form_field_datetime_get_value_stringify (FormField *field)
+*gtk_form_field_datetime_get_value_stringify (GtkFormField *field)
 {
        const gchar *ret = NULL;
 
-       FormWidget *fw;
+       GtkFormWidget *fw;
 
        g_object_get (field,
                      "form-widget", &fw,
                      NULL);
 
-       if (IS_FORM_WIDGET (fw))
+       if (IS_GTK_FORM_WIDGET (fw))
                {
-                       ret = form_widget_get_value_stringify (fw);
+                       ret = gtk_form_widget_get_value_stringify (fw);
                }
 
        return ret;
 }
 
 /**
- * form_field_datetime_get_value:
+ * gtk_form_field_datetime_get_value:
  * @field:
  *
  */
 const GValue
-*form_field_datetime_get_value (FormField *field)
+*gtk_form_field_datetime_get_value (GtkFormField *field)
 {
        struct tm datetime;
        GValue *ret = NULL;
-       const gchar *format = form_field_get_str_format (field);
+       const gchar *format = gtk_form_field_get_str_format (field);
 
-       const gchar *value = form_field_datetime_get_value_stringify (field);
+       const gchar *value = gtk_form_field_datetime_get_value_stringify (field);
 
        if (value != NULL && strptime (value, format, &datetime) != '\0')
                {
@@ -182,16 +156,16 @@ const GValue
 }
 
 /**
- * form_field_datetime_get_value_sql:
+ * gtk_form_field_datetime_get_value_sql:
  * @field:
  *
  */
 const gchar
-*form_field_datetime_get_value_sql (FormField *field)
+*gtk_form_field_datetime_get_value_sql (GtkFormField *field)
 {
        const gchar *ret = NULL;
-       const gchar *value = form_field_datetime_get_value_stringify (field);
-       const gchar *format = form_field_get_str_format (field);
+       const gchar *value = gtk_form_field_datetime_get_value_stringify (field);
+       const gchar *format = gtk_form_field_get_str_format (field);
 
        if (value != NULL)
                {
@@ -214,17 +188,17 @@ const gchar
 }
 
 /**
- * form_field_datetime_clear:
+ * gtk_form_field_datetime_clear:
  * @field:
  *
  */
 gboolean
-form_field_datetime_clear (FormField *field)
+gtk_form_field_datetime_clear (GtkFormField *field)
 {
        gboolean ret = FALSE;
-       gchar *format = form_field_get_str_format (field);
+       gchar *format = gtk_form_field_get_str_format (field);
 
-       FormFieldDateTimePrivate *priv = FORM_FIELD_DATETIME_GET_PRIVATE (field);
+       GtkFormFieldDateTimePrivate *priv = GTK_FORM_FIELD_DATETIME_GET_PRIVATE (field);
 
        if (priv->default_value != NULL)
                {
@@ -234,7 +208,7 @@ form_field_datetime_clear (FormField *field)
 
                        if (strftime (buf, 100, format, priv->default_value) != '\0')
                                {
-                                       ret = form_field_datetime_set_value_stringify (field, buf);
+                                       ret = gtk_form_field_datetime_set_value_stringify (field, buf);
                                }
                }
 
@@ -242,12 +216,12 @@ form_field_datetime_clear (FormField *field)
 }
 
 /**
- * form_field_datetime_is_empty:
+ * gtk_form_field_datetime_is_empty:
  * @field:
  *
  */
 gboolean
-form_field_datetime_is_empty (FormField *field)
+gtk_form_field_datetime_is_empty (GtkFormField *field)
 {
        gboolean ret = TRUE;
 
@@ -255,21 +229,21 @@ form_field_datetime_is_empty (FormField *field)
 }
 
 /**
- * form_field_datetime_set_from_datamodel:
+ * gtk_form_field_datetime_set_from_datamodel:
  * @field:
  * @dm:
  * @row:
  *
  */
 gboolean
-form_field_datetime_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+gtk_form_field_datetime_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row)
 {
        gboolean ret = FALSE;
-       const gchar *field_name = form_field_get_field_name (field);
+       const gchar *field_name = gtk_form_field_get_field_name (field);
 
        if (dm != NULL)
                {
-                       ret = form_field_datetime_set_value_stringify (field,
+                       ret = gtk_form_field_datetime_set_value_stringify (field,
                              gdaex_data_model_get_field_value_stringify_at (dm, row, field_name));
                }
 
@@ -278,14 +252,14 @@ form_field_datetime_set_from_datamodel (FormField *field, GdaDataModel *dm, gint
 
 /* PRIVATE */
 static void
-form_field_datetime_set_property (GObject *object,
+gtk_form_field_datetime_set_property (GObject *object,
                                   guint property_id,
                                   const GValue *value,
                                   GParamSpec *pspec)
 {
-       FormFieldDateTime *field = (FormFieldDateTime *)object;
+       GtkFormFieldDateTime *field = (GtkFormFieldDateTime *)object;
 
-       FormFieldDateTimePrivate *priv = FORM_FIELD_DATETIME_GET_PRIVATE (field);
+       GtkFormFieldDateTimePrivate *priv = GTK_FORM_FIELD_DATETIME_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -304,14 +278,14 @@ form_field_datetime_set_property (GObject *object,
 }
 
 static void
-form_field_datetime_get_property (GObject *object,
+gtk_form_field_datetime_get_property (GObject *object,
                                   guint property_id,
                                   GValue *value,
                                   GParamSpec *pspec)
 {
-       FormFieldDateTime *field = (FormFieldDateTime *)object;
+       GtkFormFieldDateTime *field = (GtkFormFieldDateTime *)object;
 
-       FormFieldDateTimePrivate *priv = FORM_FIELD_DATETIME_GET_PRIVATE (field);
+       GtkFormFieldDateTimePrivate *priv = GTK_FORM_FIELD_DATETIME_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -330,43 +304,43 @@ form_field_datetime_get_property (GObject *object,
 }
 
 static gboolean
-form_field_datetime_set_value_stringify (FormField *field, const gchar *value)
+gtk_form_field_datetime_set_value_stringify (GtkFormField *field, const gchar *value)
 {
        gboolean ret = FALSE;
-       FormWidget *fw;
+       GtkFormWidget *fw;
 
        g_object_get (field,
                      "form-widget", &fw,
                      NULL);
 
-       ret = form_widget_set_value_stringify (fw, value);
+       ret = gtk_form_widget_set_value_stringify (fw, value);
 
        return ret;
 }
 
 /**
- * form_field_get_str_format:
+ * gtk_form_field_get_str_format:
  * @field:
  *
  */
 static gchar
-*form_field_get_str_format (FormField *field)
+*gtk_form_field_get_str_format (GtkFormField *field)
 {
        gchar *format;
 
-       FormFieldDateTimePrivate *priv = FORM_FIELD_DATETIME_GET_PRIVATE (field);
+       GtkFormFieldDateTimePrivate *priv = GTK_FORM_FIELD_DATETIME_GET_PRIVATE (field);
 
        switch (priv->type)
                {
-                       case FORM_FIELD_DATETIME_TYPE_DATETIME:
+                       case GTK_FORM_FIELD_DATETIME_TYPE_DATETIME:
                                format = g_strdup ("%F %T");
                                break;
 
-                       case FORM_FIELD_DATETIME_TYPE_DATE:
+                       case GTK_FORM_FIELD_DATETIME_TYPE_DATE:
                                format = g_strdup ("%F");
                                break;
 
-                       case FORM_FIELD_DATETIME_TYPE_TIME:
+                       case GTK_FORM_FIELD_DATETIME_TYPE_TIME:
                                format = g_strdup ("%T");
                                break;
                }
index 49c6f049d03d264d66d70f74aad435481385db21..3d85e7bb667e01a1ed0c861948b663b734c1b798 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_FIELD_DATETIME_H__
-#define __LIBFORM_FIELD_DATETIME_H__
+#ifndef __LIBGTK_FORM_FIELD_DATETIME_H__
+#define __LIBGTK_FORM_FIELD_DATETIME_H__
 
 #include <libgdaex.h>
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_FIELD_DATETIME                 (form_field_datetime_get_type ())
-#define FORM_FIELD_DATETIME(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD_DATETIME, FormFieldDateTime))
-#define FORM_FIELD_DATETIME_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD_DATETIME, FormFieldDateTimeClass))
-#define IS_FORM_FIELD_DATETIME(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD_DATETIME))
-#define IS_FORM_FIELD_DATETIME_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD_DATETIME))
-#define FORM_FIELD_DATETIME_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD_DATETIME, FormFieldDateTimeClass))
+#define TYPE_GTK_FORM_FIELD_DATETIME                 (gtk_form_field_datetime_get_type ())
+#define GTK_FORM_FIELD_DATETIME(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_FIELD_DATETIME, GtkFormFieldDateTime))
+#define GTK_FORM_FIELD_DATETIME_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_FIELD_DATETIME, GtkFormFieldDateTimeClass))
+#define IS_GTK_FORM_FIELD_DATETIME(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_FIELD_DATETIME))
+#define IS_GTK_FORM_FIELD_DATETIME_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_FIELD_DATETIME))
+#define GTK_FORM_FIELD_DATETIME_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_FIELD_DATETIME, GtkFormFieldDateTimeClass))
 
 
-typedef struct _FormFieldDateTime FormFieldDateTime;
-typedef struct _FormFieldDateTimeClass FormFieldDateTimeClass;
+typedef struct _GtkFormFieldDateTime GtkFormFieldDateTime;
+typedef struct _GtkFormFieldDateTimeClass GtkFormFieldDateTimeClass;
 
-struct _FormFieldDateTime
+struct _GtkFormFieldDateTime
        {
-               FormField parent;
+               GtkFormField parent;
        };
 
-struct _FormFieldDateTimeClass
+struct _GtkFormFieldDateTimeClass
        {
-               FormFieldClass parent_class;
+               GtkFormFieldClass parent_class;
        };
 
-GType form_field_datetime_get_type (void) G_GNUC_CONST;
+GType gtk_form_field_datetime_get_type (void) G_GNUC_CONST;
 
 enum
 {
-       FORM_FIELD_DATETIME_TYPE_DATETIME,
-       FORM_FIELD_DATETIME_TYPE_DATE,
-       FORM_FIELD_DATETIME_TYPE_TIME
+       GTK_FORM_FIELD_DATETIME_TYPE_DATETIME,
+       GTK_FORM_FIELD_DATETIME_TYPE_DATE,
+       GTK_FORM_FIELD_DATETIME_TYPE_TIME
 };
 
-FormField *form_field_datetime_new (void);
+GtkFormField *gtk_form_field_datetime_new (void);
 
-const gchar *form_field_datetime_get_value_stringify (FormField *field);
-const GValue *form_field_datetime_get_value (FormField *field);
-const gchar *form_field_datetime_get_value_sql (FormField *field);
+const gchar *gtk_form_field_datetime_get_value_stringify (GtkFormField *field);
+const GValue *gtk_form_field_datetime_get_value (GtkFormField *field);
+const gchar *gtk_form_field_datetime_get_value_sql (GtkFormField *field);
 
-gboolean form_field_datetime_clear (FormField *field);
+gboolean gtk_form_field_datetime_clear (GtkFormField *field);
 
-gboolean form_field_datetime_is_empty (FormField *field);
+gboolean gtk_form_field_datetime_is_empty (GtkFormField *field);
 
-gboolean form_field_datetime_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+gboolean gtk_form_field_datetime_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_FIELD_DATETIME_H__ */
+#endif /* __LIBGTK_FORM_FIELD_DATETIME_H__ */
index 019f01b88006badbe9b1fa90ad91e5d640fffcb9..449bba02e6d6df1292351918bba7c69c9840da7b 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <locale.h>
@@ -27,72 +27,46 @@ enum
        PROP_DEFAULT
 };
 
-static void form_field_float_class_init (FormFieldFloatClass *klass);
-static void form_field_float_init (FormFieldFloat *form_field);
+static void gtk_form_field_float_class_init (GtkFormFieldFloatClass *klass);
+static void gtk_form_field_float_init (GtkFormFieldFloat *gtk_form_field);
 
-static void form_field_float_set_property (GObject *object,
+static void gtk_form_field_float_set_property (GObject *object,
                                            guint property_id,
                                            const GValue *value,
                                            GParamSpec *pspec);
-static void form_field_float_get_property (GObject *object,
+static void gtk_form_field_float_get_property (GObject *object,
                                            guint property_id,
                                            GValue *value,
                                            GParamSpec *pspec);
 
-static gboolean form_field_float_set_value_stringify (FormField *field, const gchar *value);
+static gboolean gtk_form_field_float_set_value_stringify (GtkFormField *field, const gchar *value);
 
-#define FORM_FIELD_FLOAT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD_FLOAT, FormFieldFloatPrivate))
+#define GTK_FORM_FIELD_FLOAT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_FIELD_FLOAT, GtkFormFieldFloatPrivate))
 
-typedef struct _FormFieldFloatPrivate FormFieldFloatPrivate;
-struct _FormFieldFloatPrivate
+typedef struct _GtkFormFieldFloatPrivate GtkFormFieldFloatPrivate;
+struct _GtkFormFieldFloatPrivate
        {
                gfloat default_value;
        };
 
 
-GType
-form_field_float_get_type (void)
-{
-       static GType form_field_float_type = 0;
-
-       if (!form_field_float_type)
-               {
-                       static const GTypeInfo form_field_float_info =
-                       {
-                               sizeof (FormFieldFloatClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_field_float_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormFieldFloat),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_field_float_init,
-                               NULL
-                       };
-
-                       form_field_float_type = g_type_register_static (TYPE_FORM_FIELD, "FormFieldFloat",
-                                                                       &form_field_float_info, 0);
-    }
-
-       return form_field_float_type;
-}
+G_DEFINE_TYPE (GtkFormFieldFloat, gtk_form_field_float, TYPE_GTK_FORM_FIELD)
 
 static void
-form_field_float_class_init (FormFieldFloatClass *klass)
+gtk_form_field_float_class_init (GtkFormFieldFloatClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormFieldClass *field_class = FORM_FIELD_CLASS (klass);
+       GtkFormFieldClass *field_class = GTK_FORM_FIELD_CLASS (klass);
 
-       object_class->set_property = form_field_float_set_property;
-       object_class->get_property = form_field_float_get_property;
+       object_class->set_property = gtk_form_field_float_set_property;
+       object_class->get_property = gtk_form_field_float_get_property;
 
-       field_class->get_value_stringify = form_field_float_get_value_stringify;
-       field_class->get_value = form_field_float_get_value;
-       field_class->get_value_sql = form_field_float_get_value_sql;
-       field_class->clear = form_field_float_clear;
-       field_class->is_empty = form_field_float_is_empty;
-       field_class->set_from_datamodel = form_field_float_set_from_datamodel;
+       field_class->get_value_stringify = gtk_form_field_float_get_value_stringify;
+       field_class->get_value = gtk_form_field_float_get_value;
+       field_class->get_value_sql = gtk_form_field_float_get_value_sql;
+       field_class->clear = gtk_form_field_float_clear;
+       field_class->is_empty = gtk_form_field_float_is_empty;
+       field_class->set_from_datamodel = gtk_form_field_float_set_from_datamodel;
 
        g_object_class_install_property (object_class, PROP_DEFAULT,
                                         g_param_spec_float ("default",
@@ -101,60 +75,60 @@ form_field_float_class_init (FormFieldFloatClass *klass)
                                                             -G_MAXFLOAT, G_MAXFLOAT, 0.0f,
                                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
-       g_type_class_add_private (object_class, sizeof (FormFieldFloatPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormFieldFloatPrivate));
 }
 
 static void
-form_field_float_init (FormFieldFloat *form_field)
+gtk_form_field_float_init (GtkFormFieldFloat *gtk_form_field)
 {
 }
 
 /**
- * form_field_float_new:
+ * gtk_form_field_float_new:
  *
- * Returns: the newly created #FormFieldFloat.
+ * Returns: the newly created #GtkFormFieldFloat.
  */
-FormField
-*form_field_float_new ()
+GtkFormField
+*gtk_form_field_float_new ()
 {
-       return g_object_new (TYPE_FORM_FIELD_FLOAT, NULL);
+       return g_object_new (TYPE_GTK_FORM_FIELD_FLOAT, NULL);
 }
 
 /**
- * form_field_float_get_value_stringify:
+ * gtk_form_field_float_get_value_stringify:
  * @field:
  *
  */
 const gchar
-*form_field_float_get_value_stringify (FormField *field)
+*gtk_form_field_float_get_value_stringify (GtkFormField *field)
 {
        const gchar *ret = NULL;
 
-       FormWidget *fw;
+       GtkFormWidget *fw;
                
        g_object_get (field,
                      "form-widget", &fw,
                      NULL);
 
-       if (IS_FORM_WIDGET (fw))
+       if (IS_GTK_FORM_WIDGET (fw))
                {
-                       ret = g_strdup_printf ("%f", strtod (form_widget_get_value_stringify (fw), NULL));
+                       ret = g_strdup_printf ("%f", strtod (gtk_form_widget_get_value_stringify (fw), NULL));
                }
 
        return ret;
 }
 
 /**
- * form_field_float_get_value:
+ * gtk_form_field_float_get_value:
  * @field:
  *
  */
 const GValue
-*form_field_float_get_value (FormField *field)
+*gtk_form_field_float_get_value (GtkFormField *field)
 {
        GValue *ret = NULL;
 
-       const gchar *value = form_field_float_get_value_stringify (field);
+       const gchar *value = gtk_form_field_float_get_value_stringify (field);
 
        if (value != NULL)
                {
@@ -167,15 +141,15 @@ const GValue
 }
 
 /**
- * form_field_float_get_value_sql:
+ * gtk_form_field_float_get_value_sql:
  * @field:
  *
  */
 const gchar
-*form_field_float_get_value_sql (FormField *field)
+*gtk_form_field_float_get_value_sql (GtkFormField *field)
 {
        const gchar *ret = NULL;
-       const gchar *value = form_field_float_get_value_stringify (field);
+       const gchar *value = gtk_form_field_float_get_value_stringify (field);
 
        if (value != NULL)
                {
@@ -193,34 +167,34 @@ const gchar
 }
 
 /**
- * form_field_float_clear:
+ * gtk_form_field_float_clear:
  * @field:
  *
  */
 gboolean
-form_field_float_clear (FormField *field)
+gtk_form_field_float_clear (GtkFormField *field)
 {
        gboolean ret = FALSE;
 
-       FormFieldFloatPrivate *priv = FORM_FIELD_FLOAT_GET_PRIVATE (field);
+       GtkFormFieldFloatPrivate *priv = GTK_FORM_FIELD_FLOAT_GET_PRIVATE (field);
 
-       ret = form_field_float_set_value_stringify (field, g_strdup_printf ("%f", priv->default_value));
+       ret = gtk_form_field_float_set_value_stringify (field, g_strdup_printf ("%f", priv->default_value));
 
        return ret;
 }
 
 /**
- * form_field_float_is_empty:
+ * gtk_form_field_float_is_empty:
  * @field:
  *
  */
 gboolean
-form_field_float_is_empty (FormField *field)
+gtk_form_field_float_is_empty (GtkFormField *field)
 {
        gboolean ret = TRUE;
        const gchar *value;
 
-       value = form_field_float_get_value_stringify (field);
+       value = gtk_form_field_float_get_value_stringify (field);
 
        if (strtod (value, NULL) == 0.0f)
                {
@@ -231,21 +205,21 @@ form_field_float_is_empty (FormField *field)
 }
 
 /**
- * form_field_float_set_from_datamodel:
+ * gtk_form_field_float_set_from_datamodel:
  * @field:
  * @dm:
  * @row:
  *
  */
 gboolean
-form_field_float_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+gtk_form_field_float_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row)
 {
        gboolean ret = FALSE;
-       const gchar *field_name = form_field_get_field_name (field);
+       const gchar *field_name = gtk_form_field_get_field_name (field);
 
        if (dm != NULL)
                {
-                       ret = form_field_float_set_value_stringify (field,
+                       ret = gtk_form_field_float_set_value_stringify (field,
                                                                                gdaex_data_model_get_field_value_stringify_at (dm, row, field_name));
                }
 
@@ -254,14 +228,14 @@ form_field_float_set_from_datamodel (FormField *field, GdaDataModel *dm, gint ro
 
 /* PRIVATE */
 static void
-form_field_float_set_property (GObject *object,
+gtk_form_field_float_set_property (GObject *object,
                                guint property_id,
                                const GValue *value,
                                GParamSpec *pspec)
 {
-       FormFieldFloat *field = (FormFieldFloat *)object;
+       GtkFormFieldFloat *field = (GtkFormFieldFloat *)object;
 
-       FormFieldFloatPrivate *priv = FORM_FIELD_FLOAT_GET_PRIVATE (field);
+       GtkFormFieldFloatPrivate *priv = GTK_FORM_FIELD_FLOAT_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -276,14 +250,14 @@ form_field_float_set_property (GObject *object,
 }
 
 static void
-form_field_float_get_property (GObject *object,
+gtk_form_field_float_get_property (GObject *object,
                                guint property_id,
                                GValue *value,
                                GParamSpec *pspec)
 {
-       FormFieldFloat *field = (FormFieldFloat *)object;
+       GtkFormFieldFloat *field = (GtkFormFieldFloat *)object;
 
-       FormFieldFloatPrivate *priv = FORM_FIELD_FLOAT_GET_PRIVATE (field);
+       GtkFormFieldFloatPrivate *priv = GTK_FORM_FIELD_FLOAT_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -298,16 +272,16 @@ form_field_float_get_property (GObject *object,
 }
 
 static gboolean
-form_field_float_set_value_stringify (FormField *field, const gchar *value)
+gtk_form_field_float_set_value_stringify (GtkFormField *field, const gchar *value)
 {
        gboolean ret = FALSE;
-       FormWidget *fw;
+       GtkFormWidget *fw;
 
        g_object_get (field,
                      "form-widget", &fw,
                      NULL);
 
-       ret = form_widget_set_value_stringify (fw, value);
+       ret = gtk_form_widget_set_value_stringify (fw, value);
 
        return ret;
 }
index 58801a7363011c32d65afabc658dc48974ad8b04..efb1e1c2463e282926cd19da0446e4fe9f06e065 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_FIELD_FLOAT_H__
-#define __LIBFORM_FIELD_FLOAT_H__
+#ifndef __LIBGTK_FORM_FIELD_FLOAT_H__
+#define __LIBGTK_FORM_FIELD_FLOAT_H__
 
 #include <libgdaex.h>
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_FIELD_FLOAT                 (form_field_float_get_type ())
-#define FORM_FIELD_FLOAT(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD_FLOAT, FormFieldFloat))
-#define FORM_FIELD_FLOAT_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD_FLOAT, FormFieldFloatClass))
-#define IS_FORM_FIELD_FLOAT(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD_FLOAT))
-#define IS_FORM_FIELD_FLOAT_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD_FLOAT))
-#define FORM_FIELD_FLOAT_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD_FLOAT, FormFieldFloatClass))
+#define TYPE_GTK_FORM_FIELD_FLOAT                 (gtk_form_field_float_get_type ())
+#define GTK_FORM_FIELD_FLOAT(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_FIELD_FLOAT, GtkFormFieldFloat))
+#define GTK_FORM_FIELD_FLOAT_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_FIELD_FLOAT, GtkFormFieldFloatClass))
+#define IS_GTK_FORM_FIELD_FLOAT(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_FIELD_FLOAT))
+#define IS_GTK_FORM_FIELD_FLOAT_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_FIELD_FLOAT))
+#define GTK_FORM_FIELD_FLOAT_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_FIELD_FLOAT, GtkFormFieldFloatClass))
 
 
-typedef struct _FormFieldFloat FormFieldFloat;
-typedef struct _FormFieldFloatClass FormFieldFloatClass;
+typedef struct _GtkFormFieldFloat GtkFormFieldFloat;
+typedef struct _GtkFormFieldFloatClass GtkFormFieldFloatClass;
 
-struct _FormFieldFloat
+struct _GtkFormFieldFloat
        {
-               FormField parent;
+               GtkFormField parent;
        };
 
-struct _FormFieldFloatClass
+struct _GtkFormFieldFloatClass
        {
-               FormFieldClass parent_class;
+               GtkFormFieldClass parent_class;
        };
 
-GType form_field_float_get_type (void) G_GNUC_CONST;
+GType gtk_form_field_float_get_type (void) G_GNUC_CONST;
 
-FormField *form_field_float_new (void);
+GtkFormField *gtk_form_field_float_new (void);
 
-const gchar *form_field_float_get_value_stringify (FormField *field);
-const GValue *form_field_float_get_value (FormField *field);
-const gchar *form_field_float_get_value_sql (FormField *field);
+const gchar *gtk_form_field_float_get_value_stringify (GtkFormField *field);
+const GValue *gtk_form_field_float_get_value (GtkFormField *field);
+const gchar *gtk_form_field_float_get_value_sql (GtkFormField *field);
 
-gboolean form_field_float_clear (FormField *field);
+gboolean gtk_form_field_float_clear (GtkFormField *field);
 
-gboolean form_field_float_is_empty (FormField *field);
+gboolean gtk_form_field_float_is_empty (GtkFormField *field);
 
-gboolean form_field_float_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+gboolean gtk_form_field_float_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_FIELD_FLOAT_H__ */
+#endif /* __LIBGTK_FORM_FIELD_FLOAT_H__ */
index 32403c67b5052e3effc550a71aa067cd62792508..bb4ca7d2ac7b7b999ab3bf8e0f6cca7693d9f1b4 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "widget.h"
@@ -25,72 +25,46 @@ enum
        PROP_DEFAULT
 };
 
-static void form_field_integer_class_init (FormFieldIntegerClass *klass);
-static void form_field_integer_init (FormFieldInteger *form_field);
+static void gtk_form_field_integer_class_init (GtkFormFieldIntegerClass *klass);
+static void gtk_form_field_integer_init (GtkFormFieldInteger *gtk_form_field);
 
-static void form_field_integer_set_property (GObject *object,
+static void gtk_form_field_integer_set_property (GObject *object,
                                              guint property_id,
                                              const GValue *value,
                                              GParamSpec *pspec);
-static void form_field_integer_get_property (GObject *object,
+static void gtk_form_field_integer_get_property (GObject *object,
                                              guint property_id,
                                              GValue *value,
                                              GParamSpec *pspec);
 
-static gboolean form_field_integer_set_value_stringify (FormField *field, const gchar *value);
+static gboolean gtk_form_field_integer_set_value_stringify (GtkFormField *field, const gchar *value);
 
-#define FORM_FIELD_INTEGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD_INTEGER, FormFieldIntegerPrivate))
+#define GTK_FORM_FIELD_INTEGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_FIELD_INTEGER, GtkFormFieldIntegerPrivate))
 
-typedef struct _FormFieldIntegerPrivate FormFieldIntegerPrivate;
-struct _FormFieldIntegerPrivate
+typedef struct _GtkFormFieldIntegerPrivate GtkFormFieldIntegerPrivate;
+struct _GtkFormFieldIntegerPrivate
        {
                gint default_value;
        };
 
 
-GType
-form_field_integer_get_type (void)
-{
-       static GType form_field_integer_type = 0;
-
-       if (!form_field_integer_type)
-               {
-                       static const GTypeInfo form_field_integer_info =
-                       {
-                               sizeof (FormFieldIntegerClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_field_integer_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormFieldInteger),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_field_integer_init,
-                               NULL
-                       };
-
-                       form_field_integer_type = g_type_register_static (TYPE_FORM_FIELD, "FormFieldInteger",
-                                                                         &form_field_integer_info, 0);
-    }
-
-       return form_field_integer_type;
-}
+G_DEFINE_TYPE (GtkFormFieldInteger, gtk_form_field_integer, TYPE_GTK_FORM_FIELD)
 
 static void
-form_field_integer_class_init (FormFieldIntegerClass *klass)
+gtk_form_field_integer_class_init (GtkFormFieldIntegerClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormFieldClass *field_class = FORM_FIELD_CLASS (klass);
+       GtkFormFieldClass *field_class = GTK_FORM_FIELD_CLASS (klass);
 
-       object_class->set_property = form_field_integer_set_property;
-       object_class->get_property = form_field_integer_get_property;
+       object_class->set_property = gtk_form_field_integer_set_property;
+       object_class->get_property = gtk_form_field_integer_get_property;
 
-       field_class->get_value_stringify = form_field_integer_get_value_stringify;
-       field_class->get_value = form_field_integer_get_value;
-       field_class->get_value_sql = form_field_integer_get_value_sql;
-       field_class->clear = form_field_integer_clear;
-       field_class->is_empty = form_field_integer_is_empty;
-       field_class->set_from_datamodel = form_field_integer_set_from_datamodel;
+       field_class->get_value_stringify = gtk_form_field_integer_get_value_stringify;
+       field_class->get_value = gtk_form_field_integer_get_value;
+       field_class->get_value_sql = gtk_form_field_integer_get_value_sql;
+       field_class->clear = gtk_form_field_integer_clear;
+       field_class->is_empty = gtk_form_field_integer_is_empty;
+       field_class->set_from_datamodel = gtk_form_field_integer_set_from_datamodel;
 
        g_object_class_install_property (object_class, PROP_DEFAULT,
                                         g_param_spec_int ("default",
@@ -99,60 +73,60 @@ form_field_integer_class_init (FormFieldIntegerClass *klass)
                                                           G_MININT, G_MAXINT, 0,
                                                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
-       g_type_class_add_private (object_class, sizeof (FormFieldIntegerPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormFieldIntegerPrivate));
 }
 
 static void
-form_field_integer_init (FormFieldInteger *form_field)
+gtk_form_field_integer_init (GtkFormFieldInteger *gtk_form_field)
 {
 }
 
 /**
- * form_field_integer_new:
+ * gtk_form_field_integer_new:
  *
- * Returns: the newly created #FormFieldInteger.
+ * Returns: the newly created #GtkFormFieldInteger.
  */
-FormField
-*form_field_integer_new ()
+GtkFormField
+*gtk_form_field_integer_new ()
 {
-       return g_object_new (TYPE_FORM_FIELD_INTEGER, NULL);
+       return g_object_new (TYPE_GTK_FORM_FIELD_INTEGER, NULL);
 }
 
 /**
- * form_field_integer_get_value_stringify:
+ * gtk_form_field_integer_get_value_stringify:
  * @field:
  *
  */
 const gchar
-*form_field_integer_get_value_stringify (FormField *field)
+*gtk_form_field_integer_get_value_stringify (GtkFormField *field)
 {
        const gchar *ret = NULL;
 
-       FormWidget *fw;
+       GtkFormWidget *fw;
                
        g_object_get (field,
                      "form-widget", &fw,
                      NULL);
 
-       if (IS_FORM_WIDGET (fw))
+       if (IS_GTK_FORM_WIDGET (fw))
                {
-                       ret = g_strdup_printf ("%d", strtol (form_widget_get_value_stringify (fw), NULL, 10));
+                       ret = g_strdup_printf ("%d", strtol (gtk_form_widget_get_value_stringify (fw), NULL, 10));
                }
 
        return ret;
 }
 
 /**
- * form_field_integer_get_value:
+ * gtk_form_field_integer_get_value:
  * @field:
  *
  */
 const GValue
-*form_field_integer_get_value (FormField *field)
+*gtk_form_field_integer_get_value (GtkFormField *field)
 {
        GValue *ret = NULL;
 
-       const gchar *value = form_field_integer_get_value_stringify (field);
+       const gchar *value = gtk_form_field_integer_get_value_stringify (field);
 
        if (value != NULL)
                {
@@ -165,15 +139,15 @@ const GValue
 }
 
 /**
- * form_field_integer_get_value_sql:
+ * gtk_form_field_integer_get_value_sql:
  * @field:
  *
  */
 const gchar
-*form_field_integer_get_value_sql (FormField *field)
+*gtk_form_field_integer_get_value_sql (GtkFormField *field)
 {
        const gchar *ret = NULL;
-       const gchar *value = form_field_integer_get_value_stringify (field);
+       const gchar *value = gtk_form_field_integer_get_value_stringify (field);
 
        if (value != NULL)
                {
@@ -184,34 +158,34 @@ const gchar
 }
 
 /**
- * form_field_integer_clear:
+ * gtk_form_field_integer_clear:
  * @field:
  *
  */
 gboolean
-form_field_integer_clear (FormField *field)
+gtk_form_field_integer_clear (GtkFormField *field)
 {
        gboolean ret = FALSE;
 
-       FormFieldIntegerPrivate *priv = FORM_FIELD_INTEGER_GET_PRIVATE (field);
+       GtkFormFieldIntegerPrivate *priv = GTK_FORM_FIELD_INTEGER_GET_PRIVATE (field);
 
-       ret = form_field_integer_set_value_stringify (field, g_strdup_printf ("%d", priv->default_value));
+       ret = gtk_form_field_integer_set_value_stringify (field, g_strdup_printf ("%d", priv->default_value));
 
        return ret;
 }
 
 /**
- * form_field_integer_is_empty:
+ * gtk_form_field_integer_is_empty:
  * @field:
  *
  */
 gboolean
-form_field_integer_is_empty (FormField *field)
+gtk_form_field_integer_is_empty (GtkFormField *field)
 {
        gboolean ret = TRUE;
        const gchar *value;
 
-       value = form_field_integer_get_value_stringify (field);
+       value = gtk_form_field_integer_get_value_stringify (field);
 
        if (strtol (value, NULL, 10) == 0)
                {
@@ -222,21 +196,21 @@ form_field_integer_is_empty (FormField *field)
 }
 
 /**
- * form_field_integer_set_from_datamodel:
+ * gtk_form_field_integer_set_from_datamodel:
  * @field:
  * @dm:
  * @row:
  *
  */
 gboolean
-form_field_integer_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+gtk_form_field_integer_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row)
 {
        gboolean ret = FALSE;
-       const gchar *field_name = form_field_get_field_name (field);
+       const gchar *field_name = gtk_form_field_get_field_name (field);
 
        if (dm != NULL)
                {
-                       ret = form_field_integer_set_value_stringify (field,
+                       ret = gtk_form_field_integer_set_value_stringify (field,
                                                                                  gdaex_data_model_get_field_value_stringify_at (dm, row, field_name));
                }
 
@@ -245,14 +219,14 @@ form_field_integer_set_from_datamodel (FormField *field, GdaDataModel *dm, gint
 
 /* PRIVATE */
 static void
-form_field_integer_set_property (GObject *object,
+gtk_form_field_integer_set_property (GObject *object,
                                  guint property_id,
                                  const GValue *value,
                                  GParamSpec *pspec)
 {
-       FormFieldInteger *field = (FormFieldInteger *)object;
+       GtkFormFieldInteger *field = (GtkFormFieldInteger *)object;
 
-       FormFieldIntegerPrivate *priv = FORM_FIELD_INTEGER_GET_PRIVATE (field);
+       GtkFormFieldIntegerPrivate *priv = GTK_FORM_FIELD_INTEGER_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -267,14 +241,14 @@ form_field_integer_set_property (GObject *object,
 }
 
 static void
-form_field_integer_get_property (GObject *object,
+gtk_form_field_integer_get_property (GObject *object,
                                  guint property_id,
                                  GValue *value,
                                  GParamSpec *pspec)
 {
-       FormFieldInteger *field = (FormFieldInteger *)object;
+       GtkFormFieldInteger *field = (GtkFormFieldInteger *)object;
 
-       FormFieldIntegerPrivate *priv = FORM_FIELD_INTEGER_GET_PRIVATE (field);
+       GtkFormFieldIntegerPrivate *priv = GTK_FORM_FIELD_INTEGER_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -289,16 +263,16 @@ form_field_integer_get_property (GObject *object,
 }
 
 static gboolean
-form_field_integer_set_value_stringify (FormField *field, const gchar *value)
+gtk_form_field_integer_set_value_stringify (GtkFormField *field, const gchar *value)
 {
        gboolean ret = FALSE;
-       FormWidget *fw;
+       GtkFormWidget *fw;
 
        g_object_get (field,
                      "form-widget", &fw,
                      NULL);
 
-       ret = form_widget_set_value_stringify (fw, value);
+       ret = gtk_form_widget_set_value_stringify (fw, value);
 
        return ret;
 }
index 28c741e84b8d1dfcbfe12592183ab78030665529..68ce8e08d0322ce3da3a3a41bcfeb9c06253a9ac 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_FIELD_INTEGER_H__
-#define __LIBFORM_FIELD_INTEGER_H__
+#ifndef __LIBGTK_FORM_FIELD_INTEGER_H__
+#define __LIBGTK_FORM_FIELD_INTEGER_H__
 
 #include <libgdaex.h>
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_FIELD_INTEGER                 (form_field_integer_get_type ())
-#define FORM_FIELD_INTEGER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD_INTEGER, FormFieldInteger))
-#define FORM_FIELD_INTEGER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD_INTEGER, FormFieldIntegerClass))
-#define IS_FORM_FIELD_INTEGER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD_INTEGER))
-#define IS_FORM_FIELD_INTEGER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD_INTEGER))
-#define FORM_FIELD_INTEGER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD_INTEGER, FormFieldIntegerClass))
+#define TYPE_GTK_FORM_FIELD_INTEGER                 (gtk_form_field_integer_get_type ())
+#define GTK_FORM_FIELD_INTEGER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_FIELD_INTEGER, GtkFormFieldInteger))
+#define GTK_FORM_FIELD_INTEGER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_FIELD_INTEGER, GtkFormFieldIntegerClass))
+#define IS_GTK_FORM_FIELD_INTEGER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_FIELD_INTEGER))
+#define IS_GTK_FORM_FIELD_INTEGER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_FIELD_INTEGER))
+#define GTK_FORM_FIELD_INTEGER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_FIELD_INTEGER, GtkFormFieldIntegerClass))
 
 
-typedef struct _FormFieldInteger FormFieldInteger;
-typedef struct _FormFieldIntegerClass FormFieldIntegerClass;
+typedef struct _GtkFormFieldInteger GtkFormFieldInteger;
+typedef struct _GtkFormFieldIntegerClass GtkFormFieldIntegerClass;
 
-struct _FormFieldInteger
+struct _GtkFormFieldInteger
        {
-               FormField parent;
+               GtkFormField parent;
        };
 
-struct _FormFieldIntegerClass
+struct _GtkFormFieldIntegerClass
        {
-               FormFieldClass parent_class;
+               GtkFormFieldClass parent_class;
        };
 
-GType form_field_integer_get_type (void) G_GNUC_CONST;
+GType gtk_form_field_integer_get_type (void) G_GNUC_CONST;
 
-FormField *form_field_integer_new (void);
+GtkFormField *gtk_form_field_integer_new (void);
 
-const gchar *form_field_integer_get_value_stringify (FormField *field);
-const GValue *form_field_integer_get_value (FormField *field);
-const gchar *form_field_integer_get_value_sql (FormField *field);
+const gchar *gtk_form_field_integer_get_value_stringify (GtkFormField *field);
+const GValue *gtk_form_field_integer_get_value (GtkFormField *field);
+const gchar *gtk_form_field_integer_get_value_sql (GtkFormField *field);
 
-gboolean form_field_integer_clear (FormField *field);
+gboolean gtk_form_field_integer_clear (GtkFormField *field);
 
-gboolean form_field_integer_is_empty (FormField *field);
+gboolean gtk_form_field_integer_is_empty (GtkFormField *field);
 
-gboolean form_field_integer_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+gboolean gtk_form_field_integer_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_FIELD_INTEGER_H__ */
+#endif /* __LIBGTK_FORM_FIELD_INTEGER_H__ */
index c25aaf97dd767643753c6984fffd9ee58a938f9e..0510976d33fc3f0c2ebf14e34db54f5395934e36 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "widget.h"
@@ -25,72 +25,46 @@ enum
        PROP_DEFAULT
 };
 
-static void form_field_text_class_init (FormFieldTextClass *klass);
-static void form_field_text_init (FormFieldText *form_field);
+static void gtk_form_field_text_class_init (GtkFormFieldTextClass *klass);
+static void gtk_form_field_text_init (GtkFormFieldText *gtk_form_field);
 
-static void form_field_text_set_property (GObject *object,
+static void gtk_form_field_text_set_property (GObject *object,
                                           guint property_id,
                                           const GValue *value,
                                           GParamSpec *pspec);
-static void form_field_text_get_property (GObject *object,
+static void gtk_form_field_text_get_property (GObject *object,
                                           guint property_id,
                                           GValue *value,
                                           GParamSpec *pspec);
 
-static gboolean form_field_text_set_value_stringify (FormField *field, const gchar *value);
+static gboolean gtk_form_field_text_set_value_stringify (GtkFormField *field, const gchar *value);
 
-#define FORM_FIELD_TEXT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_FIELD_TEXT, FormFieldTextPrivate))
+#define GTK_FORM_FIELD_TEXT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_FIELD_TEXT, GtkFormFieldTextPrivate))
 
-typedef struct _FormFieldTextPrivate FormFieldTextPrivate;
-struct _FormFieldTextPrivate
+typedef struct _GtkFormFieldTextPrivate GtkFormFieldTextPrivate;
+struct _GtkFormFieldTextPrivate
        {
                gchar *default_value;
        };
 
 
-GType
-form_field_text_get_type (void)
-{
-       static GType form_field_text_type = 0;
-
-       if (!form_field_text_type)
-               {
-                       static const GTypeInfo form_field_text_info =
-                       {
-                               sizeof (FormFieldTextClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_field_text_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormFieldText),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_field_text_init,
-                               NULL
-                       };
-
-                       form_field_text_type = g_type_register_static (TYPE_FORM_FIELD, "FormFieldText",
-                                                                      &form_field_text_info, 0);
-    }
-
-       return form_field_text_type;
-}
+G_DEFINE_TYPE (GtkFormFieldText, gtk_form_field_text, TYPE_GTK_FORM_FIELD)
 
 static void
-form_field_text_class_init (FormFieldTextClass *klass)
+gtk_form_field_text_class_init (GtkFormFieldTextClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormFieldClass *field_class = FORM_FIELD_CLASS (klass);
+       GtkFormFieldClass *field_class = GTK_FORM_FIELD_CLASS (klass);
 
-       object_class->set_property = form_field_text_set_property;
-       object_class->get_property = form_field_text_get_property;
+       object_class->set_property = gtk_form_field_text_set_property;
+       object_class->get_property = gtk_form_field_text_get_property;
 
-       field_class->get_value_stringify = form_field_text_get_value_stringify;
-       field_class->get_value = form_field_text_get_value;
-       field_class->get_value_sql = form_field_text_get_value_sql;
-       field_class->clear = form_field_text_clear;
-       field_class->is_empty = form_field_text_is_empty;
-       field_class->set_from_datamodel = form_field_text_set_from_datamodel;
+       field_class->get_value_stringify = gtk_form_field_text_get_value_stringify;
+       field_class->get_value = gtk_form_field_text_get_value;
+       field_class->get_value_sql = gtk_form_field_text_get_value_sql;
+       field_class->clear = gtk_form_field_text_clear;
+       field_class->is_empty = gtk_form_field_text_is_empty;
+       field_class->set_from_datamodel = gtk_form_field_text_set_from_datamodel;
 
        g_object_class_install_property (object_class, PROP_DEFAULT,
                                         g_param_spec_string ("default",
@@ -99,60 +73,60 @@ form_field_text_class_init (FormFieldTextClass *klass)
                                                              "",
                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
-       g_type_class_add_private (object_class, sizeof (FormFieldTextPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormFieldTextPrivate));
 }
 
 static void
-form_field_text_init (FormFieldText *form_field)
+gtk_form_field_text_init (GtkFormFieldText *gtk_form_field)
 {
 }
 
 /**
- * form_field_text_new:
+ * gtk_form_field_text_new:
  *
- * Returns: the newly created #FormFieldText.
+ * Returns: the newly created #GtkFormFieldText.
  */
-FormField
-*form_field_text_new ()
+GtkFormField
+*gtk_form_field_text_new ()
 {
-       return g_object_new (TYPE_FORM_FIELD_TEXT, NULL);
+       return g_object_new (TYPE_GTK_FORM_FIELD_TEXT, NULL);
 }
 
 /**
- * form_field_text_get_value_stringify:
+ * gtk_form_field_text_get_value_stringify:
  * @field:
  *
  */
 const gchar
-*form_field_text_get_value_stringify (FormField *field)
+*gtk_form_field_text_get_value_stringify (GtkFormField *field)
 {
        const gchar *ret = NULL;
 
-       FormWidget *fw;
+       GtkFormWidget *fw;
                
        g_object_get (field,
                      "form-widget", &fw,
                      NULL);
 
-       if (IS_FORM_WIDGET (fw))
+       if (IS_GTK_FORM_WIDGET (fw))
                {
-                       ret = form_widget_get_value_stringify (fw);
+                       ret = gtk_form_widget_get_value_stringify (fw);
                }
 
        return ret;
 }
 
 /**
- * form_field_text_get_value:
+ * gtk_form_field_text_get_value:
  * @field:
  *
  */
 const GValue
-*form_field_text_get_value (FormField *field)
+*gtk_form_field_text_get_value (GtkFormField *field)
 {
        GValue *ret = NULL;
 
-       const gchar *value = form_field_text_get_value_stringify (field);
+       const gchar *value = gtk_form_field_text_get_value_stringify (field);
 
        if (value != NULL)
                {
@@ -165,15 +139,15 @@ const GValue
 }
 
 /**
- * form_field_text_get_value_sql:
+ * gtk_form_field_text_get_value_sql:
  * @field:
  *
  */
 const gchar
-*form_field_text_get_value_sql (FormField *field)
+*gtk_form_field_text_get_value_sql (GtkFormField *field)
 {
        const gchar *ret = NULL;
-       const gchar *value = form_field_text_get_value_stringify (field);
+       const gchar *value = gtk_form_field_text_get_value_stringify (field);
 
        if (value != NULL)
                {
@@ -184,34 +158,34 @@ const gchar
 }
 
 /**
- * form_field_text_clear:
+ * gtk_form_field_text_clear:
  * @field:
  *
  */
 gboolean
-form_field_text_clear (FormField *field)
+gtk_form_field_text_clear (GtkFormField *field)
 {
        gboolean ret = FALSE;
 
-       FormFieldTextPrivate *priv = FORM_FIELD_TEXT_GET_PRIVATE (field);
+       GtkFormFieldTextPrivate *priv = GTK_FORM_FIELD_TEXT_GET_PRIVATE (field);
 
-       ret = form_field_text_set_value_stringify (field, priv->default_value);
+       ret = gtk_form_field_text_set_value_stringify (field, priv->default_value);
 
        return ret;
 }
 
 /**
- * form_field_text_is_empty:
+ * gtk_form_field_text_is_empty:
  * @field:
  *
  */
 gboolean
-form_field_text_is_empty (FormField *field)
+gtk_form_field_text_is_empty (GtkFormField *field)
 {
        gboolean ret = TRUE;
        const gchar *value;
 
-       value = form_field_text_get_value_stringify (field);
+       value = gtk_form_field_text_get_value_stringify (field);
 
        if (strcmp (value, "") == 0)
                {
@@ -222,21 +196,21 @@ form_field_text_is_empty (FormField *field)
 }
 
 /**
- * form_field_text_set_from_datamodel:
+ * gtk_form_field_text_set_from_datamodel:
  * @field:
  * @dm:
  * @row:
  *
  */
 gboolean
-form_field_text_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row)
+gtk_form_field_text_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row)
 {
        gboolean ret = FALSE;
-       const gchar *field_name = form_field_get_field_name (field);
+       const gchar *field_name = gtk_form_field_get_field_name (field);
 
        if (dm != NULL)
                {
-                       ret = form_field_text_set_value_stringify (field,
+                       ret = gtk_form_field_text_set_value_stringify (field,
                                                                               gdaex_data_model_get_field_value_stringify_at (dm, row, field_name));
                }
 
@@ -245,14 +219,14 @@ form_field_text_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row
 
 /* PRIVATE */
 static void
-form_field_text_set_property (GObject *object,
+gtk_form_field_text_set_property (GObject *object,
                               guint property_id,
                               const GValue *value,
                               GParamSpec *pspec)
 {
-       FormFieldText *field = (FormFieldText *)object;
+       GtkFormFieldText *field = (GtkFormFieldText *)object;
 
-       FormFieldTextPrivate *priv = FORM_FIELD_TEXT_GET_PRIVATE (field);
+       GtkFormFieldTextPrivate *priv = GTK_FORM_FIELD_TEXT_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -267,14 +241,14 @@ form_field_text_set_property (GObject *object,
 }
 
 static void
-form_field_text_get_property (GObject *object,
+gtk_form_field_text_get_property (GObject *object,
                               guint property_id,
                               GValue *value,
                               GParamSpec *pspec)
 {
-       FormFieldText *field = (FormFieldText *)object;
+       GtkFormFieldText *field = (GtkFormFieldText *)object;
 
-       FormFieldTextPrivate *priv = FORM_FIELD_TEXT_GET_PRIVATE (field);
+       GtkFormFieldTextPrivate *priv = GTK_FORM_FIELD_TEXT_GET_PRIVATE (field);
 
        switch (property_id)
                {
@@ -289,16 +263,16 @@ form_field_text_get_property (GObject *object,
 }
 
 static gboolean
-form_field_text_set_value_stringify (FormField *field, const gchar *value)
+gtk_form_field_text_set_value_stringify (GtkFormField *field, const gchar *value)
 {
        gboolean ret = FALSE;
-       FormWidget *fw;
+       GtkFormWidget *fw;
 
        g_object_get (field,
                      "form-widget", &fw,
                      NULL);
 
-       ret = form_widget_set_value_stringify (fw, value);
+       ret = gtk_form_widget_set_value_stringify (fw, value);
 
        return ret;
 }
index 15fd909d84e20262bad33ed77f937dea7a24b829..4ec5b4433f6b6a3da4faca6e6add4316996ac2c4 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_FIELD_TEXT_H__
-#define __LIBFORM_FIELD_TEXT_H__
+#ifndef __LIBGTK_FORM_FIELD_TEXT_H__
+#define __LIBGTK_FORM_FIELD_TEXT_H__
 
 #include <libgdaex.h>
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_FIELD_TEXT                 (form_field_text_get_type ())
-#define FORM_FIELD_TEXT(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_FIELD_TEXT, FormFieldText))
-#define FORM_FIELD_TEXT_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_FIELD_TEXT, FormFieldTextClass))
-#define IS_FORM_FIELD_TEXT(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_FIELD_TEXT))
-#define IS_FORM_FIELD_TEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_FIELD_TEXT))
-#define FORM_FIELD_TEXT_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_FIELD_TEXT, FormFieldTextClass))
+#define TYPE_GTK_FORM_FIELD_TEXT                 (gtk_form_field_text_get_type ())
+#define GTK_FORM_FIELD_TEXT(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_FIELD_TEXT, GtkFormFieldText))
+#define GTK_FORM_FIELD_TEXT_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_FIELD_TEXT, GtkFormFieldTextClass))
+#define IS_GTK_FORM_FIELD_TEXT(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_FIELD_TEXT))
+#define IS_GTK_FORM_FIELD_TEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_FIELD_TEXT))
+#define GTK_FORM_FIELD_TEXT_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_FIELD_TEXT, GtkFormFieldTextClass))
 
 
-typedef struct _FormFieldText FormFieldText;
-typedef struct _FormFieldTextClass FormFieldTextClass;
+typedef struct _GtkFormFieldText GtkFormFieldText;
+typedef struct _GtkFormFieldTextClass GtkFormFieldTextClass;
 
-struct _FormFieldText
+struct _GtkFormFieldText
        {
-               FormField parent;
+               GtkFormField parent;
        };
 
-struct _FormFieldTextClass
+struct _GtkFormFieldTextClass
        {
-               FormFieldClass parent_class;
+               GtkFormFieldClass parent_class;
        };
 
-GType form_field_text_get_type (void) G_GNUC_CONST;
+GType gtk_form_field_text_get_type (void) G_GNUC_CONST;
 
-FormField *form_field_text_new (void);
+GtkFormField *gtk_form_field_text_new (void);
 
-const gchar *form_field_text_get_value_stringify (FormField *field);
-const GValue *form_field_text_get_value (FormField *field);
-const gchar *form_field_text_get_value_sql (FormField *field);
+const gchar *gtk_form_field_text_get_value_stringify (GtkFormField *field);
+const GValue *gtk_form_field_text_get_value (GtkFormField *field);
+const gchar *gtk_form_field_text_get_value_sql (GtkFormField *field);
 
-gboolean form_field_text_clear (FormField *field);
+gboolean gtk_form_field_text_clear (GtkFormField *field);
 
-gboolean form_field_text_is_empty (FormField *field);
+gboolean gtk_form_field_text_is_empty (GtkFormField *field);
 
-gboolean form_field_text_set_from_datamodel (FormField *field, GdaDataModel *dm, gint row);
+gboolean gtk_form_field_text_set_from_datamodel (GtkFormField *field, GdaDataModel *dm, gint row);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_FIELD_TEXT_H__ */
+#endif /* __LIBGTK_FORM_FIELD_TEXT_H__ */
index 60db4ccb20ce9c0ca68e6af1c98157f8cb5d4530..4c9eef0cba236ad46a229b288437669fdafe4f61 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #ifdef HAVE_CONFIG_H
@@ -31,70 +31,43 @@ enum
        PROP_KEY
 };
 
-static void form_class_init (FormClass *class);
-static void form_init (Form *form);
+static void gtk_form_class_init (GtkFormClass *class);
+static void gtk_form_init (GtkForm *form);
 
-static void form_set_property (GObject *object,
+static void gtk_form_set_property (GObject *object,
                                guint property_id,
                                const GValue *value,
                                GParamSpec *pspec);
-static void form_get_property (GObject *object,
+static void gtk_form_get_property (GObject *object,
                                guint property_id,
                                GValue *value,
                                GParamSpec *pspec);
 
-#define FORM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM, FormPrivate))
+#define GTK_FORM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM, GtkFormPrivate))
 
-typedef struct _FormPrivate FormPrivate;
-struct _FormPrivate
+typedef struct _GtkFormPrivate GtkFormPrivate;
+struct _GtkFormPrivate
        {
                GList *fields;
 
                gchar *table;
-               FormKey *key;
+               GtkFormKey *key;
        };
 
-
-GType
-form_get_type (void)
-{
-  static GType form_type = 0;
-
-  if (!form_type)
-    {
-      static const GTypeInfo form_info =
-      {
-        sizeof (FormClass),
-        NULL,          /* base_init */
-        NULL,          /* base_finalize */
-        (GClassInitFunc) form_class_init,
-        NULL,          /* class_finalize */
-        NULL,          /* class_data */
-        sizeof (Form),
-        0,             /* n_preallocs */
-        (GInstanceInitFunc) form_init,
-                               NULL
-      };
-
-      form_type = g_type_register_static (G_TYPE_OBJECT, "Form",
-                                                                 &form_info, 0);
-    }
-
-  return form_type;
-}
+G_DEFINE_TYPE (GtkForm, gtk_form, G_TYPE_OBJECT)
 
 static void
-form_class_init (FormClass *class)
+gtk_form_class_init (GtkFormClass *class)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (class);
 
-       object_class->set_property = form_set_property;
-       object_class->get_property = form_get_property;
+       object_class->set_property = gtk_form_set_property;
+       object_class->get_property = gtk_form_get_property;
 
        g_object_class_install_property (object_class, PROP_TABLE,
                                         g_param_spec_string ("table",
-                                                             "Table",
-                                                             "Form's table",
+                                                             "Table name",
+                                                             "GtkForm's table name",
                                                              "",
                                                              G_PARAM_READWRITE));
 
@@ -102,45 +75,48 @@ form_class_init (FormClass *class)
                                         g_param_spec_object ("key",
                                                              "Key",
                                                              "Key",
-                                                             TYPE_FORM_KEY,
+                                                             TYPE_GTK_FORM_KEY,
                                                              G_PARAM_READWRITE));
 
-       g_type_class_add_private (object_class, sizeof (FormPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormPrivate));
 }
 
 static void
-form_init (Form *form)
+gtk_form_init (GtkForm *form)
 {
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
 
        priv->fields = NULL;
 }
 
 /**
- * form_new:
+ * gtk_form_new:
  *
- * Returns: the newly created #Form.
+ * Returns: the newly created #GtkForm.
  */
-Form
-*form_new ()
+GtkForm
+*gtk_form_new ()
 {
-       return g_object_new (TYPE_FORM, NULL);
+       return GTK_FORM (g_object_new (gtk_form_get_type (), NULL));
 }
 
 /**
- * form_add_field:
- * @form: a #Form object.
- * @field: a #FormField object.
+ * gtk_form_add_field:
+ * @form: a #GtkForm object.
+ * @field: a #GtkFormField object.
  *
  */
 gboolean
-form_add_field (Form *form, FormField *field)
+gtk_form_add_field (GtkForm *form, GtkFormField *field)
 {
-       gboolean ret = FALSE;
+       gboolean ret;
+       GtkFormPrivate *priv;
+
+       g_return_val_if_fail (IS_GTK_FORM_FIELD (field), FALSE);
 
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       ret = FALSE;
 
-       g_return_val_if_fail (IS_FORM_FIELD (field), FALSE);
+       priv = GTK_FORM_GET_PRIVATE (form);
 
        priv->fields = g_list_append (priv->fields, field);
 
@@ -150,19 +126,20 @@ form_add_field (Form *form, FormField *field)
 }
 
 /**
- * form_remove_field:
- * @form: a #Form object.
- * @field: a #FormField object.
+ * gtk_form_remove_field:
+ * @form: a #GtkForm object.
+ * @field: a #GtkFormField object.
  *
  */
 gboolean
-form_remove_field (Form *form, FormField *field)
+gtk_form_remove_field (GtkForm *form, GtkFormField *field)
 {
        gboolean ret = FALSE;
+       GtkFormPrivate *priv;
 
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       g_return_val_if_fail (IS_GTK_FORM_FIELD (field), FALSE);
 
-       g_return_val_if_fail (IS_FORM_FIELD (field), FALSE);
+       priv = GTK_FORM_GET_PRIVATE (form);
 
        priv->fields = g_list_remove (priv->fields, field);
 
@@ -172,47 +149,47 @@ form_remove_field (Form *form, FormField *field)
 }
 
 /**
- * form_add_fields:
- * @form: a #Form object.
+ * gtk_form_add_fields:
+ * @form: a #GtkForm object.
  *
  */
 gboolean
-form_add_fields (Form *form, ...)
+gtk_form_add_fields (GtkForm *form, ...)
 {
-       FormField *field;
+       GtkFormField *field;
 
        va_list vargs;
 
        va_start (vargs, form);
 
-       while ((field = va_arg (vargs, FormField *)) != NULL)
+       while ((field = va_arg (vargs, GtkFormField *)) != NULL)
                {
-                       form_add_field (form, field);
+                       gtk_form_add_field (form, field);
                }
 
        va_end (vargs);
 }
 
 /**
- * form_get_field_from_name:
- * @form: a #Form object.
+ * gtk_form_get_field_from_name:
+ * @form: a #GtkForm object.
  * @field_name:
  *
  */
-FormField
-*form_get_field_from_name (Form *form, const gchar *field_name)
+GtkFormField
+*gtk_form_get_field_from_name (GtkForm *form, const gchar *field_name)
 {
-       FormField *field = NULL;
+       GtkFormField *field = NULL;
        const gchar *name;
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
 
        GList *fields = g_list_first (priv->fields);
        while (fields != NULL)
                {
-                       name = form_field_get_field_name ((FormField *)fields->data);
+                       name = gtk_form_field_get_field_name ((GtkFormField *)fields->data);
                        if (strcmp (name, field_name) == 0)
                                {
-                                       field = (FormField *)fields->data;
+                                       field = (GtkFormField *)fields->data;
                                        break;
                                }
 
@@ -223,25 +200,25 @@ FormField
 }
 
 /**
- * form_get_widget_from_name:
- * @form: a #Form object.
+ * gtk_form_get_widget_from_name:
+ * @form: a #GtkForm object.
  * @widget_name:
  *
  */
-FormWidget
-*form_get_widget_from_name (Form *form, const gchar *widget_name)
+GtkFormWidget
+*gtk_form_get_widget_from_name (GtkForm *form, const gchar *widget_name)
 {
-       FormWidget *widget = NULL;
-       FormWidget *widget_ret = NULL;
+       GtkFormWidget *widget = NULL;
+       GtkFormWidget *widget_ret = NULL;
        gchar *name;
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
 
        GList *fields = g_list_first (priv->fields);
        while (fields != NULL)
                {
-                       widget = form_field_get_form_widget ((FormField *)fields->data);
+                       widget = gtk_form_field_get_gtk_form_widget ((GtkFormField *)fields->data);
 
-                       if (strcmp (form_widget_get_widget_name (widget), widget_name) == 0)
+                       if (strcmp (gtk_form_widget_get_widget_name (widget), widget_name) == 0)
                                {
                                        widget_ret = widget;
                                        break;
@@ -254,25 +231,25 @@ FormWidget
 }
 
 /**
- * form_clear:
- * @form: a #Form object.
+ * gtk_form_clear:
+ * @form: a #GtkForm object.
  *
  */
 gboolean
-form_clear (Form *form)
+gtk_form_clear (GtkForm *form)
 {
-       FormField *field;
+       GtkFormField *field;
        gboolean ret = FALSE;
 
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
 
        GList *fields = g_list_first (priv->fields);
 
        while (fields != NULL)
                {
-                       field = (FormField *)fields->data;
+                       field = (GtkFormField *)fields->data;
 
-                       form_field_clear (field);
+                       gtk_form_field_clear (field);
 
                        fields = g_list_next (fields);
                }
@@ -283,31 +260,31 @@ form_clear (Form *form)
 }
 
 /**
- * form_check:
- * @form: a #Form object.
+ * gtk_form_check:
+ * @form: a #GtkForm object.
  *
  * Returns: TRUE if all obligatory fields are full.
  */
 gboolean
-form_check (Form *form)
+gtk_form_check (GtkForm *form)
 {
-       FormField *field;
+       GtkFormField *field;
        gboolean ret = TRUE;
        gboolean obl = FALSE;
 
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
 
        GList *fields = g_list_first (priv->fields);
 
        while (fields != NULL)
                {
-                       field = (FormField *)fields->data;
+                       field = (GtkFormField *)fields->data;
 
                        g_object_get (G_OBJECT (field),
                                      "obligatory", &obl,
                                      NULL);
 
-                       if (obl && !form_field_is_empty (field))
+                       if (obl && !gtk_form_field_is_empty (field))
                                {
                                        ret = FALSE;
                                        break;
@@ -318,31 +295,31 @@ form_check (Form *form)
 
        if (ret)
                {
-                       ret = form_key_check (priv->key);
+                       ret = gtk_form_key_check (priv->key);
                }
 
        return ret;
 }
 
 /**
- * form_set_sensitive:
- * @form: a #Form object.
- * @sensitive: whether to set every #Form's widget sensitive or not.
+ * gtk_form_set_sensitive:
+ * @form: a #GtkForm object.
+ * @sensitive: whether to set every #GtkForm's widget sensitive or not.
  *
  */
 void
-form_set_sensitive (Form *form, gboolean sensitive)
+gtk_form_set_sensitive (GtkForm *form, gboolean sensitive)
 {
-       FormWidget *fwidget;
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormWidget *fwidget;
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
        GtkWidget *widget;
 
        GList *fields = g_list_first (priv->fields);
        while (fields != NULL)
                {
-                       fwidget = form_field_get_form_widget ((FormField *)fields->data);
+                       fwidget = gtk_form_field_get_gtk_form_widget ((GtkFormField *)fields->data);
 
-                       widget = form_widget_get_widget (fwidget);
+                       widget = gtk_form_widget_get_widget (fwidget);
                        gtk_widget_set_sensitive (widget, sensitive);
 
                        fields = g_list_next (fields);
@@ -350,39 +327,39 @@ form_set_sensitive (Form *form, gboolean sensitive)
 }
 
 /**
- * form_set_editable:
- * @form: a #Form object.
- * @editable: whether to set every #Form's widget editable or not.
+ * gtk_form_set_editable:
+ * @form: a #GtkForm object.
+ * @editable: whether to set every #GtkForm's widget editable or not.
  *
  */
 void
-form_set_editable (Form *form, gboolean editable)
+gtk_form_set_editable (GtkForm *form, gboolean editable)
 {
-       FormWidget *fwidget;
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormWidget *fwidget;
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
 
        GList *fields = g_list_first (priv->fields);
        while (fields != NULL)
                {
-                       fwidget = form_field_get_form_widget ((FormField *)fields->data);
+                       fwidget = gtk_form_field_get_gtk_form_widget ((GtkFormField *)fields->data);
 
-                       form_widget_set_editable (fwidget, editable);
+                       gtk_form_widget_set_editable (fwidget, editable);
 
                        fields = g_list_next (fields);
                }
 }
 
 /**
- * form_get_sql:
- * @form: a #Form object.
+ * gtk_form_get_sql:
+ * @form: a #GtkForm object.
  * @type: SQL's type that returns.
  *
  * Returns: the SQL string.
  */
 gchar
-*form_get_sql (Form *form, FormSqlType type)
+*gtk_form_get_sql (GtkForm *form, GtkFormSqlType type)
 {
-       FormField *field;
+       GtkFormField *field;
        gchar *sql = "";
        gchar *fields_names = "";
        gchar *values = "";
@@ -390,26 +367,26 @@ gchar
        gchar *where = "";
        const gchar *field_name;
 
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
 
        GList *fields = g_list_first (priv->fields);
 
        while (fields != NULL)
                {
-                       field = (FormField *)fields->data;
+                       field = (GtkFormField *)fields->data;
 
-                       field_name = form_field_get_field_name (field);
+                       field_name = gtk_form_field_get_field_name (field);
 
                        if (field_name != NULL && strcmp (field_name, "") != 0)
                                {
                                        switch (type)
                                                {
-                                                       case FORM_SQL_SELECT:
+                                                       case GTK_FORM_SQL_SELECT:
                                                                fields_names = g_strconcat (fields_names, field_name, ", ", NULL);
                                                                break;
 
-                                                       case FORM_SQL_INSERT:
-                                                               value = form_field_get_value_sql (field);
+                                                       case GTK_FORM_SQL_INSERT:
+                                                               value = gtk_form_field_get_value_sql (field);
                                                                if (value != NULL)
                                                                        {
                                                                                fields_names = g_strconcat (fields_names, field_name, ", ", NULL);
@@ -417,10 +394,10 @@ gchar
                                                                        }
                                                                break;
 
-                                                       case FORM_SQL_UPDATE:
-                                                               if (!form_key_field_is_key (priv->key, field))
+                                                       case GTK_FORM_SQL_UPDATE:
+                                                               if (!gtk_form_key_field_is_key (priv->key, field))
                                                                        {
-                                                                               value = form_field_get_value_sql (field);
+                                                                               value = gtk_form_field_get_value_sql (field);
                                                                                if (value != NULL)
                                                                                        {
                                                                                                fields_names = g_strconcat (fields_names, field_name, " = ", value, ", ", NULL);
@@ -444,25 +421,25 @@ gchar
 
        switch (type)
                {
-                       case FORM_SQL_SELECT:
+                       case GTK_FORM_SQL_SELECT:
                                sql = g_strconcat ("SELECT ", fields_names, " FROM ", priv->table, NULL);
                                break;
 
-                       case FORM_SQL_INSERT:
+                       case GTK_FORM_SQL_INSERT:
                                sql = g_strconcat ("INSERT INTO ", priv->table, " (", fields_names, ") VALUES (", values, ")", NULL);
                                break;
 
-                       case FORM_SQL_UPDATE:
+                       case GTK_FORM_SQL_UPDATE:
                                sql = g_strconcat ("UPDATE ", priv->table, " SET ", fields_names, NULL);
                                break;
 
-                       case FORM_SQL_DELETE:
+                       case GTK_FORM_SQL_DELETE:
                                sql = g_strconcat ("DELETE FROM ", priv->table, NULL);
                                break;
                }
 
-       where = form_key_get_sql (priv->key);
-       if ((type == FORM_SQL_SELECT || type == FORM_SQL_UPDATE || type == FORM_SQL_DELETE)
+       where = gtk_form_key_get_sql (priv->key);
+       if ((type == GTK_FORM_SQL_SELECT || type == GTK_FORM_SQL_UPDATE || type == GTK_FORM_SQL_DELETE)
            && where != NULL && strcmp (where, "") != 0)
                {
                        sql = g_strconcat (sql, where, NULL);
@@ -472,28 +449,28 @@ gchar
 }
 
 /**
- * form_fill_from_datamodel:
- * @form: a #Form object.
- * @dm: the #GdaDataModel from which fill the #Form.
+ * gtk_form_fill_from_datamodel:
+ * @form: a #GtkForm object.
+ * @dm: the #GdaDataModel from which fill the #GtkForm.
  * @row: the #GdaDataModel's row from which read data.
  *
  */
 gboolean
-form_fill_from_datamodel (Form *form, GdaDataModel *dm, gint row)
+gtk_form_fill_from_datamodel (GtkForm *form, GdaDataModel *dm, gint row)
 {
        gboolean ret = TRUE;
-       FormField *field;
+       GtkFormField *field;
        gchar *field_name;
 
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
 
        GList *fields = g_list_first (priv->fields);
 
        while (fields != NULL)
                {
-                       field = (FormField *)fields->data;
+                       field = (GtkFormField *)fields->data;
 
-                       form_field_set_from_datamodel (field, dm, row);
+                       gtk_form_field_set_from_datamodel (field, dm, row);
 
                        fields = g_list_next (fields);
                }
@@ -503,14 +480,14 @@ form_fill_from_datamodel (Form *form, GdaDataModel *dm, gint row)
 
 /* PRIVATE */
 static void
-form_set_property (GObject *object,
+gtk_form_set_property (GObject *object,
                    guint property_id,
                    const GValue *value,
                    GParamSpec *pspec)
 {
-       Form *form = (Form *)object;
+       GtkForm *form = (GtkForm *)object;
 
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
 
        switch (property_id)
                {
@@ -529,14 +506,14 @@ form_set_property (GObject *object,
 }
 
 static void
-form_get_property (GObject *object,
+gtk_form_get_property (GObject *object,
                    guint property_id,
                    GValue *value,
                    GParamSpec *pspec)
 {
-       Form *form = (Form *)object;
+       GtkForm *form = (GtkForm *)object;
 
-       FormPrivate *priv = FORM_GET_PRIVATE (form);
+       GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
 
        switch (property_id)
                {
index 9b16fb68143c916e56d9c2fcff266d6544183a2d..0c23a0c3b48d91997816cd4f2e6eddfe07a4fb41 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_H__
-#define __LIBFORM_H__
+#ifndef __LIBGTK_FORM_H__
+#define __LIBGTK_FORM_H__
 
 #include <glib.h>
 #include <glade/glade.h>
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM                 (form_get_type ())
-#define FORM(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM, Form))
-#define FORM_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM, FormClass))
-#define IS_FORM(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM))
-#define IS_FORM_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM))
-#define FORM_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM, FormClass))
+#define TYPE_GTK_FORM                 (gtk_form_get_type ())
+#define GTK_FORM(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM, GtkForm))
+#define GTK_FORM_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM, GtkFormClass))
+#define IS_GTK_FORM(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM))
+#define IS_GTK_FORM_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM))
+#define GTK_FORM_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM, GtkFormClass))
 
 
-typedef struct _Form Form;
-typedef struct _FormClass FormClass;
+typedef struct _GtkForm GtkForm;
+typedef struct _GtkFormClass GtkFormClass;
 
-struct _Form
+struct _GtkForm
        {
                GObject parent;
        };
 
-struct _FormClass
+struct _GtkFormClass
        {
                GObjectClass parent_class;
        };
 
-GType form_get_type (void) G_GNUC_CONST;
+GType gtk_form_get_type (void) G_GNUC_CONST;
 
 
-Form *form_new (void);
+GtkForm *gtk_form_new (void);
 
-gboolean form_add_field (Form *form, FormField *field);
-gboolean form_remove_field (Form *form, FormField *field);
+gboolean gtk_form_add_field (GtkForm *form, GtkFormField *field);
+gboolean gtk_form_remove_field (GtkForm *form, GtkFormField *field);
 
-gboolean form_add_fields (Form *form, ...);
+gboolean gtk_form_add_fields (GtkForm *form, ...);
 
-FormField *form_get_field_from_name (Form *form, const gchar *field_name);
-FormWidget *form_get_widget_from_name (Form *form, const gchar *widget_name);
+GtkFormField *gtk_form_get_field_from_name (GtkForm *form, const gchar *field_name);
+GtkFormWidget *gtk_form_get_widget_from_name (GtkForm *form, const gchar *widget_name);
 
-gboolean form_clear (Form *form);
+gboolean gtk_form_clear (GtkForm *form);
 
-gboolean form_check (Form *form);
+gboolean gtk_form_check (GtkForm *form);
 
-void form_set_sensitive (Form *form, gboolean sensitive);
-void form_set_editable (Form *form, gboolean editable);
+void gtk_form_set_sensitive (GtkForm *form, gboolean sensitive);
+void gtk_form_set_editable (GtkForm *form, gboolean editable);
 
 typedef enum
 {
-       FORM_SQL_SELECT,
-       FORM_SQL_INSERT,
-       FORM_SQL_UPDATE,
-       FORM_SQL_DELETE
-} FormSqlType;
+       GTK_FORM_SQL_SELECT,
+       GTK_FORM_SQL_INSERT,
+       GTK_FORM_SQL_UPDATE,
+       GTK_FORM_SQL_DELETE
+} GtkFormSqlType;
 
-gchar *form_get_sql (Form *form, FormSqlType type);
+gchar *gtk_form_get_sql (GtkForm *form, GtkFormSqlType type);
 
-gboolean form_fill_from_datamodel (Form *form, GdaDataModel *dm, gint row);
+gboolean gtk_form_fill_from_datamodel (GtkForm *form, GdaDataModel *dm, gint row);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_H__ */
+#endif /* __LIBGTK_FORM_H__ */
index 0eda43daa9026540aeea907c8bec2cbeffe5c133..6d3ab8722081ff80e3509131795a93c5b25040fd 100644 (file)
--- a/src/key.c
+++ b/src/key.c
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <stdarg.h>
 
 #include "key.h"
 
-static void form_key_class_init (FormKeyClass *class);
-static void form_key_init (FormKey *form_key);
+static void gtk_form_key_class_init (GtkFormKeyClass *class);
+static void gtk_form_key_init (GtkFormKey *gtk_form_key);
 
 
-#define FORM_KEY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_KEY, FormKeyPrivate))
+#define GTK_FORM_KEY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_KEY, GtkFormKeyPrivate))
 
-typedef struct _FormKeyPrivate FormKeyPrivate;
-struct _FormKeyPrivate
+typedef struct _GtkFormKeyPrivate GtkFormKeyPrivate;
+struct _GtkFormKeyPrivate
        {
                GList *fields;
        };
 
 
-GType
-form_key_get_type (void)
-{
-  static GType form_key_type = 0;
-
-  if (!form_key_type)
-    {
-      static const GTypeInfo form_key_info =
-      {
-        sizeof (FormKeyClass),
-        NULL,          /* base_init */
-        NULL,          /* base_finalize */
-        (GClassInitFunc) form_key_class_init,
-        NULL,          /* class_finalize */
-        NULL,          /* class_data */
-        sizeof (FormKey),
-        0,             /* n_preallocs */
-        (GInstanceInitFunc) form_key_init,
-                               NULL
-      };
-
-      form_key_type = g_type_register_static (G_TYPE_OBJECT, "FormKey",
-                                                                     &form_key_info, 0);
-    }
-
-  return form_key_type;
-}
+G_DEFINE_TYPE (GtkFormKey, gtk_form_key, G_TYPE_OBJECT)
 
 static void
-form_key_class_init (FormKeyClass *class)
+gtk_form_key_class_init (GtkFormKeyClass *class)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (class);
 
-       g_type_class_add_private (object_class, sizeof (FormKeyPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormKeyPrivate));
 }
 
 static void
-form_key_init (FormKey *form_key)
+gtk_form_key_init (GtkFormKey *gtk_form_key)
 {
-       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+       GtkFormKeyPrivate *priv = GTK_FORM_KEY_GET_PRIVATE (gtk_form_key);
 
        priv->fields = NULL;
 }
 
 /**
- * form_key_new:
+ * gtk_form_key_new:
  *
- * Returns: the newly created #FormKey.
+ * Returns: the newly created #GtkFormKey.
  */
-FormKey
-*form_key_new ()
+GtkFormKey
+*gtk_form_key_new ()
 {
-       return g_object_new (TYPE_FORM_KEY, NULL);
+       return g_object_new (TYPE_GTK_FORM_KEY, NULL);
 }
 
 /**
- * form_key_add_field:
- * @form_key: a #FormKey object.
- * @field: a #FormField object.
+ * gtk_form_key_add_field:
+ * @gtk_form_key: a #GtkFormKey object.
+ * @field: a #GtkFormField object.
  *
  */
 gboolean
-form_key_add_field (FormKey *form_key, FormField *field)
+gtk_form_key_add_field (GtkFormKey *gtk_form_key, GtkFormField *field)
 {
        gboolean ret = FALSE;
 
-       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+       GtkFormKeyPrivate *priv = GTK_FORM_KEY_GET_PRIVATE (gtk_form_key);
 
-       g_return_val_if_fail (IS_FORM_FIELD (field), FALSE);
+       g_return_val_if_fail (IS_GTK_FORM_FIELD (field), FALSE);
 
        priv->fields = g_list_append (priv->fields, field);
 
@@ -112,19 +86,19 @@ form_key_add_field (FormKey *form_key, FormField *field)
 }
 
 /**
- * form_key_remove_field:
- * @form_key: a #FormKey object.
- * @field: a #FormField object.
+ * gtk_form_key_remove_field:
+ * @gtk_form_key: a #GtkFormKey object.
+ * @field: a #GtkFormField object.
  *
  */
 gboolean
-form_key_remove_field (FormKey *form_key, FormField *field)
+gtk_form_key_remove_field (GtkFormKey *gtk_form_key, GtkFormField *field)
 {
        gboolean ret = FALSE;
 
-       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+       GtkFormKeyPrivate *priv = GTK_FORM_KEY_GET_PRIVATE (gtk_form_key);
 
-       g_return_val_if_fail (IS_FORM_FIELD (field), FALSE);
+       g_return_val_if_fail (IS_GTK_FORM_FIELD (field), FALSE);
 
        priv->fields = g_list_remove (priv->fields, field);
 
@@ -134,48 +108,48 @@ form_key_remove_field (FormKey *form_key, FormField *field)
 }
 
 /**
- * form_key_add_fields:
- * @form_key: a #FormKey object.
+ * gtk_form_key_add_fields:
+ * @gtk_form_key: a #GtkFormKey object.
  *
  */
 gboolean
-form_key_add_fields (FormKey *form_key, ...)
+gtk_form_key_add_fields (GtkFormKey *gtk_form_key, ...)
 {
-       FormField *field;
+       GtkFormField *field;
 
        va_list vargs;
 
-       va_start (vargs, form_key);
+       va_start (vargs, gtk_form_key);
 
-       while ((field = va_arg (vargs, FormField *)) != NULL)
+       while ((field = va_arg (vargs, GtkFormField *)) != NULL)
                {
-                       form_key_add_field (form_key, field);
+                       gtk_form_key_add_field (gtk_form_key, field);
                }
 
        va_end (vargs);
 }
 
 /**
- * form_key_check:
- * @form_key: a #FormKey object.
+ * gtk_form_key_check:
+ * @gtk_form_key: a #GtkFormKey object.
  *
  * Returns: TRUE if all obligatory fields are full.
  */
 gboolean
-form_key_check (FormKey *form_key)
+gtk_form_key_check (GtkFormKey *gtk_form_key)
 {
-       FormField *field;
+       GtkFormField *field;
        gboolean ret = FALSE;
 
-       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+       GtkFormKeyPrivate *priv = GTK_FORM_KEY_GET_PRIVATE (gtk_form_key);
 
        GList *fields = g_list_first (priv->fields);
 
        while (fields != NULL)
                {
-                       field = (FormField *)fields->data;
+                       field = (GtkFormField *)fields->data;
 
-                       if (form_field_is_empty (field))
+                       if (gtk_form_field_is_empty (field))
                                {
                                        ret = TRUE;
                                        break;
@@ -188,33 +162,33 @@ form_key_check (FormKey *form_key)
 }
 
 /**
- * form_key_get_sql:
- * @form_key: a #FormKey object.
+ * gtk_form_key_get_sql:
+ * @gtk_form_key: a #GtkFormKey object.
  *
  */
 gchar
-*form_key_get_sql (FormKey *form_key)
+*gtk_form_key_get_sql (GtkFormKey *gtk_form_key)
 {
-       FormField *field;
+       GtkFormField *field;
        gchar *sql = "";
        gchar *field_name;
 
-       g_return_val_if_fail (IS_FORM_KEY (form_key), NULL);
+       g_return_val_if_fail (IS_GTK_FORM_KEY (gtk_form_key), NULL);
 
-       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+       GtkFormKeyPrivate *priv = GTK_FORM_KEY_GET_PRIVATE (gtk_form_key);
 
        GList *fields = g_list_first (priv->fields);
 
        while (fields != NULL)
                {
-                       field = (FormField *)fields->data;
+                       field = (GtkFormField *)fields->data;
 
                        g_object_get (G_OBJECT (field),
                                      "field", &field_name,
                                      NULL);
 
                        sql = g_strconcat (sql, " AND ", field_name, " = ",
-                                          form_field_get_value_sql (field), NULL);
+                                          gtk_form_field_get_value_sql (field), NULL);
 
                        fields = g_list_next (fields);
                }
@@ -228,19 +202,19 @@ gchar
 }
 
 /**
- * form_key_field_is_key:
- * @form_key: a #FormKey object.
- * @field: a #FormField object.
+ * gtk_form_key_field_is_key:
+ * @gtk_form_key: a #GtkFormKey object.
+ * @field: a #GtkFormField object.
  *
- * Returns: TRUE if @field is part of @form_key.
+ * Returns: TRUE if @field is part of @gtk_form_key.
  */
 gboolean
-form_key_field_is_key (FormKey *form_key, FormField *field)
+gtk_form_key_field_is_key (GtkFormKey *gtk_form_key, GtkFormField *field)
 {
-       g_return_val_if_fail (IS_FORM_KEY (form_key), FALSE);
-       g_return_val_if_fail (IS_FORM_FIELD (field), FALSE);
+       g_return_val_if_fail (IS_GTK_FORM_KEY (gtk_form_key), FALSE);
+       g_return_val_if_fail (IS_GTK_FORM_FIELD (field), FALSE);
 
-       FormKeyPrivate *priv = FORM_KEY_GET_PRIVATE (form_key);
+       GtkFormKeyPrivate *priv = GTK_FORM_KEY_GET_PRIVATE (gtk_form_key);
 
        return (g_list_index (priv->fields, field) >= 0 ? TRUE : FALSE);
 }
index fbe44344d7dda62aea71e5aaf07cad523d2213c6..6de2300bd028c15be4ff2d82a8b837ffe36bde8c 100644 (file)
--- a/src/key.h
+++ b/src/key.h
@@ -1,23 +1,23 @@
 /*
- * Copyright (C) 2005-2006 Andrea Zagli <azagli@inwind.it>
+ * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_KEY_H__
-#define __LIBFORM_KEY_H__
+#ifndef __LIBGTK_FORM_KEY_H__
+#define __LIBGTK_FORM_KEY_H__
 
 #include <glib.h>
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_KEY                 (form_key_get_type ())
-#define FORM_KEY(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_KEY, FormKey))
-#define FORM_KEY_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_KEY, FormKeyClass))
-#define IS_FORM_KEY(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_KEY))
-#define IS_FORM_KEY_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_KEY))
-#define FORM_KEY_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_KEY, FormKeyClass))
+#define TYPE_GTK_FORM_KEY                 (gtk_form_key_get_type ())
+#define GTK_FORM_KEY(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_KEY, GtkFormKey))
+#define GTK_FORM_KEY_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_KEY, GtkFormKeyClass))
+#define IS_GTK_FORM_KEY(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_KEY))
+#define IS_GTK_FORM_KEY_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_KEY))
+#define GTK_FORM_KEY_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_KEY, GtkFormKeyClass))
 
 
-typedef struct _FormKey FormKey;
-typedef struct _FormKeyClass FormKeyClass;
+typedef struct _GtkFormKey GtkFormKey;
+typedef struct _GtkFormKeyClass GtkFormKeyClass;
 
-struct _FormKey
+struct _GtkFormKey
        {
                GObject parent;
        };
 
-struct _FormKeyClass
+struct _GtkFormKeyClass
        {
                GObjectClass parent_class;
        };
 
-GType form_key_get_type (void) G_GNUC_CONST;
+GType gtk_form_key_get_type (void) G_GNUC_CONST;
 
 
-FormKey *form_key_new (void);
+GtkFormKey *gtk_form_key_new (void);
 
-gboolean form_key_add_field (FormKey *form_key, FormField *field);
-gboolean form_key_remove_field (FormKey *form_key, FormField *field);
+gboolean gtk_form_key_add_field (GtkFormKey *gtk_form_key, GtkFormField *field);
+gboolean gtk_form_key_remove_field (GtkFormKey *gtk_form_key, GtkFormField *field);
 
-gboolean form_key_add_fields (FormKey *form_key, ...);
+gboolean gtk_form_key_add_fields (GtkFormKey *gtk_form_key, ...);
 
-gboolean form_key_check (FormKey *form_key);
+gboolean gtk_form_key_check (GtkFormKey *gtk_form_key);
 
-gchar *form_key_get_sql (FormKey *form_key);
+gchar *gtk_form_key_get_sql (GtkFormKey *gtk_form_key);
 
-gboolean form_key_field_is_key (FormKey *form_key, FormField *field);
+gboolean gtk_form_key_field_is_key (GtkFormKey *gtk_form_key, GtkFormField *field);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_KEY_H__ */
+#endif /* __LIBGTK_FORM_KEY_H__ */
index b45b9c7343b4eafbb5426db1b72eed9500564408..bbde5599fb6e13623d2c3971c83c1857966805a0 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <gtk/gtk.h>
@@ -27,58 +27,32 @@ enum
        PROP_NAME
 };
 
-static void form_widget_class_init (FormWidgetClass *klass);
-static void form_widget_init (FormWidget *form_widget);
+static void gtk_form_widget_class_init (GtkFormWidgetClass *klass);
+static void gtk_form_widget_init (GtkFormWidget *gtk_form_widget);
 
-static void form_widget_set_property (GObject *object,
+static void gtk_form_widget_set_property (GObject *object,
                                       guint property_id,
                                       const GValue *value,
                                       GParamSpec *pspec);
-static void form_widget_get_property (GObject *object,
+static void gtk_form_widget_get_property (GObject *object,
                                       guint property_id,
                                       GValue *value,
                                       GParamSpec *pspec);
 
-#define FORM_WIDGET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET, FormWidgetPrivate))
+#define GTK_FORM_WIDGET_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_WIDGET, GtkFormWidgetPrivate))
 
-typedef struct _FormWidgetPrivate FormWidgetPrivate;
-struct _FormWidgetPrivate
+typedef struct _GtkFormWidgetPrivate GtkFormWidgetPrivate;
+struct _GtkFormWidgetPrivate
        {
                GtkWidget *widget;
                gchar *widget_name;
        };
 
 
-GType
-form_widget_get_type (void)
-{
-       static GType form_widget_type = 0;
-
-       if (!form_widget_type)
-               {
-                       static const GTypeInfo form_widget_info =
-                       {
-                               sizeof (FormWidgetClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_widget_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormWidget),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_widget_init,
-                               NULL
-                       };
-
-                       form_widget_type = g_type_register_static (G_TYPE_OBJECT, "FormWidget",
-                                                                  &form_widget_info, 0);
-    }
-
-       return form_widget_type;
-}
+G_DEFINE_TYPE (GtkFormWidget, gtk_form_widget, G_TYPE_OBJECT)
 
 static void
-form_widget_class_init (FormWidgetClass *klass)
+gtk_form_widget_class_init (GtkFormWidgetClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
@@ -86,8 +60,8 @@ form_widget_class_init (FormWidgetClass *klass)
        klass->set_value_stringify = NULL;
        klass->set_editable = NULL;
 
-       object_class->set_property = form_widget_set_property;
-       object_class->get_property = form_widget_get_property;
+       object_class->set_property = gtk_form_widget_set_property;
+       object_class->get_property = gtk_form_widget_get_property;
 
        g_object_class_install_property (object_class, PROP_WIDGET,
                                         g_param_spec_object ("widget",
@@ -103,34 +77,34 @@ form_widget_class_init (FormWidgetClass *klass)
                                                              "",
                                                              G_PARAM_READWRITE));
 
-       g_type_class_add_private (object_class, sizeof (FormWidgetPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormWidgetPrivate));
 }
 
 static void
-form_widget_init (FormWidget *form_widget)
+gtk_form_widget_init (GtkFormWidget *gtk_form_widget)
 {
 }
 
 /**
- * form_widget_new:
+ * gtk_form_widget_new:
  *
- * Returns: the newly created #FormWidget.
+ * Returns: the newly created #GtkFormWidget.
  */
-FormWidget
-*form_widget_new ()
+GtkFormWidget
+*gtk_form_widget_new ()
 {
-       return g_object_new (TYPE_FORM_WIDGET, NULL);
+       return g_object_new (TYPE_GTK_FORM_WIDGET, NULL);
 }
 
 /**
- * form_widget_set_from_glade:
+ * gtk_form_widget_set_from_glade:
  * @fwidget:
  * @glade:
  * @widget_name:
  *
  */
 gboolean
-form_widget_set_from_glade (FormWidget *fwidget, GladeXML *glade, const gchar *widget_name)
+gtk_form_widget_set_from_glade (GtkFormWidget *fwidget, GladeXML *glade, const gchar *widget_name)
 {
        gboolean ret = FALSE;
 
@@ -149,86 +123,86 @@ form_widget_set_from_glade (FormWidget *fwidget, GladeXML *glade, const gchar *w
 }
 
 /**
- * form_widget_get_widget:
+ * gtk_form_widget_get_widget:
  * @fwidget:
  *
  */
 GtkWidget
-*form_widget_get_widget (FormWidget *fwidget)
+*gtk_form_widget_get_widget (GtkFormWidget *fwidget)
 {
-       FormWidgetPrivate *priv = FORM_WIDGET_GET_PRIVATE (fwidget);
+       GtkFormWidgetPrivate *priv = GTK_FORM_WIDGET_GET_PRIVATE (fwidget);
 
        return priv->widget;
 }
 
 /**
- * form_widget_get_widget_name:
+ * gtk_form_widget_get_widget_name:
  * @fwidget:
  *
- * Returns: the #FormWidget's name.
+ * Returns: the #GtkFormWidget's name.
  */
 const gchar
-*form_widget_get_widget_name (FormWidget *fwidget)
+*gtk_form_widget_get_widget_name (GtkFormWidget *fwidget)
 {
-       FormWidgetPrivate *priv = FORM_WIDGET_GET_PRIVATE (fwidget);
+       GtkFormWidgetPrivate *priv = GTK_FORM_WIDGET_GET_PRIVATE (fwidget);
 
        return (const gchar *)g_strdup (priv->widget_name);
 }
 
 /**
- * form_widget_get_value_stringify:
+ * gtk_form_widget_get_value_stringify:
  * @fwidget:
  *
  */
 const gchar
-*form_widget_get_value_stringify (FormWidget *fwidget)
+*gtk_form_widget_get_value_stringify (GtkFormWidget *fwidget)
 {
-       if (IS_FORM_WIDGET (fwidget) && FORM_WIDGET_GET_CLASS (fwidget)->get_value_stringify != NULL)
+       if (IS_GTK_FORM_WIDGET (fwidget) && GTK_FORM_WIDGET_GET_CLASS (fwidget)->get_value_stringify != NULL)
                {
-                       FORM_WIDGET_GET_CLASS (fwidget)->get_value_stringify (fwidget);
+                       GTK_FORM_WIDGET_GET_CLASS (fwidget)->get_value_stringify (fwidget);
                }
 }
 
 /**
- * form_widget_set_value_stringify:
+ * gtk_form_widget_set_value_stringify:
  * @fwidget:
  * @value:
  *
  */
 gboolean
-form_widget_set_value_stringify (FormWidget *fwidget, const gchar *value)
+gtk_form_widget_set_value_stringify (GtkFormWidget *fwidget, const gchar *value)
 {
-       if (IS_FORM_WIDGET (fwidget) && FORM_WIDGET_GET_CLASS (fwidget)->set_value_stringify != NULL)
+       if (IS_GTK_FORM_WIDGET (fwidget) && GTK_FORM_WIDGET_GET_CLASS (fwidget)->set_value_stringify != NULL)
                {
-                       FORM_WIDGET_GET_CLASS (fwidget)->set_value_stringify (fwidget, value);
+                       GTK_FORM_WIDGET_GET_CLASS (fwidget)->set_value_stringify (fwidget, value);
                }
 }
 
 /**
- * form_widget_set_editable:
+ * gtk_form_widget_set_editable:
  * @fwidget:
  * @editable:
  *
  */
 void
-form_widget_set_editable (FormWidget *fwidget, gboolean editable)
+gtk_form_widget_set_editable (GtkFormWidget *fwidget, gboolean editable)
 {
-       if (IS_FORM_WIDGET (fwidget) && FORM_WIDGET_GET_CLASS (fwidget)->set_editable != NULL)
+       if (IS_GTK_FORM_WIDGET (fwidget) && GTK_FORM_WIDGET_GET_CLASS (fwidget)->set_editable != NULL)
                {
-                       FORM_WIDGET_GET_CLASS (fwidget)->set_editable (fwidget, editable);
+                       GTK_FORM_WIDGET_GET_CLASS (fwidget)->set_editable (fwidget, editable);
                }
 }
 
 /* PRIVATE */
 static void
-form_widget_set_property (GObject *object,
+gtk_form_widget_set_property (GObject *object,
                           guint property_id,
                           const GValue *value,
                           GParamSpec *pspec)
 {
-       FormWidget *fwidget = (FormWidget *)object;
+       GtkFormWidget *fwidget = (GtkFormWidget *)object;
 
-       FormWidgetPrivate *priv = FORM_WIDGET_GET_PRIVATE (fwidget);
+       GtkFormWidgetPrivate *priv = GTK_FORM_WIDGET_GET_PRIVATE (fwidget);
 
        switch (property_id)
                {
@@ -247,14 +221,14 @@ form_widget_set_property (GObject *object,
 }
 
 static void
-form_widget_get_property (GObject *object,
+gtk_form_widget_get_property (GObject *object,
                           guint property_id,
                           GValue *value,
                           GParamSpec *pspec)
 {
-       FormWidget *fwidget = (FormWidget *)object;
+       GtkFormWidget *fwidget = (GtkFormWidget *)object;
 
-       FormWidgetPrivate *priv = FORM_WIDGET_GET_PRIVATE (fwidget);
+       GtkFormWidgetPrivate *priv = GTK_FORM_WIDGET_GET_PRIVATE (fwidget);
 
        switch (property_id)
                {
index caf5608c19490d2d9b87703d0e2814e4ecd18dcd..b8c5f39471d6433fa17b10e19f59d24ab204ffb4 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_WIDGET_H__
-#define __LIBFORM_WIDGET_H__
+#ifndef __LIBGTK_FORM_WIDGET_H__
+#define __LIBGTK_FORM_WIDGET_H__
 
 #include <glib.h>
 #include <gtk/gtk.h>
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_WIDGET                 (form_widget_get_type ())
-#define FORM_WIDGET(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET, FormWidget))
-#define FORM_WIDGET_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET, FormWidgetClass))
-#define IS_FORM_WIDGET(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET))
-#define IS_FORM_WIDGET_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET))
-#define FORM_WIDGET_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET, FormWidgetClass))
+#define TYPE_GTK_FORM_WIDGET                 (gtk_form_widget_get_type ())
+#define GTK_FORM_WIDGET(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_WIDGET, GtkFormWidget))
+#define GTK_FORM_WIDGET_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_WIDGET, GtkFormWidgetClass))
+#define IS_GTK_FORM_WIDGET(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_WIDGET))
+#define IS_GTK_FORM_WIDGET_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_WIDGET))
+#define GTK_FORM_WIDGET_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_WIDGET, GtkFormWidgetClass))
 
 
-typedef struct _FormWidget FormWidget;
-typedef struct _FormWidgetClass FormWidgetClass;
+typedef struct _GtkFormWidget GtkFormWidget;
+typedef struct _GtkFormWidgetClass GtkFormWidgetClass;
 
-struct _FormWidget
+struct _GtkFormWidget
        {
                GObject parent;
        };
 
-struct _FormWidgetClass
+struct _GtkFormWidgetClass
        {
                GObjectClass parent_class;
 
-               const gchar *(*get_value_stringify) (FormWidget *fwidget);
+               const gchar *(*get_value_stringify) (GtkFormWidget *fwidget);
 
-               gboolean (*set_value_stringify) (FormWidget *fwidget, const gchar *value);
+               gboolean (*set_value_stringify) (GtkFormWidget *fwidget, const gchar *value);
 
-               void (*set_editable) (FormWidget *fwidget, gboolean editable);
+               void (*set_editable) (GtkFormWidget *fwidget, gboolean editable);
        };
 
-GType form_widget_get_type (void) G_GNUC_CONST;
+GType gtk_form_widget_get_type (void) G_GNUC_CONST;
 
-FormWidget *form_widget_new (void);
+GtkFormWidget *gtk_form_widget_new (void);
 
-gboolean form_widget_set_from_glade (FormWidget *fwidget, GladeXML *glade, const gchar *widget_name);
+gboolean gtk_form_widget_set_from_glade (GtkFormWidget *fwidget, GladeXML *glade, const gchar *widget_name);
 
-GtkWidget *form_widget_get_widget (FormWidget *fwidget);
+GtkWidget *gtk_form_widget_get_widget (GtkFormWidget *fwidget);
 
-const gchar *form_widget_get_widget_name (FormWidget *fwidget);
+const gchar *gtk_form_widget_get_widget_name (GtkFormWidget *fwidget);
 
-const gchar *form_widget_get_value_stringify (FormWidget *fwidget);
+const gchar *gtk_form_widget_get_value_stringify (GtkFormWidget *fwidget);
 
-gboolean form_widget_set_value_stringify (FormWidget *fwidget, const gchar *value);
+gboolean gtk_form_widget_set_value_stringify (GtkFormWidget *fwidget, const gchar *value);
 
-void form_widget_set_editable (FormWidget *fwidget, gboolean editable);
+void gtk_form_widget_set_editable (GtkFormWidget *fwidget, gboolean editable);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_WIDGET_H__ */
+#endif /* __LIBGTK_FORM_WIDGET_H__ */
index 46c39b20e290f4d69185165c97e313723c55d0bb..a82fa8311d6ffa189e6b9cb60fbe4b8cc2a46c48 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <string.h>
@@ -27,109 +27,83 @@ enum
        PROP_0
 };
 
-static void form_widget_check_class_init (FormWidgetCheckClass *klass);
-static void form_widget_check_init (FormWidgetCheck *form_widget_check);
+static void gtk_form_widget_check_class_init (GtkFormWidgetCheckClass *klass);
+static void gtk_form_widget_check_init (GtkFormWidgetCheck *gtk_form_widget_check);
 
-static void form_widget_check_set_property (GObject *object,
+static void gtk_form_widget_check_set_property (GObject *object,
                                             guint property_id,
                                             const GValue *value,
                                             GParamSpec *pspec);
-static void form_widget_check_get_property (GObject *object,
+static void gtk_form_widget_check_get_property (GObject *object,
                                             guint property_id,
                                             GValue *value,
                                             GParamSpec *pspec);
 
 static gboolean check_value (const gchar *value);
 
-#define FORM_WIDGET_CHECK_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_CHECK, FormWidgetCheckPrivate))
+#define GTK_FORM_WIDGET_CHECK_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_WIDGET_CHECK, GtkFormWidgetCheckPrivate))
 
-typedef struct _FormWidgetCheckPrivate FormWidgetCheckPrivate;
-struct _FormWidgetCheckPrivate
+typedef struct _GtkFormWidgetCheckPrivate GtkFormWidgetCheckPrivate;
+struct _GtkFormWidgetCheckPrivate
        {
        };
 
 
-GType
-form_widget_check_get_type (void)
-{
-       static GType form_widget_check_type = 0;
-
-       if (!form_widget_check_type)
-               {
-                       static const GTypeInfo form_widget_check_info =
-                       {
-                               sizeof (FormWidgetCheckClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_widget_check_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormWidgetCheck),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_widget_check_init,
-                               NULL
-                       };
-
-                       form_widget_check_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetCheck",
-                                                                        &form_widget_check_info, 0);
-    }
-
-       return form_widget_check_type;
-}
+G_DEFINE_TYPE (GtkFormWidgetCheck, gtk_form_widget_check, TYPE_GTK_FORM_WIDGET)
 
 static void
-form_widget_check_class_init (FormWidgetCheckClass *klass)
+gtk_form_widget_check_class_init (GtkFormWidgetCheckClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+       GtkFormWidgetClass *widget_class = GTK_FORM_WIDGET_CLASS (klass);
 
-       object_class->set_property = form_widget_check_set_property;
-       object_class->get_property = form_widget_check_get_property;
+       object_class->set_property = gtk_form_widget_check_set_property;
+       object_class->get_property = gtk_form_widget_check_get_property;
 
-       widget_class->get_value_stringify = form_widget_check_get_value_stringify;
-       widget_class->set_value_stringify = form_widget_check_set_value_stringify;
-       widget_class->set_editable = form_widget_check_set_editable;
+       widget_class->get_value_stringify = gtk_form_widget_check_get_value_stringify;
+       widget_class->set_value_stringify = gtk_form_widget_check_set_value_stringify;
+       widget_class->set_editable = gtk_form_widget_check_set_editable;
 
-       g_type_class_add_private (object_class, sizeof (FormWidgetCheckPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormWidgetCheckPrivate));
 }
 
 static void
-form_widget_check_init (FormWidgetCheck *form_widget_check)
+gtk_form_widget_check_init (GtkFormWidgetCheck *gtk_form_widget_check)
 {
 }
 
 /**
- * form_widget_check_new:
+ * gtk_form_widget_check_new:
  *
- * Returns: the newly created #FormWidgetCheck.
+ * Returns: the newly created #GtkFormWidgetCheck.
  */
-FormWidget
-*form_widget_check_new ()
+GtkFormWidget
+*gtk_form_widget_check_new ()
 {
-       return g_object_new (TYPE_FORM_WIDGET_CHECK, NULL);
+       return g_object_new (TYPE_GTK_FORM_WIDGET_CHECK, NULL);
 }
 
 /**
- * form_widget_check_get_value_stringify:
+ * gtk_form_widget_check_get_value_stringify:
  * @widget:
  *
  */
 const gchar
-*form_widget_check_get_value_stringify (FormWidget *fwidget)
+*gtk_form_widget_check_get_value_stringify (GtkFormWidget *fwidget)
 {
-       GtkWidget *w = form_widget_get_widget (fwidget);
+       GtkWidget *w = gtk_form_widget_get_widget (fwidget);
 
        return g_strdup_printf ("%d", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)));
 }
 
 /**
- * form_widget_check_set_value_stringify:
+ * gtk_form_widget_check_set_value_stringify:
  * @fwidget:
  * @value:
  *
  */
 gboolean
-form_widget_check_set_value_stringify (FormWidget *fwidget, const gchar *value)
+gtk_form_widget_check_set_value_stringify (GtkFormWidget *fwidget, const gchar *value)
 {
        gboolean ret = FALSE;
        GtkWidget *w;
@@ -149,13 +123,13 @@ form_widget_check_set_value_stringify (FormWidget *fwidget, const gchar *value)
 }
 
 /**
- * form_widget_check_set_editable:
- * @fwidget: a #FormWidget object.
+ * gtk_form_widget_check_set_editable:
+ * @fwidget: a #GtkFormWidget object.
  * @editable:
  *
  */
 void
-form_widget_check_set_editable (FormWidget *fwidget, gboolean editable)
+gtk_form_widget_check_set_editable (GtkFormWidget *fwidget, gboolean editable)
 {
        GtkWidget *w;
 
@@ -168,14 +142,14 @@ form_widget_check_set_editable (FormWidget *fwidget, gboolean editable)
 
 /* PRIVATE */
 static void
-form_widget_check_set_property (GObject *object,
+gtk_form_widget_check_set_property (GObject *object,
                                 guint property_id,
                                 const GValue *value,
                                 GParamSpec *pspec)
 {
-       FormWidgetCheck *widget_check = (FormWidgetCheck *)object;
+       GtkFormWidgetCheck *widget_check = (GtkFormWidgetCheck *)object;
 
-       FormWidgetCheckPrivate *priv = FORM_WIDGET_CHECK_GET_PRIVATE (widget_check);
+       GtkFormWidgetCheckPrivate *priv = GTK_FORM_WIDGET_CHECK_GET_PRIVATE (widget_check);
 
        switch (property_id)
                {
@@ -186,14 +160,14 @@ form_widget_check_set_property (GObject *object,
 }
 
 static void
-form_widget_check_get_property (GObject *object,
+gtk_form_widget_check_get_property (GObject *object,
                                 guint property_id,
                                 GValue *value,
                                 GParamSpec *pspec)
 {
-       FormWidgetCheck *widget_check = (FormWidgetCheck *)object;
+       GtkFormWidgetCheck *widget_check = (GtkFormWidgetCheck *)object;
 
-       FormWidgetCheckPrivate *priv = FORM_WIDGET_CHECK_GET_PRIVATE (widget_check);
+       GtkFormWidgetCheckPrivate *priv = GTK_FORM_WIDGET_CHECK_GET_PRIVATE (widget_check);
 
        switch (property_id)
                {
index 1c7b88c49be2a8560f2979c78c0d9f119b9112f4..9a337f7e2fd19e2ba2641fa1615e3d1df36e18d7 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_WIDGET_CHECK_H__
-#define __LIBFORM_WIDGET_CHECK_H__
+#ifndef __LIBGTK_FORM_WIDGET_CHECK_H__
+#define __LIBGTK_FORM_WIDGET_CHECK_H__
 
 #include "widget.h"
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_WIDGET_CHECK                 (form_widget_check_get_type ())
-#define FORM_WIDGET_CHECK(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_CHECK, FormWidgetCheck))
-#define FORM_WIDGET_CHECK_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_CHECK, FormWidgetCheckClass))
-#define IS_FORM_WIDGET_CHECK(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_CHECK))
-#define IS_FORM_WIDGET_CHECK_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_CHECK))
-#define FORM_WIDGET_CHECK_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_CHECK, FormWidgetCheckClass))
+#define TYPE_GTK_FORM_WIDGET_CHECK                 (gtk_form_widget_check_get_type ())
+#define GTK_FORM_WIDGET_CHECK(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_WIDGET_CHECK, GtkFormWidgetCheck))
+#define GTK_FORM_WIDGET_CHECK_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_WIDGET_CHECK, GtkFormWidgetCheckClass))
+#define IS_GTK_FORM_WIDGET_CHECK(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_WIDGET_CHECK))
+#define IS_GTK_FORM_WIDGET_CHECK_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_WIDGET_CHECK))
+#define GTK_FORM_WIDGET_CHECK_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_WIDGET_CHECK, GtkFormWidgetCheckClass))
 
 
-typedef struct _FormWidgetCheck FormWidgetCheck;
-typedef struct _FormWidgetCheckClass FormWidgetCheckClass;
+typedef struct _GtkFormWidgetCheck GtkFormWidgetCheck;
+typedef struct _GtkFormWidgetCheckClass GtkFormWidgetCheckClass;
 
-struct _FormWidgetCheck
+struct _GtkFormWidgetCheck
        {
-               FormWidget parent;
+               GtkFormWidget parent;
        };
 
-struct _FormWidgetCheckClass
+struct _GtkFormWidgetCheckClass
        {
-               FormWidgetClass parent_class;
+               GtkFormWidgetClass parent_class;
        };
 
-GType form_widget_check_get_type (void) G_GNUC_CONST;
+GType gtk_form_widget_check_get_type (void) G_GNUC_CONST;
 
-FormWidget *form_widget_check_new (void);
+GtkFormWidget *gtk_form_widget_check_new (void);
 
-const gchar *form_widget_check_get_value_stringify (FormWidget *widget);
+const gchar *gtk_form_widget_check_get_value_stringify (GtkFormWidget *widget);
 
-gboolean form_widget_check_set_value_stringify (FormWidget *fwidget, const gchar *value);
+gboolean gtk_form_widget_check_set_value_stringify (GtkFormWidget *fwidget, const gchar *value);
 
-void form_widget_check_set_editable (FormWidget *fwidget, gboolean editable);
+void gtk_form_widget_check_set_editable (GtkFormWidget *fwidget, gboolean editable);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_WIDGET_CHECK_H__ */
+#endif /* __LIBGTK_FORM_WIDGET_CHECK_H__ */
index 03077c9aded54fb20a4a4e3d4e49fc61f2cb7c54..a7d5731c1cbbe2627e6f15abb66628008a4a2427 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <gtk/gtk.h>
@@ -26,67 +26,41 @@ enum
        PROP_COLUMN_FIELD
 };
 
-static void form_widget_combo_box_class_init (FormWidgetComboBoxClass *klass);
-static void form_widget_combo_box_init (FormWidgetComboBox *form_widget_combo_box);
+static void gtk_form_widget_combo_box_class_init (GtkFormWidgetComboBoxClass *klass);
+static void gtk_form_widget_combo_box_init (GtkFormWidgetComboBox *gtk_form_widget_combo_box);
 
-static void form_widget_combo_box_set_property (GObject *object,
+static void gtk_form_widget_combo_box_set_property (GObject *object,
                                                 guint property_id,
                                                 const GValue *value,
                                                 GParamSpec *pspec);
-static void form_widget_combo_box_get_property (GObject *object,
+static void gtk_form_widget_combo_box_get_property (GObject *object,
                                                 guint property_id,
                                                 GValue *value,
                                                 GParamSpec *pspec);
 
-#define FORM_WIDGET_COMBO_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_COMBO_BOX, FormWidgetComboBoxPrivate))
+#define GTK_FORM_WIDGET_COMBO_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_WIDGET_COMBO_BOX, GtkFormWidgetComboBoxPrivate))
 
-typedef struct _FormWidgetComboBoxPrivate FormWidgetComboBoxPrivate;
-struct _FormWidgetComboBoxPrivate
+typedef struct _GtkFormWidgetComboBoxPrivate GtkFormWidgetComboBoxPrivate;
+struct _GtkFormWidgetComboBoxPrivate
        {
                gint column_field;
        };
 
 
-GType
-form_widget_combo_box_get_type (void)
-{
-       static GType form_widget_combo_box_type = 0;
-
-       if (!form_widget_combo_box_type)
-               {
-                       static const GTypeInfo form_widget_combo_box_info =
-                       {
-                               sizeof (FormWidgetComboBoxClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_widget_combo_box_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormWidgetComboBox),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_widget_combo_box_init,
-                               NULL
-                       };
-
-                       form_widget_combo_box_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetComboBox",
-                                                                            &form_widget_combo_box_info, 0);
-    }
-
-       return form_widget_combo_box_type;
-}
+G_DEFINE_TYPE (GtkFormWidgetComboBox, gtk_form_widget_combo_box, TYPE_GTK_FORM_WIDGET)
 
 static void
-form_widget_combo_box_class_init (FormWidgetComboBoxClass *klass)
+gtk_form_widget_combo_box_class_init (GtkFormWidgetComboBoxClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+       GtkFormWidgetClass *widget_class = GTK_FORM_WIDGET_CLASS (klass);
 
-       object_class->set_property = form_widget_combo_box_set_property;
-       object_class->get_property = form_widget_combo_box_get_property;
+       object_class->set_property = gtk_form_widget_combo_box_set_property;
+       object_class->get_property = gtk_form_widget_combo_box_get_property;
 
-       widget_class->get_value_stringify = form_widget_combo_box_get_value_stringify;
-       widget_class->set_value_stringify = form_widget_combo_box_set_value_stringify;
-       widget_class->set_editable = form_widget_combo_box_set_editable;
+       widget_class->get_value_stringify = gtk_form_widget_combo_box_get_value_stringify;
+       widget_class->set_value_stringify = gtk_form_widget_combo_box_set_value_stringify;
+       widget_class->set_editable = gtk_form_widget_combo_box_set_editable;
 
        g_object_class_install_property (object_class, PROP_COLUMN_FIELD,
                                         g_param_spec_int ("column-field",
@@ -97,37 +71,37 @@ form_widget_combo_box_class_init (FormWidgetComboBoxClass *klass)
                                                           0,
                                                           G_PARAM_READWRITE));
 
-       g_type_class_add_private (object_class, sizeof (FormWidgetComboBoxPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormWidgetComboBoxPrivate));
 }
 
 static void
-form_widget_combo_box_init (FormWidgetComboBox *form_widget_combo_box)
+gtk_form_widget_combo_box_init (GtkFormWidgetComboBox *gtk_form_widget_combo_box)
 {
 }
 
 /**
- * form_widget_combo_box_new:
+ * gtk_form_widget_combo_box_new:
  *
- * Returns: the newly created #FormWidgetComboBox.
+ * Returns: the newly created #GtkFormWidgetComboBox.
  */
-FormWidget
-*form_widget_combo_box_new ()
+GtkFormWidget
+*gtk_form_widget_combo_box_new ()
 {
-       return g_object_new (TYPE_FORM_WIDGET_COMBO_BOX, NULL);
+       return g_object_new (TYPE_GTK_FORM_WIDGET_COMBO_BOX, NULL);
 }
 
 /**
- * form_widget_combo_box_get_value_stringify:
+ * gtk_form_widget_combo_box_get_value_stringify:
  * @widget:
  *
  */
 const gchar
-*form_widget_combo_box_get_value_stringify (FormWidget *fwidget)
+*gtk_form_widget_combo_box_get_value_stringify (GtkFormWidget *fwidget)
 {
        const gchar *ret = "";
-       GtkWidget *w = form_widget_get_widget (fwidget);
+       GtkWidget *w = gtk_form_widget_get_widget (fwidget);
 
-       FormWidgetComboBoxPrivate *priv = FORM_WIDGET_COMBO_BOX_GET_PRIVATE (fwidget);
+       GtkFormWidgetComboBoxPrivate *priv = GTK_FORM_WIDGET_COMBO_BOX_GET_PRIVATE (fwidget);
 
        GtkTreeModel *tmodel = gtk_combo_box_get_model (GTK_COMBO_BOX (w));
        if (tmodel != NULL)
@@ -152,19 +126,19 @@ const gchar
 }
 
 /**
- * form_widget_combo_box_set_value_stringify:
+ * gtk_form_widget_combo_box_set_value_stringify:
  * @fwidget:
  * @value:
  *
  */
 gboolean
-form_widget_combo_box_set_value_stringify (FormWidget *fwidget, const gchar *value)
+gtk_form_widget_combo_box_set_value_stringify (GtkFormWidget *fwidget, const gchar *value)
 {
        gboolean ret = FALSE;
        GtkWidget *w;
        GtkTreeModel *tmodel;
 
-       FormWidgetComboBoxPrivate *priv = FORM_WIDGET_COMBO_BOX_GET_PRIVATE (fwidget);
+       GtkFormWidgetComboBoxPrivate *priv = GTK_FORM_WIDGET_COMBO_BOX_GET_PRIVATE (fwidget);
 
        g_object_get (G_OBJECT (fwidget),
                      "widget", &w,
@@ -204,13 +178,13 @@ form_widget_combo_box_set_value_stringify (FormWidget *fwidget, const gchar *val
 }
 
 /**
- * form_widget_combo_box_set_editable:
- * @fwidget: a #FormWidget object.
+ * gtk_form_widget_combo_box_set_editable:
+ * @fwidget: a #GtkFormWidget object.
  * @editable:
  *
  */
 void
-form_widget_combo_box_set_editable (FormWidget *fwidget, gboolean editable)
+gtk_form_widget_combo_box_set_editable (GtkFormWidget *fwidget, gboolean editable)
 {
        GtkWidget *w;
 
@@ -223,14 +197,14 @@ form_widget_combo_box_set_editable (FormWidget *fwidget, gboolean editable)
 
 /* PRIVATE */
 static void
-form_widget_combo_box_set_property (GObject *object,
+gtk_form_widget_combo_box_set_property (GObject *object,
                                     guint property_id,
                                     const GValue *value,
                                     GParamSpec *pspec)
 {
-       FormWidgetComboBox *widget_combo_box = (FormWidgetComboBox *)object;
+       GtkFormWidgetComboBox *widget_combo_box = (GtkFormWidgetComboBox *)object;
 
-       FormWidgetComboBoxPrivate *priv = FORM_WIDGET_COMBO_BOX_GET_PRIVATE (widget_combo_box);
+       GtkFormWidgetComboBoxPrivate *priv = GTK_FORM_WIDGET_COMBO_BOX_GET_PRIVATE (widget_combo_box);
 
        switch (property_id)
                {
@@ -245,14 +219,14 @@ form_widget_combo_box_set_property (GObject *object,
 }
 
 static void
-form_widget_combo_box_get_property (GObject *object,
+gtk_form_widget_combo_box_get_property (GObject *object,
                                     guint property_id,
                                     GValue *value,
                                     GParamSpec *pspec)
 {
-       FormWidgetComboBox *widget_combo_box = (FormWidgetComboBox *)object;
+       GtkFormWidgetComboBox *widget_combo_box = (GtkFormWidgetComboBox *)object;
 
-       FormWidgetComboBoxPrivate *priv = FORM_WIDGET_COMBO_BOX_GET_PRIVATE (widget_combo_box);
+       GtkFormWidgetComboBoxPrivate *priv = GTK_FORM_WIDGET_COMBO_BOX_GET_PRIVATE (widget_combo_box);
 
        switch (property_id)
                {
index a0d48fa46f71a1b0c6261a814fc0468a685c5339..cf069ab4ee887a760240ed5e224c4d2a3e669f30 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_WIDGET_COMBO_BOX_H__
-#define __LIBFORM_WIDGET_COMBO_BOX_H__
+#ifndef __LIBGTK_FORM_WIDGET_COMBO_BOX_H__
+#define __LIBGTK_FORM_WIDGET_COMBO_BOX_H__
 
 #include "widget.h"
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_WIDGET_COMBO_BOX                 (form_widget_combo_box_get_type ())
-#define FORM_WIDGET_COMBO_BOX(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_COMBO_BOX, FormWidgetComboBox))
-#define FORM_WIDGET_COMBO_BOX_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_COMBO_BOX, FormWidgetComboBoxClass))
-#define IS_FORM_WIDGET_COMBO_BOX(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_COMBO_BOX))
-#define IS_FORM_WIDGET_COMBO_BOX_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_COMBO_BOX))
-#define FORM_WIDGET_COMBO_BOX_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_COMBO_BOX, FormWidgetComboBoxClass))
+#define TYPE_GTK_FORM_WIDGET_COMBO_BOX                 (gtk_form_widget_combo_box_get_type ())
+#define GTK_FORM_WIDGET_COMBO_BOX(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_WIDGET_COMBO_BOX, GtkFormWidgetComboBox))
+#define GTK_FORM_WIDGET_COMBO_BOX_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_WIDGET_COMBO_BOX, GtkFormWidgetComboBoxClass))
+#define IS_GTK_FORM_WIDGET_COMBO_BOX(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_WIDGET_COMBO_BOX))
+#define IS_GTK_FORM_WIDGET_COMBO_BOX_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_WIDGET_COMBO_BOX))
+#define GTK_FORM_WIDGET_COMBO_BOX_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_WIDGET_COMBO_BOX, GtkFormWidgetComboBoxClass))
 
 
-typedef struct _FormWidgetComboBox FormWidgetComboBox;
-typedef struct _FormWidgetComboBoxClass FormWidgetComboBoxClass;
+typedef struct _GtkFormWidgetComboBox GtkFormWidgetComboBox;
+typedef struct _GtkFormWidgetComboBoxClass GtkFormWidgetComboBoxClass;
 
-struct _FormWidgetComboBox
+struct _GtkFormWidgetComboBox
        {
-               FormWidget parent;
+               GtkFormWidget parent;
        };
 
-struct _FormWidgetComboBoxClass
+struct _GtkFormWidgetComboBoxClass
        {
-               FormWidgetClass parent_class;
+               GtkFormWidgetClass parent_class;
        };
 
-GType form_widget_combo_box_get_type (void) G_GNUC_CONST;
+GType gtk_form_widget_combo_box_get_type (void) G_GNUC_CONST;
 
-FormWidget *form_widget_combo_box_new (void);
+GtkFormWidget *gtk_form_widget_combo_box_new (void);
 
-const gchar *form_widget_combo_box_get_value_stringify (FormWidget *widget);
+const gchar *gtk_form_widget_combo_box_get_value_stringify (GtkFormWidget *widget);
 
-gboolean form_widget_combo_box_set_value_stringify (FormWidget *fwidget, const gchar *value);
+gboolean gtk_form_widget_combo_box_set_value_stringify (GtkFormWidget *fwidget, const gchar *value);
 
-void form_widget_combo_box_set_editable (FormWidget *fwidget, gboolean editable);
+void gtk_form_widget_combo_box_set_editable (GtkFormWidget *fwidget, gboolean editable);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_WIDGET_COMBO_BOX_H__ */
+#endif /* __LIBGTK_FORM_WIDGET_COMBO_BOX_H__ */
index f1a4a881856c51fd4c60e5bcd79553aaca3c66d8..f2a37e18834841b7c83c25b80bb09a67c9f80c6f 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <gtk/gtk.h>
@@ -25,107 +25,81 @@ enum
        PROP_0
 };
 
-static void form_widget_entry_class_init (FormWidgetEntryClass *klass);
-static void form_widget_entry_init (FormWidgetEntry *form_widget_entry);
+static void gtk_form_widget_entry_class_init (GtkFormWidgetEntryClass *klass);
+static void gtk_form_widget_entry_init (GtkFormWidgetEntry *gtk_form_widget_entry);
 
-static void form_widget_entry_set_property (GObject *object,
+static void gtk_form_widget_entry_set_property (GObject *object,
                                       guint property_id,
                                       const GValue *value,
                                       GParamSpec *pspec);
-static void form_widget_entry_get_property (GObject *object,
+static void gtk_form_widget_entry_get_property (GObject *object,
                                       guint property_id,
                                       GValue *value,
                                       GParamSpec *pspec);
 
-#define FORM_WIDGET_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_ENTRY, FormWidgetEntryPrivate))
+#define GTK_FORM_WIDGET_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_WIDGET_ENTRY, GtkFormWidgetEntryPrivate))
 
-typedef struct _FormWidgetEntryPrivate FormWidgetEntryPrivate;
-struct _FormWidgetEntryPrivate
+typedef struct _GtkFormWidgetEntryPrivate GtkFormWidgetEntryPrivate;
+struct _GtkFormWidgetEntryPrivate
        {
        };
 
 
-GType
-form_widget_entry_get_type (void)
-{
-       static GType form_widget_entry_type = 0;
-
-       if (!form_widget_entry_type)
-               {
-                       static const GTypeInfo form_widget_entry_info =
-                       {
-                               sizeof (FormWidgetEntryClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_widget_entry_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormWidgetEntry),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_widget_entry_init,
-                               NULL
-                       };
-
-                       form_widget_entry_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetEntry",
-                                                                        &form_widget_entry_info, 0);
-    }
-
-       return form_widget_entry_type;
-}
+G_DEFINE_TYPE (GtkFormWidgetEntry, gtk_form_widget_entry, TYPE_GTK_FORM_WIDGET)
 
 static void
-form_widget_entry_class_init (FormWidgetEntryClass *klass)
+gtk_form_widget_entry_class_init (GtkFormWidgetEntryClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+       GtkFormWidgetClass *widget_class = GTK_FORM_WIDGET_CLASS (klass);
 
-       object_class->set_property = form_widget_entry_set_property;
-       object_class->get_property = form_widget_entry_get_property;
+       object_class->set_property = gtk_form_widget_entry_set_property;
+       object_class->get_property = gtk_form_widget_entry_get_property;
 
-       widget_class->get_value_stringify = form_widget_entry_get_value_stringify;
-       widget_class->set_value_stringify = form_widget_entry_set_value_stringify;
-       widget_class->set_editable = form_widget_entry_set_editable;
+       widget_class->get_value_stringify = gtk_form_widget_entry_get_value_stringify;
+       widget_class->set_value_stringify = gtk_form_widget_entry_set_value_stringify;
+       widget_class->set_editable = gtk_form_widget_entry_set_editable;
 
-       g_type_class_add_private (object_class, sizeof (FormWidgetEntryPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormWidgetEntryPrivate));
 }
 
 static void
-form_widget_entry_init (FormWidgetEntry *form_widget_entry)
+gtk_form_widget_entry_init (GtkFormWidgetEntry *gtk_form_widget_entry)
 {
 }
 
 /**
- * form_widget_entry_new:
+ * gtk_form_widget_entry_new:
  *
- * Returns: the newly created #FormWidgetEntry.
+ * Returns: the newly created #GtkFormWidgetEntry.
  */
-FormWidget
-*form_widget_entry_new ()
+GtkFormWidget
+*gtk_form_widget_entry_new ()
 {
-       return g_object_new (TYPE_FORM_WIDGET_ENTRY, NULL);
+       return g_object_new (TYPE_GTK_FORM_WIDGET_ENTRY, NULL);
 }
 
 /**
- * form_widget_entry_get_value_stringify:
+ * gtk_form_widget_entry_get_value_stringify:
  * @widget:
  *
  */
 const gchar
-*form_widget_entry_get_value_stringify (FormWidget *fwidget)
+*gtk_form_widget_entry_get_value_stringify (GtkFormWidget *fwidget)
 {
-       GtkWidget *w = form_widget_get_widget (fwidget);
+       GtkWidget *w = gtk_form_widget_get_widget (fwidget);
 
        return gtk_entry_get_text (GTK_ENTRY (w));
 }
 
 /**
- * form_widget_entry_set_value_stringify:
+ * gtk_form_widget_entry_set_value_stringify:
  * @fwidget:
  * @value:
  *
  */
 gboolean
-form_widget_entry_set_value_stringify (FormWidget *fwidget, const gchar *value)
+gtk_form_widget_entry_set_value_stringify (GtkFormWidget *fwidget, const gchar *value)
 {
        gboolean ret = FALSE;
        GtkWidget *w;
@@ -142,13 +116,13 @@ form_widget_entry_set_value_stringify (FormWidget *fwidget, const gchar *value)
 }
 
 /**
- * form_widget_set_editable:
+ * gtk_form_widget_set_editable:
  * @fwidget:
  * @editable:
  *
  */
 void
-form_widget_entry_set_editable (FormWidget *fwidget, gboolean editable)
+gtk_form_widget_entry_set_editable (GtkFormWidget *fwidget, gboolean editable)
 {
        GtkWidget *w;
 
@@ -161,14 +135,14 @@ form_widget_entry_set_editable (FormWidget *fwidget, gboolean editable)
 
 /* PRIVATE */
 static void
-form_widget_entry_set_property (GObject *object,
+gtk_form_widget_entry_set_property (GObject *object,
                                 guint property_id,
                                 const GValue *value,
                                 GParamSpec *pspec)
 {
-       FormWidgetEntry *widget_entry = (FormWidgetEntry *)object;
+       GtkFormWidgetEntry *widget_entry = (GtkFormWidgetEntry *)object;
 
-       FormWidgetEntryPrivate *priv = FORM_WIDGET_ENTRY_GET_PRIVATE (widget_entry);
+       GtkFormWidgetEntryPrivate *priv = GTK_FORM_WIDGET_ENTRY_GET_PRIVATE (widget_entry);
 
        switch (property_id)
                {
@@ -179,14 +153,14 @@ form_widget_entry_set_property (GObject *object,
 }
 
 static void
-form_widget_entry_get_property (GObject *object,
+gtk_form_widget_entry_get_property (GObject *object,
                                 guint property_id,
                                 GValue *value,
                                 GParamSpec *pspec)
 {
-       FormWidgetEntry *widget_entry = (FormWidgetEntry *)object;
+       GtkFormWidgetEntry *widget_entry = (GtkFormWidgetEntry *)object;
 
-       FormWidgetEntryPrivate *priv = FORM_WIDGET_ENTRY_GET_PRIVATE (widget_entry);
+       GtkFormWidgetEntryPrivate *priv = GTK_FORM_WIDGET_ENTRY_GET_PRIVATE (widget_entry);
 
        switch (property_id)
                {
index 55794936f1f95aca66e993d22baae494b5aac47d..b8990d73dc77b2cafd525af260b7addf117b3135 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_WIDGET_ENTRY_H__
-#define __LIBFORM_WIDGET_ENTRY_H__
+#ifndef __LIBGTK_FORM_WIDGET_ENTRY_H__
+#define __LIBGTK_FORM_WIDGET_ENTRY_H__
 
 #include "widget.h"
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_WIDGET_ENTRY                 (form_widget_entry_get_type ())
-#define FORM_WIDGET_ENTRY(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_ENTRY, FormWidgetEntry))
-#define FORM_WIDGET_ENTRY_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_ENTRY, FormWidgetEntryClass))
-#define IS_FORM_WIDGET_ENTRY(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_ENTRY))
-#define IS_FORM_WIDGET_ENTRY_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_ENTRY))
-#define FORM_WIDGET_ENTRY_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_ENTRY, FormWidgetEntryClass))
+#define TYPE_GTK_FORM_WIDGET_ENTRY                 (gtk_form_widget_entry_get_type ())
+#define GTK_FORM_WIDGET_ENTRY(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_WIDGET_ENTRY, GtkFormWidgetEntry))
+#define GTK_FORM_WIDGET_ENTRY_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_WIDGET_ENTRY, GtkFormWidgetEntryClass))
+#define IS_GTK_FORM_WIDGET_ENTRY(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_WIDGET_ENTRY))
+#define IS_GTK_FORM_WIDGET_ENTRY_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_WIDGET_ENTRY))
+#define GTK_FORM_WIDGET_ENTRY_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_WIDGET_ENTRY, GtkFormWidgetEntryClass))
 
 
-typedef struct _FormWidgetEntry FormWidgetEntry;
-typedef struct _FormWidgetEntryClass FormWidgetEntryClass;
+typedef struct _GtkFormWidgetEntry GtkFormWidgetEntry;
+typedef struct _GtkFormWidgetEntryClass GtkFormWidgetEntryClass;
 
-struct _FormWidgetEntry
+struct _GtkFormWidgetEntry
        {
-               FormWidget parent;
+               GtkFormWidget parent;
        };
 
-struct _FormWidgetEntryClass
+struct _GtkFormWidgetEntryClass
        {
-               FormWidgetClass parent_class;
+               GtkFormWidgetClass parent_class;
        };
 
-GType form_widget_entry_get_type (void) G_GNUC_CONST;
+GType gtk_form_widget_entry_get_type (void) G_GNUC_CONST;
 
-FormWidget *form_widget_entry_new (void);
+GtkFormWidget *gtk_form_widget_entry_new (void);
 
-const gchar *form_widget_entry_get_value_stringify (FormWidget *widget);
+const gchar *gtk_form_widget_entry_get_value_stringify (GtkFormWidget *widget);
 
-gboolean form_widget_entry_set_value_stringify (FormWidget *fwidget, const gchar *value);
+gboolean gtk_form_widget_entry_set_value_stringify (GtkFormWidget *fwidget, const gchar *value);
 
-void form_widget_entry_set_editable (FormWidget *fwidget, gboolean editable);
+void gtk_form_widget_entry_set_editable (GtkFormWidget *fwidget, gboolean editable);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_WIDGET_ENTRY_H__ */
+#endif /* __LIBGTK_FORM_WIDGET_ENTRY_H__ */
index d53faed936871eb0fd6e1c28f547e85e4e41643f..8e3a3d38fb31724dcf81da23c4dd123f7742d763 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <gtk/gtk.h>
@@ -25,106 +25,80 @@ enum
        PROP_0
 };
 
-static void form_widget_label_class_init (FormWidgetLabelClass *klass);
-static void form_widget_label_init (FormWidgetLabel *form_widget_label);
+static void gtk_form_widget_label_class_init (GtkFormWidgetLabelClass *klass);
+static void gtk_form_widget_label_init (GtkFormWidgetLabel *gtk_form_widget_label);
 
-static void form_widget_label_set_property (GObject *object,
+static void gtk_form_widget_label_set_property (GObject *object,
                                       guint property_id,
                                       const GValue *value,
                                       GParamSpec *pspec);
-static void form_widget_label_get_property (GObject *object,
+static void gtk_form_widget_label_get_property (GObject *object,
                                       guint property_id,
                                       GValue *value,
                                       GParamSpec *pspec);
 
-#define FORM_WIDGET_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_LABEL, FormWidgetLabelPrivate))
+#define GTK_FORM_WIDGET_LABEL_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_WIDGET_LABEL, GtkFormWidgetLabelPrivate))
 
-typedef struct _FormWidgetLabelPrivate FormWidgetLabelPrivate;
-struct _FormWidgetLabelPrivate
+typedef struct _GtkFormWidgetLabelPrivate GtkFormWidgetLabelPrivate;
+struct _GtkFormWidgetLabelPrivate
        {
        };
 
 
-GType
-form_widget_label_get_type (void)
-{
-       static GType form_widget_label_type = 0;
-
-       if (!form_widget_label_type)
-               {
-                       static const GTypeInfo form_widget_label_info =
-                       {
-                               sizeof (FormWidgetLabelClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_widget_label_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormWidgetLabel),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_widget_label_init,
-                               NULL
-                       };
-
-                       form_widget_label_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetLabel",
-                                                                        &form_widget_label_info, 0);
-    }
-
-       return form_widget_label_type;
-}
+G_DEFINE_TYPE (GtkFormWidgetLabel, gtk_form_widget_label, TYPE_GTK_FORM_WIDGET)
 
 static void
-form_widget_label_class_init (FormWidgetLabelClass *klass)
+gtk_form_widget_label_class_init (GtkFormWidgetLabelClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+       GtkFormWidgetClass *widget_class = GTK_FORM_WIDGET_CLASS (klass);
 
-       object_class->set_property = form_widget_label_set_property;
-       object_class->get_property = form_widget_label_get_property;
+       object_class->set_property = gtk_form_widget_label_set_property;
+       object_class->get_property = gtk_form_widget_label_get_property;
 
-       widget_class->get_value_stringify = form_widget_label_get_value_stringify;
-       widget_class->set_value_stringify = form_widget_label_set_value_stringify;
+       widget_class->get_value_stringify = gtk_form_widget_label_get_value_stringify;
+       widget_class->set_value_stringify = gtk_form_widget_label_set_value_stringify;
 
-       g_type_class_add_private (object_class, sizeof (FormWidgetLabelPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormWidgetLabelPrivate));
 }
 
 static void
-form_widget_label_init (FormWidgetLabel *form_widget_label)
+gtk_form_widget_label_init (GtkFormWidgetLabel *gtk_form_widget_label)
 {
 }
 
 /**
- * form_widget_label_new:
+ * gtk_form_widget_label_new:
  *
- * Returns: the newly created #FormWidgetLabel.
+ * Returns: the newly created #GtkFormWidgetLabel.
  */
-FormWidget
-*form_widget_label_new ()
+GtkFormWidget
+*gtk_form_widget_label_new ()
 {
-       return g_object_new (TYPE_FORM_WIDGET_LABEL, NULL);
+       return g_object_new (TYPE_GTK_FORM_WIDGET_LABEL, NULL);
 }
 
 /**
- * form_widget_label_get_value_stringify:
+ * gtk_form_widget_label_get_value_stringify:
  * @widget:
  *
  */
 const gchar
-*form_widget_label_get_value_stringify (FormWidget *fwidget)
+*gtk_form_widget_label_get_value_stringify (GtkFormWidget *fwidget)
 {
-       GtkWidget *w = form_widget_get_widget (fwidget);;
+       GtkWidget *w = gtk_form_widget_get_widget (fwidget);;
 
        return gtk_label_get_text (GTK_LABEL (w));
 }
 
 /**
- * form_widget_label_set_value_stringify:
+ * gtk_form_widget_label_set_value_stringify:
  * @fwidget:
  * @value:
  *
  */
 gboolean
-form_widget_label_set_value_stringify (FormWidget *fwidget, const gchar *value)
+gtk_form_widget_label_set_value_stringify (GtkFormWidget *fwidget, const gchar *value)
 {
        gboolean ret = FALSE;
        GtkWidget *w;
@@ -142,14 +116,14 @@ form_widget_label_set_value_stringify (FormWidget *fwidget, const gchar *value)
 
 /* PRIVATE */
 static void
-form_widget_label_set_property (GObject *object,
+gtk_form_widget_label_set_property (GObject *object,
                                 guint property_id,
                                 const GValue *value,
                                 GParamSpec *pspec)
 {
-       FormWidgetLabel *widget_label = (FormWidgetLabel *)object;
+       GtkFormWidgetLabel *widget_label = (GtkFormWidgetLabel *)object;
 
-       FormWidgetLabelPrivate *priv = FORM_WIDGET_LABEL_GET_PRIVATE (widget_label);
+       GtkFormWidgetLabelPrivate *priv = GTK_FORM_WIDGET_LABEL_GET_PRIVATE (widget_label);
 
        switch (property_id)
                {
@@ -160,14 +134,14 @@ form_widget_label_set_property (GObject *object,
 }
 
 static void
-form_widget_label_get_property (GObject *object,
+gtk_form_widget_label_get_property (GObject *object,
                                 guint property_id,
                                 GValue *value,
                                 GParamSpec *pspec)
 {
-       FormWidgetLabel *widget_label = (FormWidgetLabel *)object;
+       GtkFormWidgetLabel *widget_label = (GtkFormWidgetLabel *)object;
 
-       FormWidgetLabelPrivate *priv = FORM_WIDGET_LABEL_GET_PRIVATE (widget_label);
+       GtkFormWidgetLabelPrivate *priv = GTK_FORM_WIDGET_LABEL_GET_PRIVATE (widget_label);
 
        switch (property_id)
                {
index 7eb3218ae8688663e9131e6ce216103617e18d61..eefa2d8d125a23d5a6ee4bb3f52c39b8a689a40a 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_WIDGET_LABEL_H__
-#define __LIBFORM_WIDGET_LABEL_H__
+#ifndef __LIBGTK_FORM_WIDGET_LABEL_H__
+#define __LIBGTK_FORM_WIDGET_LABEL_H__
 
 #include "widget.h"
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_WIDGET_LABEL                 (form_widget_label_get_type ())
-#define FORM_WIDGET_LABEL(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_LABEL, FormWidgetLabel))
-#define FORM_WIDGET_LABEL_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_LABEL, FormWidgetLabelClass))
-#define IS_FORM_WIDGET_LABEL(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_LABEL))
-#define IS_FORM_WIDGET_LABEL_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_LABEL))
-#define FORM_WIDGET_LABEL_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_LABEL, FormWidgetLabelClass))
+#define TYPE_GTK_FORM_WIDGET_LABEL                 (gtk_form_widget_label_get_type ())
+#define GTK_FORM_WIDGET_LABEL(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_WIDGET_LABEL, GtkFormWidgetLabel))
+#define GTK_FORM_WIDGET_LABEL_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_WIDGET_LABEL, GtkFormWidgetLabelClass))
+#define IS_GTK_FORM_WIDGET_LABEL(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_WIDGET_LABEL))
+#define IS_GTK_FORM_WIDGET_LABEL_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_WIDGET_LABEL))
+#define GTK_FORM_WIDGET_LABEL_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_WIDGET_LABEL, GtkFormWidgetLabelClass))
 
 
-typedef struct _FormWidgetLabel FormWidgetLabel;
-typedef struct _FormWidgetLabelClass FormWidgetLabelClass;
+typedef struct _GtkFormWidgetLabel GtkFormWidgetLabel;
+typedef struct _GtkFormWidgetLabelClass GtkFormWidgetLabelClass;
 
-struct _FormWidgetLabel
+struct _GtkFormWidgetLabel
        {
-               FormWidget parent;
+               GtkFormWidget parent;
        };
 
-struct _FormWidgetLabelClass
+struct _GtkFormWidgetLabelClass
        {
-               FormWidgetClass parent_class;
+               GtkFormWidgetClass parent_class;
        };
 
-GType form_widget_label_get_type (void) G_GNUC_CONST;
+GType gtk_form_widget_label_get_type (void) G_GNUC_CONST;
 
-FormWidget *form_widget_label_new (void);
+GtkFormWidget *gtk_form_widget_label_new (void);
 
-const gchar *form_widget_label_get_value_stringify (FormWidget *widget);
+const gchar *gtk_form_widget_label_get_value_stringify (GtkFormWidget *widget);
 
-gboolean form_widget_label_set_value_stringify (FormWidget *fwidget, const gchar *value);
+gboolean gtk_form_widget_label_set_value_stringify (GtkFormWidget *fwidget, const gchar *value);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_WIDGET_LABEL_H__ */
+#endif /* __LIBGTK_FORM_WIDGET_LABEL_H__ */
index 99b6230d32ad3686b19d99fd5a4b4eb4bbaca2fb..fe486bd2d475855d47b3244e73a9545c5e0d3f17 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <stdlib.h>
@@ -27,95 +27,69 @@ enum
        PROP_0
 };
 
-static void form_widget_spin_class_init (FormWidgetSpinClass *klass);
-static void form_widget_spin_init (FormWidgetSpin *form_widget_spin);
+static void gtk_form_widget_spin_class_init (GtkFormWidgetSpinClass *klass);
+static void gtk_form_widget_spin_init (GtkFormWidgetSpin *gtk_form_widget_spin);
 
-static void form_widget_spin_set_property (GObject *object,
+static void gtk_form_widget_spin_set_property (GObject *object,
                                            guint property_id,
                                            const GValue *value,
                                            GParamSpec *pspec);
-static void form_widget_spin_get_property (GObject *object,
+static void gtk_form_widget_spin_get_property (GObject *object,
                                            guint property_id,
                                            GValue *value,
                                            GParamSpec *pspec);
 
-#define FORM_WIDGET_SPIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_SPIN, FormWidgetSpinPrivate))
+#define GTK_FORM_WIDGET_SPIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_WIDGET_SPIN, GtkFormWidgetSpinPrivate))
 
-typedef struct _FormWidgetSpinPrivate FormWidgetSpinPrivate;
-struct _FormWidgetSpinPrivate
+typedef struct _GtkFormWidgetSpinPrivate GtkFormWidgetSpinPrivate;
+struct _GtkFormWidgetSpinPrivate
        {
        };
 
 
-GType
-form_widget_spin_get_type (void)
-{
-       static GType form_widget_spin_type = 0;
-
-       if (!form_widget_spin_type)
-               {
-                       static const GTypeInfo form_widget_spin_info =
-                       {
-                               sizeof (FormWidgetSpinClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_widget_spin_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormWidgetSpin),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_widget_spin_init,
-                               NULL
-                       };
-
-                       form_widget_spin_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetSpin",
-                                                                       &form_widget_spin_info, 0);
-    }
-
-       return form_widget_spin_type;
-}
+G_DEFINE_TYPE (GtkFormWidgetSpin, gtk_form_widget_spin, TYPE_GTK_FORM_WIDGET)
 
 static void
-form_widget_spin_class_init (FormWidgetSpinClass *klass)
+gtk_form_widget_spin_class_init (GtkFormWidgetSpinClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+       GtkFormWidgetClass *widget_class = GTK_FORM_WIDGET_CLASS (klass);
 
-       object_class->set_property = form_widget_spin_set_property;
-       object_class->get_property = form_widget_spin_get_property;
+       object_class->set_property = gtk_form_widget_spin_set_property;
+       object_class->get_property = gtk_form_widget_spin_get_property;
 
-       widget_class->get_value_stringify = form_widget_spin_get_value_stringify;
-       widget_class->set_value_stringify = form_widget_spin_set_value_stringify;
-       widget_class->set_editable = form_widget_spin_set_editable;
+       widget_class->get_value_stringify = gtk_form_widget_spin_get_value_stringify;
+       widget_class->set_value_stringify = gtk_form_widget_spin_set_value_stringify;
+       widget_class->set_editable = gtk_form_widget_spin_set_editable;
 
-       g_type_class_add_private (object_class, sizeof (FormWidgetSpinPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormWidgetSpinPrivate));
 }
 
 static void
-form_widget_spin_init (FormWidgetSpin *form_widget_spin)
+gtk_form_widget_spin_init (GtkFormWidgetSpin *gtk_form_widget_spin)
 {
 }
 
 /**
- * form_widget_spin_new:
+ * gtk_form_widget_spin_new:
  *
- * Returns: the newly created #FormWidgetSpin.
+ * Returns: the newly created #GtkFormWidgetSpin.
  */
-FormWidget
-*form_widget_spin_new ()
+GtkFormWidget
+*gtk_form_widget_spin_new ()
 {
-       return g_object_new (TYPE_FORM_WIDGET_SPIN, NULL);
+       return g_object_new (TYPE_GTK_FORM_WIDGET_SPIN, NULL);
 }
 
 /**
- * form_widget_spin_get_value_stringify:
- * @widget: a #FormWidget object.
+ * gtk_form_widget_spin_get_value_stringify:
+ * @widget: a #GtkFormWidget object.
  *
  */
 const gchar
-*form_widget_spin_get_value_stringify (FormWidget *fwidget)
+*gtk_form_widget_spin_get_value_stringify (GtkFormWidget *fwidget)
 {
-       GtkWidget *w = form_widget_get_widget (fwidget);
+       GtkWidget *w = gtk_form_widget_get_widget (fwidget);
        gchar *ret = NULL;
 
        ret = g_strdup_printf ("%f", gtk_spin_button_get_value (GTK_SPIN_BUTTON (w)));
@@ -124,13 +98,13 @@ const gchar
 }
 
 /**
- * form_widget_spin_set_value_stringify:
- * @fwidget: a #FormWidget object.
+ * gtk_form_widget_spin_set_value_stringify:
+ * @fwidget: a #GtkFormWidget object.
  * @value:
  *
  */
 gboolean
-form_widget_spin_set_value_stringify (FormWidget *fwidget, const gchar *value)
+gtk_form_widget_spin_set_value_stringify (GtkFormWidget *fwidget, const gchar *value)
 {
        gboolean ret = FALSE;
        GtkWidget *w;
@@ -147,13 +121,13 @@ form_widget_spin_set_value_stringify (FormWidget *fwidget, const gchar *value)
 }
 
 /**
- * form_widget_spin_set_editable:
- * @fwidget: a #FormWidget object.
+ * gtk_form_widget_spin_set_editable:
+ * @fwidget: a #GtkFormWidget object.
  * @editable:
  *
  */
 void
-form_widget_spin_set_editable (FormWidget *fwidget, gboolean editable)
+gtk_form_widget_spin_set_editable (GtkFormWidget *fwidget, gboolean editable)
 {
        GtkWidget *w;
 
@@ -166,14 +140,14 @@ form_widget_spin_set_editable (FormWidget *fwidget, gboolean editable)
 
 /* PRIVATE */
 static void
-form_widget_spin_set_property (GObject *object,
+gtk_form_widget_spin_set_property (GObject *object,
                                guint property_id,
                                const GValue *value,
                                GParamSpec *pspec)
 {
-       FormWidgetSpin *widget_spin = (FormWidgetSpin *)object;
+       GtkFormWidgetSpin *widget_spin = (GtkFormWidgetSpin *)object;
 
-       FormWidgetSpinPrivate *priv = FORM_WIDGET_SPIN_GET_PRIVATE (widget_spin);
+       GtkFormWidgetSpinPrivate *priv = GTK_FORM_WIDGET_SPIN_GET_PRIVATE (widget_spin);
 
        switch (property_id)
                {
@@ -184,14 +158,14 @@ form_widget_spin_set_property (GObject *object,
 }
 
 static void
-form_widget_spin_get_property (GObject *object,
+gtk_form_widget_spin_get_property (GObject *object,
                                guint property_id,
                                GValue *value,
                                GParamSpec *pspec)
 {
-       FormWidgetSpin *widget_spin = (FormWidgetSpin *)object;
+       GtkFormWidgetSpin *widget_spin = (GtkFormWidgetSpin *)object;
 
-       FormWidgetSpinPrivate *priv = FORM_WIDGET_SPIN_GET_PRIVATE (widget_spin);
+       GtkFormWidgetSpinPrivate *priv = GTK_FORM_WIDGET_SPIN_GET_PRIVATE (widget_spin);
 
        switch (property_id)
                {
index 55b7245406130cb8cfde72068edb0b97847affb0..888d30ba5a7b96caadc55d3d42a8763760c71571 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_WIDGET_SPIN_H__
-#define __LIBFORM_WIDGET_SPIN_H__
+#ifndef __LIBGTK_FORM_WIDGET_SPIN_H__
+#define __LIBGTK_FORM_WIDGET_SPIN_H__
 
 #include "widget.h"
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_WIDGET_SPIN                 (form_widget_spin_get_type ())
-#define FORM_WIDGET_SPIN(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_SPIN, FormWidgetSpin))
-#define FORM_WIDGET_SPIN_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_SPIN, FormWidgetSpinClass))
-#define IS_FORM_WIDGET_SPIN(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_SPIN))
-#define IS_FORM_WIDGET_SPIN_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_SPIN))
-#define FORM_WIDGET_SPIN_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_SPIN, FormWidgetSpinClass))
+#define TYPE_GTK_FORM_WIDGET_SPIN                 (gtk_form_widget_spin_get_type ())
+#define GTK_FORM_WIDGET_SPIN(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_WIDGET_SPIN, GtkFormWidgetSpin))
+#define GTK_FORM_WIDGET_SPIN_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_WIDGET_SPIN, GtkFormWidgetSpinClass))
+#define IS_GTK_FORM_WIDGET_SPIN(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_WIDGET_SPIN))
+#define IS_GTK_FORM_WIDGET_SPIN_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_WIDGET_SPIN))
+#define GTK_FORM_WIDGET_SPIN_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_WIDGET_SPIN, GtkFormWidgetSpinClass))
 
 
-typedef struct _FormWidgetSpin FormWidgetSpin;
-typedef struct _FormWidgetSpinClass FormWidgetSpinClass;
+typedef struct _GtkFormWidgetSpin GtkFormWidgetSpin;
+typedef struct _GtkFormWidgetSpinClass GtkFormWidgetSpinClass;
 
-struct _FormWidgetSpin
+struct _GtkFormWidgetSpin
        {
-               FormWidget parent;
+               GtkFormWidget parent;
        };
 
-struct _FormWidgetSpinClass
+struct _GtkFormWidgetSpinClass
        {
-               FormWidgetClass parent_class;
+               GtkFormWidgetClass parent_class;
        };
 
-GType form_widget_spin_get_type (void) G_GNUC_CONST;
+GType gtk_form_widget_spin_get_type (void) G_GNUC_CONST;
 
-FormWidget *form_widget_spin_new (void);
+GtkFormWidget *gtk_form_widget_spin_new (void);
 
-const gchar *form_widget_spin_get_value_stringify (FormWidget *widget);
+const gchar *gtk_form_widget_spin_get_value_stringify (GtkFormWidget *widget);
 
-gboolean form_widget_spin_set_value_stringify (FormWidget *fwidget, const gchar *value);
+gboolean gtk_form_widget_spin_set_value_stringify (GtkFormWidget *fwidget, const gchar *value);
 
-void form_widget_spin_set_editable (FormWidget *fwidget, gboolean editable);
+void gtk_form_widget_spin_set_editable (GtkFormWidget *fwidget, gboolean editable);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_WIDGET_SPIN_H__ */
+#endif /* __LIBGTK_FORM_WIDGET_SPIN_H__ */
index a8514d764f9f2683ad843b39580c523b01275739..c80dbff4d071566939ebe9d39b2e81ad10a1224c 100644 (file)
@@ -1,19 +1,19 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include <gtk/gtk.h>
@@ -25,93 +25,67 @@ enum
        PROP_0
 };
 
-static void form_widget_textview_class_init (FormWidgetTextviewClass *klass);
-static void form_widget_textview_init (FormWidgetTextview *form_widget_textview);
+static void gtk_form_widget_textview_class_init (GtkFormWidgetTextviewClass *klass);
+static void gtk_form_widget_textview_init (GtkFormWidgetTextview *gtk_form_widget_textview);
 
-static void form_widget_textview_set_property (GObject *object,
+static void gtk_form_widget_textview_set_property (GObject *object,
                                       guint property_id,
                                       const GValue *value,
                                       GParamSpec *pspec);
-static void form_widget_textview_get_property (GObject *object,
+static void gtk_form_widget_textview_get_property (GObject *object,
                                       guint property_id,
                                       GValue *value,
                                       GParamSpec *pspec);
 
-#define FORM_WIDGET_TEXTVIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_FORM_WIDGET_TEXTVIEW, FormWidgetTextviewPrivate))
+#define GTK_FORM_WIDGET_TEXTVIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), TYPE_GTK_FORM_WIDGET_TEXTVIEW, GtkFormWidgetTextviewPrivate))
 
-typedef struct _FormWidgetTextviewPrivate FormWidgetTextviewPrivate;
-struct _FormWidgetTextviewPrivate
+typedef struct _GtkFormWidgetTextviewPrivate GtkFormWidgetTextviewPrivate;
+struct _GtkFormWidgetTextviewPrivate
        {
        };
 
 
-GType
-form_widget_textview_get_type (void)
-{
-       static GType form_widget_textview_type = 0;
-
-       if (!form_widget_textview_type)
-               {
-                       static const GTypeInfo form_widget_textview_info =
-                       {
-                               sizeof (FormWidgetTextviewClass),
-                               NULL,           /* base_init */
-                               NULL,           /* base_finalize */
-                               (GClassInitFunc) form_widget_textview_class_init,
-                               NULL,           /* class_finalize */
-                               NULL,           /* class_data */
-                               sizeof (FormWidgetTextview),
-                               0,              /* n_preallocs */
-                               (GInstanceInitFunc) form_widget_textview_init,
-                               NULL
-                       };
-
-                       form_widget_textview_type = g_type_register_static (TYPE_FORM_WIDGET, "FormWidgetTextview",
-                                                                           &form_widget_textview_info, 0);
-    }
-
-       return form_widget_textview_type;
-}
+G_DEFINE_TYPE (GtkFormWidgetTextview, gtk_form_widget_textview, TYPE_GTK_FORM_WIDGET)
 
 static void
-form_widget_textview_class_init (FormWidgetTextviewClass *klass)
+gtk_form_widget_textview_class_init (GtkFormWidgetTextviewClass *klass)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       FormWidgetClass *widget_class = FORM_WIDGET_CLASS (klass);
+       GtkFormWidgetClass *widget_class = GTK_FORM_WIDGET_CLASS (klass);
 
-       object_class->set_property = form_widget_textview_set_property;
-       object_class->get_property = form_widget_textview_get_property;
+       object_class->set_property = gtk_form_widget_textview_set_property;
+       object_class->get_property = gtk_form_widget_textview_get_property;
 
-       widget_class->get_value_stringify = form_widget_textview_get_value_stringify;
-       widget_class->set_value_stringify = form_widget_textview_set_value_stringify;
-       widget_class->set_editable = form_widget_textview_set_editable;
+       widget_class->get_value_stringify = gtk_form_widget_textview_get_value_stringify;
+       widget_class->set_value_stringify = gtk_form_widget_textview_set_value_stringify;
+       widget_class->set_editable = gtk_form_widget_textview_set_editable;
 
-       g_type_class_add_private (object_class, sizeof (FormWidgetTextviewPrivate));
+       g_type_class_add_private (object_class, sizeof (GtkFormWidgetTextviewPrivate));
 }
 
 static void
-form_widget_textview_init (FormWidgetTextview *form_widget_textview)
+gtk_form_widget_textview_init (GtkFormWidgetTextview *gtk_form_widget_textview)
 {
 }
 
 /**
- * form_widget_textview_new:
+ * gtk_form_widget_textview_new:
  *
- * Returns: the newly created #FormWidgetTextview.
+ * Returns: the newly created #GtkFormWidgetTextview.
  */
-FormWidget
-*form_widget_textview_new ()
+GtkFormWidget
+*gtk_form_widget_textview_new ()
 {
-       return g_object_new (TYPE_FORM_WIDGET_TEXTVIEW, NULL);
+       return g_object_new (TYPE_GTK_FORM_WIDGET_TEXTVIEW, NULL);
 }
 
 /**
- * form_widget_textview_get_value_stringify:
- * @widget: a #FormWidget object.
+ * gtk_form_widget_textview_get_value_stringify:
+ * @widget: a #GtkFormWidget object.
  *
  */
 const gchar
-*form_widget_textview_get_value_stringify (FormWidget *fwidget)
+*gtk_form_widget_textview_get_value_stringify (GtkFormWidget *fwidget)
 {
        gchar *ret = NULL;
        GtkWidget *w;
@@ -119,7 +93,7 @@ const gchar
        GtkTextIter start;
        GtkTextIter end;
 
-       w = form_widget_get_widget (fwidget);
+       w = gtk_form_widget_get_widget (fwidget);
 
        buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w));
        gtk_text_buffer_get_bounds (buf, &start, &end);
@@ -129,13 +103,13 @@ const gchar
 }
 
 /**
- * form_widget_textview_set_value_stringify:
- * @fwidget: a #FormWidget object.
+ * gtk_form_widget_textview_set_value_stringify:
+ * @fwidget: a #GtkFormWidget object.
  * @value:
  *
  */
 gboolean
-form_widget_textview_set_value_stringify (FormWidget *fwidget, const gchar *value)
+gtk_form_widget_textview_set_value_stringify (GtkFormWidget *fwidget, const gchar *value)
 {
        gboolean ret = FALSE;
        GtkWidget *w;
@@ -154,13 +128,13 @@ form_widget_textview_set_value_stringify (FormWidget *fwidget, const gchar *valu
 }
 
 /**
- * form_widget_textview_set_editable:
- * @fwidget: a #FormWidget object.
+ * gtk_form_widget_textview_set_editable:
+ * @fwidget: a #GtkFormWidget object.
  * @editable:
  *
  */
 void
-form_widget_textview_set_editable (FormWidget *fwidget, gboolean editable)
+gtk_form_widget_textview_set_editable (GtkFormWidget *fwidget, gboolean editable)
 {
        GtkWidget *w;
 
@@ -173,14 +147,14 @@ form_widget_textview_set_editable (FormWidget *fwidget, gboolean editable)
 
 /* PRIVATE */
 static void
-form_widget_textview_set_property (GObject *object,
+gtk_form_widget_textview_set_property (GObject *object,
                                    guint property_id,
                                    const GValue *value,
                                    GParamSpec *pspec)
 {
-       FormWidgetTextview *widget_textview = (FormWidgetTextview *)object;
+       GtkFormWidgetTextview *widget_textview = (GtkFormWidgetTextview *)object;
 
-       FormWidgetTextviewPrivate *priv = FORM_WIDGET_TEXTVIEW_GET_PRIVATE (widget_textview);
+       GtkFormWidgetTextviewPrivate *priv = GTK_FORM_WIDGET_TEXTVIEW_GET_PRIVATE (widget_textview);
 
        switch (property_id)
                {
@@ -191,14 +165,14 @@ form_widget_textview_set_property (GObject *object,
 }
 
 static void
-form_widget_textview_get_property (GObject *object,
+gtk_form_widget_textview_get_property (GObject *object,
                                    guint property_id,
                                    GValue *value,
                                    GParamSpec *pspec)
 {
-       FormWidgetTextview *widget_textview = (FormWidgetTextview *)object;
+       GtkFormWidgetTextview *widget_textview = (GtkFormWidgetTextview *)object;
 
-       FormWidgetTextviewPrivate *priv = FORM_WIDGET_TEXTVIEW_GET_PRIVATE (widget_textview);
+       GtkFormWidgetTextviewPrivate *priv = GTK_FORM_WIDGET_TEXTVIEW_GET_PRIVATE (widget_textview);
 
        switch (property_id)
                {
index c374fb44c45ef92535da0704fb35e5f63e97b705..9c27053528a6a8c7be4d158be5198692678d100f 100644 (file)
@@ -1,23 +1,23 @@
 /*
  * Copyright (C) 2005-2009 Andrea Zagli <azagli@libero.it>
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef __LIBFORM_WIDGET_TEXTVIEW_H__
-#define __LIBFORM_WIDGET_TEXTVIEW_H__
+#ifndef __LIBGTK_FORM_WIDGET_TEXTVIEW_H__
+#define __LIBGTK_FORM_WIDGET_TEXTVIEW_H__
 
 #include "widget.h"
 
 G_BEGIN_DECLS
 
 
-#define TYPE_FORM_WIDGET_TEXTVIEW                 (form_widget_textview_get_type ())
-#define FORM_WIDGET_TEXTVIEW(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_FORM_WIDGET_TEXTVIEW, FormWidgetTextview))
-#define FORM_WIDGET_TEXTVIEW_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_FORM_WIDGET_TEXTVIEW, FormWidgetTextviewClass))
-#define IS_FORM_WIDGET_TEXTVIEW(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_FORM_WIDGET_TEXTVIEW))
-#define IS_FORM_WIDGET_TEXTVIEW_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_FORM_WIDGET_TEXTVIEW))
-#define FORM_WIDGET_TEXTVIEW_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_FORM_WIDGET_TEXTVIEW, FormWidgetTextviewClass))
+#define TYPE_GTK_FORM_WIDGET_TEXTVIEW                 (gtk_form_widget_textview_get_type ())
+#define GTK_FORM_WIDGET_TEXTVIEW(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GTK_FORM_WIDGET_TEXTVIEW, GtkFormWidgetTextview))
+#define GTK_FORM_WIDGET_TEXTVIEW_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_GTK_FORM_WIDGET_TEXTVIEW, GtkFormWidgetTextviewClass))
+#define IS_GTK_FORM_WIDGET_TEXTVIEW(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_GTK_FORM_WIDGET_TEXTVIEW))
+#define IS_GTK_FORM_WIDGET_TEXTVIEW_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_GTK_FORM_WIDGET_TEXTVIEW))
+#define GTK_FORM_WIDGET_TEXTVIEW_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_GTK_FORM_WIDGET_TEXTVIEW, GtkFormWidgetTextviewClass))
 
 
-typedef struct _FormWidgetTextview FormWidgetTextview;
-typedef struct _FormWidgetTextviewClass FormWidgetTextviewClass;
+typedef struct _GtkFormWidgetTextview GtkFormWidgetTextview;
+typedef struct _GtkFormWidgetTextviewClass GtkFormWidgetTextviewClass;
 
-struct _FormWidgetTextview
+struct _GtkFormWidgetTextview
        {
-               FormWidget parent;
+               GtkFormWidget parent;
        };
 
-struct _FormWidgetTextviewClass
+struct _GtkFormWidgetTextviewClass
        {
-               FormWidgetClass parent_class;
+               GtkFormWidgetClass parent_class;
        };
 
-GType form_widget_textview_get_type (void) G_GNUC_CONST;
+GType gtk_form_widget_textview_get_type (void) G_GNUC_CONST;
 
-FormWidget *form_widget_textview_new (void);
+GtkFormWidget *gtk_form_widget_textview_new (void);
 
-const gchar *form_widget_textview_get_value_stringify (FormWidget *widget);
+const gchar *gtk_form_widget_textview_get_value_stringify (GtkFormWidget *widget);
 
-gboolean form_widget_textview_set_value_stringify (FormWidget *fwidget, const gchar *value);
+gboolean gtk_form_widget_textview_set_value_stringify (GtkFormWidget *fwidget, const gchar *value);
 
-void form_widget_textview_set_editable (FormWidget *fwidget, gboolean editable);
+void gtk_form_widget_textview_set_editable (GtkFormWidget *fwidget, gboolean editable);
 
 
 G_END_DECLS
 
 
-#endif /* __LIBFORM_WIDGET_TEXTVIEW_H__ */
+#endif /* __LIBGTK_FORM_WIDGET_TEXTVIEW_H__ */
index fb4ebe77db8d911025b1a3740a61803a27150707..07fabaf42f991f4d05581fea2b85574299bc1ad7 100644 (file)
 #include "widgetspin.h"
 #include "widgettextview.h"
 
-Form *form;
+GtkForm *form;
 
-FormField *ftext;
-FormField *fint;
-FormField *ffloat;
-FormField *fbool;
-FormField *fdatetime;
+GtkFormField *ftext;
+GtkFormField *fint;
+GtkFormField *ffloat;
+GtkFormField *fbool;
+GtkFormField *fdatetime;
 
-FormWidget *wlabel;
-FormWidget *wentry;
-FormWidget *wtxtv;
-FormWidget *wspin;
-FormWidget *wcheck;
-FormWidget *wcombobox;
+GtkFormWidget *wlabel;
+GtkFormWidget *wentry;
+GtkFormWidget *wtxtv;
+GtkFormWidget *wspin;
+GtkFormWidget *wcheck;
+GtkFormWidget *wcombobox;
 
 GtkWidget *w;
 GtkWidget *txtvSql;
@@ -61,14 +61,14 @@ void
 on_btnClear_clicked (GtkButton *button,
                      gpointer user_data)
 {
-       form_clear (form);
+       gtk_form_clear (form);
 }
 
 void
 on_btnCheck_clicked (GtkButton *button,
                      gpointer user_data)
 {
-       if (!form_check (form))
+       if (!gtk_form_check (form))
                {
                        GtkWidget *diag = gtk_message_dialog_new (GTK_WINDOW (w),
                                                                  GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -87,12 +87,12 @@ on_tbtnEditable_toggled (GtkToggleButton *button,
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tbtnEditable)))
                {
                        gtk_button_set_label (GTK_BUTTON (tbtnEditable), "Not Editable");
-                       form_set_editable (form, FALSE);
+                       gtk_form_set_editable (form, FALSE);
                }
        else
                {
                        gtk_button_set_label (GTK_BUTTON (tbtnEditable), "Editable");
-                       form_set_editable (form, TRUE);
+                       gtk_form_set_editable (form, TRUE);
                }
 }
 
@@ -103,12 +103,12 @@ on_tbtnSensitive_toggled (GtkToggleButton *button,
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tbtnSensitive)))
                {
                        gtk_button_set_label (GTK_BUTTON (tbtnSensitive), "Not Sensitive");
-                       form_set_sensitive (form, FALSE);
+                       gtk_form_set_sensitive (form, FALSE);
                }
        else
                {
                        gtk_button_set_label (GTK_BUTTON (tbtnSensitive), "Sensitive");
-                       form_set_sensitive (form, TRUE);
+                       gtk_form_set_sensitive (form, TRUE);
                }
 }
 
@@ -117,7 +117,7 @@ on_btnSqlSelect_clicked (GtkButton *button,
                          gpointer user_data)
 {
        GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvSql));
-       gchar *sql = form_get_sql (form, FORM_SQL_SELECT);
+       gchar *sql = gtk_form_get_sql (form, GTK_FORM_SQL_SELECT);
 
        gtk_text_buffer_set_text (buf, sql, strlen (sql));
 }
@@ -127,7 +127,7 @@ on_btnSqlUpdate_clicked (GtkButton *button,
                          gpointer user_data)
 {
        GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvSql));
-       gchar *sql = form_get_sql (form, FORM_SQL_UPDATE);
+       gchar *sql = gtk_form_get_sql (form, GTK_FORM_SQL_UPDATE);
 
        gtk_text_buffer_set_text (buf, sql, strlen (sql));
 }
@@ -137,7 +137,7 @@ on_btnSqlInsert_clicked (GtkButton *button,
                          gpointer user_data)
 {
        GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvSql));
-       gchar *sql = form_get_sql (form, FORM_SQL_INSERT);
+       gchar *sql = gtk_form_get_sql (form, GTK_FORM_SQL_INSERT);
 
        gtk_text_buffer_set_text (buf, sql, strlen (sql));
 }
@@ -147,7 +147,7 @@ on_btnSqlDelete_clicked (GtkButton *button,
                          gpointer user_data)
 {
        GtkTextBuffer *buf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (txtvSql));
-       gchar *sql = form_get_sql (form, FORM_SQL_DELETE);
+       gchar *sql = gtk_form_get_sql (form, GTK_FORM_SQL_DELETE);
 
        gtk_text_buffer_set_text (buf, sql, strlen (sql));
 }
@@ -205,7 +205,7 @@ int
 main (int argc, char **argv)
 {
        GladeXML *glade;
-       FormKey *key;
+       GtkFormKey *key;
        time_t time_now;
        struct tm *now;
 
@@ -218,131 +218,131 @@ main (int argc, char **argv)
        tbtnEditable = glade_xml_get_widget (glade, "tbtnEditable");
        tbtnSensitive = glade_xml_get_widget (glade, "tbtnSensitive");
 
-       form = form_new ();
+       form = gtk_form_new ();
        if (form == NULL) return 0;
 
-       key = form_key_new ();
+       key = gtk_form_key_new ();
        g_object_set (G_OBJECT (form),
                      "table", "names",
                      "key", key,
                      NULL);
 
        /* LABEL - INTEGER */
-       wlabel = form_widget_label_new ();
-       form_widget_set_from_glade (wlabel, glade, "lblID");
+       wlabel = gtk_form_widget_label_new ();
+       gtk_form_widget_set_from_glade (wlabel, glade, "lblID");
 
-       fint = form_field_integer_new ();
+       fint = gtk_form_field_integer_new ();
        g_object_set (fint,
                      "field", "id",
                      "form-widget", wlabel,
                      "default", 15,
                      NULL);
-       form_add_field (form, fint);
-       form_key_add_field (key, fint);
+       gtk_form_add_field (form, fint);
+       gtk_form_key_add_field (key, fint);
 
        /* LABEL - TEXT */
-       wlabel = form_widget_label_new ();
-       form_widget_set_from_glade (wlabel, glade, "lblText");
+       wlabel = gtk_form_widget_label_new ();
+       gtk_form_widget_set_from_glade (wlabel, glade, "lblText");
 
-       ftext = form_field_text_new ();
+       ftext = gtk_form_field_text_new ();
        g_object_set (ftext,
                      "field", "id",
                      "form-widget", wlabel,
                      "default", "default value",
                      NULL);
-       form_add_field (form, ftext);
+       gtk_form_add_field (form, ftext);
 
        /* ENTRY - TEXT */
-       wentry = form_widget_entry_new ();
-       form_widget_set_from_glade (wentry, glade, "txtName");
+       wentry = gtk_form_widget_entry_new ();
+       gtk_form_widget_set_from_glade (wentry, glade, "txtName");
 
-       ftext = form_field_text_new ();
+       ftext = gtk_form_field_text_new ();
        g_object_set (ftext,
                      "field", "name",
                                                                "obligatory", TRUE,
                      "form-widget", wentry,
                      "default", "entry default value",
                      NULL);
-       form_add_field (form, ftext);
+       gtk_form_add_field (form, ftext);
 
        /* SPIN - INTEGER */
-       wspin = form_widget_spin_new ();
-       form_widget_set_from_glade (wspin, glade, "spnAge");
+       wspin = gtk_form_widget_spin_new ();
+       gtk_form_widget_set_from_glade (wspin, glade, "spnAge");
 
-       fint = form_field_integer_new ();
+       fint = gtk_form_field_integer_new ();
        g_object_set (fint,
                      "field", "age",
                      "form-widget", wspin,
                      "default", 23,
                      NULL);
-       form_add_field (form, fint);
+       gtk_form_add_field (form, fint);
 
        /* SPIN - FLOAT */
-       wspin = form_widget_spin_new ();
-       form_widget_set_from_glade (wspin, glade, "spnAmount");
+       wspin = gtk_form_widget_spin_new ();
+       gtk_form_widget_set_from_glade (wspin, glade, "spnAmount");
 
-       ffloat = form_field_float_new ();
+       ffloat = gtk_form_field_float_new ();
        g_object_set (ffloat,
                      "field", "amount",
                      "form-widget", wspin,
                      "default", 12.45f,
                      NULL);
-       form_add_field (form, ffloat);
+       gtk_form_add_field (form, ffloat);
 
        /* COMBOBOX - INTEGER */
        create_cb_nation (glade_xml_get_widget (glade, "cbNation"));
 
-       wcombobox = form_widget_combo_box_new ();
-       form_widget_set_from_glade (wcombobox, glade, "cbNation");
+       wcombobox = gtk_form_widget_combo_box_new ();
+       gtk_form_widget_set_from_glade (wcombobox, glade, "cbNation");
        g_object_set (wcombobox,
                      "column-field", 0,
                                                                NULL);
 
-       fint = form_field_integer_new ();
+       fint = gtk_form_field_integer_new ();
        g_object_set (fint,
                      "field", "id_nation",
                      "form-widget", wcombobox,
                      "default", 3,
                      NULL);
-       form_add_field (form, fint);
+       gtk_form_add_field (form, fint);
 
        /* CHECK - BOOL*/
-       wcheck = form_widget_check_new ();
-       form_widget_set_from_glade (wcheck, glade, "chkMarried");
+       wcheck = gtk_form_widget_check_new ();
+       gtk_form_widget_set_from_glade (wcheck, glade, "chkMarried");
 
-       fbool = form_field_boolean_new ();
+       fbool = gtk_form_field_boolean_new ();
        g_object_set (fbool,
                      "field", "married",
                      "form-widget", wcheck,
                      NULL);
-       form_add_field (form, fbool);
+       gtk_form_add_field (form, fbool);
 
        /* TEXTVIEW - TEXT */
-       wtxtv = form_widget_textview_new ();
-       form_widget_set_from_glade (wtxtv, glade, "txtvDescription");
+       wtxtv = gtk_form_widget_textview_new ();
+       gtk_form_widget_set_from_glade (wtxtv, glade, "txtvDescription");
 
-       ftext = form_field_text_new ();
+       ftext = gtk_form_field_text_new ();
        g_object_set (ftext,
                      "field", "description",
                      "form-widget", wtxtv,
                                                                "default", "the default value\nfor this text view\nwith also line feed\nand\tt\ta\tb",
                      NULL);
-       form_add_field (form, ftext);
+       gtk_form_add_field (form, ftext);
 
        /* LABEL - DATETIME */
        time (&time_now);
        now = localtime (&time_now);
 
-       wlabel = form_widget_label_new ();
-       form_widget_set_from_glade (wlabel, glade, "lblDateTime");
+       wlabel = gtk_form_widget_label_new ();
+       gtk_form_widget_set_from_glade (wlabel, glade, "lblDateTime");
 
-       fdatetime = form_field_datetime_new ();
+       fdatetime = gtk_form_field_datetime_new ();
        g_object_set (fdatetime,
                      "field", "now",
                      "form-widget", wlabel,
                                                                "default", now,
                      NULL);
-       form_add_field (form, fdatetime);
+       gtk_form_add_field (form, fdatetime);
 
        txtvSql = glade_xml_get_widget (glade, "txtvSql");
 
index f250867716a4c02f703681a253fabee28a270e1b..9035c10515940f55c5a1faa756de8c7e0b8296db 100644 (file)
                   <widget class="GtkTextView" id="txtvSql">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
+                    <property name="wrap_mode">word</property>
                   </widget>
                 </child>
               </widget>