[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 ();
|
||||
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)
|
||||
NewCommit (this, new_commit_args);
|
||||
|
@ -741,13 +741,15 @@ namespace SparkleLib {
|
|||
public string Author;
|
||||
public string Email;
|
||||
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;
|
||||
Email = email;
|
||||
Message = message;
|
||||
RepositoryName = repository_name;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@ using System.Text.RegularExpressions;
|
|||
|
||||
namespace SparkleShare {
|
||||
|
||||
public class SparkleLog : Window {
|
||||
public class SparkleLog : Window {
|
||||
|
||||
private SparkleRepo SparkleRepo;
|
||||
private string LocalPath;
|
||||
private VBox LayoutVertical;
|
||||
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);
|
||||
SetPosition (WindowPosition.Center);
|
||||
BorderWidth = 12;
|
||||
|
||||
// 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";
|
||||
|
||||
LayoutVertical = new VBox (false, 12);
|
||||
|
@ -63,11 +65,9 @@ namespace SparkleShare {
|
|||
|
||||
open_folder_button.Clicked += delegate (object o, EventArgs args) {
|
||||
|
||||
string path = SparkleHelpers.CombineMore (SparklePaths.SparklePath, SparkleRepo.Name);
|
||||
|
||||
Process process = new Process ();
|
||||
process.StartInfo.FileName = "xdg-open";
|
||||
process.StartInfo.Arguments = path.Replace (" ", "\\ "); // Escape space-characters
|
||||
process.StartInfo.Arguments = LocalPath.Replace (" ", "\\ "); // Escape space-characters
|
||||
process.Start ();
|
||||
|
||||
Destroy ();
|
||||
|
@ -113,7 +113,7 @@ namespace SparkleShare {
|
|||
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
process.StartInfo.WorkingDirectory = SparkleRepo.LocalPath;
|
||||
process.StartInfo.WorkingDirectory = LocalPath;
|
||||
process.StartInfo.FileName = "git";
|
||||
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 {
|
||||
|
||||
SparkleLog log = new SparkleLog (repo);
|
||||
SparkleLog log = new SparkleLog (path);
|
||||
log.ShowAll ();
|
||||
|
||||
};
|
||||
|
@ -222,7 +222,7 @@ namespace SparkleShare {
|
|||
IsImportant = true
|
||||
};
|
||||
|
||||
FolderAction.Activated += CreateWindowDelegate (repo);
|
||||
FolderAction.Activated += CreateWindowDelegate (repo.LocalPath);
|
||||
|
||||
MenuItem menu_item = (MenuItem) FolderAction.CreateMenuItem ();
|
||||
|
||||
|
|
|
@ -301,15 +301,26 @@ namespace SparkleShare {
|
|||
|
||||
// Shows a notification bubble when someone
|
||||
// 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,
|
||||
"sparkleshare.notify");
|
||||
|
||||
if (File.Exists (notify_settings_file)) {
|
||||
|
||||
SparkleBubble bubble= new SparkleBubble (author, message);
|
||||
bubble.Icon = SparkleHelpers.GetAvatar (email, 32);
|
||||
SparkleBubble bubble = new SparkleBubble (author, message) {
|
||||
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 ();
|
||||
|
||||
}
|
||||
|
@ -363,7 +374,8 @@ namespace SparkleShare {
|
|||
SparkleRepo repo = new SparkleRepo (folder_path);
|
||||
|
||||
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) {
|
||||
|
|
Loading…
Reference in a new issue