setup: '[X] Add SparklShare to startup items' and tutorial phrases tweaks

This commit is contained in:
Hylke Bons 2012-02-24 03:43:28 +01:00
parent 51b5e738ee
commit e90796cbae
8 changed files with 79 additions and 50 deletions

View file

@ -102,9 +102,33 @@ namespace SparkleShare {
} }
public override void EnableSystemAutostart () public override void CreateStartupItem ()
{ {
// N/A // There aren't any bindings in MonoMac to support this yet, so
// we call out to an applescript to do the job
Process process = new Process ();
process.EnableRaisingEvents = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = "osascript";
process.StartInfo.CreateNoWindow = true;
string app_path = Path.GetDirectoryName (NSBundle.MainBundle.ResourcePath);
app_path = Path.GetDirectoryName (app_path);
process.StartInfo.Arguments = "-e 'tell application \"System Events\" to " +
"make login item at end with properties {path:\"" + app_path + "\", hidden:false}'";
process.Exited += delegate {
SparkleHelpers.DebugInfo ("Controller", "Added " + app_path + " to login items");
};
try {
process.Start ();
} catch (Exception e) {
SparkleHelpers.DebugInfo ("Controller", "Failed adding " + app_path + " to login items: " + e.Message);
}
} }

View file

@ -37,6 +37,7 @@ namespace SparkleShare {
private NSButton TryAgainButton; private NSButton TryAgainButton;
private NSButton CancelButton; private NSButton CancelButton;
private NSButton SkipTutorialButton; private NSButton SkipTutorialButton;
private NSButton StartupCheckButton;
private NSButton OpenFolderButton; private NSButton OpenFolderButton;
private NSButton FinishButton; private NSButton FinishButton;
private NSImage SlideImage; private NSImage SlideImage;
@ -52,7 +53,6 @@ namespace SparkleShare {
private NSTextField PathTextField; private NSTextField PathTextField;
private NSTextField PathLabel; private NSTextField PathLabel;
private NSTextField PathHelpLabel; private NSTextField PathHelpLabel;
private NSTextField AddProjectTextField;
private NSTextField WarningTextField; private NSTextField WarningTextField;
private NSImage WarningImage; private NSImage WarningImage;
private NSImageView WarningImageView; private NSImageView WarningImageView;
@ -84,10 +84,9 @@ namespace SparkleShare {
switch (type) { switch (type) {
case PageType.Setup: { case PageType.Setup: {
// TODO: Improve text
Header = "Welcome to SparkleShare!"; Header = "Welcome to SparkleShare!";
Description = "We'll need some info to mark your changes in the event log. " + Description = "Before we get started, what's your name and email? " +
"Don't worry, this stays between you and your peers."; "Don't worry, this information is only visible to your team members.";
FullNameLabel = new NSTextField () { FullNameLabel = new NSTextField () {
@ -618,7 +617,7 @@ namespace SparkleShare {
switch (Controller.TutorialPageNumber) { switch (Controller.TutorialPageNumber) {
case 1: { case 1: {
Header = "What's happening next?"; Header = "What's happening next?";
Description = "SparkleShare creates a special folder in your personal folder " + Description = "SparkleShare creates a special folder on your computer " +
"that will keep track of your projects."; "that will keep track of your projects.";
SkipTutorialButton = new NSButton () { SkipTutorialButton = new NSButton () {
@ -658,8 +657,8 @@ namespace SparkleShare {
case 2: { case 2: {
Header = "Sharing files with others"; Header = "Sharing files with others";
Description = "All files added to your project folders are synced with the host " + Description = "All files added to your project folders are synced automatically with " +
"automatically, as well as with your collaborators."; "the host and your team members.";
ContinueButton = new NSButton () { ContinueButton = new NSButton () {
Title = "Continue" Title = "Continue"
@ -689,8 +688,8 @@ namespace SparkleShare {
case 3: { case 3: {
Header = "The status icon is here to help"; Header = "The status icon is here to help";
Description = "It shows the syncing process status, " + Description = "It shows the syncing progress, provides easy access to " +
"and contains links to your projects and the event log."; "your projects and let's you view recent changes.";
ContinueButton = new NSButton () { ContinueButton = new NSButton () {
Title = "Continue" Title = "Continue"
@ -720,17 +719,20 @@ namespace SparkleShare {
case 4: { case 4: {
Header = "Adding projects to SparkleShare"; Header = "Adding projects to SparkleShare";
Description = "Just click this button when you see it on the web, and " + Description = "You can do this through the status icon menu, or by clicking " +
"the project will be automatically added:"; "magic buttons on webpages that look like this:";
AddProjectTextField = new NSTextField () {
Frame = new RectangleF (190, Frame.Height - 290, 640 - 240, 44), StartupCheckButton = new NSButton () {
BackgroundColor = NSColor.WindowBackground, Frame = new RectangleF (190, Frame.Height - 400, 300, 18),
Bordered = false, Title = "Add SparkleShare to startup items",
Editable = false, State = NSCellStateValue.On
Font = SparkleUI.Font, };
StringValue = "…or select Add Hosted Project… from the status icon menu " +
"to add one by hand." StartupCheckButton.SetButtonType (NSButtonType.Switch);
StartupCheckButton.Activated += delegate {
Controller.StartupItemChanged (StartupCheckButton.State == NSCellStateValue.On);
}; };
FinishButton = new NSButton () { FinishButton = new NSButton () {
@ -741,6 +743,7 @@ namespace SparkleShare {
Controller.TutorialPageCompleted (); Controller.TutorialPageCompleted ();
}; };
string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath, string slide_image_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"Pixmaps", "tutorial-slide-4.png"); "Pixmaps", "tutorial-slide-4.png");
@ -754,7 +757,7 @@ namespace SparkleShare {
}; };
ContentView.AddSubview (SlideImageView); ContentView.AddSubview (SlideImageView);
ContentView.AddSubview (AddProjectTextField); ContentView.AddSubview (StartupCheckButton);
Buttons.Add (FinishButton); Buttons.Add (FinishButton);
break; break;

View file

@ -45,8 +45,10 @@ namespace SparkleShare {
// Creates a .desktop entry in autostart folder to // Creates a .desktop entry in autostart folder to
// start SparkleShare automatically at login // start SparkleShare automatically at login
public override void EnableSystemAutostart () public override void CreateStartupItem ()
{ {
// TODO: check whether this still works
string autostart_path = Path.Combine (Environment.GetFolderPath ( string autostart_path = Path.Combine (Environment.GetFolderPath (
Environment.SpecialFolder.ApplicationData), "autostart"); Environment.SpecialFolder.ApplicationData), "autostart");

View file

@ -92,7 +92,7 @@ namespace SparkleShare {
public abstract string PluginsPath { get; } public abstract string PluginsPath { get; }
// Enables SparkleShare to start automatically at login // Enables SparkleShare to start automatically at login
public abstract void EnableSystemAutostart (); public abstract void CreateStartupItem ();
// Installs the sparkleshare:// protocol handler // Installs the sparkleshare:// protocol handler
public abstract void InstallProtocolHandler (); public abstract void InstallProtocolHandler ();
@ -132,7 +132,6 @@ namespace SparkleShare {
public virtual void Initialize () public virtual void Initialize ()
{ {
EnableSystemAutostart ();
InstallProtocolHandler (); InstallProtocolHandler ();
// Create the SparkleShare folder and add it to the bookmarks // Create the SparkleShare folder and add it to the bookmarks

View file

@ -64,8 +64,9 @@ namespace SparkleShare {
case PageType.Setup: { case PageType.Setup: {
Header = _("Welcome to SparkleShare!"); Header = _("Welcome to SparkleShare!");
Description = "We'll need some info to mark your changes in the event log. " + Description = "Before we get started, what's your name and email? " +
"Don't worry, this stays between you and your peers."; "Don't worry, this information is only visible to your team members.";
Table table = new Table (2, 3, true) { Table table = new Table (2, 3, true) {
@ -496,8 +497,8 @@ namespace SparkleShare {
switch (Controller.TutorialPageNumber) { switch (Controller.TutorialPageNumber) {
case 1: { case 1: {
Header = _("What's happening next?"); Header = _("What's happening next?");
Description = _("SparkleShare creates a special folder in your personal folder " + Description = "SparkleShare creates a special folder on your computer " +
"that will keep track of your projects."); "that will keep track of your projects.";
Button skip_tutorial_button = new Button (_("Skip Tutorial")); Button skip_tutorial_button = new Button (_("Skip Tutorial"));
skip_tutorial_button.Clicked += delegate { skip_tutorial_button.Clicked += delegate {
@ -521,8 +522,8 @@ namespace SparkleShare {
case 2: { case 2: {
Header = _("Sharing files with others"); Header = _("Sharing files with others");
Description = _("All files added to your project folders are synced with the host " + Description = _("All files added to your project folders are synced automatically with " +
"automatically, as well as with your collaborators."); "the host and your team members.");
Button continue_button = new Button (_("Continue")); Button continue_button = new Button (_("Continue"));
continue_button.Clicked += delegate { continue_button.Clicked += delegate {
@ -539,8 +540,8 @@ namespace SparkleShare {
case 3: { case 3: {
Header = _("The status icon is here to help"); Header = _("The status icon is here to help");
Description = _("It shows the syncing process status, " + Description = _("It shows the syncing progress, provides easy access to " +
"and contains links to your projects and the event log."); "your projects and let's you view recent changes.");
Button continue_button = new Button (_("Continue")); Button continue_button = new Button (_("Continue"));
continue_button.Clicked += delegate { continue_button.Clicked += delegate {
@ -557,15 +558,8 @@ namespace SparkleShare {
case 4: { case 4: {
Header = _("Adding projects to SparkleShare"); Header = _("Adding projects to SparkleShare");
Description = _("Just click this button when you see it on the web, and " + Description = _("You can do this through the status icon menu, or by clicking " +
"the project will be automatically added:"); "magic buttons on webpages that look like this:");
Label label = new Label (_("…or select <b>Add Hosted Project…</b> from the status icon menu " +
"to add one by hand.")) {
Wrap = true,
Xalign = 0,
UseMarkup = true
};
Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-4.png"); Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-4.png");
@ -574,12 +568,9 @@ namespace SparkleShare {
Controller.FinishPageCompleted (); Controller.FinishPageCompleted ();
}; };
// TODO: Add startup item checkbox here
VBox box = new VBox (false, 0); Add (slide);
box.Add (slide);
box.Add (label);
Add (box);
AddButton (finish_button); AddButton (finish_button);
break; break;

View file

@ -103,6 +103,7 @@ namespace SparkleShare {
private string saved_address = ""; private string saved_address = "";
private string saved_remote_path = ""; private string saved_remote_path = "";
private bool create_startup_item = true;
public SparkleSetupController () public SparkleSetupController ()
@ -209,14 +210,23 @@ namespace SparkleShare {
} }
public void StartupItemChanged (bool create_startup_item)
{
this.create_startup_item = create_startup_item;
}
public void TutorialPageCompleted () public void TutorialPageCompleted ()
{ {
TutorialPageNumber++; TutorialPageNumber++;
if (TutorialPageNumber == 4) { if (TutorialPageNumber == 5) {
if (HideWindowEvent != null) if (HideWindowEvent != null)
HideWindowEvent (); HideWindowEvent ();
if (this.create_startup_item)
Program.Controller.CreateStartupItem ();
} else { } else {
if (ChangePageEvent != null) if (ChangePageEvent != null)
ChangePageEvent (PageType.Tutorial, null); ChangePageEvent (PageType.Tutorial, null);
@ -264,7 +274,7 @@ namespace SparkleShare {
remote_path = remote_path.Trim (); remote_path = remote_path.Trim ();
if (selected_plugin == 0) if (selected_plugin == 0)
this.saved_address = address; this.saved_address = address;
this.saved_remote_path = remote_path; this.saved_remote_path = remote_path;

View file

@ -145,7 +145,7 @@ namespace SparkleShare {
public void AddHostedProjectClicked () public void AddHostedProjectClicked ()
{ {
Program.Controller.ShowSetupWindow (PageType.Add); Program.Controller.ShowSetupWindow (PageType.Tutorial);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB