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
if (string.IsNullOrEmpty (uri))
uri = SparkleConfig.DefaultConfig.GetFolderOptionalAttribute (
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
uri = SparkleConfig.DefaultConfig.GetFolderOptionalAttribute (folder_name, "announcements_url");
// 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 announce_uri = new Uri (uri);
@ -58,8 +54,7 @@ namespace SparkleLib {
// the number of connections as low as possible
foreach (SparkleListenerBase listener in listeners) {
if (listener.Server.Equals (announce_uri)) {
SparkleHelpers.DebugInfo ("ListenerFactory",
"Refered to existing " + announce_uri.Scheme +
SparkleHelpers.DebugInfo ("ListenerFactory", "Refered to existing " + announce_uri.Scheme +
" listener for " + announce_uri);
// We already seem to have a listener for this server,
@ -80,8 +75,8 @@ namespace SparkleLib {
break;
}
SparkleHelpers.DebugInfo ("ListenerFactory",
"Issued new " + announce_uri.Scheme + " listener for " + announce_uri);
SparkleHelpers.DebugInfo ("ListenerFactory", "Issued new " + announce_uri.Scheme +
" listener for " + announce_uri);
return (SparkleListenerBase) listeners [listeners.Count - 1];
}

View file

@ -233,7 +233,10 @@ namespace SparkleShare {
if (this.web_view.Superview == ContentView)
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.IO;
using Mono.Unix;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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