[gnome-builder] libide: progress towards making libide introspectable



commit 064ed59b057a50f17baadfc56c110d956495fed5
Author: Christian Hergert <christian hergert me>
Date:   Thu Feb 12 14:26:04 2015 -0800

    libide: progress towards making libide introspectable

 .gitignore                                         |    2 +
 Makefile.am                                        |    3 +
 build/autotools/autoconf.d/50_dependencies.post-am |    2 +
 build/autotools/m4/introspection.m4                |   96 +++++++++++++++++++
 libide/Makefile.am                                 |   58 +++++++++++-
 libide/ide-debugger.c                              |   26 +++++
 libide/ide-debugger.h                              |    2 +-
 libide/ide-deployer.c                              |   93 +++++++++++++++++++
 libide/ide-executable.c                            |   26 +++++
 libide/ide-executable.h                            |    2 +-
 libide/ide-executer.c                              |   26 +++++
 libide/ide-executer.h                              |    2 +-
 libide/ide-process.c                               |   26 +++++
 libide/ide-process.h                               |    2 +-
 libide/ide-search-context.c                        |   93 +++++++++++++++++++
 libide/ide-search-context.h                        |   37 ++++++++
 libide/ide-search-engine.c                         |   97 ++++++++++++++++++++
 libide/ide-search-provider.c                       |   93 +++++++++++++++++++
 libide/ide-search-result.c                         |   93 +++++++++++++++++++
 libide/ide-symbol.c                                |   71 ++++++++++++++
 libide/ide-symbol.h                                |   12 +-
 libide/ide-target.c                                |   26 +++++
 libide/ide-target.h                                |    6 +-
 libide/ide-test-case.c                             |   26 +++++
 libide/ide-test-suite.c                            |   26 +++++
 libide/ide-test-suite.h                            |    4 +-
 libide/ide-types.h                                 |    2 +
 libide/ide-unsaved-file.c                          |    7 ++
 libide/ide.h                                       |    1 +
 29 files changed, 939 insertions(+), 21 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 67599d3..7e44bbb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,8 @@ config.h.in~
 config.log
 config.status
 configure
+Ide.gir
+Ide.typelib
 gnome-builder
 ide-build
 ide-list-devices
diff --git a/Makefile.am b/Makefile.am
index 64ddc53..05468ba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,5 +29,8 @@ INTLTOOL_FILES = \
 EXTRA_DIST += \
        $(INTLTOOL_FILES) \
        AUTHORS \
+       build/autotools/m4/introspection.m4 \
        $(NULL)
 
+DISTCHECK_CONFIGURE_FLAGS = --enable-introspection
+
diff --git a/build/autotools/autoconf.d/50_dependencies.post-am 
b/build/autotools/autoconf.d/50_dependencies.post-am
index 4d3b815..7e8a729 100644
--- a/build/autotools/autoconf.d/50_dependencies.post-am
+++ b/build/autotools/autoconf.d/50_dependencies.post-am
@@ -24,3 +24,5 @@ AC_SUBST([CLANG_LDFLAGS])
 AC_CHECK_HEADER([clang-c/Index.h], [], [
     AC_MSG_ERROR([Failed to locage clang-c/Index.h. Please install clang-devel.])
 ])
