[gnome-builder] vte: make VTE in core optional



commit df25b57a5234a83a443c56d39e42ab08d8fa6331
Author: Christian Hergert <christian hergert me>
Date:   Tue Sep 1 00:45:44 2015 -0700

    vte: make VTE in core optional
    
    We currently still use VTE in the gnome-builder process to
    get access to the users preferred shell.
    
    This let’s us make that optional. What we should do, is move
    this to the terminal plugin. But that requires more plumbing.

 configure.ac                               |   11 +++++++++++
 src/Makefile.am                            |    5 +++++
 src/project-tree/gb-project-tree-actions.c |   26 ++++++++++++++++++--------
 3 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 29bd26f..43f056e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -166,6 +166,9 @@ PKG_CHECK_MODULES(BUILDER,  [gtk+-3.0 >= gtk_required_version
                              libgit2-glib-1.0 >= ggit_required_version
                              libpeas-1.0 >= peas_required_version
                             vte-2.91 >= vte_required_version])
+PKG_CHECK_MODULES(VTE,      [vte-2.91 >= vte_required_version],
+                            [have_vte=yes],
+                            [have_vte=no])
 PKG_CHECK_MODULES(EGG,      [glib-2.0 >= glib_required_version
                              gtk+-3.0 >= gtk_required_version])
 PKG_CHECK_MODULES(GD,       [gtk+-3.0 >= gtk_required_version])
@@ -253,6 +256,14 @@ CPPFLAGS=${CPPFLAGS_SAVE}
 
 
 dnl ***********************************************************************
+dnl Additional VTE support in Builder core
+dnl ***********************************************************************
+# FIXME: If we make adding menu items accessable from plugins, then
+#        we don't need this hack.
+AM_CONDITIONAL(HAVE_VTE, test x$have_vte != xno)
+
+
+dnl ***********************************************************************
 dnl Check for Required Python
 dnl ***********************************************************************
 enable_python_scripting=no
diff --git a/src/Makefile.am b/src/Makefile.am
index d1bb5e0..0b326b7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -247,6 +247,11 @@ libgnome_builder_la_CFLAGS = \
        $(NULL)
 
 
+if HAVE_VTE
+libgnome_builder_la_CFLAGS += -DHAVE_VTE
+endif
+
+
 gnome_builder_SOURCES = main.c
 gnome_builder_CFLAGS = $(libgnome_builder_la_CFLAGS)
 gnome_builder_LDADD = \
diff --git a/src/project-tree/gb-project-tree-actions.c b/src/project-tree/gb-project-tree-actions.c
index 173fc2b..1d57cde 100644
--- a/src/project-tree/gb-project-tree-actions.c
+++ b/src/project-tree/gb-project-tree-actions.c
@@ -20,7 +20,10 @@
 
 #include <glib/gi18n.h>
 #include <gio/gdesktopappinfo.h>
-#include <vte/vte.h>
+
+#ifdef HAVE_VTE
+# include <vte/vte.h>
+#endif
 
 #include "gb-file-manager.h"
 #include "gb-new-file-popover.h"
@@ -283,7 +286,6 @@ gb_project_tree_actions_open_in_terminal (GSimpleAction *action,
   GFile *file;
   g_autofree gchar *workdir = NULL;
   g_autofree gchar *terminal_executable = NULL;
-  g_autofree gchar *shell = NULL;
   const gchar *argv[] = { NULL, NULL };
   g_auto(GStrv) env = NULL;
   GError *error = NULL;
@@ -319,12 +321,20 @@ gb_project_tree_actions_open_in_terminal (GSimpleAction *action,
   argv[0] = terminal_executable;
   g_return_if_fail (terminal_executable != NULL);
 
-  /*
-   * Overwrite SHELL to the users default shell.
-   * Failure to do so typically results in /bin/sh being used.
-   */
-  shell = vte_get_user_shell ();
-  g_setenv ("SHELL", shell, TRUE);
+#ifdef HAVE_VTE
+  {
+    /*
+     * Overwrite SHELL to the users default shell.
+     * Failure to do so typically results in /bin/sh being used.
+     */
+    gchar *shell;
+
+    shell = vte_get_user_shell ();
+    g_setenv ("SHELL", shell, TRUE);
+    g_free (shell);
+  }
+#endif
+
   env = g_get_environ ();
 
   /* Can't use GdkAppLaunchContext as


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