[gnome-builder] terminal: port terminal util to libide



commit 48e76504fa4e1841b60eb7aed34d301b9b2be5b7
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 21 22:35:29 2017 -0800

    terminal: port terminal util to libide
    
    This allows us to create PTY slaves from libide without needing
    to restrict ourselves to API craziness for plugins to provide
    the feature.

 src/libide/ide.h                                   |    1 +
 .../terminal/ide-terminal-util.c}                  |    8 ++++----
 .../terminal/ide-terminal-util.h}                  |    4 +++-
 src/libide/terminal/meson.build                    |    2 ++
 src/plugins/terminal/gb-terminal-view.c            |    3 +--
 src/plugins/terminal/gb-terminal-workbench-addin.c |    3 +--
 src/plugins/terminal/meson.build                   |    2 --
 7 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/src/libide/ide.h b/src/libide/ide.h
index 1970c2a..141ff58 100644
--- a/src/libide/ide.h
+++ b/src/libide/ide.h
@@ -174,6 +174,7 @@ G_BEGIN_DECLS
 #include "threading/ide-thread-pool.h"
 #include "terminal/ide-terminal.h"
 #include "terminal/ide-terminal-search.h"
+#include "terminal/ide-terminal-util.h"
 #include "transfers/ide-pkcon-transfer.h"
 #include "transfers/ide-transfer.h"
 #include "transfers/ide-transfer-button.h"
diff --git a/src/plugins/terminal/gb-terminal-util.c b/src/libide/terminal/ide-terminal-util.c
similarity index 90%
rename from src/plugins/terminal/gb-terminal-util.c
rename to src/libide/terminal/ide-terminal-util.c
index b57ea73..ac9a706 100644
--- a/src/plugins/terminal/gb-terminal-util.c
+++ b/src/libide/terminal/ide-terminal-util.c
@@ -1,4 +1,4 @@
-/* gb-terminal-util.c
+/* ide-terminal-util.c
  *
  * Copyright © 2016 Christian Hergert <chergert redhat com>
  *
@@ -16,7 +16,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#define G_LOG_DOMAIN "gb-terminal-util"
+#define G_LOG_DOMAIN "ide-terminal-util"
 
 #include "config.h"
 
@@ -24,10 +24,10 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include "gb-terminal-util.h"
+#include "terminal/ide-terminal-util.h"
 
 gint
-gb_vte_pty_create_slave (VtePty *pty)
+ide_vte_pty_create_slave (VtePty *pty)
 {
   gint master_fd;
 #ifdef HAVE_PTSNAME_R
diff --git a/src/plugins/terminal/gb-terminal-util.h b/src/libide/terminal/ide-terminal-util.h
similarity index 91%
rename from src/plugins/terminal/gb-terminal-util.h
rename to src/libide/terminal/ide-terminal-util.h
index 5931085..47fefdf 100644
--- a/src/plugins/terminal/gb-terminal-util.h
+++ b/src/libide/terminal/ide-terminal-util.h
@@ -20,8 +20,10 @@
 
 #include <vte/vte.h>
 
+#include "ide-version-macros.h"
+
 G_BEGIN_DECLS
 
-int gb_vte_pty_create_slave (VtePty *pty);
+int ide_vte_pty_create_slave (VtePty *pty);
 
 G_END_DECLS
diff --git a/src/libide/terminal/meson.build b/src/libide/terminal/meson.build
index 96ce4ad..fca092c 100644
--- a/src/libide/terminal/meson.build
+++ b/src/libide/terminal/meson.build
@@ -1,11 +1,13 @@
 terminal_headers = [
   'ide-terminal.h',
   'ide-terminal-search.h',
+  'ide-terminal-util.h',
 ]
 
 terminal_sources = [
   'ide-terminal.c',
   'ide-terminal-search.c',
+  'ide-terminal-util.c',
 ]
 
 libide_public_headers += files(terminal_headers)
diff --git a/src/plugins/terminal/gb-terminal-view.c b/src/plugins/terminal/gb-terminal-view.c
index ed3068f..3b13d88 100644
--- a/src/plugins/terminal/gb-terminal-view.c
+++ b/src/plugins/terminal/gb-terminal-view.c
@@ -29,7 +29,6 @@
 #include <vte/vte.h>
 #include <unistd.h>
 
-#include "gb-terminal-util.h"
 #include "gb-terminal-view.h"
 #include "gb-terminal-view-private.h"
 #include "gb-terminal-view-actions.h"
@@ -256,7 +255,7 @@ gb_terminal_respawn (GbTerminalView *self,
 
   vte_terminal_set_pty (terminal, pty);
 
-  if (-1 == (tty_fd = gb_vte_pty_create_slave (pty)))
+  if (-1 == (tty_fd = ide_vte_pty_create_slave (pty)))
     IDE_GOTO (failure);
 
   /* dup() is safe as it will inherit O_CLOEXEC */
diff --git a/src/plugins/terminal/gb-terminal-workbench-addin.c 
b/src/plugins/terminal/gb-terminal-workbench-addin.c
index 8d29465..23c681d 100644
--- a/src/plugins/terminal/gb-terminal-workbench-addin.c
+++ b/src/plugins/terminal/gb-terminal-workbench-addin.c
@@ -24,7 +24,6 @@
 #include <ide.h>
 #include <vte/vte.h>
 
-#include "gb-terminal-util.h"
 #include "gb-terminal-view.h"
 #include "gb-terminal-workbench-addin.h"
 
@@ -165,7 +164,7 @@ on_run_manager_run (GbTerminalWorkbenchAddin *self,
       gb_terminal_view_set_pty (self->run_terminal, pty);
     }
 
-  if (-1 != (tty_fd = gb_vte_pty_create_slave (pty)))
+  if (-1 != (tty_fd = ide_vte_pty_create_slave (pty)))
     {
       ide_runner_set_tty (runner, tty_fd);
       close (tty_fd);
diff --git a/src/plugins/terminal/meson.build b/src/plugins/terminal/meson.build
index 7bdceda..e697221 100644
--- a/src/plugins/terminal/meson.build
+++ b/src/plugins/terminal/meson.build
@@ -7,8 +7,6 @@ terminal_resources = gnome.compile_resources(
 terminal_sources = [
   'gb-terminal-plugin.c',
   'gb-terminal-private.h',
-  'gb-terminal-util.c',
-  'gb-terminal-util.h',
   'gb-terminal-view.c',
   'gb-terminal-view.h',
   'gb-terminal-view-private.h',


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