Code cleanup

This commit is contained in:
Hylke Bons 2012-07-25 10:01:31 +02:00
parent 0b500c3ef4
commit 63eaf5daa5
3 changed files with 21 additions and 32 deletions

View file

@ -35,12 +35,8 @@ namespace SparkleLib {
if (SparkleConfig.DebugMode)
Console.WriteLine (line);
lock (debug_lock) {
File.AppendAllText (
SparkleConfig.DefaultConfig.LogFilePath,
line + Environment.NewLine
);
}
lock (debug_lock)
File.AppendAllText (SparkleConfig.DefaultConfig.LogFilePath, line + Environment.NewLine);
}
@ -60,18 +56,19 @@ namespace SparkleLib {
// Recursively sets access rights of a folder to 'Normal'
public static void ClearAttributes (string path)
{
if (Directory.Exists (path)) {
string [] folders = Directory .GetDirectories (path);
if (!Directory.Exists (path))
return;
foreach (string folder in folders)
ClearAttributes (folder);
string [] folders = Directory.GetDirectories (path);
string [] files = Directory .GetFiles(path);
foreach (string folder in folders)
ClearAttributes (folder);
foreach (string file in files)
if (!IsSymlink (file))
File.SetAttributes (file, FileAttributes.Normal);
}
string [] files = Directory.GetFiles(path);
foreach (string file in files)
if (!IsSymlink (file))
File.SetAttributes (file, FileAttributes.Normal);
}
@ -93,11 +90,9 @@ namespace SparkleLib {
public static bool IsWindows {
get {
PlatformID platform = Environment.OSVersion.Platform;
return (platform == PlatformID.Win32NT ||
platform == PlatformID.Win32S ||
platform == PlatformID.Win32Windows);
return (Environment.OSVersion.Platform == PlatformID.Win32NT ||
Environment.OSVersion.Platform == PlatformID.Win32S ||
Environment.OSVersion.Platform == PlatformID.Win32Windows);
}
}

View file

@ -43,7 +43,6 @@ namespace SparkleShare {
args.RetVal = true;
};
DefaultSize = new Gdk.Size (600, 260);
Resizable = false;
BorderWidth = 0;
@ -52,8 +51,7 @@ namespace SparkleShare {
Title = _("About SparkleShare");
AppPaintable = true;
string image_path = new string [] {SparkleUI.AssetsPath,
"pixmaps", "about.png"}.Combine ();
string image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine ();
Realize ();
Gdk.Pixbuf buf = new Gdk.Pixbuf (image_path);
@ -62,7 +60,6 @@ namespace SparkleShare {
GdkWindow.SetBackPixmap (map, false);
CreateAbout ();
Controller.HideWindowEvent += delegate {
Application.Invoke (delegate {
@ -80,7 +77,7 @@ namespace SparkleShare {
Controller.NewVersionEvent += delegate (string new_version) {
Application.Invoke (delegate {
this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#729fcf'>{0}</span>",
String.Format ("A newer version ({0}) is available!", new_version));
string.Format ("A newer version ({0}) is available!", new_version));
this.updates.ShowAll ();
});
@ -109,17 +106,14 @@ namespace SparkleShare {
private void CreateAbout ()
{
Label version = new Label () {
Markup = "<span font_size='small' fgcolor='white'>" +
"version " + Controller.RunningVersion +
"</span>",
Markup = string.Format ("<span font_size='small' fgcolor='white'>version {0}</span>",
Controller.RunningVersion),
Xalign = 0,
Xpad = 300
};
this.updates = new Label () {
Markup = "<span font_size='small' fgcolor='#729fcf'>" +
"Checking for updates..." +
"</span>",
Markup = "<span font_size='small' fgcolor='#729fcf'>Checking for updates...</span>",
Xalign = 0,
Xpad = 300
};

View file

@ -252,7 +252,7 @@ namespace SparkleShare {
this.animation_frame_number = 0;
this.animation = new Timer () {
Interval = 40
Interval = 100
};
this.animation.Elapsed += delegate {