glom r2036 - in trunk: . glom glom/libglom
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: glom r2036 - in trunk: . glom glom/libglom
- Date: Mon, 30 Mar 2009 13:14:19 +0000 (UTC)
Author: murrayc
Date: Mon Mar 30 13:14:19 2009
New Revision: 2036
URL: http://svn.gnome.org/viewvc/glom?rev=2036&view=rev
Log:
2009-03-30 Murray Cumming <murrayc murrayc com>
* glom/libglom/Makefile.am:
* glom/libglom/init.[h|cc]: Added this file with libglom_init() and
libglom_deinit(), containing some code that was in main(). This allows
code other than Glom to use libglom.
* glom/main.cc: Call the new functions, replacing some code.
* glom/libglom/test_document.cc: Call the new functions.
Added:
trunk/glom/libglom/init.cc
trunk/glom/libglom/init.h
Modified:
trunk/ChangeLog
trunk/glom/libglom/Makefile.am
trunk/glom/libglom/test_document.cc
trunk/glom/main.cc
Modified: trunk/glom/libglom/Makefile.am
==============================================================================
--- trunk/glom/libglom/Makefile.am (original)
+++ trunk/glom/libglom/Makefile.am Mon Mar 30 13:14:19 2009
@@ -20,7 +20,8 @@
-DGLOM_ICON_DIR=\""$(glom_icon_dir)"\"
# These are installed, for use by other applications/utilties:
-h_sources_public = libglom_config.h \
+h_sources_public = libglom_config.h \
+ init.h \
sharedptr.h \
standard_table_prefs_fields.h \
appstate.h
@@ -33,6 +34,7 @@
gst-package.h
cc_sources = appstate.cc \
+ init.cc \
calcinprogress.cc \
connectionpool.cc \
spawn_with_feedback.cc \
Added: trunk/glom/libglom/init.cc
==============================================================================
--- (empty file)
+++ trunk/glom/libglom/init.cc Mon Mar 30 13:14:19 2009
@@ -0,0 +1,49 @@
+/* Glom
+ *
+ * Copyright (C) 2001-2009 Murray Cumming
+ *
+ * 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 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.
+ *
+ * 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.
+ */
+
+#include <Python.h> //Include it before anything else to avoid "_POSIX_C_SOURCE redefined".
+
+#include <glom/libglom/connectionpool.h>
+#include <giomm.h>
+#include <libgdamm.h>
+
+namespace Glom
+{
+
+void libglom_init()
+{
+ g_thread_init(NULL); //So we can use GMutex.
+ Gnome::Gda::init();
+ Gio::init();
+
+ Py_Initialize();
+}
+
+void libglom_deinit()
+{
+ //We use python for calculated-fields:
+ Py_Finalize();
+
+ //Clean up singletons:
+ Glom::ConnectionPool::delete_instance();
+}
+
+} //namespace Glom
+
Added: trunk/glom/libglom/init.h
==============================================================================
--- (empty file)
+++ trunk/glom/libglom/init.h Mon Mar 30 13:14:19 2009
@@ -0,0 +1,37 @@
+/* Glom
+ *
+ * Copyright (C) 2001-2009 Murray Cumming
+ *
+ * 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 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.
+ *
+ * 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.
+ */
+
+#ifndef GLOM_LIBGLOM_INIT_H
+#define GLOM_LIBGLOM_INIT_H
+
+namespace Glom
+{
+
+/** This must be used by applications other than Glom,
+ * which are unlikely to otherwise initialize the libraries used by libglom.
+ * Glom uses it too, just to avoid duplicating code.
+ */
+void libglom_init();
+
+void libglom_deinit();
+
+} //namespace Glom
+
+#endif //GLOM_LIBGLOM_INIT_H
Modified: trunk/glom/libglom/test_document.cc
==============================================================================
--- trunk/glom/libglom/test_document.cc (original)
+++ trunk/glom/libglom/test_document.cc Mon Mar 30 13:14:19 2009
@@ -19,14 +19,12 @@
*/
#include <libglom/document/document_glom.h>
-#include <giomm.h>
-#include <glibmm.h>
+#include <libglom/init.h>
int
main()
{
- Gnome::Gda::init();
- Gio::init();
+ Glom::libglom_init();
Glib::ustring uri;
@@ -56,6 +54,9 @@
{
std::cout << "Table: " << *iter << std::endl;
}
+
+ Glom::libglom_deinit();
+
return 0;
}
Modified: trunk/glom/main.cc
==============================================================================
--- trunk/glom/main.cc (original)
+++ trunk/glom/main.cc Mon Mar 30 13:14:19 2009
@@ -24,6 +24,7 @@
#include <Python.h> //Include it before anything else to avoid "_POSIX_C_SOURCE redefined".
//#include <gnome.h>
+#include <glom/libglom/init.h>
#include <gtkmm/main.h>
#include <gtkmm/messagedialog.h>
#include <giomm.h>
@@ -264,9 +265,8 @@
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
- g_thread_init(NULL); //So we can use GMutex.
-
- Gnome::Gda::init();
+ Glom::libglom_init();
+
#ifdef GLOM_ENABLE_MAEMO
Hildon::init();
#endif
@@ -445,11 +445,7 @@
}
#endif // GLIBMM_EXCEPTIONS_ENABLED
- //We use python for calculated-fields:
- Py_Finalize();
-
- //Clean up singletons:
- Glom::ConnectionPool::delete_instance();
+ Glom::libglom_deinit();
//These fail, probably because of previous things that are causing leaks:
//cairo_debug_reset_static_data(); //This crashes with _cairo_hash_table_destroy: Assertion `hash_table->live_entries == 0' failed.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]