linux: Fix build

This commit is contained in:
Hylke Bons 2016-03-31 15:46:17 +01:00
parent 1423c2d4ca
commit 996f2b2ce7
34 changed files with 147 additions and 153 deletions

View file

@ -43,8 +43,7 @@ namespace SparkleShare
if (skipped_avatars.Contains (email))
return null;
string avatars_path = new string [] { Path.GetDirectoryName (target_path),
"avatars", size + "x" + size }.Combine ();
string avatars_path = Path.Combine (Path.GetDirectoryName (target_path), "avatars", size + "x" + size);
// Search avatars by file name, ignore extension
// Delete files over a day old

View file

@ -36,7 +36,7 @@ namespace SparkleShare {
}
private void AddRepository (BaseRepository repo)
void AddRepository (BaseRepository repo)
{
lock (this.repo_lock) {
this.repositories.Add (repo);
@ -45,7 +45,7 @@ namespace SparkleShare {
}
private void RemoveRepository (BaseRepository repo)
void RemoveRepository (BaseRepository repo)
{
lock (this.repo_lock)
this.repositories.Remove (repo);
@ -186,12 +186,12 @@ namespace SparkleShare {
public abstract string EventEntryHTML { get; }
private BaseFetcher fetcher;
private FileSystemWatcher watcher;
private Object repo_lock = new Object ();
private Object check_repos_lock = new Object ();
private List<BaseRepository> repositories = new List<BaseRepository> ();
private bool lost_folders_path = false;
BaseFetcher fetcher;
FileSystemWatcher watcher;
object repo_lock = new object ();
object check_repos_lock = new object ();
List<BaseRepository> repositories = new List<BaseRepository> ();
bool lost_folders_path = false;
public BaseController ()

View file

@ -1,4 +1,4 @@
dist_plugins_DATA = \
dist_presets_DATA = \
bitbucket.xml \
github.xml \
own-server.xml \
@ -8,7 +8,7 @@ dist_plugins_DATA = \
planio.png \
own-server.png
pluginsdir = $(pkgdatadir)/presets/
presetsdir = $(pkgdatadir)/presets/
MAINTAINERCLEANFILES = \
Makefile.in

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<sparkleshare>
<plugin>
<preset>
<info>
<name>Bitbucket</name>
<description>Free code hosting for Git and Mercurial</description>
@ -17,5 +17,5 @@
<example>/username/project</example>
<uses_lower_case>True</uses_lower_case>
</path>
</plugin>
</preset>
</sparkleshare>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<sparkleshare>
<plugin>
<preset>
<info>
<name>GitHub</name>
<description>Collaborate on projects hosted on GitHub</description>
@ -16,5 +16,5 @@
<value/>
<example>/username/project</example>
</path>
</plugin>
</preset>
</sparkleshare>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<sparkleshare>
<plugin>
<preset>
<info>
<name>On my own server</name>
<description>Everything under my control</description>
@ -15,5 +15,5 @@
<value/>
<example>/path/to/project</example>
</path>
</plugin>
</preset>
</sparkleshare>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<sparkleshare>
<plugin>
<preset>
<info>
<name>Planio</name>
<description>500MB of unlimited free hosted Git repos and project management</description>
@ -17,5 +17,5 @@
<value/>
<example>/[account]-[project].git</example>
</path>
</plugin>
</preset>
</sparkleshare>

View file

@ -78,7 +78,7 @@ namespace SparkleShare {
private void CreateAbout ()
{
CssProvider window_css_provider = new CssProvider ();
Image image = SparkleUIHelpers.GetImage("about.png");
Image image = UserInterfaceHelpers.GetImage("about.png");
window_css_provider.LoadFromData ("GtkWindow {" +
"background-image: url('" + image.File + "');" +

View file

@ -37,7 +37,7 @@ namespace SparkleShare {
private void ShowBubbleEvent (string title, string subtext, string image_path)
{
if (!Program.Controller.NotificationsEnabled)
if (!SparkleShare.Controller.NotificationsEnabled)
return;
Application.Invoke (delegate {
@ -57,7 +57,7 @@ namespace SparkleShare {
notification.Show ();
} catch (Exception e) {
SparkleLogger.LogInfo ("Notification", "Error showing notification: ", e);
Logger.LogInfo ("Notification", "Error showing notification: ", e);
}
});
}

View file

@ -26,16 +26,16 @@ using Sparkles;
namespace SparkleShare {
public class SparkleController : ControllerBase {
public class Controller : BaseController {
public SparkleController ()
public Controller ()
{
}
public override string PresetsPath {
get {
return Path.Combine (Defines.INSTALL_DIR, "plugins");
return Path.Combine (InstallationInfo.Directory, "presets");
}
}
@ -55,7 +55,7 @@ namespace SparkleShare {
string autostart_exec = "sparkleshare";
if (Defines.INSTALL_DIR.StartsWith ("/app/"))
if (InstallationInfo.Directory.StartsWith ("/app/"))
autostart_exec = "xdg-app run org.sparkleshare.SparkleShare";
// TODO: Ship as .desktop file and copy in place
@ -69,10 +69,10 @@ namespace SparkleShare {
"Terminal=false\n" +
"X-GNOME-Autostart-enabled=true\n");
SparkleLogger.LogInfo ("Controller", "Added SparkleShare to startup items");
Logger.LogInfo ("Controller", "Added SparkleShare to startup items");
} catch (Exception e) {
SparkleLogger.LogInfo ("Controller", "Failed to add SparkleShare to startup items", e);
Logger.LogInfo ("Controller", "Failed to add SparkleShare to startup items", e);
}
}
@ -80,9 +80,9 @@ namespace SparkleShare {
// Creates the SparkleShare folder in the user's home folder
public override bool CreateSparkleShareFolder ()
{
if (!Directory.Exists (SparkleConfig.DefaultConfig.FoldersPath)) {
Directory.CreateDirectory (SparkleConfig.DefaultConfig.FoldersPath);
Syscall.chmod (SparkleConfig.DefaultConfig.FoldersPath, (FilePermissions) 448); // 448 -> 700
if (!Directory.Exists (Configuration.DefaultConfig.FoldersPath)) {
Directory.CreateDirectory (Configuration.DefaultConfig.FoldersPath);
Syscall.chmod (Configuration.DefaultConfig.FoldersPath, (FilePermissions) 448); // 448 -> 700
return true;
}
@ -93,8 +93,8 @@ namespace SparkleShare {
public override string EventLogHTML {
get {
string html_path = new string [] { Defines.INSTALL_DIR, "html", "event-log.html" }.Combine ();
string jquery_file_path = new string [] { Defines.INSTALL_DIR, "html", "jquery.js" }.Combine ();
string html_path = Path.Combine (InstallationInfo.Directory, "html", "event-log.html");
string jquery_file_path = Path.Combine (InstallationInfo.Directory, "html", "jquery.js");
string html = File.ReadAllText (html_path);
string jquery = File.ReadAllText (jquery_file_path);
@ -106,7 +106,7 @@ namespace SparkleShare {
public override string DayEntryHTML {
get {
string path = new string [] { Defines.INSTALL_DIR, "html", "day-entry.html" }.Combine ();
string path = Path.Combine (InstallationInfo.Directory, "html", "day-entry.html");
return File.ReadAllText (path);
}
}
@ -114,7 +114,7 @@ namespace SparkleShare {
public override string EventEntryHTML {
get {
string path = new string [] { Defines.INSTALL_DIR, "html", "event-entry.html" }.Combine ();
string path = Path.Combine (InstallationInfo.Directory, "html", "event-entry.html");
return File.ReadAllText (path);
}
}
@ -129,7 +129,7 @@ namespace SparkleShare {
public override void SetFolderIcon ()
{
var process = new SparkleProcess ("gvfs-set-attribute", SparkleConfig.DefaultConfig.FoldersPath + " " +
var process = new Command ("gvfs-set-attribute", Configuration.DefaultConfig.FoldersPath + " " +
"metadata::custom-icon-name org.sparkleshare.SparkleShare");
process.StartAndWaitForExit ();
@ -144,7 +144,7 @@ namespace SparkleShare {
public override void OpenFile (string path)
{
new SparkleProcess ("xdg-open", "\"" + path + "\"").Start ();
new Command ("xdg-open", "\"" + path + "\"").Start ();
}

View file

@ -16,6 +16,7 @@
using System;
using IO = System.IO;
using Gtk;
// using WebKit;
@ -240,34 +241,34 @@ namespace SparkleShare {
public void UpdateContent (string html)
{
string pixmaps_path = new string [] {SparkleUI.AssetsPath, "pixmaps"}.Combine ();
string icons_path = new string [] {SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status"}.Combine ();
string pixmaps_path = IO.Path.Combine (UserInterface.AssetsPath, "pixmaps");
string icons_path = IO.Path.Combine (UserInterface.AssetsPath, "icons", "hicolor", "12x12", "status");
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
html = html.Replace ("<!-- $a-color -->", "#0085cf");
html = html.Replace ("<!-- $body-font-family -->", StyleContext.GetFont (StateFlags.Normal).Family);
html = html.Replace ("<!-- $body-font-size -->", (double) (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px");
html = html.Replace ("<!-- $body-color -->", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Normal)));
html = html.Replace ("<!-- $body-color -->", UserInterfaceHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Normal)));
// TODO
// html = html.Replace ("<!-- $body-background-color -->",
// SparkleUIHelpers.RGBAToHex (new TreeView ().StyleContext.GetStyleProperty ("background-color")));
// UserInterfaceHelpers.RGBAToHex (new TreeView ().StyleContext.GetStyleProperty ("background-color")));
html = html.Replace ("<!-- $day-entry-header-font-size -->", (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px");
html = html.Replace ("<!-- $day-entry-header-background-color -->",
SparkleUIHelpers.RGBAToHex (StyleContext.GetBackgroundColor (StateFlags.Normal)));
UserInterfaceHelpers.RGBAToHex (StyleContext.GetBackgroundColor (StateFlags.Normal)));
html = html.Replace ("<!-- $secondary-font-color -->", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Insensitive)));
html = html.Replace ("<!-- $secondary-font-color -->", UserInterfaceHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Insensitive)));
html = html.Replace ("<!-- $small-color -->", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Insensitive)));
html = html.Replace ("<!-- $small-color -->", UserInterfaceHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Insensitive)));
html = html.Replace ("<!-- $small-font-size -->", "90%");
html = html.Replace ("<!-- $pixmaps-path -->", pixmaps_path);
html = html.Replace ("<!-- $document-added-background-image -->", "file://" + new string [] {icons_path, "document-added.png"}.Combine ());
html = html.Replace ("<!-- $document-edited-background-image -->", "file://" + new string [] {icons_path, "document-edited.png"}.Combine ());
html = html.Replace ("<!-- $document-deleted-background-image -->", "file://" + new string [] {icons_path, "document-deleted.png"}.Combine ());
html = html.Replace ("<!-- $document-moved-background-image -->", "file://" + new string [] {icons_path, "document-moved.png"}.Combine ());
html = html.Replace ("<!-- $document-added-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-added.png"));
html = html.Replace ("<!-- $document-edited-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-edited.png"));
html = html.Replace ("<!-- $document-deleted-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-deleted.png"));
html = html.Replace ("<!-- $document-moved-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-moved.png"));
this.spinner.Stop ();
// this.scrolled_window.Remove (this.web_view);

View file

@ -75,7 +75,7 @@ namespace SparkleShare {
Image user_image = new Image (Controller.AvatarFilePath);
/* TODO: Style the entry neatly, multiple lines, and add placeholder text
string balloon_image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "text-balloon.png" }.Combine ();
string balloon_image_path = new string [] { UserInterface.AssetsPath, "pixmaps", "text-balloon.png" }.Combine ();
Image balloon_image = new Image (balloon_image_path);
CssProvider balloon_css_provider = new CssProvider ();
@ -113,8 +113,8 @@ namespace SparkleShare {
};
Label user_label = new Label () {
Markup = "<b>" + Program.Controller.CurrentUser.Name + "</b>\n" +
"<span fgcolor=\"" + Program.UI.SecondaryTextColor + "\">" + Program.Controller.CurrentUser.Email +
Markup = "<b>" + SparkleShare.Controller.CurrentUser.Name + "</b>\n" +
"<span fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + SparkleShare.Controller.CurrentUser.Email +
"</span>"
};

View file

@ -137,7 +137,7 @@ namespace SparkleShare {
VBox layout_address = new VBox (true, 0);
VBox layout_path = new VBox (true, 0);
ListStore store = new ListStore (typeof (string), typeof (Gdk.Pixbuf), typeof (string), typeof (SparklePreset));
ListStore store = new ListStore (typeof (string), typeof (Gdk.Pixbuf), typeof (string), typeof (Preset));
SparkleTreeView tree_view = new SparkleTreeView (store) { HeadersVisible = false };
ScrolledWindow scrolled_window = new ScrolledWindow () { ShadowType = ShadowType.In };
@ -157,11 +157,11 @@ namespace SparkleShare {
service_column.PackStart (service_cell, true);
service_column.SetCellDataFunc (service_cell, new TreeCellDataFunc (RenderServiceColumn));
foreach (SparklePreset plugin in Controller.Presets) {
store.AppendValues ("", new Gdk.Pixbuf (plugin.ImagePath),
"<span size=\"small\"><b>" + plugin.Name + "</b>\n" +
"<span fgcolor=\"" + Program.UI.SecondaryTextColor + "\">" + plugin.Description + "</span>" +
"</span>", plugin);
foreach (Preset preset in Controller.Presets) {
store.AppendValues ("", new Gdk.Pixbuf (preset.ImagePath),
"<span size=\"small\"><b>" + preset.Name + "</b>\n" +
"<span fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + preset.Description + "</span>" +
"</span>", preset);
}
tree_view.AppendColumn (service_column);
@ -183,14 +183,14 @@ namespace SparkleShare {
Xalign = 0,
UseMarkup = true,
Markup = "<span size=\"small\" fgcolor=\"" +
Program.UI.SecondaryTextColor + "\">" + Controller.SelectedPreset.AddressExample + "</span>"
SparkleShare.UI.SecondaryTextColor + "\">" + Controller.SelectedPreset.AddressExample + "</span>"
};
Label path_example = new Label () {
Xalign = 0,
UseMarkup = true,
Markup = "<span size=\"small\" fgcolor=\"" +
Program.UI.SecondaryTextColor + "\">" + Controller.SelectedPreset.PathExample + "</span>"
SparkleShare.UI.SecondaryTextColor + "\">" + Controller.SelectedPreset.PathExample + "</span>"
};
@ -203,7 +203,7 @@ namespace SparkleShare {
string address;
try {
address = (model.GetValue (iter, 2) as SparklePreset).Address;
address = (model.GetValue (iter, 2) as Preset).Address;
} catch (NullReferenceException) {
address = "";
@ -213,12 +213,12 @@ namespace SparkleShare {
address.Equals (Controller.PreviousAddress)) {
tree_view.SetCursor (path, service_column, false);
SparklePreset plugin = (SparklePreset) model.GetValue (iter, 2);
Preset preset = (Preset) model.GetValue (iter, 2);
if (plugin.Address != null)
if (preset.Address != null)
address_entry.Sensitive = false;
if (plugin.Path != null)
if (preset.Path != null)
path_entry.Sensitive = false;
return true;
@ -280,7 +280,7 @@ namespace SparkleShare {
address_entry.Text = text;
address_entry.Sensitive = (state == FieldState.Enabled);
address_example.Markup = "<span size=\"small\" fgcolor=\"" +
Program.UI.SecondaryTextColor + "\">" + example_text + "</span>";
SparkleShare.UI.SecondaryTextColor + "\">" + example_text + "</span>";
});
};
@ -291,7 +291,7 @@ namespace SparkleShare {
path_entry.Text = text;
path_entry.Sensitive = (state == FieldState.Enabled);
path_example.Markup = "<span size=\"small\" fgcolor=\""
+ Program.UI.SecondaryTextColor + "\">" + example_text + "</span>";
+ SparkleShare.UI.SecondaryTextColor + "\">" + example_text + "</span>";
});
};
@ -405,9 +405,9 @@ namespace SparkleShare {
Header = "Oops! Something went wrong" + "…";
VBox points = new VBox (false, 0);
Image list_point_one = new Image (SparkleUIHelpers.GetIcon ("list-point", 16));
Image list_point_two = new Image (SparkleUIHelpers.GetIcon ("list-point", 16));
Image list_point_three = new Image (SparkleUIHelpers.GetIcon ("list-point", 16));
Image list_point_one = new Image (UserInterfaceHelpers.GetIcon ("list-point", 16));
Image list_point_two = new Image (UserInterfaceHelpers.GetIcon ("list-point", 16));
Image list_point_three = new Image (UserInterfaceHelpers.GetIcon ("list-point", 16));
Label label_one = new Label () {
Markup = "<b>" + Controller.PreviousUrl + "</b> is the address weve compiled. " +
@ -507,7 +507,7 @@ namespace SparkleShare {
wrapper.PackStart (table, true, false, 0);
Image warning_image = new Image (
SparkleUIHelpers.GetIcon ("dialog-information", 24));
UserInterfaceHelpers.GetIcon ("dialog-information", 24));
Label warning_label = new Label () {
Xalign = 0,
@ -581,7 +581,7 @@ namespace SparkleShare {
if (warnings.Length > 0) {
Image warning_image = new Image (SparkleUIHelpers.GetIcon ("dialog-information", 24));
Image warning_image = new Image (UserInterfaceHelpers.GetIcon ("dialog-information", 24));
Label warning_label = new Label (warnings [0]) {
Xalign = 0,
@ -658,7 +658,7 @@ namespace SparkleShare {
HBox layout_horizontal = new HBox (false, 6);
Entry link_code_entry = new Entry () {
Text = Program.Controller.UserAuthenticationInfo.PublicKey,
Text = SparkleShare.Controller.UserAuthenticationInfo.PublicKey,
Sensitive = false
};
@ -690,7 +690,7 @@ namespace SparkleShare {
}
if (Controller.TutorialPageNumber < 4) {
Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-" + Controller.TutorialPageNumber + ".png");
Image slide = UserInterfaceHelpers.GetImage ("tutorial-slide-" + Controller.TutorialPageNumber + ".png");
Add (slide);
}
}
@ -704,9 +704,9 @@ namespace SparkleShare {
TreeSelection selection = (column.TreeView as TreeView).Selection;
if (selection.IterIsSelected (iter))
markup = markup.Replace (Program.UI.SecondaryTextColor, Program.UI.SecondaryTextColorSelected);
markup = markup.Replace (SparkleShare.UI.SecondaryTextColor, SparkleShare.UI.SecondaryTextColorSelected);
else
markup = markup.Replace (Program.UI.SecondaryTextColorSelected, Program.UI.SecondaryTextColor);
markup = markup.Replace (SparkleShare.UI.SecondaryTextColorSelected, SparkleShare.UI.SecondaryTextColor);
(cell as CellRendererText).Markup = markup;
}

View file

@ -62,7 +62,7 @@ namespace SparkleShare {
layout_vertical.PackStart (this.content_area, true, true, 0);
layout_vertical.PackStart (layout_actions, false, false, 15);
Image side_splash = SparkleUIHelpers.GetImage ("side-splash.png");
Image side_splash = UserInterfaceHelpers.GetImage ("side-splash.png");
side_splash.Yalign = 1;
layout_horizontal.PackStart (side_splash, false, false, 0);

View file

@ -17,8 +17,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using Gtk;
#if HAVE_APP_INDICATOR
using AppIndicator3;
#endif
@ -120,7 +122,7 @@ namespace SparkleShare {
this.state_item = new MenuItem (Controller.StateText) { Sensitive = false };
ImageMenuItem folder_item = new SparkleMenuItem ("SparkleShare");
folder_item.Image = new Image (SparkleUIHelpers.GetIcon ("org.sparkleshare.SparkleShare", 16));
folder_item.Image = new Image (UserInterfaceHelpers.GetIcon ("org.sparkleshare.SparkleShare", 16));
this.menu.Add (this.state_item);
this.menu.Add (new SeparatorMenuItem ());
@ -148,12 +150,10 @@ namespace SparkleShare {
MenuItem resume_item;
if (project.UnsyncedChangesInfo.Count > 0) {
string icons_path = new string [] {
SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status"}.Combine ();
string icons_path = Path.Combine (UserInterface.AssetsPath, "icons", "hicolor", "12x12", "status");
foreach (KeyValuePair<string, string> pair in project.UnsyncedChangesInfo) {
string icon_path = new string [] {
icons_path, pair.Value.Replace ("-12", "")}.Combine ();
string icon_path = Path.Combine (icons_path, pair.Value.Replace ("-12", ""));
(item.Submenu as Menu).Add (new SparkleMenuItem (pair.Key) {
Image = new Image (icon_path),
@ -208,16 +208,16 @@ namespace SparkleShare {
#if HAVE_APP_INDICATOR
MenuItem notify_item;
if (Program.Controller.NotificationsEnabled)
if (SparkleShare.Controller.NotificationsEnabled)
notify_item = new MenuItem ("Turn Notifications Off");
else
notify_item = new MenuItem ("Turn Notifications On");
notify_item.Activated += delegate {
Program.Controller.ToggleNotifications ();
SparkleShare.Controller.ToggleNotifications ();
Application.Invoke (delegate {
if (Program.Controller.NotificationsEnabled)
if (SparkleShare.Controller.NotificationsEnabled)
(notify_item.Child as Label).Text = "Turn Notifications Off";
else
(notify_item.Child as Label).Text = "Turn Notifications On";
@ -230,7 +230,7 @@ namespace SparkleShare {
if (Controller.LinkCodeItemEnabled) {
link_code_item.Submenu = new Menu ();
string link_code = Program.Controller.UserAuthenticationInfo.PublicKey.Substring (0, 20) + "...";
string link_code = SparkleShare.Controller.UserAuthenticationInfo.PublicKey.Substring (0, 20) + "...";
MenuItem code_item = new MenuItem (link_code) { Sensitive = false };
MenuItem copy_item = new MenuItem ("Copy to Clipboard");

View file

@ -26,7 +26,7 @@ namespace SparkleShare {
public class UserInterface {
public static string AssetsPath = Defines.INSTALL_DIR;
public static string AssetsPath = InstallationInfo.Directory;
public SparkleStatusIcon StatusIcon;
public SparkleEventLog EventLog;
@ -48,15 +48,15 @@ namespace SparkleShare {
application.Register (null);
application.Activated += ApplicationActivatedDelegate;
Gdk.Color color = SparkleUIHelpers.RGBAToColor (new Label().StyleContext.GetColor (StateFlags.Insensitive));
SecondaryTextColor = SparkleUIHelpers.ColorToHex (color);
Gdk.Color color = UserInterfaceHelpers.RGBAToColor (new Label().StyleContext.GetColor (StateFlags.Insensitive));
SecondaryTextColor = UserInterfaceHelpers.ColorToHex (color);
color = SparkleUIHelpers.MixColors (
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetColor (StateFlags.Selected)),
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected)),
color = UserInterfaceHelpers.MixColors (
UserInterfaceHelpers.RGBAToColor (new TreeView ().StyleContext.GetColor (StateFlags.Selected)),
UserInterfaceHelpers.RGBAToColor (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected)),
0.39);
SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex (color);
SecondaryTextColorSelected = UserInterfaceHelpers.ColorToHex (color);
}
@ -79,7 +79,7 @@ namespace SparkleShare {
}
if (!has_visible_windows)
Program.Controller.HandleReopen ();
SparkleShare.Controller.HandleReopen ();
} else {
Setup = new SparkleSetup ();
@ -93,7 +93,7 @@ namespace SparkleShare {
EventLog.Application = application;
About.Application = application;
Program.Controller.UIHasLoaded ();
SparkleShare.Controller.UIHasLoaded ();
}
}
}

View file

@ -16,16 +16,18 @@
using System;
using System.IO;
using Gtk;
namespace SparkleShare {
public static class SparkleUIHelpers {
public static class UserInterfaceHelpers {
public static Gdk.Pixbuf GetIcon (string name, int size)
{
IconTheme icon_theme = new IconTheme ();
icon_theme.AppendSearchPath (new string [] {SparkleUI.AssetsPath, "icons"}.Combine ());
icon_theme.AppendSearchPath (Path.Combine (UserInterface.AssetsPath, "icons"));
foreach (string search_path in IconTheme.Default.SearchPath)
icon_theme.AppendSearchPath (search_path);
@ -46,7 +48,7 @@ namespace SparkleShare {
public static Image GetImage (string name)
{
string image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", name }.Combine ();
string image_path = Path.Combine (UserInterface.AssetsPath, "pixmaps", name);
return new Image (image_path);
}

View file

@ -730,28 +730,28 @@ namespace SparkleShare {
int backing_scale_factor;
public SparkleDataSource (float backing_scale_factor, List<Preset> plugins)
public SparkleDataSource (float backing_scale_factor, List<Preset> presets)
{
Items = new List <object> ();
Cells = new NSAttributedString [plugins.Count];
SelectedCells = new NSAttributedString [plugins.Count];
Cells = new NSAttributedString [presets.Count];
SelectedCells = new NSAttributedString [presets.Count];
this.backing_scale_factor = (int) backing_scale_factor;
int i = 0;
foreach (Preset plugin in plugins) {
Items.Add (plugin);
foreach (Preset preset in presets) {
Items.Add (preset);
NSTextFieldCell cell = new NSTextFieldCell ();
NSData name_data = NSData.FromString ("<font face='" + UserInterface.FontName + "'><b>" + plugin.Name + "</b></font>");
NSData name_data = NSData.FromString ("<font face='" + UserInterface.FontName + "'><b>" + preset.Name + "</b></font>");
NSDictionary name_dictionary = new NSDictionary();
NSAttributedString name_attributes = new NSAttributedString (
name_data, new NSUrl ("file://"), out name_dictionary);
NSData description_data = NSData.FromString (
"<small><font style='line-height: 150%' color='#aaa' face='" + UserInterface.FontName + "'>" + plugin.Description + "</font></small>");
"<small><font style='line-height: 150%' color='#aaa' face='" + UserInterface.FontName + "'>" + preset.Description + "</font></small>");
NSDictionary description_dictionary = new NSDictionary();
NSAttributedString description_attributes = new NSAttributedString (
@ -767,7 +767,7 @@ namespace SparkleShare {
NSTextFieldCell selected_cell = new NSTextFieldCell ();
NSData selected_name_data = NSData.FromString (
"<font color='white' face='" + UserInterface.FontName +"'><b>" + plugin.Name + "</b></font>");
"<font color='white' face='" + UserInterface.FontName +"'><b>" + preset.Name + "</b></font>");
NSDictionary selected_name_dictionary = new NSDictionary ();
NSAttributedString selected_name_attributes = new NSAttributedString (
@ -775,7 +775,7 @@ namespace SparkleShare {
NSData selected_description_data = NSData.FromString (
"<small><font style='line-height: 150%' color='#9bbaeb' face='" + UserInterface.FontName + "'>" +
plugin.Description + "</font></small>");
preset.Description + "</font></small>");
NSDictionary selected_description_dictionary = new NSDictionary ();
NSAttributedString selected_description_attributes = new NSAttributedString (

View file

@ -179,7 +179,7 @@ namespace SparkleShare {
Content = text_block;
MouseUp += delegate {
Program.Controller.OpenWebsite (url);
SparkleShare.Controller.OpenWebsite (url);
};
}
}

View file

@ -27,10 +27,10 @@ namespace SparkleShare {
public SparkleBubbles ()
{
Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) {
if (!Program.Controller.NotificationsEnabled)
if (!SparkleShare.Controller.NotificationsEnabled)
return;
Program.UI.StatusIcon.ShowBalloon (title, subtext, image_path);
SparkleShare.UI.StatusIcon.ShowBalloon (title, subtext, image_path);
};
}
}

View file

@ -366,7 +366,7 @@ namespace SparkleShare {
public void LinkClicked (string url)
{
Program.UI.EventLog.Controller.LinkClicked (url);
SparkleShare.UI.EventLog.Controller.LinkClicked (url);
}
}
}

View file

@ -254,7 +254,7 @@ namespace SparkleShare
{
public void LinkClicked(string url)
{
Program.UI.EventLog.Controller.LinkClicked(url);
SparkleShare.UI.EventLog.Controller.LinkClicked(url);
}
}

View file

@ -93,8 +93,8 @@ namespace SparkleShare {
this.user_image.ImageSource = avatar;
this.Title = Controller.CurrentProject ?? "Add Note";
this.user_name_text_block.Text = Program.Controller.CurrentUser.Name;
this.user_email_text_field.Text = Program.Controller.CurrentUser.Email;
this.user_name_text_block.Text = SparkleShare.Controller.CurrentUser.Name;
this.user_email_text_field.Text = SparkleShare.Controller.CurrentUser.Email;
this.balloon_text_field.Text = default_text;
ElementHost.EnableModelessKeyboardInterop (this);

View file

@ -139,7 +139,7 @@ namespace SparkleShare {
cancel_button.Click += delegate {
Dispatcher.BeginInvoke ((Action) delegate {
Program.UI.StatusIcon.Dispose ();
SparkleShare.UI.StatusIcon.Dispose ();
Controller.SetupPageCancelled ();
});
};
@ -928,7 +928,7 @@ namespace SparkleShare {
TextBox link_code_text_box = new TextBox () {
Text = Program.Controller.CurrentUser.PublicKey,
Text = SparkleShare.Controller.CurrentUser.PublicKey,
Width = 250,
MaxLines = 1,
TextWrapping = TextWrapping.NoWrap,

View file

@ -142,7 +142,7 @@ namespace SparkleShare {
if(Controller.LinkCodeItemEnabled) {
SparkleMenuItem code_item = new SparkleMenuItem {
Header = Program.Controller.CurrentUser.PublicKey.Substring(0, 20) + "..."
Header = SparkleShare.Controller.CurrentUser.PublicKey.Substring(0, 20) + "..."
};
SparkleMenuItem copy_item = new SparkleMenuItem {
@ -159,7 +159,7 @@ namespace SparkleShare {
CheckBox notify_check_box = new CheckBox {
Margin = new Thickness(6, 0, 0, 0),
IsChecked = Program.Controller.NotificationsEnabled
IsChecked = SparkleShare.Controller.NotificationsEnabled
};
SparkleMenuItem notify_item = new SparkleMenuItem {
@ -187,13 +187,13 @@ namespace SparkleShare {
notify_check_box.Click += delegate {
this.context_menu.IsOpen = false;
Program.Controller.ToggleNotifications();
notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
SparkleShare.Controller.ToggleNotifications();
notify_check_box.IsChecked = SparkleShare.Controller.NotificationsEnabled;
};
notify_item.Click += delegate {
Program.Controller.ToggleNotifications();
notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
SparkleShare.Controller.ToggleNotifications();
notify_check_box.IsChecked = SparkleShare.Controller.NotificationsEnabled;
};
this.exit_item.Click += delegate {

View file

@ -51,7 +51,7 @@ namespace SparkleShare {
StatusIcon = new SparkleStatusIcon ();
Note = new SparkleNote ();
Program.Controller.UIHasLoaded ();
SparkleShare.Controller.UIHasLoaded ();
}

View file

@ -80,7 +80,7 @@ namespace Sparkles {
protected List<string> warnings = new List<string> ();
protected List<string> errors = new List<string> ();
protected string [] ExcludeRules = new string [] {
protected string [] ExcludeRules = {
"*.autosave", // Various autosaving apps
"*~", // gedit and emacs
".~lock.*", // LibreOffice

View file

@ -99,7 +99,7 @@ namespace Sparkles {
}
protected string LocateCommand (string name)
protected static string LocateCommand (string name)
{
string [] possible_command_paths = {
Environment.GetFolderPath (Environment.SpecialFolder.Personal) + "/bin/" + name,

View file

@ -24,17 +24,6 @@ namespace Sparkles {
public static class Extensions {
public static string Combine (this string [] parts)
{
string new_path = "";
foreach (string part in parts)
new_path = Path.Combine (new_path, part);
return new_path;
}
public static string SHA1 (this string s)
{
SHA1 sha1 = new SHA1CryptoServiceProvider ();

View file

@ -26,6 +26,9 @@ namespace Sparkles.Git {
public static string GitVersion {
get {
if (GitPath == null)
GitPath = LocateCommand ("git");
string git_version = new Command (GitPath, "--version").StartAndReadStandardOutput ();
return git_version.Replace ("git version ", "");
}

View file

@ -243,7 +243,7 @@ namespace Sparkles.Git {
void InstallConfiguration ()
{
string [] settings = new string [] {
string [] settings = {
"core.autocrlf input",
"core.quotepath false", // Don't quote "unusual" characters in path names
"core.ignorecase false", // Be case sensitive explicitly to work on Mac
@ -272,13 +272,13 @@ namespace Sparkles.Git {
// Add a .gitignore file to the repo
void InstallExcludeRules ()
{
string git_info_path = new string [] { TargetFolder, ".git", "info" }.Combine ();
string git_info_path = Path.Combine (TargetFolder, ".git", "info");
if (!Directory.Exists (git_info_path))
Directory.CreateDirectory (git_info_path);
string exclude_rules = string.Join (Environment.NewLine, ExcludeRules);
string exclude_rules_file_path = new string [] { git_info_path, "exclude" }.Combine ();
string exclude_rules_file_path = Path.Combine (git_info_path, "exclude");
File.WriteAllText (exclude_rules_file_path, exclude_rules);
}
@ -286,12 +286,12 @@ namespace Sparkles.Git {
void InstallAttributeRules ()
{
string attribute_rules_file_path = new string [] { TargetFolder, ".git", "info", "attributes" }.Combine ();
string attribute_rules_file_path = Path.Combine (TargetFolder, ".git", "info", "attributes");
TextWriter writer = new StreamWriter (attribute_rules_file_path);
// Compile a list of files we don't want Git to compress.
// Not compressing already compressed files decreases memory usage and increases speed
string [] extensions = new string [] {
string [] extensions = {
"jpg", "jpeg", "png", "tiff", "gif", // Images
"flac", "mp3", "ogg", "oga", // Audio
"avi", "mov", "mpg", "mpeg", "mkv", "ogv", "ogx", "webm", // Video
@ -326,11 +326,11 @@ namespace Sparkles.Git {
git_config_clean.StartAndWaitForExit ();
// Pass all files through the encryption filter
string git_attributes_file_path = new string [] { TargetFolder, ".git", "info", "attributes" }.Combine ();
string git_attributes_file_path = Path.Combine (TargetFolder, ".git", "info", "attributes");
File.WriteAllText (git_attributes_file_path, "* filter=encryption");
// Store the password
string password_file_path = new string [] { TargetFolder, ".git", "info", "encryption_password" }.Combine ();
string password_file_path = Path.Combine (TargetFolder, ".git", "info", "encryption_password");
File.WriteAllText (password_file_path, password.SHA256 (this.password_salt));
}

View file

@ -78,7 +78,7 @@ namespace Sparkles.Git {
private bool in_merge {
get {
string merge_file_path = new string [] { LocalPath, ".git", "MERGE_HEAD" }.Combine ();
string merge_file_path = Path.Combine (LocalPath, ".git", "MERGE_HEAD");
return File.Exists (merge_file_path);
}
}
@ -111,7 +111,7 @@ namespace Sparkles.Git {
public override double Size {
get {
string file_path = new string [] { LocalPath, ".git", "info", "size" }.Combine ();
string file_path = Path.Combine (LocalPath, ".git", "info", "size");
try {
string size = File.ReadAllText (file_path);
@ -126,7 +126,7 @@ namespace Sparkles.Git {
public override double HistorySize {
get {
string file_path = new string [] { LocalPath, ".git", "info", "history_size" }.Combine ();
string file_path = Path.Combine (LocalPath, ".git", "info", "history_size");
try {
string size = File.ReadAllText (file_path);
@ -144,8 +144,8 @@ namespace Sparkles.Git {
double size = CalculateSizes (new DirectoryInfo (LocalPath));
double history_size = CalculateSizes (new DirectoryInfo (Path.Combine (LocalPath, ".git")));
string size_file_path = new string [] { LocalPath, ".git", "info", "size" }.Combine ();
string history_size_file_path = new string [] { LocalPath, ".git", "info", "history_size" }.Combine ();
string size_file_path = Path.Combine (LocalPath, ".git", "info", "size");
string history_size_file_path = Path.Combine (LocalPath, ".git", "info", "history_size");
File.WriteAllText (size_file_path, size.ToString ());
File.WriteAllText (history_size_file_path, history_size.ToString ());
@ -377,12 +377,12 @@ namespace Sparkles.Git {
public override bool HasUnsyncedChanges {
get {
string unsynced_file_path = new string [] { LocalPath, ".git", "has_unsynced_changes" }.Combine ();
string unsynced_file_path = Path.Combine (LocalPath, ".git", "has_unsynced_changes");
return File.Exists (unsynced_file_path);
}
set {
string unsynced_file_path = new string [] { LocalPath, ".git", "has_unsynced_changes" }.Combine ();
string unsynced_file_path = Path.Combine (LocalPath, ".git", "has_unsynced_changes");
if (value)
File.WriteAllText (unsynced_file_path, "");
@ -1110,7 +1110,7 @@ namespace Sparkles.Git {
// Recursively gets a folder's size in bytes
private long CalculateSizes (DirectoryInfo parent)
long CalculateSizes (DirectoryInfo parent)
{
long size = 0;
@ -1149,7 +1149,7 @@ namespace Sparkles.Git {
}
private bool IsSymlink (string file)
bool IsSymlink (string file)
{
FileAttributes attributes = File.GetAttributes (file);
return ((attributes & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint);

View file

@ -68,7 +68,7 @@ namespace Sparkles {
if (InstallationInfo.Platform == PlatformID.Win32NT)
home_path = Environment.GetFolderPath (Environment.SpecialFolder.UserProfile);
string crash_report_file_path = new string [] { home_path, "SparkleShare", "crash_report.txt" }.Combine ();
string crash_report_file_path = Path.Combine (home_path, "SparkleShare", "crash_report.txt");
string n = Environment.NewLine;
string crash_report =

View file

@ -15,7 +15,7 @@ LINK_WEBKIT = $(WEBKITGTK_SHARP_LIBS)
LINK_APP_INDICATOR = $(APP_INDICATOR_LIBS)
REF_SPARKLES = $(LINK_SYSTEM) $(LINK_MONO_POSIX)
LINK_SPARKLES = -r:$(DIR_BIN)/Sparkles.dll
LINK_SPARKLES = -r:$(DIR_BIN)/Sparkles.dll -r:$(DIR_BIN)/Sparkles.Git.dll
LINK_SPARKLES_DEPS = $(REF_SPARKLES) $(LINK_SPARKLES)
REF_SPARKLESHARE = $(LINK_GTK) $(LINK_SPARKLES_DEPS) $(LINK_APP_INDICATOR) $(LINK_WEBKIT)