mac intro: fix coding style and whitespace
This commit is contained in:
parent
5ef01566b0
commit
4c7b01003b
|
@ -53,22 +53,18 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleIntro () : base ()
|
public SparkleIntro () : base ()
|
||||||
{
|
{
|
||||||
|
|
||||||
ServerFormOnly = false;
|
ServerFormOnly = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ShowAccountForm ()
|
public void ShowAccountForm ()
|
||||||
{
|
{
|
||||||
|
|
||||||
Reset ();
|
Reset ();
|
||||||
|
|
||||||
Header = "Welcome to SparkleShare!";
|
Header = "Welcome to SparkleShare!";
|
||||||
Description = "Before we can create a SparkleShare folder on this " +
|
Description = "Before we can create a SparkleShare folder on this " +
|
||||||
"computer, we need some information from you.";
|
"computer, we need some information from you.";
|
||||||
|
|
||||||
|
|
||||||
UserInfoForm = new NSForm (new RectangleF (250, 115, 350, 64));
|
UserInfoForm = new NSForm (new RectangleF (250, 115, 350, 64));
|
||||||
UserInfoForm.AddEntry ("Full Name:");
|
UserInfoForm.AddEntry ("Full Name:");
|
||||||
UserInfoForm.AddEntry ("Email Address:");
|
UserInfoForm.AddEntry ("Email Address:");
|
||||||
|
@ -82,14 +78,12 @@ namespace SparkleShare {
|
||||||
UserInfoForm.Cells [0].StringValue = full_name.TrimEnd (",".ToCharArray());;
|
UserInfoForm.Cells [0].StringValue = full_name.TrimEnd (",".ToCharArray());;
|
||||||
UserInfoForm.Cells [1].StringValue = SparkleShare.Controller.UserEmail;
|
UserInfoForm.Cells [1].StringValue = SparkleShare.Controller.UserEmail;
|
||||||
|
|
||||||
|
|
||||||
ContinueButton = new NSButton () {
|
ContinueButton = new NSButton () {
|
||||||
Title = "Continue",
|
Title = "Continue",
|
||||||
Enabled = false
|
Enabled = false
|
||||||
};
|
};
|
||||||
|
|
||||||
ContinueButton.Activated += delegate {
|
ContinueButton.Activated += delegate {
|
||||||
|
|
||||||
SparkleShare.Controller.UserName = UserInfoForm.Cells [0].StringValue.Trim ();
|
SparkleShare.Controller.UserName = UserInfoForm.Cells [0].StringValue.Trim ();
|
||||||
SparkleShare.Controller.UserEmail = UserInfoForm.Cells [1].StringValue.Trim ();
|
SparkleShare.Controller.UserEmail = UserInfoForm.Cells [1].StringValue.Trim ();
|
||||||
SparkleShare.Controller.GenerateKeyPair ();
|
SparkleShare.Controller.GenerateKeyPair ();
|
||||||
|
@ -98,29 +92,23 @@ namespace SparkleShare {
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
ShowServerForm ();
|
ShowServerForm ();
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// TODO: Ugly hack, do properly with events
|
// TODO: Ugly hack, do properly with events
|
||||||
Timer timer = new Timer () {
|
Timer timer = new Timer () {
|
||||||
Interval = 50
|
Interval = 50
|
||||||
};
|
};
|
||||||
|
|
||||||
timer.Elapsed += delegate {
|
timer.Elapsed += delegate {
|
||||||
|
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
|
|
||||||
bool name_is_correct =
|
bool name_is_correct =
|
||||||
!UserInfoForm.Cells [0].StringValue.Trim ().Equals ("");
|
!UserInfoForm.Cells [0].StringValue.Trim ().Equals ("");
|
||||||
|
|
||||||
bool email_is_correct = SparkleShare.Controller.IsValidEmail
|
bool email_is_correct = SparkleShare.Controller.IsValidEmail (
|
||||||
(UserInfoForm.Cells [1].StringValue.Trim ());
|
UserInfoForm.Cells [1].StringValue.Trim ());
|
||||||
|
|
||||||
ContinueButton.Enabled = (name_is_correct && email_is_correct);
|
ContinueButton.Enabled = (name_is_correct && email_is_correct);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
timer.Start ();
|
timer.Start ();
|
||||||
|
@ -129,28 +117,23 @@ namespace SparkleShare {
|
||||||
Buttons.Add (ContinueButton);
|
Buttons.Add (ContinueButton);
|
||||||
|
|
||||||
ShowAll ();
|
ShowAll ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ShowServerForm (bool server_form_only)
|
public void ShowServerForm (bool server_form_only)
|
||||||
{
|
{
|
||||||
|
|
||||||
ServerFormOnly = server_form_only;
|
ServerFormOnly = server_form_only;
|
||||||
ShowServerForm ();
|
ShowServerForm ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ShowServerForm ()
|
public void ShowServerForm ()
|
||||||
{
|
{
|
||||||
|
|
||||||
Reset ();
|
Reset ();
|
||||||
|
|
||||||
Header = "Where is your remote folder?";
|
Header = "Where is your remote folder?";
|
||||||
Description = "";
|
Description = "";
|
||||||
|
|
||||||
|
|
||||||
ServerTypeLabel = new NSTextField () {
|
ServerTypeLabel = new NSTextField () {
|
||||||
Alignment = NSTextAlignment.Right,
|
Alignment = NSTextAlignment.Right,
|
||||||
BackgroundColor = NSColor.WindowBackground,
|
BackgroundColor = NSColor.WindowBackground,
|
||||||
|
@ -284,7 +267,6 @@ namespace SparkleShare {
|
||||||
|
|
||||||
timer.Start ();
|
timer.Start ();
|
||||||
|
|
||||||
|
|
||||||
ContentView.AddSubview (ServerTypeLabel);
|
ContentView.AddSubview (ServerTypeLabel);
|
||||||
ContentView.AddSubview (Matrix);
|
ContentView.AddSubview (Matrix);
|
||||||
|
|
||||||
|
@ -295,15 +277,12 @@ namespace SparkleShare {
|
||||||
ContentView.AddSubview (FolderNameTextField);
|
ContentView.AddSubview (FolderNameTextField);
|
||||||
ContentView.AddSubview (FolderNameHelpLabel);
|
ContentView.AddSubview (FolderNameHelpLabel);
|
||||||
|
|
||||||
|
|
||||||
SyncButton = new NSButton () {
|
SyncButton = new NSButton () {
|
||||||
Title = "Sync",
|
Title = "Sync",
|
||||||
Enabled = false
|
Enabled = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SyncButton.Activated += delegate {
|
SyncButton.Activated += delegate {
|
||||||
|
|
||||||
string name = FolderNameTextField.StringValue;
|
string name = FolderNameTextField.StringValue;
|
||||||
|
|
||||||
// Remove the starting slash if there is one
|
// Remove the starting slash if there is one
|
||||||
|
@ -334,22 +313,17 @@ namespace SparkleShare {
|
||||||
// Remove the trailing slash if there is one
|
// Remove the trailing slash if there is one
|
||||||
if (server.EndsWith ("/"))
|
if (server.EndsWith ("/"))
|
||||||
server = server.TrimEnd ("/".ToCharArray ());
|
server = server.TrimEnd ("/".ToCharArray ());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ServerType == 2) {
|
if (ServerType == 2) {
|
||||||
|
|
||||||
server = "ssh://git@gitorious.org";
|
server = "ssh://git@gitorious.org";
|
||||||
|
|
||||||
if (!name.EndsWith (".git")) {
|
if (!name.EndsWith (".git")) {
|
||||||
|
|
||||||
if (!name.Contains ("/"))
|
if (!name.Contains ("/"))
|
||||||
name = name + "/" + name;
|
name = name + "/" + name;
|
||||||
|
|
||||||
name += ".git";
|
name += ".git";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ServerType == 1)
|
if (ServerType == 1)
|
||||||
|
@ -361,37 +335,26 @@ namespace SparkleShare {
|
||||||
string url = server + "/" + name;
|
string url = server + "/" + name;
|
||||||
string canonical_name = Path.GetFileNameWithoutExtension (name);
|
string canonical_name = Path.GetFileNameWithoutExtension (name);
|
||||||
|
|
||||||
|
|
||||||
ShowSyncingPage (canonical_name);
|
ShowSyncingPage (canonical_name);
|
||||||
|
|
||||||
|
|
||||||
SparkleShare.Controller.FolderFetched += delegate {
|
SparkleShare.Controller.FolderFetched += delegate {
|
||||||
|
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
ShowSuccessPage (canonical_name);
|
ShowSuccessPage (canonical_name);
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SparkleShare.Controller.FolderFetchError += delegate {
|
SparkleShare.Controller.FolderFetchError += delegate {
|
||||||
|
|
||||||
InvokeOnMainThread (delegate {
|
InvokeOnMainThread (delegate {
|
||||||
ShowErrorPage ();
|
ShowErrorPage ();
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SparkleShare.Controller.FetchFolder (url, name);
|
SparkleShare.Controller.FetchFolder (url, name);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Buttons.Add (SyncButton);
|
Buttons.Add (SyncButton);
|
||||||
|
|
||||||
|
|
||||||
if (ServerFormOnly) {
|
if (ServerFormOnly) {
|
||||||
|
|
||||||
CancelButton = new NSButton () {
|
CancelButton = new NSButton () {
|
||||||
Title = "Cancel"
|
Title = "Cancel"
|
||||||
};
|
};
|
||||||
|
@ -403,9 +366,7 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
Buttons.Add (CancelButton);
|
Buttons.Add (CancelButton);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
SkipButton = new NSButton () {
|
SkipButton = new NSButton () {
|
||||||
Title = "Skip"
|
Title = "Skip"
|
||||||
};
|
};
|
||||||
|
@ -417,23 +378,19 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
Buttons.Add (SkipButton);
|
Buttons.Add (SkipButton);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowAll ();
|
ShowAll ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ShowErrorPage ()
|
public void ShowErrorPage ()
|
||||||
{
|
{
|
||||||
|
|
||||||
Reset ();
|
Reset ();
|
||||||
|
|
||||||
Header = "Something went wrong…";
|
Header = "Something went wrong…";
|
||||||
Description = "";
|
Description = "";
|
||||||
|
|
||||||
|
|
||||||
TryAgainButton = new NSButton () {
|
TryAgainButton = new NSButton () {
|
||||||
Title = "Try again…"
|
Title = "Try again…"
|
||||||
};
|
};
|
||||||
|
@ -444,24 +401,20 @@ namespace SparkleShare {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Buttons.Add (TryAgainButton);
|
Buttons.Add (TryAgainButton);
|
||||||
|
|
||||||
ShowAll ();
|
ShowAll ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ShowSyncingPage (string name)
|
private void ShowSyncingPage (string name)
|
||||||
{
|
{
|
||||||
|
|
||||||
Reset ();
|
Reset ();
|
||||||
|
|
||||||
Header = "Syncing folder ‘" + name + "’…";
|
Header = "Syncing folder ‘" + name + "’…";
|
||||||
Description = "This may take a while.\n" +
|
Description = "This may take a while.\n" +
|
||||||
"Are you sure it’s not coffee o'clock?";
|
"Are you sure it’s not coffee o'clock?";
|
||||||
|
|
||||||
|
|
||||||
ProgressIndicator = new NSProgressIndicator () {
|
ProgressIndicator = new NSProgressIndicator () {
|
||||||
Frame = new RectangleF (190, Frame.Height - 200, 640 - 150 - 80, 20),
|
Frame = new RectangleF (190, Frame.Height - 200, 640 - 150 - 80, 20),
|
||||||
Style = NSProgressIndicatorStyle.Bar
|
Style = NSProgressIndicatorStyle.Bar
|
||||||
|
@ -471,7 +424,6 @@ namespace SparkleShare {
|
||||||
|
|
||||||
ContentView.AddSubview (ProgressIndicator);
|
ContentView.AddSubview (ProgressIndicator);
|
||||||
|
|
||||||
|
|
||||||
FinishButton = new NSButton () {
|
FinishButton = new NSButton () {
|
||||||
Title = "Finish",
|
Title = "Finish",
|
||||||
Enabled = false
|
Enabled = false
|
||||||
|
@ -480,20 +432,17 @@ namespace SparkleShare {
|
||||||
Buttons.Add (FinishButton);
|
Buttons.Add (FinishButton);
|
||||||
|
|
||||||
ShowAll ();
|
ShowAll ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void ShowSuccessPage (string folder_name)
|
public void ShowSuccessPage (string folder_name)
|
||||||
{
|
{
|
||||||
|
|
||||||
Reset ();
|
Reset ();
|
||||||
|
|
||||||
Header = "Folder synced succesfully!";
|
Header = "Folder synced succesfully!";
|
||||||
Description = "Now you can access the synced files from ‘" + folder_name + "’ in " +
|
Description = "Now you can access the synced files from ‘" + folder_name + "’ in " +
|
||||||
"your SparkleShare folder.";
|
"your SparkleShare folder.";
|
||||||
|
|
||||||
|
|
||||||
FinishButton = new NSButton () {
|
FinishButton = new NSButton () {
|
||||||
Title = "Finish"
|
Title = "Finish"
|
||||||
};
|
};
|
||||||
|
@ -505,7 +454,6 @@ namespace SparkleShare {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
OpenFolderButton = new NSButton () {
|
OpenFolderButton = new NSButton () {
|
||||||
Title = "Open Folder"
|
Title = "Open Folder"
|
||||||
};
|
};
|
||||||
|
@ -514,7 +462,6 @@ namespace SparkleShare {
|
||||||
SparkleShare.Controller.OpenSparkleShareFolder (folder_name);
|
SparkleShare.Controller.OpenSparkleShareFolder (folder_name);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Buttons.Add (FinishButton);
|
Buttons.Add (FinishButton);
|
||||||
Buttons.Add (OpenFolderButton);
|
Buttons.Add (OpenFolderButton);
|
||||||
|
|
||||||
|
@ -522,13 +469,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
NSApplication.SharedApplication.RequestUserAttention
|
NSApplication.SharedApplication.RequestUserAttention
|
||||||
(NSRequestUserAttentionType.CriticalRequest);
|
(NSRequestUserAttentionType.CriticalRequest);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ShowCompletedPage ()
|
private void ShowCompletedPage ()
|
||||||
{
|
{
|
||||||
|
|
||||||
Reset ();
|
Reset ();
|
||||||
|
|
||||||
Header = "SparkleShare is ready to go!";
|
Header = "SparkleShare is ready to go!";
|
||||||
|
@ -536,7 +481,6 @@ namespace SparkleShare {
|
||||||
"Just click on invitations you get by email and " +
|
"Just click on invitations you get by email and " +
|
||||||
"we will take care of the rest.";
|
"we will take care of the rest.";
|
||||||
|
|
||||||
|
|
||||||
FinishButton = new NSButton () {
|
FinishButton = new NSButton () {
|
||||||
Title = "Finish"
|
Title = "Finish"
|
||||||
};
|
};
|
||||||
|
@ -552,10 +496,6 @@ namespace SparkleShare {
|
||||||
Buttons.Add (FinishButton);
|
Buttons.Add (FinishButton);
|
||||||
|
|
||||||
ShowAll ();
|
ShowAll ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue