[gnome-builder] libidemm: wrap first class: Ide::Application
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libidemm: wrap first class: Ide::Application
- Date: Tue, 17 May 2016 12:34:13 +0000 (UTC)
commit dfad307ab3d1f175d88ca71e95b9ec1ad3e35e9a
Author: Marcin Kolny <marcin kolny gmail com>
Date: Sun Apr 3 14:12:41 2016 +0200
libidemm: wrap first class: Ide::Application
libidemm/.gitignore | 46 +++++++++++++++++--
libidemm/Makefile.am | 4 +-
libidemm/configure.ac | 31 ++++++++++---
libidemm/idemm.h | 7 +++
libidemm/{libidemm.h => idemmconfig.h.in} | 0
libidemm/libidemm/Makefile.am | 15 ++++++
libidemm/libidemm/filelist.am | 7 +++
.../{libidemmconfig.h.in => libidemm/wrap_init.h} | 0
libidemm/src/Makefile.am | 12 +++++
libidemm/src/application.ccg | 49 ++++++++++++++++++++
libidemm/src/application.hg | 42 +++++++++++++++++
libidemm/src/filelist.am | 13 +++++
libidemm/src/libide.defs | 4 ++
libidemm/tools/Makefile.am | 4 +-
.../tools/extra_defs_gen/generate_defs_libide.cc | 3 +-
libidemm/tools/m4/convert.m4 | 2 +
libidemm/tools/m4/convert_libide.m4 | 2 +-
17 files changed, 224 insertions(+), 17 deletions(-)
---
diff --git a/libidemm/.gitignore b/libidemm/.gitignore
index ee68cec..87dbeec 100644
--- a/libidemm/.gitignore
+++ b/libidemm/.gitignore
@@ -1,13 +1,51 @@
-libidemmconfig.h
+*~
+
+*.lo
+*.o
+.deps
+.dirstamp
+.libs
+
stamp-h2
+.stamps
+
+# /
/Makefile
/Makefile.in
-/libidemm/Makefile
-/libidemm/Makefile.in
+/idemmconfig.h
+/compile-binding.am
+/dist-changelog.am
+/doc-reference.am
+/generate-binding.am
+
+# /src
/src/Makefile
/src/Makefile.in
+
+# /tools
/tools/extra_defs_gen/.dirstamp
/tools/extra_defs_gen/generate_defs_libide
/tools/Makefile
-/tools/Makefile.in
\ No newline at end of file
+/tools/Makefile.in
+
+# /libidemm
+/libidemm/libidemm-1.0.la
+/libidemm/Makefile
+/libidemm/Makefile.in
+/libidemm/private/
+/libidemm/application.cc
+/libidemm/application.h
+/libidemm/wrap_init.cc
+
+# docs/
+/docs/doc-install.pl
+/docs/doc-postprocess.pl
+/docs/doxygen.css
+/docs/doxygen-extra.css
+/docs/tagfile-to-devhelp2.xsl
+/docs/reference/Doxyfile
+/docs/reference/doxygen.log
+/docs/reference/gstreamermm-1.0.devhelp2
+/docs/reference/gstreamermm-1.0.tag
+/docs/reference/html/
diff --git a/libidemm/Makefile.am b/libidemm/Makefile.am
index 87305eb..fde0058 100644
--- a/libidemm/Makefile.am
+++ b/libidemm/Makefile.am
@@ -14,7 +14,7 @@
## along with this program. If not, see <http://www.gnu.org/licenses/>.
srcmm_subdirs = libidemm
-libidemm_include_HEADERS = libidemm.h
+libidemm_include_HEADERS = idemm.h
if MAINTAINER_MODE
src_subdirs = src
@@ -33,7 +33,7 @@ SUBDIRS = tools $(src_subdirs) $(srcmm_subdirs) # $(doc_subdirs)
libidemm_includedir = $(includedir)/$(LIBIDEMM_MODULE_NAME)
libidemm_libincludedir = $(libdir)/$(LIBIDEMM_MODULE_NAME)/include
-nodist_libidemm_libinclude_HEADERS = libidemmconfig.h
+nodist_libidemm_libinclude_HEADERS = idemmconfig.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(pkgconfig_files)
diff --git a/libidemm/configure.ac b/libidemm/configure.ac
index d732c1e..0960e2f 100644
--- a/libidemm/configure.ac
+++ b/libidemm/configure.ac
@@ -1,4 +1,21 @@
m4_define([glibmm_required_version], [2.47.3])
+m4_define([gtkmm_required_version], [3.19.12])
+
+AC_SUBST([LIBIDEMM_SO_VERSION], [0:0:0])
+
+MM_PREREQ([0.9.8])
+MM_INIT_MODULE([libidemm-1.0])
+
+MM_CONFIG_DOCTOOL_DIR([docs])
+
+MM_ARG_ENABLE_DOCUMENTATION
+
+MM_PKG_CONFIG_SUBST([GMMPROC_DIR], [--variable=gmmprocdir glibmm-2.4])
+MM_PKG_CONFIG_SUBST([GMMPROC_EXTRA_M4_DIR], [--variable=gmmprocm4dir cairomm-1.0 pangomm-1.4 atkmm-1.6
gtkmm-3.0])
+
+PKG_CHECK_MODULES(LIBIDEMM, [glibmm-2.4 >= glibmm_required_version
+ gtkmm-3.0 >= gtkmm_required_version])
+
AC_ARG_ENABLE([libidemm],
[AS_HELP_STRING([--enable-libidemm=@<:@yes/no@:>@],
@@ -7,21 +24,21 @@ AC_ARG_ENABLE([libidemm],
[enable_libidemm=auto])
AS_IF([test x$enable_libidemm != xno],[
- PKG_CHECK_MODULES(GLIBMM,
- [glibmm-2.4 >= glibmm_required_version],
- [have_glibmm=yes],
- [have_glibmm=no])
+ PKG_CHECK_MODULES(GTKMM,
+ [gtkmm-3.0 >= gtkmm_required_version],
+ [have_gtkmm=yes],
+ [have_gtkmm=no])
AS_IF([test x$enable_libidemm = xyes && x$have_libidemm = xno],[
- AC_MSG_ERROR([--enable-libidemm requires glibmm >= glibmm_required_version])
+ AC_MSG_ERROR([--enable-libidemm requires gtkmm >= gtkmm_required_version])
])
- enable_libidemm=$have_glibmm
+ enable_libidemm=$have_gtkmm
])
AM_CONDITIONAL(ENABLE_LIBIDEMM, test x$enable_libidemm = xyes)
-AC_CONFIG_HEADERS([libidemm/libidemmconfig.h])
+AC_CONFIG_HEADERS([libidemm/idemmconfig.h])
AC_CONFIG_FILES([libidemm/Makefile])
AC_CONFIG_FILES([libidemm/libidemm/Makefile])
diff --git a/libidemm/idemm.h b/libidemm/idemm.h
new file mode 100644
index 0000000..b57e1af
--- /dev/null
+++ b/libidemm/idemm.h
@@ -0,0 +1,7 @@
+#ifndef _IDEMM_H
+#define _IDEMM_H
+
+#include "libidemm/application.h"
+#include "libidemm/wrap_init.h"
+
+#endif
diff --git a/libidemm/libidemm.h b/libidemm/idemmconfig.h.in
similarity index 100%
rename from libidemm/libidemm.h
rename to libidemm/idemmconfig.h.in
diff --git a/libidemm/libidemm/Makefile.am b/libidemm/libidemm/Makefile.am
index e69de29..0fb50c3 100644
--- a/libidemm/libidemm/Makefile.am
+++ b/libidemm/libidemm/Makefile.am
@@ -0,0 +1,15 @@
+lib_LTLIBRARIES = libidemm-1.0.la
+include $(srcdir)/../src/filelist.am
+include $(srcdir)/filelist.am
+include $(top_srcdir)/libidemm/compile-binding.am
+
+local_cppflags = $(binding_includes) $(binding_cppflags) -DLIBIDEMM_BUILD=1
+libide_cflags = $(LIBIDE_CFLAGS) -I$(top_srcdir)/libide -I$(top_srcdir)/contrib/pnl
+
+AM_CPPFLAGS = $(local_cppflags) $(LIBIDEMM_CFLAGS) $(libide_cflags)
+
+AM_CXXFLAGS = $(LIBIDEMM_WXXFLAGS)
+
+libidemm_1_0_la_SOURCES = $(binding_sources)
+libidemm_1_0_la_LDFLAGS = -no-undefined -version-info $(LIBIDEMM_SO_VERSION)
+libidemm_1_0_la_LIBADD = $(LIBIDEMM_LIBS)
diff --git a/libidemm/libidemm/filelist.am b/libidemm/libidemm/filelist.am
new file mode 100644
index 0000000..991759a
--- /dev/null
+++ b/libidemm/libidemm/filelist.am
@@ -0,0 +1,7 @@
+files_built_cc = $(libidemm_files_hg:.hg=.cc) wrap_init.cc
+files_built_h = $(libidemm_files_hg:.hg=.h)
+files_built_ph = $(patsubst %.hg,private/%_p.h,$(libidemm_files_hg))
+files_extra_cc =
+files_extra_h = \
+ wrap_init.h
+files_extra_ph =
diff --git a/libidemm/libidemmconfig.h.in b/libidemm/libidemm/wrap_init.h
similarity index 100%
rename from libidemm/libidemmconfig.h.in
rename to libidemm/libidemm/wrap_init.h
diff --git a/libidemm/src/Makefile.am b/libidemm/src/Makefile.am
index e69de29..7d29442 100644
--- a/libidemm/src/Makefile.am
+++ b/libidemm/src/Makefile.am
@@ -0,0 +1,12 @@
+binding_name = libidemm
+wrap_init_flags = --namespace=Ide --parent_dir=libidemm
+codegen_srcdir = $(top_srcdir)/libidemm/tools
+
+include $(srcdir)/filelist.am
+include $(top_srcdir)/libidemm/tools/m4/filelist.am
+
+files_defs = $(libidemm_files_defs)
+files_ccg = $(libidemm_files_ccg)
+files_hg = $(libidemm_files_hg)
+
+include $(top_srcdir)/libidemm/generate-binding.am
diff --git a/libidemm/src/application.ccg b/libidemm/src/application.ccg
new file mode 100644
index 0000000..99e0fec
--- /dev/null
+++ b/libidemm/src/application.ccg
@@ -0,0 +1,49 @@
+#include "application.h"
+
+namespace {
+
+static void
+SignalProxy_async_callback(GObject*, GAsyncResult* res, gpointer data)
+{
+ auto the_slot = static_cast<Gio::SlotAsyncReady*>(data);
+
+ try
+ {
+ auto result = Glib::wrap(res, true /* take copy */);
+ (*the_slot)(result);
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+
+ delete the_slot;
+}
+
+}
+
+namespace Ide {
+
+Application::Application()
+:
+ _CONSTRUCT("application-id", "org.gnome.Builder", "flags", G_APPLICATION_HANDLES_OPEN)
+{}
+
+
+void Application::get_worker_async(const Glib::ustring& plugin_name, const Gio::SlotAsyncReady& slot, const
Glib::RefPtr<Gio::Cancellable>& cancellable)
+{
+ // slot_copy will be deleted in the callback.
+ auto slot_copy = new Gio::SlotAsyncReady(slot);
+
+ ide_application_get_worker_async(gobj(), plugin_name.c_str(), Glib::unwrap(cancellable),
&SignalProxy_async_callback, slot_copy);
+}
+
+void Application::get_worker_async(const Glib::ustring& plugin_name, const Gio::SlotAsyncReady& slot)
+{
+ // slot_copy will be deleted in the callback.
+ auto slot_copy = new Gio::SlotAsyncReady(slot);
+
+ ide_application_get_worker_async(gobj(), plugin_name.c_str(), nullptr, &SignalProxy_async_callback,
slot_copy);
+}
+
+}
diff --git a/libidemm/src/application.hg b/libidemm/src/application.hg
new file mode 100644
index 0000000..8c408dc
--- /dev/null
+++ b/libidemm/src/application.hg
@@ -0,0 +1,42 @@
+#include <gtkmm/application.h>
+#include <giomm/asyncresult.h>
+#include <giomm/cancellable.h>
+#include <giomm/dbusproxy.h>
+
+#include <ide.h>
+
+_DEFS(libidemm, libide)
+_PINCLUDE(gtkmm/private/application_p.h)
+
+namespace Ide {
+
+_WRAP_ENUM(ApplicationMode, IdeApplicationMode, NO_GTYPE)
+
+class Application : public Gtk::Application
+{
+protected:
+ _CLASS_GOBJECT(Application, IdeApplication, IDE_APPLICATION, Gtk::Application, GtkApplication)
+ _STRUCT_NOT_HIDDEN
+
+ Application();
+
+public:
+ _IGNORE(ide_application_new)
+ _WRAP_CREATE()
+ _WRAP_METHOD(Ide::ApplicationMode get_mode() const, ide_application_get_mode)
+ _WRAP_METHOD(Glib::DateTime get_started_at() const, ide_application_get_started_at)
+ _WRAP_METHOD(void show_projects_window(), ide_application_show_projects_window)
+ _WRAP_METHOD(Glib::ustring get_keybindings_mode() const, ide_application_get_keybindings_mode)
+ _WRAP_METHOD(Glib::RefPtr<Gio::Menu> get_menu_by_id(const Glib::ustring& id),
ide_application_get_menu_by_id)
+
+// TODO: remove the conversion when bug #764547 is fixed
+#m4 _CONVERSION(`GDBusProxy*',`Glib::RefPtr<Gio::DBus::Proxy>',`Glib::wrap($3)')
+_WRAP_METHOD(Glib::RefPtr<Gio::DBus::Proxy> get_worker_finish(const Glib::RefPtr<Gio::AsyncResult>& result),
ide_application_get_worker_finish, errthrow)
+
+ void get_worker_async(const Glib::ustring& plugin_name, const Gio::SlotAsyncReady& slot, const
Glib::RefPtr<Gio::Cancellable>& cancellable);
+ void get_worker_async(const Glib::ustring& plugin_name, const Gio::SlotAsyncReady& slot);
+ _IGNORE(ide_application_get_worker_async)
+
+};
+
+}
diff --git a/libidemm/src/filelist.am b/libidemm/src/filelist.am
new file mode 100644
index 0000000..a52693b
--- /dev/null
+++ b/libidemm/src/filelist.am
@@ -0,0 +1,13 @@
+## This file is part of libidemm.
+
+libidemm_files_defs = \
+ libide.defs \
+ libide_enums.defs \
+ libide_methods.defs \
+ libide_signals.defs \
+ libide_docs.xml
+
+libidemm_files_hg = \
+ application.hg
+
+libidemm_files_ccg = $(libidemm_files_hg:.hg=.ccg)
diff --git a/libidemm/src/libide.defs b/libidemm/src/libide.defs
new file mode 100644
index 0000000..4121a64
--- /dev/null
+++ b/libidemm/src/libide.defs
@@ -0,0 +1,4 @@
+(include libide_methods.defs)
+(include libide_signals.defs)
+(include libide_enums.defs)
+
diff --git a/libidemm/tools/Makefile.am b/libidemm/tools/Makefile.am
index ff1b535..b9edb15 100644
--- a/libidemm/tools/Makefile.am
+++ b/libidemm/tools/Makefile.am
@@ -6,6 +6,6 @@ noinst_PROGRAMS = extra_defs_gen/generate_defs_libide
extra_defs_gen_generate_defs_libide_SOURCES = extra_defs_gen/generate_defs_libide.cc
extra_defs_gen_generate_defs_libide_LDADD = \
- $(LIBIDEMM_LIBS) -lglibmm_generate_extra_defs-2.4
+ $(LIBIDEMM_LIBS) -lglibmm_generate_extra_defs-2.4 -L../../libide -lide-1.0
-AM_CPPFLAGS = -I$(top_builddir) $(LIBIDE_CFLAGS) $(GLIBMM_CFLAGS) -I../../libide -I../../contrib/pnl
+AM_CPPFLAGS = -I$(top_builddir) $(LIBIDE_CFLAGS) $(LIBIDEMM_CFLAGS) -I../../libide -I../../contrib/pnl
diff --git a/libidemm/tools/extra_defs_gen/generate_defs_libide.cc
b/libidemm/tools/extra_defs_gen/generate_defs_libide.cc
index cb98320..75cbc94 100644
--- a/libidemm/tools/extra_defs_gen/generate_defs_libide.cc
+++ b/libidemm/tools/extra_defs_gen/generate_defs_libide.cc
@@ -28,6 +28,7 @@ bool libide_type_is_a_pointer(GType gtype)
int main (int argc, char *argv[])
{
- // std::cout << get_defs(GTYPE, libide_type_is_a_pointer);
+ std::cout << get_defs(IDE_TYPE_APPLICATION, libide_type_is_a_pointer);
+
return 0;
}
diff --git a/libidemm/tools/m4/convert.m4 b/libidemm/tools/m4/convert.m4
index 5b7d6e3..3eb375e 100644
--- a/libidemm/tools/m4/convert.m4
+++ b/libidemm/tools/m4/convert.m4
@@ -2,4 +2,6 @@ include(convert_base.m4)
include(convert_glib.m4)
include(convert_libide.m4)
include(convert_glibmm.m4)
+include(convert_gtkmm.m4)
+include(convert_gio.m4)
diff --git a/libidemm/tools/m4/convert_libide.m4 b/libidemm/tools/m4/convert_libide.m4
index 757fad4..40db454 100644
--- a/libidemm/tools/m4/convert_libide.m4
+++ b/libidemm/tools/m4/convert_libide.m4
@@ -1,5 +1,5 @@
dnl Enums
-#_CONV_ENUM(Gst,AssocFlags)
+_CONV_ENUM(Ide,ApplicationMode)
dnl Glibmm Enums
#_CONV_GLIB_ENUM(ThreadPriority)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]