[log][repo][statusicon] add notices and icons when there are unpushed changes
This commit is contained in:
parent
443b221a32
commit
71f1252157
|
@ -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)
|
||||
|
|
|
@ -98,6 +98,8 @@ namespace SparkleShare {
|
|||
|
||||
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 = "<b>" + _("This folder has unsynced changes") + "</b>\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);
|
||||
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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)" \
|
||||
|
|
BIN
data/icons/dialog-warning-16.png
Normal file
BIN
data/icons/dialog-warning-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 683 B |
BIN
data/icons/dialog-warning-24.png
Normal file
BIN
data/icons/dialog-warning-24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 1 KiB |
Loading…
Reference in a new issue