Code cleanup
This commit is contained in:
parent
5bef8dd3cc
commit
a2fb7e163c
|
@ -35,12 +35,8 @@ namespace SparkleLib {
|
||||||
if (SparkleConfig.DebugMode)
|
if (SparkleConfig.DebugMode)
|
||||||
Console.WriteLine (line);
|
Console.WriteLine (line);
|
||||||
|
|
||||||
lock (debug_lock) {
|
lock (debug_lock)
|
||||||
File.AppendAllText (
|
File.AppendAllText (SparkleConfig.DefaultConfig.LogFilePath, line + Environment.NewLine);
|
||||||
SparkleConfig.DefaultConfig.LogFilePath,
|
|
||||||
line + Environment.NewLine
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,18 +56,19 @@ namespace SparkleLib {
|
||||||
// Recursively sets access rights of a folder to 'Normal'
|
// Recursively sets access rights of a folder to 'Normal'
|
||||||
public static void ClearAttributes (string path)
|
public static void ClearAttributes (string path)
|
||||||
{
|
{
|
||||||
if (Directory.Exists (path)) {
|
if (!Directory.Exists (path))
|
||||||
string [] folders = Directory .GetDirectories (path);
|
return;
|
||||||
|
|
||||||
foreach (string folder in folders)
|
string [] folders = Directory.GetDirectories (path);
|
||||||
ClearAttributes (folder);
|
|
||||||
|
|
||||||
string [] files = Directory .GetFiles(path);
|
foreach (string folder in folders)
|
||||||
|
ClearAttributes (folder);
|
||||||
|
|
||||||
foreach (string file in files)
|
string [] files = Directory.GetFiles(path);
|
||||||
if (!IsSymlink (file))
|
|
||||||
File.SetAttributes (file, FileAttributes.Normal);
|
foreach (string file in files)
|
||||||
}
|
if (!IsSymlink (file))
|
||||||
|
File.SetAttributes (file, FileAttributes.Normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,11 +90,9 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public static bool IsWindows {
|
public static bool IsWindows {
|
||||||
get {
|
get {
|
||||||
PlatformID platform = Environment.OSVersion.Platform;
|
return (Environment.OSVersion.Platform == PlatformID.Win32NT ||
|
||||||
|
Environment.OSVersion.Platform == PlatformID.Win32S ||
|
||||||
return (platform == PlatformID.Win32NT ||
|
Environment.OSVersion.Platform == PlatformID.Win32Windows);
|
||||||
platform == PlatformID.Win32S ||
|
|
||||||
platform == PlatformID.Win32Windows);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ namespace SparkleShare {
|
||||||
args.RetVal = true;
|
args.RetVal = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
DefaultSize = new Gdk.Size (600, 260);
|
DefaultSize = new Gdk.Size (600, 260);
|
||||||
Resizable = false;
|
Resizable = false;
|
||||||
BorderWidth = 0;
|
BorderWidth = 0;
|
||||||
|
@ -52,8 +51,7 @@ namespace SparkleShare {
|
||||||
Title = _("About SparkleShare");
|
Title = _("About SparkleShare");
|
||||||
AppPaintable = true;
|
AppPaintable = true;
|
||||||
|
|
||||||
string image_path = new string [] {SparkleUI.AssetsPath,
|
string image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine ();
|
||||||
"pixmaps", "about.png"}.Combine ();
|
|
||||||
|
|
||||||
Realize ();
|
Realize ();
|
||||||
Gdk.Pixbuf buf = new Gdk.Pixbuf (image_path);
|
Gdk.Pixbuf buf = new Gdk.Pixbuf (image_path);
|
||||||
|
@ -62,7 +60,6 @@ namespace SparkleShare {
|
||||||
GdkWindow.SetBackPixmap (map, false);
|
GdkWindow.SetBackPixmap (map, false);
|
||||||
|
|
||||||
CreateAbout ();
|
CreateAbout ();
|
||||||
|
|
||||||
|
|
||||||
Controller.HideWindowEvent += delegate {
|
Controller.HideWindowEvent += delegate {
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
|
@ -80,7 +77,7 @@ namespace SparkleShare {
|
||||||
Controller.NewVersionEvent += delegate (string new_version) {
|
Controller.NewVersionEvent += delegate (string new_version) {
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#729fcf'>{0}</span>",
|
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 ();
|
this.updates.ShowAll ();
|
||||||
});
|
});
|
||||||
|
@ -109,17 +106,14 @@ namespace SparkleShare {
|
||||||
private void CreateAbout ()
|
private void CreateAbout ()
|
||||||
{
|
{
|
||||||
Label version = new Label () {
|
Label version = new Label () {
|
||||||
Markup = "<span font_size='small' fgcolor='white'>" +
|
Markup = string.Format ("<span font_size='small' fgcolor='white'>version {0}</span>",
|
||||||
"version " + Controller.RunningVersion +
|
Controller.RunningVersion),
|
||||||
"</span>",
|
|
||||||
Xalign = 0,
|
Xalign = 0,
|
||||||
Xpad = 300
|
Xpad = 300
|
||||||
};
|
};
|
||||||
|
|
||||||
this.updates = new Label () {
|
this.updates = new Label () {
|
||||||
Markup = "<span font_size='small' fgcolor='#729fcf'>" +
|
Markup = "<span font_size='small' fgcolor='#729fcf'>Checking for updates...</span>",
|
||||||
"Checking for updates..." +
|
|
||||||
"</span>",
|
|
||||||
Xalign = 0,
|
Xalign = 0,
|
||||||
Xpad = 300
|
Xpad = 300
|
||||||
};
|
};
|
||||||
|
|
|
@ -252,7 +252,7 @@ namespace SparkleShare {
|
||||||
this.animation_frame_number = 0;
|
this.animation_frame_number = 0;
|
||||||
|
|
||||||
this.animation = new Timer () {
|
this.animation = new Timer () {
|
||||||
Interval = 40
|
Interval = 100
|
||||||
};
|
};
|
||||||
|
|
||||||
this.animation.Elapsed += delegate {
|
this.animation.Elapsed += delegate {
|
||||||
|
|
Loading…
Reference in a new issue