[gitg] Add standalone mode



commit f06e5b4fd89b7ca944c6578a981294b107063271
Author: Alberto Fanjul <albertofanjul gmail com>
Date:   Sun Oct 14 20:12:45 2018 +0200

    Add standalone mode

 gitg/gitg-application.vala |  9 +++++++++
 test.vala                  | 15 +++++++++++++++
 2 files changed, 24 insertions(+)
---
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index 9487dc14..85f33988 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -42,6 +42,7 @@ public class Application : Gtk.Application
                public static bool quit = false;
                public static string activity;
                public static bool no_wd = false;
+               public static bool standalone = false;
 
                public static ApplicationCommandLine command_line;
 
@@ -64,6 +65,9 @@ public class Application : Gtk.Application
                        {"no-wd", 0, 0, OptionArg.NONE,
                         ref no_wd, N_("Do not try to load a repository from the current working directory"), 
null},
 
+                       {"standalone", 0, 0, OptionArg.NONE,
+                        ref standalone, N_("Run gitg in standalone mode"), null},
+
                        {null}
                };
        }
@@ -148,6 +152,11 @@ public class Application : Gtk.Application
                        return true;
                }
 
+               if (Options.standalone)
+               {
+                       set_flags(get_flags() | ApplicationFlags.NON_UNIQUE);
+               }
+
                if (Options.quit)
                {
                        exit_status = 0;
diff --git a/test.vala b/test.vala
new file mode 100755
index 00000000..99b7166a
--- /dev/null
+++ b/test.vala
@@ -0,0 +1,15 @@
+#!/usr/bin/env vala
+message ("hello world!");
+
+Regex regexp = new Regex(".*(?:\\s|\\R)*(?P<message>(?:.|\\R)*?)\\s*$");
+
+
+var m = "hello world\r\n  Riti toti.\r\nasdf adfa      \r\n   a    \r\n            ";
+MatchInfo minfo;
+
+if (regexp.match(m, 0, out minfo))
+{
+   var mes = minfo.fetch_named("message");
+   message(":"+mes+":");
+}
+


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