[gnome-builder] libidemm: wrap Ide::Object



commit 63587cb2af952e2a1c39c9fe4c236995dff6b011
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Sun Apr 10 21:16:40 2016 +0200

    libidemm: wrap Ide::Object

 libidemm/.gitignore                                |    2 +
 libidemm/src/filelist.am                           |    1 +
 libidemm/src/libide_signals.defs                   |   18 ++++++++
 libidemm/src/object.ccg                            |   30 +++++++++++++
 libidemm/src/object.hg                             |   44 ++++++++++++++++++++
 libidemm/tools/Makefile.am                         |    2 +-
 .../tools/extra_defs_gen/generate_defs_libide.cc   |    3 +-
 libidemm/tools/m4/convert_libide.m4                |    2 +
 8 files changed, 100 insertions(+), 2 deletions(-)
---
diff --git a/libidemm/.gitignore b/libidemm/.gitignore
index 0ad1aad..6b6ae5c 100644
--- a/libidemm/.gitignore
+++ b/libidemm/.gitignore
@@ -38,6 +38,8 @@ stamp-h2
 /idemm/application.h
 /idemm/applicationaddin.cc
 /idemm/applicationaddin.h
+/idemm/object.cc
+/idemm/object.h
 /idemm/recentprojects.cc
 /idemm/recentprojects.h
 /idemm/wrap_init.cc
diff --git a/libidemm/src/filelist.am b/libidemm/src/filelist.am
index 4c1f788..2d1af9b 100644
--- a/libidemm/src/filelist.am
+++ b/libidemm/src/filelist.am
@@ -11,6 +11,7 @@ idemm_files_defs =            \
 idemm_files_hg =               \
        application.hg          \
        applicationaddin.hg     \
+       object.hg               \
        recentprojects.hg
 
 idemm_files_ccg = $(idemm_files_hg:.hg=.ccg)
diff --git a/libidemm/src/libide_signals.defs b/libidemm/src/libide_signals.defs
index e69de29..a54dacf 100644
--- a/libidemm/src/libide_signals.defs
+++ b/libidemm/src/libide_signals.defs
@@ -0,0 +1,18 @@
+;; From IdeApplication
+
+;; From IdeObject
+
+(define-signal destroy
+  (of-object "IdeObject")
+  (return-type "void")
+  (when "last")
+)
+
+(define-property context
+  (of-object "IdeObject")
+  (prop-type "GParamObject")
+  (docs "The context that owns the object.")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
diff --git a/libidemm/src/object.ccg b/libidemm/src/object.ccg
new file mode 100644
index 0000000..2331758
--- /dev/null
+++ b/libidemm/src/object.ccg
@@ -0,0 +1,30 @@
+/* object.ccg
+ *
+ * Copyright (C) 2016 Marcin Kolny <marcin kolny gmail com>
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace Ide {
+
+Glib::RefPtr<Ide::Object> Object::create_finish(const Glib::RefPtr<Gio::AsyncResult>& result)
+{
+  GError* gerror = nullptr;
+  Glib::RefPtr<Ide::Object> retvalue = Glib::wrap(ide_object_new_finish(Glib::unwrap(result), &(gerror)), 
true);
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+  return retvalue;
+}
+
+}
diff --git a/libidemm/src/object.hg b/libidemm/src/object.hg
new file mode 100644
index 0000000..b17e1cc
--- /dev/null
+++ b/libidemm/src/object.hg
@@ -0,0 +1,44 @@
+/* object.hg
+ *
+ * Copyright (C) 2016 Marcin Kolny <marcin kolny gmail com>
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glibmm/object.h>
+#include <giomm/asyncresult.h>
+
+#include <ide.h>
+
+_DEFS(idemm, libide)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Ide {
+
+class Object : public Glib::Object
+{
+protected:
+  _CLASS_GOBJECT(Object, IdeObject, IDE_OBJECT, Glib::Object, GObject)
+
+public:
+  static Glib::RefPtr<Ide::Object> create_finish(const Glib::RefPtr<Gio::AsyncResult>& result);
+
+  _WRAP_METHOD(bool hold(), ide_object_hold)
+  _WRAP_METHOD(void release(), ide_object_release)
+  _WRAP_METHOD(void notify_in_main(GParamSpec *pspec), ide_object_notify_in_main)
+
+  _WRAP_SIGNAL(void destroy(), "destroy")
+};
+
+}
diff --git a/libidemm/tools/Makefile.am b/libidemm/tools/Makefile.am
index 2c43a6d..1d4ce8d 100644
--- a/libidemm/tools/Makefile.am
+++ b/libidemm/tools/Makefile.am
@@ -8,7 +8,7 @@ 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 = \
-       $(IDEMM_LIBS) -lglibmm_generate_extra_defs-2.4 -L../../libide -lide-1.0
+       $(IDEMM_LIBS) $(LIBIDE_LIBS) -lglibmm_generate_extra_defs-2.4 -L../../libide -lide-1.0
 
 AM_CPPFLAGS = -I$(top_builddir) $(LIBIDE_CFLAGS) $(IDEMM_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 75cbc94..f5298d4 100644
--- a/libidemm/tools/extra_defs_gen/generate_defs_libide.cc
+++ b/libidemm/tools/extra_defs_gen/generate_defs_libide.cc
@@ -28,7 +28,8 @@ bool libide_type_is_a_pointer(GType gtype)
 int main (int argc, char *argv[])
 {
 
-  std::cout << get_defs(IDE_TYPE_APPLICATION, libide_type_is_a_pointer);
+  std::cout << get_defs(IDE_TYPE_APPLICATION, libide_type_is_a_pointer)
+           << get_defs(IDE_TYPE_OBJECT, libide_type_is_a_pointer);
   
   return 0;
 }
diff --git a/libidemm/tools/m4/convert_libide.m4 b/libidemm/tools/m4/convert_libide.m4
index f403de6..abc7ce7 100644
--- a/libidemm/tools/m4/convert_libide.m4
+++ b/libidemm/tools/m4/convert_libide.m4
@@ -43,3 +43,5 @@ dnl Ide::Application
 _CONVERSION(`const Glib::RefPtr<Ide::Application>&',`IdeApplication*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`IdeApplication*',`const Glib::RefPtr<Ide::Application>&',Glib::wrap($3, true))
 
+dnl Ide::Object
+_CONVERSION(`IdeObject*',`Glib::RefPtr<Ide::Object>',Glib::wrap($3, true))


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