diff --git a/SparkleShare/Mac/SparkleShare/SparkleLog.cs b/SparkleShare/Mac/SparkleShare/SparkleLog.cs index 4052ce8b..dba344b5 100644 --- a/SparkleShare/Mac/SparkleShare/SparkleLog.cs +++ b/SparkleShare/Mac/SparkleShare/SparkleLog.cs @@ -22,6 +22,8 @@ using MonoMac.AppKit; using MonoMac.ObjCRuntime; using MonoMac.WebKit; +using System.IO; + namespace SparkleShare { public class SparkleLog : NSWindow { @@ -83,7 +85,7 @@ namespace SparkleShare { ContentView.AddSubview (CloseButton); - string name = System.IO.Path.GetFileName (LocalPath); + string name = Path.GetFileName (LocalPath); Title = String.Format ("Recent Events in ‘{0}’", name); OrderFrontRegardless (); @@ -100,10 +102,19 @@ namespace SparkleShare { private WebView CreateEventLog () { - RectangleF frame = new RectangleF (0, 12 + 31 + 16, 480, 640 - (12 + 31 + 16)); + RectangleF frame = new RectangleF (0, (12 + 31 + 16), 480, 618 - (12 + 31 + 16)); - WebView = new WebView (frame, "", ""); - WebView.MainFrameUrl = "http://www.google.nl/"; + string folder_name = Path.GetFileName (LocalPath); + string html = SparkleShare.Controller.GetHTMLLog (folder_name); + + html = html.Replace ("", "Lucida Grande"); + html = html.Replace ("", "10pt"); + html = html.Replace ("", "#bbb"); + html = html.Replace ("", "#f5f5f5"); + html = html.Replace ("", "#0085cf"); + + WebView = new WebView (frame, "", ""); + WebView.MainFrame.LoadHtmlString (html, new NSUrl ("")); return WebView; diff --git a/SparkleShare/Mac/SparkleShare/SparkleMacController.cs b/SparkleShare/Mac/SparkleShare/SparkleMacController.cs index 3937009b..34c1ab9c 100644 --- a/SparkleShare/Mac/SparkleShare/SparkleMacController.cs +++ b/SparkleShare/Mac/SparkleShare/SparkleMacController.cs @@ -49,8 +49,8 @@ namespace SparkleShare { // list of bookmarked places public override void AddToBookmarks () { - + // TODO } @@ -89,7 +89,67 @@ namespace SparkleShare { process.Start (); } + + + public override string EventLogHTML + { + + get { + + string resource_path = NSBundle.MainBundle.ResourcePath; + string html_path = Path.Combine (resource_path, "HTML", "event-log.html"); + + StreamReader reader = new StreamReader (html_path); + string html = reader.ReadToEnd (); + reader.Close (); + + return html; + + } + + } + + + public override string DayEntryHTML + { + + get { + + string resource_path = NSBundle.MainBundle.ResourcePath; + + string html_path = Path.Combine (resource_path, "HTML", "day-entry.html"); + + StreamReader reader = new StreamReader (html_path); + string html = reader.ReadToEnd (); + reader.Close (); + + return html; + + } + + } + + + public override string EventEntryHTML + { + + get { + + string resource_path = NSBundle.MainBundle.ResourcePath; + + string html_path = Path.Combine (resource_path, "HTML", "event-entry.html"); + + StreamReader reader = new StreamReader (html_path); + string html = reader.ReadToEnd (); + reader.Close (); + + return html; + + } + + } + } } \ No newline at end of file diff --git a/SparkleShare/Mac/SparkleShare/SparkleWindow.cs b/SparkleShare/Mac/SparkleShare/SparkleWindow.cs index 21f1cbde..0cb8dcee 100644 --- a/SparkleShare/Mac/SparkleShare/SparkleWindow.cs +++ b/SparkleShare/Mac/SparkleShare/SparkleWindow.cs @@ -48,16 +48,41 @@ namespace SparkleShare { SideSplash = new NSImage (NSBundle.MainBundle.ResourcePath + "/Pixmaps/side-splash.png"); SideSplash.Size = new SizeF (150, 480); + + - NSText tv = new NSText (new RectangleF (200, 200, 200, 200)) { - Value = "TEST" + + NSButtonCell proto = new NSButtonCell { + Title = " Github" }; - ContentView.AddSubview (new NSImageView (new RectangleF (0, 0, 150, 480)) { Image = SideSplash}); - ContentView.AddSubview (new NSTextField (new RectangleF (200, 100, 128, 31)) { BezelStyle = NSTextFieldBezelStyle.Rounded}); - ContentView.AddSubview (tv); + NSText text = new NSText (new RectangleF (150,150,350,300)) { + Value = "DDDDDDDD" + }; + proto.SetButtonType (NSButtonType.Radio) ; + + NSButton button = new NSButton (new RectangleF (150, 0, 350, 300)) { + Cell = proto, + Font = NSFontManager.SharedFontManager.FontWithFamily ("Lucida Grande", + NSFontTraitMask.Bold, + 0, 14) + }; + + NSMatrix matrix = new NSMatrix (new RectangleF (300, 00, 300, 300), NSMatrixMode.Radio, proto, 4, 1); + + + + matrix.Cells [0].Title = "My own server:"; + matrix.Cells [1].Title = "Github\nFree hosting"; + matrix.Cells [2].Title = "Gitorious"; + matrix.Cells [3].Title = "The GNOME Project"; + + ContentView.AddSubview (new NSImageView (new RectangleF (0, 0, 150, 480)) { Image = SideSplash}); + ContentView.AddSubview (new NSTextField (new RectangleF (200, 100, 128, 25)) { BezelStyle = NSTextFieldBezelStyle.Square, Editable=false}); + ContentView.AddSubview (button); + ContentView.AddSubview (text); NSApplication.SharedApplication.ActivateIgnoringOtherApps (true); diff --git a/SparkleShare/SparkleController.cs b/SparkleShare/SparkleController.cs index 8cc2ffd4..802554c7 100644 --- a/SparkleShare/SparkleController.cs +++ b/SparkleShare/SparkleController.cs @@ -233,12 +233,16 @@ namespace SparkleShare { } + public abstract string EventLogHTML { get; } + public abstract string DayEntryHTML { get; } + public abstract string EventEntryHTML { get; } + + public string GetHTMLLog (string name) { - List commits = GetLog (name); - - List activity_days = new List (); + List commits = GetLog (name); + List activity_days = new List (); foreach (SparkleCommit commit in commits) { @@ -261,34 +265,20 @@ namespace SparkleShare { if (!commit_inserted) { - ActivityDay activity_day = new ActivityDay (commit.DateTime); - activity_day.Add (commit); - activity_days.Add (activity_day); + ActivityDay activity_day = new ActivityDay (commit.DateTime); + activity_day.Add (commit); + activity_days.Add (activity_day); } } - - - StreamReader reader; - - reader = new StreamReader (Defines.PREFIX + "/share/sparkleshare/html/event-log.html"); - string event_log_html = reader.ReadToEnd (); - reader.Close (); - - reader = new StreamReader (Defines.PREFIX + "/share/sparkleshare/html/day-entry.html"); - string day_entry_html = reader.ReadToEnd (); - reader.Close (); - - reader = new StreamReader (Defines.PREFIX + "/share/sparkleshare/html/event-entry.html"); - string event_entry_html = reader.ReadToEnd (); - reader.Close (); - - + string event_log_html = EventLogHTML; + string day_entry_html = DayEntryHTML; + string event_entry_html = EventEntryHTML; + - string event_log = ""; foreach (ActivityDay activity_day in activity_days) { @@ -305,13 +295,13 @@ namespace SparkleShare { foreach (string file_path in change_set.Edited) { - if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath ,name , file_path))) { + if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath, name, file_path))) { event_entry += "
" + file_path + "
"; } else { - event_entry += "
" + SparkleHelpers.CombineMore (SparklePaths.SparklePath, name, file_path) + "
"; + event_entry += "
" + file_path + "
"; } @@ -326,13 +316,13 @@ namespace SparkleShare { foreach (string file_path in change_set.Added) { - if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath ,name , file_path))) { + if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath, name, file_path))) { event_entry += "
" + file_path + "
"; } else { - event_entry += "
" + SparkleHelpers.CombineMore (SparklePaths.SparklePath ,name , file_path) + "
"; + event_entry += "
" + file_path + "
"; } @@ -346,33 +336,33 @@ namespace SparkleShare { foreach (string file_path in change_set.Deleted) { - if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath ,name , file_path))) { + if (File.Exists (SparkleHelpers.CombineMore (SparklePaths.SparklePath, name, file_path))) { event_entry += "
" + file_path + "
"; } else { - event_entry += "
" + SparkleHelpers.CombineMore (SparklePaths.SparklePath ,name , file_path) + "
"; + event_entry += "
" + file_path + "
"; } } } -Console.WriteLine(GetAvatar (change_set.UserEmail, 32)); + event_entry += ""; + event_entries += event_entry_html.Replace ("", event_entry) .Replace ("", change_set.UserName) - .Replace ("", "file://" +GetAvatar (change_set.UserEmail, 32) ) + .Replace ("", "file://" + GetAvatar (change_set.UserEmail, 32) ) .Replace ("", change_set.DateTime.ToString ("H:mm")); - + } - - - + + string day_entry = ""; - DateTime today = DateTime.Now; + DateTime today = DateTime.Now; DateTime yesterday = DateTime.Now.AddDays (-1); if (today.Day == activity_day.DateTime.Day && @@ -398,7 +388,8 @@ Console.WriteLine(GetAvatar (change_set.UserEmail, 32)); } - + + string html = event_log_html.Replace ("", event_log); return html; diff --git a/SparkleShare/SparkleShare.cs b/SparkleShare/SparkleShare.cs index 8aa9cbe8..fa180f50 100644 --- a/SparkleShare/SparkleShare.cs +++ b/SparkleShare/SparkleShare.cs @@ -89,11 +89,11 @@ namespace SparkleShare { case PlatformID.Unix: SetProcessName ("sparkleshare"); - Controller = new SparkleLinController (); + //Controller = new SparkleLinController (); break; case PlatformID.MacOSX: - //Controller = new SparkleMacController (); + Controller = new SparkleMacController (); break; case PlatformID.Win32NT: diff --git a/data/html/event-log.html b/data/html/event-log.html index 304a0d86..ec3477cd 100644 --- a/data/html/event-log.html +++ b/data/html/event-log.html @@ -30,10 +30,23 @@ padding: 12px; } - .dd { + dl { + padding: 0; + margin: 0; + padding-bottom: 18px; + } + + dt { + padding-bottom: 12px; + padding-top: 12px; + } + + dd { + padding-left: 0; + margin-left: 12px; text-overflow: ellipsis; } - + a { color: ; text-decoration: none; @@ -51,6 +64,10 @@ font-size: 80%; color: ; } + + img { + margin-right: 12px; + }