[repo] Add an error state icon and [repo] don't commit empty change sets
This commit is contained in:
parent
343daaa614
commit
5ca135f3f6
|
@ -56,6 +56,7 @@ namespace SparkleLib {
|
||||||
public delegate void NewCommitEventHandler (object o, NewCommitArgs args);
|
public delegate void NewCommitEventHandler (object o, NewCommitArgs args);
|
||||||
public delegate void ConflictDetectedEventHandler (object o, SparkleEventArgs args);
|
public delegate void ConflictDetectedEventHandler (object o, SparkleEventArgs args);
|
||||||
public delegate void ChangesDetectedEventHandler (object o, SparkleEventArgs args);
|
public delegate void ChangesDetectedEventHandler (object o, SparkleEventArgs args);
|
||||||
|
public delegate void CommitEndedUpEmptyEventHandler (object o, SparkleEventArgs args);
|
||||||
|
|
||||||
public event AddedEventHandler Added;
|
public event AddedEventHandler Added;
|
||||||
public event CommitedEventHandler Commited;
|
public event CommitedEventHandler Commited;
|
||||||
|
@ -67,6 +68,7 @@ namespace SparkleLib {
|
||||||
public event NewCommitEventHandler NewCommit;
|
public event NewCommitEventHandler NewCommit;
|
||||||
public event ConflictDetectedEventHandler ConflictDetected;
|
public event ConflictDetectedEventHandler ConflictDetected;
|
||||||
public event ChangesDetectedEventHandler ChangesDetected;
|
public event ChangesDetectedEventHandler ChangesDetected;
|
||||||
|
public event CommitEndedUpEmptyEventHandler CommitEndedUpEmpty;
|
||||||
|
|
||||||
|
|
||||||
public SparkleRepo (string path)
|
public SparkleRepo (string path)
|
||||||
|
@ -198,9 +200,12 @@ namespace SparkleLib {
|
||||||
TimeSpan changed = new TimeSpan (now.Ticks - LastChange.Ticks);
|
TimeSpan changed = new TimeSpan (now.Ticks - LastChange.Ticks);
|
||||||
|
|
||||||
if (changed.TotalMilliseconds > 5000) {
|
if (changed.TotalMilliseconds > 5000) {
|
||||||
HasChanged = false;
|
|
||||||
SparkleHelpers.DebugInfo ("Local", "[" + Name + "] Changes have settled, adding files...");
|
SparkleHelpers.DebugInfo ("Local", "[" + Name + "] Changes have settled, adding files...");
|
||||||
|
|
||||||
|
HasChanged = false;
|
||||||
AddCommitAndPush ();
|
AddCommitAndPush ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -223,7 +228,7 @@ namespace SparkleLib {
|
||||||
if (!HasChanged) {
|
if (!HasChanged) {
|
||||||
|
|
||||||
SparkleEventArgs args = new SparkleEventArgs ("ChangesDetected");
|
SparkleEventArgs args = new SparkleEventArgs ("ChangesDetected");
|
||||||
Console.WriteLine ("test");
|
|
||||||
if (ChangesDetected != null)
|
if (ChangesDetected != null)
|
||||||
ChangesDetected (this, args);
|
ChangesDetected (this, args);
|
||||||
|
|
||||||
|
@ -245,7 +250,7 @@ Console.WriteLine ("test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// When there are changes we generally want to Add, Commit and Push
|
// When there are changes we generally want to Add, Commit and Push,
|
||||||
// so this method does them all with appropriate timers, etc. switched off
|
// so this method does them all with appropriate timers, etc. switched off
|
||||||
public void AddCommitAndPush ()
|
public void AddCommitAndPush ()
|
||||||
{
|
{
|
||||||
|
@ -265,6 +270,13 @@ Console.WriteLine ("test");
|
||||||
CheckForRemoteChanges ();
|
CheckForRemoteChanges ();
|
||||||
Push ();
|
Push ();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
SparkleEventArgs args = new SparkleEventArgs ("CommitEndedUpEmpty");
|
||||||
|
|
||||||
|
if (CommitEndedUpEmpty != null)
|
||||||
|
CommitEndedUpEmpty (this, args);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
@ -329,6 +329,14 @@ namespace SparkleShare {
|
||||||
|
|
||||||
|
|
||||||
public void ShowState ()
|
public void ShowState ()
|
||||||
|
{
|
||||||
|
|
||||||
|
ShowState (false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ShowState (bool error)
|
||||||
{
|
{
|
||||||
|
|
||||||
UpdateFolderSize ();
|
UpdateFolderSize ();
|
||||||
|
@ -339,11 +347,19 @@ namespace SparkleShare {
|
||||||
if (SyncingReposCount > SparkleUI.Repositories.Count)
|
if (SyncingReposCount > SparkleUI.Repositories.Count)
|
||||||
SyncingReposCount = SparkleUI.Repositories.Count;
|
SyncingReposCount = SparkleUI.Repositories.Count;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
|
||||||
|
SetErrorState ();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
if (SyncingReposCount > 0)
|
if (SyncingReposCount > 0)
|
||||||
SetSyncingState ();
|
SetSyncingState ();
|
||||||
else
|
else
|
||||||
SetIdleState ();
|
SetIdleState ();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
UpdateStatusMenuItem ();
|
UpdateStatusMenuItem ();
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Status", "Number of repos syncing: " + SyncingReposCount);
|
SparkleHelpers.DebugInfo ("Status", "Number of repos syncing: " + SyncingReposCount);
|
||||||
|
@ -374,15 +390,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
|
|
||||||
// Changes the state to indicate there was an error syncing
|
// Changes the state to indicate there was an error syncing
|
||||||
public void ShowErrorState ()
|
public void SetErrorState ()
|
||||||
{
|
{
|
||||||
|
|
||||||
Pixbuf = SparkleHelpers.GetIcon ("image-missing", 24);
|
Timer.Stop ();
|
||||||
StateText = _("Failed to sync your changes");
|
Application.Invoke (delegate { Pixbuf = SparkleHelpers.GetIcon ("sparkleshare-syncing-error", 24); });
|
||||||
|
StateText = _("Failed to sync changes");
|
||||||
UpdateStatusMenuItem ();
|
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Status", "Number of repos syncing: " + SyncingReposCount);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -359,7 +359,7 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
|
|
||||||
NotificationIcon.SyncingReposCount--;
|
NotificationIcon.SyncingReposCount--;
|
||||||
NotificationIcon.ShowErrorState ();
|
NotificationIcon.ShowState (true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,6 +410,10 @@ namespace SparkleShare {
|
||||||
Application.Invoke (UpdateStatusIconToIdle);
|
Application.Invoke (UpdateStatusIconToIdle);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
repo.CommitEndedUpEmpty += delegate {
|
||||||
|
Application.Invoke (UpdateStatusIconToIdle);
|
||||||
|
};
|
||||||
|
|
||||||
repo.PushingFailed += delegate {
|
repo.PushingFailed += delegate {
|
||||||
Application.Invoke (UpdateStatusIconToError);
|
Application.Invoke (UpdateStatusIconToError);
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,7 @@ app_theme_icons = \
|
||||||
places,folder-sparkleshare-256.png \
|
places,folder-sparkleshare-256.png \
|
||||||
places,folder-sparkleshare-32.png \
|
places,folder-sparkleshare-32.png \
|
||||||
places,folder-sparkleshare-48.png \
|
places,folder-sparkleshare-48.png \
|
||||||
|
status,sparkleshare-syncing-error-24.png \
|
||||||
status,avatar-default-16.png \
|
status,avatar-default-16.png \
|
||||||
status,avatar-default-22.png \
|
status,avatar-default-22.png \
|
||||||
status,avatar-default-24.png \
|
status,avatar-default-24.png \
|
||||||
|
|
BIN
data/icons/sparkleshare-syncing-error-24.png
Normal file
BIN
data/icons/sparkleshare-syncing-error-24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 844 KiB After Width: | Height: | Size: 868 KiB |
Loading…
Reference in a new issue