r20310 - gnucash/trunk - Add optional module that compiles with gtkmm, i.e. in C++.
Christian Stimming
cstim at code.gnucash.org
Wed Feb 16 16:39:54 EST 2011
Author: cstim
Date: 2011-02-16 16:39:54 -0500 (Wed, 16 Feb 2011)
New Revision: 20310
Trac: http://svn.gnucash.org/trac/changeset/20310
Added:
gnucash/trunk/src/optional/gtkmm/
gnucash/trunk/src/optional/gtkmm/Makefile.am
gnucash/trunk/src/optional/gtkmm/gncmod-gtkmm.cpp
Modified:
gnucash/trunk/configure.ac
gnucash/trunk/src/bin/gnucash-bin.c
gnucash/trunk/src/optional/Makefile.am
Log:
Add optional module that compiles with gtkmm, i.e. in C++.
This was just a crazy idea, but it turns out to be extremely easy.
This can be used as a place for new GUI elements which people prefer
to write in gtkmm/C++ instead of C. It's disabled by default.
Use configure --enable-gtkmm to enable it.
Modified: gnucash/trunk/configure.ac
===================================================================
--- gnucash/trunk/configure.ac 2011-02-16 21:39:40 UTC (rev 20309)
+++ gnucash/trunk/configure.ac 2011-02-16 21:39:54 UTC (rev 20310)
@@ -1259,6 +1259,30 @@
AC_SUBST(LC_MESSAGES_ENUM)
###--------------------------------------------------------
+### Make gtkmm plugin optional
+###--------------------------------------------------------
+enable_gtkmm=false
+
+AC_ARG_ENABLE(gtkmm,
+ [AS_HELP_STRING([--enable-gtkmm],[enable gtkmm gui])],
+ [case "${enableval}" in
+ yes) enable_gtkmm=true ;;
+ no) enable_gtkmm=false ;;
+ *) enable_gtkmm=true ;;
+ esac]
+ )
+if test x${enable_gtkmm} = "xtrue"
+then
+ GTKMM_DIR=gtkmm
+ # We require gtkmm, of course
+ PKG_CHECK_MODULES(GTKMM, gtkmm-2.4 >= 2.16)
+ # and also the c++ compiler
+ AC_PROG_CXX
+ AC_PROG_CXXCPP
+fi
+AC_SUBST(GTKMM_DIR)
+
+###--------------------------------------------------------
### Make Python bindings optional
###--------------------------------------------------------
enable_python=false
@@ -1472,6 +1496,7 @@
src/libqof/qof/Makefile
src/libqof/qof/test/Makefile
src/optional/Makefile
+ src/optional/gtkmm/Makefile
src/optional/python-bindings/Makefile
src/optional/python-bindings/tests/Makefile
src/pixmaps/Makefile
Modified: gnucash/trunk/src/bin/gnucash-bin.c
===================================================================
--- gnucash/trunk/src/bin/gnucash-bin.c 2011-02-16 21:39:40 UTC (rev 20309)
+++ gnucash/trunk/src/bin/gnucash-bin.c 2011-02-16 21:39:54 UTC (rev 20310)
@@ -576,7 +576,8 @@
{ "gnucash/report/utility-reports", 0, FALSE },
{ "gnucash/report/locale-specific/us", 0, FALSE },
{ "gnucash/report/report-gnome", 0, FALSE },
- { "gnucash/business-gnome", 0, TRUE }
+ { "gnucash/business-gnome", 0, TRUE },
+ { "gnucash/gtkmm", 0, TRUE },
};
/* module initializations go here */
Modified: gnucash/trunk/src/optional/Makefile.am
===================================================================
--- gnucash/trunk/src/optional/Makefile.am 2011-02-16 21:39:40 UTC (rev 20309)
+++ gnucash/trunk/src/optional/Makefile.am 2011-02-16 21:39:54 UTC (rev 20310)
@@ -1,2 +1,2 @@
-SUBDIRS = ${PYTHON_DIR}
-DIST_SUBDIRS = python-bindings
+SUBDIRS = ${PYTHON_DIR} ${GTKMM_DIR}
+DIST_SUBDIRS = python-bindings gtkmm
Added: gnucash/trunk/src/optional/gtkmm/Makefile.am
===================================================================
--- gnucash/trunk/src/optional/gtkmm/Makefile.am (rev 0)
+++ gnucash/trunk/src/optional/gtkmm/Makefile.am 2011-02-16 21:39:54 UTC (rev 20310)
@@ -0,0 +1,40 @@
+SUBDIRS =
+
+pkglib_LTLIBRARIES = libgncmod-gtkmm.la
+
+libgncmod_gtkmm_la_SOURCES = \
+ gncmod-gtkmm.cpp
+
+noinst_HEADERS =
+
+libgncmod_gtkmm_la_LDFLAGS = -avoid-version
+
+libgncmod_gtkmm_la_LIBADD = \
+ ${top_builddir}/src/gnome/libgnc-gnome.la \
+ ${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
+ ${top_builddir}/src/app-utils/libgncmod-app-utils.la \
+ ${top_builddir}/src/engine/libgncmod-engine.la \
+ ${top_builddir}/src/core-utils/libgnc-core-utils.la \
+ ${top_builddir}/src/gnc-module/libgnc-module.la \
+ ${top_builddir}/src/libqof/qof/libgnc-qof.la \
+ ${GTKMM_LIBS} \
+ ${GNOME_LIBS} \
+ ${GLADE_LIBS} \
+ ${GLIB_LIBS}
+
+AM_CPPFLAGS = \
+ -I${top_srcdir}/src \
+ ${GTKMM_CFLAGS} \
+ ${GNOME_CFLAGS} \
+ ${GLADE_CFLAGS} \
+ ${GLIB_CFLAGS}
+
+uidir = $(GNC_UI_DIR)
+ui_DATA =
+
+gladedir = $(GNC_GLADE_DIR)
+glade_DATA =
+
+EXTRA_DIST = ${ui_DATA} ${glade_DATA}
+
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.gtkmm\"
Added: gnucash/trunk/src/optional/gtkmm/gncmod-gtkmm.cpp
===================================================================
--- gnucash/trunk/src/optional/gtkmm/gncmod-gtkmm.cpp (rev 0)
+++ gnucash/trunk/src/optional/gtkmm/gncmod-gtkmm.cpp 2011-02-16 21:39:54 UTC (rev 20310)
@@ -0,0 +1,91 @@
+/*
+ * gncmod-gtkmm.cpp --
+ *
+ * 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, contact:
+ *
+ * Free Software Foundation Voice: +1-617-542-5942
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
+ * Boston, MA 02110-1301, USA gnu at gnu.org
+ */
+
+/**
+ * @internal
+ * @file gncmod-gtkmm.cpp
+ * @brief Module definition/initialization for gtkmm support
+ * @author Copyright (C) 2011 Christian Stimming <stimming at tuhh.de>
+ */
+
+#include "config.h"
+/*#include <glib.h>*/
+#include <glib/gi18n.h>
+
+extern "C" {
+#include "gnc-module/gnc-module.h"
+#include "gnc-module/gnc-module-api.h"
+
+GNC_MODULE_API_DECL(libgncmod_gtkmm)
+
+/* version of the gnc module system interface we require */
+gint libgncmod_gtkmm_gnc_module_system_interface = 0;
+
+/* module versioning uses libtool semantics. */
+gint libgncmod_gtkmm_gnc_module_current = 0;
+gint libgncmod_gtkmm_gnc_module_revision = 0;
+gint libgncmod_gtkmm_gnc_module_age = 0;
+} // END extern "C"
+
+#include <gtkmm.h>
+
+extern "C" {
+
+gchar *
+libgncmod_gtkmm_gnc_module_path(void)
+{
+ return g_strdup("gnucash/gtkmm");
+}
+
+gchar *
+libgncmod_gtkmm_gnc_module_description(void)
+{
+ return g_strdup("Support for gtkmm gui");
+}
+
+gint
+libgncmod_gtkmm_gnc_module_init(gint refcount)
+{
+ /* Load modules we depend on */
+ if (!gnc_module_load("gnucash/engine", 0)
+ || !gnc_module_load("gnucash/app-utils", 0)
+ || !gnc_module_load("gnucash/gnome-utils", 0))
+ {
+ return FALSE;
+ }
+
+ /* Initialize the gtkmm framework. Calling this static method is
+ * sufficient; we don't actually need a Gtk::Main object. */
+ Gtk::Main::init_gtkmm_internals();
+
+ /* Add menu items with C callbacks */
+ /*gnc_plugin_gtkmm_create_plugin();*/
+
+ return 1;
+}
+
+gint
+libgncmod_gtkmm_gnc_module_end(gint refcount)
+{
+ return 1;
+}
+
+} // END extern "C"
Property changes on: gnucash/trunk/src/optional/gtkmm/gncmod-gtkmm.cpp
___________________________________________________________________
Added: svn:eol-style
+ LF
More information about the gnucash-changes
mailing list