gitlive.js
[gitlive] / gitlive.js
1 #!/usr/bin/seed
2 ///<script type="text/javascript">
3 /**
4 * Git Live
5
6 * inotify hooks for ~/gitlive
7 * that commit and push any changes made.
8 * Bit like a revision controled backed up file system!?
9
10
11 */
12
13 GIRepository      = imports.gi.GIRepository
14 GLib        = imports.gi.GLib;
15
16 //print(JSON.stringify(GI, null,4));
17 // we add this in, as it appears to get lost sometimes if we set it using the ENV. variable in builder.sh
18 //GI.Repository.prepend_search_path(GLib.get_home_dir() + '/.Builder/girepository-1.1');
19 GIRepository.Repository.prepend_search_path(GLib.get_home_dir() + '/.Builder/girepository-1.2');
20
21 var Gio      = imports.gi.Gio;
22 var Gtk      = imports.gi.Gtk;
23 var Notify = imports.gi.Notify;
24
25 var Spawn = imports.Spawn;
26 var StatusIcon = imports.StatusIcon.StatusIcon;
27 var Monitor = imports.Monitor.Monitor;
28
29
30 //File = imports[__script_path__+'/../introspection-doc-generator/File.js'].File
31 Gtk.init (null, null);
32
33 // sanity check...
34
35 var gitlive = GLib.get_home_dir() + "/gitlive";
36
37 if (!GLib.file_test(gitlive, GLib.FileTest.IS_DIR)) {
38     var msg = new Gtk.MessageDialog({message_type:
39         Gtk.MessageType.INFO, buttons : Gtk.ButtonsType.OK, text: "GIT Live - ~/gitlive does not exist."});
40     msg.run();
41     msg.destroy();
42     
43     Seed.quit();
44 }
45
46  
47 // I'm lost...
48
49 function errorDialog(data) {
50     var msg = new Gtk.MessageDialog({
51             message_type: Gtk.MessageType.ERROR, 
52             buttons : Gtk.ButtonsType.OK, 
53             text: data
54     });
55     msg.run();
56     msg.destroy();
57 }
58
59  
60
61
62
63 //
64 // need a better icon...
65
66
67 StatusIcon.init();   
68
69
70 Notify.init("gitlive");
71
72 imports.GitMonitor.GitMonitor.add(GLib.get_home_dir() + "/gitlive");
73 imports.GitMonitor.GitMonitor.start();
74
75 Gtk.main();
76 //icon.signal["activate"].connect(on_left_click);
77