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 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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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,14 +70,18 @@ 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);
|
||||
// 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")) {
|
||||
|
@ -89,6 +94,11 @@ namespace SparkleShare {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Repositories = new SparkleRepo [i];
|
||||
Array.Copy (TmpRepos, Repositories, i);
|
||||
|
||||
// Don't create the window and status
|
||||
// icon when --disable-gui was given
|
||||
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
|
||||
string ConfigPath = SparklePaths.SparkleConfigPath;
|
||||
string AvatarPath = SparklePaths.SparkleAvatarPath;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue