[sparkleintro] fix spinner size

This commit is contained in:
Hylke Bons 2010-07-29 14:47:09 +01:00
parent 57627b909c
commit 03a79d72a0
7 changed files with 133 additions and 37 deletions

View file

@ -5,6 +5,7 @@ Maintainer:
Contributors: Contributors:
Andreas Nilsson <andreasn@gnome.org> Andreas Nilsson <andreasn@gnome.org>
Benjamin Podszun <benjamin.podszun@gmail.com>
Bertrand Lorentz <bertrand.lorentz@gmail.com> Bertrand Lorentz <bertrand.lorentz@gmail.com>
Garrett LeSage <garrett@novell.com> Garrett LeSage <garrett@novell.com>
Jakub Steiner <jimmac@novell.com> Jakub Steiner <jimmac@novell.com>

View file

@ -115,24 +115,6 @@ namespace SparkleShare {
int SlashPos = RepoRemoteUrl.LastIndexOf ("/"); int SlashPos = RepoRemoteUrl.LastIndexOf ("/");
int ColumnPos = RepoRemoteUrl.LastIndexOf (":"); int ColumnPos = RepoRemoteUrl.LastIndexOf (":");
// Check whether a "/" or ":" is used to separate the
// repo name from the domain.
string RepoName;
if (SlashPos > ColumnPos)
RepoName = RepoRemoteUrl.Substring (SlashPos + 1);
else
RepoName = RepoRemoteUrl.Substring (ColumnPos + 1);
SparkleBubble SyncingBubble;
SyncingBubble = new SparkleBubble (String.Format(_("Syncing folder {0}"), RepoName),
_("SparkleShare will notify you when this is done."));
SyncingBubble.AddAction ("", _("Dismiss"),
delegate {
SyncingBubble.Close ();
});
SyncingBubble.Show ();
Process Process = new Process (); Process Process = new Process ();
Process.EnableRaisingEvents = true; Process.EnableRaisingEvents = true;
@ -154,23 +136,13 @@ namespace SparkleShare {
if (Process.ExitCode != 0) { if (Process.ExitCode != 0) {
SparkleBubble ErrorBubble; // error
ErrorBubble = new SparkleBubble (String.Format(_("Something went wrong while syncing {0}"), RepoName),
"Please double check the address and\n" +
"network connection.");
try { try {
Directory.Delete (SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath, RepoName)); Directory.Delete (SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath, RepoName));
} catch (System.IO.DirectoryNotFoundException) { } catch (System.IO.DirectoryNotFoundException) {
SparkleHelpers.DebugInfo ("Config", "[" + RepoName + "] Temporary directory did not exist..."); SparkleHelpers.DebugInfo ("Config", "[" + RepoName + "] Temporary directory did not exist...");
} }
ErrorBubble.AddAction ("", _("Try Again…"),
delegate {
SparkleDialog SparkleDialog = new SparkleDialog (RepoRemoteUrl);
SparkleDialog.ShowAll ();
});
ErrorBubble.Show ();
} else { } else {
@ -188,6 +160,8 @@ namespace SparkleShare {
Writer.WriteLine (".DS_store"); // Ignore OSX's invisible directories Writer.WriteLine (".DS_store"); // Ignore OSX's invisible directories
Writer.Close (); Writer.Close ();
// TODO: Install username and email from global file
File.Create (SparkleHelpers.CombineMore (SparklePaths.SparklePath, RepoName, File.Create (SparkleHelpers.CombineMore (SparklePaths.SparklePath, RepoName,
".emblems")); ".emblems"));

View file

@ -303,6 +303,8 @@ namespace SparkleShare {
AddButton.Clicked += delegate { AddButton.Clicked += delegate {
ShowStepTwoAndAHalf ();
// TODO // TODO
}; };
@ -331,13 +333,106 @@ namespace SparkleShare {
Add (layout_horizontal); Add (layout_horizontal);
CheckStepOneFields (); CheckStepTwoFields ();
ShowAll (); ShowAll ();
} }
private void ShowStepTwoAndAHalf ()
{
Title = _("Add Remote Folder");
Remove (Child);
HBox layout_horizontal = new HBox (false, 6);
Image side_splash = new Image (SparkleHelpers.CombineMore (Defines.PREFIX, "share", "pixmaps",
"side-splash.png"));
VBox wrapper = new VBox (false, 0);
VBox layout_vertical = new VBox (false, 0) {
BorderWidth = 30
};
Label introduction = new Label ("<span size='x-large'><b>" +
String.Format (_("Retrieving folder {0}’…"), FolderEntry.Text) +
"</b></span>") {
UseMarkup = true,
Xalign = 0
};
Label information = new Label ("<span fgcolor='#777'>" +
_("This may take a while.\n") +
_("You sure its not coffee o-clock?" +
"</span>")) {
UseMarkup = true,
Xalign = 0
};
HButtonBox controls = new HButtonBox () {
BorderWidth = 12,
Layout = ButtonBoxStyle.End,
Spacing = 6
};
Button button = new Button ("") {
Sensitive = false
};
if (StepTwoOnly) {
button.Label = _("Finish");
button.Clicked += delegate {
Destroy ();
};
} else {
button.Label = _("Next");
button.Clicked += delegate {
ShowStepThree ();
};
}
controls.Add (button);
SparkleSpinner spinner = new SparkleSpinner (22);
Table table = new Table (2, 2, false) {
RowSpacing = 12,
ColumnSpacing = 9
};
HBox box = new HBox (false, 0);
table.Attach (spinner, 0, 1, 0, 1);
table.Attach (introduction, 1, 2, 0, 1);
table.Attach (information, 1, 2, 1, 2);
box.PackStart (table, false, false, 0);
layout_vertical.PackStart (box, false, false, 0);
wrapper.PackStart (layout_vertical, true, true, 0);
wrapper.PackStart (controls, false, true, 0);
layout_horizontal.PackStart (side_splash, false, false, 0);
layout_horizontal.PackStart (wrapper, true, true, 0);
Add (layout_horizontal);
CheckStepTwoFields ();
ShowAll ();
}
private void ShowStepThree () private void ShowStepThree ()
{ {

View file

@ -66,6 +66,8 @@ namespace SparkleShare {
public SparkleRepo (string path) public SparkleRepo (string path)
{ {
// if (Directory.Exists)
LocalPath = path; LocalPath = path;
Name = Path.GetFileName (LocalPath); Name = Path.GetFileName (LocalPath);
@ -130,6 +132,14 @@ namespace SparkleShare {
} }
public void Init ()
{
}
private void CheckForChanges () private void CheckForChanges ()
{ {

View file

@ -15,7 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using Gtk; using Gtk;
using System;
using System.Timers; using System.Timers;
namespace SparkleShare { namespace SparkleShare {
@ -38,31 +37,42 @@ namespace SparkleShare {
Size = size; Size = size;
CycleDuration = 750; CycleDuration = 600;
CurrentStep = 0; CurrentStep = 0;
Gdk.Pixbuf spinner_gallery = SparkleHelpers.GetIcon ("process-working", Size); Gdk.Pixbuf spinner_gallery = SparkleHelpers.GetIcon ("process-working", Size);
int frames_in_width = spinner_gallery.Width / Size; int frames_in_width = spinner_gallery.Width / Size;
int frames_in_height = spinner_gallery.Height / Size; int frames_in_height = spinner_gallery.Height / Size;
NumSteps = frames_in_width * frames_in_height; NumSteps = frames_in_width * frames_in_height;
Images = new Gdk.Pixbuf [NumSteps - 1]; Images = new Gdk.Pixbuf [NumSteps - 1];
int i = 0; int i = 0;
for (int y = 0; y < frames_in_height; y++) { for (int y = 0; y < frames_in_height; y++) {
for (int x = 0; x < frames_in_width; x++) { for (int x = 0; x < frames_in_width; x++) {
if (!(y == 0 && x == 0)) { if (!(y == 0 && x == 0)) {
Images [i] = new Gdk.Pixbuf (spinner_gallery, x * Size, y * Size, Size, Size); Images [i] = new Gdk.Pixbuf (spinner_gallery, x * Size, y * Size, Size, Size);
i++; i++;
} }
} }
} }
Timer = new Timer (); Timer = new Timer () {
Timer.Interval = CycleDuration / NumSteps; Interval = CycleDuration / NumSteps
};
Timer.Elapsed += delegate { Timer.Elapsed += delegate {
NextImage (); NextImage ();
}; };
Start (); Start ();
} }
@ -82,27 +92,32 @@ namespace SparkleShare {
private void SetImage () private void SetImage ()
{ {
Console.WriteLine (CurrentStep);
Pixbuf = Images [CurrentStep]; Pixbuf = Images [CurrentStep];
} }
public bool IsActive () public bool IsActive ()
{ {
return Active; return Active;
} }
public void Start () public void Start ()
{ {
CurrentStep = 0; CurrentStep = 0;
Active = true; Active = true;
Timer.Start (); Timer.Start ();
} }
public void Stop () public void Stop ()
{ {
Active = false; Active = false;
Timer.Stop (); Timer.Stop ();
} }
} }

View file

@ -4,6 +4,7 @@ hicolordir = $(DESTDIR)$(datadir)/icons/hicolor
theme_icons = \ theme_icons = \
animations,process-syncing-sparkleshare-24.png \ animations,process-syncing-sparkleshare-24.png \
animations,process-working-22.png \
places,folder-16.png \ places,folder-16.png \
places,folder-22.png \ places,folder-22.png \
places,folder-24.png \ places,folder-24.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB