gnomemm r1747 - in libgdamm/trunk: . libgda libgda/libgdamm libgda/src tools/extra_defs_gen tools/m4



Author: jhs
Date: Thu Oct 16 14:42:24 2008
New Revision: 1747
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1747&view=rev

Log:
2008-10-16  Johannes Schmid  <jschmid openismus com>

	* libgda/libgdamm/Makefile.am:
	* libgda/libgdamm/value_tools.h:
	Added some inline methods for GValue conversions
	
	* libgda/src/Makefile_list_of_hg.am_fragment:	
	* libgda/src/error.*
	Wrapped GdaError boxed type

	* libgda/src/dataproxy.hg:
	* libgda/src/set.hg:
	* libgda/src/holder.hg
	Fixed some signals

	* libgda/src/libgda_signals.defs:
	Edited by hand to fix some wrongly detected signals
	
	* tools/m4/convert_libgdamm.m4:
	Added some new conversions for GError and GdaError

Added:
   libgdamm/trunk/libgda/libgdamm/value_tools.h
   libgdamm/trunk/libgda/src/error.ccg
   libgdamm/trunk/libgda/src/error.hg
Modified:
   libgdamm/trunk/ChangeLog
   libgdamm/trunk/libgda/libgdamm.h
   libgdamm/trunk/libgda/libgdamm/Makefile.am
   libgdamm/trunk/libgda/src/Makefile_list_of_hg.am_fragment
   libgdamm/trunk/libgda/src/dataproxy.hg
   libgdamm/trunk/libgda/src/holder.hg
   libgdamm/trunk/libgda/src/libgda_signals.defs
   libgdamm/trunk/libgda/src/set.hg
   libgdamm/trunk/libgda/src/statement.hg
   libgdamm/trunk/tools/extra_defs_gen/generate_defs_gda.cc
   libgdamm/trunk/tools/m4/convert_libgdamm.m4

Modified: libgdamm/trunk/libgda/libgdamm.h
==============================================================================
--- libgdamm/trunk/libgda/libgdamm.h	(original)
+++ libgdamm/trunk/libgda/libgdamm.h	Thu Oct 16 14:42:24 2008
@@ -44,6 +44,7 @@
 #include <libgdamm/datamodelimport.h>
 #include <libgdamm/datamodeliter.h>
 #include <libgdamm/dataproxy.h>
+#include <libgdamm/error.h>
 #include <libgdamm/holder.h>
 #include <libgdamm/metastore.h>
 #include <libgdamm/metastruct.h>

Modified: libgdamm/trunk/libgda/libgdamm/Makefile.am
==============================================================================
--- libgdamm/trunk/libgda/libgdamm/Makefile.am	(original)
+++ libgdamm/trunk/libgda/libgdamm/Makefile.am	Thu Oct 16 14:42:24 2008
@@ -11,7 +11,7 @@
 sublib_topdir = libgda
 
 
-files_extra_h	= init.h wrap_init.h
+files_extra_h	= init.h wrap_init.h value_tools.h
 files_extra_cc = init.cc
 
 include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment

