fix some issues with non existing repos

This commit is contained in:
Hylke Bons 2010-05-16 13:28:25 +01:00
parent 4b37ff93ed
commit f2815da626
4 changed files with 42 additions and 20 deletions

View file

@ -29,18 +29,15 @@ namespace SparkleShare {
private Button AddButton;
private ComboBoxEntry RemoteUrlCombo;
private Entry NameEntry;
private SparkleWindow ParentSparkleWindow;
public SparkleDialog (SparkleWindow Parent) : base ("") {
public SparkleDialog () : base ("") {
ParentSparkleWindow = Parent;
BorderWidth = 6;
IconName = "folder-sparkleshare";
Modal = true;
Resizable = false;
SetPosition (WindowPosition.Center);
Title = "Add a Folder";
TransientFor = ParentSparkleWindow;
VBox VBox = new VBox (false, 0);
@ -103,6 +100,7 @@ namespace SparkleShare {
VBox.PackStart (ButtonBox, false, false, 0);
Add (VBox);
ShowAll ();
}
@ -141,8 +139,6 @@ namespace SparkleShare {
RepoName)
);
Destroy ();
ParentSparkleWindow.ToggleVisibility ();
ParentSparkleWindow.Notebook.CurrentPage = 1;
};
}

View file

@ -132,7 +132,7 @@ namespace SparkleShare {
public void OnFileActivity (object o, FileSystemEventArgs args) {
WatcherChangeTypes wct = args.ChangeType;
if (!ShouldIgnore (args.Name) && SyncChanges) {
Console.WriteLine("[Event][" + Name + "] " + wct.ToString() +
Console.WriteLine ("[Event][" + Name + "] " + wct.ToString() +
" '" + args.Name + "'");
StartBufferTimer ();
}

View file

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using Gtk;
using SparkleShare;
using System;
using System.Diagnostics;
using System.IO;
@ -69,25 +70,34 @@ namespace SparkleShare {
}
// Get all the repos in ~/SparkleShare
string [] Repos = Directory.GetDirectories (SparklePath);
Repositories = new SparkleRepo [Repos.Length];
SparkleRepo [] TmpRepos =
new SparkleRepo [Directory.GetDirectories (SparklePath).Length];
int i = 0;
foreach (string Folder in Repos) {
foreach (string Folder in Directory.GetDirectories (SparklePath)) {
Repositories [i] = new SparkleRepo (Folder);
i++;
// Check if the folder is a git repo
if (Directory.Exists (SparkleHelpers.CombineMore (Folder,
".git"))) {
TmpRepos [i] = new SparkleRepo (Folder);
i++;
Console.WriteLine (Folder);
// Attach emblems
if (SparklePlatform.Name.Equals ("GNOME")) {
Process.StartInfo.FileName = "gvfs-set-attribute";
Process.StartInfo.Arguments = " file://" + Folder +
" metadata::emblems " +
"[synced]";
Process.Start();
// Attach emblems
if (SparklePlatform.Name.Equals ("GNOME")) {
Process.StartInfo.FileName = "gvfs-set-attribute";
Process.StartInfo.Arguments = " file://" + Folder +
" metadata::emblems " +
"[synced]";
Process.Start();
}
}
}
Repositories = new SparkleRepo [i];
Array.Copy (TmpRepos, Repositories, i);
// Don't create the window and status
// icon when --disable-gui was given
@ -104,6 +114,21 @@ namespace SparkleShare {
};
}
// Watch the SparkleShare folder and pop up the
// Add dialog when a new folder is created
FileSystemWatcher Watcher = new FileSystemWatcher (SparklePaths.SparklePath);
Watcher.IncludeSubdirectories = false;
Watcher.EnableRaisingEvents = true;
Watcher.Created += delegate (object o, FileSystemEventArgs args) {
WatcherChangeTypes wct = args.ChangeType;
Console.WriteLine ("[Event][SparkleShare] " + wct.ToString() +
" '" + args.Name + "'");
SparkleDialog SparkleDialog = new SparkleDialog ();
SparkleDialog.ShowAll ();
//Window Window = new Window ("");
//Window.ShowAll ();
};
// Create place to store configuration user's home folder
string ConfigPath = SparklePaths.SparkleConfigPath;

View file

@ -187,7 +187,8 @@ namespace SparkleShare {
Selection.GetSelected (out Iter);
SparkleRepo SparkleRepo = (SparkleRepo)ReposStore.GetValue (Iter, 2);
SparkleRepo SparkleRepo =
(SparkleRepo) ReposStore.GetValue (Iter, 2);
LayoutHorizontal.Remove (LayoutVerticalRight);
LayoutVerticalRight = CreateDetailedView (SparkleRepo);