fix some issues with non existing repos
This commit is contained in:
parent
e2b160e79e
commit
9d9b9da11a
|
@ -29,18 +29,15 @@ namespace SparkleShare {
|
||||||
private Button AddButton;
|
private Button AddButton;
|
||||||
private ComboBoxEntry RemoteUrlCombo;
|
private ComboBoxEntry RemoteUrlCombo;
|
||||||
private Entry NameEntry;
|
private Entry NameEntry;
|
||||||
private SparkleWindow ParentSparkleWindow;
|
|
||||||
|
|
||||||
public SparkleDialog (SparkleWindow Parent) : base ("") {
|
public SparkleDialog () : base ("") {
|
||||||
|
|
||||||
ParentSparkleWindow = Parent;
|
|
||||||
BorderWidth = 6;
|
BorderWidth = 6;
|
||||||
IconName = "folder-sparkleshare";
|
IconName = "folder-sparkleshare";
|
||||||
Modal = true;
|
Modal = true;
|
||||||
Resizable = false;
|
Resizable = false;
|
||||||
SetPosition (WindowPosition.Center);
|
SetPosition (WindowPosition.Center);
|
||||||
Title = "Add a Folder";
|
Title = "Add a Folder";
|
||||||
TransientFor = ParentSparkleWindow;
|
|
||||||
|
|
||||||
VBox VBox = new VBox (false, 0);
|
VBox VBox = new VBox (false, 0);
|
||||||
|
|
||||||
|
@ -103,6 +100,7 @@ namespace SparkleShare {
|
||||||
VBox.PackStart (ButtonBox, false, false, 0);
|
VBox.PackStart (ButtonBox, false, false, 0);
|
||||||
|
|
||||||
Add (VBox);
|
Add (VBox);
|
||||||
|
ShowAll ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,8 +139,6 @@ namespace SparkleShare {
|
||||||
RepoName)
|
RepoName)
|
||||||
);
|
);
|
||||||
Destroy ();
|
Destroy ();
|
||||||
ParentSparkleWindow.ToggleVisibility ();
|
|
||||||
ParentSparkleWindow.Notebook.CurrentPage = 1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ namespace SparkleShare {
|
||||||
public void OnFileActivity (object o, FileSystemEventArgs args) {
|
public void OnFileActivity (object o, FileSystemEventArgs args) {
|
||||||
WatcherChangeTypes wct = args.ChangeType;
|
WatcherChangeTypes wct = args.ChangeType;
|
||||||
if (!ShouldIgnore (args.Name) && SyncChanges) {
|
if (!ShouldIgnore (args.Name) && SyncChanges) {
|
||||||
Console.WriteLine("[Event][" + Name + "] " + wct.ToString() +
|
Console.WriteLine ("[Event][" + Name + "] " + wct.ToString() +
|
||||||
" '" + args.Name + "'");
|
" '" + args.Name + "'");
|
||||||
StartBufferTimer ();
|
StartBufferTimer ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
// 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 SparkleShare;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -69,26 +70,35 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all the repos in ~/SparkleShare
|
// Get all the repos in ~/SparkleShare
|
||||||
string [] Repos = Directory.GetDirectories (SparklePath);
|
SparkleRepo [] TmpRepos =
|
||||||
Repositories = new SparkleRepo [Repos.Length];
|
new SparkleRepo [Directory.GetDirectories (SparklePath).Length];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (string Folder in Repos) {
|
foreach (string Folder in Directory.GetDirectories (SparklePath)) {
|
||||||
|
|
||||||
Repositories [i] = new SparkleRepo (Folder);
|
// Check if the folder is a git repo
|
||||||
i++;
|
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
|
// Don't create the window and status
|
||||||
// icon when --disable-gui was given
|
// icon when --disable-gui was given
|
||||||
if (!HideUI) {
|
if (!HideUI) {
|
||||||
|
@ -105,6 +115,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
|
// Create place to store configuration user's home folder
|
||||||
string ConfigPath = SparklePaths.SparkleConfigPath;
|
string ConfigPath = SparklePaths.SparkleConfigPath;
|
||||||
string AvatarPath = SparklePaths.SparkleAvatarPath;
|
string AvatarPath = SparklePaths.SparkleAvatarPath;
|
||||||
|
|
|
@ -187,7 +187,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
Selection.GetSelected (out Iter);
|
Selection.GetSelected (out Iter);
|
||||||
|
|
||||||
SparkleRepo SparkleRepo = (SparkleRepo)ReposStore.GetValue (Iter, 2);
|
SparkleRepo SparkleRepo =
|
||||||
|
(SparkleRepo) ReposStore.GetValue (Iter, 2);
|
||||||
|
|
||||||
LayoutHorizontal.Remove (LayoutVerticalRight);
|
LayoutHorizontal.Remove (LayoutVerticalRight);
|
||||||
LayoutVerticalRight = CreateDetailedView (SparkleRepo);
|
LayoutVerticalRight = CreateDetailedView (SparkleRepo);
|
||||||
|
|
Loading…
Reference in a new issue