eventlog: Fix some occasions where the spinner doesn't appear.

This commit is contained in:
Hylke Bons 2012-07-18 23:12:51 +02:00
parent a00e5d406c
commit 437cfbe1e1
11 changed files with 45 additions and 65 deletions

View file

@ -32,25 +32,21 @@ namespace SparkleLib {
// Check if the user wants a use a custom notification service for this folder // Check if the user wants a use a custom notification service for this folder
if (string.IsNullOrEmpty (uri)) if (string.IsNullOrEmpty (uri))
uri = SparkleConfig.DefaultConfig.GetFolderOptionalAttribute ( uri = SparkleConfig.DefaultConfig.GetFolderOptionalAttribute (folder_name, "announcements_url");
folder_name, "announcements_url");
// Fall back to the fallback service is neither is the case
if (string.IsNullOrEmpty (uri)) {
// This is SparkleShare's centralized notification service.
// It communicates "It's time to sync!" signals between clients.
//
// Here's how it works: the client listens to a channel (the
// folder identifier, a SHA-1 hash) for when it's time to sync.
// Clients also send the current revision hash to the channel
// for other clients to pick up when you've synced up any
// changes.
//
// Please see the SparkleShare wiki if you wish to run
// your own service instead
// This is SparkleShare's centralized notification service.
// It communicates "It's time to sync!" signals between clients.
//
// Here's how it works: the client listens to a channel (the
// folder identifier, a SHA-1 hash) for when it's time to sync.
// Clients also send the current revision hash to the channel
// for other clients to pick up when you've synced up any
// changes.
//
// Please see the SparkleShare wiki if you wish to run
// your own service instead
if (string.IsNullOrEmpty (uri))
uri = "tcp://notifications.sparkleshare.org:80"; uri = "tcp://notifications.sparkleshare.org:80";
}
Uri announce_uri = new Uri (uri); Uri announce_uri = new Uri (uri);
@ -58,8 +54,7 @@ namespace SparkleLib {
// the number of connections as low as possible // the number of connections as low as possible
foreach (SparkleListenerBase listener in listeners) { foreach (SparkleListenerBase listener in listeners) {
if (listener.Server.Equals (announce_uri)) { if (listener.Server.Equals (announce_uri)) {
SparkleHelpers.DebugInfo ("ListenerFactory", SparkleHelpers.DebugInfo ("ListenerFactory", "Refered to existing " + announce_uri.Scheme +
"Refered to existing " + announce_uri.Scheme +
" listener for " + announce_uri); " listener for " + announce_uri);
// We already seem to have a listener for this server, // We already seem to have a listener for this server,
@ -80,8 +75,8 @@ namespace SparkleLib {
break; break;
} }
SparkleHelpers.DebugInfo ("ListenerFactory", SparkleHelpers.DebugInfo ("ListenerFactory", "Issued new " + announce_uri.Scheme +
"Issued new " + announce_uri.Scheme + " listener for " + announce_uri); " listener for " + announce_uri);
return (SparkleListenerBase) listeners [listeners.Count - 1]; return (SparkleListenerBase) listeners [listeners.Count - 1];
} }

View file

@ -233,7 +233,10 @@ namespace SparkleShare {
if (this.web_view.Superview == ContentView) if (this.web_view.Superview == ContentView)
this.web_view.RemoveFromSuperview (); this.web_view.RemoveFromSuperview ();
ContentView.AddSubview (this.progress_indicator); if (this.progress_indicator.Superview != ContentView)
ContentView.AddSubview (this.progress_indicator);
this.progress_indicator.StartAnimation (this);
}); });
} }
}; };

View file

@ -20,7 +20,6 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using Mono.Unix;
using MonoMac.Foundation; using MonoMac.Foundation;
using MonoMac.AppKit; using MonoMac.AppKit;
using MonoMac.ObjCRuntime; using MonoMac.ObjCRuntime;

View file