+
+GOBJECT_INTROSPECTION_CHECK([1.30.0])
diff --git a/build/autotools/m4/introspection.m4 b/build/autotools/m4/introspection.m4
new file mode 100644
index 0000000..d89c3d9
--- /dev/null
+++ b/build/autotools/m4/introspection.m4
@@ -0,0 +1,96 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+    AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+    AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+    dnl enable/disable introspection
+    m4_if([$2], [require],
+    [dnl
+        enable_introspection=yes
+    ],[dnl
+        AC_ARG_ENABLE(introspection,
+                  AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+                                 [Enable introspection for this build]),, 
+                                 [enable_introspection=auto])
+    ])dnl
+
+    AC_MSG_CHECKING([for gobject-introspection])
+
+    dnl presence/version checking
+    AS_CASE([$enable_introspection],
+    [no], [dnl
+        found_introspection="no (disabled, use --enable-introspection to enable)"
+    ],dnl
+    [yes],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+                         AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+                         found_introspection=yes,
+                         AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build 
AC_PACKAGE_NAME]))
+    ],dnl
+    [auto],[dnl
+        PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+       dnl Canonicalize enable_introspection
+       enable_introspection=$found_introspection
+    ],dnl
+    [dnl       
+        AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of 
@<:@no/auto/yes@:>@])
+    ])dnl
+
+    AC_MSG_RESULT([$found_introspection])
+
+    INTROSPECTION_SCANNER=
+    INTROSPECTION_COMPILER=
+    INTROSPECTION_GENERATE=
+    INTROSPECTION_GIRDIR=
+    INTROSPECTION_TYPELIBDIR=
+    if test "x$found_introspection" = "xyes"; then
+       INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+       INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+       INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+       INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+       INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+       INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir 
gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+    fi
+    AC_SUBST(INTROSPECTION_SCANNER)
+    AC_SUBST(INTROSPECTION_COMPILER)
+    AC_SUBST(INTROSPECTION_GENERATE)
+    AC_SUBST(INTROSPECTION_GIRDIR)
+    AC_SUBST(INTROSPECTION_TYPELIBDIR)
+    AC_SUBST(INTROSPECTION_CFLAGS)
+    AC_SUBST(INTROSPECTION_LIBS)
+    AC_SUBST(INTROSPECTION_MAKEFILE)
+
+    AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl   GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+  _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])
diff --git a/libide/Makefile.am b/libide/Makefile.am
index 0d24f71..7798380 100644
--- a/libide/Makefile.am
+++ b/libide/Makefile.am
@@ -1,6 +1,6 @@
 noinst_LTLIBRARIES += libide.la
 
-libide_la_SOURCES = \
+libide_la_public_sources = \
        libide/autotools/ide-autotools-build-system.c \
        libide/autotools/ide-autotools-build-system.h \
        libide/autotools/ide-autotools-build-task.c \
@@ -26,17 +26,12 @@ libide_la_SOURCES = \
        libide/directory/ide-directory-build-system.h \
        libide/directory/ide-directory-vcs.c \
        libide/directory/ide-directory-vcs.h \
-       libide/gconstructor.h \
        libide/git/ide-git-vcs.c \
        libide/git/ide-git-vcs.h \
-       libide/ide-async-helper.c \
-       libide/ide-async-helper.h \
        libide/ide-back-forward-item.c \
        libide/ide-back-forward-item.h \
        libide/ide-back-forward-list.c \
        libide/ide-back-forward-list.h \
-       libide/ide-buffer-iter.h \
-       libide/ide-buffer.h \
        libide/ide-build-result.c \
        libide/ide-build-result.h \
        libide/ide-build-system.c \
@@ -45,7 +40,9 @@ libide_la_SOURCES = \
        libide/ide-builder.h \
        libide/ide-context.c \
        libide/ide-context.h \
+       libide/ide-debugger.c \
        libide/ide-debugger.h \
+       libide/ide-deployer.c \
        libide/ide-deployer.h \
        libide/ide-device-manager.c \
        libide/ide-device-manager.h \
@@ -61,7 +58,9 @@ libide_la_SOURCES = \
        libide/ide-diagnostician.h \
        libide/ide-diagnostics.c \
        libide/ide-diagnostics.h \
+       libide/ide-executable.c \
        libide/ide-executable.h \
+       libide/ide-executer.c \
        libide/ide-executer.h \
        libide/ide-file.c \
        libide/ide-file.h \
@@ -76,6 +75,7 @@ libide_la_SOURCES = \
        libide/ide-language.h \
        libide/ide-object.c \
        libide/ide-object.h \
+       libide/ide-process.c \
        libide/ide-process.h \
        libide/ide-project-file.c \
        libide/ide-project-file.h \
