rename some classes and file
This commit is contained in:
parent
4eba19b62d
commit
993a2a0cca
|
@ -26,8 +26,8 @@ using System.Timers;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
// Repository class holds repository information and timers
|
// SparkleRepo class holds repository information and timers
|
||||||
public class Repository {
|
public class SparkleRepo {
|
||||||
|
|
||||||
private Process Process;
|
private Process Process;
|
||||||
private Timer FetchTimer;
|
private Timer FetchTimer;
|
||||||
|
@ -44,7 +44,7 @@ namespace SparkleShare {
|
||||||
public string UserName;
|
public string UserName;
|
||||||
public bool MonitorOnly;
|
public bool MonitorOnly;
|
||||||
|
|
||||||
public Repository (string Path) {
|
public SparkleRepo (string Path) {
|
||||||
|
|
||||||
MonitorOnly = false;
|
MonitorOnly = false;
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Main.cs" />
|
<Compile Include="SparkleShare.cs" />
|
||||||
<Compile Include="Repository.cs" />
|
<Compile Include="SparkleRepo.cs" />
|
||||||
<Compile Include="SparkleUI.cs" />
|
<Compile Include="SparkleUI.cs" />
|
||||||
<Compile Include="SparkleStatusIcon.cs" />
|
<Compile Include="SparkleStatusIcon.cs" />
|
||||||
<Compile Include="SparkleWindow.cs" />
|
<Compile Include="SparkleWindow.cs" />
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace SparkleShare {
|
||||||
// Holds the status icon, window and repository list
|
// Holds the status icon, window and repository list
|
||||||
public class SparkleUI {
|
public class SparkleUI {
|
||||||
|
|
||||||
public Repository [] Repositories;
|
public SparkleRepo [] Repositories;
|
||||||
|
|
||||||
public SparkleWindow SparkleWindow;
|
public SparkleWindow SparkleWindow;
|
||||||
public SparkleStatusIcon SparkleStatusIcon;
|
public SparkleStatusIcon SparkleStatusIcon;
|
||||||
|
@ -75,11 +75,11 @@ namespace SparkleShare {
|
||||||
|
|
||||||
// Get all the repos in ~/SparkleShare
|
// Get all the repos in ~/SparkleShare
|
||||||
string [] Repos = Directory.GetDirectories (ReposPath);
|
string [] Repos = Directory.GetDirectories (ReposPath);
|
||||||
Repositories = new Repository [Repos.Length];
|
Repositories = new SparkleRepo [Repos.Length];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (string Folder in Repos) {
|
foreach (string Folder in Repos) {
|
||||||
Repositories [i] = new Repository (Folder);
|
Repositories [i] = new SparkleRepo (Folder);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,9 @@ namespace SparkleShare {
|
||||||
|
|
||||||
private TreeView ReposView;
|
private TreeView ReposView;
|
||||||
private ListStore ReposStore;
|
private ListStore ReposStore;
|
||||||
private Repository [] Repositories;
|
private SparkleRepo [] Repositories;
|
||||||
|
|
||||||
public SparkleWindow (Repository [] R) : base ("SparkleShare") {
|
public SparkleWindow (SparkleRepo [] R) : base ("SparkleShare") {
|
||||||
|
|
||||||
Repositories = R;
|
Repositories = R;
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@ namespace SparkleShare {
|
||||||
LayoutHorizontal = new HBox (false, 0);
|
LayoutHorizontal = new HBox (false, 0);
|
||||||
|
|
||||||
ReposStore = new ListStore (typeof (Gdk.Pixbuf),
|
ReposStore = new ListStore (typeof (Gdk.Pixbuf),
|
||||||
typeof (string),
|
typeof (string),
|
||||||
typeof (Repository));
|
typeof (SparkleRepo));
|
||||||
|
|
||||||
LayoutVerticalLeft = CreateReposList ();
|
LayoutVerticalLeft = CreateReposList ();
|
||||||
LayoutVerticalLeft.BorderWidth = 12;
|
LayoutVerticalLeft.BorderWidth = 12;
|
||||||
|
@ -120,12 +120,12 @@ namespace SparkleShare {
|
||||||
TreeSelection Selection = ReposView.Selection;;
|
TreeSelection Selection = ReposView.Selection;;
|
||||||
TreeIter Iter = new TreeIter ();;
|
TreeIter Iter = new TreeIter ();;
|
||||||
Selection.GetSelected (out Iter);
|
Selection.GetSelected (out Iter);
|
||||||
Repository Repository = (Repository)ReposStore.GetValue (Iter, 2);
|
SparkleRepo SparkleRepo = (SparkleRepo)ReposStore.GetValue (Iter, 2);
|
||||||
Console.WriteLine(Repository.Name);
|
Console.WriteLine(SparkleRepo.Name);
|
||||||
|
|
||||||
LayoutHorizontal.Remove (LayoutVerticalRight);
|
LayoutHorizontal.Remove (LayoutVerticalRight);
|
||||||
|
|
||||||
LayoutVerticalRight = CreateDetailedView (Repository);
|
LayoutVerticalRight = CreateDetailedView (SparkleRepo);
|
||||||
|
|
||||||
LayoutHorizontal.PackStart (LayoutVerticalRight, true, true, 12);
|
LayoutHorizontal.PackStart (LayoutVerticalRight, true, true, 12);
|
||||||
ShowAll ();
|
ShowAll ();
|
||||||
|
@ -147,16 +147,16 @@ namespace SparkleShare {
|
||||||
"/usr/share/icons/gnome/32x32/places/folder.png";
|
"/usr/share/icons/gnome/32x32/places/folder.png";
|
||||||
|
|
||||||
TreeIter ReposIter;
|
TreeIter ReposIter;
|
||||||
foreach (Repository Repository in Repositories) {
|
foreach (SparkleRepo SparkleRepo in Repositories) {
|
||||||
|
|
||||||
ReposIter = ReposStore.Prepend ();
|
ReposIter = ReposStore.Prepend ();
|
||||||
|
|
||||||
ReposStore.SetValue (ReposIter, 0, new Gdk.Pixbuf (FolderIcon));
|
ReposStore.SetValue (ReposIter, 0, new Gdk.Pixbuf (FolderIcon));
|
||||||
|
|
||||||
ReposStore.SetValue (ReposIter, 1, Repository.Name + " \n" +
|
ReposStore.SetValue (ReposIter, 1, SparkleRepo.Name + " \n" +
|
||||||
Repository.Domain + " ");
|
SparkleRepo.Domain + " ");
|
||||||
|
|
||||||
ReposStore.SetValue (ReposIter, 2, Repository);
|
ReposStore.SetValue (ReposIter, 2, SparkleRepo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,10 +185,10 @@ namespace SparkleShare {
|
||||||
|
|
||||||
Selection.GetSelected (out Iter);
|
Selection.GetSelected (out Iter);
|
||||||
|
|
||||||
Repository Repository = (Repository)ReposStore.GetValue (Iter, 2);
|
SparkleRepo SparkleRepo = (SparkleRepo)ReposStore.GetValue (Iter, 2);
|
||||||
|
|
||||||
LayoutHorizontal.Remove (LayoutVerticalRight);
|
LayoutHorizontal.Remove (LayoutVerticalRight);
|
||||||
LayoutVerticalRight = CreateDetailedView (Repository);
|
LayoutVerticalRight = CreateDetailedView (SparkleRepo);
|
||||||
LayoutHorizontal.PackStart (LayoutVerticalRight, true, true, 12);
|
LayoutHorizontal.PackStart (LayoutVerticalRight, true, true, 12);
|
||||||
ShowAll ();
|
ShowAll ();
|
||||||
|
|
||||||
|
@ -220,17 +220,17 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates the detailed view
|
// Creates the detailed view
|
||||||
public VBox CreateDetailedView (Repository Repository) {
|
public VBox CreateDetailedView (SparkleRepo SparkleRepo) {
|
||||||
|
|
||||||
// Create box layout for Remote Address
|
// Create box layout for Remote Address
|
||||||
HBox RemoteUrlBox = new HBox (false, 0);
|
HBox RemoteUrlBox = new HBox (false, 0);
|
||||||
|
|
||||||
Label Property1 = new Label ("Remote Address:");
|
Label Property1 = new Label ("Remote address:");
|
||||||
Property1.WidthRequest = 120;
|
Property1.WidthRequest = 120;
|
||||||
Property1.SetAlignment (0, 0);
|
Property1.SetAlignment (0, 0);
|
||||||
|
|
||||||
Label Value1 = new Label
|
Label Value1 = new Label
|
||||||
("<b>" + Repository.RemoteOriginUrl + "</b>");
|
("<b>" + SparkleRepo.RemoteOriginUrl + "</b>");
|
||||||
|
|
||||||
Value1.UseMarkup = true;
|
Value1.UseMarkup = true;
|
||||||
|
|
||||||
|
@ -240,12 +240,12 @@ namespace SparkleShare {
|
||||||
// Create box layout for repository path
|
// Create box layout for repository path
|
||||||
HBox LocalPathBox = new HBox (false, 0);
|
HBox LocalPathBox = new HBox (false, 0);
|
||||||
|
|
||||||
Label Property2 = new Label ("Local Path:");
|
Label Property2 = new Label ("Local path:");
|
||||||
Property2.WidthRequest = 120;
|
Property2.WidthRequest = 120;
|
||||||
Property2.SetAlignment (0, 0);
|
Property2.SetAlignment (0, 0);
|
||||||
|
|
||||||
Label Value2 = new Label
|
Label Value2 = new Label
|
||||||
("<b>" + Repository.LocalPath + "</b>");
|
("<b>" + SparkleRepo.LocalPath + "</b>");
|
||||||
|
|
||||||
Value2.UseMarkup = true;
|
Value2.UseMarkup = true;
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ namespace SparkleShare {
|
||||||
VBox.PackStart (Table, false, false, 12);
|
VBox.PackStart (Table, false, false, 12);
|
||||||
|
|
||||||
VBox.PackStart (PeopleLabel, false, false, 0);
|
VBox.PackStart (PeopleLabel, false, false, 0);
|
||||||
VBox.PackStart (CreatePeopleList (Repository ), true, true, 12);
|
VBox.PackStart (CreatePeopleList (SparkleRepo ), true, true, 12);
|
||||||
|
|
||||||
return VBox;
|
return VBox;
|
||||||
|
|
||||||
|
@ -299,13 +299,13 @@ namespace SparkleShare {
|
||||||
Process.StartInfo.FileName = "git";
|
Process.StartInfo.FileName = "git";
|
||||||
|
|
||||||
string Output = "";
|
string Output = "";
|
||||||
foreach (Repository Repository in Repositories) {
|
foreach (SparkleRepo SparkleRepo in Repositories) {
|
||||||
|
|
||||||
// We're using the snowman here to separate messages :)
|
// We're using the snowman here to separate messages :)
|
||||||
Process.StartInfo.Arguments =
|
Process.StartInfo.Arguments =
|
||||||
"log --format=\"%at☃In ‘" + Repository.Name + "’, %an %s☃%cr\" -25";
|
"log --format=\"%at☃In ‘" + SparkleRepo.Name + "’, %an %s☃%cr\" -25";
|
||||||
|
|
||||||
Process.StartInfo.WorkingDirectory = Repository.LocalPath;
|
Process.StartInfo.WorkingDirectory = SparkleRepo.LocalPath;
|
||||||
Process.Start();
|
Process.Start();
|
||||||
Output += "\n" + Process.StandardOutput.ReadToEnd().Trim ();
|
Output += "\n" + Process.StandardOutput.ReadToEnd().Trim ();
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,7 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a visual list of people working in the repo
|
// Creates a visual list of people working in the repo
|
||||||
public ScrolledWindow CreatePeopleList (Repository Repository) {
|
public ScrolledWindow CreatePeopleList (SparkleRepo SparkleRepo) {
|
||||||
|
|
||||||
Process Process = new Process ();
|
Process Process = new Process ();
|
||||||
Process.EnableRaisingEvents = false;
|
Process.EnableRaisingEvents = false;
|
||||||
|
@ -388,7 +388,7 @@ namespace SparkleShare {
|
||||||
// Get a log of commits, example: "Hylke Bons☃added 'file'."
|
// Get a log of commits, example: "Hylke Bons☃added 'file'."
|
||||||
Process.StartInfo.FileName = "git";
|
Process.StartInfo.FileName = "git";
|
||||||
Process.StartInfo.Arguments = "log --format=\"%an☃%ae\" -50";
|
Process.StartInfo.Arguments = "log --format=\"%an☃%ae\" -50";
|
||||||
Process.StartInfo.WorkingDirectory = Repository.LocalPath;
|
Process.StartInfo.WorkingDirectory = SparkleRepo.LocalPath;
|
||||||
Process.Start();
|
Process.Start();
|
||||||
|
|
||||||
string Output = Process.StandardOutput.ReadToEnd().Trim ();
|
string Output = Process.StandardOutput.ReadToEnd().Trim ();
|
||||||
|
@ -412,7 +412,7 @@ namespace SparkleShare {
|
||||||
string UserEmail = Parts [1];
|
string UserEmail = Parts [1];
|
||||||
|
|
||||||
// Do something special if the person is you
|
// Do something special if the person is you
|
||||||
if (UserName.Equals (Repository.UserName))
|
if (UserName.Equals (SparkleRepo.UserName))
|
||||||
UserName += " (that’s you!)";
|
UserName += " (that’s you!)";
|
||||||
|
|
||||||
string AvatarFileName = GetAvatarFileName (UserEmail, 32);
|
string AvatarFileName = GetAvatarFileName (UserEmail, 32);
|
||||||
|
@ -465,7 +465,7 @@ namespace SparkleShare {
|
||||||
NameExample.SetAlignment (0, 0);
|
NameExample.SetAlignment (0, 0);
|
||||||
NameLabel.Xalign = 1;
|
NameLabel.Xalign = 1;
|
||||||
|
|
||||||
Label RemoteUrlLabel = new Label ("Remote Address: ");
|
Label RemoteUrlLabel = new Label ("Remote address: ");
|
||||||
|
|
||||||
string [] DefaultUrls = new string [3] { "ssh://git@github.com/",
|
string [] DefaultUrls = new string [3] { "ssh://git@github.com/",
|
||||||
"ssh://git@git.gnome.org/",
|
"ssh://git@git.gnome.org/",
|
||||||
|
|
Loading…
Reference in a new issue