[gedit/wip/gtkapp: 195/197] Add support for stdin



commit 9a72592e9691de6c0a605c244c23b6030cdfed23
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Tue Jul 31 17:21:50 2012 +0200

    Add support for stdin

 gedit/gedit-app.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 6cd6b6d..9a351a7 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -38,6 +38,7 @@
 #include <locale.h>
 
 #include <glib/gi18n.h>
+#include <glib.h>
 #include <libpeas/peas-extension-set.h>
 #include <gtksourceview/gtksourcestyleschememanager.h>
 
@@ -114,6 +115,7 @@ static gboolean background = FALSE;
 static gboolean standalone = FALSE;
 static gchar **remaining_args = NULL;
 static const GeditEncoding *encoding = NULL;
+static GInputStream *stdin_stream = NULL;
 
 static const GOptionEntry options[] =
 {
@@ -561,6 +563,16 @@ gedit_app_activate (GApplication *application)
 		g_slist_free (loaded);
 	}
 
+	if (stdin_stream)
+	{
+		doc_created = gedit_window_create_tab_from_stream (window,
+		                                                   stdin_stream,
+		                                                   encoding,
+		                                                   line_position,
+		                                                   column_position,
+		                                                   TRUE) != NULL;
+	}
+
 	if (!doc_created || new_document)
 	{
 		gedit_debug_message (DEBUG_APP, "Create tab");
@@ -647,6 +659,8 @@ gedit_app_command_line (GApplication            *application,
 			g_free (encoding_charset);
 		}
 
+		stdin_stream = g_application_command_line_get_stdin (command_line);
+
 		gedit_app_activate (application);
 	}
 



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