@@ -89,8 +89,13 @@ libide_la_SOURCES = \
        libide/ide-refactory.h \
        libide/ide-script.c \
        libide/ide-script.h \
+       libide/ide-search-context.c \
+       libide/ide-search-context.h \
+       libide/ide-search-engine.c \
        libide/ide-search-engine.h \
+       libide/ide-search-provider.c \
        libide/ide-search-provider.h \
+       libide/ide-search-result.c \
        libide/ide-search-result.h \
        libide/ide-service.c \
        libide/ide-service.h \
@@ -100,9 +105,13 @@ libide_la_SOURCES = \
        libide/ide-source-range.h \
        libide/ide-symbol-resolver.c \
        libide/ide-symbol-resolver.h \
+       libide/ide-symbol.c \
        libide/ide-symbol.h \
+       libide/ide-target.c \
        libide/ide-target.h \
+       libide/ide-test-case.c \
        libide/ide-test-case.h \
+       libide/ide-test-suite.c \
        libide/ide-test-suite.h \
        libide/ide-types.h \
        libide/ide-unsaved-file.c \
@@ -115,6 +124,13 @@ libide_la_SOURCES = \
        libide/ide.h \
        libide/local/ide-local-device.c \
        libide/local/ide-local-device.h \
+       $(NULL)
+
+libide_la_SOURCES = \
+       $(libide_la_public_sources) \
+       libide/gconstructor.h \
+       libide/ide-async-helper.c \
+       libide/ide-async-helper.h \
        libide/tasks/ide-load-directory-task.c \
        libide/tasks/ide-load-directory-task.h \
        $(NULL)
@@ -135,3 +151,33 @@ libide_la_LIBADD = \
        $(LIBIDE_LIBS) \
        -lclang \
        $(NULL)
+
+
+-include $(INTROSPECTION_MAKEFILE)
+
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(top_srcdir)/libide --warn-all
+INTROSPECTION_COMPILER_ARGS = --includedir=$(top_srcdir)/libide
+
+if HAVE_INTROSPECTION
+introspection_sources = $(libide_la_public_sources)
+
+Ide.gir: libide.la
+Ide_gir_INCLUDES = Gio-2.0 GtkSource-3.0 Ggit-1.0
+Ide_gir_CFLAGS = $(libide_la_CFLAGS)
+Ide_gir_LIBS = libide.la
+Ide_gir_FILES = $(introspection_sources)
+Ide_gir_SCANNERFLAGS = \
+       --c-include="ide.h" \
+       -n Ide \
+       $(NULL)
+INTROSPECTION_GIRS += Ide.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif
diff --git a/libide/ide-debugger.c b/libide/ide-debugger.c
new file mode 100644
index 0000000..f4d8dc2
--- /dev/null
+++ b/libide/ide-debugger.c
@@ -0,0 +1,26 @@
+/* ide-debugger.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-debugger.h"
+
+G_DEFINE_INTERFACE (IdeDebugger, ide_debugger, IDE_TYPE_OBJECT)
+
+static void
+ide_debugger_default_init (IdeDebuggerInterface *iface)
+{
+}
diff --git a/libide/ide-debugger.h b/libide/ide-debugger.h
index d12ac06..afb1ed1 100644
--- a/libide/ide-debugger.h
+++ b/libide/ide-debugger.h
@@ -19,7 +19,7 @@
 #ifndef IDE_DEBUGGER_H
 #define IDE_DEBUGGER_H
 
-#include <glib-object.h>
+#include "ide-object.h"
 
 G_BEGIN_DECLS
 
diff --git a/libide/ide-deployer.c b/libide/ide-deployer.c
new file mode 100644
index 0000000..95776aa
--- /dev/null
+++ b/libide/ide-deployer.c
@@ -0,0 +1,93 @@
+/* ide-deployer.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-deployer.h"
+
+typedef struct
+{
+  void *foo;
+} IdeDeployerPrivate;
+
+G_DEFINE_ABSTRACT_TYPE (IdeDeployer, ide_deployer, IDE_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+  LAST_PROP
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+
+IdeDeployer *
+ide_deployer_new (void)
+{
+  return g_object_new (IDE_TYPE_DEPLOYER, NULL);
+}
+
+static void
+ide_deployer_finalize (GObject *object)
+{
+  IdeDeployer *self = (IdeDeployer *)object;
+  IdeDeployerPrivate *priv = ide_deployer_get_instance_private (self);
+
+  G_OBJECT_CLASS (ide_deployer_parent_class)->finalize (object);
+}
+
+static void
+ide_deployer_get_property (GObject    *object,
+                           guint       prop_id,
+                           GValue     *value,
+                           GParamSpec *pspec)
+{
+  IdeDeployer *self = IDE_DEPLOYER (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_deployer_set_property (GObject      *object,
+                           guint         prop_id,
+                           const GValue *value,
+                           GParamSpec   *pspec)
+{
+  IdeDeployer *self = IDE_DEPLOYER (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_deployer_class_init (IdeDeployerClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = ide_deployer_finalize;
+  object_class->get_property = ide_deployer_get_property;
+  object_class->set_property = ide_deployer_set_property;
+}
+
+static void
+ide_deployer_init (IdeDeployer *self)
+{
+}
diff --git a/libide/ide-executable.c b/libide/ide-executable.c
new file mode 100644
index 0000000..ccedfcd
--- /dev/null
+++ b/libide/ide-executable.c
@@ -0,0 +1,26 @@
+/* ide-executable.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-executable.h"
+
+G_DEFINE_INTERFACE (IdeExecutable, ide_executable, IDE_TYPE_OBJECT)
+
+static void
+ide_executable_default_init (IdeExecutableInterface *iface)
+{
+}
diff --git a/libide/ide-executable.h b/libide/ide-executable.h
index 1e80494..774a39d 100644
--- a/libide/ide-executable.h
+++ b/libide/ide-executable.h
@@ -19,7 +19,7 @@
 #ifndef IDE_EXECUTABLE_H
 #define IDE_EXECUTABLE_H
 
-#include <glib-object.h>
+#include "ide-object.h"
 
 G_BEGIN_DECLS
 
diff --git a/libide/ide-executer.c b/libide/ide-executer.c
new file mode 100644
index 0000000..62bacb3
--- /dev/null
+++ b/libide/ide-executer.c
@@ -0,0 +1,26 @@
+/* ide-executer.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-executer.h"
+
+G_DEFINE_INTERFACE (IdeExecuter, ide_executer, IDE_TYPE_OBJECT)
+
+static void
+ide_executer_default_init (IdeExecuterInterface *iface)
+{
+}
diff --git a/libide/ide-executer.h b/libide/ide-executer.h
index 89550e3..0b9d2fd 100644
--- a/libide/ide-executer.h
+++ b/libide/ide-executer.h
@@ -19,7 +19,7 @@
 #ifndef IDE_EXECUTER_H
 #define IDE_EXECUTER_H
 
-#include <glib-object.h>
+#include "ide-object.h"
 
 G_BEGIN_DECLS
 
diff --git a/libide/ide-process.c b/libide/ide-process.c
new file mode 100644
index 0000000..a185a15
--- /dev/null
+++ b/libide/ide-process.c
@@ -0,0 +1,26 @@
+/* ide-process.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-process.h"
+
+G_DEFINE_INTERFACE (IdeProcess, ide_process, IDE_TYPE_OBJECT)
+
+static void
+ide_process_default_init (IdeProcessInterface *iface)
+{
+}
diff --git a/libide/ide-process.h b/libide/ide-process.h
index d6ae844..9835082 100644
--- a/libide/ide-process.h
+++ b/libide/ide-process.h
@@ -19,7 +19,7 @@
 #ifndef IDE_PROCESS_H
 #define IDE_PROCESS_H
 
-#include <glib-object.h>
+#include "ide-object.h"
 
 G_BEGIN_DECLS
 
diff --git a/libide/ide-search-context.c b/libide/ide-search-context.c
new file mode 100644
index 0000000..787136b
--- /dev/null
+++ b/libide/ide-search-context.c
@@ -0,0 +1,93 @@
+/* ide-search-context.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-search-context.h"
+
+typedef struct
+{
+  void *foo;
+} IdeSearchContextPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (IdeSearchContext, ide_search_context, IDE_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+  LAST_PROP
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+
+IdeSearchContext *
+ide_search_context_new (void)
+{
+  return g_object_new (IDE_TYPE_SEARCH_CONTEXT, NULL);
+}
+
+static void
+ide_search_context_finalize (GObject *object)
+{
+  IdeSearchContext *self = (IdeSearchContext *)object;
+  IdeSearchContextPrivate *priv = ide_search_context_get_instance_private (self);
+
+  G_OBJECT_CLASS (ide_search_context_parent_class)->finalize (object);
+}
+
+static void
+ide_search_context_get_property (GObject    *object,
+                                 guint       prop_id,
+                                 GValue     *value,
+                                 GParamSpec *pspec)
+{
+  IdeSearchContext *self = IDE_SEARCH_CONTEXT (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_search_context_set_property (GObject      *object,
+                                 guint         prop_id,
+                                 const GValue *value,
+                                 GParamSpec   *pspec)
+{
+  IdeSearchContext *self = IDE_SEARCH_CONTEXT (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_search_context_class_init (IdeSearchContextClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = ide_search_context_finalize;
+  object_class->get_property = ide_search_context_get_property;
+  object_class->set_property = ide_search_context_set_property;
+}
+
+static void
+ide_search_context_init (IdeSearchContext *self)
+{
+}
diff --git a/libide/ide-search-context.h b/libide/ide-search-context.h
new file mode 100644
index 0000000..7718322
--- /dev/null
+++ b/libide/ide-search-context.h
@@ -0,0 +1,37 @@
+/* ide-search-context.h
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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/>.
+ */
+
+#ifndef IDE_SEARCH_CONTEXT_H
+#define IDE_SEARCH_CONTEXT_H
+
+#include "ide-object.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_SEARCH_CONTEXT (ide_search_context_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeSearchContext, ide_search_context, IDE, SEARCH_CONTEXT, IdeObject)
+
+struct _IdeSearchContext
+{
+  IdeObject parent_instance;
+};
+
+G_END_DECLS
+
+#endif /* IDE_SEARCH_CONTEXT_H */
diff --git a/libide/ide-search-engine.c b/libide/ide-search-engine.c
new file mode 100644
index 0000000..f6d3967
--- /dev/null
+++ b/libide/ide-search-engine.c
@@ -0,0 +1,97 @@
+/* ide-search-engine.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 <glib/gi18n.h>
+
+#include "ide-search-engine.h"
+#include "ide-search-provider.h"
+#include "ide-search-result.h"
+
+typedef struct
+{
+  GPtrArray *providers;
+} IdeSearchEnginePrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (IdeSearchEngine, ide_search_engine, IDE_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+  LAST_PROP
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+
+IdeSearchEngine *
+ide_search_engine_new (void)
+{
+  return g_object_new (IDE_TYPE_SEARCH_ENGINE, NULL);
+}
+
+static void
+ide_search_engine_finalize (GObject *object)
+{
+  IdeSearchEngine *self = (IdeSearchEngine *)object;
+  IdeSearchEnginePrivate *priv = ide_search_engine_get_instance_private (self);
+
+  G_OBJECT_CLASS (ide_search_engine_parent_class)->finalize (object);
+}
+
+static void
+ide_search_engine_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+  IdeSearchEngine *self = IDE_SEARCH_ENGINE (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_search_engine_set_property (GObject      *object,
+                                guint         prop_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
+{
+  IdeSearchEngine *self = IDE_SEARCH_ENGINE (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_search_engine_class_init (IdeSearchEngineClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = ide_search_engine_finalize;
+  object_class->get_property = ide_search_engine_get_property;
+  object_class->set_property = ide_search_engine_set_property;
+}
+
+static void
+ide_search_engine_init (IdeSearchEngine *self)
+{
+}
diff --git a/libide/ide-search-provider.c b/libide/ide-search-provider.c
new file mode 100644
index 0000000..a37f76e
--- /dev/null
+++ b/libide/ide-search-provider.c
@@ -0,0 +1,93 @@
+/* ide-search-provider.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-search-provider.h"
+
+typedef struct
+{
+  gchar *name;
+} IdeSearchProviderPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (IdeSearchProvider, ide_search_provider, IDE_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+  LAST_PROP
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+
+IdeSearchProvider *
+ide_search_provider_new (void)
+{
+  return g_object_new (IDE_TYPE_SEARCH_PROVIDER, NULL);
+}
+
+static void
+ide_search_provider_finalize (GObject *object)
+{
+  IdeSearchProvider *self = (IdeSearchProvider *)object;
+  IdeSearchProviderPrivate *priv = ide_search_provider_get_instance_private (self);
+
+  G_OBJECT_CLASS (ide_search_provider_parent_class)->finalize (object);
+}
+
+static void
+ide_search_provider_get_property (GObject    *object,
+                                  guint       prop_id,
+                                  GValue     *value,
+                                  GParamSpec *pspec)
+{
+  IdeSearchProvider *self = IDE_SEARCH_PROVIDER (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_search_provider_set_property (GObject      *object,
+                                  guint         prop_id,
+                                  const GValue *value,
+                                  GParamSpec   *pspec)
+{
+  IdeSearchProvider *self = IDE_SEARCH_PROVIDER (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_search_provider_class_init (IdeSearchProviderClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = ide_search_provider_finalize;
+  object_class->get_property = ide_search_provider_get_property;
+  object_class->set_property = ide_search_provider_set_property;
+}
+
+static void
+ide_search_provider_init (IdeSearchProvider *self)
+{
+}
diff --git a/libide/ide-search-result.c b/libide/ide-search-result.c
new file mode 100644
index 0000000..a530b53
--- /dev/null
+++ b/libide/ide-search-result.c
@@ -0,0 +1,93 @@
+/* ide-search-result.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-search-result.h"
+
+typedef struct
+{
+  gchar *text;
+} IdeSearchResultPrivate;
+
+G_DEFINE_TYPE_WITH_PRIVATE (IdeSearchResult, ide_search_result, IDE_TYPE_OBJECT)
+
+enum {
+  PROP_0,
+  LAST_PROP
+};
+
+static GParamSpec *gParamSpecs [LAST_PROP];
+
+IdeSearchResult *
+ide_search_result_new (void)
+{
+  return g_object_new (IDE_TYPE_SEARCH_RESULT, NULL);
+}
+
+static void
+ide_search_result_finalize (GObject *object)
+{
+  IdeSearchResult *self = (IdeSearchResult *)object;
+  IdeSearchResultPrivate *priv = ide_search_result_get_instance_private (self);
+
+  G_OBJECT_CLASS (ide_search_result_parent_class)->finalize (object);
+}
+
+static void
+ide_search_result_get_property (GObject    *object,
+                                guint       prop_id,
+                                GValue     *value,
+                                GParamSpec *pspec)
+{
+  IdeSearchResult *self = IDE_SEARCH_RESULT (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_search_result_set_property (GObject      *object,
+                                guint         prop_id,
+                                const GValue *value,
+                                GParamSpec   *pspec)
+{
+  IdeSearchResult *self = IDE_SEARCH_RESULT (object);
+
+  switch (prop_id)
+    {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+    }
+}
+
+static void
+ide_search_result_class_init (IdeSearchResultClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = ide_search_result_finalize;
+  object_class->get_property = ide_search_result_get_property;
+  object_class->set_property = ide_search_result_set_property;
+}
+
+static void
+ide_search_result_init (IdeSearchResult *self)
+{
+}
diff --git a/libide/ide-symbol.c b/libide/ide-symbol.c
new file mode 100644
index 0000000..be14fb6
--- /dev/null
+++ b/libide/ide-symbol.c
@@ -0,0 +1,71 @@
+/* ide-symbol.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-symbol.h"
+
+struct _IdeSymbol
+{
+  volatile gint ref_count;
+  gchar *name;
+};
+
+G_DEFINE_BOXED_TYPE (IdeSymbol, ide_symbol, ide_symbol_ref, ide_symbol_unref)
+
+IdeSymbol *
+_ide_symbol_new (const gchar *name)
+{
+  IdeSymbol *ret;
+
+  ret = g_slice_new0 (IdeSymbol);
+  ret->ref_count = 1;
+  ret->name = g_strdup (name);
+
+  return ret;
+}
+
+const gchar *
+ide_symbol_get_name (IdeSymbol *self)
+{
+  g_return_val_if_fail (self, NULL);
+
+  return self->name;
+}
+
+IdeSymbol *
+ide_symbol_ref (IdeSymbol *self)
+{
+  g_return_val_if_fail (self, NULL);
+  g_return_val_if_fail (self->ref_count > 0, NULL);
+
+  g_atomic_int_inc (&self->ref_count);
+
+  return self;
+}
+
+void
+ide_symbol_unref (IdeSymbol *self)
+{
+  g_return_if_fail (self);
+  g_return_if_fail (self->ref_count);
+
+  if (g_atomic_int_dec_and_test (&self->ref_count))
+    {
+      g_free (self->name);
+      g_slice_free (IdeSymbol, self);
+    }
+}
diff --git a/libide/ide-symbol.h b/libide/ide-symbol.h
index 667184a..fdbc7c6 100644
--- a/libide/ide-symbol.h
+++ b/libide/ide-symbol.h
@@ -19,18 +19,18 @@
 #ifndef IDE_SYMBOL_H
 #define IDE_SYMBOL_H
 
-#include "ide-object.h"
+#include "ide-types.h"
 
 G_BEGIN_DECLS
 
 #define IDE_TYPE_SYMBOL (ide_symbol_get_type())
 
-G_DECLARE_DERIVABLE_TYPE (IdeSymbol, ide_symbol, IDE, SYMBOL, IdeObject)
+GType        ide_symbol_get_type (void);
+IdeSymbol   *ide_symbol_ref      (IdeSymbol *self);
+void         ide_symbol_unref    (IdeSymbol *self);
+const gchar *ide_symbol_get_name (IdeSymbol *self);
 
-struct _IdeSymbolClass
-{
-  IdeObjectClass parent;
-};
+G_DEFINE_AUTOPTR_CLEANUP_FUNC (IdeSymbol, ide_symbol_unref)
 
 G_END_DECLS
 
diff --git a/libide/ide-target.c b/libide/ide-target.c
new file mode 100644
index 0000000..956e9bc
--- /dev/null
+++ b/libide/ide-target.c
@@ -0,0 +1,26 @@
+/* ide-target.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-target.h"
+
+G_DEFINE_INTERFACE (IdeTarget, ide_target, IDE_TYPE_OBJECT)
+
+static void
+ide_target_default_init (IdeTargetInterface *iface)
+{
+}
diff --git a/libide/ide-target.h b/libide/ide-target.h
index d72ea1c..f0f3dd6 100644
--- a/libide/ide-target.h
+++ b/libide/ide-target.h
@@ -19,13 +19,13 @@
 #ifndef IDE_TARGET_H
 #define IDE_TARGET_H
 
-#include <glib-object.h>
+#include "ide-object.h"
 
 G_BEGIN_DECLS
 
 #define IDE_TYPE_TARGET               (ide_target_get_type ())
-#define IDE_TARGET(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_TARGET, IdeTarget))
-#define IDE_IS_TARGET(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_TARGET))
+#define IDE_TARGET(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj),    IDE_TYPE_TARGET, IdeTarget))
+#define IDE_IS_TARGET(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj),    IDE_TYPE_TARGET))
 #define IDE_TARGET_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), IDE_TYPE_TARGET, 
IdeTargetInterface))
 
 struct _IdeTargetInterface
diff --git a/libide/ide-test-case.c b/libide/ide-test-case.c
new file mode 100644
index 0000000..d7ed4a8
--- /dev/null
+++ b/libide/ide-test-case.c
@@ -0,0 +1,26 @@
+/* ide-test-case.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-test-case.h"
+
+G_DEFINE_INTERFACE (IdeTestCase, ide_test_case, IDE_TYPE_OBJECT)
+
+static void
+ide_test_case_default_init (IdeTestCaseInterface *iface)
+{
+}
diff --git a/libide/ide-test-suite.c b/libide/ide-test-suite.c
new file mode 100644
index 0000000..21a6b90
--- /dev/null
+++ b/libide/ide-test-suite.c
@@ -0,0 +1,26 @@
+/* ide-test-suite.c
+ *
+ * Copyright (C) 2015 Christian Hergert <christian hergert me>
+ *
+ * This file is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This file 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
+ * Lesser 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 "ide-test-suite.h"
+
+G_DEFINE_INTERFACE (IdeTestSuite, ide_test_suite, IDE_TYPE_OBJECT)
+
+static void
+ide_test_suite_default_init (IdeTestSuiteInterface *iface)
+{
+}
diff --git a/libide/ide-test-suite.h b/libide/ide-test-suite.h
index 59a097d..6593861 100644
--- a/libide/ide-test-suite.h
+++ b/libide/ide-test-suite.h
@@ -24,8 +24,8 @@
 G_BEGIN_DECLS
 
 #define IDE_TYPE_TEST_SUITE               (ide_test_suite_get_type ())
-#define IDE_TEST_SUITE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDE_TYPE_TEST_SUITE, 
IdeTestSuite))
-#define IDE_IS_TEST_SUITE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDE_TYPE_TEST_SUITE))
+#define IDE_TEST_SUITE(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj),    IDE_TYPE_TEST_SUITE, 
IdeTestSuite))
+#define IDE_IS_TEST_SUITE(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj),    IDE_TYPE_TEST_SUITE))
 #define IDE_TEST_SUITE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), IDE_TYPE_TEST_SUITE, 
IdeTestSuiteInterface))
 
 struct _IdeTestSuiteInterface
diff --git a/libide/ide-types.h b/libide/ide-types.h
index 10f01c1..cf16c93 100644
--- a/libide/ide-types.h
+++ b/libide/ide-types.h
@@ -92,6 +92,8 @@ typedef struct _IdeRefactoryInterface          IdeRefactoryInterface;
 
 typedef struct _IdeScript                      IdeScript;
 
+typedef struct _IdeSearchContext               IdeSearchContext;
+
 typedef struct _IdeSearchEngine                IdeSearchEngine;
 
 typedef struct _IdeSearchProvider              IdeSearchProvider;
diff --git a/libide/ide-unsaved-file.c b/libide/ide-unsaved-file.c
index faa8eef..b2c34cd 100644
--- a/libide/ide-unsaved-file.c
+++ b/libide/ide-unsaved-file.c
@@ -89,6 +89,13 @@ ide_unsaved_file_get_content (IdeUnsavedFile *self)
   return self->content;
 }
 
+/**
+ * ide_unsaved_file_get_file:
+ *
+ * Retrieves the underlying file represented by @self.
+ *
+ * Returns: (transfer none): A #GFile.
+ */
 GFile *
 ide_unsaved_file_get_file (IdeUnsavedFile *self)
 {
diff --git a/libide/ide.h b/libide/ide.h
index 48ee256..78ec003 100644
--- a/libide/ide.h
+++ b/libide/ide.h
@@ -55,6 +55,7 @@ G_BEGIN_DECLS
 #include "ide-project-item.h"
 #include "ide-refactory.h"
 #include "ide-script.h"
+#include "ide-search-context.h"
 #include "ide-search-engine.h"
 #include "ide-search-provider.h"
 #include "ide-search-result.h"



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