diff --git a/SparkleLib/SparkleRepo.cs b/SparkleLib/SparkleRepo.cs index 304ab8f8..fed2dd4b 100644 --- a/SparkleLib/SparkleRepo.cs +++ b/SparkleLib/SparkleRepo.cs @@ -265,13 +265,21 @@ namespace SparkleLib { _UserName = GetUserName (); _UserEmail = GetUserEmail (); _CurrentHash = GetCurrentHash (); - _HasUnsyncedChanges = false; _IsSyncing = false; _IsBuffering = false; _IsPolling = true; _IsFetching = false; _IsPushing = false; + string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath , + ".git", "has_unsynced_changes"); + + if (File.Exists (unsynced_file_path)) + _HasUnsyncedChanges = true; + else + _HasUnsyncedChanges = false; + + if (_CurrentHash == null) CreateInitialCommit (); @@ -770,6 +778,12 @@ namespace SparkleLib { SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Pushing failed."); + string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath , + ".git", "has_unsynced_changes"); + + if (!File.Exists (unsynced_file_path)) + File.Create (unsynced_file_path); + _HasUnsyncedChanges = true; args = new SparkleEventArgs ("PushingFailed"); @@ -783,6 +797,12 @@ namespace SparkleLib { args = new SparkleEventArgs ("PushingFinished"); + string unsynced_file_path = SparkleHelpers.CombineMore (LocalPath , + ".git", "has_unsynced_changes"); + + if (File.Exists (unsynced_file_path)) + File.Delete (unsynced_file_path); + _HasUnsyncedChanges = false; if (PushingFinished != null) diff --git a/SparkleShare/SparkleLog.cs b/SparkleShare/SparkleLog.cs index fe455cf5..f5e99913 100644 --- a/SparkleShare/SparkleLog.cs +++ b/SparkleShare/SparkleLog.cs @@ -97,7 +97,9 @@ namespace SparkleShare { MenuBar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal)); LayoutVertical = new VBox (false, 0); - + + + LayoutVertical.PackStart (CreateEventLog (), true, true, 0); HButtonBox dialog_buttons = new HButtonBox { @@ -143,7 +145,6 @@ namespace SparkleShare { foreach (SparkleRepo repo in SparkleUI.Repositories) { - // Get commits from the repository if (repo.LocalPath.Equals (LocalPath)) { // Remove the eventhooks @@ -231,6 +232,37 @@ namespace SparkleShare { VBox layout_vertical = new VBox (false, 0); + + if ((SparkleUI.Repositories.Find (delegate (SparkleRepo r) + { return r.LocalPath.Equals (LocalPath); }) as SparkleRepo).HasUnsyncedChanges == true) { + + Window window = new Window (WindowType.Popup) { + Name = "gtk-tooltip" + }; + + window.EnsureStyle (); + + EventBox warning_box = new EventBox () { + Style = window.Style + }; + + Label label = new Label () { + Markup = "" + _("This folder has unsynced changes") + "\n" + + _("We will sync these once connected again") + }; + + HBox warning_hbox = new HBox (false, 12) { + BorderWidth = 12 + }; + warning_hbox.PackStart (new Image (SparkleUIHelpers.GetIcon ("dialog-warning", 24)), false, false, 0); + + warning_hbox.PackStart (label, false, false, 0); + warning_box.Add (warning_hbox); + + layout_vertical.PackStart (warning_box, false, false, 0); + + } + TreeView tree_view = new TreeView (); Gdk.Color background_color = tree_view.Style.Base (StateType.Normal); diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index d12f02b6..37cd8921 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -227,10 +227,8 @@ namespace SparkleShare { // Creates the menu that is popped up when the // user clicks the statusicon public void CreateMenu () - {int i = 0; -foreach (SparkleLog logi in SparkleUI.OpenLogs){i++; -Console.WriteLine (i + ": " + logi.LocalPath); -} + { + Menu = new Menu (); // The menu item showing the status and size of the SparkleShare folder @@ -269,10 +267,9 @@ Console.WriteLine (i + ": " + logi.LocalPath); IsImportant = true }; - if (repo.HasUnsyncedChanges){ + if (repo.HasUnsyncedChanges) folder_action.IconName = "dialog-warning"; - Console.WriteLine ("FFFFFFFFFFFFFFFFFFFF"); -} + folder_action.Activated += OpenLogDelegate (repo.LocalPath); MenuItem menu_item = (MenuItem) folder_action.CreateMenuItem (); diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 88e72484..0b9edd10 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -29,7 +29,8 @@ app_theme_icons = \ status,document-edited-16.png \ status,document-moved-16.png \ status,document-removed-16.png \ - status,dialog-warning-16.png + status,dialog-warning-16.png \ + status,dialog-warning-24.png install_icon_exec = $(top_srcdir)/build/icon-theme-installer \ -t "$(theme)" \ diff --git a/data/icons/dialog-warning-16.png b/data/icons/dialog-warning-16.png new file mode 100644 index 00000000..219432c4 Binary files /dev/null and b/data/icons/dialog-warning-16.png differ diff --git a/data/icons/dialog-warning-24.png b/data/icons/dialog-warning-24.png new file mode 100644 index 00000000..05149670 Binary files /dev/null and b/data/icons/dialog-warning-24.png differ diff --git a/data/icons/dialog-warning.png b/data/icons/dialog-warning.png index 219432c4..93050550 100644 Binary files a/data/icons/dialog-warning.png and b/data/icons/dialog-warning.png differ