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 SparkleBubble (string Title, string Subtext) : base (Title, Subtext) {
Timeout = 4500;
Urgency = Urgency.Low;
Show ();
IconName = "folder-sparkleshare";
// TODO: Doesn't work for some reason
AttachToStatusIcon (SparkleUI.NotificationIcon);
}

View file

@ -119,9 +119,18 @@ namespace SparkleShare {
else
RepoName = RepoRemoteUrl.Substring (ColumnPos + 1);
SparkleBubble SparkleBubble =
SparkleBubble SyncingBubble =
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.EnableRaisingEvents = true;
@ -138,62 +147,71 @@ namespace SparkleShare {
Process.Start ();
string Output = Process.StandardOutput.ReadToEnd ();
if (Output.Contains ("fatal")) {
SparkleBubble =
new SparkleBubble ("Something went wrong while syncing " +
" " + RepoName + "",
"Please double check the address and\n" +
"network connection.");
SparkleBubble.AddAction ("", _("Try Again…"),
delegate {
Process.StartInfo.FileName = "xdg-open";
Process.StartInfo.Arguments =
SparkleHelpers.CombineMore
(SparklePaths.SparklePath, RepoName);
Process.Start ();
}
);
SparkleDialog SparkleDialog = new SparkleDialog (RepoRemoteUrl);
SparkleDialog.ShowAll ();
Destroy ();
}
Console.WriteLine ("[Git][" + RepoName + "] Cloning repository...");
// Move the folder to the SparkleShare folder when done cloning
Process.Exited += delegate {
Directory.Move (
SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath,
RepoName),
SparkleHelpers.CombineMore (SparklePaths.SparklePath,
RepoName)
);
if (Output.Contains ("fatal:")) {
// Show a confirmation notification
SparkleBubble =
new SparkleBubble (_("Successfully synced the folder ") +
"" + RepoName + "",
_("Now make great stuff happen!"));
SparkleBubble ErrorBubble =
new SparkleBubble ("Something went wrong while syncing " +
" " + RepoName + "",
"Please double check the address and\n" +
"network connection.");
SparkleBubble.AddAction ("", _("Open Folder"),
delegate {
Process.StartInfo.FileName = "xdg-open";
Process.StartInfo.Arguments =
SparkleHelpers.CombineMore (
SparklePaths.SparklePath, RepoName);
Process.Start ();
}
);
ErrorBubble.AddAction ("", _("Try Again…"),
delegate {
Process.StartInfo.FileName = "xdg-open";
Process.StartInfo.Arguments =
SparkleHelpers.CombineMore
(SparklePaths.SparklePath, RepoName);
Process.Start ();
}
);
// Destroy the Add dialog
Destroy ();
ErrorBubble.Show ();
// Refresh the UI
SparkleShare.SparkleUI = new SparkleUI (true);
SparkleDialog SparkleDialog = new SparkleDialog (RepoRemoteUrl);
SparkleDialog.ShowAll ();
Destroy ();
} else {
Directory.Move (
SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath,
RepoName),
SparkleHelpers.CombineMore (SparklePaths.SparklePath,
RepoName)
);
Console.WriteLine ("[Git][" + RepoName + "] Repository cloned");
// Show a confirmation notification
SparkleBubble FinishedBubble =
new SparkleBubble (_("Successfully synced folder ") +
"" + RepoName + "",
_("Now make great stuff happen!"));
FinishedBubble.AddAction ("", _("Open Folder"),
delegate {
Process.StartInfo.FileName = "xdg-open";
Process.StartInfo.Arguments =
SparkleHelpers.CombineMore (
SparklePaths.SparklePath, RepoName);
Process.Start ();
}
);
FinishedBubble.Show ();
// Destroy the Add dialog
Destroy ();
// Refresh the UI
SparkleShare.SparkleUI = new SparkleUI (true);
}
};

View file

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

View file

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