fix notifications in Add dialog and other places

This commit is contained in:
Hylke Bons 2010-06-01 20:58:08 +02:00
parent e32903efe0
commit aa3523c1aa
4 changed files with 72 additions and 54 deletions

View file

@ -23,13 +23,9 @@ namespace SparkleShare {
public class SparkleBubble : Notification { public class SparkleBubble : Notification {
public SparkleBubble (string Title, string Subtext) : base (Title, Subtext) { public SparkleBubble (string Title, string Subtext) : base (Title, Subtext) {
Timeout = 4500; Timeout = 4500;
Urgency = Urgency.Low; Urgency = Urgency.Low;
Show ();
IconName = "folder-sparkleshare"; IconName = "folder-sparkleshare";
// TODO: Doesn't work for some reason
AttachToStatusIcon (SparkleUI.NotificationIcon); AttachToStatusIcon (SparkleUI.NotificationIcon);
} }

View file

@ -119,9 +119,18 @@ namespace SparkleShare {
else else
RepoName = RepoRemoteUrl.Substring (ColumnPos + 1); RepoName = RepoRemoteUrl.Substring (ColumnPos + 1);
SparkleBubble SparkleBubble = SparkleBubble SyncingBubble =
new SparkleBubble (_("Syncing folder ") + RepoName + "", new SparkleBubble (_("Syncing folder ") + RepoName + "",
_("SparkleShare will notify you when this is done.")); _("SparkleShare will notify you ") +
_("when this is done."));
SyncingBubble.AddAction ("", _("Dismiss"),
delegate {
SyncingBubble.Close ();
}
);
SyncingBubble.Show ();
Process Process = new Process (); Process Process = new Process ();
Process.EnableRaisingEvents = true; Process.EnableRaisingEvents = true;
@ -138,15 +147,20 @@ namespace SparkleShare {
Process.Start (); Process.Start ();
string Output = Process.StandardOutput.ReadToEnd (); string Output = Process.StandardOutput.ReadToEnd ();
if (Output.Contains ("fatal")) { Console.WriteLine ("[Git][" + RepoName + "] Cloning repository...");
SparkleBubble = // Move the folder to the SparkleShare folder when done cloning
Process.Exited += delegate {
if (Output.Contains ("fatal:")) {
SparkleBubble ErrorBubble =
new SparkleBubble ("Something went wrong while syncing " + new SparkleBubble ("Something went wrong while syncing " +
" " + RepoName + "", " " + RepoName + "",
"Please double check the address and\n" + "Please double check the address and\n" +
"network connection."); "network connection.");
SparkleBubble.AddAction ("", _("Try Again…"), ErrorBubble.AddAction ("", _("Try Again…"),
delegate { delegate {
Process.StartInfo.FileName = "xdg-open"; Process.StartInfo.FileName = "xdg-open";
Process.StartInfo.Arguments = Process.StartInfo.Arguments =
@ -156,15 +170,14 @@ namespace SparkleShare {
} }
); );
ErrorBubble.Show ();
SparkleDialog SparkleDialog = new SparkleDialog (RepoRemoteUrl); SparkleDialog SparkleDialog = new SparkleDialog (RepoRemoteUrl);
SparkleDialog.ShowAll (); SparkleDialog.ShowAll ();
Destroy (); Destroy ();
} } else {
// Move the folder to the SparkleShare folder when done cloning
Process.Exited += delegate {
Directory.Move ( Directory.Move (
SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath, SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath,
@ -173,13 +186,15 @@ namespace SparkleShare {
RepoName) RepoName)
); );
Console.WriteLine ("[Git][" + RepoName + "] Repository cloned");
// Show a confirmation notification // Show a confirmation notification
SparkleBubble = SparkleBubble FinishedBubble =
new SparkleBubble (_("Successfully synced the folder ") + new SparkleBubble (_("Successfully synced folder ") +
"" + RepoName + "", "" + RepoName + "",
_("Now make great stuff happen!")); _("Now make great stuff happen!"));
SparkleBubble.AddAction ("", _("Open Folder"), FinishedBubble.AddAction ("", _("Open Folder"),
delegate { delegate {
Process.StartInfo.FileName = "xdg-open"; Process.StartInfo.FileName = "xdg-open";
Process.StartInfo.Arguments = Process.StartInfo.Arguments =
@ -188,6 +203,7 @@ namespace SparkleShare {
Process.Start (); Process.Start ();
} }
); );
FinishedBubble.Show ();
// Destroy the Add dialog // Destroy the Add dialog
Destroy (); Destroy ();
@ -195,6 +211,8 @@ namespace SparkleShare {
// Refresh the UI // Refresh the UI
SparkleShare.SparkleUI = new SparkleUI (true); SparkleShare.SparkleUI = new SparkleUI (true);
}
}; };
} }

View file

@ -469,6 +469,8 @@ namespace SparkleShare {
Process.StartInfo.FileName = "git"; Process.StartInfo.FileName = "git";
} ); } );
StuffChangedBubble.Show ();
} }
} }

View file

@ -132,6 +132,8 @@ namespace SparkleShare {
*/ */
} ); } );
NoFoldersBubble.Show ();
} }
} }