[gnome-builder] ctags: allow specifying path to ctags binary



commit fe35e8c3662e21cdd3b591925a712a97e5ff8557
Author: Christian Hergert <christian hergert me>
Date:   Sat May 16 21:02:45 2015 -0700

    ctags: allow specifying path to ctags binary

 .../org.gnome.builder.code-insight.gschema.xml     |    5 +++
 libide/ctags/ide-ctags-builder.c                   |   32 +++++++++++++++++++-
 2 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/data/gsettings/org.gnome.builder.code-insight.gschema.xml 
b/data/gsettings/org.gnome.builder.code-insight.gschema.xml
index 7f69aed..e55f671 100644
--- a/data/gsettings/org.gnome.builder.code-insight.gschema.xml
+++ b/data/gsettings/org.gnome.builder.code-insight.gschema.xml
@@ -20,5 +20,10 @@
       <summary>Enable semantic highlighting</summary>
       <description>If enabled, additional highlighting will be provided in supported languages based on 
information extracted from the source code.</description>
     </key>
+    <key name="ctags-path" type="s">
+      <default>'ctags'</default>
+      <summary>Path to ctags executable</summary>
+      <description>The path to the ctags executable on the system.</description>
+    </key>
   </schema>
 </schemalist>
diff --git a/libide/ctags/ide-ctags-builder.c b/libide/ctags/ide-ctags-builder.c
index e7fdeff..848d2ca 100644
--- a/libide/ctags/ide-ctags-builder.c
+++ b/libide/ctags/ide-ctags-builder.c
@@ -43,7 +43,11 @@ struct _IdeCtagsBuilder
   IdeObject  parent_instance;
 
   GSettings *settings;
+
+  GQuark     ctags_path;
+
   guint      build_timeout;
+
   guint      is_building : 1;
 };
 
@@ -182,7 +186,7 @@ ide_ctags_builder_build_worker (GTask        *task,
     g_unlink (tags_file);
 
   argv = g_ptr_array_new_with_free_func (g_free);
-  g_ptr_array_add (argv, g_strdup ("ctags"));
+  g_ptr_array_add (argv, g_strdup (g_quark_to_string (self->ctags_path)));
   g_ptr_array_add (argv, g_strdup ("-f"));
   g_ptr_array_add (argv, g_strdup ("-"));
   g_ptr_array_add (argv, g_strdup ("--recurse=yes"));
@@ -290,6 +294,21 @@ ide_ctags_builder__buffer_saved_cb (IdeCtagsBuilder  *self,
 }
 
 static void
+ide_ctags_builder__ctags_path_changed (IdeCtagsBuilder *self,
+                                       const gchar     *key,
+                                       GSettings       *settings)
+{
+  g_autofree gchar *ctags_path = NULL;
+
+  g_assert (IDE_IS_CTAGS_BUILDER (self));
+  g_assert (ide_str_equal0 (key, "ctags-path"));
+  g_assert (G_IS_SETTINGS (settings));
+
+  ctags_path = g_settings_get_string (settings, "ctags-path");
+  self->ctags_path = g_quark_from_string (ctags_path);
+}
+
+static void
 ide_ctags_builder_constructed (GObject *object)
 {
   IdeCtagsBuilder *self = (IdeCtagsBuilder *)object;
@@ -348,7 +367,18 @@ ide_ctags_builder_class_init (IdeCtagsBuilderClass *klass)
 static void
 ide_ctags_builder_init (IdeCtagsBuilder *self)
 {
+  g_autofree gchar *ctags_path = NULL;
+
   EGG_COUNTER_INC (instances);
 
   self->settings = g_settings_new ("org.gnome.builder.code-insight");
+
+  g_signal_connect_object (self->settings,
+                           "changed::ctags-path",
+                           G_CALLBACK (ide_ctags_builder__ctags_path_changed),
+                           self,
+                           G_CONNECT_SWAPPED);
+
+  ctags_path = g_settings_get_string (self->settings, "ctags-path");
+  self->ctags_path = g_quark_from_string (ctags_path);
 }


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