linux: Fix build
This commit is contained in:
parent
1423c2d4ca
commit
996f2b2ce7
|
@ -43,8 +43,7 @@ namespace SparkleShare
|
||||||
if (skipped_avatars.Contains (email))
|
if (skipped_avatars.Contains (email))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
string avatars_path = new string [] { Path.GetDirectoryName (target_path),
|
string avatars_path = Path.Combine (Path.GetDirectoryName (target_path), "avatars", size + "x" + size);
|
||||||
"avatars", size + "x" + size }.Combine ();
|
|
||||||
|
|
||||||
// Search avatars by file name, ignore extension
|
// Search avatars by file name, ignore extension
|
||||||
// Delete files over a day old
|
// Delete files over a day old
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void AddRepository (BaseRepository repo)
|
void AddRepository (BaseRepository repo)
|
||||||
{
|
{
|
||||||
lock (this.repo_lock) {
|
lock (this.repo_lock) {
|
||||||
this.repositories.Add (repo);
|
this.repositories.Add (repo);
|
||||||
|
@ -45,7 +45,7 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void RemoveRepository (BaseRepository repo)
|
void RemoveRepository (BaseRepository repo)
|
||||||
{
|
{
|
||||||
lock (this.repo_lock)
|
lock (this.repo_lock)
|
||||||
this.repositories.Remove (repo);
|
this.repositories.Remove (repo);
|
||||||
|
@ -186,12 +186,12 @@ namespace SparkleShare {
|
||||||
public abstract string EventEntryHTML { get; }
|
public abstract string EventEntryHTML { get; }
|
||||||
|
|
||||||
|
|
||||||
private BaseFetcher fetcher;
|
BaseFetcher fetcher;
|
||||||
private FileSystemWatcher watcher;
|
FileSystemWatcher watcher;
|
||||||
private Object repo_lock = new Object ();
|
object repo_lock = new object ();
|
||||||
private Object check_repos_lock = new Object ();
|
object check_repos_lock = new object ();
|
||||||
private List<BaseRepository> repositories = new List<BaseRepository> ();
|
List<BaseRepository> repositories = new List<BaseRepository> ();
|
||||||
private bool lost_folders_path = false;
|
bool lost_folders_path = false;
|
||||||
|
|
||||||
|
|
||||||
public BaseController ()
|
public BaseController ()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
dist_plugins_DATA = \
|
dist_presets_DATA = \
|
||||||
bitbucket.xml \
|
bitbucket.xml \
|
||||||
github.xml \
|
github.xml \
|
||||||
own-server.xml \
|
own-server.xml \
|
||||||
|
@ -8,7 +8,7 @@ dist_plugins_DATA = \
|
||||||
planio.png \
|
planio.png \
|
||||||
own-server.png
|
own-server.png
|
||||||
|
|
||||||
pluginsdir = $(pkgdatadir)/presets/
|
presetsdir = $(pkgdatadir)/presets/
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = \
|
MAINTAINERCLEANFILES = \
|
||||||
Makefile.in
|
Makefile.in
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<sparkleshare>
|
<sparkleshare>
|
||||||
<plugin>
|
<preset>
|
||||||
<info>
|
<info>
|
||||||
<name>Bitbucket</name>
|
<name>Bitbucket</name>
|
||||||
<description>Free code hosting for Git and Mercurial</description>
|
<description>Free code hosting for Git and Mercurial</description>
|
||||||
|
@ -17,5 +17,5 @@
|
||||||
<example>/username/project</example>
|
<example>/username/project</example>
|
||||||
<uses_lower_case>True</uses_lower_case>
|
<uses_lower_case>True</uses_lower_case>
|
||||||
</path>
|
</path>
|
||||||
</plugin>
|
</preset>
|
||||||
</sparkleshare>
|
</sparkleshare>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<sparkleshare>
|
<sparkleshare>
|
||||||
<plugin>
|
<preset>
|
||||||
<info>
|
<info>
|
||||||
<name>GitHub</name>
|
<name>GitHub</name>
|
||||||
<description>Collaborate on projects hosted on GitHub</description>
|
<description>Collaborate on projects hosted on GitHub</description>
|
||||||
|
@ -16,5 +16,5 @@
|
||||||
<value/>
|
<value/>
|
||||||
<example>/username/project</example>
|
<example>/username/project</example>
|
||||||
</path>
|
</path>
|
||||||
</plugin>
|
</preset>
|
||||||
</sparkleshare>
|
</sparkleshare>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<sparkleshare>
|
<sparkleshare>
|
||||||
<plugin>
|
<preset>
|
||||||
<info>
|
<info>
|
||||||
<name>On my own server</name>
|
<name>On my own server</name>
|
||||||
<description>Everything under my control</description>
|
<description>Everything under my control</description>
|
||||||
|
@ -15,5 +15,5 @@
|
||||||
<value/>
|
<value/>
|
||||||
<example>/path/to/project</example>
|
<example>/path/to/project</example>
|
||||||
</path>
|
</path>
|
||||||
</plugin>
|
</preset>
|
||||||
</sparkleshare>
|
</sparkleshare>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<sparkleshare>
|
<sparkleshare>
|
||||||
<plugin>
|
<preset>
|
||||||
<info>
|
<info>
|
||||||
<name>Planio</name>
|
<name>Planio</name>
|
||||||
<description>500MB of unlimited free hosted Git repos and project management</description>
|
<description>500MB of unlimited free hosted Git repos and project management</description>
|
||||||
|
@ -17,5 +17,5 @@
|
||||||
<value/>
|
<value/>
|
||||||
<example>/[account]-[project].git</example>
|
<example>/[account]-[project].git</example>
|
||||||
</path>
|
</path>
|
||||||
</plugin>
|
</preset>
|
||||||
</sparkleshare>
|
</sparkleshare>
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace SparkleShare {
|
||||||
private void CreateAbout ()
|
private void CreateAbout ()
|
||||||
{
|
{
|
||||||
CssProvider window_css_provider = new CssProvider ();
|
CssProvider window_css_provider = new CssProvider ();
|
||||||
Image image = SparkleUIHelpers.GetImage("about.png");
|
Image image = UserInterfaceHelpers.GetImage("about.png");
|
||||||
|
|
||||||
window_css_provider.LoadFromData ("GtkWindow {" +
|
window_css_provider.LoadFromData ("GtkWindow {" +
|
||||||
"background-image: url('" + image.File + "');" +
|
"background-image: url('" + image.File + "');" +
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
private void ShowBubbleEvent (string title, string subtext, string image_path)
|
private void ShowBubbleEvent (string title, string subtext, string image_path)
|
||||||
{
|
{
|
||||||
if (!Program.Controller.NotificationsEnabled)
|
if (!SparkleShare.Controller.NotificationsEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
|
@ -57,7 +57,7 @@ namespace SparkleShare {
|
||||||
notification.Show ();
|
notification.Show ();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SparkleLogger.LogInfo ("Notification", "Error showing notification: ", e);
|
Logger.LogInfo ("Notification", "Error showing notification: ", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,16 +26,16 @@ using Sparkles;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleController : ControllerBase {
|
public class Controller : BaseController {
|
||||||
|
|
||||||
public SparkleController ()
|
public Controller ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override string PresetsPath {
|
public override string PresetsPath {
|
||||||
get {
|
get {
|
||||||
return Path.Combine (Defines.INSTALL_DIR, "plugins");
|
return Path.Combine (InstallationInfo.Directory, "presets");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
string autostart_exec = "sparkleshare";
|
string autostart_exec = "sparkleshare";
|
||||||
|
|
||||||
if (Defines.INSTALL_DIR.StartsWith ("/app/"))
|
if (InstallationInfo.Directory.StartsWith ("/app/"))
|
||||||
autostart_exec = "xdg-app run org.sparkleshare.SparkleShare";
|
autostart_exec = "xdg-app run org.sparkleshare.SparkleShare";
|
||||||
|
|
||||||
// TODO: Ship as .desktop file and copy in place
|
// TODO: Ship as .desktop file and copy in place
|
||||||
|
@ -69,10 +69,10 @@ namespace SparkleShare {
|
||||||
"Terminal=false\n" +
|
"Terminal=false\n" +
|
||||||
"X-GNOME-Autostart-enabled=true\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) {
|
} 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
|
// Creates the SparkleShare folder in the user's home folder
|
||||||
public override bool CreateSparkleShareFolder ()
|
public override bool CreateSparkleShareFolder ()
|
||||||
{
|
{
|
||||||
if (!Directory.Exists (SparkleConfig.DefaultConfig.FoldersPath)) {
|
if (!Directory.Exists (Configuration.DefaultConfig.FoldersPath)) {
|
||||||
Directory.CreateDirectory (SparkleConfig.DefaultConfig.FoldersPath);
|
Directory.CreateDirectory (Configuration.DefaultConfig.FoldersPath);
|
||||||
Syscall.chmod (SparkleConfig.DefaultConfig.FoldersPath, (FilePermissions) 448); // 448 -> 700
|
Syscall.chmod (Configuration.DefaultConfig.FoldersPath, (FilePermissions) 448); // 448 -> 700
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -93,8 +93,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public override string EventLogHTML {
|
public override string EventLogHTML {
|
||||||
get {
|
get {
|
||||||
string html_path = new string [] { Defines.INSTALL_DIR, "html", "event-log.html" }.Combine ();
|
string html_path = Path.Combine (InstallationInfo.Directory, "html", "event-log.html");
|
||||||
string jquery_file_path = new string [] { Defines.INSTALL_DIR, "html", "jquery.js" }.Combine ();
|
string jquery_file_path = Path.Combine (InstallationInfo.Directory, "html", "jquery.js");
|
||||||
|
|
||||||
string html = File.ReadAllText (html_path);
|
string html = File.ReadAllText (html_path);
|
||||||
string jquery = File.ReadAllText (jquery_file_path);
|
string jquery = File.ReadAllText (jquery_file_path);
|
||||||
|
@ -106,7 +106,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public override string DayEntryHTML {
|
public override string DayEntryHTML {
|
||||||
get {
|
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);
|
return File.ReadAllText (path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public override string EventEntryHTML {
|
public override string EventEntryHTML {
|
||||||
get {
|
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);
|
return File.ReadAllText (path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public override void SetFolderIcon ()
|
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");
|
"metadata::custom-icon-name org.sparkleshare.SparkleShare");
|
||||||
|
|
||||||
process.StartAndWaitForExit ();
|
process.StartAndWaitForExit ();
|
||||||
|
@ -144,7 +144,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public override void OpenFile (string path)
|
public override void OpenFile (string path)
|
||||||
{
|
{
|
||||||
new SparkleProcess ("xdg-open", "\"" + path + "\"").Start ();
|
new Command ("xdg-open", "\"" + path + "\"").Start ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using IO = System.IO;
|
||||||
|
|
||||||
using Gtk;
|
using Gtk;
|
||||||
// using WebKit;
|
// using WebKit;
|
||||||
|
@ -240,34 +241,34 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void UpdateContent (string html)
|
public void UpdateContent (string html)
|
||||||
{
|
{
|
||||||
string pixmaps_path = new string [] {SparkleUI.AssetsPath, "pixmaps"}.Combine ();
|
string pixmaps_path = IO.Path.Combine (UserInterface.AssetsPath, "pixmaps");
|
||||||
string icons_path = new string [] {SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status"}.Combine ();
|
string icons_path = IO.Path.Combine (UserInterface.AssetsPath, "icons", "hicolor", "12x12", "status");
|
||||||
|
|
||||||
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
|
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
|
||||||
html = html.Replace ("<!-- $a-color -->", "#0085cf");
|
html = html.Replace ("<!-- $a-color -->", "#0085cf");
|
||||||
|
|
||||||
html = html.Replace ("<!-- $body-font-family -->", StyleContext.GetFont (StateFlags.Normal).Family);
|
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-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
|
// TODO
|
||||||
// html = html.Replace ("<!-- $body-background-color -->",
|
// 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-font-size -->", (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px");
|
||||||
html = html.Replace ("<!-- $day-entry-header-background-color -->",
|
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 ("<!-- $small-font-size -->", "90%");
|
||||||
|
|
||||||
html = html.Replace ("<!-- $pixmaps-path -->", pixmaps_path);
|
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-added-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-added.png"));
|
||||||
html = html.Replace ("<!-- $document-edited-background-image -->", "file://" + new string [] {icons_path, "document-edited.png"}.Combine ());
|
html = html.Replace ("<!-- $document-edited-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-edited.png"));
|
||||||
html = html.Replace ("<!-- $document-deleted-background-image -->", "file://" + new string [] {icons_path, "document-deleted.png"}.Combine ());
|
html = html.Replace ("<!-- $document-deleted-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-deleted.png"));
|
||||||
html = html.Replace ("<!-- $document-moved-background-image -->", "file://" + new string [] {icons_path, "document-moved.png"}.Combine ());
|
html = html.Replace ("<!-- $document-moved-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-moved.png"));
|
||||||
|
|
||||||
this.spinner.Stop ();
|
this.spinner.Stop ();
|
||||||
// this.scrolled_window.Remove (this.web_view);
|
// this.scrolled_window.Remove (this.web_view);
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace SparkleShare {
|
||||||
Image user_image = new Image (Controller.AvatarFilePath);
|
Image user_image = new Image (Controller.AvatarFilePath);
|
||||||
|
|
||||||
/* TODO: Style the entry neatly, multiple lines, and add placeholder text
|
/* 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);
|
Image balloon_image = new Image (balloon_image_path);
|
||||||
CssProvider balloon_css_provider = new CssProvider ();
|
CssProvider balloon_css_provider = new CssProvider ();
|
||||||
|
|
||||||
|
@ -113,8 +113,8 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
Label user_label = new Label () {
|
Label user_label = new Label () {
|
||||||
Markup = "<b>" + Program.Controller.CurrentUser.Name + "</b>\n" +
|
Markup = "<b>" + SparkleShare.Controller.CurrentUser.Name + "</b>\n" +
|
||||||
"<span fgcolor=\"" + Program.UI.SecondaryTextColor + "\">" + Program.Controller.CurrentUser.Email +
|
"<span fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + SparkleShare.Controller.CurrentUser.Email +
|
||||||
"</span>"
|
"</span>"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ namespace SparkleShare {
|
||||||
VBox layout_address = new VBox (true, 0);
|
VBox layout_address = new VBox (true, 0);
|
||||||
VBox layout_path = 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 };
|
SparkleTreeView tree_view = new SparkleTreeView (store) { HeadersVisible = false };
|
||||||
ScrolledWindow scrolled_window = new ScrolledWindow () { ShadowType = ShadowType.In };
|
ScrolledWindow scrolled_window = new ScrolledWindow () { ShadowType = ShadowType.In };
|
||||||
|
@ -157,11 +157,11 @@ namespace SparkleShare {
|
||||||
service_column.PackStart (service_cell, true);
|
service_column.PackStart (service_cell, true);
|
||||||
service_column.SetCellDataFunc (service_cell, new TreeCellDataFunc (RenderServiceColumn));
|
service_column.SetCellDataFunc (service_cell, new TreeCellDataFunc (RenderServiceColumn));
|
||||||
|
|
||||||
foreach (SparklePreset plugin in Controller.Presets) {
|
foreach (Preset preset in Controller.Presets) {
|
||||||
store.AppendValues ("", new Gdk.Pixbuf (plugin.ImagePath),
|
store.AppendValues ("", new Gdk.Pixbuf (preset.ImagePath),
|
||||||
"<span size=\"small\"><b>" + plugin.Name + "</b>\n" +
|
"<span size=\"small\"><b>" + preset.Name + "</b>\n" +
|
||||||
"<span fgcolor=\"" + Program.UI.SecondaryTextColor + "\">" + plugin.Description + "</span>" +
|
"<span fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + preset.Description + "</span>" +
|
||||||
"</span>", plugin);
|
"</span>", preset);
|
||||||
}
|
}
|
||||||
|
|
||||||
tree_view.AppendColumn (service_column);
|
tree_view.AppendColumn (service_column);
|
||||||
|
@ -183,14 +183,14 @@ namespace SparkleShare {
|
||||||
Xalign = 0,
|
Xalign = 0,
|
||||||
UseMarkup = true,
|
UseMarkup = true,
|
||||||
Markup = "<span size=\"small\" fgcolor=\"" +
|
Markup = "<span size=\"small\" fgcolor=\"" +
|
||||||
Program.UI.SecondaryTextColor + "\">" + Controller.SelectedPreset.AddressExample + "</span>"
|
SparkleShare.UI.SecondaryTextColor + "\">" + Controller.SelectedPreset.AddressExample + "</span>"
|
||||||
};
|
};
|
||||||
|
|
||||||
Label path_example = new Label () {
|
Label path_example = new Label () {
|
||||||
Xalign = 0,
|
Xalign = 0,
|
||||||
UseMarkup = true,
|
UseMarkup = true,
|
||||||
Markup = "<span size=\"small\" fgcolor=\"" +
|
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;
|
string address;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
address = (model.GetValue (iter, 2) as SparklePreset).Address;
|
address = (model.GetValue (iter, 2) as Preset).Address;
|
||||||
|
|
||||||
} catch (NullReferenceException) {
|
} catch (NullReferenceException) {
|
||||||
address = "";
|
address = "";
|
||||||
|
@ -213,12 +213,12 @@ namespace SparkleShare {
|
||||||
address.Equals (Controller.PreviousAddress)) {
|
address.Equals (Controller.PreviousAddress)) {
|
||||||
|
|
||||||
tree_view.SetCursor (path, service_column, false);
|
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;
|
address_entry.Sensitive = false;
|
||||||
|
|
||||||
if (plugin.Path != null)
|
if (preset.Path != null)
|
||||||
path_entry.Sensitive = false;
|
path_entry.Sensitive = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -280,7 +280,7 @@ namespace SparkleShare {
|
||||||
address_entry.Text = text;
|
address_entry.Text = text;
|
||||||
address_entry.Sensitive = (state == FieldState.Enabled);
|
address_entry.Sensitive = (state == FieldState.Enabled);
|
||||||
address_example.Markup = "<span size=\"small\" fgcolor=\"" +
|
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.Text = text;
|
||||||
path_entry.Sensitive = (state == FieldState.Enabled);
|
path_entry.Sensitive = (state == FieldState.Enabled);
|
||||||
path_example.Markup = "<span size=\"small\" fgcolor=\""
|
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" + "…";
|
Header = "Oops! Something went wrong" + "…";
|
||||||
|
|
||||||
VBox points = new VBox (false, 0);
|
VBox points = new VBox (false, 0);
|
||||||
Image list_point_one = new Image (SparkleUIHelpers.GetIcon ("list-point", 16));
|
Image list_point_one = new Image (UserInterfaceHelpers.GetIcon ("list-point", 16));
|
||||||
Image list_point_two = new Image (SparkleUIHelpers.GetIcon ("list-point", 16));
|
Image list_point_two = new Image (UserInterfaceHelpers.GetIcon ("list-point", 16));
|
||||||
Image list_point_three = new Image (SparkleUIHelpers.GetIcon ("list-point", 16));
|
Image list_point_three = new Image (UserInterfaceHelpers.GetIcon ("list-point", 16));
|
||||||
|
|
||||||
Label label_one = new Label () {
|
Label label_one = new Label () {
|
||||||
Markup = "<b>" + Controller.PreviousUrl + "</b> is the address we’ve compiled. " +
|
Markup = "<b>" + Controller.PreviousUrl + "</b> is the address we’ve compiled. " +
|
||||||
|
@ -507,7 +507,7 @@ namespace SparkleShare {
|
||||||
wrapper.PackStart (table, true, false, 0);
|
wrapper.PackStart (table, true, false, 0);
|
||||||
|
|
||||||
Image warning_image = new Image (
|
Image warning_image = new Image (
|
||||||
SparkleUIHelpers.GetIcon ("dialog-information", 24));
|
UserInterfaceHelpers.GetIcon ("dialog-information", 24));
|
||||||
|
|
||||||
Label warning_label = new Label () {
|
Label warning_label = new Label () {
|
||||||
Xalign = 0,
|
Xalign = 0,
|
||||||
|
@ -581,7 +581,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
|
|
||||||
if (warnings.Length > 0) {
|
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]) {
|
Label warning_label = new Label (warnings [0]) {
|
||||||
Xalign = 0,
|
Xalign = 0,
|
||||||
|
@ -658,7 +658,7 @@ namespace SparkleShare {
|
||||||
HBox layout_horizontal = new HBox (false, 6);
|
HBox layout_horizontal = new HBox (false, 6);
|
||||||
|
|
||||||
Entry link_code_entry = new Entry () {
|
Entry link_code_entry = new Entry () {
|
||||||
Text = Program.Controller.UserAuthenticationInfo.PublicKey,
|
Text = SparkleShare.Controller.UserAuthenticationInfo.PublicKey,
|
||||||
Sensitive = false
|
Sensitive = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -690,7 +690,7 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Controller.TutorialPageNumber < 4) {
|
if (Controller.TutorialPageNumber < 4) {
|
||||||
Image slide = SparkleUIHelpers.GetImage ("tutorial-slide-" + Controller.TutorialPageNumber + ".png");
|
Image slide = UserInterfaceHelpers.GetImage ("tutorial-slide-" + Controller.TutorialPageNumber + ".png");
|
||||||
Add (slide);
|
Add (slide);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -704,9 +704,9 @@ namespace SparkleShare {
|
||||||
TreeSelection selection = (column.TreeView as TreeView).Selection;
|
TreeSelection selection = (column.TreeView as TreeView).Selection;
|
||||||
|
|
||||||
if (selection.IterIsSelected (iter))
|
if (selection.IterIsSelected (iter))
|
||||||
markup = markup.Replace (Program.UI.SecondaryTextColor, Program.UI.SecondaryTextColorSelected);
|
markup = markup.Replace (SparkleShare.UI.SecondaryTextColor, SparkleShare.UI.SecondaryTextColorSelected);
|
||||||
else
|
else
|
||||||
markup = markup.Replace (Program.UI.SecondaryTextColorSelected, Program.UI.SecondaryTextColor);
|
markup = markup.Replace (SparkleShare.UI.SecondaryTextColorSelected, SparkleShare.UI.SecondaryTextColor);
|
||||||
|
|
||||||
(cell as CellRendererText).Markup = markup;
|
(cell as CellRendererText).Markup = markup;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace SparkleShare {
|
||||||
layout_vertical.PackStart (this.content_area, true, true, 0);
|
layout_vertical.PackStart (this.content_area, true, true, 0);
|
||||||
layout_vertical.PackStart (layout_actions, false, false, 15);
|
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;
|
side_splash.Yalign = 1;
|
||||||
|
|
||||||
layout_horizontal.PackStart (side_splash, false, false, 0);
|
layout_horizontal.PackStart (side_splash, false, false, 0);
|
||||||
|
|
|
@ -17,8 +17,10 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
using Gtk;
|
using Gtk;
|
||||||
|
|
||||||
#if HAVE_APP_INDICATOR
|
#if HAVE_APP_INDICATOR
|
||||||
using AppIndicator3;
|
using AppIndicator3;
|
||||||
#endif
|
#endif
|
||||||
|
@ -120,7 +122,7 @@ namespace SparkleShare {
|
||||||
this.state_item = new MenuItem (Controller.StateText) { Sensitive = false };
|
this.state_item = new MenuItem (Controller.StateText) { Sensitive = false };
|
||||||
|
|
||||||
ImageMenuItem folder_item = new SparkleMenuItem ("SparkleShare");
|
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 (this.state_item);
|
||||||
this.menu.Add (new SeparatorMenuItem ());
|
this.menu.Add (new SeparatorMenuItem ());
|
||||||
|
@ -148,12 +150,10 @@ namespace SparkleShare {
|
||||||
MenuItem resume_item;
|
MenuItem resume_item;
|
||||||
|
|
||||||
if (project.UnsyncedChangesInfo.Count > 0) {
|
if (project.UnsyncedChangesInfo.Count > 0) {
|
||||||
string icons_path = new string [] {
|
string icons_path = Path.Combine (UserInterface.AssetsPath, "icons", "hicolor", "12x12", "status");
|
||||||
SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status"}.Combine ();
|
|
||||||
|
|
||||||
foreach (KeyValuePair<string, string> pair in project.UnsyncedChangesInfo) {
|
foreach (KeyValuePair<string, string> pair in project.UnsyncedChangesInfo) {
|
||||||
string icon_path = new string [] {
|
string icon_path = Path.Combine (icons_path, pair.Value.Replace ("-12", ""));
|
||||||
icons_path, pair.Value.Replace ("-12", "")}.Combine ();
|
|
||||||
|
|
||||||
(item.Submenu as Menu).Add (new SparkleMenuItem (pair.Key) {
|
(item.Submenu as Menu).Add (new SparkleMenuItem (pair.Key) {
|
||||||
Image = new Image (icon_path),
|
Image = new Image (icon_path),
|
||||||
|
@ -208,16 +208,16 @@ namespace SparkleShare {
|
||||||
#if HAVE_APP_INDICATOR
|
#if HAVE_APP_INDICATOR
|
||||||
MenuItem notify_item;
|
MenuItem notify_item;
|
||||||
|
|
||||||
if (Program.Controller.NotificationsEnabled)
|
if (SparkleShare.Controller.NotificationsEnabled)
|
||||||
notify_item = new MenuItem ("Turn Notifications Off");
|
notify_item = new MenuItem ("Turn Notifications Off");
|
||||||
else
|
else
|
||||||
notify_item = new MenuItem ("Turn Notifications On");
|
notify_item = new MenuItem ("Turn Notifications On");
|
||||||
|
|
||||||
notify_item.Activated += delegate {
|
notify_item.Activated += delegate {
|
||||||
Program.Controller.ToggleNotifications ();
|
SparkleShare.Controller.ToggleNotifications ();
|
||||||
|
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
if (Program.Controller.NotificationsEnabled)
|
if (SparkleShare.Controller.NotificationsEnabled)
|
||||||
(notify_item.Child as Label).Text = "Turn Notifications Off";
|
(notify_item.Child as Label).Text = "Turn Notifications Off";
|
||||||
else
|
else
|
||||||
(notify_item.Child as Label).Text = "Turn Notifications On";
|
(notify_item.Child as Label).Text = "Turn Notifications On";
|
||||||
|
@ -230,7 +230,7 @@ namespace SparkleShare {
|
||||||
if (Controller.LinkCodeItemEnabled) {
|
if (Controller.LinkCodeItemEnabled) {
|
||||||
link_code_item.Submenu = new Menu ();
|
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 code_item = new MenuItem (link_code) { Sensitive = false };
|
||||||
|
|
||||||
MenuItem copy_item = new MenuItem ("Copy to Clipboard");
|
MenuItem copy_item = new MenuItem ("Copy to Clipboard");
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public class UserInterface {
|
public class UserInterface {
|
||||||
|
|
||||||
public static string AssetsPath = Defines.INSTALL_DIR;
|
public static string AssetsPath = InstallationInfo.Directory;
|
||||||
|
|
||||||
public SparkleStatusIcon StatusIcon;
|
public SparkleStatusIcon StatusIcon;
|
||||||
public SparkleEventLog EventLog;
|
public SparkleEventLog EventLog;
|
||||||
|
@ -48,15 +48,15 @@ namespace SparkleShare {
|
||||||
application.Register (null);
|
application.Register (null);
|
||||||
application.Activated += ApplicationActivatedDelegate;
|
application.Activated += ApplicationActivatedDelegate;
|
||||||
|
|
||||||
Gdk.Color color = SparkleUIHelpers.RGBAToColor (new Label().StyleContext.GetColor (StateFlags.Insensitive));
|
Gdk.Color color = UserInterfaceHelpers.RGBAToColor (new Label().StyleContext.GetColor (StateFlags.Insensitive));
|
||||||
SecondaryTextColor = SparkleUIHelpers.ColorToHex (color);
|
SecondaryTextColor = UserInterfaceHelpers.ColorToHex (color);
|
||||||
|
|
||||||
color = SparkleUIHelpers.MixColors (
|
color = UserInterfaceHelpers.MixColors (
|
||||||
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetColor (StateFlags.Selected)),
|
UserInterfaceHelpers.RGBAToColor (new TreeView ().StyleContext.GetColor (StateFlags.Selected)),
|
||||||
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected)),
|
UserInterfaceHelpers.RGBAToColor (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected)),
|
||||||
0.39);
|
0.39);
|
||||||
|
|
||||||
SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex (color);
|
SecondaryTextColorSelected = UserInterfaceHelpers.ColorToHex (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!has_visible_windows)
|
if (!has_visible_windows)
|
||||||
Program.Controller.HandleReopen ();
|
SparkleShare.Controller.HandleReopen ();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Setup = new SparkleSetup ();
|
Setup = new SparkleSetup ();
|
||||||
|
@ -93,7 +93,7 @@ namespace SparkleShare {
|
||||||
EventLog.Application = application;
|
EventLog.Application = application;
|
||||||
About.Application = application;
|
About.Application = application;
|
||||||
|
|
||||||
Program.Controller.UIHasLoaded ();
|
SparkleShare.Controller.UIHasLoaded ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,16 +16,18 @@
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
using Gtk;
|
using Gtk;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
public static class SparkleUIHelpers {
|
public static class UserInterfaceHelpers {
|
||||||
|
|
||||||
public static Gdk.Pixbuf GetIcon (string name, int size)
|
public static Gdk.Pixbuf GetIcon (string name, int size)
|
||||||
{
|
{
|
||||||
IconTheme icon_theme = new IconTheme ();
|
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)
|
foreach (string search_path in IconTheme.Default.SearchPath)
|
||||||
icon_theme.AppendSearchPath (search_path);
|
icon_theme.AppendSearchPath (search_path);
|
||||||
|
@ -46,7 +48,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public static Image GetImage (string name)
|
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);
|
return new Image (image_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -730,28 +730,28 @@ namespace SparkleShare {
|
||||||
|
|
||||||
int backing_scale_factor;
|
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> ();
|
Items = new List <object> ();
|
||||||
Cells = new NSAttributedString [plugins.Count];
|
Cells = new NSAttributedString [presets.Count];
|
||||||
SelectedCells = new NSAttributedString [plugins.Count];
|
SelectedCells = new NSAttributedString [presets.Count];
|
||||||
|
|
||||||
this.backing_scale_factor = (int) backing_scale_factor;
|
this.backing_scale_factor = (int) backing_scale_factor;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (Preset plugin in plugins) {
|
foreach (Preset preset in presets) {
|
||||||
Items.Add (plugin);
|
Items.Add (preset);
|
||||||
|
|
||||||
NSTextFieldCell cell = new NSTextFieldCell ();
|
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();
|
NSDictionary name_dictionary = new NSDictionary();
|
||||||
NSAttributedString name_attributes = new NSAttributedString (
|
NSAttributedString name_attributes = new NSAttributedString (
|
||||||
name_data, new NSUrl ("file://"), out name_dictionary);
|
name_data, new NSUrl ("file://"), out name_dictionary);
|
||||||
|
|
||||||
NSData description_data = NSData.FromString (
|
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();
|
NSDictionary description_dictionary = new NSDictionary();
|
||||||
NSAttributedString description_attributes = new NSAttributedString (
|
NSAttributedString description_attributes = new NSAttributedString (
|
||||||
|
@ -767,7 +767,7 @@ namespace SparkleShare {
|
||||||
NSTextFieldCell selected_cell = new NSTextFieldCell ();
|
NSTextFieldCell selected_cell = new NSTextFieldCell ();
|
||||||
|
|
||||||
NSData selected_name_data = NSData.FromString (
|
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 ();
|
NSDictionary selected_name_dictionary = new NSDictionary ();
|
||||||
NSAttributedString selected_name_attributes = new NSAttributedString (
|
NSAttributedString selected_name_attributes = new NSAttributedString (
|
||||||
|
@ -775,7 +775,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
NSData selected_description_data = NSData.FromString (
|
NSData selected_description_data = NSData.FromString (
|
||||||
"<small><font style='line-height: 150%' color='#9bbaeb' face='" + UserInterface.FontName + "'>" +
|
"<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 ();
|
NSDictionary selected_description_dictionary = new NSDictionary ();
|
||||||
NSAttributedString selected_description_attributes = new NSAttributedString (
|
NSAttributedString selected_description_attributes = new NSAttributedString (
|
||||||
|
|
|
@ -179,7 +179,7 @@ namespace SparkleShare {
|
||||||
Content = text_block;
|
Content = text_block;
|
||||||
|
|
||||||
MouseUp += delegate {
|
MouseUp += delegate {
|
||||||
Program.Controller.OpenWebsite (url);
|
SparkleShare.Controller.OpenWebsite (url);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,10 @@ namespace SparkleShare {
|
||||||
public SparkleBubbles ()
|
public SparkleBubbles ()
|
||||||
{
|
{
|
||||||
Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) {
|
Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) {
|
||||||
if (!Program.Controller.NotificationsEnabled)
|
if (!SparkleShare.Controller.NotificationsEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Program.UI.StatusIcon.ShowBalloon (title, subtext, image_path);
|
SparkleShare.UI.StatusIcon.ShowBalloon (title, subtext, image_path);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,7 +366,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public void LinkClicked (string url)
|
public void LinkClicked (string url)
|
||||||
{
|
{
|
||||||
Program.UI.EventLog.Controller.LinkClicked (url);
|
SparkleShare.UI.EventLog.Controller.LinkClicked (url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ namespace SparkleShare
|
||||||
{
|
{
|
||||||
public void LinkClicked(string url)
|
public void LinkClicked(string url)
|
||||||
{
|
{
|
||||||
Program.UI.EventLog.Controller.LinkClicked(url);
|
SparkleShare.UI.EventLog.Controller.LinkClicked(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
this.user_image.ImageSource = avatar;
|
this.user_image.ImageSource = avatar;
|
||||||
this.Title = Controller.CurrentProject ?? "Add Note";
|
this.Title = Controller.CurrentProject ?? "Add Note";
|
||||||
this.user_name_text_block.Text = Program.Controller.CurrentUser.Name;
|
this.user_name_text_block.Text = SparkleShare.Controller.CurrentUser.Name;
|
||||||
this.user_email_text_field.Text = Program.Controller.CurrentUser.Email;
|
this.user_email_text_field.Text = SparkleShare.Controller.CurrentUser.Email;
|
||||||
this.balloon_text_field.Text = default_text;
|
this.balloon_text_field.Text = default_text;
|
||||||
|
|
||||||
ElementHost.EnableModelessKeyboardInterop (this);
|
ElementHost.EnableModelessKeyboardInterop (this);
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
cancel_button.Click += delegate {
|
cancel_button.Click += delegate {
|
||||||
Dispatcher.BeginInvoke ((Action) delegate {
|
Dispatcher.BeginInvoke ((Action) delegate {
|
||||||
Program.UI.StatusIcon.Dispose ();
|
SparkleShare.UI.StatusIcon.Dispose ();
|
||||||
Controller.SetupPageCancelled ();
|
Controller.SetupPageCancelled ();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -928,7 +928,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
|
|
||||||
TextBox link_code_text_box = new TextBox () {
|
TextBox link_code_text_box = new TextBox () {
|
||||||
Text = Program.Controller.CurrentUser.PublicKey,
|
Text = SparkleShare.Controller.CurrentUser.PublicKey,
|
||||||
Width = 250,
|
Width = 250,
|
||||||
MaxLines = 1,
|
MaxLines = 1,
|
||||||
TextWrapping = TextWrapping.NoWrap,
|
TextWrapping = TextWrapping.NoWrap,
|
||||||
|
|
|
@ -142,7 +142,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
if(Controller.LinkCodeItemEnabled) {
|
if(Controller.LinkCodeItemEnabled) {
|
||||||
SparkleMenuItem code_item = new SparkleMenuItem {
|
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 {
|
SparkleMenuItem copy_item = new SparkleMenuItem {
|
||||||
|
@ -159,7 +159,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
CheckBox notify_check_box = new CheckBox {
|
CheckBox notify_check_box = new CheckBox {
|
||||||
Margin = new Thickness(6, 0, 0, 0),
|
Margin = new Thickness(6, 0, 0, 0),
|
||||||
IsChecked = Program.Controller.NotificationsEnabled
|
IsChecked = SparkleShare.Controller.NotificationsEnabled
|
||||||
};
|
};
|
||||||
|
|
||||||
SparkleMenuItem notify_item = new SparkleMenuItem {
|
SparkleMenuItem notify_item = new SparkleMenuItem {
|
||||||
|
@ -187,13 +187,13 @@ namespace SparkleShare {
|
||||||
|
|
||||||
notify_check_box.Click += delegate {
|
notify_check_box.Click += delegate {
|
||||||
this.context_menu.IsOpen = false;
|
this.context_menu.IsOpen = false;
|
||||||
Program.Controller.ToggleNotifications();
|
SparkleShare.Controller.ToggleNotifications();
|
||||||
notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
|
notify_check_box.IsChecked = SparkleShare.Controller.NotificationsEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
notify_item.Click += delegate {
|
notify_item.Click += delegate {
|
||||||
Program.Controller.ToggleNotifications();
|
SparkleShare.Controller.ToggleNotifications();
|
||||||
notify_check_box.IsChecked = Program.Controller.NotificationsEnabled;
|
notify_check_box.IsChecked = SparkleShare.Controller.NotificationsEnabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.exit_item.Click += delegate {
|
this.exit_item.Click += delegate {
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace SparkleShare {
|
||||||
StatusIcon = new SparkleStatusIcon ();
|
StatusIcon = new SparkleStatusIcon ();
|
||||||
Note = new SparkleNote ();
|
Note = new SparkleNote ();
|
||||||
|
|
||||||
Program.Controller.UIHasLoaded ();
|
SparkleShare.Controller.UIHasLoaded ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace Sparkles {
|
||||||
protected List<string> warnings = new List<string> ();
|
protected List<string> warnings = new List<string> ();
|
||||||
protected List<string> errors = new List<string> ();
|
protected List<string> errors = new List<string> ();
|
||||||
|
|
||||||
protected string [] ExcludeRules = new string [] {
|
protected string [] ExcludeRules = {
|
||||||
"*.autosave", // Various autosaving apps
|
"*.autosave", // Various autosaving apps
|
||||||
"*~", // gedit and emacs
|
"*~", // gedit and emacs
|
||||||
".~lock.*", // LibreOffice
|
".~lock.*", // LibreOffice
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace Sparkles {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected string LocateCommand (string name)
|
protected static string LocateCommand (string name)
|
||||||
{
|
{
|
||||||
string [] possible_command_paths = {
|
string [] possible_command_paths = {
|
||||||
Environment.GetFolderPath (Environment.SpecialFolder.Personal) + "/bin/" + name,
|
Environment.GetFolderPath (Environment.SpecialFolder.Personal) + "/bin/" + name,
|
||||||
|
|
|
@ -24,17 +24,6 @@ namespace Sparkles {
|
||||||
|
|
||||||
public static class Extensions {
|
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)
|
public static string SHA1 (this string s)
|
||||||
{
|
{
|
||||||
SHA1 sha1 = new SHA1CryptoServiceProvider ();
|
SHA1 sha1 = new SHA1CryptoServiceProvider ();
|
||||||
|
|
|
@ -26,6 +26,9 @@ namespace Sparkles.Git {
|
||||||
|
|
||||||
public static string GitVersion {
|
public static string GitVersion {
|
||||||
get {
|
get {
|
||||||
|
if (GitPath == null)
|
||||||
|
GitPath = LocateCommand ("git");
|
||||||
|
|
||||||
string git_version = new Command (GitPath, "--version").StartAndReadStandardOutput ();
|
string git_version = new Command (GitPath, "--version").StartAndReadStandardOutput ();
|
||||||
return git_version.Replace ("git version ", "");
|
return git_version.Replace ("git version ", "");
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,7 @@ namespace Sparkles.Git {
|
||||||
|
|
||||||
void InstallConfiguration ()
|
void InstallConfiguration ()
|
||||||
{
|
{
|
||||||
string [] settings = new string [] {
|
string [] settings = {
|
||||||
"core.autocrlf input",
|
"core.autocrlf input",
|
||||||
"core.quotepath false", // Don't quote "unusual" characters in path names
|
"core.quotepath false", // Don't quote "unusual" characters in path names
|
||||||
"core.ignorecase false", // Be case sensitive explicitly to work on Mac
|
"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
|
// Add a .gitignore file to the repo
|
||||||
void InstallExcludeRules ()
|
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))
|
if (!Directory.Exists (git_info_path))
|
||||||
Directory.CreateDirectory (git_info_path);
|
Directory.CreateDirectory (git_info_path);
|
||||||
|
|
||||||
string exclude_rules = string.Join (Environment.NewLine, ExcludeRules);
|
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);
|
File.WriteAllText (exclude_rules_file_path, exclude_rules);
|
||||||
}
|
}
|
||||||
|
@ -286,12 +286,12 @@ namespace Sparkles.Git {
|
||||||
|
|
||||||
void InstallAttributeRules ()
|
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);
|
TextWriter writer = new StreamWriter (attribute_rules_file_path);
|
||||||
|
|
||||||
// Compile a list of files we don't want Git to compress.
|
// Compile a list of files we don't want Git to compress.
|
||||||
// Not compressing already compressed files decreases memory usage and increases speed
|
// Not compressing already compressed files decreases memory usage and increases speed
|
||||||
string [] extensions = new string [] {
|
string [] extensions = {
|
||||||
"jpg", "jpeg", "png", "tiff", "gif", // Images
|
"jpg", "jpeg", "png", "tiff", "gif", // Images
|
||||||
"flac", "mp3", "ogg", "oga", // Audio
|
"flac", "mp3", "ogg", "oga", // Audio
|
||||||
"avi", "mov", "mpg", "mpeg", "mkv", "ogv", "ogx", "webm", // Video
|
"avi", "mov", "mpg", "mpeg", "mkv", "ogv", "ogx", "webm", // Video
|
||||||
|
@ -326,11 +326,11 @@ namespace Sparkles.Git {
|
||||||
git_config_clean.StartAndWaitForExit ();
|
git_config_clean.StartAndWaitForExit ();
|
||||||
|
|
||||||
// Pass all files through the encryption filter
|
// 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");
|
File.WriteAllText (git_attributes_file_path, "* filter=encryption");
|
||||||
|
|
||||||
// Store the password
|
// 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));
|
File.WriteAllText (password_file_path, password.SHA256 (this.password_salt));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace Sparkles.Git {
|
||||||
|
|
||||||
private bool in_merge {
|
private bool in_merge {
|
||||||
get {
|
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);
|
return File.Exists (merge_file_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ namespace Sparkles.Git {
|
||||||
|
|
||||||
public override double Size {
|
public override double Size {
|
||||||
get {
|
get {
|
||||||
string file_path = new string [] { LocalPath, ".git", "info", "size" }.Combine ();
|
string file_path = Path.Combine (LocalPath, ".git", "info", "size");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
string size = File.ReadAllText (file_path);
|
string size = File.ReadAllText (file_path);
|
||||||
|
@ -126,7 +126,7 @@ namespace Sparkles.Git {
|
||||||
|
|
||||||
public override double HistorySize {
|
public override double HistorySize {
|
||||||
get {
|
get {
|
||||||
string file_path = new string [] { LocalPath, ".git", "info", "history_size" }.Combine ();
|
string file_path = Path.Combine (LocalPath, ".git", "info", "history_size");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
string size = File.ReadAllText (file_path);
|
string size = File.ReadAllText (file_path);
|
||||||
|
@ -144,8 +144,8 @@ namespace Sparkles.Git {
|
||||||
double size = CalculateSizes (new DirectoryInfo (LocalPath));
|
double size = CalculateSizes (new DirectoryInfo (LocalPath));
|
||||||
double history_size = CalculateSizes (new DirectoryInfo (Path.Combine (LocalPath, ".git")));
|
double history_size = CalculateSizes (new DirectoryInfo (Path.Combine (LocalPath, ".git")));
|
||||||
|
|
||||||
string size_file_path = new string [] { LocalPath, ".git", "info", "size" }.Combine ();
|
string size_file_path = Path.Combine (LocalPath, ".git", "info", "size");
|
||||||
string history_size_file_path = new string [] { LocalPath, ".git", "info", "history_size" }.Combine ();
|
string history_size_file_path = Path.Combine (LocalPath, ".git", "info", "history_size");
|
||||||
|
|
||||||
File.WriteAllText (size_file_path, size.ToString ());
|
File.WriteAllText (size_file_path, size.ToString ());
|
||||||
File.WriteAllText (history_size_file_path, history_size.ToString ());
|
File.WriteAllText (history_size_file_path, history_size.ToString ());
|
||||||
|
@ -377,12 +377,12 @@ namespace Sparkles.Git {
|
||||||
|
|
||||||
public override bool HasUnsyncedChanges {
|
public override bool HasUnsyncedChanges {
|
||||||
get {
|
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);
|
return File.Exists (unsynced_file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
set {
|
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)
|
if (value)
|
||||||
File.WriteAllText (unsynced_file_path, "");
|
File.WriteAllText (unsynced_file_path, "");
|
||||||
|
@ -1110,7 +1110,7 @@ namespace Sparkles.Git {
|
||||||
|
|
||||||
|
|
||||||
// Recursively gets a folder's size in bytes
|
// Recursively gets a folder's size in bytes
|
||||||
private long CalculateSizes (DirectoryInfo parent)
|
long CalculateSizes (DirectoryInfo parent)
|
||||||
{
|
{
|
||||||
long size = 0;
|
long size = 0;
|
||||||
|
|
||||||
|
@ -1149,7 +1149,7 @@ namespace Sparkles.Git {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private bool IsSymlink (string file)
|
bool IsSymlink (string file)
|
||||||
{
|
{
|
||||||
FileAttributes attributes = File.GetAttributes (file);
|
FileAttributes attributes = File.GetAttributes (file);
|
||||||
return ((attributes & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint);
|
return ((attributes & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint);
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace Sparkles {
|
||||||
if (InstallationInfo.Platform == PlatformID.Win32NT)
|
if (InstallationInfo.Platform == PlatformID.Win32NT)
|
||||||
home_path = Environment.GetFolderPath (Environment.SpecialFolder.UserProfile);
|
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 n = Environment.NewLine;
|
||||||
string crash_report =
|
string crash_report =
|
||||||
|
|
|
@ -15,7 +15,7 @@ LINK_WEBKIT = $(WEBKITGTK_SHARP_LIBS)
|
||||||
LINK_APP_INDICATOR = $(APP_INDICATOR_LIBS)
|
LINK_APP_INDICATOR = $(APP_INDICATOR_LIBS)
|
||||||
|
|
||||||
REF_SPARKLES = $(LINK_SYSTEM) $(LINK_MONO_POSIX)
|
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)
|
LINK_SPARKLES_DEPS = $(REF_SPARKLES) $(LINK_SPARKLES)
|
||||||
|
|
||||||
REF_SPARKLESHARE = $(LINK_GTK) $(LINK_SPARKLES_DEPS) $(LINK_APP_INDICATOR) $(LINK_WEBKIT)
|
REF_SPARKLESHARE = $(LINK_GTK) $(LINK_SPARKLES_DEPS) $(LINK_APP_INDICATOR) $(LINK_WEBKIT)
|
||||||
|
|
Loading…
Reference in a new issue