fix notifications in Add dialog and other places
This commit is contained in:
parent
e32903efe0
commit
aa3523c1aa
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,62 +147,71 @@ 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 =
|
|
||||||
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 ();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Move the folder to the SparkleShare folder when done cloning
|
// Move the folder to the SparkleShare folder when done cloning
|
||||||
Process.Exited += delegate {
|
Process.Exited += delegate {
|
||||||
|
|
||||||
Directory.Move (
|
if (Output.Contains ("fatal:")) {
|
||||||
SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath,
|
|
||||||
RepoName),
|
|
||||||
SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
|
||||||
RepoName)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Show a confirmation notification
|
SparkleBubble ErrorBubble =
|
||||||
SparkleBubble =
|
new SparkleBubble ("Something went wrong while syncing " +
|
||||||
new SparkleBubble (_("Successfully synced the folder ") +
|
" ‘" + RepoName + "’",
|
||||||
"‘" + RepoName + "’",
|
"Please double check the address and\n" +
|
||||||
_("Now make great stuff happen!"));
|
"network connection.");
|
||||||
|
|
||||||
SparkleBubble.AddAction ("", _("Open Folder"),
|
ErrorBubble.AddAction ("", _("Try Again…"),
|
||||||
delegate {
|
delegate {
|
||||||
Process.StartInfo.FileName = "xdg-open";
|
Process.StartInfo.FileName = "xdg-open";
|
||||||
Process.StartInfo.Arguments =
|
Process.StartInfo.Arguments =
|
||||||
SparkleHelpers.CombineMore (
|
SparkleHelpers.CombineMore
|
||||||
SparklePaths.SparklePath, RepoName);
|
(SparklePaths.SparklePath, RepoName);
|
||||||
Process.Start ();
|
Process.Start ();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Destroy the Add dialog
|
ErrorBubble.Show ();
|
||||||
Destroy ();
|
|
||||||
|
|
||||||
// Refresh the UI
|
SparkleDialog SparkleDialog = new SparkleDialog (RepoRemoteUrl);
|
||||||
SparkleShare.SparkleUI = new SparkleUI (true);
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -469,6 +469,8 @@ namespace SparkleShare {
|
||||||
Process.StartInfo.FileName = "git";
|
Process.StartInfo.FileName = "git";
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
StuffChangedBubble.Show ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,6 +131,8 @@ namespace SparkleShare {
|
||||||
Process.Start ();
|
Process.Start ();
|
||||||
*/
|
*/
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
NoFoldersBubble.Show ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue