]> saetta.ns0.it Git - solipa/libsolipa/commitdiff
Aggiunta la funzione SolipaAllegato::add_to_gtkform.
authorAndrea Zagli <azagli@libero.it>
Sun, 30 Jan 2011 11:24:46 +0000 (12:24 +0100)
committerAndrea Zagli <azagli@libero.it>
Sun, 30 Jan 2011 11:24:46 +0000 (12:24 +0100)
configure.ac
src/allegato.c
src/allegato.h

index efc2c4d30af68565f5b699151f5a37c663214034..a6ee59b97b8d8a72309177a83dc336f750d609b8 100644 (file)
@@ -30,6 +30,7 @@ AC_PROG_RANLIB
 PKG_CHECK_MODULES(SOLIPA, [gobject-2.0 >= 2.24.0
                            glib-2.0 >= 2.24.0
                            libgdaex >= 0.2.2
+                           libgtkform >= 0.1.4
                            camel-provider-1.2 >= 2.24
                            gtk+-2.0 >= 2.20
                            gio-2.0 >= 2.24])
index a99298f317751a1458f3704f76c0a4bed3c41153..5d1dc9a5c7b69e6c958e1068414d27679db463f4 100644 (file)
 
 #include <sql-parser/gda-sql-parser.h>
 
+#include <libgtkform/field.h>
+#include <libgtkform/fielddatetime.h>
+#include <libgtkform/fieldinteger.h>
+#include <libgtkform/fieldtext.h>
+#include <libgtkform/widget.h>
+#include <libgtkform/widgetentry.h>
+
 #include "allegato.h"
 
 static void solipa_allegato_class_init (SolipaAllegatoClass *class);
@@ -322,6 +329,64 @@ solipa_allegato_salva_in_db (GdaConnection *gda_con, const gchar *sql,
        return TRUE;
 }
 
+void solipa_allegato_add_to_gtkform (SolipaAllegato *solipa_allegato, GtkForm *form,
+                                     const gchar *percorso_field,
+                                     const gchar *data_field,
+                                     const gchar *dimensione_field)
+{
+       SolipaAllegatoPrivate *priv;
+
+       GtkFormWidget *wentry;
+       GtkFormField *ftext;
+       GtkFormField *fdatetime;
+       GtkFormField *fint;
+
+       g_return_if_fail (IS_SOLIPA_ALLEGATO (solipa_allegato));
+       g_return_if_fail (IS_GTK_FORM (form));
+       g_return_if_fail (percorso_field != NULL);
+
+       priv = SOLIPA_ALLEGATO_GET_PRIVATE (solipa_allegato);
+
+       wentry = gtk_form_widget_entry_new ();
+       gtk_form_widget_set_from_gtkbuilder (wentry, priv->gtkbuilder, "entry42");
+
+       ftext = gtk_form_field_text_new ();
+       g_object_set (ftext,
+                     "field", percorso_field,
+                     "obligatory", TRUE,
+                     "form-widget", wentry,
+                     NULL);
+       gtk_form_add_field (form, ftext);
+
+       if (data_field != NULL)
+               {
+                       wentry = gtk_form_widget_entry_new ();
+                       gtk_form_widget_set_from_gtkbuilder (wentry, priv->gtkbuilder, "entry44");
+
+                       fdatetime = gtk_form_field_datetime_new ();
+                       g_object_set (fdatetime,
+                                     "field", data_field,
+                                     "form-widget", wentry,
+                                     "type", GTK_FORM_FIELD_DATETIME_TYPE_DATETIME,
+                                     "display-format", "%d/%m/%Y %H.%M.%S",
+                                     NULL);
+                       gtk_form_add_field (form, fdatetime);
+               }
+
+       if (dimensione_field != NULL)
+               {
+                       wentry = gtk_form_widget_entry_new ();
+                       gtk_form_widget_set_from_gtkbuilder (wentry, priv->gtkbuilder, "entry45");
+
+                       fint = gtk_form_field_integer_new ();
+                       g_object_set (fint,
+                                     "field", dimensione_field,
+                                     "form-widget", wentry,
+                                     NULL);
+                       gtk_form_add_field (form, fint);
+               }
+}
+
 /* PRIVATE */
 static void
 solipa_allegato_set_property (GObject *object,
index 46a7621d4affe09101f1185aaad332bbf83f6905..5a37afa2e7e2d852eecf1299c5fb182fae8e9565 100644 (file)
@@ -23,6 +23,7 @@
 #include <glib-object.h>
 
 #include <libgda/libgda.h>
+#include <libgtkform/form.h>
 
 #include "solipa.h"
 
@@ -64,6 +65,11 @@ const gchar *solipa_allegato_get_data (SolipaAllegato *solipa_allegato);
 guint solipa_allegato_get_dimensione (SolipaAllegato *solipa_allegato);
 gboolean solipa_allegato_get_salva_in_db (SolipaAllegato *solipa_allegato);
 
+void solipa_allegato_add_to_gtkform (SolipaAllegato *solipa_allegato, GtkForm *form,
+                                     const gchar *percorso_field,
+                                     const gchar *data_field,
+                                     const gchar *dimensione_field);
+
 void solipa_allegato_apri_allegato (GtkWindow *transient, const gchar *filename);
 
 gboolean solipa_allegato_salva_in_db (GdaConnection *gda_con, const gchar *sql,