From 68250779155ec32d4555f06fd6b356fb12855b5d Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Sat, 22 May 2010 16:41:28 +0100 Subject: [PATCH] show 'some rearrangements --- README | 2 +- SparkleShare/SparkleBubble.cs | 36 +++++++++++++++++++++++++ SparkleShare/SparkleBubble.osx.cs | 32 ++++++++++++++++++++++ SparkleShare/SparkleDialog.cs | 4 +-- SparkleShare/SparkleStatusIcon.cs | 45 ++++++++++++++++--------------- SparkleShare/SparkleWindow.cs | 12 ++------- 6 files changed, 96 insertions(+), 35 deletions(-) create mode 100644 SparkleShare/SparkleBubble.cs create mode 100644 SparkleShare/SparkleBubble.osx.cs diff --git a/README b/README index c1fe81c3..d8f18bcb 100644 --- a/README +++ b/README @@ -70,7 +70,7 @@ Frequently Asked Question ========================= Q: Why is it written in Mono/C#? -A: Because. +A: Because. And I hate freedom too. Info diff --git a/SparkleShare/SparkleBubble.cs b/SparkleShare/SparkleBubble.cs new file mode 100644 index 00000000..0965795a --- /dev/null +++ b/SparkleShare/SparkleBubble.cs @@ -0,0 +1,36 @@ +// SparkleShare, an instant update workflow to Git. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +using Gtk; +using Notifications; +using SparkleShare; + +namespace SparkleShare { + + public class SparkleBubble : Notification { + + public SparkleBubble (string Title, string Subtext) : base (Title, Subtext) { + Timeout = 4500; + Urgency = Urgency.Low; + Show (); + + // TODO: Doesn't work for some reason + AttachToStatusIcon (SparkleUI.NotificationIcon); + } + + } + +} diff --git a/SparkleShare/SparkleBubble.osx.cs b/SparkleShare/SparkleBubble.osx.cs new file mode 100644 index 00000000..eb194cda --- /dev/null +++ b/SparkleShare/SparkleBubble.osx.cs @@ -0,0 +1,32 @@ +// SparkleShare, an instant update workflow to Git. +// Copyright (C) 2010 Hylke Bons +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +using Notifications; + +namespace SparkleShare { + + public class SparkleBubble : Notification { + + public SparkleBubble (string Title, string Subtext) : base (Title, Subtext) { + Timeout = 4500; + Urgency = Urgency.Low; + Show (); +// StatusIcon = SparkleUI.NotificationIcon; // Doesn't work for some reason :( + } + + } + +} diff --git a/SparkleShare/SparkleDialog.cs b/SparkleShare/SparkleDialog.cs index d526da15..8b764262 100644 --- a/SparkleShare/SparkleDialog.cs +++ b/SparkleShare/SparkleDialog.cs @@ -57,8 +57,8 @@ namespace SparkleShare { RemoteUrlCombo = new ComboBoxEntry (DefaultUrls); - Label RemoteUrlExample = new Label (_("These usually look something like this:\n ") + - _("‘ssh://git@github.com/hbons/SparkleShare’.")); + Label RemoteUrlExample = new Label (_("These usually look something like this:\n ") + + _("‘ssh://git@github.com/hbons/SparkleShare’.")); RemoteUrlExample.UseMarkup = true; RemoteUrlExample.SetAlignment (0, 0); RemoteUrlLabel.Xalign = 1; diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs index ccea2420..e8de185c 100644 --- a/SparkleShare/SparkleStatusIcon.cs +++ b/SparkleShare/SparkleStatusIcon.cs @@ -48,14 +48,32 @@ namespace SparkleShare { Menu.Add (StatusItem); Menu.Add (new SeparatorMenuItem ()); - MenuItem [] FolderItems = - new MenuItem [SparkleShare.Repositories.Length]; + MenuItem OpenFolderItem = new MenuItem (_("SparkleShare Folder")); + OpenFolderItem.Activated += delegate { + Process Process = new Process (); + switch (SparklePlatform.Name) { + case "GNOME": + Process.StartInfo.FileName = "xdg-open"; + break; + case "OSX": + Process.StartInfo.FileName = "open"; + break; + } + Process.StartInfo.Arguments = SparklePaths.SparklePath; + Process.Start(); + }; + Menu.Add (OpenFolderItem); + Action [] FolderItems = + new Action [SparkleShare.Repositories.Length]; + int i = 0; foreach (SparkleRepo SparkleRepo in SparkleShare.Repositories) { - FolderItems [i] = new MenuItem (SparkleRepo.Name); + FolderItems [i] = new Action("", SparkleRepo.Name); + FolderItems [i].IconName = "folder"; + FolderItems [i].IsImportant = true; FolderItems [i].Activated += CreateWindowDelegate (SparkleRepo); - Menu.Add (FolderItems [i]); + Menu.Add (FolderItems [i].CreateMenuItem ()); i++; } @@ -87,22 +105,6 @@ namespace SparkleShare { } }; - MenuItem OpenFolderItem = new MenuItem (_("Open SparkleShare Folder")); - OpenFolderItem.Activated += delegate { - Process Process = new Process (); - switch (SparklePlatform.Name) { - case "GNOME": - Process.StartInfo.FileName = "xdg-open"; - break; - case "OSX": - Process.StartInfo.FileName = "open"; - break; - } - Process.StartInfo.Arguments = SparklePaths.SparklePath; - Process.Start(); - }; - Menu.Add (OpenFolderItem); - MenuItem AboutItem = new MenuItem (_("About SparkleShare")); AboutItem.Activated += delegate { Process Process = new Process (); @@ -123,10 +125,9 @@ namespace SparkleShare { MenuItem QuitItem = new MenuItem ("Quit"); QuitItem.Activated += delegate { Environment.Exit (0); }; Menu.Add (QuitItem); - Menu.ShowAll (); Menu.Popup (); - + // TODO: Make sure the menu never overlaps the status icon }; SetIdleState (); diff --git a/SparkleShare/SparkleWindow.cs b/SparkleShare/SparkleWindow.cs index 50400f0d..69b68c9d 100644 --- a/SparkleShare/SparkleWindow.cs +++ b/SparkleShare/SparkleWindow.cs @@ -49,7 +49,7 @@ namespace SparkleShare { Title = _("‘" + SparkleRepo.Name + "’ on " + SparkleRepo.RemoteOriginUrl .TrimEnd (("/" + SparkleRepo.Name + ".git").ToCharArray ())); - IconName = "folder-sparkleshare"; + IconName = "folder"; VBox LayoutVertical = new VBox (false, 0); @@ -73,14 +73,6 @@ namespace SparkleShare { LayoutVertical.PackStart (DialogButtons, false, false, 0); -/* Timer RedrawTimer = new Timer (); - RedrawTimer.Interval = 5000; - RedrawTimer.Elapsed += delegate { - UpdatePeopleList (); - UpdateEventLog (); - }; - RedrawTimer.Start(); -*/ Add (LayoutVertical); } @@ -194,7 +186,7 @@ namespace SparkleShare { Columns [0].MinWidth = 28; Columns [1].Expand = true; Columns [2].Expand = true; - Columns [1].MinWidth = 300; + Columns [1].MinWidth = 350; LogView.CursorChanged += delegate(object o, EventArgs args) { TreeModel Model;