Fixed: if added remote folder then update repositories in menu
This commit is contained in:
parent
645ec60c56
commit
10f4156a9a
|
@ -107,7 +107,7 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsGitUrl (string Url) {
|
public static bool IsGitUrl (string Url) {
|
||||||
return Regex.Match (Url, @"[a-z]+://(.)+(/|:)(.)+").Success;
|
return Regex.Match (Url, @"(.)+(/|:)(.)+").Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DebugInfo (string Type, string Message) {
|
public static void DebugInfo (string Type, string Message) {
|
||||||
|
|
|
@ -25,6 +25,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleUI {
|
public class SparkleUI {
|
||||||
|
|
||||||
|
private Process Process;
|
||||||
|
|
||||||
// Short alias for the translations
|
// Short alias for the translations
|
||||||
public static string _ (string s) {
|
public static string _ (string s) {
|
||||||
return Catalog.GetString (s);
|
return Catalog.GetString (s);
|
||||||
|
@ -34,7 +36,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleUI (bool HideUI) {
|
public SparkleUI (bool HideUI) {
|
||||||
|
|
||||||
Process Process = new Process ();
|
Process = new Process ();
|
||||||
Process.EnableRaisingEvents = true;
|
Process.EnableRaisingEvents = true;
|
||||||
Process.StartInfo.RedirectStandardOutput = true;
|
Process.StartInfo.RedirectStandardOutput = true;
|
||||||
Process.StartInfo.UseShellExecute = false;
|
Process.StartInfo.UseShellExecute = false;
|
||||||
|
@ -88,36 +90,7 @@ namespace SparkleShare {
|
||||||
NotificationIcon = new SparkleStatusIcon ();
|
NotificationIcon = new SparkleStatusIcon ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all the repos in ~/SparkleShare
|
UpdateRepositories ();
|
||||||
SparkleRepo [] TmpRepos =
|
|
||||||
new SparkleRepo [Directory.GetDirectories (SparklePath).Length];
|
|
||||||
|
|
||||||
int FolderCount = 0;
|
|
||||||
foreach (string Folder in Directory.GetDirectories (SparklePath)) {
|
|
||||||
|
|
||||||
// Check if the folder is a git repo
|
|
||||||
if (Directory.Exists (SparkleHelpers.CombineMore (Folder,
|
|
||||||
".git"))) {
|
|
||||||
TmpRepos [FolderCount] = new SparkleRepo (Folder);
|
|
||||||
FolderCount++;
|
|
||||||
|
|
||||||
// TODO: emblems don't work in nautilus
|
|
||||||
// Attach emblems
|
|
||||||
switch (SparklePlatform.Name) {
|
|
||||||
case "GNOME":
|
|
||||||
Process.StartInfo.FileName = "gvfs-set-attribute";
|
|
||||||
Process.StartInfo.Arguments =
|
|
||||||
"-t string \"" + Folder + "\" metadata::emblems [synced]";
|
|
||||||
Process.Start ();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SparkleShare.Repositories = new SparkleRepo [FolderCount];
|
|
||||||
Array.Copy (TmpRepos, SparkleShare.Repositories, FolderCount);
|
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -202,6 +175,38 @@ namespace SparkleShare {
|
||||||
File.Create (NotifySettingFile);
|
File.Create (NotifySettingFile);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void UpdateRepositories () {
|
||||||
|
string SparklePath = SparklePaths.SparklePath;
|
||||||
|
// Get all the repos in ~/SparkleShare
|
||||||
|
SparkleRepo [] TmpRepos =
|
||||||
|
new SparkleRepo [Directory.GetDirectories (SparklePath).Length];
|
||||||
|
|
||||||
|
int FolderCount = 0;
|
||||||
|
foreach (string Folder in Directory.GetDirectories (SparklePath)) {
|
||||||
|
|
||||||
|
// Check if the folder is a git repo
|
||||||
|
if (Directory.Exists (SparkleHelpers.CombineMore (Folder,
|
||||||
|
".git"))) {
|
||||||
|
TmpRepos [FolderCount] = new SparkleRepo (Folder);
|
||||||
|
FolderCount++;
|
||||||
|
|
||||||
|
// TODO: emblems don't work in nautilus
|
||||||
|
// Attach emblems
|
||||||
|
switch (SparklePlatform.Name) {
|
||||||
|
case "GNOME":
|
||||||
|
Process.StartInfo.FileName = "gvfs-set-attribute";
|
||||||
|
Process.StartInfo.Arguments =
|
||||||
|
"-t string \"" + Folder + "\" metadata::emblems [synced]";
|
||||||
|
Process.Start ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
SparkleShare.Repositories = new SparkleRepo [FolderCount];
|
||||||
|
Array.Copy (TmpRepos, SparkleShare.Repositories, FolderCount);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue