Final User interface tweaks to basic commit code (shows dialogs while it does stuff)
[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 // 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
30
31 Gtk.init (null, null);
32
33 // sanity check...
34
35 // where is everything..
36 GitMonitor.gitlive =  GLib.get_home_dir() + "/gitlive";
37
38 if (!GLib.file_test(GitMonitor.gitlive, GLib.FileTest.IS_DIR)) {
39     var msg = new Gtk.MessageDialog({message_type:
40         Gtk.MessageType.INFO, buttons : Gtk.ButtonsType.OK, text: "GIT Live - ~/gitlive does not exist."});
41     msg.run();
42     msg.destroy();
43     Seed.quit();
44 }
45
46 // I'm lost...
47
48 function errorDialog(data) {
49     var msg = new Gtk.MessageDialog({
50             message_type: Gtk.MessageType.ERROR, 
51             buttons : Gtk.ButtonsType.OK, 
52             text: data
53     });
54     msg.run();
55     msg.destroy();
56 }
57
58  
59
60 //
61 // need a better icon...
62
63
64 StatusIcon.init();   
65
66
67 Notify.init("gitlive");
68
69 GitMonitor.add(GitMonitor.gitlive);
70 GitMonitor.start();
71
72 Gtk.main();
73 vv//icon.signal["activate"].connect(on_left_click);
74