[libgda] More fixes to Gda UI GI and Vala bindings. Added more objects to Glade. Mis. on GdaData * Fixes on G



commit 7a731498f0e638bdca22b45cad808d5e84261b79
Author: Daniel Espinosa <esodan gmail com>
Date:   Sat Apr 20 20:50:56 2013 -0500

    More fixes to Gda UI GI and Vala bindings. Added more objects to Glade. Mis. on GdaData
    * Fixes on GdaDsnInfo and Gda UI bindings, by set GdaDsnInfo as GBoxed derived type
    * Added vapi files for Gda UI to track changes
    * Added more objects (expected to be used by Glade) to Glade's catalog
    * Added 'model' property for GdaData.DbRecordCollection
    * Removed vapi and GIR files from CLEANFILES

 libgda-ui/Makefile.am               |  4 +-
 libgda-ui/gdaui-login.c             |  2 +-
 libgda-ui/glade/Makefile.am         |  7 +++-
 libgda-ui/glade/gdaui-catalog.xml   | 16 +++++++-
 libgda-ui/libgdaui-5.0.vapi         |  2 +-
 libgda/Makefile.am                  |  2 +-
 libgda/data/DbRecordCollection.vala |  1 +
 libgda/data/GdaData-5.0.gir         |  6 +--
 libgda/gda-config.c                 | 81 +++++++++++++++++++++++++++++++++++++
 libgda/gda-config.h                 |  8 ++++
 libgda/libgda-5.0.vapi              | 27 ++++++++-----
 libgda/libgda.symbols               |  4 ++
 12 files changed, 138 insertions(+), 22 deletions(-)
---
diff --git a/libgda-ui/Makefile.am b/libgda-ui/Makefile.am
index 90b72c2..e0fe716 100644
--- a/libgda-ui/Makefile.am
+++ b/libgda-ui/Makefile.am
@@ -248,7 +248,7 @@ endif
 gir_DATA = $(INTROSPECTION_GIRS)
 typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
-CLEANFILES += $(INTROSPECTION_GIRS) $(typelibs_DATA)
+CLEANFILES += $(typelibs_DATA)
 
 if ENABLE_GDAUI_VALA
 
@@ -264,8 +264,6 @@ EXTRA_DIST += \
        Gdaui-5.0.metadata \
         $(vapi_DATA)
 
-CLEANFILES += libgdaui-5.0.vapi
-
 endif
 
 endif
diff --git a/libgda-ui/gdaui-login.c b/libgda-ui/gdaui-login.c
index e2a8e07..3055cb2 100644
--- a/libgda-ui/gdaui-login.c
+++ b/libgda-ui/gdaui-login.c
@@ -599,7 +599,7 @@ gdaui_login_set_mode (GdauiLogin *login, GdauiLoginMode mode)
  * If the connection is not specified by a DSN, then the 'name' attribute of the returned
  * #GdaDsnInfo will be %NULL, and otherwise it will contain the name of the selected DSN.
  *
- * Retuns: (transfer none): a pointer to a (read-only) #GdaDsnInfo.
+ * Returns: (transfer none): a pointer to a (read-only) #GdaDsnInfo.
  *
  * Since: 4.2
  */
diff --git a/libgda-ui/glade/Makefile.am b/libgda-ui/glade/Makefile.am
index c2b6339..9031f73 100644
--- a/libgda-ui/glade/Makefile.am
+++ b/libgda-ui/glade/Makefile.am
@@ -2,7 +2,12 @@ glade_catalog_DATA = gdaui-catalog.xml
 glade_catalogdir = $(GLADE_CATALOG)
 
 glade_pixmap_DATA = \
-       widget-gdaui-gdauigrid.png
+       widget-gdaui-gdauigrid.png \
+       widget-gdaui-gdauilogin.png \
+       widget-gdaui-gdauibasicform.png \
+       widget-gdaui-gdauicombo.png \
+       widget-gdaui-gdauirawgrid.png
+
 
 glade_pixmapdir = $(GLADE_PIXMAP)
 
