add another platform switch

This commit is contained in:
Hylke Bons 2010-05-21 09:49:41 +01:00
parent 8b6e719fd2
commit fb80989511
4 changed files with 70 additions and 45 deletions

View file

@ -102,15 +102,7 @@ namespace SparkleShare {
public void CloneRepo (object o, EventArgs args) { public void CloneRepo (object o, EventArgs args) {
Remove (Child); Destroy ();
VBox Box = new VBox (false, 24);
SparkleSpinner Spinner = new SparkleSpinner ();
Label Label = new Label (_("Downloading files,\n") +
_("this may take a while..."));
Box.PackStart (Spinner, false, false, 0);
Box.PackStart (Label, false, false, 0);
BorderWidth = 30;
Add (Box);
string RepoRemoteUrl = RemoteUrlCombo.Entry.Text; string RepoRemoteUrl = RemoteUrlCombo.Entry.Text;
string RepoName = string RepoName =
@ -121,8 +113,7 @@ namespace SparkleShare {
Process.StartInfo.RedirectStandardOutput = true; Process.StartInfo.RedirectStandardOutput = true;
Process.StartInfo.UseShellExecute = false; Process.StartInfo.UseShellExecute = false;
Process.StartInfo.FileName = "git"; Process.StartInfo.FileName = "git";
Process.StartInfo.WorkingDirectory = Process.StartInfo.WorkingDirectory = SparklePaths.SparkleTmpPath;
SparklePaths.SparkleTmpPath;
Process.StartInfo.Arguments = "clone "; Process.StartInfo.Arguments = "clone ";
Process.StartInfo.Arguments += Process.StartInfo.Arguments +=
@ -130,6 +121,10 @@ namespace SparkleShare {
Process.Start (); Process.Start ();
SparkleBubble SparkleBubble =
new SparkleBubble ("Downloading " + RepoName + "",
"You will be notified when this is done");
// Move the folder to the SparkleShare folder when done cloning // Move the folder to the SparkleShare folder when done cloning
Process.Exited += delegate { Process.Exited += delegate {
Directory.Move ( Directory.Move (
@ -139,7 +134,20 @@ namespace SparkleShare {
RepoName) RepoName)
); );
Destroy (); SparkleBubble =
new SparkleBubble ("Successfully added the folder" +
" " + RepoName + "",
"Now make great stuff happen!");
SparkleBubble.AddAction ("", "Open Folder",
delegate {
Process.StartInfo.FileName = "xdg-open";
Process.StartInfo.Arguments =
SparkleHelpers.CombineMore (
SparklePaths.SparklePath, RepoName);
Process.Start();
} );
}; };
} }

View file

@ -388,13 +388,21 @@ namespace SparkleShare {
// Add a button to open the folder where the changed file is // Add a button to open the folder where the changed file is
if (ShowButtons) if (ShowButtons)
StuffChangedBubble.AddAction ("", "Open Folder", StuffChangedBubble.AddAction
delegate { ("", "Open Folder",
Process.StartInfo.FileName = "xdg-open"; delegate {
Process.StartInfo.Arguments = LocalPath; switch (SparklePlatform.Name) {
Process.Start(); case "GNOME":
Process.StartInfo.FileName = "git"; Process.StartInfo.FileName = "xdg-open";
} ); break;
case "OSX":
Process.StartInfo.FileName = "open";
break;
}
Process.StartInfo.Arguments = LocalPath;
Process.Start();
Process.StartInfo.FileName = "git";
} );
} }

View file

@ -38,29 +38,36 @@ namespace SparkleShare {
// Create 'SparkleShare' folder in the user's home folder // Create 'SparkleShare' folder in the user's home folder
// if it's not there already // if it's not there already
if (!Directory.Exists (SparklePath)) { if (!Directory.Exists (SparklePath)) {
Directory.CreateDirectory (SparklePath); Directory.CreateDirectory (SparklePath);
Console.WriteLine ("[Config] Created '" + SparklePath + "'"); Console.WriteLine ("[Config] Created '" + SparklePath + "'");
if (SparklePlatform.Name.Equals ("GNOME")) { // Add a special icon to the SparkleShare folder
switch (SparklePlatform.Name) {
case "GNOME":
Process.StartInfo.FileName = "gvfs-set-attribute";
Process.StartInfo.Arguments = SparklePath +
" metadata::custom-icon " +
"file:///usr/share/icons/hicolor/" +
"48x48/places/" +
"folder-sparkleshare.png";
break;
}
Process.Start();
// Add a special icon to the SparkleShare folder // Add the SparkleShare folder to the bookmarks
Process.StartInfo.FileName = "gvfs-set-attribute"; switch (SparklePlatform.Name) {
Process.StartInfo.Arguments = SparklePath + case "GNOME":
" metadata::custom-icon " +
"file:///usr/share/icons/hicolor/" +
"48x48/places/" +
"folder-sparkleshare.png";
Process.Start();
// Add the SparkleShare folder to the bookmarks string BookmarksFileName =
string BookmarksFileName = Path.Combine (SparklePaths.HomePath, ".gtk-bookmarks");
Path.Combine (SparklePaths.HomePath, ".gtk-bookmarks"); if (File.Exists (BookmarksFileName)) {
if (File.Exists (BookmarksFileName)) { TextWriter TextWriter = File.AppendText (BookmarksFileName);
TextWriter TextWriter = File.AppendText (BookmarksFileName); TextWriter.WriteLine ("file://" + SparklePath + " SparkleShare");
TextWriter.WriteLine ("file://" + SparklePath + " SparkleShare"); TextWriter.Close();
TextWriter.Close(); }
}
break;
} }
} }
@ -79,13 +86,15 @@ namespace SparkleShare {
i++; i++;
// Attach emblems // Attach emblems
if (SparklePlatform.Name.Equals ("GNOME")) { switch (SparklePlatform.Name) {
Process.StartInfo.FileName = "gvfs-set-attribute"; case "GNOME":
Process.StartInfo.Arguments = " file://" + Folder + Process.StartInfo.FileName = "gvfs-set-attribute";
" metadata::emblems " + Process.StartInfo.Arguments = " file://" + Folder +
"[synced]"; " metadata::emblems " +
Process.Start(); "[synced]";
break;
} }
Process.Start();
} }

View file

@ -2,7 +2,7 @@
mkdir -p locale mkdir -p locale
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then
echo "Usage: ./create-po-file [LOCALE].po" echo "Usage: ./create-po-file [LOCALE].pot"
else else
xgettext -a --from-code=UTF-8 SparkleShare/*.cs -o locale/$1 xgettext -a --from-code=UTF-8 SparkleShare/*.cs -o locale/$1
echo "Created locale/$1." echo "Created locale/$1."