make global setting for notifications work
This commit is contained in:
parent
44ad4a9b45
commit
1e04bade71
|
@ -40,8 +40,6 @@ namespace SparkleShare {
|
|||
|
||||
public string UserEmail;
|
||||
public string UserName;
|
||||
public bool NotifyChanges;
|
||||
public bool SyncChanges;
|
||||
|
||||
public SparkleRepo (string RepoPath) {
|
||||
|
||||
|
@ -54,17 +52,6 @@ namespace SparkleShare {
|
|||
LocalPath = RepoPath;
|
||||
Process.StartInfo.WorkingDirectory = LocalPath;
|
||||
|
||||
string NotifyChangesFileName =
|
||||
SparkleHelpers.CombineMore (LocalPath, ".git",
|
||||
"sparkleshare.notify");
|
||||
|
||||
string SyncChangesFileName =
|
||||
SparkleHelpers.CombineMore (LocalPath, ".git",
|
||||
"sparkleshare.sync");
|
||||
|
||||
NotifyChanges = File.Exists (NotifyChangesFileName);
|
||||
SyncChanges = File.Exists (SyncChangesFileName);
|
||||
|
||||
// Get user.name, example: "User Name"
|
||||
UserName = "Anonymous";
|
||||
Process.StartInfo.FileName = "git";
|
||||
|
@ -131,7 +118,7 @@ namespace SparkleShare {
|
|||
// Starts a time buffer when something changes
|
||||
public void OnFileActivity (object o, FileSystemEventArgs args) {
|
||||
WatcherChangeTypes wct = args.ChangeType;
|
||||
if (!ShouldIgnore (args.Name) && SyncChanges) {
|
||||
if (!ShouldIgnore (args.Name)) {
|
||||
Console.WriteLine ("[Event][" + Name + "] " + wct.ToString() +
|
||||
" '" + args.Name + "'");
|
||||
StartBufferTimer ();
|
||||
|
@ -261,9 +248,14 @@ namespace SparkleShare {
|
|||
Process.Start();
|
||||
string LastCommitUserName = Process.StandardOutput.ReadToEnd().Trim ();
|
||||
|
||||
ShowEventBubble (LastCommitUserName + " " + LastCommitMessage,
|
||||
SparkleHelpers.GetAvatar (LastCommitEmail, 48),
|
||||
true);
|
||||
string NotifySettingFile =
|
||||
SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath,
|
||||
"sparkleshare.notify");
|
||||
|
||||
if (File.Exists (NotifySettingFile))
|
||||
ShowEventBubble (LastCommitUserName + " " + LastCommitMessage,
|
||||
SparkleHelpers.GetAvatar (LastCommitEmail, 48),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -391,20 +383,18 @@ namespace SparkleShare {
|
|||
Gdk.Pixbuf Avatar,
|
||||
bool ShowButtons) {
|
||||
|
||||
if (NotifyChanges) {
|
||||
SparkleBubble StuffChangedBubble = new SparkleBubble (Title, "");
|
||||
StuffChangedBubble.Icon = Avatar;
|
||||
|
||||
// Add a button to open the folder where the changed file is
|
||||
if (ShowButtons)
|
||||
StuffChangedBubble.AddAction ("", "Open Folder",
|
||||
delegate {
|
||||
Process.StartInfo.FileName = "xdg-open";
|
||||
delegate {
|
||||
Process.StartInfo.FileName = "xdg-open";
|
||||
Process.StartInfo.Arguments = LocalPath;
|
||||
Process.Start();
|
||||
Process.StartInfo.FileName = "git";
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ using Gtk;
|
|||
using Mono.Unix;
|
||||
using SparkleShare;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace SparkleShare {
|
||||
|
@ -69,27 +70,24 @@ namespace SparkleShare {
|
|||
Menu.Add (NotifyCheckMenuItem);
|
||||
Menu.Add (new SeparatorMenuItem ());
|
||||
|
||||
/*
|
||||
|
||||
|
||||
string NotifyChangesFileName =
|
||||
SparkleHelpers.CombineMore (SparkleRepo.LocalPath,
|
||||
".git", "sparkleshare.notify");
|
||||
SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath,
|
||||
"sparkleshare.notify");
|
||||
|
||||
if (File.Exists (NotifyChangesFileName))
|
||||
NotifyChangesCheckButton.Active = true;
|
||||
if (System.IO.File.Exists (NotifyChangesFileName))
|
||||
NotifyCheckMenuItem.Active = true;
|
||||
|
||||
NotifyChangesCheckButton.Toggled += delegate {
|
||||
if (File.Exists (NotifyChangesFileName)) {
|
||||
SparkleRepo.NotifyChanges = false;
|
||||
NotifyCheckMenuItem.Toggled += delegate {
|
||||
if (System.IO.File.Exists (NotifyChangesFileName)) {
|
||||
File.Delete (NotifyChangesFileName);
|
||||
} else {
|
||||
SparkleRepo.NotifyChanges = true;
|
||||
File.Create (NotifyChangesFileName);
|
||||
System.IO.File.Create (NotifyChangesFileName);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
*/
|
||||
|
||||
MenuItem OpenFolderItem = new MenuItem (_("Open Sharing Folder"));
|
||||
OpenFolderItem.Activated += delegate {
|
||||
|
|
Loading…
Reference in a new issue