[vte] app: Add multi-window mode



commit bea04b972649524c06dcf57e5c77a87de50edfa5
Author: Christian Persch <chpe gnome org>
Date:   Mon Dec 7 22:51:08 2015 +0100

    app: Add multi-window mode

 src/app.vala |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index d08e563..516623a 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -762,8 +762,6 @@ class Window : Gtk.ApplicationWindow
 
 class App : Gtk.Application
 {
-  private Window window;
-
   public App()
   {
     Object(application_id: "org.gnome.Vte.Test.App",
@@ -780,14 +778,18 @@ class App : Gtk.Application
   {
     base.startup();
 
-    window = new Window(this);
-    window.launch();
+    for (uint i = 0; i < App.Options.n_windows; i++)
+      new Window(this);
   }
 
   protected override void activate()
   {
-    window.apply_geometry();
-    window.present();
+    foreach (Gtk.Window win in this.get_windows()) {
+      var window = win as Window;
+      window.apply_geometry();
+      window.present();
+      window.launch();
+    }
   }
 
   public struct Options
@@ -823,6 +825,7 @@ class App : Gtk.Application
     public static int scrollback_lines = 512;
     public static int transparency_percent = 0;
     public static bool version = false;
+    public static int n_windows = 1;
     public static string? word_char_exceptions = null;
     public static string? working_directory = null;
 
@@ -1014,6 +1017,8 @@ class App : Gtk.Application
         "Enable the use of a transparent background", "0..100" },
       { "version", 0, 0, OptionArg.NONE, ref version,
         "Show version", null },
+      { "windows", 0, 0, OptionArg.INT, ref n_windows,
+        "Open multiple windows (default: 1)", "NUMBER" },
       { "word-char-exceptions", 0, 0, OptionArg.STRING, ref word_char_exceptions,
         "Specify the word char exceptions", "CHARS" },
       { "working-directory", 'w', 0, OptionArg.FILENAME, ref working_directory,


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