[invitation] Make it work again

This commit is contained in:
Hylke Bons 2010-10-04 20:33:37 +01:00
parent bdc831bc0e
commit 7050aa1139
3 changed files with 32 additions and 28 deletions

View file

@ -53,7 +53,7 @@ namespace SparkleShare {
XmlNodeList server_xml = xml_doc.GetElementsByTagName ("server");
XmlNodeList folder_xml = xml_doc.GetElementsByTagName ("folder");
XmlNodeList invite_key_xml = xml_doc.GetElementsByTagName ("invitekey");
XmlNodeList invite_key_xml = xml_doc.GetElementsByTagName ("invite_key");
Server = server_xml [0].InnerText;
Folder = folder_xml [0].InnerText;
@ -95,7 +95,7 @@ namespace SparkleShare {
}
public void PresentInvitation ()
new public void Present ()
{
VBox layout_vertical = new VBox (false, 0);
@ -159,7 +159,7 @@ namespace SparkleShare {
accept_button.Clicked += delegate {
string url = "ssh://git@" + Server + "/projects/" + Folder;
string url = "ssh://git@" + Server + "/" + Folder;
SparkleHelpers.DebugInfo ("Git", "[" + Folder + "] Formed URL: " + url);
FetchFolder (url, Folder);
@ -180,7 +180,7 @@ namespace SparkleShare {
ShowAll ();
Present ();
base.Present ();
}
@ -191,6 +191,24 @@ namespace SparkleShare {
string canonical_name = System.IO.Path.GetFileNameWithoutExtension (name);
string tmp_folder = SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath, canonical_name);
bool folder_exists = Directory.Exists (
SparkleHelpers.CombineMore (SparklePaths.SparklePath, canonical_name));
int i = 1;
while (folder_exists) {
i++;
folder_exists = Directory.Exists (
SparkleHelpers.CombineMore (SparklePaths.SparklePath, canonical_name + " (" + i + ")"));
}
string target_folder_name = canonical_name;
if (i > 1)
target_folder_name += " (" + i + ")";
SparkleFetcher fetcher = new SparkleFetcher (url, tmp_folder);
@ -209,23 +227,6 @@ namespace SparkleShare {
try {
bool folder_exists = Directory.Exists (
SparkleHelpers.CombineMore (SparklePaths.SparklePath, canonical_name));
int i = 1;
while (folder_exists) {
i++;
folder_exists = Directory.Exists (
SparkleHelpers.CombineMore (SparklePaths.SparklePath, canonical_name + " (" + i + ")"));
}
string target_folder_name = canonical_name;
if (i > 1)
target_folder_name += " (" + i + ")";
string target_folder_path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
target_folder_name);
@ -237,7 +238,7 @@ namespace SparkleShare {
}
Application.Invoke (delegate { ShowSuccessPage (canonical_name); });
Application.Invoke (delegate { ShowSuccessPage (target_folder_name); });
};

View file

@ -164,10 +164,11 @@ namespace SparkleShare {
double size = 0;
// Ignore the temporary 'rebase-apply' directory.
// Ignore the temporary 'rebase-apply' and '.tmp' directories.
// This prevents potential crashes when files are being
// queried whilst the files have already been deleted.
if (parent.Name.Equals ("rebase-apply"))
if (parent.Name.Equals ("rebase-apply") ||
parent.Name.Equals (".tmp"))
return 0;
foreach (FileInfo file in parent.GetFiles()) {

View file

@ -85,12 +85,14 @@ namespace SparkleShare {
// Handle invitations when the user saves an
// invitation into the SparkleShare folder
if (args.Name.EndsWith ("sparkleshare.invitation")) {
if (args.Name.EndsWith (".invitation")) {
SparkleInvitation invitation;
invitation = new SparkleInvitation (args.FullPath);
Application.Invoke (delegate {
Application.Invoke (delegate { invitation.PresentInvitation (); });
SparkleInvitation invitation = new SparkleInvitation (args.FullPath);
invitation.Present ();
});
} else if (Directory.Exists (args.FullPath)) {