[ui] Add a button to bubbles with 'Show Events'
This commit is contained in:
parent
1af89b0573
commit
01d8baf364
|
@ -393,7 +393,7 @@ namespace SparkleLib {
|
||||||
Process.Start ();
|
Process.Start ();
|
||||||
string message = Process.StandardOutput.ReadToEnd ().Trim ();
|
string message = Process.StandardOutput.ReadToEnd ().Trim ();
|
||||||
|
|
||||||
NewCommitArgs new_commit_args = new NewCommitArgs (author, email, message);
|
NewCommitArgs new_commit_args = new NewCommitArgs (author, email, message, Name);
|
||||||
|
|
||||||
if (NewCommit != null)
|
if (NewCommit != null)
|
||||||
NewCommit (this, new_commit_args);
|
NewCommit (this, new_commit_args);
|
||||||
|
@ -741,13 +741,15 @@ namespace SparkleLib {
|
||||||
public string Author;
|
public string Author;
|
||||||
public string Email;
|
public string Email;
|
||||||
public string Message;
|
public string Message;
|
||||||
|
public string RepositoryName;
|
||||||
|
|
||||||
public NewCommitArgs (string author, string email, string message)
|
public NewCommitArgs (string author, string email, string message, string repository_name)
|
||||||
{
|
{
|
||||||
|
|
||||||
Author = author;
|
Author = author;
|
||||||
Email = email;
|
Email = email;
|
||||||
Message = message;
|
Message = message;
|
||||||
|
RepositoryName = repository_name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleLog : Window {
|
public class SparkleLog : Window {
|
||||||
|
|
||||||
private SparkleRepo SparkleRepo;
|
private string LocalPath;
|
||||||
private VBox LayoutVertical;
|
private VBox LayoutVertical;
|
||||||
private ScrolledWindow ScrolledWindow;
|
private ScrolledWindow ScrolledWindow;
|
||||||
|
|
||||||
|
@ -38,16 +38,18 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SparkleLog (SparkleRepo sparkle_repo) : base ("")
|
public SparkleLog (string path) : base ("")
|
||||||
{
|
{
|
||||||
|
|
||||||
SparkleRepo = sparkle_repo;
|
LocalPath = path;
|
||||||
|
|
||||||
|
string name = System.IO.Path.GetFileName (LocalPath);
|
||||||
SetSizeRequest (540, 640);
|
SetSizeRequest (540, 640);
|
||||||
SetPosition (WindowPosition.Center);
|
SetPosition (WindowPosition.Center);
|
||||||
BorderWidth = 12;
|
BorderWidth = 12;
|
||||||
|
|
||||||
// TRANSLATORS: {0} is a folder name, and {1} is a server address
|
// TRANSLATORS: {0} is a folder name, and {1} is a server address
|
||||||
Title = String.Format(_("Recent Events in ‘{0}’"), SparkleRepo.Name);
|
Title = String.Format(_("Recent Events in ‘{0}’"), name);
|
||||||
IconName = "folder";
|
IconName = "folder";
|
||||||
|
|
||||||
LayoutVertical = new VBox (false, 12);
|
LayoutVertical = new VBox (false, 12);
|
||||||
|
@ -63,11 +65,9 @@ namespace SparkleShare {
|
||||||
|
|
||||||
open_folder_button.Clicked += delegate (object o, EventArgs args) {
|
open_folder_button.Clicked += delegate (object o, EventArgs args) {
|
||||||
|
|
||||||
string path = SparkleHelpers.CombineMore (SparklePaths.SparklePath, SparkleRepo.Name);
|
|
||||||
|
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
process.StartInfo.FileName = "xdg-open";
|
process.StartInfo.FileName = "xdg-open";
|
||||||
process.StartInfo.Arguments = path.Replace (" ", "\\ "); // Escape space-characters
|
process.StartInfo.Arguments = LocalPath.Replace (" ", "\\ "); // Escape space-characters
|
||||||
process.Start ();
|
process.Start ();
|
||||||
|
|
||||||
Destroy ();
|
Destroy ();
|
||||||
|
@ -113,7 +113,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
process.StartInfo.UseShellExecute = false;
|
process.StartInfo.UseShellExecute = false;
|
||||||
process.StartInfo.WorkingDirectory = SparkleRepo.LocalPath;
|
process.StartInfo.WorkingDirectory = LocalPath;
|
||||||
process.StartInfo.FileName = "git";
|
process.StartInfo.FileName = "git";
|
||||||
process.StartInfo.Arguments = "log --format=\"%at☃%an☃%ae☃%s\" -" + number_of_events;
|
process.StartInfo.Arguments = "log --format=\"%at☃%an☃%ae☃%s\" -" + number_of_events;
|
||||||
|
|
||||||
|
|
|
@ -113,12 +113,12 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private EventHandler CreateWindowDelegate (SparkleRepo repo)
|
private EventHandler CreateWindowDelegate (string path)
|
||||||
{
|
{
|
||||||
|
|
||||||
return delegate {
|
return delegate {
|
||||||
|
|
||||||
SparkleLog log = new SparkleLog (repo);
|
SparkleLog log = new SparkleLog (path);
|
||||||
log.ShowAll ();
|
log.ShowAll ();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -222,7 +222,7 @@ namespace SparkleShare {
|
||||||
IsImportant = true
|
IsImportant = true
|
||||||
};
|
};
|
||||||
|
|
||||||
FolderAction.Activated += CreateWindowDelegate (repo);
|
FolderAction.Activated += CreateWindowDelegate (repo.LocalPath);
|
||||||
|
|
||||||
MenuItem menu_item = (MenuItem) FolderAction.CreateMenuItem ();
|
MenuItem menu_item = (MenuItem) FolderAction.CreateMenuItem ();
|
||||||
|
|
||||||
|
|
|
@ -301,15 +301,26 @@ namespace SparkleShare {
|
||||||
|
|
||||||
// Shows a notification bubble when someone
|
// Shows a notification bubble when someone
|
||||||
// made a change to the repository
|
// made a change to the repository
|
||||||
public void ShowNewCommitBubble (string author, string email, string message) {
|
public void ShowNewCommitBubble (string author, string email, string message, string repository_name) {
|
||||||
|
|
||||||
string notify_settings_file = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath,
|
string notify_settings_file = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath,
|
||||||
"sparkleshare.notify");
|
"sparkleshare.notify");
|
||||||
|
|
||||||
if (File.Exists (notify_settings_file)) {
|
if (File.Exists (notify_settings_file)) {
|
||||||
|
|
||||||
SparkleBubble bubble= new SparkleBubble (author, message);
|
SparkleBubble bubble = new SparkleBubble (author, message) {
|
||||||
bubble.Icon = SparkleHelpers.GetAvatar (email, 32);
|
Icon = SparkleHelpers.GetAvatar (email, 32)
|
||||||
|
};
|
||||||
|
|
||||||
|
bubble.AddAction ("ShowDetails", "Show Events", delegate {
|
||||||
|
|
||||||
|
string path = SparkleHelpers.CombineMore (SparklePaths.SparklePath, repository_name);
|
||||||
|
|
||||||
|
SparkleLog log = new SparkleLog (path);
|
||||||
|
log.ShowAll ();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
bubble.Show ();
|
bubble.Show ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -363,7 +374,8 @@ namespace SparkleShare {
|
||||||
SparkleRepo repo = new SparkleRepo (folder_path);
|
SparkleRepo repo = new SparkleRepo (folder_path);
|
||||||
|
|
||||||
repo.NewCommit += delegate (object o, NewCommitArgs args) {
|
repo.NewCommit += delegate (object o, NewCommitArgs args) {
|
||||||
Application.Invoke (delegate { ShowNewCommitBubble (args.Author, args.Email, args.Message); });
|
Application.Invoke (delegate { ShowNewCommitBubble (args.Author, args.Email, args.Message,
|
||||||
|
args.RepositoryName); });
|
||||||
};
|
};
|
||||||
|
|
||||||
repo.Commited += delegate (object o, SparkleEventArgs args) {
|
repo.Commited += delegate (object o, SparkleEventArgs args) {
|
||||||
|
|
Loading…
Reference in a new issue