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

View file

@ -45,8 +45,10 @@ namespace SparkleShare {
// Creates a .desktop entry in autostart folder to
// 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 (
Environment.SpecialFolder.ApplicationData), "autostart");

View file

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

View file

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

View file

@ -103,6 +103,7 @@ namespace SparkleShare {
private string saved_address = "";
private string saved_remote_path = "";
private bool create_startup_item = true;
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 ()
{
TutorialPageNumber++;
if (TutorialPageNumber == 4) {
if (TutorialPageNumber == 5) {
if (HideWindowEvent != null)
HideWindowEvent ();
if (this.create_startup_item)
Program.Controller.CreateStartupItem ();
} else {
if (ChangePageEvent != null)
ChangePageEvent (PageType.Tutorial, null);
@ -264,7 +274,7 @@ namespace SparkleShare {
remote_path = remote_path.Trim ();
if (selected_plugin == 0)
this.saved_address = address;
this.saved_address = address;
this.saved_remote_path = remote_path;

View file

@ -145,7 +145,7 @@ namespace SparkleShare {
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