3 public class AppSettings : Object
6 // options - used when builder is run as a compiler
7 // we have to spawn ourself as a compiler as just running libvala
8 // as a task to check syntax causes memory leakage..
10 const OptionEntry[] options = {
13 { "project", 0, 0, OptionArg.STRING, ref opt_compile_project, "Compile a project", null },
14 { "target", 0, 0, OptionArg.STRING, ref opt_compile_target, "Target to build", null },
15 { "skip-file", 0, 0, OptionArg.STRING, ref opt_compile_skip "For test compiles do not add this (usually used in conjunction with add-file ", null },
16 { "add-file", 0, 0, OptionArg.STRING, ref opt_compile_add, "Add this file to compile list", null },
19 string opt_compile_project;
20 string opt_compile_target;
21 string opt_compile_skip;
22 string opt_compile_add;
25 // what are we going to have as settings?
26 public string roo_html_dir { get; set; }
30 this.notify.connect(() => {
35 public static AppSettings factory()
38 var setting_file = BuilderApplication.configDirectory() + "/builder.settings";
40 if (!FileUtils.test(setting_file, FileTest.EXISTS)) {
41 return new AppSettings();
44 FileUtils.get_contents(setting_file, out data);
45 return Json.gobject_from_data (typeof (AppSettings), data) as AppSettings;
49 var dirname = GLib.Environment.get_home_dir() + "/.Builder";
50 var setting_file = dirname + "/builder.settings";
51 string data = Json.gobject_to_data (this, null);
52 print("saving application settings\n");
53 FileUtils.set_contents(setting_file, data);
60 public static BuilderApplication application = null;
62 public class BuilderApplication : Gtk.Application
71 public const Gtk.TargetEntry[] targetList = {
72 { "INTEGER", 0, Target.INT32 },
73 { "STRING", 0, Target.STRING },
74 { "application/json", 0, Target.STRING },
75 { "text/plain", 0, Target.STRING },
76 { "application/x-rootwindow-drop", 0, Target.ROOTWIN }
78 public AppSettings settings = null;
81 public BuilderApplication ()
84 application_id: "org.roojs.app-builder",
85 flags: ApplicationFlags.FLAGS_NONE
89 this.settings = AppSettings.factory();
96 public static BuilderApplication singleton()
98 if (application==null) {
99 application = new BuilderApplication();
107 public static string configDirectory()
109 var dirname = GLib.Environment.get_home_dir() + "/.Builder";
111 if (!FileUtils.test(dirname,FileTest.IS_DIR)) {
112 var dir = File.new_for_path(dirname);
113 dir.make_directory();
115 if (!FileUtils.test(dirname + "/resources",FileTest.IS_DIR)) {
116 var dir = File.new_for_path(dirname + "/resources");
117 dir.make_directory();