show notification when other people update
This commit is contained in:
parent
0c44a7889d
commit
a364bba47f
|
@ -211,6 +211,7 @@ public class Repository {
|
||||||
Process.StartInfo.RedirectStandardOutput = true;
|
Process.StartInfo.RedirectStandardOutput = true;
|
||||||
Process.StartInfo.UseShellExecute = false;
|
Process.StartInfo.UseShellExecute = false;
|
||||||
|
|
||||||
|
// Get user.name, example: "/home/user/Collaboration/"
|
||||||
RepoPath = Path;
|
RepoPath = Path;
|
||||||
Process.StartInfo.WorkingDirectory = RepoPath;
|
Process.StartInfo.WorkingDirectory = RepoPath;
|
||||||
|
|
||||||
|
@ -259,8 +260,6 @@ public class Repository {
|
||||||
Watcher.Created += new FileSystemEventHandler(OnFileActivity);
|
Watcher.Created += new FileSystemEventHandler(OnFileActivity);
|
||||||
Watcher.Deleted += new FileSystemEventHandler(OnFileActivity);
|
Watcher.Deleted += new FileSystemEventHandler(OnFileActivity);
|
||||||
|
|
||||||
|
|
||||||
// Call Fetch () every 30 seconds
|
|
||||||
BufferTimer = new Timer ();
|
BufferTimer = new Timer ();
|
||||||
|
|
||||||
// TODO: uncomment when status checking is implemented
|
// TODO: uncomment when status checking is implemented
|
||||||
|
@ -269,14 +268,17 @@ public class Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartBufferTimer () {
|
public void StartBufferTimer () {
|
||||||
|
|
||||||
int Interval = 3000;
|
int Interval = 3000;
|
||||||
if (!BufferTimer.Enabled) {
|
if (!BufferTimer.Enabled) {
|
||||||
|
|
||||||
// Delay for a few seconds to see if more files change
|
// Delay for a few seconds to see if more files change
|
||||||
BufferTimer.Interval = Interval;
|
BufferTimer.Interval = Interval;
|
||||||
BufferTimer.Elapsed += delegate (object o, ElapsedEventArgs args) { Add (); } ;
|
BufferTimer.Elapsed += delegate (object o, ElapsedEventArgs args) { Add (); } ;
|
||||||
Console.WriteLine ("[Buffer] Waiting for more changes...");
|
Console.WriteLine ("[Buffer] Waiting for more changes...");
|
||||||
BufferTimer.Start();
|
BufferTimer.Start();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Extend the delay when something changes
|
// Extend the delay when something changes
|
||||||
BufferTimer.Close ();
|
BufferTimer.Close ();
|
||||||
BufferTimer = new Timer ();
|
BufferTimer = new Timer ();
|
||||||
|
@ -299,7 +301,11 @@ public class Repository {
|
||||||
Process.StartInfo.FileName = "git";
|
Process.StartInfo.FileName = "git";
|
||||||
Process.StartInfo.Arguments = "clone " + RemoteOriginUrl;
|
Process.StartInfo.Arguments = "clone " + RemoteOriginUrl;
|
||||||
Process.Start();
|
Process.Start();
|
||||||
// TODO: Add a gitignore file for *~
|
|
||||||
|
// Add a gitignore file
|
||||||
|
Process.StartInfo.FileName = "/bin/sh";
|
||||||
|
Process.StartInfo.Arguments = "echo \"*~\" >> " + RepoPath + "/.gitignore";
|
||||||
|
Process.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add () {
|
public void Add () {
|
||||||
|
@ -309,11 +315,21 @@ public class Repository {
|
||||||
Process.StartInfo.FileName = "git";
|
Process.StartInfo.FileName = "git";
|
||||||
Process.StartInfo.Arguments = "add --all";
|
Process.StartInfo.Arguments = "add --all";
|
||||||
Process.Start();
|
Process.Start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: Format the commit message here
|
// TODO: Format the commit message here
|
||||||
// Format: list-add In 'GNOME3', Hylke Bons added 'widgets.svg' and 3 more.
|
// Format: list-add In 'GNOME3', Hylke Bons added 'widgets.svg' and 3 more.
|
||||||
// Format: pencil In 'GNOME3', Hylke Bons changed 'widgets.svg' and 2 more.
|
// Format: pencil In 'GNOME3', Hylke Bons changed 'widgets.svg' and 2 more.
|
||||||
// Format: pencil In 'GNOME3', Hylke Bons renamed 'widgets.svg' to 'gnome.svg'.
|
// Format: edit-redo 'GNOME3', Hylke Bons renamed 'widgets.svg' to 'gnome.svg'.
|
||||||
// Format: edit-redo 'GNOME3', Hylke Bons moved 'widgets.svg' to 'gnome.svg'.
|
|
||||||
// Format: list-remove In 'GNOME3', Hylke Bons deleted 'widgets.svg'.
|
// Format: list-remove In 'GNOME3', Hylke Bons deleted 'widgets.svg'.
|
||||||
Commit ("Stuff happened");
|
Commit ("Stuff happened");
|
||||||
}
|
}
|
||||||
|
@ -322,7 +338,6 @@ public class Repository {
|
||||||
Console.WriteLine ("[Git] Commiting changes...");
|
Console.WriteLine ("[Git] Commiting changes...");
|
||||||
Process.StartInfo.FileName = "git";
|
Process.StartInfo.FileName = "git";
|
||||||
Process.StartInfo.Arguments = "commit -m '" + Message + "'";
|
Process.StartInfo.Arguments = "commit -m '" + Message + "'";
|
||||||
ShowNotification ("Stuff happened", "");
|
|
||||||
Process.Start();
|
Process.Start();
|
||||||
Fetch ();
|
Fetch ();
|
||||||
Push ();
|
Push ();
|
||||||
|
@ -338,6 +353,7 @@ public class Repository {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Fetch (object o, ElapsedEventArgs args) {
|
public void Fetch (object o, ElapsedEventArgs args) {
|
||||||
|
// TODO: What happens when network disconnects during a fetch
|
||||||
// TODO: change status icon to sync
|
// TODO: change status icon to sync
|
||||||
Console.WriteLine ("[Git] Fetching changes...");
|
Console.WriteLine ("[Git] Fetching changes...");
|
||||||
Process.StartInfo.FileName = "git";
|
Process.StartInfo.FileName = "git";
|
||||||
|
@ -353,13 +369,18 @@ public class Repository {
|
||||||
Process.StartInfo.Arguments = "merge origin/master";
|
Process.StartInfo.Arguments = "merge origin/master";
|
||||||
Process.Start();
|
Process.Start();
|
||||||
Process.WaitForExit ();
|
Process.WaitForExit ();
|
||||||
// TODO: Notify user with the last fetched commit
|
|
||||||
|
Process.StartInfo.FileName = "git";
|
||||||
|
Process.StartInfo.Arguments = "log --pretty=oneline -1";
|
||||||
|
Process.Start();
|
||||||
|
string LastCommitMessage = Process.StandardOutput.ReadToEnd().Trim ().Substring (41);
|
||||||
|
ShowNotification (LastCommitMessage, "");
|
||||||
Watcher.EnableRaisingEvents = true;
|
Watcher.EnableRaisingEvents = true;
|
||||||
// TODO: change status icon to normal
|
// TODO: change status icon to normal
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Push () {
|
public void Push () {
|
||||||
// TODO: Ping first, then push
|
// TODO: What happens when network disconnects during a push
|
||||||
Process.StartInfo.FileName = "git";
|
Process.StartInfo.FileName = "git";
|
||||||
Process.StartInfo.Arguments = "push";
|
Process.StartInfo.Arguments = "push";
|
||||||
Process.Start();
|
Process.Start();
|
||||||
|
@ -380,8 +401,9 @@ public class Repository {
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetPeopleList [] () {
|
// TODO: To UI
|
||||||
|
public string [] GetPeopleList () {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can potentially be moved from this class as well
|
// Can potentially be moved from this class as well
|
||||||
|
@ -418,11 +440,16 @@ public class SparklePonyWindow : Window {
|
||||||
ListStore FoldersStore = new ListStore (typeof (Gdk.Pixbuf), typeof (string), typeof (string));
|
ListStore FoldersStore = new ListStore (typeof (Gdk.Pixbuf), typeof (string), typeof (string));
|
||||||
string RemoteFolderIcon = "/usr/share/icons/gnome/16x16/places/folder.png";
|
string RemoteFolderIcon = "/usr/share/icons/gnome/16x16/places/folder.png";
|
||||||
|
|
||||||
foreach (Repository Repository in Repositories)
|
TreeIter Iter2;
|
||||||
FoldersStore.AppendValues (new Gdk.Pixbuf (RemoteFolderIcon), Repository.Name);
|
|
||||||
|
foreach (Repository Repository in Repositories) {
|
||||||
|
Iter2 = FoldersStore.Prepend ();
|
||||||
|
FoldersStore.SetValue (Iter2, 1, null);
|
||||||
|
FoldersStore.SetValue (Iter2, 1, Repository.Name);
|
||||||
|
}
|
||||||
|
|
||||||
TreeView FoldersView = new TreeView (FoldersStore);
|
TreeView FoldersView = new TreeView (FoldersStore);
|
||||||
FoldersView.AppendColumn ("", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
|
FoldersView.AppendColumn ("", new CellRendererPixbuf () , "pixbuf", 0);
|
||||||
FoldersView.AppendColumn ("", new Gtk.CellRendererText (), "text", 1);
|
FoldersView.AppendColumn ("", new Gtk.CellRendererText (), "text", 1);
|
||||||
|
|
||||||
HBox AddRemoveButtons = new HBox ();
|
HBox AddRemoveButtons = new HBox ();
|
||||||
|
|
|
@ -28,6 +28,30 @@ if [[ "$1" == "stop" ]]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$1" == "restart" ]]; then
|
||||||
|
if [ -e "/tmp/sparklepony/sparklepony.pid" ]; then
|
||||||
|
echo -n "Stopping SparklePony..."
|
||||||
|
kill `cat /tmp/sparklepony/sparklepony.pid`
|
||||||
|
rm -f /tmp/sparklepony/sparklepony.pid
|
||||||
|
echo " Done."
|
||||||
|
else
|
||||||
|
echo "SparklePony isn't running."
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e "/tmp/sparklepony/sparklepony.pid" ]; then
|
||||||
|
echo "SparklePony is already running."
|
||||||
|
else
|
||||||
|
echo -n "Starting SparklePony..."
|
||||||
|
|
||||||
|
# Start SparklePony in the background and save the pid
|
||||||
|
mono /usr/local/share/sparklepony/SparklePony.exe $2 &
|
||||||
|
PID=$!
|
||||||
|
echo $PID > /tmp/sparklepony/sparklepony.pid
|
||||||
|
echo " Done."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ "$1" == "--help" ]]; then
|
if [[ "$1" == "--help" ]]; then
|
||||||
mono /usr/local/share/sparklepony/SparklePony.exe --help
|
mono /usr/local/share/sparklepony/SparklePony.exe --help
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue