Add standalone mode

This commit is contained in:
Alberto Fanjul 2018-10-14 20:12:45 +02:00
parent 1c3a2c82e6
commit f06e5b4fd8
2 changed files with 24 additions and 0 deletions

View file

@ -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;

15
test.vala Executable file
View file

@ -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+":");
}