SparkleDialog: update coding style

This commit is contained in:
Hylke Bons 2010-06-15 00:28:08 +01:00
parent 75d770eb02
commit 57f02b92d2

View file

@ -28,15 +28,16 @@ namespace SparkleShare {
public class SparkleDialog : Window { public class SparkleDialog : Window {
// Short alias for the translations // Short alias for the translations
public static string _ (string s) { public static string _ (string s)
{
return Catalog.GetString (s); return Catalog.GetString (s);
} }
private Button AddButton; private Button AddButton;
private ComboBoxEntry RemoteUrlCombo; private ComboBoxEntry RemoteUrlCombo;
public SparkleDialog (string Url) : base ("") { public SparkleDialog (string Url) : base ("")
{
BorderWidth = 12; BorderWidth = 12;
IconName = "folder-sparkleshare"; IconName = "folder-sparkleshare";
WidthRequest = 320; WidthRequest = 320;
@ -46,8 +47,7 @@ namespace SparkleShare {
VBox VBox = new VBox (false, 0); VBox VBox = new VBox (false, 0);
Label RemoteUrlLabel = Label RemoteUrlLabel = new Label (_("Address of remote SparkleShare folder:"));
new Label (_("Address of remote SparkleShare folder:"));
RemoteUrlLabel.Xalign = 0; RemoteUrlLabel.Xalign = 0;
ListStore Defaults = new ListStore (typeof (string)); ListStore Defaults = new ListStore (typeof (string));
@ -104,7 +104,7 @@ namespace SparkleShare {
// Clones a remote repo // Clones a remote repo
public void CloneRepo (object o, EventArgs args) { public void CloneRepo (object o, EventArgs args) {
// SparkleUI.NotificationIcon.SetSyncingState (); // SparkleUI.NotificationIcon.SetSyncingState ();
HideAll (); HideAll ();
@ -121,16 +121,14 @@ namespace SparkleShare {
else else
RepoName = RepoRemoteUrl.Substring (ColumnPos + 1); RepoName = RepoRemoteUrl.Substring (ColumnPos + 1);
SparkleBubble SyncingBubble;
SparkleBubble SyncingBubble = SyncingBubble = new SparkleBubble (String.Format(_("Syncing folder {0}"), RepoName),
new SparkleBubble (String.Format(_("Syncing folder {0}"), RepoName), _("SparkleShare will notify you when this is done."));
_("SparkleShare will notify you when this is done."));
SyncingBubble.AddAction ("", _("Dismiss"), SyncingBubble.AddAction ("", _("Dismiss"),
delegate { delegate {
SyncingBubble.Close (); SyncingBubble.Close ();
} });
);
SyncingBubble.Show (); SyncingBubble.Show ();
@ -139,57 +137,52 @@ namespace SparkleShare {
Process.StartInfo.RedirectStandardOutput = true; Process.StartInfo.RedirectStandardOutput = true;
Process.StartInfo.UseShellExecute = false; Process.StartInfo.UseShellExecute = false;
SparkleHelpers.DebugInfo ("Config", SparkleHelpers.DebugInfo ("Config", "[" + RepoName + "] Cloning repository...");
"[" + RepoName + "] Cloning repository...");
// Clone into the system's temporary folder // Clone into the system's temporary folder
Process.StartInfo.FileName = "git"; Process.StartInfo.FileName = "git";
Process.StartInfo.WorkingDirectory = SparklePaths.SparkleTmpPath; Process.StartInfo.WorkingDirectory = SparklePaths.SparkleTmpPath;
Process.StartInfo.Arguments = String.Format ("clone {0} {1}", Process.StartInfo.Arguments = String.Format ("clone {0} {1}",
RepoRemoteUrl, RepoRemoteUrl,
RepoName); RepoName);
Process.Start (); Process.Start ();
Process.WaitForExit (); Process.WaitForExit ();
if (Process.ExitCode != 0) { if (Process.ExitCode != 0) {
SparkleBubble ErrorBubble = SparkleBubble ErrorBubble;
new SparkleBubble (String.Format(_("Something went wrong while syncing {0}"), RepoName), ErrorBubble = new SparkleBubble (String.Format(_("Something went wrong while syncing {0}"), RepoName),
"Please double check the address and\n" + "Please double check the address and\n" +
"network connection."); "network connection.");
ErrorBubble.AddAction ("", _("Try Again…"), ErrorBubble.AddAction ("", _("Try Again…"),
delegate { delegate {
SparkleDialog SparkleDialog = SparkleDialog SparkleDialog = new SparkleDialog (RepoRemoteUrl);
new SparkleDialog (RepoRemoteUrl); SparkleDialog.ShowAll ();
SparkleDialog.ShowAll (); });
}
);
ErrorBubble.Show (); ErrorBubble.Show ();
} else { } else {
SparkleHelpers.DebugInfo ("Git", "[" + RepoName + "] Repository cloned");
SparkleShare.SparkleUI.UpdateRepositories (); SparkleShare.SparkleUI.UpdateRepositories ();
SparkleHelpers.DebugInfo ("Git",
"[" + RepoName + "] Repository cloned");
// Show a confirmation notification // Show a confirmation notification
SparkleBubble FinishedBubble = SparkleBubble FinishedBubble;
new SparkleBubble (String.Format(_("Successfully synced folder {0}"), RepoName), FinishedBubble = new SparkleBubble (String.Format(_("Successfully synced folder {0}"), RepoName),
_("Now make great stuff happen!")); _("Now make great stuff happen!"));
FinishedBubble.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 = SparkleHelpers.CombineMore (SparklePaths.SparklePath, RepoName);
SparkleHelpers.CombineMore ( Process.Start ();
SparklePaths.SparklePath, RepoName); } );
Process.Start ();
} );
FinishedBubble.Show (); FinishedBubble.Show ();
} }
} }
// Enables the Add button when the fields are // Enables the Add button when the fields are