Added: libgdamm/trunk/libgda/libgdamm/value_tools.h
==============================================================================
--- (empty file)
+++ libgdamm/trunk/libgda/libgdamm/value_tools.h	Thu Oct 16 14:42:24 2008
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+
+/* value-tools.h
+ *
+ * Copyright 2006 libgdamm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef VALUE_TOOLS_H
+#define VALUE_TOOLS_H
+
+namespace Gnome
+{
+
+namespace Gda
+{
+
+inline Glib::ValueBase gvalue_to_valuebase (const GValue* value)
+{
+	Glib::ValueBase valuebase;
+	valuebase.init(value);
+	// FIXME: We need to decide whether to free the value
+	return valuebase;
+}
+
+} // namespace Gda
+
+} // namespace Gnome
+
+#endif // VALUE_TOOLS_H
\ No newline at end of file

Modified: libgdamm/trunk/libgda/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- libgdamm/trunk/libgda/src/Makefile_list_of_hg.am_fragment	(original)
+++ libgdamm/trunk/libgda/src/Makefile_list_of_hg.am_fragment	Thu Oct 16 14:42:24 2008
@@ -12,7 +12,7 @@
      serverprovider.hg serveroperation.hg transactionstatus.hg \
      set.hg row.hg column.hg holder.hg statement.hg sqlparser.hg \
      batch.hg metastore.hg metastruct.hg config.hg threader.hg \
-     blobop.hg blob.hg quarklist.hg
+     blobop.hg blob.hg quarklist.hg error.hg
 
 
 

Modified: libgdamm/trunk/libgda/src/dataproxy.hg
==============================================================================
--- libgdamm/trunk/libgda/src/dataproxy.hg	(original)
+++ libgdamm/trunk/libgda/src/dataproxy.hg	Thu Oct 16 14:42:24 2008
@@ -110,9 +110,7 @@
   _WRAP_SIGNAL(void sample_changed(int sample_start, int sample_end), "sample-changed")
   _WRAP_SIGNAL(void sample_size_changed(int sample_size), "sample-size-changed")
   _WRAP_SIGNAL(void filter_changed(), "filter-changed", no_default_handler)
-  #m4 _CONVERSION(`gpointer',`Glib::Error*',`Glib::wrap($3)')
-  #m4 _CONVERSION(`Glib::Error*',`gpointer',`(gpointer) $3->gobj()')
-  _WRAP_SIGNAL(Glib::Error* validate_row_changes(int row,  int proxied_row), "validate-row-changes", no_default_handler)
+  _WRAP_SIGNAL(Error validate_row_changes(int row,  int proxied_row), "validate-row-changes", no_default_handler)
   _WRAP_SIGNAL(void row_changes_applied(int row,  int proxied_row), "row-changes-applied")
 };
 

Added: libgdamm/trunk/libgda/src/error.ccg
==============================================================================
--- (empty file)
+++ libgdamm/trunk/libgda/src/error.ccg	Thu Oct 16 14:42:24 2008
@@ -0,0 +1,35 @@
+// -*- C++ -*- // this is for the .hg, I realize gensig puts one in
+
+/* error.ccg
+ *
+ * Copyright 2001      Free Software Foundation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+ 
+#include <libgda/gda-error.h>
+
+// This is a quite bad hack...
+#define gerror_get_type(o) gda_error_get_type(o)
+
+namespace Gnome
+{
+
+namespace Gda
+{
+
+} // namespace Gda
+
+} // namesoace Gnome

Added: libgdamm/trunk/libgda/src/error.hg
==============================================================================
--- (empty file)
+++ libgdamm/trunk/libgda/src/error.hg	Thu Oct 16 14:42:24 2008
@@ -0,0 +1,45 @@
+// -*- C++ -*- // this is for the .hg, I realize gensig puts one in
+
+/* error.h
+ *
+ * Copyright 2001      Free Software Foundation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+ 
+_DEFS(libgdamm,libgda)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gnome
+{
+
+namespace Gda
+{
+	
+/** This objects is the boxed type of a Glib::Error
+ *
+ * @ingroup DataHandlers
+ */
+class Error
+{
+  _CLASS_BOXEDTYPE(Error, GError, NONE, g_error_copy, g_error_free)
+  
+  public:
+		inline Glib::Error gerror() {return Glib::Error(gobj(), false);};
+};
+
+} // namespace Gda
+
+} // namespace Gnome

Modified: libgdamm/trunk/libgda/src/holder.hg
==============================================================================
--- libgdamm/trunk/libgda/src/holder.hg	(original)
+++ libgdamm/trunk/libgda/src/holder.hg	Thu Oct 16 14:42:24 2008
@@ -20,6 +20,7 @@
  */
 
 #include <libgdamm/datahandler.h>
+#include <libgdamm/error.h>
 
 _DEFS(libgdamm,libgda)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -94,7 +95,10 @@
 
   _WRAP_SIGNAL(void changed(), "changed")
   _WRAP_SIGNAL(void source_changed(), "source-changed")
+  _WRAP_SIGNAL(Error validate_change(Glib::ValueBase value), "validate-change", no_default_handler)
+  _WRAP_SIGNAL(void attribute_changed (Glib::ustring attr_name, Glib::ValueBase value), "attribute-changed", no_default_handler)
 
+		
 };
 
 } // namespace Gda

Modified: libgdamm/trunk/libgda/src/libgda_signals.defs
==============================================================================
--- libgdamm/trunk/libgda/src/libgda_signals.defs	(original)
+++ libgdamm/trunk/libgda/src/libgda_signals.defs	Thu Oct 16 14:42:24 2008
@@ -77,7 +77,7 @@
   )
 )
 
