Fix #5560 - Gitlive - branching wip
[gitlive] / old_seed_version / 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 // see the install instructions on how to override the default gir's
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  
26 var StatusIcon  = imports.StatusIcon.StatusIcon;
27 var Monitor     = imports.Monitor.Monitor;
28 var GitMonitor  = imports.GitMonitor.GitMonitor;
29 var WindowLog  = imports.WindowLog.WindowLog;
30
31
32 Gtk.init (null, null);
33
34 // sanity check...
35
36 // where is everything..
37 GitMonitor.gitlive =  GLib.get_home_dir() + "/gitlive";
38
39 if (!GLib.file_test(GitMonitor.gitlive, GLib.FileTest.IS_DIR)) {
40     var msg = new Gtk.MessageDialog({message_type:
41         Gtk.MessageType.INFO, buttons : Gtk.ButtonsType.OK, text: "GIT Live - ~/gitlive does not exist."});
42     msg.run();
43     msg.destroy();
44     Seed.quit();
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 // need a better icon...
63
64
65 StatusIcon.init();   
66
67
68 Notify.init("gitlive");
69
70 GLib.timeout_add(GLib.PRIORITY_LOW, 500, function() {
71     // this should start after we have shown the icon...
72     GitMonitor.add(GitMonitor.gitlive);
73     GitMonitor.start();
74     
75     WindowLog.start();
76 });
77
78 Gtk.main();
79 //icon.signal["activate"].connect(on_left_click);
80