diff --git a/FriendFace/FriendFace.cs b/FriendFace/FriendFace.cs new file mode 100644 index 00000000..b59051aa --- /dev/null +++ b/FriendFace/FriendFace.cs @@ -0,0 +1,104 @@ +// FriendFace creates an icon theme of buddy icons from the web +// Copyright (C) 2010 Hylke Bons +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using Gtk; +using System; + +namespace FriendFace +{ + + public class FaceCollection : IconTheme + { + + private string Path; + + public bool UseTwitter; + public bool UseGravatar; + public bool UseIdentica; + public bool UseSystem; + public bool UseFlickr; + + public bool UseAllServices; + + private string IconThemePath; + + public FaceCollection () + { + + Path = ""; + + UseTwitter = false; + UseGravatar = false; + UseIdentica = false; + UseSystem = false; + UseFlickr = false; + UseAllServices = false; + + } + + public FaceCollection (string path) + { + + UnixUserInfo unix_user_info = new UnixUserInfo (UnixEnvironment.UserName); + string home_path = unix_user_info.HomeDirectory; + + string IconThemePath = CombineMore (home_path, ".icons"); + SetThemePath (IconThemePath); + + if (!Directory.Exists (theme_path)) + Directory.CreateDirectory (theme_path); + + Directory.CreateDirectory (CombineMore (ThemePath)); + + + } + + public void SetThemePath (string path) + { + string IconThemePath = path; + } + + public string GetThemePath () + { + + } + + + public Gdk.Pixbuf GetFace (string identifier) + { + return null; + } + + public bool AddFace (string identifier) + { + // avatar-twitter-hbons + // 16, 24, 32, 48 + Gdk.Pixbuf gravatar_icon; + if (UseGravatar) + gravatar_icon = new GravatarIcon (identifier); + + return true; + + } + + public bool Refresh () + { + return true; + } + + } + +} diff --git a/FriendFace/FriendFace.csproj b/FriendFace/FriendFace.csproj new file mode 100644 index 00000000..522e24e6 --- /dev/null +++ b/FriendFace/FriendFace.csproj @@ -0,0 +1 @@ + Debug AnyCPU 8.0.50727 2.0 {3BA434AF-494F-4F5D-9D21-B7BD24FD67AF} Exe FriendFace FriendFace true full false bin\Debug DEBUG prompt 4 none false bin\Release prompt 4 \ No newline at end of file diff --git a/FriendFace/Gravatar.cs b/FriendFace/Gravatar.cs new file mode 100644 index 00000000..c11d799b --- /dev/null +++ b/FriendFace/Gravatar.cs @@ -0,0 +1,79 @@ +// FriendFace creates an icon theme of buddy icons from the web +// Copyright (C) 2010 Hylke Bons +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see .using Gtk; + +using Gtk; +using System; + +namespace FriendFace { + + public class Gravatar : Gdk.Pixbuf { + + public Gravatar (string identifier) + { + + UnixUserInfo unix_user_info = new UnixUserInfo (UnixEnvironment.UserName); + string home_path = unix_user_info.HomeDirectory; + + string theme_path = CombineMore (home_path, ".icons", "friendface", "48x48", "status"); + string file_name = "avatar-gravatar-" + identifier; + string file_path = CombineMore (theme_path, file_name); + + if (!Directory.Exists (theme_path)) + Directory.CreateDirectory (theme_path); + + WebClient WebClient = new WebClient (); + Uri icon_uri = new Uri ("http://www.gravatar.com/avatar/" + MD5 (identifier) + ".jpg?s=48&d=404"); + + if (File.Exists (file_path)) + File.Delete (file_path); + + WebClient.DownloadFileAsync (icon_uri, file_path); + + WebClient.DownloadFileCompleted += delegate { + + FileInfo file_info = new FileInfo (file_path); + + if (file_info.Length < 256) + File.Delete (file_path); + + }; + + } + + } + + + // Creates an MD5 hash of input + public static string MD5 (string s) + { + MD5 md5 = new MD5CryptoServiceProvider (); + Byte[] bytes = ASCIIEncoding.Default.GetBytes (s); + Byte[] encoded_bytes = md5.ComputeHash (bytes); + return BitConverter.ToString (encoded_bytes).ToLower ().Replace ("-", ""); + } + + + // Makes it possible to combine more than + // two paths at once + public static string CombineMore (params string [] parts) + { + string new_path = ""; + foreach (string part in parts) + new_path = Path.Combine (new_path, part); + return new_path; + } + +} diff --git a/SharpSSH/SharpSSH.csproj b/SharpSSH/SharpSSH.csproj index 84636d8c..1e6b181a 100644 --- a/SharpSSH/SharpSSH.csproj +++ b/SharpSSH/SharpSSH.csproj @@ -1 +1,199 @@ - Debug AnyCPU 8.0.50727 2.0 {BB50B7E2-4622-4D8B-B7FF-5E5D8F02D91F} Library Tamir.SharpSsh Tamir.SharpSSH true full false ..\bin\Debug\ prompt 4 false none false ..\bin\Release\ prompt 4 false InputForm.cs False lib\DiffieHellman.dll False lib\Org.Mentalis.Security.dll \ No newline at end of file + + + + Debug + AnyCPU + 8.0.50727 + 2.0 + {BB50B7E2-4622-4D8B-B7FF-5E5D8F02D91F} + Library + Tamir.SharpSsh + Tamir.SharpSSH + + + true + full + false + ..\bin\Debug\ + prompt + 4 + false + + + none + false + ..\bin\Release\ + prompt + 4 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + InputForm.cs + + + + + + + + + + False + lib\DiffieHellman.dll + + + False + lib\Org.Mentalis.Security.dll + + + + + + + + + \ No newline at end of file diff --git a/SparkleShare.sln b/SparkleShare.sln index df6e25f5..af6794fc 100644 --- a/SparkleShare.sln +++ b/SparkleShare.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotifySharp", "NotifySharp\ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpSSH", "SharpSSH\SharpSSH.csproj", "{BB50B7E2-4622-4D8B-B7FF-5E5D8F02D91F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FriendFace", "FriendFace\FriendFace.csproj", "{3BA434AF-494F-4F5D-9D21-B7BD24FD67AF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -17,6 +19,10 @@ Global {005CCA8E-DFBF-464A-B6DA-452C62D4589C}.Debug|Any CPU.Build.0 = Debug|Any CPU {005CCA8E-DFBF-464A-B6DA-452C62D4589C}.Release|Any CPU.ActiveCfg = Release|Any CPU {005CCA8E-DFBF-464A-B6DA-452C62D4589C}.Release|Any CPU.Build.0 = Release|Any CPU + {3BA434AF-494F-4F5D-9D21-B7BD24FD67AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BA434AF-494F-4F5D-9D21-B7BD24FD67AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BA434AF-494F-4F5D-9D21-B7BD24FD67AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BA434AF-494F-4F5D-9D21-B7BD24FD67AF}.Release|Any CPU.Build.0 = Release|Any CPU {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Debug|Any CPU.Build.0 = Debug|Any CPU {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/SparkleShare/SparkleIntro.cs b/SparkleShare/SparkleIntro.cs index 005e25a3..1342da62 100644 --- a/SparkleShare/SparkleIntro.cs +++ b/SparkleShare/SparkleIntro.cs @@ -23,11 +23,11 @@ using System.Diagnostics; using System.IO; using System.Text.RegularExpressions; using System.Timers; +using System.Security.Cryptography; namespace SparkleShare { - public class SparkleIntro : Window - { + public class SparkleIntro : Window { // Short alias for the translations public static string _ (string s) @@ -38,15 +38,29 @@ namespace SparkleShare { public SparkleIntro () : base ("") { + using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider()) + { + File.WriteAllText ("PublicKeyOnly.xml", rsa.ToXmlString (false)); + File.WriteAllText ("PublicPrivate.xml", rsa.ToXmlString (true)); + } + BorderWidth = 0; SetSizeRequest (640, 400); Resizable = false; IconName = "folder-sparkleshare"; WindowPosition = WindowPosition.Center; + + ShowStepOne (); + + } + + public void ShowStepOne () + { HBox layout_horizontal = new HBox (false, 6); + // TODO: Fix the path Image side_splash = new Image ("/home/hbons/github/SparkleShare/data/side-splash.png"); layout_horizontal.PackStart (side_splash, false, false, 0); @@ -143,10 +157,10 @@ namespace SparkleShare { layout_horizontal.PackStart (wrapper, true, true, 0); Add (layout_horizontal); - ShowAll (); - } + ShowAll (); + } public void ShowStepTwo () { @@ -165,7 +179,7 @@ namespace SparkleShare { layout_vertical.BorderWidth = 30; Label introduction; - introduction = new Label ("SparkleShare ready to go!"); + introduction = new Label ("SparkleShare is ready to go!"); introduction.UseMarkup = true; introduction.Xalign = 0; @@ -173,7 +187,7 @@ namespace SparkleShare { Label information; information = new Label ("You can now start accepting invitations from others. " + "Just click on invitations you get by email and " + - "we'll take care of the rest."); + "we will take care of the rest."); information.UseMarkup = true; information.Wrap = true; @@ -207,6 +221,7 @@ namespace SparkleShare { layout_horizontal.Add (wrapper); Add (layout_horizontal); + ShowAll (); } diff --git a/SparkleShare/SparkleShare.csproj b/SparkleShare/SparkleShare.csproj index f42c092b..62026f09 100644 --- a/SparkleShare/SparkleShare.csproj +++ b/SparkleShare/SparkleShare.csproj @@ -33,6 +33,10 @@ + + False + ..\SharpSSH\lib\DiffieHellman.dll + diff --git a/SparkleShare/SparkleWindow.cs b/SparkleShare/SparkleWindow.cs index 5bcdc15e..5cac9ba3 100644 --- a/SparkleShare/SparkleWindow.cs +++ b/SparkleShare/SparkleWindow.cs @@ -26,8 +26,7 @@ using System.Timers; namespace SparkleShare { - public class SparkleWindow : Window - { + public class SparkleWindow : Window { // Short alias for the translations public static string _ (string s) @@ -137,7 +136,7 @@ namespace SparkleShare { DateTime date_time = UnixTimestampToDateTime (unix_timestamp); - message = message.Replace ("/", " → "); + message = message.Replace ("/", " ‣ "); message = message.Replace ("\n", " "); ChangeSet change_set = new ChangeSet (user_name, user_email, message, date_time);