@ -24,7 +24,6 @@ using MonoMac.Foundation;
using MonoMac.AppKit; using MonoMac.AppKit;
using MonoMac.ObjCRuntime; using MonoMac.ObjCRuntime;
using MonoMac.WebKit; using MonoMac.WebKit;
using Mono.Unix;
namespace SparkleShare { namespace SparkleShare {
@ -52,8 +51,7 @@ namespace SparkleShare {
Center (); Center ();
string side_splash_path = Path.Combine (NSBundle.MainBundle.ResourcePath, string side_splash_path = Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "side-splash.png");
"Pixmaps", "side-splash.png");
SideSplash = new NSImage (side_splash_path) { SideSplash = new NSImage (side_splash_path) {
Size = new SizeF (150, 482) Size = new SizeF (150, 482)
@ -69,8 +67,8 @@ namespace SparkleShare {
BackgroundColor = NSColor.WindowBackground, BackgroundColor = NSColor.WindowBackground,
Bordered = false, Bordered = false,
Editable = false, Editable = false,
Font = NSFontManager.SharedFontManager.FontWithFamily Font = NSFontManager.SharedFontManager.FontWithFamily (
("Lucida Grande", NSFontTraitMask.Bold, 0, 15) "Lucida Grande", NSFontTraitMask.Bold, 0, 15)
}; };
DescriptionTextField = new NSTextField () { DescriptionTextField = new NSTextField () {
@ -78,8 +76,8 @@ namespace SparkleShare {
BackgroundColor = NSColor.WindowBackground, BackgroundColor = NSColor.WindowBackground,
Bordered = false, Bordered = false,
Editable = false, Editable = false,
Font = NSFontManager.SharedFontManager.FontWithFamily Font = NSFontManager.SharedFontManager.FontWithFamily (
("Lucida Grande", NSFontTraitMask.Condensed, 0, 13) "Lucida Grande", NSFontTraitMask.Condensed, 0, 13)
}; };
if (Program.UI != null) if (Program.UI != null)

View file

@ -42,7 +42,6 @@
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="MonoMac" /> <Reference Include="MonoMac" />
<Reference Include="Mono.Posix" />
<Reference Include="System.Net" /> <Reference Include="System.Net" />
<Reference Include="SparkleLib"> <Reference Include="SparkleLib">
<HintPath>..\..\bin\SparkleLib.dll</HintPath> <HintPath>..\..\bin\SparkleLib.dll</HintPath>

View file

@ -19,7 +19,6 @@ using System;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using Mono.Unix;
using MonoMac.Foundation; using MonoMac.Foundation;
using MonoMac.AppKit; using MonoMac.AppKit;
using MonoMac.ObjCRuntime; using MonoMac.ObjCRuntime;
@ -59,13 +58,6 @@ namespace SparkleShare {
private EventHandler [] overflow_tasks; private EventHandler [] overflow_tasks;
// Short alias for the translations
public static string _ (string s)
{
return Catalog.GetString (s);
}
public SparkleStatusIcon () : base () public SparkleStatusIcon () : base ()
{ {
using (var a = new NSAutoreleasePool ()) using (var a = new NSAutoreleasePool ())

View file

@ -19,7 +19,6 @@ using System;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using Mono.Unix;
using MonoMac.Foundation; using MonoMac.Foundation;
using MonoMac.AppKit; using MonoMac.AppKit;
using MonoMac.ObjCRuntime; using MonoMac.ObjCRuntime;
@ -46,8 +45,6 @@ namespace SparkleShare {
{ {
using (var a = new NSAutoreleasePool ()) using (var a = new NSAutoreleasePool ())
{ {
Catalog.Init ("sparkleshare", Path.Combine (NSBundle.MainBundle.ResourcePath, "Translations"));
GrowlApplicationBridge.WeakDelegate = this; GrowlApplicationBridge.WeakDelegate = this;
GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate (); GrowlApplicationBridge.Delegate = new SparkleGrowlDelegate ();

View file

@ -18,10 +18,6 @@
using System; using System;
using System.Threading; using System.Threading;
#if __MonoCS__
using Mono.Unix;
#endif
namespace SparkleShare { namespace SparkleShare {
// This is SparkleShare! // This is SparkleShare!

View file

@ -177,7 +177,7 @@ namespace SparkleShare {
public virtual void Initialize () public virtual void Initialize ()
{ {
SparklePlugin.PluginsPath = PluginsPath; SparklePlugin.PluginsPath = PluginsPath;
InstallProtocolHandler (); InstallProtocolHandler ();
// Create the SparkleShare folder and add it to the bookmarks // Create the SparkleShare folder and add it to the bookmarks

View file

@ -45,6 +45,8 @@ namespace SparkleShare {
private string selected_folder; private string selected_folder;
public bool WindowIsOpen { get; private set; }
public string SelectedFolder { public string SelectedFolder {
get { get {
return this.selected_folder; return this.selected_folder;
@ -144,6 +146,9 @@ namespace SparkleShare {
public SparkleEventLogController () public SparkleEventLogController ()
{ {
Program.Controller.ShowEventLogWindowEvent += delegate { Program.Controller.ShowEventLogWindowEvent += delegate {
if (!WindowIsOpen)
ContentLoadingEvent ();
if (this.selected_folder == null) { if (this.selected_folder == null) {
new Thread (() => { new Thread (() => {
UpdateChooserEvent (Folders); UpdateChooserEvent (Folders);
@ -152,6 +157,7 @@ namespace SparkleShare {
}).Start (); }).Start ();
} }
WindowIsOpen = true;
ShowWindowEvent (); ShowWindowEvent ();
}; };
@ -172,6 +178,7 @@ namespace SparkleShare {
public void WindowClosed () public void WindowClosed ()
{ {
WindowIsOpen = false;
HideWindowEvent (); HideWindowEvent ();
this.selected_folder = null; this.selected_folder = null;
} }

View file

@ -16,18 +16,18 @@
using System; using System;
using System.IO;
using System.Xml; using System.Xml;
using IO = System.IO;
namespace SparkleShare { namespace SparkleShare {
public class SparklePlugin { public class SparklePlugin {
public static string PluginsPath = ""; public static string PluginsPath = "";
public static string LocalPluginsPath = public static string LocalPluginsPath = new string [] {
new string [] { Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "sparkleshare", "plugins" }.Combine ();
"sparkleshare", "plugins" }.Combine ();
public string Name { public string Name {
@ -45,17 +45,12 @@ namespace SparkleShare {
public string ImagePath { public string ImagePath {
get { get {
string image_file_name = GetValue ("info", "icon"); string image_file_name = GetValue ("info", "icon");
string image_path = IO.Path.Combine (this.plugin_directory, image_file_name);
string image_path = System.IO.Path.Combine ( if (IO.File.Exists (image_path))
this.plugin_directory,
image_file_name
);
if (File.Exists (image_path))
return image_path; return image_path;
else else
return System.IO.Path.Combine ( return IO.Path.Combine (PluginsPath, image_file_name);
PluginsPath, image_file_name);
} }
} }
@ -128,7 +123,7 @@ namespace SparkleShare {
{ {
string plugin_path = System.IO.Path.Combine (LocalPluginsPath, name + ".xml"); string plugin_path = System.IO.Path.Combine (LocalPluginsPath, name + ".xml");
if (File.Exists (plugin_path)) if (IO.File.Exists (plugin_path))
return null; return null;
string plugin_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + string plugin_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
@ -153,10 +148,10 @@ namespace SparkleShare {
plugin_xml = plugin_xml.Replace ("<value></value>", "<value/>"); plugin_xml = plugin_xml.Replace ("<value></value>", "<value/>");
plugin_xml = plugin_xml.Replace ("<example></example>", "<example/>"); plugin_xml = plugin_xml.Replace ("<example></example>", "<example/>");
if (!Directory.Exists (LocalPluginsPath)) if (!IO.Directory.Exists (LocalPluginsPath))
Directory.CreateDirectory (LocalPluginsPath); IO.Directory.CreateDirectory (LocalPluginsPath);
File.WriteAllText (plugin_path, plugin_xml); IO.File.WriteAllText (plugin_path, plugin_xml);
return new SparklePlugin (plugin_path); return new SparklePlugin (plugin_path);
} }
@ -164,8 +159,7 @@ namespace SparkleShare {
private string GetValue (string a, string b) private string GetValue (string a, string b)
{ {
XmlNode node = this.xml.SelectSingleNode ( XmlNode node = this.xml.SelectSingleNode ("/sparkleshare/plugin/" + a + "/" + b + "/text()");
"/sparkleshare/plugin/" + a + "/" + b + "/text()");
if (node != null && !string.IsNullOrEmpty (node.Value)) if (node != null && !string.IsNullOrEmpty (node.Value))
return node.Value; return node.Value;