diff --git a/Makefile.am b/Makefile.am index e81e4787..0fdb386b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,6 @@ SUBDIRS = \ build \ help \ - NotifySharp \ SmartIrc4net \ . \ SparkleLib \ diff --git a/README b/README index 49c5889b..7aafcbb4 100644 --- a/README +++ b/README @@ -87,6 +87,13 @@ Note: Use './configure --prefix=/usr' if you want the Nautilus extension to work. +Build on OSX: +============= + +Get the Mono Framework, Monodevelop, and MacPorts. +Install git-core, automake and intltool using 'port install'. + + Frequently Asked Question ========================= diff --git a/SparkleLib/SparkleListener.cs b/SparkleLib/SparkleListener.cs index 9494c59f..eef45c4b 100644 --- a/SparkleLib/SparkleListener.cs +++ b/SparkleLib/SparkleListener.cs @@ -41,7 +41,7 @@ namespace SparkleLib { Server = server; Channel = channel; - Nick = nick.Replace ("@", "_at_").Replace (".", "_dot_"); + Nick = "test"; //nick.Replace ("@", "_at_").Replace (".", "_dot_"); // Keep the nick short if (Nick.Length > 9) diff --git a/SparkleShare/Makefile.am b/SparkleShare/Makefile.am index 0f218304..28025497 100644 --- a/SparkleShare/Makefile.am +++ b/SparkleShare/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS = \ ASSEMBLY = SparkleShare TARGET = exe -LINK = $(REF_SPARKLESHARE) -pkg:webkit-sharp-1.0 +LINK = $(REF_SPARKLESHARE) SOURCES = \ diff --git a/SparkleShare/SparkleBubble.cs b/SparkleShare/SparkleBubble.cs index ea37b681..14180861 100644 --- a/SparkleShare/SparkleBubble.cs +++ b/SparkleShare/SparkleBubble.cs @@ -15,34 +15,37 @@ // along with this program. If not, see . using Gtk; -using Notifications; using SparkleShare; namespace SparkleShare { - public class SparkleBubble : Notification { + public class SparkleBubble { - public SparkleBubble (string title, string subtext) : base (title, subtext) + public int Timeout; + public string IconName; + public Gdk.Pixbuf Icon; + + public SparkleBubble (string title, string subtext) { IconName = "folder-sparkleshare"; Timeout = 4500; - Urgency = Urgency.Low; +// Urgency = Urgency.Low; - AttachToStatusIcon (SparkleUI.StatusIcon); +// AttachToStatusIcon (SparkleUI.StatusIcon); } // Checks whether the system allows adding buttons to a notification, // prevents error messages in Ubuntu. - new public void AddAction (string action, string label, ActionHandler handler) - { +// new public void AddAction (string action, string label, ActionHandler handler) +// { - if (System.Array.IndexOf (Notifications.Global.Capabilities, "actions") > -1) - base.AddAction (action, label, handler); +// if (System.Array.IndexOf (Notifications.Global.Capabilities, "actions") > -1) +// base.AddAction (action, label, handler); - } +// } } diff --git a/SparkleShare/SparkleLog.cs b/SparkleShare/SparkleLog.cs index eb2e4165..4984883c 100644 --- a/SparkleShare/SparkleLog.cs +++ b/SparkleShare/SparkleLog.cs @@ -20,9 +20,7 @@ using SparkleLib; using System; using System.Collections.Generic; using System.Diagnostics; -using System.IO; using System.Text.RegularExpressions; -using WebKit; namespace SparkleShare { @@ -32,7 +30,6 @@ namespace SparkleShare { private VBox LayoutVertical; private ScrolledWindow ScrolledWindow; private MenuBar MenuBar; - private WebView WebView; // Short alias for the translations public static string _ (string s) @@ -60,54 +57,8 @@ namespace SparkleShare { Close (); }; - LayoutVertical = new VBox (false, 0); - LayoutVertical.PackStart (CreateEventLog (), true, true, 0); - - HButtonBox dialog_buttons = new HButtonBox { - Layout = ButtonBoxStyle.Edge, - BorderWidth = 12 - }; - - Button open_folder_button = new Button (_("_Open Folder")) { - UseUnderline = true - }; - - open_folder_button.Clicked += delegate (object o, EventArgs args) { - - Process process = new Process (); - process.StartInfo.FileName = Defines.OPEN_COMMAND; - process.StartInfo.Arguments = LocalPath.Replace (" ", "\\ "); // Escape space-characters - process.Start (); - - Close (); - - }; - - Button close_button = new Button (Stock.Close); - - close_button.Clicked += delegate { - Close (); - }; - - dialog_buttons.Add (open_folder_button); - dialog_buttons.Add (close_button); - - LayoutVertical.PackStart (new HSeparator (), false, false, 0); - - // We have to hide the menubar somewhere... - LayoutVertical.PackStart (EnableKeyboardShortcuts (), false, false, 0); - LayoutVertical.PackStart (dialog_buttons, false, false, 0); - - Add (LayoutVertical); - - } - - - private MenuBar EnableKeyboardShortcuts () - { - - // Adds a hidden menubar that to enable keyboard + // Adds a hidden menubar that contains to enable keyboard // shortcuts to close the log MenuBar = new MenuBar (); @@ -144,8 +95,46 @@ namespace SparkleShare { // will simply be disabled when using Hide () MenuBar.HeightRequest = 1; MenuBar.ModifyBg (StateType.Normal, Style.Background (StateType.Normal)); + + LayoutVertical = new VBox (false, 0); - return MenuBar; + LayoutVertical.PackStart (CreateEventLog (), true, true, 0); + + HButtonBox dialog_buttons = new HButtonBox { + Layout = ButtonBoxStyle.Edge, + BorderWidth = 12 + }; + + Button open_folder_button = new Button (_("_Open Folder")) { + UseUnderline = true + }; + + open_folder_button.Clicked += delegate (object o, EventArgs args) { + + Process process = new Process (); + process.StartInfo.FileName = Defines.OPEN_COMMAND; + process.StartInfo.Arguments = LocalPath.Replace (" ", "\\ "); // Escape space-characters + process.Start (); + + Close (); + + }; + + Button close_button = new Button (Stock.Close); + + close_button.Clicked += delegate { + Close (); + }; + + dialog_buttons.Add (open_folder_button); + dialog_buttons.Add (close_button); + + LayoutVertical.PackStart (new HSeparator (), false, false, 0); + // We have to hide the menubar somewhere... + LayoutVertical.PackStart (MenuBar, false, false, 0); + LayoutVertical.PackStart (dialog_buttons, false, false, 0); + + Add (LayoutVertical); } @@ -195,7 +184,7 @@ namespace SparkleShare { List commits = new List (); foreach (SparkleRepo repo in SparkleShare.Controller.Repositories) { -// Controller.GetCommits (LocalPath); + // Get commits from the repository if (repo.LocalPath.Equals (LocalPath)) { @@ -222,8 +211,6 @@ namespace SparkleShare { foreach (SparkleCommit commit in commits) { - SparkleUIHelpers.GetAvatar (commit.UserEmail, 32); - bool commit_inserted = false; foreach (ActivityDay stored_activity_day in activity_days) { @@ -249,23 +236,7 @@ namespace SparkleShare { } - - - - 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 (); - + VBox layout_vertical = new VBox (false, 0); if (SparkleShare.Controller.Repositories.Find ( delegate (SparkleRepo r) @@ -277,7 +248,7 @@ namespace SparkleShare { SparkleInfobar infobar = new SparkleInfobar ("dialog-error", title, text); - LayoutVertical.PackStart (infobar, false, false, 0); + layout_vertical.PackStart (infobar, false, false, 0); } else { @@ -291,177 +262,240 @@ namespace SparkleShare { SparkleInfobar infobar = new SparkleInfobar ("dialog-error", title, text); - LayoutVertical.PackStart (infobar, false, false, 0); + layout_vertical.PackStart (infobar, false, false, 0); } } - string event_log = ""; + TreeView tree_view = new TreeView (); + Gdk.Color background_color = tree_view.Style.Base (StateType.Normal); foreach (ActivityDay activity_day in activity_days) { - string event_entries = ""; + EventBox box = new EventBox (); + + Label date_label = new Label ("") { + UseMarkup = true, + Xalign = 0, + Xpad = 9, + Ypad = 9 + }; + + DateTime today = DateTime.Now; + DateTime yesterday = DateTime.Now.AddDays (-1); + + if (today.Day == activity_day.DateTime.Day && + today.Month == activity_day.DateTime.Month && + today.Year == activity_day.DateTime.Year) { + + date_label.Markup = "Today"; + + } else if (yesterday.Day == activity_day.DateTime.Day && + yesterday.Month == activity_day.DateTime.Month && + yesterday.Year == activity_day.DateTime.Year) { + + date_label.Markup = "Yesterday"; + + } else { + + date_label.Markup = "" + activity_day.DateTime.ToString ("ddd MMM d, yyyy") + ""; + + } + + box.Add (date_label); + layout_vertical.PackStart (box, false, false, 0); + + Gdk.Color color = Style.Foreground (StateType.Insensitive); + string secondary_text_color = SparkleUIHelpers.GdkColorToHex (color); foreach (SparkleCommit change_set in activity_day) { - string event_entry = "
"; + VBox log_entry = new VBox (false, 0); + VBox deleted_files = new VBox (false, 0); + VBox edited_files = new VBox (false, 0); + VBox added_files = new VBox (false, 0); + VBox moved_files = new VBox (false, 0); - if (change_set.Edited.Count > 0) { - event_entry += "
Edited
"; + foreach (string file_path in change_set.Edited) { - foreach (string file_path in change_set.Edited) { + SparkleLink link = new SparkleLink (file_path, + SparkleHelpers.CombineMore (LocalPath, file_path)); - if (File.Exists (SparkleHelpers.CombineMore (LocalPath, file_path))) { + link.ModifyBg (StateType.Normal, background_color); - event_entry += "
" + file_path + "
"; + edited_files.PackStart (link, false, false, 0); - } else { + } - event_entry += "
" + SparkleHelpers.CombineMore (LocalPath, file_path) + "
"; + foreach (string file_path in change_set.Added) { - } + SparkleLink link = new SparkleLink (file_path, + SparkleHelpers.CombineMore (LocalPath, file_path)); - } + link.ModifyBg (StateType.Normal, background_color); + + added_files.PackStart (link, false, false, 0); } - if (change_set.Added.Count > 0) { + foreach (string file_path in change_set.Deleted) { - event_entry += "
Added
"; + SparkleLink link = new SparkleLink (file_path, + SparkleHelpers.CombineMore (LocalPath, file_path)); - foreach (string file_path in change_set.Added) { + link.ModifyBg (StateType.Normal, background_color); - if (File.Exists (SparkleHelpers.CombineMore (LocalPath, file_path))) { - - event_entry += "
" + file_path + "
"; - - } else { - - event_entry += "
" + SparkleHelpers.CombineMore (LocalPath, file_path) + "
"; - - } - - } + deleted_files.PackStart (link, false, false, 0); } - if (change_set.Deleted.Count > 0) { + for (int i = 0; i < change_set.MovedFrom.Count; i++) { - event_entry += "
Deleted
"; + SparkleLink from_link = new SparkleLink (change_set.MovedFrom [i], + SparkleHelpers.CombineMore (LocalPath, change_set.MovedFrom [i])); - foreach (string file_path in change_set.Deleted) { + from_link.ModifyBg (StateType.Normal, background_color); - if (File.Exists (SparkleHelpers.CombineMore (LocalPath, file_path))) { + SparkleLink to_link = new SparkleLink (change_set.MovedTo [i], + SparkleHelpers.CombineMore (LocalPath, change_set.MovedTo [i])); - event_entry += "
" + file_path + "
"; + to_link.ModifyBg (StateType.Normal, background_color); - } else { + Label to_label = new Label ("" + + "to ") { + UseMarkup = true, + Xalign = 0 + }; - event_entry += "
" + SparkleHelpers.CombineMore (LocalPath, file_path) + "
"; + HBox link_wrapper = new HBox (false, 0); + link_wrapper.PackStart (to_label, false, false, 0); + link_wrapper.PackStart (to_link, true, true, 0); - } + moved_files.PackStart (from_link, false, false, 0); + moved_files.PackStart (link_wrapper, false, false, 0); - } + if (change_set.MovedFrom.Count > 1) + moved_files.PackStart (new Label (""), false, false, 0); } -Console.WriteLine(SparkleUIHelpers.GetAvatar (change_set.UserEmail, 32)); - event_entry += "
"; - event_entries += event_entry_html.Replace ("", event_entry) - .Replace ("", change_set.UserName) - .Replace ("", "file://" + SparkleUIHelpers.GetAvatar (change_set.UserEmail, 32)) - .Replace ("", change_set.DateTime.ToString ("H:mm")); + + HBox change_set_info_hbox = new HBox (false, 0); + + Label change_set_info = new Label ("" + change_set.UserName + "") { + UseMarkup = true, + Xalign = 0 + }; + + Label change_set_time = new Label ("" + + change_set.DateTime.ToString ("H:mm") + + "") { + Xalign = 1, + UseMarkup = true + }; + + change_set_info_hbox.PackStart (change_set_info, true, true, 0); + change_set_info_hbox.PackStart (change_set_time, false, false, 0); + + log_entry.PackStart (change_set_info_hbox, false, false, 0); + + if (edited_files.Children.Length > 0) { + + Label edited_label = new Label ("\n" + + _("Edited") + + "") { + UseMarkup = true, + Xalign = 0 + }; + + log_entry.PackStart (edited_label, false, false, 0); + log_entry.PackStart (edited_files, false, false, 0); + + } + + if (added_files.Children.Length > 0) { + + Label added_label = new Label ("\n" + + _("Added") + + "") { + UseMarkup = true, + Xalign = 0 + }; + + log_entry.PackStart (added_label, false, false, 0); + log_entry.PackStart (added_files, false, false, 0); + + } + + if (deleted_files.Children.Length > 0) { + + Label deleted_label = new Label ("\n" + + _("Deleted") + + "") { + UseMarkup = true, + Xalign = 0 + }; + + log_entry.PackStart (deleted_label, false, false, 0); + log_entry.PackStart (deleted_files, false, false, 0); + + } + + if (moved_files.Children.Length > 0) { + + Label moved_label = new Label ("\n" + + _("Moved") + + "") { + UseMarkup = true, + Xalign = 0 + }; + + log_entry.PackStart (moved_label, false, false, 0); + log_entry.PackStart (moved_files, false, false, 0); + + } + + HBox hbox = new HBox (false, 0); + + Image avatar = new Image (SparkleUIHelpers.GetAvatar (change_set.UserEmail, 32)) { + Yalign = 0 + }; + + hbox.PackStart (avatar, false, false, 18); + + VBox vbox = new VBox (false, 0); + vbox.PackStart (log_entry, false, false, 0); + + hbox.PackStart (vbox, true, true, 0); + hbox.PackStart (new Label (""), false, false, 12); + + layout_vertical.PackStart (hbox, false, false, 18); } - - - string day_entry = ""; - - DateTime today = DateTime.Now; - DateTime yesterday = DateTime.Now.AddDays (-1); - - if (today.Day == activity_day.DateTime.Day && - today.Month == activity_day.DateTime.Month && - today.Year == activity_day.DateTime.Year) { - - day_entry = day_entry_html.Replace ("", "Today"); - - } else if (yesterday.Day == activity_day.DateTime.Day && - yesterday.Month == activity_day.DateTime.Month && - yesterday.Year == activity_day.DateTime.Year) { - - day_entry = day_entry_html.Replace ("", "Yesterday"); - - } else { - - day_entry = day_entry_html.Replace ("", - "" + activity_day.DateTime.ToString ("ddd MMM d, yyyy") + ""); - - } - - event_log += day_entry.Replace ("", event_entries); - + layout_vertical.PackStart (new Label (""), false, false, 3); } - string html = event_log_html.Replace ("", event_log); + ScrolledWindow = new ScrolledWindow (); + EventBox wrapper = new EventBox (); + wrapper.ModifyBg (StateType.Normal, background_color); + wrapper.Add (layout_vertical); - // Style the html page like the GTK theme - html = html.Replace ("", (Style.FontDescription.Size / 1024 + 0.5) + "pt"); - html = html.Replace ("", "\"" + Style.FontDescription.Family + "\""); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal))); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal))); - - - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); - html = html.Replace ("", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); - -Console.WriteLine (Style.FontDescription.Family); - - WebView = new WebView () { - Editable = false - }; - - - WebView.HoveringOverLink += delegate (object o, WebKit.HoveringOverLinkArgs args) { - Status = args.Link; - }; -WebView.NavigationRequested += delegate (object o, WebKit.NavigationRequestedArgs args) { - // FIXME: There's currently no way to tell the difference - // between a link being clicked and another navigation event. - // This is a temporary workaround. - Console.WriteLine ("CLICKED!" + args.Request.Uri); - - if (args.Request.Uri == Status) { - -Console.WriteLine ("CLICKED!:" + Status); - } - }; - ScrolledWindow = new ScrolledWindow () { - HscrollbarPolicy = PolicyType.Never - }; - - -// wrapper.ModifyBg (StateType.Normal, background_color); - - WebView.LoadHtmlString (html, "file://"); - WebView.HoveringOverLink += delegate {}; - - ScrolledWindow.AddWithViewport (WebView); + ScrolledWindow.AddWithViewport (wrapper); (ScrolledWindow.Child as Viewport).ShadowType = ShadowType.None; return ScrolledWindow; } -public string Status = null; } - // All commits that happened on a day + + // All commits that happened on a day public class ActivityDay : List { diff --git a/SparkleShare/SparkleSpinner.cs b/SparkleShare/SparkleSpinner.cs index 5d83d3b9..29889b34 100644 --- a/SparkleShare/SparkleSpinner.cs +++ b/SparkleShare/SparkleSpinner.cs @@ -86,7 +86,7 @@ namespace SparkleShare { else CurrentStep = 0; - Application.Invoke (delegate { SetImage (); }); +// Application.Invoke (delegate { SetImage (); }); } diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index 6ed72417..d83c1336 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -129,14 +129,14 @@ namespace SparkleShare { else bubble.Icon = SparkleUIHelpers.GetIcon ("avatar-default", 32); - bubble.AddAction ("", "Show Events", delegate { +// bubble.AddAction ("", "Show Events", delegate { - SparkleLog log = new SparkleLog (repository_path); - log.ShowAll (); +// SparkleLog log = new SparkleLog (repository_path); +// log.ShowAll (); - }); +// }); - bubble.Show (); +// bubble.Show (); }); @@ -150,7 +150,7 @@ namespace SparkleShare { string subtext = _("Don't worry, SparkleShare made a copy of each conflicting file."); SparkleBubble bubble = new SparkleBubble(title, subtext); - bubble.Show (); +// bubble.Show (); }); }; diff --git a/build/build.environment.mk b/build/build.environment.mk index 7908bc95..e38da469 100644 --- a/build/build.environment.mk +++ b/build/build.environment.mk @@ -30,7 +30,7 @@ REF_SPARKLELIB = $(LINK_SYSTEM) $(LINK_MONO_POSIX) $(LINK_SMARTIRC4NET) $(LINK_G LINK_SPARKLELIB = -r:$(DIR_BIN)/SparkleLib.dll LINK_SPARKLELIB_DEPS = $(REF_SPARKLELIB) $(LINK_SPARKLELIB) -REF_SPARKLESHARE = $(LINK_DBUS) $(LINK_GTK) $(LINK_NOTIFY_SHARP_DEPS) $(LINK_SPARKLELIB_DEPS) +REF_SPARKLESHARE = $(LINK_DBUS) $(LINK_GTK) $(LINK_SPARKLELIB_DEPS) REF_SPARKLEDIFF = $(LINK_FRIENDFACE_DEPS) $(LINK_GTK) $(LINK_SPARKLELIB_DEPS) diff --git a/configure.ac b/configure.ac index e6fb30b0..c96ceada 100644 --- a/configure.ac +++ b/configure.ac @@ -69,10 +69,10 @@ fi dnl package checks, common for all configs -PKG_CHECK_MODULES([NDESK_DBUS], [ndesk-dbus-1.0]) -AC_SUBST(NDESK_DBUS_LIBS) -PKG_CHECK_MODULES([NDESK_DBUS_GLIB], [ndesk-dbus-glib-1.0]) -AC_SUBST(NDESK_DBUS_GLIB_LIBS) +#PKG_CHECK_MODULES([NDESK_DBUS], [ndesk-dbus-1.0]) +#AC_SUBST(NDESK_DBUS_LIBS) +#PKG_CHECK_MODULES([NDESK_DBUS_GLIB], [ndesk-dbus-glib-1.0]) +#AC_SUBST(NDESK_DBUS_GLIB_LIBS) SPARKLESHARE_CHECK_GTK_SHARP @@ -97,7 +97,6 @@ data/Makefile data/icons/Makefile data/html/Makefile help/Makefile -NotifySharp/Makefile SparkleLib/AssemblyInfo.cs SparkleLib/Defines.cs SparkleLib/Makefile