-(define-property system-filename
+(define-property user-filename
   (of-object "GdaConfig")
   (prop-type "GParamString")
   (docs "")
@@ -86,7 +86,7 @@
   (construct-only #f)
 )
 
-(define-property user-filename
+(define-property system-filename
   (of-object "GdaConfig")
   (prop-type "GParamString")
   (docs "")
@@ -513,7 +513,7 @@
 
 (define-signal validate-row-changes
   (of-object "GdaDataProxy")
-  (return-type "gpointer")
+  (return-type "GError*")
   (when "last")
   (parameters
     '("gint" "p0")
@@ -587,12 +587,22 @@
   (when "first")
 )
 
+(define-signal attribute-changed
+  (of-object "GdaHolder")
+  (return-type "void")
+  (when "first")
+  (parameters
+    '("const-gchar*" "p0")
+    '("GValue*" "p1")
+  )
+)
+
 (define-signal validate-change
   (of-object "GdaHolder")
-  (return-type "gpointer")
+  (return-type "GError*")
   (when "last")
   (parameters
-    '("gpointer" "p0")
+    '("GValue*" "p0")
   )
 )
 
@@ -843,35 +853,28 @@
 
 (define-signal validate-holder-change
   (of-object "GdaSet")
-  (return-type "gpointer")
+  (return-type "GError*")
   (when "last")
   (parameters
     '("GdaHolder*" "p0")
-    '("gpointer" "p1")
+    '("GValue*" "p1")
   )
 )
 
 (define-signal validate-set
   (of-object "GdaSet")
-  (return-type "gpointer")
+  (return-type "GError*")
   (when "last")
 )
 
-(define-signal holder-plugin-changed
-  (of-object "GdaSet")
-  (return-type "void")
-  (when "first")
-  (parameters
-    '("GdaHolder*" "p0")
-  )
-)
-
 (define-signal holder-attr-changed
   (of-object "GdaSet")
   (return-type "void")
   (when "first")
   (parameters
     '("GdaHolder*" "p0")
+    '("const-gchar*" "p1")
+    '("GValue*" "p2")
   )
 )
 

Modified: libgdamm/trunk/libgda/src/set.hg
==============================================================================
--- libgdamm/trunk/libgda/src/set.hg	(original)
+++ libgdamm/trunk/libgda/src/set.hg	Thu Oct 16 14:42:24 2008
@@ -20,9 +20,12 @@
  */
 
 #include <libgdamm/holder.h>
+#include <libgdamm/value_tools.h>
+#include <libgdamm/error.h>
 
 _DEFS(libgdamm,libgda)
 _PINCLUDE(glibmm/private/object_p.h)
+_PINCLUDE(libgda/gda-error.h)
 
 namespace Gnome
 {
@@ -68,14 +71,12 @@
   _WRAP_METHOD(SetSource* get_source (const Glib::RefPtr<Holder>& param), gda_set_get_source)
   _WRAP_METHOD(SetGroup* get_group (const Glib::RefPtr<Holder>& param), gda_set_get_group)
   _WRAP_METHOD(SetNode* get_node (const Glib::RefPtr<Holder>& param), gda_set_get_node)
-
+		
   _WRAP_SIGNAL(void holder_changed (const Glib::RefPtr<Holder>& holder), "holder-changed")
   _WRAP_SIGNAL(void public_data_changed (), "public-data-changed")
-  #m4 _CONVERSION(`gpointer',`Glib::Error*',`Glib::wrap($3)')
-  #m4 _CONVERSION(`Glib::Error*',`gpointer',`(gpointer) $3->gobj()')
-  _WRAP_SIGNAL(Glib::Error* validate_set(), "validate-set", no_default_handler)
-//  _WRAP_SIGNAL(Glib::Error* validate_holder_change(const Glib::RefPtr<Holder>& holder,Glib::ValueBase value), "validate-holder-change", no_default_handler)
-//  _WRAP_SIGNAL(void holder_attr_changed (const Glib::RefPtr<Set>& set, const Glib::RefPtr<Holder>& holder, const Glib::ustring& attr_name, const Glib::ValueBase& value), "holder-attr-changed", no_default_handler)
+  _WRAP_SIGNAL(Error validate_set(), "validate-set", no_default_handler)
+  _WRAP_SIGNAL(Error validate_holder_change(const Glib::RefPtr<Holder>& holder, Glib::ValueBase value), "validate-holder-change", no_default_handler)
+  _WRAP_SIGNAL(void holder_attr_changed (const Glib::RefPtr<Holder>& holder, Glib::ustring attr_name, Glib::ValueBase value), "holder-attr-changed", no_default_handler)
      
   _WRAP_PROPERTY("description", Glib::ustring)
   _WRAP_PROPERTY("id", Glib::ustring)

Modified: libgdamm/trunk/libgda/src/statement.hg
==============================================================================
--- libgdamm/trunk/libgda/src/statement.hg	(original)
+++ libgdamm/trunk/libgda/src/statement.hg	Thu Oct 16 14:42:24 2008
@@ -80,7 +80,7 @@
                                 std::auto_ptr<Glib::Error>& error);
   #endif //GLIBMM_EXCEPTIONS_ENABLED
 
-  _WRAP_METHOD(SqlStatementType get_statement_type(), gda_statement_get_statement_type)
+	_WRAP_METHOD(SqlStatementType get_statement_type(), gda_statement_get_statement_type)
   _WRAP_METHOD(bool is_useless() const, gda_statement_is_useless)
   _WRAP_METHOD(bool check_structure() const, gda_statement_check_structure, errthrow)
   _WRAP_METHOD(bool check_validity(const Glib::RefPtr<Connection>& cnc) const, gda_statement_check_validity, errthrow)

Modified: libgdamm/trunk/tools/extra_defs_gen/generate_defs_gda.cc
==============================================================================
--- libgdamm/trunk/tools/extra_defs_gen/generate_defs_gda.cc	(original)
+++ libgdamm/trunk/tools/extra_defs_gen/generate_defs_gda.cc	Thu Oct 16 14:42:24 2008
@@ -42,7 +42,7 @@
 #endif
     << get_defs (GDA_TYPE_DATA_MODEL_DIR)
     << get_defs (GDA_TYPE_DATA_MODEL) 
-    << get_defs (GDA_TYPE_DATA_MODEL_IMPORT) 
+    << get_defs (GDA_TYPE_DATA_MODEL_IMPORT)
     << get_defs (GDA_TYPE_DATA_MODEL_ITER) 
     << get_defs (GDA_TYPE_DATA_PROXY) 
     << get_defs (GDA_TYPE_HOLDER)

Modified: libgdamm/trunk/tools/m4/convert_libgdamm.m4
==============================================================================
--- libgdamm/trunk/tools/m4/convert_libgdamm.m4	(original)
+++ libgdamm/trunk/tools/m4/convert_libgdamm.m4	Thu Oct 16 14:42:24 2008
@@ -62,7 +62,8 @@
 _CONVERSION(`const Glib::RefPtr<Column>&', `GdaColumn*', __CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<Column>&', `const GdaColumn*', __CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const Column>&', `const GdaColumn*', __CONVERT_REFPTR_TO_P)
-#_CONVERSION(`Column&', `GdaColumn*', `($3).gobj()')
+_CONVERSION(`Error*', `GdaError*', `($3).gobj()')
+_CONVERSION(`GdaError*', `Error*', `Glib::wrap($3)')
 
 _CONVERSION(`GdaColumnIndex*',`Glib::RefPtr<ColumnIndex>',`Glib::wrap($3)')
 
@@ -72,11 +73,18 @@
 _CONVERSION(`const Glib::RefPtr<Glib::Object>&', `const GObject*', `($3)->gobj()')
 
 _CONVERSION(`Glib::ValueBase&', `GValue*', `($3).gobj()')
+_CONVERSION(`Glib::ValueBase', `GValue*', `($3).gobj()')
 _CONVERSION(`const Glib::ValueBase&', `const GValue*', `($3).gobj()')
+_CONVERSION(`GValue*', `Glib::ValueBase', `gvalue_to_valuebase($3)')
 
 _CONVERSION(`GdaRow*', `const Glib::RefPtr<Row>',  `Glib::wrap($3)')
 _CONVERSION(`GdaRow*', `const Glib::RefPtr<const Row>',  `Glib::wrap($3)')
 
+_CONVERSION(`GdaError*', `Error',  `Glib::wrap($3)')
+_CONVERSION(`Error', `GdaError*', `(GdaError*)($3).gobj()')
+_CONVERSION(`Error', `GError*', `($3).gobj()')
+
+
 _CONVERSION(`const int*','const-gint*',`$3')
 
 _CONVERSION(`long&',`glong*',`&($3)')



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