Prettify linux about dialog
This commit is contained in:
parent
9d261cc740
commit
27629c067e
|
@ -13,7 +13,24 @@ endif
|
|||
|
||||
SOURCES = \
|
||||
SparkleAbout.cs \
|
||||
SparkleAboutController.cs
|
||||
SparkleAboutController.cs \
|
||||
SparkleBubbles.cs \
|
||||
SparkleBubblesController.cs \
|
||||
SparkleController.cs \
|
||||
SparkleEntry.cs \
|
||||
SparkleEventLog.cs \
|
||||
SparkleEventLogController.cs \
|
||||
SparkleInvitation.cs \
|
||||
SparkleLinController.cs \
|
||||
SparkleSetup.cs \
|
||||
SparkleSetupController.cs \
|
||||
SparkleSetupWindow.cs \
|
||||
SparkleShare.cs \
|
||||
SparkleSpinner.cs \
|
||||
SparkleStatusIcon.cs \
|
||||
SparkleStatusIconController.cs \
|
||||
SparkleUI.cs \
|
||||
SparkleUIHelpers.cs
|
||||
SparkleBubbles.cs \
|
||||
SparkleBubblesController.cs \
|
||||
SparkleController.cs \
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace SparkleShare {
|
|||
|
||||
public SparkleAboutController Controller = new SparkleAboutController ();
|
||||
|
||||
private Label version;
|
||||
private Label updates;
|
||||
|
||||
|
||||
// Short alias for the translations
|
||||
|
@ -41,33 +41,47 @@ namespace SparkleShare {
|
|||
|
||||
public SparkleAbout () : base ("")
|
||||
{
|
||||
DefaultSize = new Gdk.Size (640, 280);
|
||||
DefaultSize = new Gdk.Size (600, 260);
|
||||
Resizable = false;
|
||||
BorderWidth = 0;
|
||||
IconName = "folder-sparkleshare";
|
||||
WindowPosition = WindowPosition.Center;
|
||||
Title = _("About SparkleShare");
|
||||
Resizable = false;
|
||||
AppPaintable = true;
|
||||
|
||||
// TODO: Should be able to do without referencing SparkleLib...
|
||||
string image_path = SparkleLib.SparkleHelpers.CombineMore (SparkleLib.Defines.DATAROOTDIR,
|
||||
"sparkleshare", "pixmaps", "about.png");
|
||||
|
||||
Realize ();
|
||||
Gdk.Pixbuf buf = new Gdk.Pixbuf (image_path);
|
||||
Gdk.Pixmap map, map2;
|
||||
buf.RenderPixmapAndMask (out map, out map2, 255);
|
||||
GdkWindow.SetBackPixmap (map, false);
|
||||
|
||||
CreateAbout ();
|
||||
|
||||
Controller.NewVersionEvent += delegate (string new_version) {
|
||||
Application.Invoke (delegate {
|
||||
this.version.Markup = String.Format ("<small><span fgcolor='#f57900'>{0}: {1}</span></small>", _("A newer version is available!"), new_version);
|
||||
this.version.ShowAll ();
|
||||
this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#f57900'>{0}: {1}</span>",
|
||||
_("A newer version is available!"), new_version);
|
||||
this.updates.ShowAll ();
|
||||
});
|
||||
};
|
||||
|
||||
Controller.VersionUpToDateEvent += delegate {
|
||||
Application.Invoke (delegate {
|
||||
this.version.Markup = String.Format ("<small><span fgcolor='#4e9a06'>{0}</span></small>", _("You are running the latest version."));
|
||||
this.version.ShowAll ();
|
||||
this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#4e9a06'>{0}</span>",
|
||||
_("You are running the latest version."));
|
||||
this.updates.ShowAll ();
|
||||
});
|
||||
};
|
||||
|
||||
Controller.CheckingForNewVersionEvent += delegate {
|
||||
Application.Invoke (delegate {
|
||||
this.version.Markup = String.Format ("<small><span fgcolor='#4e9a06'>{0}</span></small>", _("Checking for updates..."));
|
||||
this.version.ShowAll ();
|
||||
this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#4e9a06'>{0}</span>",
|
||||
_("Checking for updates..."));
|
||||
this.updates.ShowAll ();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -78,48 +92,58 @@ namespace SparkleShare {
|
|||
Gdk.Color color = Style.Foreground (StateType.Insensitive);
|
||||
string secondary_text_color = SparkleUIHelpers.GdkColorToHex (color);
|
||||
|
||||
|
||||
Label header = new Label () {
|
||||
Markup = "<span fgcolor='" + secondary_text_color + "'>version " + Controller.RunningVersion + "</span>",
|
||||
Xalign = 0,
|
||||
Xpad = 18,
|
||||
Ypad = 18
|
||||
};
|
||||
|
||||
|
||||
this.version = new Label () {
|
||||
Markup = String.Format ("<small>{0}</small>", _("Checking for updates...")),
|
||||
Label version = new Label () {
|
||||
Markup = "<span font_size='small' fgcolor='white'>" +
|
||||
"version " + Controller.RunningVersion +
|
||||
"</span>",
|
||||
Xalign = 0,
|
||||
Xpad = 18,
|
||||
Ypad = 22,
|
||||
Xpad = 300
|
||||
};
|
||||
|
||||
this.updates = new Label () {
|
||||
Markup = "<span font_size='small' fgcolor='" + secondary_text_color + "'>" +
|
||||
_("Checking for updates...") +
|
||||
"</span>",
|
||||
Xalign = 0,
|
||||
Xpad = 300
|
||||
};
|
||||
|
||||
Label copyright = new Label () {
|
||||
Markup = "<span font_size='small' fgcolor='white'>" +
|
||||
"Copyright © 2010–" + DateTime.Now.Year + " " +
|
||||
"Hylke Bons and others." +
|
||||
"</span>",
|
||||
Xalign = 0,
|
||||
Xpad = 300
|
||||
};
|
||||
|
||||
Label license = new Label () {
|
||||
Xalign = 0,
|
||||
Xpad = 18,
|
||||
Ypad = 0,
|
||||
LineWrap = true,
|
||||
Wrap = true,
|
||||
LineWrapMode = Pango.WrapMode.Word,
|
||||
|
||||
Markup = "<small>Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others.\n" +
|
||||
"\n" +
|
||||
"SparkleShare is Free and Open Source Software. You are free to use, modify, " +
|
||||
"and redistribute it under the terms of the GNU General Public License " +
|
||||
"version 3 or later.</small>"
|
||||
Markup = "<span font_size='small' fgcolor='white'>" +
|
||||
"SparkleShare is Free and Open Source Software. You are free to use, modify, " +
|
||||
"and redistribute it under the GNU General Public License version 3 or later." +
|
||||
"</span>",
|
||||
WidthRequest = 330,
|
||||
Wrap = true,
|
||||
Xalign = 0,
|
||||
Xpad = 300,
|
||||
};
|
||||
|
||||
VBox vbox = new VBox (false, 0) {
|
||||
BorderWidth = 0
|
||||
VBox layout_horizontal = new VBox (false, 0) {
|
||||
BorderWidth = 0,
|
||||
HeightRequest = 260,
|
||||
WidthRequest = 640
|
||||
};
|
||||
|
||||
layout_horizontal.PackStart (new Label (""), false, false, 42);
|
||||
layout_horizontal.PackStart (version, false, false, 0);
|
||||
layout_horizontal.PackStart (this.updates, false, false, 0);
|
||||
layout_horizontal.PackStart (copyright, false, false, 9);
|
||||
layout_horizontal.PackStart (license, false, false, 0);
|
||||
layout_horizontal.PackStart (new Label (""), false, false, 0);
|
||||
|
||||
|
||||
vbox.PackStart (header, true, true, 0);
|
||||
vbox.PackStart (this.version, false, false, 0);
|
||||
vbox.PackStart (license, true, true, 0);
|
||||
|
||||
Add (vbox);
|
||||
Add (layout_horizontal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,14 +31,14 @@ namespace SparkleShare {
|
|||
{
|
||||
Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) {
|
||||
Notification notification = new Notification () {
|
||||
Timeout = 5 * 1000;
|
||||
Urgency = Urgency.Low;
|
||||
}
|
||||
Timeout = 5 * 1000,
|
||||
Urgency = Urgency.Low
|
||||
};
|
||||
|
||||
if (image_path != null)
|
||||
Icon = new Gdk.Pixbuf (image_path);
|
||||
notification.Icon = new Gdk.Pixbuf (image_path);
|
||||
else
|
||||
IconName = "folder-sparkleshare";
|
||||
notification.IconName = "folder-sparkleshare";
|
||||
|
||||
notification.Show ();
|
||||
};
|
||||
|
|
|
@ -24,22 +24,26 @@ using System.Collections.Generic;
|
|||
|
||||
using Gtk;
|
||||
using Mono.Unix;
|
||||
using Notifications;
|
||||
|
||||
|
||||
namespace SparkleShare {
|
||||
|
||||
public class SparkleIntro : SparkleWindow {
|
||||
public class SparkleSetup : SparkleSetupWindow {
|
||||
|
||||
public SparkleSetupController Controller = new SparkleSetupController ();
|
||||
|
||||
private string SecondaryTextColor;
|
||||
|
||||
private Entry NameEntry;
|
||||
private Entry EmailEntry;
|
||||
private SparkleEntry ServerEntry;
|
||||
private SparkleEntry FolderEntry;
|
||||
private string PreviousServer;
|
||||
private string PreviousFolder;
|
||||
|
||||
private Button NextButton;
|
||||
private Button SyncButton;
|
||||
private bool ServerFormOnly;
|
||||
private string SecondaryTextColor;
|
||||
|
||||
private Table Table;
|
||||
|
||||
private ProgressBar progress_bar = new ProgressBar () { PulseStep = 0.01 };
|
||||
private Timer progress_bar_pulse_timer = new Timer () { Interval = 25, Enabled = true };
|
||||
|
||||
|
@ -51,601 +55,350 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
public SparkleIntro () : base ()
|
||||
public SparkleSetup () : base ()
|
||||
{
|
||||
ServerFormOnly = false;
|
||||
SecondaryTextColor = SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive));
|
||||
}
|
||||
|
||||
|
||||
public void ShowAccountForm ()
|
||||
{
|
||||
Reset ();
|
||||
Controller.ChangePageEvent += delegate (PageType type) {
|
||||
Application.Invoke (delegate {
|
||||
Reset ();
|
||||
|
||||
VBox layout_vertical = new VBox (false, 0);
|
||||
|
||||
Deletable = false;
|
||||
switch (type) {
|
||||
case PageType.Setup:
|
||||
|
||||
Label header = new Label ("<span size='large'><b>" +
|
||||
_("Welcome to SparkleShare!") +
|
||||
"</b></span>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
Header = _("Welcome to SparkleShare!");
|
||||
Description = _("Before we can create a SparkleShare folder on this " +
|
||||
"computer, we need a few bits of information from you.");
|
||||
|
||||
Label information = new Label (_("Before we can create a SparkleShare folder on this " +
|
||||
"computer, we need a few bits of information from you.")) {
|
||||
Xalign = 0,
|
||||
Wrap = true
|
||||
};
|
||||
|
||||
Table table = new Table (4, 2, true) {
|
||||
RowSpacing = 6
|
||||
};
|
||||
|
||||
Label name_label = new Label ("<b>" + _("Full Name:") + "</b>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
NameEntry = new Entry (SparkleShare.Controller.UserName);
|
||||
NameEntry.Changed += delegate {
|
||||
CheckAccountForm ();
|
||||
};
|
||||
|
||||
EmailEntry = new Entry ();
|
||||
EmailEntry.Changed += delegate {
|
||||
CheckAccountForm ();
|
||||
};
|
||||
|
||||
Label email_label = new Label ("<b>" + _("Email:") + "</b>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
|
||||
table.Attach (name_label, 0, 1, 0, 1);
|
||||
table.Attach (NameEntry, 1, 2, 0, 1);
|
||||
table.Attach (email_label, 0, 1, 1, 2);
|
||||
table.Attach (EmailEntry, 1, 2, 1, 2);
|
||||
|
||||
NextButton = new Button (_("Next")) {
|
||||
Sensitive = false
|
||||
};
|
||||
|
||||
NextButton.Clicked += delegate (object o, EventArgs args) {
|
||||
NextButton.Remove (NextButton.Child);
|
||||
NextButton.Add (new Label (_("Configuring…")));
|
||||
|
||||
NextButton.Sensitive = false;
|
||||
table.Sensitive = false;
|
||||
|
||||
NextButton.ShowAll ();
|
||||
|
||||
SparkleShare.Controller.UserName = NameEntry.Text;
|
||||
SparkleShare.Controller.UserEmail = EmailEntry.Text;
|
||||
|
||||
SparkleShare.Controller.GenerateKeyPair ();
|
||||
SparkleShare.Controller.AddKey ();
|
||||
|
||||
SparkleUI.StatusIcon.CreateMenu ();
|
||||
|
||||
Deletable = true;
|
||||
ShowServerForm ();
|
||||
};
|
||||
|
||||
AddButton (NextButton);
|
||||
|
||||
layout_vertical.PackStart (header, false, false, 0);
|
||||
layout_vertical.PackStart (information, false, false, 21);
|
||||
layout_vertical.PackStart (new Label (""), false, false, 0);
|
||||
layout_vertical.PackStart (table, false, false, 0);
|
||||
|
||||
Add (layout_vertical);
|
||||
CheckAccountForm ();
|
||||
ShowAll ();
|
||||
}
|
||||
|
||||
|
||||
public void ShowServerForm (bool server_form_only)
|
||||
{
|
||||
ServerFormOnly = server_form_only;
|
||||
ShowServerForm ();
|
||||
}
|
||||
|
||||
|
||||
public void ShowServerForm ()
|
||||
{
|
||||
Reset ();
|
||||
|
||||
VBox layout_vertical = new VBox (false, 0);
|
||||
|
||||
Label header = new Label ("<span size='large'><b>" +
|
||||
_("Where is your remote folder?") +
|
||||
"</b></span>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
Table table = new Table (7, 2, false) {
|
||||
RowSpacing = 12
|
||||
};
|
||||
|
||||
HBox layout_server = new HBox (true, 0);
|
||||
|
||||
ServerEntry = new SparkleEntry () { };
|
||||
ServerEntry.Completion = new EntryCompletion();
|
||||
ServerEntry.Completion.Model = ServerEntryCompletion();
|
||||
ServerEntry.Completion.TextColumn = 0;
|
||||
|
||||
if (PreviousServer != null) {
|
||||
ServerEntry.Text = PreviousServer;
|
||||
ServerEntry.ExampleTextActive = false;
|
||||
} else
|
||||
ServerEntry.ExampleText = _("address-to-server.com");
|
||||
|
||||
ServerEntry.Changed += CheckServerForm;
|
||||
|
||||
RadioButton radio_button = new RadioButton ("<b>" + _("On my own server:") + "</b>");
|
||||
|
||||
layout_server.Add (radio_button);
|
||||
layout_server.Add (ServerEntry);
|
||||
|
||||
string github_text = "<b>" + "Github" + "</b>\n" +
|
||||
"<span fgcolor='" + SecondaryTextColor + "' size='small'>" +
|
||||
_("Free hosting for Free and Open Source Software projects.") + "\n" +
|
||||
_("Also has paid accounts for extra private space and bandwidth.") +
|
||||
"</span>";
|
||||
|
||||
RadioButton radio_button_github = new RadioButton (radio_button, github_text);
|
||||
|
||||
(radio_button_github.Child as Label).UseMarkup = true;
|
||||
(radio_button_github.Child as Label).Wrap = true;
|
||||
|
||||
string gnome_text = "<b>" + _("The GNOME Project") + "</b>\n" +
|
||||
"<span fgcolor='" + SecondaryTextColor + "' size='small'>" +
|
||||
_("GNOME is an easy to understand interface to your computer.") + "\n" +
|
||||
_("Select this option if you’re a developer or designer working on GNOME.") +
|
||||
"</span>";
|
||||
|
||||
RadioButton radio_button_gnome = new RadioButton (radio_button, gnome_text);
|
||||
|
||||
(radio_button_gnome.Child as Label).UseMarkup = true;
|
||||
(radio_button_gnome.Child as Label).Wrap = true;
|
||||
|
||||
string gitorious_text = "<b>" + _("Gitorious") + "</b>\n" +
|
||||
"<span fgcolor='" + SecondaryTextColor + "' size='small'>" +
|
||||
_("Completely Free as in Freedom infrastructure.") + "\n" +
|
||||
_("Free accounts for Free and Open Source projects.") +
|
||||
"</span>";
|
||||
RadioButton radio_button_gitorious = new RadioButton (radio_button, gitorious_text) {
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
(radio_button_gitorious.Child as Label).UseMarkup = true;
|
||||
(radio_button_gitorious.Child as Label).Wrap = true;
|
||||
|
||||
radio_button_github.Toggled += delegate {
|
||||
if (radio_button_github.Active)
|
||||
FolderEntry.ExampleText = _("Username/Folder");
|
||||
};
|
||||
|
||||
radio_button_gitorious.Toggled += delegate {
|
||||
if (radio_button_gitorious.Active)
|
||||
FolderEntry.ExampleText = _("Project/Folder");
|
||||
};
|
||||
|
||||
radio_button_gnome.Toggled += delegate {
|
||||
if (radio_button_gnome.Active)
|
||||
FolderEntry.ExampleText = _("Project");
|
||||
};
|
||||
|
||||
radio_button.Toggled += delegate {
|
||||
if (radio_button.Active) {
|
||||
FolderEntry.ExampleText = _("Folder");
|
||||
ServerEntry.Sensitive = true;
|
||||
CheckServerForm ();
|
||||
} else {
|
||||
ServerEntry.Sensitive = false;
|
||||
CheckServerForm ();
|
||||
}
|
||||
|
||||
ShowAll ();
|
||||
};
|
||||
|
||||
table.Attach (layout_server, 0, 2, 1, 2);
|
||||
table.Attach (radio_button_github, 0, 2, 2, 3);
|
||||
table.Attach (radio_button_gitorious, 0, 2, 3, 4);
|
||||
table.Attach (radio_button_gnome, 0, 2, 4, 5);
|
||||
|
||||
HBox layout_folder = new HBox (true, 0);
|
||||
|
||||
FolderEntry = new SparkleEntry () { };
|
||||
FolderEntry.Completion = new EntryCompletion();
|
||||
FolderEntry.Completion.Model = FolderEntryCompletion();
|
||||
FolderEntry.Completion.TextColumn = 0;
|
||||
|
||||
if (PreviousFolder != null) {
|
||||
FolderEntry.Text = PreviousFolder;
|
||||
FolderEntry.ExampleTextActive = false;
|
||||
} else
|
||||
FolderEntry.ExampleText = _("Folder");
|
||||
|
||||
FolderEntry.Changed += CheckServerForm;
|
||||
|
||||
Label folder_label = new Label (_("Folder Name:")) {
|
||||
UseMarkup = true,
|
||||
Xalign = 1
|
||||
};
|
||||
|
||||
(radio_button.Child as Label).UseMarkup = true;
|
||||
|
||||
layout_folder.PackStart (folder_label, true, true, 12);
|
||||
layout_folder.PackStart (FolderEntry, true, true, 0);
|
||||
|
||||
SyncButton = new Button (_("Sync"));
|
||||
|
||||
SyncButton.Clicked += delegate {
|
||||
string folder_name = FolderEntry.Text;
|
||||
string server = ServerEntry.Text;
|
||||
string canonical_name = System.IO.Path.GetFileNameWithoutExtension (folder_name);
|
||||
|
||||
PreviousServer = ServerEntry.Text;
|
||||
PreviousFolder = FolderEntry.Text;
|
||||
|
||||
if (radio_button_gitorious.Active)
|
||||
server = "gitorious.org";
|
||||
|
||||
if (radio_button_github.Active)
|
||||
server = "github.com";
|
||||
|
||||
if (radio_button_gnome.Active)
|
||||
server = "gnome.org";
|
||||
|
||||
Application.Invoke (delegate {
|
||||
Deletable = false;
|
||||
ShowSyncingPage (canonical_name);
|
||||
});
|
||||
|
||||
SparkleShare.Controller.FolderFetched += delegate {
|
||||
Application.Invoke (delegate {
|
||||
this.progress_bar_pulse_timer.Stop ();
|
||||
Deletable = true;
|
||||
UrgencyHint = true;
|
||||
ShowSuccessPage (canonical_name);
|
||||
});
|
||||
};
|
||||
|
||||
SparkleShare.Controller.FolderFetchError += delegate {
|
||||
Application.Invoke (delegate {
|
||||
this.progress_bar_pulse_timer.Stop ();
|
||||
Deletable = true;
|
||||
ShowErrorPage ();
|
||||
});
|
||||
Table = new Table (4, 2, true) {
|
||||
RowSpacing = 6
|
||||
};
|
||||
|
||||
SparkleShare.Controller.FetchFolder (server, folder_name);
|
||||
};
|
||||
Label name_label = new Label ("<b>" + _("Full Name:") + "</b>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
NameEntry = new Entry (SparkleShare.Controller.UserName);
|
||||
NameEntry.Changed += delegate {
|
||||
CheckSetupPage ();
|
||||
};
|
||||
|
||||
if (ServerFormOnly) {
|
||||
Button cancel_button = new Button (_("Cancel"));
|
||||
EmailEntry = new Entry ();
|
||||
EmailEntry.Changed += delegate {
|
||||
CheckSetupPage ();
|
||||
};
|
||||
|
||||
cancel_button.Clicked += delegate {
|
||||
Close ();
|
||||
};
|
||||
Label email_label = new Label ("<b>" + _("Email:") + "</b>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
AddButton (cancel_button);
|
||||
} else {
|
||||
Button skip_button = new Button (_("Skip"));
|
||||
Table.Attach (name_label, 0, 1, 0, 1);
|
||||
Table.Attach (NameEntry, 1, 2, 0, 1);
|
||||
Table.Attach (email_label, 0, 1, 1, 2);
|
||||
Table.Attach (EmailEntry, 1, 2, 1, 2);
|
||||
|
||||
skip_button.Clicked += delegate {
|
||||
ShowCompletedPage ();
|
||||
};
|
||||
NextButton = new Button (_("Next")) {
|
||||
Sensitive = false
|
||||
};
|
||||
|
||||
AddButton (skip_button);
|
||||
}
|
||||
NextButton.Clicked += delegate (object o, EventArgs args) {
|
||||
string full_name = NameEntry.Text;
|
||||
string email = EmailEntry.Text;
|
||||
|
||||
AddButton (SyncButton);
|
||||
Controller.SetupPageCompleted (full_name, email);
|
||||
};
|
||||
|
||||
layout_vertical.PackStart (header, false, false, 0);
|
||||
layout_vertical.PackStart (new Label (""), false, false, 3);
|
||||
layout_vertical.PackStart (table, false, false, 0);
|
||||
layout_vertical.PackStart (layout_folder, false, false, 6);
|
||||
AddButton (NextButton);
|
||||
Add (Table);
|
||||
|
||||
Add (layout_vertical);
|
||||
CheckServerForm ();
|
||||
ShowAll ();
|
||||
}
|
||||
CheckSetupPage ();
|
||||
|
||||
break;
|
||||
|
||||
public void ShowInvitationPage (string server, string folder, string token)
|
||||
{
|
||||
VBox layout_vertical = new VBox (false, 0);
|
||||
case PageType.Add:
|
||||
|
||||
Label header = new Label ("<span size='large'><b>" +
|
||||
_("Invitation received!") +
|
||||
"</b></span>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
Header = _("Where is your remote folder?");
|
||||
|
||||
Label information = new Label (_("You've received an invitation to join a shared folder.\n" +
|
||||
"We're ready to hook you up immediately if you wish.")) {
|
||||
Xalign = 0,
|
||||
Wrap = true
|
||||
};
|
||||
|
||||
Label question = new Label (_("Do you accept this invitation?")) {
|
||||
Xalign = 0,
|
||||
Wrap = true
|
||||
};
|
||||
|
||||
Table table = new Table (2, 2, false) {
|
||||
RowSpacing = 6
|
||||
};
|
||||
|
||||
Label server_label = new Label (_("Server Address:")) {
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
Label server_text = new Label ("<b>" + server + "</b>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
Label folder_label = new Label (_("Folder Name:")) {
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
Label folder_text = new Label ("<b>" + folder + "</b>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
table.Attach (folder_label, 0, 1, 0, 1);
|
||||
table.Attach (folder_text, 1, 2, 0, 1);
|
||||
table.Attach (server_label, 0, 1, 1, 2);
|
||||
table.Attach (server_text, 1, 2, 1, 2);
|
||||
|
||||
Button reject_button = new Button (_("Reject"));
|
||||
Button accept_button = new Button (_("Accept and Sync"));
|
||||
|
||||
reject_button.Clicked += delegate {
|
||||
Close ();
|
||||
};
|
||||
|
||||
accept_button.Clicked += delegate {
|
||||
string url = "ssh://git@" + server + "/" + folder;
|
||||
if (server.StartsWith("http")) {
|
||||
url = server;
|
||||
}
|
||||
|
||||
SparkleShare.Controller.FolderFetched += delegate {
|
||||
Application.Invoke (delegate {
|
||||
this.progress_bar_pulse_timer.Stop ();
|
||||
ShowSuccessPage (folder);
|
||||
});
|
||||
};
|
||||
|
||||
SparkleShare.Controller.FolderFetchError += delegate {
|
||||
Application.Invoke (delegate {
|
||||
this.progress_bar_pulse_timer.Stop ();
|
||||
ShowErrorPage ();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
SparkleShare.Controller.FetchFolder (url, folder);
|
||||
};
|
||||
|
||||
AddButton (reject_button);
|
||||
AddButton (accept_button);
|
||||
|
||||
layout_vertical.PackStart (header, false, false, 0);
|
||||
layout_vertical.PackStart (information, false, false, 21);
|
||||
layout_vertical.PackStart (new Label (""), false, false, 0);
|
||||
layout_vertical.PackStart (table, false, false, 0);
|
||||
layout_vertical.PackStart (new Label (""), false, false, 0);
|
||||
layout_vertical.PackStart (question, false, false, 21);
|
||||
|
||||
Add (layout_vertical);
|
||||
ShowAll ();
|
||||
}
|
||||
|
||||
|
||||
// The page shown when syncing has failed
|
||||
private void ShowErrorPage ()
|
||||
{
|
||||
Reset ();
|
||||
|
||||
VBox layout_vertical = new VBox (false, 0);
|
||||
|
||||
Label header = new Label ("<span size='large'><b>" +
|
||||
_("Something went wrong…") +
|
||||
"</b></span>\n") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
Button try_again_button = new Button (_("Try Again")) {
|
||||
Sensitive = true
|
||||
};
|
||||
|
||||
try_again_button.Clicked += delegate (object o, EventArgs args) {
|
||||
ShowServerForm ();
|
||||
};
|
||||
|
||||
AddButton (try_again_button);
|
||||
|
||||
layout_vertical.PackStart (header, false, false, 0);
|
||||
|
||||
Add (layout_vertical);
|
||||
ShowAll ();
|
||||
}
|
||||
|
||||
|
||||
// The page shown when syncing has succeeded
|
||||
private void ShowSuccessPage (string folder_name)
|
||||
{
|
||||
Reset ();
|
||||
|
||||
UrgencyHint = true;
|
||||
|
||||
PreviousServer = null;
|
||||
PreviousFolder = null;
|
||||
|
||||
if (!HasToplevelFocus) {
|
||||
string title = String.Format (_("‘{0}’ has been successfully added"), folder_name);
|
||||
string subtext = _("");
|
||||
|
||||
new SparkleBubble (title, subtext).Show ();
|
||||
}
|
||||
|
||||
VBox layout_vertical = new VBox (false, 0);
|
||||
|
||||
Label header = new Label ("<span size='large'><b>" +
|
||||
_("Folder synced successfully!") +
|
||||
"</b></span>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
Label information = new Label (
|
||||
String.Format (_("Now you can access the synced files from ‘{0}’ in your SparkleShare folder."),
|
||||
folder_name)) {
|
||||
Xalign = 0,
|
||||
Wrap = true,
|
||||
UseMarkup = true
|
||||
};
|
||||
|
||||
// A button that opens the synced folder
|
||||
Button open_folder_button = new Button (_("Open Folder"));
|
||||
|
||||
open_folder_button.Clicked += delegate {
|
||||
SparkleShare.Controller.OpenSparkleShareFolder (folder_name);
|
||||
Table = new Table (6, 2, false) {
|
||||
RowSpacing = 12
|
||||
};
|
||||
|
||||
Button finish_button = new Button (_("Finish"));
|
||||
|
||||
finish_button.Clicked += delegate (object o, EventArgs args) {
|
||||
Close ();
|
||||
};
|
||||
|
||||
AddButton (open_folder_button);
|
||||
AddButton (finish_button);
|
||||
HBox layout_server = new HBox (true, 0);
|
||||
|
||||
layout_vertical.PackStart (header, false, false, 0);
|
||||
layout_vertical.PackStart (information, false, false, 21);
|
||||
// Own server radiobutton
|
||||
RadioButton radio_button = new RadioButton ("<b>" + _("On my own server:") + "</b>");
|
||||
(radio_button.Child as Label).UseMarkup = true;
|
||||
|
||||
Add (layout_vertical);
|
||||
ShowAll ();
|
||||
}
|
||||
radio_button.Toggled += delegate {
|
||||
if (radio_button.Active) {
|
||||
FolderEntry.ExampleText = _("Folder");
|
||||
ServerEntry.Sensitive = true;
|
||||
CheckAddPage ();
|
||||
} else {
|
||||
ServerEntry.Sensitive = false;
|
||||
CheckAddPage ();
|
||||
}
|
||||
|
||||
ShowAll ();
|
||||
};
|
||||
|
||||
// Own server entry
|
||||
ServerEntry = new SparkleEntry () { };
|
||||
ServerEntry.Completion = new EntryCompletion();
|
||||
|
||||
ListStore server_store = new ListStore (typeof (string));
|
||||
|
||||
//TODO foreach (string host in SparkleShare.Controller.PreviousHosts)
|
||||
// server_store.AppendValues (host);
|
||||
|
||||
ServerEntry.Completion.Model = server_store;
|
||||
ServerEntry.Completion.TextColumn = 0;
|
||||
|
||||
if (!string.IsNullOrEmpty (Controller.PreviousServer)) {
|
||||
ServerEntry.Text = Controller.PreviousServer;
|
||||
ServerEntry.ExampleTextActive = false;
|
||||
} else {
|
||||
ServerEntry.ExampleText = _("address-to-server.com");
|
||||
}
|
||||
|
||||
ServerEntry.Changed += delegate {
|
||||
CheckAddPage ();
|
||||
};
|
||||
|
||||
layout_server.Add (radio_button);
|
||||
layout_server.Add (ServerEntry);
|
||||
|
||||
Table.Attach (layout_server, 0, 2, 1, 2);
|
||||
|
||||
// Github radiobutton
|
||||
string github_text = "<b>" + "Github" + "</b>\n" +
|
||||
"<span fgcolor='" + SecondaryTextColor + "' size='small'>" +
|
||||
_("Free hosting for Free and Open Source Software projects.") + "\n" +
|
||||
_("Also has paid accounts for extra private space and bandwidth.") +
|
||||
"</span>";
|
||||
|
||||
RadioButton radio_button_github = new RadioButton (radio_button, github_text);
|
||||
(radio_button_github.Child as Label).UseMarkup = true;
|
||||
(radio_button_github.Child as Label).Wrap = true;
|
||||
|
||||
radio_button_github.Toggled += delegate {
|
||||
if (radio_button_github.Active)
|
||||
FolderEntry.ExampleText = _("Username/Folder");
|
||||
};
|
||||
|
||||
|
||||
// The page shown whilst syncing
|
||||
private void ShowSyncingPage (string name)
|
||||
{
|
||||
Reset ();
|
||||
// Gitorious radiobutton
|
||||
string gitorious_text = "<b>" + _("Gitorious") + "</b>\n" +
|
||||
"<span fgcolor='" + SecondaryTextColor + "' size='small'>" +
|
||||
_("Completely Free as in Freedom infrastructure.") + "\n" +
|
||||
_("Free accounts for Free and Open Source projects.") +
|
||||
"</span>";
|
||||
|
||||
VBox layout_vertical = new VBox (false, 0);
|
||||
RadioButton radio_button_gitorious = new RadioButton (radio_button, gitorious_text);
|
||||
(radio_button_gitorious.Child as Label).UseMarkup = true;
|
||||
(radio_button_gitorious.Child as Label).Wrap = true;
|
||||
|
||||
Label header = new Label ("<span size='large'><b>" +
|
||||
String.Format (_("Syncing folder ‘{0}’…"), name) +
|
||||
"</b></span>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0,
|
||||
Wrap = true
|
||||
};
|
||||
radio_button_gitorious.Toggled += delegate {
|
||||
if (radio_button_gitorious.Active)
|
||||
FolderEntry.ExampleText = _("Project/Folder");
|
||||
};
|
||||
|
||||
Label information = new Label (_("This may take a while.\n") +
|
||||
_("Are you sure it’s not coffee o'clock?")) {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
// GNOME radiobutton
|
||||
string gnome_text = "<b>" + _("The GNOME Project") + "</b>\n"+
|
||||
"<span fgcolor='" + SecondaryTextColor + "' size='small'>" +
|
||||
_("GNOME is an easy to understand interface to your computer.") + "\n" +
|
||||
_("Select this option if you’re a developer or designer working on GNOME.") +
|
||||
"</span>";
|
||||
|
||||
RadioButton radio_button_gnome = new RadioButton (radio_button, gnome_text);
|
||||
(radio_button_gnome.Child as Label).UseMarkup = true;
|
||||
(radio_button_gnome.Child as Label).Wrap = true;
|
||||
|
||||
radio_button_gnome.Toggled += delegate {
|
||||
if (radio_button_gnome.Active)
|
||||
FolderEntry.ExampleText = _("Project");
|
||||
};
|
||||
|
||||
Table.Attach (radio_button_github, 0, 2, 2, 3);
|
||||
Table.Attach (radio_button_gitorious, 0, 2, 3, 4);
|
||||
Table.Attach (radio_button_gnome, 0, 2, 4, 5);
|
||||
|
||||
// Folder label and entry
|
||||
HBox layout_folder = new HBox (true, 0);
|
||||
|
||||
Label folder_label = new Label (_("Folder Name:")) {
|
||||
UseMarkup = true,
|
||||
Xalign = 1
|
||||
};
|
||||
|
||||
FolderEntry = new SparkleEntry ();
|
||||
FolderEntry.ExampleText = _("Folder");
|
||||
|
||||
FolderEntry.Changed += delegate {
|
||||
CheckAddPage ();
|
||||
};
|
||||
|
||||
layout_folder.PackStart (folder_label, true, true, 12);
|
||||
layout_folder.PackStart (FolderEntry, true, true, 0);
|
||||
|
||||
Table.Attach (layout_folder, 0, 2, 5, 6);
|
||||
Add (Table);
|
||||
|
||||
// Cancel button
|
||||
Button cancel_button = new Button (_("Cancel"));
|
||||
|
||||
cancel_button.Clicked += delegate {
|
||||
Close ();
|
||||
};
|
||||
|
||||
|
||||
// Sync button
|
||||
SyncButton = new Button (_("Sync"));
|
||||
|
||||
SyncButton.Clicked += delegate {
|
||||
string server = ServerEntry.Text;
|
||||
string folder_name = FolderEntry.Text;
|
||||
|
||||
if (radio_button_gitorious.Active)
|
||||
server = "gitorious.org";
|
||||
|
||||
if (radio_button_github.Active)
|
||||
server = "github.com";
|
||||
|
||||
if (radio_button_gnome.Active)
|
||||
server = "gnome.org";
|
||||
|
||||
Controller.AddPageCompleted (server, folder_name);
|
||||
};
|
||||
|
||||
AddButton (cancel_button);
|
||||
AddButton (SyncButton);
|
||||
|
||||
CheckAddPage ();
|
||||
|
||||
break;
|
||||
|
||||
case PageType.Syncing:
|
||||
|
||||
Header = String.Format (_("Syncing folder ‘{0}’…"), Controller.SyncingFolder);
|
||||
Description = _("This may take a while." + Environment.NewLine) +
|
||||
_("Are you sure it’s not coffee o'clock?");
|
||||
|
||||
Button button = new Button () {
|
||||
Sensitive = false,
|
||||
Label = _("Finish")
|
||||
};
|
||||
|
||||
|
||||
button.Clicked += delegate {
|
||||
Close ();
|
||||
};
|
||||
|
||||
AddButton (button);
|
||||
AddButton (button);
|
||||
|
||||
layout_vertical.PackStart (header, false, false, 0);
|
||||
layout_vertical.PackStart (information, false, false, 21);
|
||||
this.progress_bar_pulse_timer.Elapsed += delegate {
|
||||
Application.Invoke (delegate {
|
||||
progress_bar.Pulse ();
|
||||
});
|
||||
};
|
||||
|
||||
this.progress_bar_pulse_timer.Elapsed += delegate {
|
||||
Application.Invoke (delegate {
|
||||
progress_bar.Pulse ();
|
||||
});
|
||||
};
|
||||
if (this.progress_bar.Parent != null)
|
||||
(this.progress_bar.Parent as Container).Remove (this.progress_bar);
|
||||
|
||||
if (this.progress_bar.Parent != null)
|
||||
layout_vertical.Reparent(this.progress_bar);
|
||||
VBox bar_wrapper = new VBox (false , 0);
|
||||
bar_wrapper.PackStart (this.progress_bar, false, false, 0);
|
||||
|
||||
layout_vertical.PackStart (this.progress_bar, false, false, 54);
|
||||
Add (bar_wrapper);
|
||||
|
||||
break;
|
||||
|
||||
case PageType.Error:
|
||||
|
||||
string n = Environment.NewLine;
|
||||
|
||||
Header = _("Something went wrong") + "…";
|
||||
Description = "We don't know exactly what the problem is, " +
|
||||
"but we can try to help you pinpoint it.";
|
||||
|
||||
|
||||
Label l = new Label (
|
||||
"First, have you tried turning it off and on again?" + n +
|
||||
n +
|
||||
Controller.SyncingFolder +" is the address we've compiled from the information " +
|
||||
"you entered. Does this look correct?" + n +
|
||||
n +
|
||||
"The host needs to know who you are. Have you uploaded the key that sits in your SparkleShare folder?");
|
||||
|
||||
|
||||
|
||||
l.Xpad = 12;
|
||||
l.Wrap = true;
|
||||
|
||||
|
||||
|
||||
Button try_again_button = new Button (_("Try Again")) {
|
||||
Sensitive = true
|
||||
};
|
||||
|
||||
try_again_button.Clicked += delegate {
|
||||
Controller.ErrorPageCompleted ();
|
||||
};
|
||||
|
||||
AddButton (try_again_button);
|
||||
Add (l);
|
||||
|
||||
break;
|
||||
|
||||
case PageType.Finished:
|
||||
|
||||
UrgencyHint = true;
|
||||
|
||||
if (!HasToplevelFocus) {
|
||||
string title = String.Format (_("‘{0}’ has been successfully added"), Controller.SyncingFolder);
|
||||
string subtext = _("");
|
||||
|
||||
//TODO new SparkleBubble (title, subtext).Show ();
|
||||
}
|
||||
|
||||
Header = _("Folder synced successfully!");
|
||||
Description = _("Access the synced files from your SparkleShare folder.");
|
||||
|
||||
// A button that opens the synced folder
|
||||
Button open_folder_button = new Button (_("Open Folder"));
|
||||
|
||||
open_folder_button.Clicked += delegate {
|
||||
SparkleShare.Controller.OpenSparkleShareFolder (Controller.SyncingFolder);
|
||||
};
|
||||
|
||||
Button finish_button = new Button (_("Finish"));
|
||||
|
||||
finish_button.Clicked += delegate {
|
||||
Close ();
|
||||
};
|
||||
|
||||
Add (null);
|
||||
|
||||
AddButton (open_folder_button);
|
||||
AddButton (finish_button);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ShowAll ();
|
||||
});
|
||||
};
|
||||
|
||||
Add (layout_vertical);
|
||||
ShowAll ();
|
||||
}
|
||||
|
||||
|
||||
// The page shown when the setup has been completed
|
||||
private void ShowCompletedPage ()
|
||||
{
|
||||
Reset ();
|
||||
|
||||
VBox layout_vertical = new VBox (false, 0);
|
||||
|
||||
Label header = new Label ("<span size='large'><b>" +
|
||||
_("SparkleShare is ready to go!") +
|
||||
"</b></span>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
Label information = new Label (_("Now you can start accepting invitations from others. " + "\n" +
|
||||
"Just click on invitations you get by email and " +
|
||||
"we will take care of the rest.")) {
|
||||
UseMarkup = true,
|
||||
Wrap = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
|
||||
HBox link_wrapper = new HBox (false, 0);
|
||||
LinkButton link = new LinkButton ("http://www.sparkleshare.org/",
|
||||
_("Learn how to host your own SparkleServer"));
|
||||
|
||||
link_wrapper.PackStart (link, false, false, 0);
|
||||
|
||||
layout_vertical.PackStart (header, false, false, 0);
|
||||
layout_vertical.PackStart (information, false, false, 21);
|
||||
layout_vertical.PackStart (link_wrapper, false, false, 0);
|
||||
|
||||
Button finish_button = new Button (_("Finish"));
|
||||
|
||||
finish_button.Clicked += delegate (object o, EventArgs args) {
|
||||
Close ();
|
||||
};
|
||||
|
||||
AddButton (finish_button);
|
||||
|
||||
Add (layout_vertical);
|
||||
ShowAll ();
|
||||
}
|
||||
|
||||
|
||||
// Enables or disables the 'Next' button depending on the
|
||||
// Enables or disables the 'Next' button depending on the
|
||||
// entries filled in by the user
|
||||
private void CheckAccountForm ()
|
||||
private void CheckSetupPage ()
|
||||
{
|
||||
if (NameEntry.Text.Length > 0 &&
|
||||
IsValidEmail (EmailEntry.Text)) {
|
||||
SparkleShare.Controller.IsValidEmail (EmailEntry.Text)) {
|
||||
|
||||
NextButton.Sensitive = true;
|
||||
} else {
|
||||
|
@ -654,17 +407,9 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
// Enables the Add button when the fields are
|
||||
// filled in correctly
|
||||
public void CheckServerForm (object o, EventArgs args)
|
||||
{
|
||||
CheckServerForm ();
|
||||
}
|
||||
|
||||
|
||||
// Enables the Add button when the fields are
|
||||
// filled in correctly
|
||||
public void CheckServerForm ()
|
||||
// Enables or disables the 'Next' button depending on the
|
||||
// entries filled in by the user
|
||||
public void CheckAddPage ()
|
||||
{
|
||||
SyncButton.Sensitive = false;
|
||||
|
||||
|
@ -683,39 +428,5 @@ namespace SparkleShare {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private TreeModel ServerEntryCompletion ()
|
||||
{
|
||||
List<string> hosts = SparkleShare.Controller.PreviousHosts;
|
||||
|
||||
ListStore store = new ListStore (typeof (string));
|
||||
store.AppendValues ("user@localhost");
|
||||
store.AppendValues ("user@example.com");
|
||||
|
||||
foreach (string host in hosts)
|
||||
store.AppendValues (host);
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
|
||||
private TreeModel FolderEntryCompletion ()
|
||||
{
|
||||
ListStore store = new ListStore (typeof (string));
|
||||
store.AppendValues ("~/test.git");
|
||||
|
||||
foreach (string folder in SparkleShare.Controller.Folders)
|
||||
store.AppendValues (folder);
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
|
||||
// Checks to see if an email address is valid
|
||||
private bool IsValidEmail (string email)
|
||||
{
|
||||
Regex regex = new Regex (@"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$", RegexOptions.IgnoreCase);
|
||||
return regex.IsMatch (email);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,412 +0,0 @@
|
|||
// SparkleShare, a collaboration and sharing tool.
|
||||
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General private License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General private License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General private License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Timers;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Gtk;
|
||||
using Mono.Unix;
|
||||
|
||||
|
||||
namespace SparkleShare {
|
||||
|
||||
public class SparkleSetup : SparkleSetupWindow {
|
||||
|
||||
public SparkleSetupController Controller = new SparkleSetupController ();
|
||||
|
||||
private string SecondaryTextColor;
|
||||
|
||||
private Entry NameEntry;
|
||||
private Entry EmailEntry;
|
||||
private SparkleEntry ServerEntry;
|
||||
private SparkleEntry FolderEntry;
|
||||
|
||||
private Button NextButton;
|
||||
private Button SyncButton;
|
||||
|
||||
private Table Table;
|
||||
|
||||
private ProgressBar progress_bar = new ProgressBar () { PulseStep = 0.01 };
|
||||
private Timer progress_bar_pulse_timer = new Timer () { Interval = 25, Enabled = true };
|
||||
|
||||
|
||||
// Short alias for the translations
|
||||
public static string _ (string s)
|
||||
{
|
||||
return Catalog.GetString (s);
|
||||
}
|
||||
|
||||
|
||||
public SparkleSetup () : base ()
|
||||
{
|
||||
SecondaryTextColor = SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive));
|
||||
|
||||
Controller.ChangePageEvent += delegate (PageType type) {
|
||||
Application.Invoke (delegate {
|
||||
Reset ();
|
||||
|
||||
switch (type) {
|
||||
case PageType.Setup:
|
||||
|
||||
Header = _("Welcome to SparkleShare!");
|
||||
Description = _("Before we can create a SparkleShare folder on this " +
|
||||
"computer, we need a few bits of information from you.");
|
||||
|
||||
Table = new Table (4, 2, true) {
|
||||
RowSpacing = 6
|
||||
};
|
||||
|
||||
Label name_label = new Label ("<b>" + _("Full Name:") + "</b>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
NameEntry = new Entry (SparkleShare.Controller.UserName);
|
||||
NameEntry.Changed += delegate {
|
||||
CheckSetupPage ();
|
||||
};
|
||||
|
||||
EmailEntry = new Entry ();
|
||||
EmailEntry.Changed += delegate {
|
||||
CheckSetupPage ();
|
||||
};
|
||||
|
||||
Label email_label = new Label ("<b>" + _("Email:") + "</b>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
Table.Attach (name_label, 0, 1, 0, 1);
|
||||
Table.Attach (NameEntry, 1, 2, 0, 1);
|
||||
Table.Attach (email_label, 0, 1, 1, 2);
|
||||
Table.Attach (EmailEntry, 1, 2, 1, 2);
|
||||
|
||||
NextButton = new Button (_("Next")) {
|
||||
Sensitive = false
|
||||
};
|
||||
|
||||
NextButton.Clicked += delegate (object o, EventArgs args) {
|
||||
string full_name = NameEntry.Text;
|
||||
string email = EmailEntry.Text;
|
||||
|
||||
Controller.SetupPageCompleted (full_name, email);
|
||||
};
|
||||
|
||||
AddButton (NextButton);
|
||||
Add (Table);
|
||||
|
||||
CheckSetupPage ();
|
||||
|
||||
break;
|
||||
|
||||
case PageType.Add:
|
||||
|
||||
Header = _("Where is your remote folder?");
|
||||
|
||||
Table = new Table (6, 2, false) {
|
||||
RowSpacing = 12
|
||||
};
|
||||
|
||||
HBox layout_server = new HBox (true, 0);
|
||||
|
||||
// Own server radiobutton
|
||||
RadioButton radio_button = new RadioButton ("<b>" + _("On my own server:") + "</b>");
|
||||
(radio_button.Child as Label).UseMarkup = true;
|
||||
|
||||
radio_button.Toggled += delegate {
|
||||
if (radio_button.Active) {
|
||||
FolderEntry.ExampleText = _("Folder");
|
||||
ServerEntry.Sensitive = true;
|
||||
CheckAddPage ();
|
||||
} else {
|
||||
ServerEntry.Sensitive = false;
|
||||
CheckAddPage ();
|
||||
}
|
||||
|
||||
ShowAll ();
|
||||
};
|
||||
|
||||
// Own server entry
|
||||
ServerEntry = new SparkleEntry () { };
|
||||
ServerEntry.Completion = new EntryCompletion();
|
||||
|
||||
ListStore server_store = new ListStore (typeof (string));
|
||||
|
||||
foreach (string host in SparkleShare.Controller.PreviousHosts)
|
||||
server_store.AppendValues (host);
|
||||
|
||||
ServerEntry.Completion.Model = server_store;
|
||||
ServerEntry.Completion.TextColumn = 0;
|
||||
|
||||
if (!string.IsNullOrEmpty (Controller.PreviousServer)) {
|
||||
ServerEntry.Text = Controller.PreviousServer;
|
||||
ServerEntry.ExampleTextActive = false;
|
||||
} else {
|
||||
ServerEntry.ExampleText = _("address-to-server.com");
|
||||
}
|
||||
|
||||
ServerEntry.Changed += delegate {
|
||||
CheckAddPage ();
|
||||
};
|
||||
|
||||
layout_server.Add (radio_button);
|
||||
layout_server.Add (ServerEntry);
|
||||
|
||||
Table.Attach (layout_server, 0, 2, 1, 2);
|
||||
|
||||
// Github radiobutton
|
||||
string github_text = "<b>" + "Github" + "</b>\n" +
|
||||
"<span fgcolor='" + SecondaryTextColor + "' size='small'>" +
|
||||
_("Free hosting for Free and Open Source Software projects.") + "\n" +
|
||||
_("Also has paid accounts for extra private space and bandwidth.") +
|
||||
"</span>";
|
||||
|
||||
RadioButton radio_button_github = new RadioButton (radio_button, github_text);
|
||||
(radio_button_github.Child as Label).UseMarkup = true;
|
||||
(radio_button_github.Child as Label).Wrap = true;
|
||||
|
||||
radio_button_github.Toggled += delegate {
|
||||
if (radio_button_github.Active)
|
||||
FolderEntry.ExampleText = _("Username/Folder");
|
||||
};
|
||||
|
||||
|
||||
// Gitorious radiobutton
|
||||
string gitorious_text = "<b>" + _("Gitorious") + "</b>\n" +
|
||||
"<span fgcolor='" + SecondaryTextColor + "' size='small'>" +
|
||||
_("Completely Free as in Freedom infrastructure.") + "\n" +
|
||||
_("Free accounts for Free and Open Source projects.") +
|
||||
"</span>";
|
||||
|
||||
RadioButton radio_button_gitorious = new RadioButton (radio_button, gitorious_text);
|
||||
(radio_button_gitorious.Child as Label).UseMarkup = true;
|
||||
(radio_button_gitorious.Child as Label).Wrap = true;
|
||||
|
||||
radio_button_gitorious.Toggled += delegate {
|
||||
if (radio_button_gitorious.Active)
|
||||
FolderEntry.ExampleText = _("Project/Folder");
|
||||
};
|
||||
|
||||
|
||||
// GNOME radiobutton
|
||||
string gnome_text = "<b>" + _("The GNOME Project") + "</b>\n"+
|
||||
"<span fgcolor='" + SecondaryTextColor + "' size='small'>" +
|
||||
_("GNOME is an easy to understand interface to your computer.") + "\n" +
|
||||
_("Select this option if you’re a developer or designer working on GNOME.") +
|
||||
"</span>";
|
||||
|
||||
RadioButton radio_button_gnome = new RadioButton (radio_button, gnome_text);
|
||||
(radio_button_gnome.Child as Label).UseMarkup = true;
|
||||
(radio_button_gnome.Child as Label).Wrap = true;
|
||||
|
||||
radio_button_gnome.Toggled += delegate {
|
||||
if (radio_button_gnome.Active)
|
||||
FolderEntry.ExampleText = _("Project");
|
||||
};
|
||||
|
||||
Table.Attach (radio_button_github, 0, 2, 2, 3);
|
||||
Table.Attach (radio_button_gitorious, 0, 2, 3, 4);
|
||||
Table.Attach (radio_button_gnome, 0, 2, 4, 5);
|
||||
|
||||
// Folder label and entry
|
||||
HBox layout_folder = new HBox (true, 0);
|
||||
|
||||
Label folder_label = new Label (_("Folder Name:")) {
|
||||
UseMarkup = true,
|
||||
Xalign = 1
|
||||
};
|
||||
|
||||
FolderEntry = new SparkleEntry ();
|
||||
FolderEntry.ExampleText = _("Folder");
|
||||
|
||||
FolderEntry.Changed += delegate {
|
||||
CheckAddPage ();
|
||||
};
|
||||
|
||||
layout_folder.PackStart (folder_label, true, true, 12);
|
||||
layout_folder.PackStart (FolderEntry, true, true, 0);
|
||||
|
||||
Table.Attach (layout_folder, 0, 2, 5, 6);
|
||||
Add (Table);
|
||||
|
||||
// Cancel button
|
||||
Button cancel_button = new Button (_("Cancel"));
|
||||
|
||||
cancel_button.Clicked += delegate {
|
||||
Close ();
|
||||
};
|
||||
|
||||
|
||||
// Sync button
|
||||
SyncButton = new Button (_("Sync"));
|
||||
|
||||
SyncButton.Clicked += delegate {
|
||||
string server = ServerEntry.Text;
|
||||
string folder_name = FolderEntry.Text;
|
||||
|
||||
if (radio_button_gitorious.Active)
|
||||
server = "gitorious.org";
|
||||
|
||||
if (radio_button_github.Active)
|
||||
server = "github.com";
|
||||
|
||||
if (radio_button_gnome.Active)
|
||||
server = "gnome.org";
|
||||
|
||||
Controller.AddPageCompleted (server, folder_name);
|
||||
};
|
||||
|
||||
AddButton (cancel_button);
|
||||
AddButton (SyncButton);
|
||||
|
||||
CheckAddPage ();
|
||||
|
||||
break;
|
||||
|
||||
case PageType.Syncing:
|
||||
|
||||
Header = String.Format (_("Syncing folder ‘{0}’…"), Controller.SyncingFolder);
|
||||
Description = _("This may take a while." + Environment.NewLine) +
|
||||
_("Are you sure it’s not coffee o'clock?");
|
||||
|
||||
Button button = new Button () {
|
||||
Sensitive = false,
|
||||
Label = _("Finish")
|
||||
};
|
||||
|
||||
button.Clicked += delegate {
|
||||
Close ();
|
||||
};
|
||||
|
||||
AddButton (button);
|
||||
|
||||
this.progress_bar_pulse_timer.Elapsed += delegate {
|
||||
Application.Invoke (delegate {
|
||||
progress_bar.Pulse ();
|
||||
});
|
||||
};
|
||||
|
||||
if (this.progress_bar.Parent != null)
|
||||
(this.progress_bar.Parent as Container).Remove (this.progress_bar);
|
||||
|
||||
VBox bar_wrapper = new VBox (false , 0);
|
||||
bar_wrapper.PackStart (this.progress_bar, false, false, 0);
|
||||
|
||||
Add (bar_wrapper);
|
||||
|
||||
break;
|
||||
|
||||
case PageType.Error:
|
||||
|
||||
Header = _("Something went wrong") + "…";
|
||||
|
||||
Button try_again_button = new Button (_("Try Again")) {
|
||||
Sensitive = true
|
||||
};
|
||||
|
||||
try_again_button.Clicked += delegate {
|
||||
Controller.ErrorPageCompleted ();
|
||||
};
|
||||
|
||||
AddButton (try_again_button);
|
||||
Add (null);
|
||||
|
||||
break;
|
||||
|
||||
case PageType.Finished:
|
||||
|
||||
UrgencyHint = true;
|
||||
|
||||
if (!HasToplevelFocus) {
|
||||
string title = String.Format (_("‘{0}’ has been successfully added"), Controller.SyncingFolder);
|
||||
string subtext = _("");
|
||||
|
||||
new SparkleBubble (title, subtext).Show ();
|
||||
}
|
||||
|
||||
Header = _("Folder synced successfully!");
|
||||
Description = _("Access the synced files from your SparkleShare folder.");
|
||||
|
||||
// A button that opens the synced folder
|
||||
Button open_folder_button = new Button (_("Open Folder"));
|
||||
|
||||
open_folder_button.Clicked += delegate {
|
||||
SparkleShare.Controller.OpenSparkleShareFolder (Controller.SyncingFolder);
|
||||
};
|
||||
|
||||
Button finish_button = new Button (_("Finish"));
|
||||
|
||||
finish_button.Clicked += delegate {
|
||||
Close ();
|
||||
};
|
||||
|
||||
Add (null);
|
||||
|
||||
AddButton (open_folder_button);
|
||||
AddButton (finish_button);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
ShowAll ();
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Enables or disables the 'Next' button depending on the
|
||||
// entries filled in by the user
|
||||
private void CheckSetupPage ()
|
||||
{
|
||||
if (NameEntry.Text.Length > 0 &&
|
||||
SparkleShare.Controller.IsValidEmail (EmailEntry.Text)) {
|
||||
|
||||
NextButton.Sensitive = true;
|
||||
} else {
|
||||
NextButton.Sensitive = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Enables or disables the 'Next' button depending on the
|
||||
// entries filled in by the user
|
||||
public void CheckAddPage ()
|
||||
{
|
||||
SyncButton.Sensitive = false;
|
||||
|
||||
if (FolderEntry.ExampleTextActive ||
|
||||
(ServerEntry.Sensitive && ServerEntry.ExampleTextActive))
|
||||
return;
|
||||
|
||||
bool IsFolder = !FolderEntry.Text.Trim ().Equals ("");
|
||||
bool IsServer = !ServerEntry.Text.Trim ().Equals ("");
|
||||
|
||||
if (ServerEntry.Sensitive == true) {
|
||||
if (IsServer && IsFolder)
|
||||
SyncButton.Sensitive = true;
|
||||
} else if (IsFolder) {
|
||||
SyncButton.Sensitive = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -28,21 +28,26 @@ using SparkleLib;
|
|||
|
||||
namespace SparkleShare {
|
||||
|
||||
public class SparkleWindow : Window {
|
||||
public class SparkleSetupWindow : Window {
|
||||
|
||||
private HBox HBox;
|
||||
private VBox VBox;
|
||||
private VBox Wrapper;
|
||||
private HButtonBox Buttons;
|
||||
|
||||
public string Header;
|
||||
public string Description;
|
||||
|
||||
public SparkleWindow () : base ("")
|
||||
public Container Content;
|
||||
|
||||
public SparkleSetupWindow () : base ("")
|
||||
{
|
||||
Title = Catalog.GetString ("SparkleShare Setup");
|
||||
BorderWidth = 0;
|
||||
IconName = "folder-sparkleshare";
|
||||
Resizable = false;
|
||||
WindowPosition = WindowPosition.Center;
|
||||
Deletable = false;
|
||||
|
||||
SetSizeRequest (680, 440);
|
||||
|
||||
|
@ -104,13 +109,35 @@ namespace SparkleShare {
|
|||
|
||||
new public void Add (Widget widget)
|
||||
{
|
||||
Wrapper.PackStart (widget, true, true, 0);
|
||||
Label header = new Label ("<span size='large'><b>" + Header + "</b></span>") {
|
||||
UseMarkup = true,
|
||||
Xalign = 0
|
||||
};
|
||||
|
||||
Label description = new Label (Description) {
|
||||
Xalign = 0,
|
||||
Wrap = true
|
||||
};
|
||||
|
||||
VBox layout_vertical = new VBox (false, 0);
|
||||
layout_vertical.PackStart (header, false, false, 0);
|
||||
|
||||
if (!string.IsNullOrEmpty (Description))
|
||||
layout_vertical.PackStart (description, false, false, 21);
|
||||
|
||||
if (widget != null)
|
||||
layout_vertical.PackStart (widget, true, true, 21);
|
||||
|
||||
Wrapper.PackStart (layout_vertical, true, true, 0);
|
||||
ShowAll ();
|
||||
}
|
||||
|
||||
|
||||
public void Reset ()
|
||||
{
|
||||
Header = "";
|
||||
Description = "";
|
||||
|
||||
if (Wrapper.Children.Length > 0)
|
||||
Wrapper.Remove (Wrapper.Children [0]);
|
||||
|
||||
|
@ -122,7 +149,9 @@ namespace SparkleShare {
|
|||
|
||||
new public void ShowAll ()
|
||||
{
|
||||
Present ();
|
||||
|
||||
Present ();
|
||||
|
||||
base.ShowAll ();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,26 +37,6 @@
|
|||
<Reference Include="System" />
|
||||
<Reference Include="Mono.Posix" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="SparkleShare.cs" />
|
||||
<Compile Include="SparkleSpinner.cs" />
|
||||
<Compile Include="SparkleStatusIcon.cs" />
|
||||
<Compile Include="SparkleUI.cs" />
|
||||
<Compile Include="SparkleEntry.cs" />
|
||||
<Compile Include="SparkleEventLog.cs" />
|
||||
<Compile Include="SparkleUIHelpers.cs" />
|
||||
<Compile Include="SparkleController.cs" />
|
||||
<Compile Include="SparkleAbout.cs" />
|
||||
<Compile Include="SparkleAboutController.cs" />
|
||||
<Compile Include="SparkleLinController.cs" />
|
||||
<Compile Include="SparkleBubblesController.cs" />
|
||||
<Compile Include="SparkleEventLogController.cs" />
|
||||
<Compile Include="SparkleSetupController.cs" />
|
||||
<Compile Include="SparkleStatusIconController.cs" />
|
||||
<Compile Include="SparkleBubbles.cs" />
|
||||
<Compile Include="SparkleSetup.cs" />
|
||||
<Compile Include="SparkleSetupWindow.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SparkleLib\SparkleLib.csproj">
|
||||
<Project>{2C914413-B31C-4362-93C7-1AE34F09112A}</Project>
|
||||
|
@ -78,4 +58,25 @@
|
|||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
<ItemGroup>
|
||||
<Compile Include="SparkleAbout.cs" />
|
||||
<Compile Include="SparkleAboutController.cs" />
|
||||
<Compile Include="SparkleBubbles.cs" />
|
||||
<Compile Include="SparkleBubblesController.cs" />
|
||||
<Compile Include="SparkleController.cs" />
|
||||
<Compile Include="SparkleEntry.cs" />
|
||||
<Compile Include="SparkleEventLog.cs" />
|
||||
<Compile Include="SparkleEventLogController.cs" />
|
||||
<Compile Include="SparkleInvitation.cs" />
|
||||
<Compile Include="SparkleLinController.cs" />
|
||||
<Compile Include="SparkleSetup.cs" />
|
||||
<Compile Include="SparkleSetupController.cs" />
|
||||
<Compile Include="SparkleSetupWindow.cs" />
|
||||
<Compile Include="SparkleShare.cs" />
|
||||
<Compile Include="SparkleSpinner.cs" />
|
||||
<Compile Include="SparkleStatusIcon.cs" />
|
||||
<Compile Include="SparkleStatusIconController.cs" />
|
||||
<Compile Include="SparkleUI.cs" />
|
||||
<Compile Include="SparkleUIHelpers.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -223,16 +223,16 @@ namespace SparkleShare {
|
|||
sync_item.Activated += delegate {
|
||||
Application.Invoke (delegate {
|
||||
|
||||
if (SparkleUI.Intro == null) {
|
||||
SparkleUI.Intro = new SparkleIntro ();
|
||||
SparkleUI.Intro.ShowServerForm (true);
|
||||
if (SparkleUI.Setup == null) {
|
||||
SparkleUI.Setup = new SparkleSetup ();
|
||||
SparkleUI.Setup.Controller.ShowAddPage ();
|
||||
}
|
||||
|
||||
if (!SparkleUI.Intro.Visible)
|
||||
SparkleUI.Intro.ShowServerForm (true);
|
||||
if (!SparkleUI.Setup.Visible)
|
||||
SparkleUI.Setup.Controller.ShowAddPage ();
|
||||
|
||||
SparkleUI.Intro.ShowAll ();
|
||||
SparkleUI.Intro.Present ();
|
||||
//SparkleUI.Intro.ShowAll ();
|
||||
//SparkleUI.Intro.Present ();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace SparkleShare {
|
|||
|
||||
public static SparkleStatusIcon StatusIcon;
|
||||
public static SparkleEventLog EventLog;
|
||||
public static SparkleIntro Intro;
|
||||
public static SparkleSetup Setup;
|
||||
|
||||
|
||||
// Short alias for the translations
|
||||
|
@ -56,20 +56,15 @@ namespace SparkleShare {
|
|||
StatusIcon = new SparkleStatusIcon ();
|
||||
|
||||
if (SparkleShare.Controller.FirstRun) {
|
||||
Intro = new SparkleIntro ();
|
||||
Intro.ShowAccountForm ();
|
||||
Setup = new SparkleSetup ();
|
||||
Setup.Controller.ShowSetupPage ();
|
||||
}
|
||||
|
||||
SparkleShare.Controller.OnQuitWhileSyncing += delegate {
|
||||
// TODO: Pop up a warning when quitting whilst syncing
|
||||
};
|
||||
|
||||
SparkleShare.Controller.OnInvitation += delegate (string server, string folder, string token) {
|
||||
Application.Invoke (delegate {
|
||||
SparkleIntro intro = new SparkleIntro ();
|
||||
intro.ShowInvitationPage (server, folder, token);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Show a bubble when there are new changes
|
||||
SparkleShare.Controller.NotificationRaised += delegate (string user_name, string user_email,
|
||||
|
@ -77,19 +72,19 @@ namespace SparkleShare {
|
|||
Application.Invoke (delegate {
|
||||
if (EventLog != null)
|
||||
EventLog.UpdateEvents ();
|
||||
|
||||
|
||||
if (!SparkleShare.Controller.NotificationsEnabled)
|
||||
return;
|
||||
|
||||
SparkleBubble bubble = new SparkleBubble (user_name, message);
|
||||
string avatar_file_path = SparkleShare.Controller.GetAvatar (user_email, 36);
|
||||
// TODO SparkleBubble bubble = new SparkleBubble (user_name, message);
|
||||
//string avatar_file_path = SparkleShare.Controller.GetAvatar (user_email, 36);
|
||||
|
||||
if (avatar_file_path != null)
|
||||
bubble.Icon = new Gdk.Pixbuf (avatar_file_path);
|
||||
else
|
||||
bubble.Icon = SparkleUIHelpers.GetIcon ("avatar-default", 36);
|
||||
//if (avatar_file_path != null)
|
||||
// bubble.Icon = new Gdk.Pixbuf (avatar_file_path);
|
||||
//else
|
||||
// bubble.Icon = SparkleUIHelpers.GetIcon ("avatar-default", 36);
|
||||
|
||||
bubble.Show ();
|
||||
//bubble.Show ();
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -99,7 +94,7 @@ namespace SparkleShare {
|
|||
string title = _("Ouch! Mid-air collision!");
|
||||
string subtext = _("Don't worry, SparkleShare made a copy of each conflicting file.");
|
||||
|
||||
new SparkleBubble (title, subtext).Show ();
|
||||
// TODO new SparkleBubble (title, subtext).Show ();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ SUBDIRS = \
|
|||
dist_pixmaps_DATA = \
|
||||
sparkleshare-gnome.svg \
|
||||
sparkleshare-mist.svg \
|
||||
side-splash.png
|
||||
side-splash.png \
|
||||
about.png
|
||||
|
||||
pixmapsdir = $(pkgdatadir)/pixmaps/
|
||||
|
||||
|
|
Loading…
Reference in a new issue