diff --git a/libgda-ui/glade/gdaui-catalog.xml b/libgda-ui/glade/gdaui-catalog.xml
index 3429854..c66e23c 100644
--- a/libgda-ui/glade/gdaui-catalog.xml
+++ b/libgda-ui/glade/gdaui-catalog.xml
@@ -1,9 +1,23 @@
 <glade-catalog name="gdaui" library="libgda-ui-5.0.so" depends="gtk+">
   <init-function>gdaui_init</init-function>
   <glade-widget-classes>
-    <glade-widget-class name="GdauiGrid" generic-name="gdauigrid" title="Grid"/>
+    <glade-widget-class name="GdauiGrid" generic-name="gdauigrid" title="Database Grid"/>
+    <glade-widget-class name="GdauiLogin" generic-name="gdauilogin" title="Database Login"/>
+    <glade-widget-class name="GdauiBasicForm" generic-name="gdauibasicform" title="Database Basic Form"/>
+    <glade-widget-class name="GdauiCloud" generic-name="gdauicloud" title="Database Cloud"/>
+    <glade-widget-class name="GdauiCombo" generic-name="gdauicombo" title="Database Combo"/>
+    <glade-widget-class name="GdauiEntry" generic-name="gdauientry" title="Database Entry"/>
+    <glade-widget-class name="GdauiRawGrid" generic-name="gdauirawgrid" title="Database Raw Grid"/>
+    <glade-widget-class name="GdauiRtEditor" generic-name="gdauirteditor" title="Database Rich Text Editor"/>
   </glade-widget-classes>
   <glade-widget-group name="Gdaui" title="GNOME Data Access Widgets">
     <glade-widget-class-ref name="GdauiGrid"/>
+    <glade-widget-class-ref name="GdauiLogin"/>
+    <glade-widget-class-ref name="GdauiBasicForm"/>
+    <glade-widget-class-ref name="GdauiCloud"/>
+    <glade-widget-class-ref name="GdauiCombo"/>
+    <glade-widget-class-ref name="GdauiEntry"/>
+    <glade-widget-class-ref name="GdauiRawGrid"/>
+    <glade-widget-class-ref name="GdauiRtEditor"/>
   </glade-widget-group>
 </glade-catalog>
diff --git a/libgda-ui/libgdaui-5.0.vapi b/libgda-ui/libgdaui-5.0.vapi
index 4b74559..4308733 100644
--- a/libgda-ui/libgdaui-5.0.vapi
+++ b/libgda-ui/libgdaui-5.0.vapi
@@ -398,7 +398,7 @@ namespace Gdaui {
        public class Login : Gtk.Box, Atk.Implementor, Gtk.Buildable, Gtk.Orientable {
                [CCode (has_construct_function = false, type = "GtkWidget*")]
                public Login (string? dsn);
-               public Gda.DsnInfo get_connection_information ();
+               public unowned Gda.DsnInfo get_connection_information ();
                public void set_connection_information (Gda.DsnInfo cinfo);
                public void set_dsn (string? dsn);
                public void set_mode (Gdaui.LoginMode mode);
diff --git a/libgda/Makefile.am b/libgda/Makefile.am
index a31dd32..c759914 100644
--- a/libgda/Makefile.am
+++ b/libgda/Makefile.am
@@ -375,7 +375,7 @@ libgda-5.0.vapi: Gda-5.0.gir
 
 vapidir = $(VAPIDIR)
 vapi_DATA=libgda-5.0.vapi
-CLEANFILES += $(vapi_DATA)
+
 
 EXTRA_DIST += \
        Gda-5.0.metadata \
diff --git a/libgda/data/DbRecordCollection.vala b/libgda/data/DbRecordCollection.vala
index 8199512..5128329 100644
--- a/libgda/data/DbRecordCollection.vala
+++ b/libgda/data/DbRecordCollection.vala
@@ -25,6 +25,7 @@ namespace GdaData {
                                Iterable<DbRecord>, Collection<DbRecord>
        {
                public abstract Connection   connection { get; set; }
+               public abstract DataModel    model      { get; }
                public abstract DbTable      table      { get; }
        }
 }
diff --git a/libgda/data/GdaData-5.0.gir b/libgda/data/GdaData-5.0.gir
index 0326c82..c61cf0d 100644
--- a/libgda/data/GdaData-5.0.gir
+++ b/libgda/data/GdaData-5.0.gir
@@ -217,9 +217,6 @@
                                <type name="utf8" c:type="gchar*"/>
                        </return-value>
                </method>
-               <property name="model">
-                       <type name="Gda.DataModel" c:type="GdaDataModel*"/>
-               </property>
        </class>
        <record name="RecordCollectionClass" c:type="GdaDataRecordCollectionClass" 
glib:is-gtype-struct-for="RecordCollection">
                <field name="parent_class">
@@ -1247,6 +1244,9 @@
                <property name="connection" writable="1">
                        <type name="Gda.Connection" c:type="GdaConnection*"/>
                </property>
+               <property name="model">
+                       <type name="Gda.DataModel" c:type="GdaDataModel*"/>
+               </property>
                <property name="table">
                        <type name="GdaData.DbTable" c:type="GdaDataDbTable*"/>
                </property>
diff --git a/libgda/gda-config.c b/libgda/gda-config.c
index de3c6e5..f49a437 100644
--- a/libgda/gda-config.c
+++ b/libgda/gda-config.c
@@ -65,6 +65,87 @@
   #endif
 #endif
 
+/*
+   Register GdaDsnInfo type
+*/
+GType
+gda_dsn_info_get_type (void)
+{
+       static GType type = 0;
+
+       if (G_UNLIKELY (type == 0)) {
+        if (type == 0)
+                       type = g_boxed_type_register_static ("GdaDsnInfo",
+                                                            (GBoxedCopyFunc) gda_dsn_info_copy,
+                                                            (GBoxedFreeFunc) gda_dsn_info_free);
+       }
+
+       return type;
+}
+
+/**
+ * gda_dsn_info_new:
+ *
+ * Creates a new #GdaDsnInfo struct.
+ *
+ * Returns: (transfer full): a new #GdaDsnInfo struct.
+ *
+ * Since: 5.2
+ */
+GdaDsnInfo*
+gda_dsn_info_new (void)
+{
+       GdaDsnInfo *dsn = g_new0 (GdaDsnInfo, 1);
+       dsn->name = NULL;
+       dsn->provider = NULL;
+       dsn->description = NULL;
+       dsn->cnc_string = NULL;
+       dsn->auth_string = NULL;
+       dsn->is_system = FALSE;
+       return dsn;
+}
+
+/**
+ * gda_dsn_info_copy:
+ * @source: a #GdaDsnInfo to copy from
+ *
+ * Copy constructor.
+ *
+ * Returns: (transfer full): a new #GdaDsnInfo
+ *
+ * Since: 5.2
+ */
+GdaDsnInfo *
+gda_dsn_info_copy (GdaDsnInfo *source)
+{
+       GdaDsnInfo *n;
+       g_return_val_if_fail (source, NULL);
+       n = gda_dsn_info_new ();
+       n->name = source->name;
+       n->provider = source->provider;
+       n->description = source->description;
+       n->cnc_string = source->cnc_string;
+       n->auth_string = source->auth_string;
+       n->is_system = source->is_system;;
+       return n;
+}
+
+/**
+ * gda_dsn_info_free:
+ * @dsn: (allow-none): a #GdaDsnInfo struct to free
+ *
+ * Frees any resources taken by @dsn struct. If @dsn is %NULL, then nothing happens.
+ *
+ * Since: 5.2
+ */
+void
+gda_dsn_info_free (GdaDsnInfo *dsn)
+{
+       g_return_if_fail(dsn);
+       g_free (dsn);
+}
+
+
 typedef struct {
        GdaProviderInfo    pinfo;
        GModule           *handle;
diff --git a/libgda/gda-config.h b/libgda/gda-config.h
index bddbebe..e8203bb 100644
--- a/libgda/gda-config.h
+++ b/libgda/gda-config.h
@@ -6,6 +6,7 @@
  * Copyright (C) 2003 Laurent Sansonetti <laurent datarescue be>
  * Copyright (C) 2003 - 2007 Murray Cumming <murrayc murrayc com>
  * Copyright (C) 2005 Andrew Hill <andru src gnome org>
+ * Copyright (C) 2013 Daniel Espinosa <despinosa src gnome org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -79,6 +80,13 @@ struct _GdaDsnInfo {
        gpointer _gda_reserved4;
 };
 
+#define GDA_TYPE_DSN_INFO (gda_dsn_info_get_type ())
+
+GType            gda_dsn_info_get_type  (void) G_GNUC_CONST;
+GdaDsnInfo*      gda_dsn_info_new       (void);
+GdaDsnInfo*      gda_dsn_info_copy      (GdaDsnInfo *source);
+void             gda_dsn_info_free      (GdaDsnInfo *dsn);
+
 /**
  * GdaProviderInfo:
  * @id: the unique identifier of the database provider
diff --git a/libgda/libgda-5.0.vapi b/libgda/libgda-5.0.vapi
index 0d2fab4..2172353 100644
--- a/libgda/libgda-5.0.vapi
+++ b/libgda/libgda-5.0.vapi
@@ -82,8 +82,8 @@ namespace Gda {
                public static bool dsn_needs_authentication (string dsn_name);
                public static GLib.Quark error_quark ();
                public static Gda.Config @get ();
-               public static Gda.DsnInfo get_dsn_info (string dsn_name);
-               public static Gda.DsnInfo get_dsn_info_at_index (int index);
+               public static unowned Gda.DsnInfo get_dsn_info (string dsn_name);
+               public static unowned Gda.DsnInfo get_dsn_info_at_index (int index);
                public static int get_dsn_info_index (string dsn_name);
                public static int get_nb_dsn ();
                public static unowned Gda.ServerProvider get_provider (string provider_name) throws 
GLib.Error;
@@ -430,6 +430,20 @@ namespace Gda {
                public static string escape_string (string string);
                public static string unescape_string (string string);
        }
+       [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = 
"g_boxed_free", type_id = "gda_dsn_info_get_type ()")]
+       [Compact]
+       public class DsnInfo {
+               public weak string auth_string;
+               public weak string cnc_string;
+               public weak string description;
+               public bool is_system;
+               public weak string name;
+               public weak string provider;
+               [CCode (has_construct_function = false)]
+               public DsnInfo ();
+               public Gda.DsnInfo copy ();
+               public void free ();
+       }
        [CCode (cheader_filename = "libgda/libgda.h", copy_function = "g_boxed_copy", free_function = 
"g_boxed_free", lower_case_csuffix = "geometricpoint", type_id = "gda_geometricpoint_get_type ()")]
        [Compact]
        public class GeometricPoint {
@@ -1336,15 +1350,6 @@ namespace Gda {
                public weak GLib.HashTable<void*,void*> values;
        }
        [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)]
-       public struct DsnInfo {
-               public weak string name;
-               public weak string provider;
-               public weak string description;
-               public weak string cnc_string;
-               public weak string auth_string;
-               public bool is_system;
-       }
-       [CCode (cheader_filename = "libgda/libgda.h", has_type_id = false)]
        public struct MetaDbObject {
                public Gda.MetaDbObjectType obj_type;
                public bool outdated;
diff --git a/libgda/libgda.symbols b/libgda/libgda.symbols
index e1aa754..1e476e9 100644
--- a/libgda/libgda.symbols
+++ b/libgda/libgda.symbols
@@ -351,6 +351,10 @@
        gda_default_get_type
        gda_default_unescape_string
        gda_diff_type_get_type
+       gda_dsn_info_copy
+       gda_dsn_info_free
+       gda_dsn_info_get_type
+       gda_dsn_info_new
        gda_dsn_split
        gda_gbr_get_file_path
        gda_gbr_init


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]