diff --git a/SparkleLib/Defines.cs b/SparkleLib/Defines.cs index b56b96d6..51057bf2 100644 --- a/SparkleLib/Defines.cs +++ b/SparkleLib/Defines.cs @@ -19,7 +19,7 @@ using System; using System.Reflection; [assembly:AssemblyTitle ("SparkleLib")] -[assembly:AssemblyVersion ("1.2")] +[assembly:AssemblyVersion ("1.3")] [assembly:AssemblyCopyright ("Copyright (c) 2010 Hylke Bons and others")] [assembly:AssemblyTrademark ("SparkleShare is a trademark of SparkleShare Ltd.")] diff --git a/SparkleShare/Common/HTML/event-log.html b/SparkleShare/Common/HTML/event-log.html index b6988503..fa7b547d 100755 --- a/SparkleShare/Common/HTML/event-log.html +++ b/SparkleShare/Common/HTML/event-log.html @@ -55,7 +55,7 @@ background-color: #fefefe; color: ; font-size: ; - font-family: ; + font-family: ""; margin: 0; -webkit-user-select: none; } diff --git a/SparkleShare/Common/Pixmaps/Sources/about-dialog.svg b/SparkleShare/Common/Pixmaps/Sources/about-dialog.svg index f7058ce0..e7e8a8b6 100644 --- a/SparkleShare/Common/Pixmaps/Sources/about-dialog.svg +++ b/SparkleShare/Common/Pixmaps/Sources/about-dialog.svg @@ -14,7 +14,7 @@ height="260" width="640" version="1.1" - inkscape:version="0.48.2 r9819" + inkscape:version="0.48.4 r9939" sodipodi:docname="about-dialog.svg"> - - - - - - + + + + + + @@ -2098,21 +2116,21 @@ + {0}", text); - this.updates.ShowAll (); + this.updates.Text = text; + this.updates.ShowAll(); }); }; + + + CreateAbout (); } private void CreateAbout () { + Gdk.RGBA white = new Gdk.RGBA (); + white.Parse ("#ffffff"); + + Gdk.RGBA highlight = new Gdk.RGBA (); + highlight.Parse ("#a8bbcf"); + + Pango.FontDescription font = StyleContext.GetFont (StateFlags.Normal); + font.Size = 9 * 1024; + + CssProvider css_provider = new CssProvider (); + string image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine (); + + css_provider.LoadFromData ("GtkWindow {" + + "background-image: url('" + image_path + "');" + + "background-repeat: no-repeat;" + + "background-position: left bottom;" + + "}"); + + StyleContext.AddProvider (css_provider, 800); + + VBox layout_vertical = new VBox (false, 0); + HBox links_layout = new HBox (false, 16); + + Label version = new Label () { - Markup = string.Format ("version {0}", - Controller.RunningVersion), - Xalign = 0, - Xpad = 300 + Text = "version " + Controller.RunningVersion, + Xalign = 0, Xpad = 0 }; - this.updates = new Label () { - Markup = "Checking for updates...", - Xalign = 0, - Xpad = 300 + version.OverrideFont (font); + version.OverrideColor (StateFlags.Normal, white); + + + this.updates = new Label ("Checking for updates…") { + Xalign = 0, Xpad = 0 }; + this.updates.OverrideFont (font); + this.updates.OverrideColor (StateFlags.Normal, highlight); + + Label copyright = new Label () { - Markup = "" + - "Copyright © 2010–" + DateTime.Now.Year + " " + - "Hylke Bons and others." + - "", - Xalign = 0, - Xpad = 300 + Markup = string.Format ("Copyright © 2010–{0} Hylke Bons and others.", DateTime.Now.Year), + Xalign = 0, Xpad = 0 }; - Label license = new Label () { - LineWrap = true, - LineWrapMode = Pango.WrapMode.Word, - Markup = "" + - "SparkleShare is Open Source software. You are free to use, modify, " + - "and redistribute it under the GNU General Public License version 3 or later." + - "", - WidthRequest = 330, - Wrap = true, - Xalign = 0, - Xpad = 300, - }; + copyright.OverrideFont (font); + copyright.OverrideColor (StateFlags.Normal, white); - VBox layout_vertical = new VBox (false, 0) { - BorderWidth = 0, - HeightRequest = 260, - WidthRequest = 640 - }; - - HBox links_layout = new HBox (false, 6); - - SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress); - SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress); + + TextView license = new TextView (); + TextBuffer license_buffer = license.Buffer; + license.WrapMode = WrapMode.Word; + license.Sensitive = false; + + license_buffer.Text = "SparkleShare is Open Source and you’re free to use, change, " + + "and share it under the GNU GPLv3."; + + license.OverrideBackgroundColor (StateFlags.Normal, new Gdk.RGBA () { Alpha = 0 }); + license.OverrideFont (font); + license.OverrideColor (StateFlags.Normal, white); + + + SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress); + SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress); SparkleLink report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress); - SparkleLink debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress); - - links_layout.PackStart (new Label (""), false, false, 143); - links_layout.PackStart (website_link, false, false, 9); - links_layout.PackStart (credits_link, false, false, 9); - links_layout.PackStart (report_problem_link, false, false, 9); - links_layout.PackStart (debug_log_link, false, false, 9); - - layout_vertical.PackStart (new Label (""), false, false, 42); + SparkleLink debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress); + + + layout_vertical.PackStart (new Label (""), true, true, 0); layout_vertical.PackStart (version, false, false, 0); layout_vertical.PackStart (this.updates, false, false, 0); - layout_vertical.PackStart (copyright, false, false, 9); - layout_vertical.PackStart (license, false, false, 0); - layout_vertical.PackStart (links_layout, false, false, 12); - - Add (layout_vertical); + layout_vertical.PackStart (copyright, false, false, 6); + layout_vertical.PackStart (license, false, false, 6); + layout_vertical.PackStart (links_layout, false, false, 16); + + links_layout.PackStart (website_link, false, false, 0); + links_layout.PackStart (credits_link, false, false, 0); + links_layout.PackStart (report_problem_link, false, false, 0); + links_layout.PackStart (debug_log_link, false, false, 0); + + HBox layout_horizontal = new HBox (false, 0); + layout_horizontal.PackStart (new Label (""), false, false, 149); + layout_horizontal.PackStart (layout_vertical, false, false, 0); + + Add (layout_horizontal); + } + } + + + public class SparkleLink : Label { + + public SparkleLink (string text, string url) + { + Markup = string.Format ("{1}", url, text); + CanFocus = false; + + Pango.FontDescription font = StyleContext.GetFont (StateFlags.Normal); + font.Size = 9 * 1024; + + OverrideFont (font); } } - - - public class SparkleLink : EventBox { - - public SparkleLink (string text, string url) - { - VisibleWindow = false; - - Label label = new Label () { - Markup = "" + text + "" - }; - - EnterNotifyEvent += delegate { - GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Hand1); - }; - - LeaveNotifyEvent += delegate { - GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Arrow); - }; - - ButtonPressEvent += delegate { - Program.Controller.OpenWebsite (url); - }; - - Add (label); - } - } } diff --git a/SparkleShare/Linux/SparkleController.cs b/SparkleShare/Linux/SparkleController.cs index bed4384c..3a68e39a 100755 --- a/SparkleShare/Linux/SparkleController.cs +++ b/SparkleShare/Linux/SparkleController.cs @@ -201,11 +201,5 @@ namespace SparkleShare { Clipboard clipboard = Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false)); clipboard.Text = text; } - - - public override void OpenWebsite (string url) - { - OpenFile (url); - } } } diff --git a/SparkleShare/Linux/SparkleEventLog.cs b/SparkleShare/Linux/SparkleEventLog.cs index 40a54746..db6ff3f9 100755 --- a/SparkleShare/Linux/SparkleEventLog.cs +++ b/SparkleShare/Linux/SparkleEventLog.cs @@ -16,15 +16,10 @@ using System; -using System.Collections.Generic; -using System.Threading; using Gtk; -using Mono.Unix; using WebKit; -using IO = System.IO; - namespace SparkleShare { public class SparkleEventLog : Window { @@ -33,84 +28,66 @@ namespace SparkleShare { private Label size_label; private Label history_label; - private HBox layout_horizontal; private ComboBox combo_box; - private HBox combo_box_wrapper; private EventBox content_wrapper; + private HBox combo_box_wrapper; + private HBox layout_horizontal; private ScrolledWindow scrolled_window; + private VBox spinner_wrapper; + private Spinner spinner; private WebView web_view; - private SparkleSpinner spinner; + + private int pos_x, pos_y; - public SparkleEventLog () : base ("") + public SparkleEventLog () : base ("Recent Changes") { + SetWmclass ("SparkleShare", "SparkleShare"); + Gdk.Rectangle monitor_0_rect = Gdk.Screen.Default.GetMonitorGeometry (0); SetSizeRequest (480, (int) (monitor_0_rect.Height * 0.8)); - int x = (int) (monitor_0_rect.Width * 0.61); - int y = (int) (monitor_0_rect.Height * 0.5 - (HeightRequest * 0.5)); + IconName = "sparkleshare"; + this.pos_x = (int) (monitor_0_rect.Width * 0.61); + this.pos_y = (int) (monitor_0_rect.Height * 0.5 - (HeightRequest * 0.5)); - Move (x, y); + this.size_label = new Label () { Xalign = 0, Markup = "Size: …" }; + this.history_label = new Label () { Xalign = 0, Markup = "History: …" }; - Resizable = true; - BorderWidth = 0; + this.size_label.SetSizeRequest (100, 24); - Title = "Recent Changes"; - IconName = "folder-sparkleshare"; - - DeleteEvent += delegate (object o, DeleteEventArgs args) { - Controller.WindowClosed (); - args.RetVal = true; - }; - - KeyPressEvent += delegate (object o, KeyPressEventArgs args) { - if (args.Event.Key == Gdk.Key.Escape || - (args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w)) { - - Controller.WindowClosed (); - } - }; - - this.size_label = new Label () { - Markup = "Size: …", - Xalign = 0 - }; - - this.history_label = new Label () { - Markup = "History: …", - Xalign = 0 - }; - - HBox layout_sizes = new HBox (false, 12); - layout_sizes.Add (this.size_label); - layout_sizes.Add (this.history_label); + HBox layout_sizes = new HBox (false, 0); + layout_sizes.PackStart (this.size_label, false, false, 12); + layout_sizes.PackStart (this.history_label, false, false, 0); VBox layout_vertical = new VBox (false, 0); - this.spinner = new SparkleSpinner (22); + this.spinner = new Spinner (); + this.spinner_wrapper = new VBox (); this.content_wrapper = new EventBox (); this.scrolled_window = new ScrolledWindow (); - Gdk.Color white = new Gdk.Color(); - Gdk.Color.Parse ("white", ref white); - - this.content_wrapper.ModifyBg (StateType.Normal, white); - - this.web_view = new WebView () { - Editable = false - }; - + this.content_wrapper.OverrideBackgroundColor (StateFlags.Normal, + new Gdk.RGBA () { Red = 1, Green = 1, Blue=1, Alpha = 1 }); + this.web_view = new WebView () { Editable = false }; this.web_view.NavigationRequested += WebViewNavigationRequested; this.scrolled_window.Add (this.web_view); - this.content_wrapper.Add (this.spinner); - + + this.spinner_wrapper = new VBox (false, 0); + this.spinner_wrapper.PackStart (new Label(""), true, true, 0); + this.spinner_wrapper.PackStart (this.spinner, false, false, 0); + this.spinner_wrapper.PackStart (new Label(""), true, true, 0); + this.spinner.SetSizeRequest (24, 24); this.spinner.Start (); - this.layout_horizontal = new HBox (true, 0); + this.content_wrapper.Add (this.spinner_wrapper); + + this.layout_horizontal = new HBox (false, 0); this.layout_horizontal.PackStart (layout_sizes, true, true, 12); layout_vertical.PackStart (this.layout_horizontal, false, false, 0); + layout_vertical.PackStart (new HSeparator (), false, false, 0); layout_vertical.PackStart (this.content_wrapper, true, true, 0); Add (layout_vertical); @@ -118,7 +95,7 @@ namespace SparkleShare { Controller.HideWindowEvent += delegate { Application.Invoke (delegate { - HideAll (); + Hide (); if (this.content_wrapper.Child != null) this.content_wrapper.Remove (this.content_wrapper.Child); @@ -127,6 +104,7 @@ namespace SparkleShare { Controller.ShowWindowEvent += delegate { Application.Invoke (delegate { + Move (this.pos_x, this.pos_y); ShowAll (); Present (); }); @@ -134,8 +112,8 @@ namespace SparkleShare { Controller.ShowSaveDialogEvent += delegate (string file_name, string target_folder_path) { Application.Invoke (delegate { - FileChooserDialog dialog = new FileChooserDialog ("Restore from History", - this, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Ok); + FileChooserDialog dialog = new FileChooserDialog ("Restore from History", this, + FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Ok); dialog.CurrentName = file_name; dialog.DoOverwriteConfirmation = true; @@ -151,21 +129,15 @@ namespace SparkleShare { }; Controller.UpdateChooserEvent += delegate (string [] folders) { - Application.Invoke (delegate { - UpdateChooser (folders); - }); + Application.Invoke (delegate { UpdateChooser (folders); }); }; Controller.UpdateChooserEnablementEvent += delegate (bool enabled) { - Application.Invoke (delegate { - this.combo_box.Sensitive = enabled; - }); + Application.Invoke (delegate { this.combo_box.Sensitive = enabled; }); }; Controller.UpdateContentEvent += delegate (string html) { - Application.Invoke (delegate { - UpdateContent (html); - }); + Application.Invoke (delegate { UpdateContent (html); }); }; Controller.ContentLoadingEvent += delegate { @@ -173,33 +145,33 @@ namespace SparkleShare { if (this.content_wrapper.Child != null) this.content_wrapper.Remove (this.content_wrapper.Child); - this.content_wrapper.Add (this.spinner); + this.content_wrapper.Add (this.spinner_wrapper); this.spinner.Start (); - this.content_wrapper.ShowAll (); }); }; Controller.UpdateSizeInfoEvent += delegate (string size, string history_size) { Application.Invoke (delegate { - this.size_label.Markup = "Size: " + size; - this.history_label.Markup = "History: " + history_size; - - this.size_label.ShowAll (); - this.history_label.ShowAll (); + this.size_label.Markup = "Size " + size; + this.history_label.Markup = "History " + history_size; }); }; + + DeleteEvent += delegate (object o, DeleteEventArgs args) { + Controller.WindowClosed (); + args.RetVal = true; + }; + + KeyPressEvent += delegate (object o, KeyPressEventArgs args) { + if (args.Event.Key == Gdk.Key.Escape || + (args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w)) { + + Controller.WindowClosed (); + } + }; } - private void WebViewNavigationRequested (object o, WebKit.NavigationRequestedArgs args) { - Controller.LinkClicked (args.Request.Uri); - - // Don't follow HREFs (as this would cause a page refresh) - if (!args.Request.Uri.Equals ("file:")) - args.RetVal = 1; - } - - public void UpdateChooser (string [] folders) { if (folders == null) @@ -226,16 +198,16 @@ namespace SparkleShare { this.combo_box.Active = 0; int row = 2; - foreach (string folder in folders) { + foreach (string folder in folders) { store.AppendValues (folder); if (folder.Equals (Controller.SelectedFolder)) this.combo_box.Active = row; - + row++; } - this.combo_box.RowSeparatorFunc = delegate (TreeModel model, TreeIter iter) { + this.combo_box.RowSeparatorFunc = delegate (ITreeModel model, TreeIter iter) { string item = (string) this.combo_box.Model.GetValue (iter, 0); return (item == "---"); }; @@ -252,43 +224,50 @@ namespace SparkleShare { Controller.SelectedFolder = selection; }; - this.combo_box_wrapper.PackStart (new Label (" "), false, false, 9); - this.combo_box_wrapper.PackStart (this.combo_box, true, true, 0); + this.combo_box_wrapper.Add (this.combo_box); + this.combo_box.GrabFocus (); - this.layout_horizontal.BorderWidth = 9; - this.layout_horizontal.PackStart (this.combo_box_wrapper, true, true, 0); + this.layout_horizontal.BorderWidth = 6; + this.layout_horizontal.PackStart (this.combo_box_wrapper, false, false, 0); this.layout_horizontal.ShowAll (); } public void UpdateContent (string html) { - string pixmaps_path = IO.Path.Combine (SparkleUI.AssetsPath, "pixmaps"); + string pixmaps_path = new string [] {SparkleUI.AssetsPath, "pixmaps"}.Combine (); string icons_path = new string [] {SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status"}.Combine (); - html = html.Replace ("", (double) (Style.FontDescription.Size / 1024 + 3) + "px"); - html = html.Replace ("", (Style.FontDescription.Size / 1024 + 3) + "px"); - html = html.Replace ("", "#0085cf"); html = html.Replace ("", "#009ff8"); - html = html.Replace ("", "\"" + Style.FontDescription.Family + "\""); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal))); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal))); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - html = html.Replace ("", "85%"); + html = html.Replace ("", "#0085cf"); + + html = html.Replace ("", StyleContext.GetFont (StateFlags.Normal).Family); + html = html.Replace ("", (double) (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px"); + html = html.Replace ("", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Normal))); + html = html.Replace ("", + SparkleUIHelpers.RGBAToHex (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Normal))); + + html = html.Replace ("", (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px"); + html = html.Replace ("", + SparkleUIHelpers.RGBAToHex (StyleContext.GetBackgroundColor (StateFlags.Normal))); + + html = html.Replace ("", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Insensitive))); + + html = html.Replace ("", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Insensitive))); + html = html.Replace ("", "90%"); + html = html.Replace ("", pixmaps_path); - html = html.Replace ("", "file://" + IO.Path.Combine (icons_path, "document-added.png")); - html = html.Replace ("", "file://" + IO.Path.Combine (icons_path, "document-edited.png")); - html = html.Replace ("", "file://" + IO.Path.Combine (icons_path, "document-deleted.png")); - html = html.Replace ("", "file://" + IO.Path.Combine (icons_path, "document-moved.png")); + html = html.Replace ("", "file://" + new string [] {icons_path, "document-added.png"}.Combine ()); + html = html.Replace ("", "file://" + new string [] {icons_path, "document-edited.png"}.Combine ()); + html = html.Replace ("", "file://" + new string [] {icons_path, "document-deleted.png"}.Combine ()); + html = html.Replace ("", "file://" + new string [] {icons_path, "document-moved.png"}.Combine ()); this.spinner.Stop (); this.scrolled_window.Remove (this.web_view); this.web_view.Dispose (); this.web_view = new WebView () { Editable = false }; - this.web_view.LoadHtmlString (html, "file://"); + this.web_view.LoadString (html, "text/html", "UTF-8", "file://"); this.web_view.NavigationRequested += WebViewNavigationRequested; this.scrolled_window.Add (this.web_view); @@ -296,5 +275,15 @@ namespace SparkleShare { this.content_wrapper.Add (this.scrolled_window); this.scrolled_window.ShowAll (); } + + + private void WebViewNavigationRequested (object o, WebKit.NavigationRequestedArgs args) { + Controller.LinkClicked (args.Request.Uri); + + // Don't follow HREFs (as this would cause a page refresh) + if (!args.Request.Uri.Equals ("file:")) + args.RetVal = 1; + } } } + diff --git a/SparkleShare/Linux/SparkleSetup.cs b/SparkleShare/Linux/SparkleSetup.cs index 8f7f7524..91dc70ce 100755 --- a/SparkleShare/Linux/SparkleSetup.cs +++ b/SparkleShare/Linux/SparkleSetup.cs @@ -16,7 +16,6 @@ using System; -using System.IO; using Gtk; using Mono.Unix; @@ -31,7 +30,7 @@ namespace SparkleShare { public SparkleSetup () : base () { Controller.HideWindowEvent += delegate { - Application.Invoke (delegate { HideAll (); }); + Application.Invoke (delegate { Hide (); }); }; Controller.ShowWindowEvent += delegate { @@ -55,7 +54,7 @@ namespace SparkleShare { { if (type == PageType.Setup) { Header = "Welcome to SparkleShare!"; - Description = "First off, what’s your name and email?\n(Visible only to team members)"; + Description = "First off, what’s your name and email?\n(visible only to team members)"; Table table = new Table (2, 3, true) { RowSpacing = 6, @@ -117,48 +116,57 @@ namespace SparkleShare { Add (wrapper); Controller.CheckSetupPage (name_entry.Text, email_entry.Text); + + if (name_entry.Text.Equals ("")) + name_entry.GrabFocus (); + else + email_entry.GrabFocus (); } if (type == PageType.Add) { Header = "Where’s your project hosted?"; - VBox layout_vertical = new VBox (false, 12); - HBox layout_fields = new HBox (true, 12); + VBox layout_vertical = new VBox (false, 16); + HBox layout_fields = new HBox (true, 32); VBox layout_address = new VBox (true, 0); VBox layout_path = new VBox (true, 0); - ListStore store = new ListStore (typeof (Gdk.Pixbuf), typeof (string), typeof (SparklePlugin)); + ListStore store = new ListStore (typeof (string), typeof (Gdk.Pixbuf), typeof (string), typeof (SparklePlugin)); - SparkleTreeView tree = new SparkleTreeView (store) { HeadersVisible = false }; - ScrolledWindow scrolled_window = new ScrolledWindow (); - scrolled_window.AddWithViewport (tree); + SparkleTreeView tree_view = new SparkleTreeView (store) { HeadersVisible = false }; + ScrolledWindow scrolled_window = new ScrolledWindow () { ShadowType = ShadowType.In }; + scrolled_window.SetPolicy (PolicyType.Never, PolicyType.Automatic); + + // Padding column + tree_view.AppendColumn ("Padding", new Gtk.CellRendererText (), "text", 0); + tree_view.Columns [0].Cells [0].Xpad = 4; // Icon column - tree.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0); - tree.Columns [0].Cells [0].Xpad = 6; + tree_view.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 1); + tree_view.Columns [1].Cells [0].Xpad = 4; // Service column TreeViewColumn service_column = new TreeViewColumn () { Title = "Service" }; - CellRendererText service_cell = new CellRendererText () { Ypad = 4 }; + CellRendererText service_cell = new CellRendererText () { Ypad = 8 }; service_column.PackStart (service_cell, true); service_column.SetCellDataFunc (service_cell, new TreeCellDataFunc (RenderServiceColumn)); foreach (SparklePlugin plugin in Controller.Plugins) { - store.AppendValues (new Gdk.Pixbuf (plugin.ImagePath), + store.AppendValues ("", new Gdk.Pixbuf (plugin.ImagePath), "" + plugin.Name + "\n" + - "" + - plugin.Description + "" + + "" + plugin.Description + "" + "", plugin); } - tree.AppendColumn (service_column); + tree_view.AppendColumn (service_column); + scrolled_window.Add (tree_view); Entry address_entry = new Entry () { Text = Controller.PreviousAddress, Sensitive = (Controller.SelectedPlugin.Address == null), ActivatesDefault = true }; - + Entry path_entry = new Entry () { Text = Controller.PreviousPath, Sensitive = (Controller.SelectedPlugin.Path == null), @@ -180,11 +188,84 @@ namespace SparkleShare { }; - // Select the first plugin by default - TreeSelection default_selection = tree.Selection; - TreePath default_path = new TreePath ("0"); + TreeSelection default_selection = tree_view.Selection; + TreePath default_path = new TreePath ("" + Controller.SelectedPluginIndex); default_selection.SelectPath (default_path); - Controller.SelectedPluginChanged (0); + + tree_view.Model.Foreach (new TreeModelForeachFunc ( + delegate (ITreeModel model, TreePath path, TreeIter iter) { + string address; + + try { + address = (model.GetValue (iter, 2) as SparklePlugin).Address; + + } catch (NullReferenceException) { + address = ""; + } + + if (!string.IsNullOrEmpty (address) && + address.Equals (Controller.PreviousAddress)) { + + tree_view.SetCursor (path, service_column, false); + SparklePlugin plugin = (SparklePlugin) model.GetValue (iter, 2); + + if (plugin.Address != null) + address_entry.Sensitive = false; + + if (plugin.Path != null) + path_entry.Sensitive = false; + + return true; + + } else { + return false; + } + } + )); + + layout_address.PackStart (new Label () { + Markup = "" + "Address" + "", + Xalign = 0 + }, true, true, 0); + + layout_address.PackStart (address_entry, false, false, 0); + layout_address.PackStart (address_example, false, false, 0); + + path_entry.Changed += delegate { + Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree_view.SelectedRow); + }; + + layout_path.PackStart (new Label () { + Markup = "" + "Remote Path" + "", + Xalign = 0 + }, true, true, 0); + + layout_path.PackStart (path_entry, false, false, 0); + layout_path.PackStart (path_example, false, false, 0); + + layout_fields.PackStart (layout_address, true, true, 0); + layout_fields.PackStart (layout_path, true, true, 0); + + layout_vertical.PackStart (new Label (""), false, false, 0); + layout_vertical.PackStart (scrolled_window, true, true, 0); + layout_vertical.PackStart (layout_fields, false, false, 0); + + tree_view.ScrollToCell (new TreePath ("" + Controller.SelectedPluginIndex), null, true, 0, 0); + + Add (layout_vertical); + + + if (string.IsNullOrEmpty (path_entry.Text)) { + address_entry.GrabFocus (); + address_entry.Position = -1; + } else { + path_entry.GrabFocus (); + path_entry.Position = -1; + } + + Button cancel_button = new Button ("Cancel"); + Button add_button = new Button ("Add") { Sensitive = false }; + Controller.ChangeAddressFieldEvent += delegate (string text, string example_text, FieldState state) { @@ -208,93 +289,22 @@ namespace SparkleShare { }); }; - Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1); - - // Update the address field text when the selection changes - tree.CursorChanged += delegate (object sender, EventArgs e) { - Controller.SelectedPluginChanged (tree.SelectedRow); - // TODO: Scroll to selected row when using arrow keys + Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) { + Application.Invoke (delegate { add_button.Sensitive = button_enabled; }); }; - tree.Model.Foreach (new TreeModelForeachFunc (delegate (TreeModel model, - TreePath path, TreeIter iter) { - string address; - - try { - address = (model.GetValue (iter, 2) as SparklePlugin).Address; - - } catch (NullReferenceException) { - address = ""; - } - - if (!string.IsNullOrEmpty (address) && - address.Equals (Controller.PreviousAddress)) { - - tree.SetCursor (path, service_column, false); - SparklePlugin plugin = (SparklePlugin) model.GetValue (iter, 2); - - if (plugin.Address != null) { - address_entry.Sensitive = false;} - - if (plugin.Path != null) - path_entry.Sensitive = false; - - // TODO: Scroll to the selection - return true; - - } else { - return false; - } - })); + tree_view.CursorChanged += delegate (object sender, EventArgs e) { + Controller.SelectedPluginChanged (tree_view.SelectedRow); + }; address_entry.Changed += delegate { - Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow); + Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree_view.SelectedRow); }; - layout_address.PackStart (new Label () { - Markup = "" + "Address:" + "", - Xalign = 0 - }, true, true, 0); - - layout_address.PackStart (address_entry, false, false, 0); - layout_address.PackStart (address_example, false, false, 0); - - path_entry.Changed += delegate { - Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow); - }; - - layout_path.PackStart (new Label () { - Markup = "" + "Remote Path:" + "", - Xalign = 0 - }, true, true, 0); - - layout_path.PackStart (path_entry, false, false, 0); - layout_path.PackStart (path_example, false, false, 0); - - layout_fields.PackStart (layout_address); - layout_fields.PackStart (layout_path); - - layout_vertical.PackStart (new Label (""), false, false, 0); - layout_vertical.PackStart (scrolled_window, true, true, 0); - layout_vertical.PackStart (layout_fields, false, false, 0); - - Add (layout_vertical); - - Button cancel_button = new Button ("Cancel"); - Button add_button = new Button ("Add") { Sensitive = false }; - cancel_button.Clicked += delegate { Controller.PageCancelled (); }; + add_button.Clicked += delegate { Controller.AddPageCompleted (address_entry.Text, path_entry.Text); }; - add_button.Clicked += delegate { - Controller.AddPageCompleted (address_entry.Text, path_entry.Text); - }; - - Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) { - Application.Invoke (delegate { - add_button.Sensitive = button_enabled; - }); - }; CheckButton check_button = new CheckButton ("Fetch prior history") { Active = false }; check_button.Toggled += delegate { Controller.HistoryItemChanged (check_button.Active); }; @@ -302,7 +312,7 @@ namespace SparkleShare { AddOption (check_button); AddButton (cancel_button); AddButton (add_button); - + Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1); } @@ -460,7 +470,7 @@ namespace SparkleShare { Description = "Please enter the password to see their contents."; } - Label password_label = new Label ("" + "Password:" + "") { + Label password_label = new Label ("" + "Password" + "") { UseMarkup = true, Xalign = 1 }; @@ -545,6 +555,8 @@ namespace SparkleShare { AddButton (cancel_button); AddButton (continue_button); + + password_entry.GrabFocus (); } if (type == PageType.Finished) { @@ -679,20 +691,15 @@ namespace SparkleShare { private void RenderServiceColumn (TreeViewColumn column, CellRenderer cell, - TreeModel model, TreeIter iter) + ITreeModel model, TreeIter iter) { - string markup = (string) model.GetValue (iter, 1); + string markup = (string) model.GetValue (iter, 2); TreeSelection selection = (column.TreeView as TreeView).Selection; - if (selection.IterIsSelected (iter)) { - if (column.TreeView.HasFocus) - markup = markup.Replace (SecondaryTextColor, SecondaryTextColorSelected); - else - markup = markup.Replace (SecondaryTextColorSelected, SecondaryTextColor); - - } else { + if (selection.IterIsSelected (iter)) + markup = markup.Replace (SecondaryTextColor, SecondaryTextColorSelected); + else markup = markup.Replace (SecondaryTextColorSelected, SecondaryTextColor); - } (cell as CellRendererText).Markup = markup; } @@ -704,7 +711,7 @@ namespace SparkleShare { { get { TreeIter iter; - TreeModel model; + ITreeModel model; Selection.GetSelected (out model, out iter); return int.Parse (model.GetPath (iter).ToString ()); diff --git a/SparkleShare/Linux/SparkleSetupWindow.cs b/SparkleShare/Linux/SparkleSetupWindow.cs index 218360b9..1e00f701 100755 --- a/SparkleShare/Linux/SparkleSetupWindow.cs +++ b/SparkleShare/Linux/SparkleSetupWindow.cs @@ -16,99 +16,72 @@ using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Text.RegularExpressions; -using System.Timers; - using Gtk; -using Mono.Unix; namespace SparkleShare { public class SparkleSetupWindow : Window { - // TODO: caps - private HBox HBox; - private VBox VBox; - private VBox Wrapper; - private VBox OptionArea; - private HBox Buttons; + private EventBox content_area; + private EventBox option_area; + private HBox buttons; public string Header; public string Description; - public string SecondaryTextColor; - public string SecondaryTextColorSelected; - public Container Content; + public readonly string SecondaryTextColor; + public readonly string SecondaryTextColorSelected; - public SparkleSetupWindow () : base ("") + + public SparkleSetupWindow () : base ("SparkleShare Setup") { - Title = Catalog.GetString ("SparkleShare Setup"); - BorderWidth = 0; - IconName = "folder-sparkleshare"; + SetWmclass ("SparkleShare", "SparkleShare"); + + IconName = "sparkleshare"; Resizable = false; WindowPosition = WindowPosition.Center; Deletable = false; TypeHint = Gdk.WindowTypeHint.Dialog; - DeleteEvent += delegate (object sender, DeleteEventArgs args) { - args.RetVal = true; - }; - - SecondaryTextColor = SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive)); - - SecondaryTextColorSelected = - SparkleUIHelpers.GdkColorToHex ( - MixColors ( - new TreeView ().Style.Foreground (StateType.Selected), - new TreeView ().Style.Background (StateType.Selected), - 0.15 - ) - ); SetSizeRequest (680, 400); - HBox = new HBox (false, 0); + DeleteEvent += delegate (object sender, DeleteEventArgs args) { args.RetVal = true; }; - VBox = new VBox (false, 0); + Gdk.Color color = SparkleUIHelpers.RGBAToColor (StyleContext.GetColor (StateFlags.Insensitive)); + SecondaryTextColor = SparkleUIHelpers.ColorToHex (color); + + color = MixColors ( + SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetColor (StateFlags.Selected)), + SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected)), + 0.39); + + SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex (color); - Wrapper = new VBox (false, 0) { - BorderWidth = 0 - }; + HBox layout_horizontal = new HBox (false, 0); - OptionArea = new VBox (false, 0) { - BorderWidth = 0 - }; + VBox layout_vertical = new VBox (false, 0); - Buttons = CreateButtonBox (); + this.content_area = new EventBox (); + this.option_area = new EventBox (); + this.buttons = CreateButtonBox (); - HBox layout_horizontal = new HBox (false , 0) { - BorderWidth = 0 - }; + HBox layout_actions = new HBox (false , 48); - layout_horizontal.PackStart (OptionArea, true, true, 0); - layout_horizontal.PackStart (Buttons, false, false, 0); + layout_actions.PackStart (this.option_area, true, true, 0); + layout_actions.PackStart (this.buttons, false, false, 0); - VBox.PackStart (Wrapper, true, true, 0); - VBox.PackStart (layout_horizontal, false, false, 15); - - EventBox box = new EventBox (); - Gdk.Color bg_color = new Gdk.Color (); - Gdk.Color.Parse ("#000", ref bg_color); - box.ModifyBg (StateType.Normal, bg_color); + layout_vertical.PackStart (this.content_area, true, true, 0); + layout_vertical.PackStart (layout_actions, false, false, 15); Image side_splash = SparkleUIHelpers.GetImage ("side-splash.png"); side_splash.Yalign = 1; - box.Add (side_splash); + layout_horizontal.PackStart (side_splash, false, false, 0); + layout_horizontal.PackStart (layout_vertical, true, true, 30); - HBox.PackStart (box, false, false, 0); - HBox.PackStart (VBox, true, true, 30); - - base.Add (HBox); + base.Add (layout_horizontal); } @@ -116,7 +89,6 @@ namespace SparkleShare { { return new HBox () { BorderWidth = 0, - //Layout = ButtonBoxStyle.End, Homogeneous = false, Spacing = 6 }; @@ -126,13 +98,13 @@ namespace SparkleShare { public void AddButton (Button button) { (button.Child as Label).Xpad = 15; - Buttons.Add (button); + this.buttons.Add (button); } public void AddOption (Widget widget) { - OptionArea.Add (widget); + this.option_area.Add (widget); } @@ -160,8 +132,7 @@ namespace SparkleShare { if (widget != null) layout_vertical.PackStart (widget, true, true, 0); - Wrapper.PackStart (layout_vertical, true, true, 0); - ShowAll (); + this.content_area.Add (layout_vertical); } @@ -170,23 +141,21 @@ namespace SparkleShare { Header = ""; Description = ""; - if (OptionArea.Children.Length > 0) - OptionArea.Remove (OptionArea.Children [0]); + if (this.option_area.Children.Length > 0) + this.option_area.Remove (this.option_area.Children [0]); - if (Wrapper.Children.Length > 0) - Wrapper.Remove (Wrapper.Children [0]); + if (this.content_area.Children.Length > 0) + this.content_area.Remove (this.content_area.Children [0]); - foreach (Button button in Buttons) - Buttons.Remove (button); - - ShowAll (); + foreach (Button button in this.buttons) + this.buttons.Remove (button); } new public void ShowAll () { - if (Buttons.Children.Length > 0) { - Button default_button = (Button) Buttons.Children [Buttons.Children.Length - 1]; + if (this.buttons.Children.Length > 0) { + Button default_button = (Button) this.buttons.Children [this.buttons.Children.Length - 1]; default_button.CanDefault = true; Default = default_button; @@ -201,11 +170,11 @@ namespace SparkleShare { { return new Gdk.Color ( Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) + - second_color.Red * ratio))) / 65535), + second_color.Red * ratio))) / 65535), Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) + second_color.Green * ratio))) / 65535), Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) + - second_color.Blue * ratio))) / 65535) + second_color.Blue * ratio))) / 65535) ); } } diff --git a/SparkleShare/Linux/SparkleSpinner.cs b/SparkleShare/Linux/SparkleSpinner.cs deleted file mode 100755 index 84ab3b10..00000000 --- a/SparkleShare/Linux/SparkleSpinner.cs +++ /dev/null @@ -1,76 +0,0 @@ -// SparkleShare, a collaboration and sharing tool. -// 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 System.Timers; -using Gtk; - -namespace SparkleShare { - - // This is a close implementation of GtkSpinner - public class SparkleSpinner : Image { - - private Timer timer; - - - public SparkleSpinner (int size) : base () - { - int current_frame = 0; - Gdk.Pixbuf spinner_gallery = SparkleUIHelpers.GetIcon ("process-working", size); - int frames_in_width = spinner_gallery.Width / size; - int frames_in_height = spinner_gallery.Height / size; - int frame_count = (frames_in_width * frames_in_height) - 1; - Gdk.Pixbuf [] frames = new Gdk.Pixbuf [frame_count]; - - int i = 0; - for (int y = 0; y < frames_in_height; y++) { - for (int x = 0; x < frames_in_width; x++) { - if (!(y == 0 && x == 0)) { - frames [i] = new Gdk.Pixbuf (spinner_gallery, x * size, y * size, size, size); - i++; - } - } - } - - timer = new Timer () { - Interval = 600 / frame_count - }; - - timer.Elapsed += delegate { - if (current_frame < frame_count - 1) - current_frame++; - else - current_frame = 0; - - Application.Invoke (delegate { - Pixbuf = frames [current_frame]; - }); - }; - } - - - public void Start () - { - timer.Start (); - } - - - public void Stop () - { - timer.Stop (); - } - } -} diff --git a/SparkleShare/Linux/SparkleStatusIcon.cs b/SparkleShare/Linux/SparkleStatusIcon.cs index 089976e5..073bf22a 100644 --- a/SparkleShare/Linux/SparkleStatusIcon.cs +++ b/SparkleShare/Linux/SparkleStatusIcon.cs @@ -19,7 +19,7 @@ using System; using Gtk; #if HAVE_APP_INDICATOR -using AppIndicator; +using AppIndicator3; #endif namespace SparkleShare { @@ -34,7 +34,7 @@ namespace SparkleShare { private MenuItem state_item; #if HAVE_APP_INDICATOR - private ApplicationIndicator indicator; + private Indicator indicator; #else private StatusIcon status_icon; #endif @@ -43,9 +43,9 @@ namespace SparkleShare { public SparkleStatusIcon () { #if HAVE_APP_INDICATOR - this.indicator = new ApplicationIndicator ("sparkleshare", "sparkleshare", Category.ApplicationStatus); + this.indicator = new Indicator ("sparkleshare", "sparkleshare", (int) IndicatorCategory.ApplicationStatus); this.indicator.IconName = "process-syncing-idle"; - this.indicator.Status = Status.Active; + this.indicator.Status = (int) IndicatorStatus.Active; #else this.status_icon = new StatusIcon (); this.status_icon.IconName = "sparkleshare"; @@ -76,8 +76,9 @@ namespace SparkleShare { #if HAVE_APP_INDICATOR this.indicator.IconName = icon_name; - this.indicator.Status = Status.Attention; - this.indicator.Status = Status.Active; + // Force update of the status icon + this.indicator.Status = (int) IndicatorStatus.Attention; + this.indicator.Status = (int) IndicatorStatus.Active; #else this.status_icon.IconName = icon_name; #endif @@ -151,6 +152,8 @@ namespace SparkleShare { this.recent_events_item.Sensitive = Controller.RecentEventsItemEnabled; this.quit_item = new MenuItem ("Quit") { Sensitive = Controller.QuitItemEnabled }; MenuItem add_item = new MenuItem ("Add Hosted Project…"); + + #if HAVE_APP_INDICATOR MenuItem notify_item; if (Program.Controller.NotificationsEnabled) @@ -168,6 +171,7 @@ namespace SparkleShare { (notify_item.Child as Label).Text = "Turn Notifications On"; }); }; + #endif MenuItem link_code_item = new MenuItem ("Client ID"); @@ -195,8 +199,10 @@ namespace SparkleShare { folder_item.Submenu = new Menu (); (folder_item.Submenu as Menu).Add (this.recent_events_item); (folder_item.Submenu as Menu).Add (add_item); + #if HAVE_APP_INDICATOR (folder_item.Submenu as Menu).Add (new SeparatorMenuItem ()); (folder_item.Submenu as Menu).Add (notify_item); + #endif (folder_item.Submenu as Menu).Add (new SeparatorMenuItem ()); (folder_item.Submenu as Menu).Add (link_code_item); (folder_item.Submenu as Menu).Add (new SeparatorMenuItem ()); diff --git a/SparkleShare/Linux/SparkleUI.cs b/SparkleShare/Linux/SparkleUI.cs index a5dcf6f0..afa4442f 100644 --- a/SparkleShare/Linux/SparkleUI.cs +++ b/SparkleShare/Linux/SparkleUI.cs @@ -17,6 +17,7 @@ using System; +using GLib; using Gtk; using SparkleLib; @@ -24,33 +25,53 @@ namespace SparkleShare { public class SparkleUI { + public static string AssetsPath = Defines.INSTALL_DIR; + public SparkleStatusIcon StatusIcon; public SparkleEventLog EventLog; public SparkleBubbles Bubbles; public SparkleSetup Setup; public SparkleAbout About; - public static string AssetsPath = Defines.INSTALL_DIR; + private Gtk.Application application; public SparkleUI () { - Application.Init (); + this.application = new Gtk.Application ("org.sparkleshare.sparkleshare", 0); - Setup = new SparkleSetup (); - EventLog = new SparkleEventLog (); - About = new SparkleAbout (); - Bubbles = new SparkleBubbles (); - StatusIcon = new SparkleStatusIcon (); - - Program.Controller.UIHasLoaded (); + this.application.Register (null); + this.application.Activated += ApplicationActivatedDelegate; } - // Runs the application public void Run () + { + (this.application as GLib.Application).Run (0, null); + } + + + private void ApplicationActivatedDelegate (object sender, EventArgs args) { - Application.Run (); + if (this.application.Windows.Length > 0) { + foreach (Window window in this.application.Windows) { + if (window.Visible) + window.Present (); + } + + } else { + Setup = new SparkleSetup (); + EventLog = new SparkleEventLog (); + About = new SparkleAbout (); + Bubbles = new SparkleBubbles (); + StatusIcon = new SparkleStatusIcon (); + + Setup.Application = this.application; + EventLog.Application = this.application; + About.Application = this.application; + + Program.Controller.UIHasLoaded (); + } } } } diff --git a/SparkleShare/Linux/SparkleUIHelpers.cs b/SparkleShare/Linux/SparkleUIHelpers.cs index c631cf2f..5f0ffbf4 100755 --- a/SparkleShare/Linux/SparkleUIHelpers.cs +++ b/SparkleShare/Linux/SparkleUIHelpers.cs @@ -12,11 +12,10 @@ // 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 . +// along with this program. If not, see . + using System; -using System.IO; - using Gtk; namespace SparkleShare { @@ -26,16 +25,10 @@ namespace SparkleShare { public static Gdk.Pixbuf GetIcon (string name, int size) { IconTheme icon_theme = new IconTheme (); + icon_theme.AppendSearchPath (new string [] {SparkleUI.AssetsPath, "icons"}.Combine ()); -// foreach (string search_path in IconTheme.Default.SearchPath) -// icon_theme.AppendSearchPath (search_path); - - // FIXME: Temporary workaround for a bug in IconTheme.SearchPath in Gtk# on 64-bit systems - // https://github.com/mono/gtk-sharp/commit/9c54fd5ae77f63d11fdc6873a3cb90691990e37f - icon_theme.AppendSearchPath ("/usr/share/icons"); - icon_theme.AppendSearchPath ("/usr/local/share/icons"); - icon_theme.AppendSearchPath ("/opt/local/share/icons"); - icon_theme.AppendSearchPath (Path.Combine (SparkleUI.AssetsPath, "icons")); + foreach (string search_path in IconTheme.Default.SearchPath) + icon_theme.AppendSearchPath (search_path); try { return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); @@ -60,12 +53,27 @@ namespace SparkleShare { // Converts a Gdk RGB color to a hex value. // Example: from "rgb:0,0,0" to "#000000" - public static string GdkColorToHex (Gdk.Color color) + public static string ColorToHex (Gdk.Color color) { return String.Format ("#{0:X2}{1:X2}{2:X2}", (int) Math.Truncate (color.Red / 256.00), (int) Math.Truncate (color.Green / 256.00), (int) Math.Truncate (color.Blue / 256.00)); } + + + public static Gdk.Color RGBAToColor (Gdk.RGBA rgba) { + return new Gdk.Color () { + Red = (ushort) (rgba.Red * 65535), + Green = (ushort) (rgba.Green * 65535), + Blue = (ushort)(rgba.Blue * 65535) + }; + } + + + public static string RGBAToHex (Gdk.RGBA rgba) + { + return ColorToHex (RGBAToColor (rgba)); + } } } diff --git a/SparkleShare/Linux/sparkleshare.in b/SparkleShare/Linux/sparkleshare.in index a075609d..5af417c9 100755 --- a/SparkleShare/Linux/sparkleshare.in +++ b/SparkleShare/Linux/sparkleshare.in @@ -5,62 +5,18 @@ if [[ $UID -eq 0 ]]; then exit 1 fi -if [ "$XDG_RUNTIME_DIR" ]; then - pidfile=${XDG_RUNTIME_DIR}/sparkleshare.pid -else - pidfile=~/.sparkleshare-$(hostname)-${USER}.pid -fi - start() { - if [ -e "${pidfile}" ]; then - sparklepid=`cat ${pidfile}` - if [ -n "`ps -p ${sparklepid} | grep ${sparklepid}`" ]; then - echo "SparkleShare is already running." - exit 0 - else - echo "Stale SparkleShare PID file found, starting a new instance..." - rm -f $pidfile - fi - fi - - echo -n "Starting SparkleShare... " if [ -n "${SSH_AGENT_PID}" -o -n "${SSH_AUTH_SOCK}" ] ; then mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 & else ssh-agent mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 & fi - ( umask 066; echo $! > ${pidfile} ) - echo "Done." -} - -stop() { - if [ -e "${pidfile}" ]; then - sparklepid=`cat ${pidfile}` - if [ -n "`ps -p ${sparklepid} | grep ${sparklepid}`" ]; then - echo -n "Stopping SparkleShare... " - kill ${sparklepid} - rm -f ${pidfile} - echo "Done." - else - echo "SparkleShare is not running, removing stale PID file..." - rm -f ${pidfile} - fi - else - echo "SparkleShare is not running." - fi } case $1 in start|--start) start ;; - stop|--stop) - stop - ;; - restart|--restart) - stop - start - ;; open|--open) invite=`date -u +%N` open=`echo $2 | sed 's/sparkleshare:\/\/addProject\///'` diff --git a/SparkleShare/Mac/Info.plist b/SparkleShare/Mac/Info.plist index 3a9a9040..524c2767 100755 --- a/SparkleShare/Mac/Info.plist +++ b/SparkleShare/Mac/Info.plist @@ -9,9 +9,9 @@ CFBundleName SparkleShare CFBundleVersion - 1.2 + 1.3 CFBundleShortVersionString - 1.2 + 1.3 LSApplicationCategoryType public.app-category.productivity LSMinimumSystemVersion diff --git a/SparkleShare/Program.cs b/SparkleShare/Program.cs index 096c7959..7087e9e8 100644 --- a/SparkleShare/Program.cs +++ b/SparkleShare/Program.cs @@ -36,7 +36,7 @@ namespace SparkleShare { #endif public static void Main (string [] args) { - if (args.Length != 0 && !args [0].Equals ("start") && + if (args.Length != 0 && !args [0].Equals ("help") && SparkleBackend.Platform != PlatformID.MacOSX && SparkleBackend.Platform != PlatformID.Win32NT) { @@ -47,13 +47,13 @@ namespace SparkleShare { "designed to keep things simple and to stay out of your way." + n + n + "Version: " + SparkleLib.SparkleBackend.Version + n + - "Copyright (C) 2010 Hylke Bons" + n + + "Copyright (C) 2010 Hylke Bons and others" + n + "This program comes with ABSOLUTELY NO WARRANTY." + n + n + "This is free software, and you are welcome to redistribute it" + n + "under certain conditions. Please read the GNU GPLv3 for details." + n + n + - "Usage: sparkleshare [start|stop|restart]"); + "Usage: sparkleshare [start|open]"); Environment.Exit (-1); } diff --git a/SparkleShare/SparkleControllerBase.cs b/SparkleShare/SparkleControllerBase.cs index fb8d6a33..363f6d0f 100644 --- a/SparkleShare/SparkleControllerBase.cs +++ b/SparkleShare/SparkleControllerBase.cs @@ -141,7 +141,7 @@ namespace SparkleShare { public abstract void OpenFile (string path); // Opens a file with the appropriate application - public abstract void OpenWebsite (string url); + public virtual void OpenWebsite (string url) { } // Copies text to the clipboard public abstract void CopyToClipboard (string text); diff --git a/SparkleShare/Windows/SparkleShare.wxs b/SparkleShare/Windows/SparkleShare.wxs index dfbe47e3..943ef08e 100644 --- a/SparkleShare/Windows/SparkleShare.wxs +++ b/SparkleShare/Windows/SparkleShare.wxs @@ -2,7 +2,7 @@ + Language='1033' Codepage='1252' Version='1.3' Manufacturer='SparkleShare'> diff --git a/build/build.environment.mk b/build/build.environment.mk index 82ce2088..e99c6cfb 100755 --- a/build/build.environment.mk +++ b/build/build.environment.mk @@ -12,8 +12,7 @@ LINK_MONO_POSIX = -r:Mono.Posix LINK_GLIB = $(GLIBSHARP_LIBS) LINK_GTK = $(GTKSHARP_LIBS) LINK_GNOME = $(GNOME_SHARP_LIBS) -LINK_DBUS = $(NDESK_DBUS_LIBS) $(NDESK_DBUS_GLIB_LIBS) -LINK_DBUS_NO_GLIB = $(NDESK_DBUS_LIBS) +LINK_WEBKIT = $(WEBKITGTK_SHARP_LIBS) LINK_APP_INDICATOR = $(APP_INDICATOR_LIBS) REF_NOTIFY_SHARP = $(LINK_SYSTEM) $(LINK_DBUS) $(GTKSHARP_LIBS) $(GLIBSHARP_LIBS) @@ -24,7 +23,7 @@ REF_SPARKLELIB = $(LINK_SYSTEM) $(LINK_MONO_POSIX) LINK_SPARKLELIB = -r:$(DIR_BIN)/SparkleLib.dll LINK_SPARKLELIB_DEPS = $(REF_SPARKLELIB) $(LINK_SPARKLELIB) -REF_SPARKLESHARE = $(LINK_DBUS) $(LINK_GTK) $(LINK_SPARKLELIB_DEPS) $(LINK_APP_INDICATOR) +REF_SPARKLESHARE = $(LINK_GTK) $(LINK_SPARKLELIB_DEPS) $(LINK_APP_INDICATOR) $(LINK_WEBKIT) # Cute hack to replace a space with something colon:= : diff --git a/build/build.rules.mk b/build/build.rules.mk index a0b75d55..0beed5c0 100755 --- a/build/build.rules.mk +++ b/build/build.rules.mk @@ -23,10 +23,6 @@ if ENABLE_TESTS ENABLE_TESTS_FLAG = "-define:ENABLE_TESTS" endif -if ENABLE_ATK - ENABLE_ATK_FLAG = "-define:ENABLE_ATK" -endif - FILTERED_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE)) DEP_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE) | sed s,-r:,,g | grep '$(top_builddir)/bin/') diff --git a/build/m4/sparkleshare/gtk-sharp.m4 b/build/m4/sparkleshare/gtk-sharp.m4 index 76077ed9..c8974902 100755 --- a/build/m4/sparkleshare/gtk-sharp.m4 +++ b/build/m4/sparkleshare/gtk-sharp.m4 @@ -1,23 +1,14 @@ AC_DEFUN([SPARKLESHARE_CHECK_GTK_SHARP], [ - GTKSHARP_REQUIRED=2.12.2 + GTKSHARP_REQUIRED=2.99.1 PKG_CHECK_MODULES(GTKSHARP, - gtk-sharp-2.0 >= $GTKSHARP_REQUIRED) + gtk-sharp-3.0 >= $GTKSHARP_REQUIRED) AC_SUBST(GTKSHARP_LIBS) PKG_CHECK_MODULES(GLIBSHARP, - glib-sharp-2.0 >= $GTKSHARP_REQUIRED) + glib-sharp-3.0 >= $GTKSHARP_REQUIRED) AC_SUBST(GLIBSHARP_LIBS) - PKG_CHECK_MODULES(GLIBSHARP_2_12_7, - glib-sharp-2.0 >= 2.12.7, - HAVE_GLIBSHARP_2_12_7=yes, - HAVE_GLIBSHARP_2_12_7=no) - AM_CONDITIONAL(HAVE_GLIBSHARP_2_12_7, [test "$HAVE_GLIBSHARP_2_12_7" = "yes"]) - - PKG_CHECK_MODULES(GTKSHARP_A11Y, gtk-sharp-2.0 >= 2.12.10, gtksharp_with_a11y=yes, gtksharp_with_a11y=no) - AM_CONDITIONAL(ENABLE_ATK, test "x$gtksharp_with_a11y" = "xyes") - ]) diff --git a/configure.ac b/configure.ac index 2dde1f1c..3bff984e 100755 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -m4_define([sparkleshare_version], [1.2]) +m4_define([sparkleshare_version], [1.3]) AC_PREREQ([2.54]) AC_INIT([SparkleShare], sparkleshare_version) @@ -31,8 +31,6 @@ PKG_CHECK_EXISTS([mono >= 2.8], [SHAMROCK_FIND_MONO_4_0_COMPILER SHAMROCK_CHECK_MONO_4_0_GAC_ASSEMBLIES([ System - System.Security - Mono.Posix ])] ) @@ -59,14 +57,6 @@ if test -z "$CONFIG_REQUESTED" ; then enable_debug=yes fi - -dnl package checks, common for all configs -#PKG_CHECK_MODULES([NDESK_DBUS], [ndesk-dbus-1.0]) -#AC_SUBST(NDESK_DBUS_LIBS) -#PKG_CHECK_MODULES([NDESK_DBUS_GLIB], [ndesk-dbus-glib-1.0]) -#AC_SUBST(NDESK_DBUS_GLIB_LIBS) - - SPARKLESHARE_CHECK_GTK_SHARP AC_ARG_ENABLE(appindicator, @@ -76,12 +66,12 @@ AC_ARG_ENABLE(appindicator, OSNAME=`uname -s` if test "$OSNAME" = "Linux" ; then - dnl check for webkit-sharp - PKG_CHECK_MODULES(WEBKIT_SHARP, webkit-sharp-1.0, have_webkit_sharp=yes, have_webkit_sharp=no) - if test "x$have_webkit_sharp" = "xno" ; then - AC_ERROR("webkit-sharp is a required dependency: you need to install the appropriate devel package before you can compile") + dnl check for webkitgtk-sharp + PKG_CHECK_MODULES(WEBKITGTK_SHARP, webkitgtk-sharp-3.0, have_webkitgtk_sharp=yes, have_webkitgtk_sharp=no) + if test "x$have_webkitgtk_sharp" = "xno" ; then + AC_ERROR("webkitgtk-sharp is a required dependency: you need to install the appropriate devel package before you can compile") fi - AC_SUBST(WEBKIT_SHARP_LIBS) + AC_SUBST(WEBKITGTK_SHARP_LIBS) dnl check for notify-sharp PKG_CHECK_MODULES(NOTIFY_SHARP, notify-sharp, have_notify_sharp=yes, have_notify_sharp=no) @@ -90,19 +80,19 @@ if test "$OSNAME" = "Linux" ; then fi AC_SUBST(NOTIFY_SHARP_LIBS) - APPINDICATOR_REQUIRED=0.0.7 + APPINDICATOR_REQUIRED=0.1 if test x$enable_appindicator = xauto ; then - PKG_CHECK_EXISTS([appindicator-sharp-0.1 >= $APPINDICATOR_REQUIRED], + PKG_CHECK_EXISTS([appindicator3-sharp-0.1 >= $APPINDICATOR_REQUIRED], enable_appindicator="yes", enable_appindicator="no") fi if test x$enable_appindicator = xyes ; then - PKG_CHECK_EXISTS([appindicator-sharp-0.1 >= $APPINDICATOR_REQUIRED],, - AC_MSG_ERROR([appindicator-sharp-0.1 is not installed])) + PKG_CHECK_EXISTS([appindicator3-sharp-0.1 >= $APPINDICATOR_REQUIRED],, + AC_MSG_ERROR([appindicator3-sharp-0.1 is not installed])) PKG_CHECK_MODULES(APP_INDICATOR, - appindicator-sharp-0.1 >= $APPINDICATOR_REQUIRED) + appindicator3-sharp-0.1 >= $APPINDICATOR_REQUIRED) AC_SUBST(APP_INDICATOR_CFLAGS) AC_SUBST(APP_INDICATOR_LIBS) AC_DEFINE(HAVE_APP_INDICATOR, 1, [Have AppIndicator])