Merge branch 'GNOME3'

Conflicts:
	SparkleShare/Linux/SparkleEventLog.cs
	SparkleShare/Linux/SparkleStatusIcon.cs
This commit is contained in:
Hylke Bons 2013-10-27 00:25:23 +02:00
commit 4897c698ad
27 changed files with 556 additions and 645 deletions

View file

@ -19,7 +19,7 @@ using System;
using System.Reflection; using System.Reflection;
[assembly:AssemblyTitle ("SparkleLib")] [assembly:AssemblyTitle ("SparkleLib")]
[assembly:AssemblyVersion ("1.2")] [assembly:AssemblyVersion ("1.3")]
[assembly:AssemblyCopyright ("Copyright (c) 2010 Hylke Bons and others")] [assembly:AssemblyCopyright ("Copyright (c) 2010 Hylke Bons and others")]
[assembly:AssemblyTrademark ("SparkleShare is a trademark of SparkleShare Ltd.")] [assembly:AssemblyTrademark ("SparkleShare is a trademark of SparkleShare Ltd.")]

View file

@ -55,7 +55,7 @@
background-color: #fefefe; background-color: #fefefe;
color: <!-- $body-color -->; color: <!-- $body-color -->;
font-size: <!-- $body-font-size -->; font-size: <!-- $body-font-size -->;
font-family: <!-- $body-font-family -->; font-family: "<!-- $body-font-family -->";
margin: 0; margin: 0;
-webkit-user-select: none; -webkit-user-select: none;
} }

View file

@ -14,7 +14,7 @@
height="260" height="260"
width="640" width="640"
version="1.1" version="1.1"
inkscape:version="0.48.2 r9819" inkscape:version="0.48.4 r9939"
sodipodi:docname="about-dialog.svg"> sodipodi:docname="about-dialog.svg">
<sodipodi:namedview <sodipodi:namedview
pagecolor="#ffffff" pagecolor="#ffffff"
@ -34,11 +34,11 @@
fit-margin-right="0" fit-margin-right="0"
fit-margin-bottom="0" fit-margin-bottom="0"
showborder="false" showborder="false"
inkscape:zoom="1" inkscape:zoom="0.5"
inkscape:cx="172.52608" inkscape:cx="454.44819"
inkscape:cy="90.406735" inkscape:cy="126.31199"
inkscape:window-x="310" inkscape:window-x="310"
inkscape:window-y="75" inkscape:window-y="63"
inkscape:window-maximized="0" inkscape:window-maximized="0"
inkscape:current-layer="layer1" /> inkscape:current-layer="layer1" />
<defs <defs
@ -60,29 +60,6 @@
stop-color="#3465a4" stop-color="#3465a4"
offset="1" /> offset="1" />
</linearGradient> </linearGradient>
<clipPath
id="clipPath76786"
clipPathUnits="userSpaceOnUse">
<rect
id="rect76788"
transform="matrix(0.60278,0.7979,0.7979,-0.60278,0,0)"
height="321.82999"
width="654.53998"
y="-407.10001"
x="617.64001"
style="fill:url(#linearGradient76790)" />
</clipPath>
<clipPath
id="clipPath101490"
clipPathUnits="userSpaceOnUse">
<rect
id="rect101492"
height="260"
width="640"
y="645.98999"
x="147.08"
style="fill:url(#linearGradient101494)" />
</clipPath>
<linearGradient <linearGradient
id="linearGradient101494" id="linearGradient101494"
x1="437.70999" x1="437.70999"
@ -2074,11 +2051,52 @@
xlink:href="#linearGradient75956" xlink:href="#linearGradient75956"
id="linearGradient8143" id="linearGradient8143"
gradientUnits="userSpaceOnUse" gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.7690459,0,0,1.3201,-349.09096,-128.43)"
x1="437.70999"
y1="553.48291"
x2="437.70999"
y2="818.36084" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient75956"
id="linearGradient4246"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.6031,0,0,1.3201,-335.96,-128.43)" gradientTransform="matrix(1.6031,0,0,1.3201,-335.96,-128.43)"
x1="437.70999" x1="437.70999"
y1="553.48291" y1="553.48291"
x2="437.70999" x2="437.70999"
y2="818.36084" /> y2="818.36084" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient101494"
id="linearGradient4250"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.1272499,0,0,0.68647,-8.0178756,287.619)"
x1="437.70999"
y1="525.46002"
x2="437.70999"
y2="863.81" />
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath4254">
<rect
style="fill:url(#linearGradient4258)"
x="147.08"
y="645.98999"
width="720"
height="260"
id="rect4256" />
</clipPath>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient101494"
id="linearGradient4258"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.1272499,0,0,0.68647,57.891124,366.26)"
x1="437.70999"
y1="525.46002"
x2="437.70999"
y2="863.81" />
</defs> </defs>
<metadata <metadata
id="metadata7"> id="metadata7">
@ -2098,21 +2116,21 @@
<g <g
id="g101011" id="g101011"
transform="translate(-65.909,-78.641)" transform="translate(-65.909,-78.641)"
clip-path="url(#clipPath101490)" clip-path="url(#clipPath4254)"
inkscape:export-filename="/Users/hbons/Projects/SparkleShare/SparkleShare/Common/Pixmaps/about@2x.png" inkscape:export-filename="/home/hylke/Projects/SparkleShare/SparkleShare/Common/Pixmaps/about@2x.png"
inkscape:export-xdpi="180" inkscape:export-xdpi="180"
inkscape:export-ydpi="180"> inkscape:export-ydpi="180">
<rect <rect
id="rect3322-0" id="rect3322-0"
height="500" height="500"
width="1024" width="1130"
y="409.51001" y="409.51001"
x="-209.11" x="-209.11"
style="fill:url(#linearGradient8143)" /> style="fill:url(#linearGradient8143)" />
<g <g
id="g76634" id="g76634"
transform="matrix(0.94303,1.2396,1.2483,-0.93649,-1175.4,1042)" transform="matrix(0.94303,1.2396,1.2483,-0.93649,-1175.4,1042)"
clip-path="url(#clipPath76786)" clip-path="none"
style="opacity:0.3"> style="opacity:0.3">
<path <path
id="path76622" id="path76622"
@ -2187,6 +2205,14 @@
d="m 281.43,-272.16 c 41.897,0 83.613,5.492 124.08,16.336 l -124.08,463.08 z" d="m 281.43,-272.16 c 41.897,0 83.613,5.492 124.08,16.336 l -124.08,463.08 z"
inkscape:connector-curvature="0" /> inkscape:connector-curvature="0" />
</g> </g>
<rect
style="fill:url(#linearGradient76790)"
x="-209.12357"
y="409.52542"
width="1024.0005"
height="499.98679"
transform="matrix(1,-1.2325673e-5,-4.2720841e-6,1,0,0)"
id="rect4252" />
</g> </g>
<g <g
id="g6982" id="g6982"

Before

Width:  |  Height:  |  Size: 952 KiB

After

Width:  |  Height:  |  Size: 953 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 182 KiB

View file

@ -3,7 +3,7 @@ SUBDIRS = Pixmaps
ASSEMBLY = SparkleShare ASSEMBLY = SparkleShare
TARGET = exe TARGET = exe
LINK = $(REF_SPARKLESHARE) $(NOTIFY_SHARP_LIBS) $(WEBKIT_SHARP_LIBS) LINK = $(REF_SPARKLESHARE) $(NOTIFY_SHARP_LIBS) $(WEBKITGTK_SHARP_LIBS)
if HAVE_APP_INDICATOR if HAVE_APP_INDICATOR
BUILD_DEFINES="-define:HAVE_APP_INDICATOR" BUILD_DEFINES="-define:HAVE_APP_INDICATOR"
@ -12,6 +12,7 @@ endif
SOURCES = \ SOURCES = \
../Program.cs \ ../Program.cs \
../SparkleAboutController.cs \ ../SparkleAboutController.cs \
../SparkleAvatars.cs \
../SparkleBubblesController.cs \ ../SparkleBubblesController.cs \
../SparkleControllerBase.cs \ ../SparkleControllerBase.cs \
../SparkleEventLogController.cs \ ../SparkleEventLogController.cs \
@ -22,13 +23,11 @@ SOURCES = \
../SparkleSetupController.cs \ ../SparkleSetupController.cs \
../SparkleStatusIconController.cs \ ../SparkleStatusIconController.cs \
SparkleAbout.cs \ SparkleAbout.cs \
../SparkleAvatars.cs \
SparkleBubbles.cs \ SparkleBubbles.cs \
SparkleController.cs \ SparkleController.cs \
SparkleEventLog.cs \ SparkleEventLog.cs \
SparkleSetup.cs \ SparkleSetup.cs \
SparkleSetupWindow.cs \ SparkleSetupWindow.cs \
SparkleSpinner.cs \
SparkleStatusIcon.cs \ SparkleStatusIcon.cs \
SparkleUI.cs \ SparkleUI.cs \
SparkleUIHelpers.cs SparkleUIHelpers.cs

View file

@ -13,17 +13,16 @@ system_theme_icons = \
apps,sparkleshare-256.png \ apps,sparkleshare-256.png \
apps,sparkleshare-32.png \ apps,sparkleshare-32.png \
apps,sparkleshare-48.png \ apps,sparkleshare-48.png \
status,process-syncing-up-24.png \ status,process-syncing-up-24.png \
status,process-syncing-down-24.png \ status,process-syncing-down-24.png \
status,process-syncing-24.png \ status,process-syncing-24.png \
status,process-syncing-error-24.png \ status,process-syncing-error-24.png \
status,process-syncing-up-48.png \ status,process-syncing-up-48.png \
status,process-syncing-down-48.png \ status,process-syncing-down-48.png \
status,process-syncing-48.png \ status,process-syncing-48.png \
status,process-syncing-error-48.png status,process-syncing-error-48.png
app_theme_icons = \ app_theme_icons = \
animations,process-working-22.png \
status,document-added-12.png \ status,document-added-12.png \
status,document-edited-12.png \ status,document-edited-12.png \
status,document-deleted-12.png \ status,document-deleted-12.png \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

View file

@ -0,0 +1,37 @@
## Building on GNOME 3
SparkleShare now successfully runs on the GNOME 3 platform!
Here's how you compile it against GTK+3 and other dependencies.
Check out the `GNOME3` git branch from:
https://github.com/hbons/SparkleShare
You will still need to have the regular build dependencies installed:
https://github.com/hbons/SparkleShare/blob/master/SparkleShare/Linux/README.md
The C# bindings that SparkleShare uses need to be recompiled against GTK+3, so
you will need to get the the dependencies from the specific locations listed
below, where they are GTK+3-enabled.
Install the `gtk-sharp3` bindings from:
https://github.com/mono/gtk-sharp
Install the `notify-sharp` bindings from:
https://github.com/meebey/notify-sharp
Install the `webkitgtk-sharp` bindings from:
https://github.com/xDarkice/webkitgtk-sharp
All with the usual:
```
./autogen.sh --prefix=/usr
make
sudo make install
```
### Ubuntu
If you're using Ubuntu, install `appindicator-sharp` bindings from:
https://github.com/xDarkice/appindicator-sharp

View file

@ -16,10 +16,7 @@
using System; using System;
using System.Diagnostics;
using Gtk; using Gtk;
using Mono.Unix;
namespace SparkleShare { namespace SparkleShare {
@ -30,25 +27,15 @@ namespace SparkleShare {
private Label updates; private Label updates;
public SparkleAbout () : base ("") public SparkleAbout () : base ("About SparkleShare")
{ {
DefaultSize = new Gdk.Size (600, 260); SetWmclass ("SparkleShare", "SparkleShare");
IconName = "sparkleshare";
Resizable = false; Resizable = false;
BorderWidth = 0;
IconName = "folder-sparkleshare";
WindowPosition = WindowPosition.Center; WindowPosition = WindowPosition.Center;
Title = "About SparkleShare";
AppPaintable = true;
string image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine (); SetSizeRequest (600, 260);
Realize ();
Gdk.Pixbuf buf = new Gdk.Pixbuf (image_path);
Gdk.Pixmap map, map2;
buf.RenderPixmapAndMask (out map, out map2, 255);
GdkWindow.SetBackPixmap (map, false);
CreateAbout ();
DeleteEvent += delegate (object o, DeleteEventArgs args) { DeleteEvent += delegate (object o, DeleteEventArgs args) {
@ -65,9 +52,7 @@ namespace SparkleShare {
}; };
Controller.HideWindowEvent += delegate { Controller.HideWindowEvent += delegate {
Application.Invoke (delegate { Application.Invoke (delegate { Hide (); });
HideAll ();
});
}; };
Controller.ShowWindowEvent += delegate { Controller.ShowWindowEvent += delegate {
@ -79,104 +64,119 @@ namespace SparkleShare {
Controller.UpdateLabelEvent += delegate (string text) { Controller.UpdateLabelEvent += delegate (string text) {
Application.Invoke (delegate { Application.Invoke (delegate {
this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#8cc4ff'>{0}</span>", text); this.updates.Text = text;
this.updates.ShowAll (); this.updates.ShowAll();
}); });
}; };
CreateAbout ();
} }
private void CreateAbout () private void CreateAbout ()
{ {
Gdk.RGBA white = new Gdk.RGBA ();
white.Parse ("#ffffff");
Gdk.RGBA highlight = new Gdk.RGBA ();
highlight.Parse ("#a8bbcf");
Pango.FontDescription font = StyleContext.GetFont (StateFlags.Normal);
font.Size = 9 * 1024;
CssProvider css_provider = new CssProvider ();
string image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine ();
css_provider.LoadFromData ("GtkWindow {" +
"background-image: url('" + image_path + "');" +
"background-repeat: no-repeat;" +
"background-position: left bottom;" +
"}");
StyleContext.AddProvider (css_provider, 800);
VBox layout_vertical = new VBox (false, 0);
HBox links_layout = new HBox (false, 16);
Label version = new Label () { Label version = new Label () {
Markup = string.Format ("<span font_size='small' fgcolor='white'>version {0}</span>", Text = "version " + Controller.RunningVersion,
Controller.RunningVersion), Xalign = 0, Xpad = 0
Xalign = 0,
Xpad = 300
}; };
this.updates = new Label () { version.OverrideFont (font);
Markup = "<span font_size='small' fgcolor='#729fcf'>Checking for updates...</span>", version.OverrideColor (StateFlags.Normal, white);
Xalign = 0,
Xpad = 300
this.updates = new Label ("Checking for updates…") {
Xalign = 0, Xpad = 0
}; };
this.updates.OverrideFont (font);
this.updates.OverrideColor (StateFlags.Normal, highlight);
Label copyright = new Label () { Label copyright = new Label () {
Markup = "<span font_size='small' fgcolor='white'>" + Markup = string.Format ("Copyright © 2010{0} Hylke Bons and others.", DateTime.Now.Year),
"Copyright © 2010" + DateTime.Now.Year + " " + Xalign = 0, Xpad = 0
"Hylke Bons and others." +
"</span>",
Xalign = 0,
Xpad = 300
}; };
Label license = new Label () { copyright.OverrideFont (font);
LineWrap = true, copyright.OverrideColor (StateFlags.Normal, white);
LineWrapMode = Pango.WrapMode.Word,
Markup = "<span font_size='small' fgcolor='white'>" +
"SparkleShare is Open Source software. You are free to use, modify, " +
"and redistribute it under the GNU General Public License version 3 or later." +
"</span>",
WidthRequest = 330,
Wrap = true,
Xalign = 0,
Xpad = 300,
};
VBox layout_vertical = new VBox (false, 0) {
BorderWidth = 0, TextView license = new TextView ();
HeightRequest = 260, TextBuffer license_buffer = license.Buffer;
WidthRequest = 640 license.WrapMode = WrapMode.Word;
}; license.Sensitive = false;
HBox links_layout = new HBox (false, 6); license_buffer.Text = "SparkleShare is Open Source and youre free to use, change, " +
"and share it under the GNU GPLv3.";
SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress); license.OverrideBackgroundColor (StateFlags.Normal, new Gdk.RGBA () { Alpha = 0 });
license.OverrideFont (font);
license.OverrideColor (StateFlags.Normal, white);
SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
SparkleLink report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress); SparkleLink report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
SparkleLink debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress); SparkleLink debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);
links_layout.PackStart (new Label (""), false, false, 143);
links_layout.PackStart (website_link, false, false, 9); layout_vertical.PackStart (new Label (""), true, true, 0);
links_layout.PackStart (credits_link, false, false, 9);
links_layout.PackStart (report_problem_link, false, false, 9);
links_layout.PackStart (debug_log_link, false, false, 9);
layout_vertical.PackStart (new Label (""), false, false, 42);
layout_vertical.PackStart (version, false, false, 0); layout_vertical.PackStart (version, false, false, 0);
layout_vertical.PackStart (this.updates, false, false, 0); layout_vertical.PackStart (this.updates, false, false, 0);
layout_vertical.PackStart (copyright, false, false, 9); layout_vertical.PackStart (copyright, false, false, 6);
layout_vertical.PackStart (license, false, false, 0); layout_vertical.PackStart (license, false, false, 6);
layout_vertical.PackStart (links_layout, false, false, 12); layout_vertical.PackStart (links_layout, false, false, 16);
Add (layout_vertical); links_layout.PackStart (website_link, false, false, 0);
links_layout.PackStart (credits_link, false, false, 0);
links_layout.PackStart (report_problem_link, false, false, 0);
links_layout.PackStart (debug_log_link, false, false, 0);
HBox layout_horizontal = new HBox (false, 0);
layout_horizontal.PackStart (new Label (""), false, false, 149);
layout_horizontal.PackStart (layout_vertical, false, false, 0);
Add (layout_horizontal);
}
}
public class SparkleLink : Label {
public SparkleLink (string text, string url)
{
Markup = string.Format ("<a href=\"{0}\"><span fgcolor=\"#729fcf\">{1}</span></a>", url, text);
CanFocus = false;
Pango.FontDescription font = StyleContext.GetFont (StateFlags.Normal);
font.Size = 9 * 1024;
OverrideFont (font);
} }
} }
public class SparkleLink : EventBox {
public SparkleLink (string text, string url)
{
VisibleWindow = false;
Label label = new Label () {
Markup = "<span size='small' fgcolor='#729fcf' underline='single'>" + text + "</span>"
};
EnterNotifyEvent += delegate {
GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Hand1);
};
LeaveNotifyEvent += delegate {
GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Arrow);
};
ButtonPressEvent += delegate {
Program.Controller.OpenWebsite (url);
};
Add (label);
}
}
} }

View file

@ -201,11 +201,5 @@ namespace SparkleShare {
Clipboard clipboard = Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false)); Clipboard clipboard = Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
clipboard.Text = text; clipboard.Text = text;
} }
public override void OpenWebsite (string url)
{
OpenFile (url);
}
} }
} }

View file

@ -16,15 +16,10 @@
using System; using System;
using System.Collections.Generic;
using System.Threading;
using Gtk; using Gtk;
using Mono.Unix;
using WebKit; using WebKit;
using IO = System.IO;
namespace SparkleShare { namespace SparkleShare {
public class SparkleEventLog : Window { public class SparkleEventLog : Window {
@ -33,84 +28,66 @@ namespace SparkleShare {
private Label size_label; private Label size_label;
private Label history_label; private Label history_label;
private HBox layout_horizontal;
private ComboBox combo_box; private ComboBox combo_box;
private HBox combo_box_wrapper;
private EventBox content_wrapper; private EventBox content_wrapper;
private HBox combo_box_wrapper;
private HBox layout_horizontal;
private ScrolledWindow scrolled_window; private ScrolledWindow scrolled_window;
private VBox spinner_wrapper;
private Spinner spinner;
private WebView web_view; private WebView web_view;
private SparkleSpinner spinner;
private int pos_x, pos_y;
public SparkleEventLog () : base ("") public SparkleEventLog () : base ("Recent Changes")
{ {
SetWmclass ("SparkleShare", "SparkleShare");
Gdk.Rectangle monitor_0_rect = Gdk.Screen.Default.GetMonitorGeometry (0); Gdk.Rectangle monitor_0_rect = Gdk.Screen.Default.GetMonitorGeometry (0);
SetSizeRequest (480, (int) (monitor_0_rect.Height * 0.8)); SetSizeRequest (480, (int) (monitor_0_rect.Height * 0.8));
int x = (int) (monitor_0_rect.Width * 0.61); IconName = "sparkleshare";
int y = (int) (monitor_0_rect.Height * 0.5 - (HeightRequest * 0.5)); this.pos_x = (int) (monitor_0_rect.Width * 0.61);
this.pos_y = (int) (monitor_0_rect.Height * 0.5 - (HeightRequest * 0.5));
Move (x, y); this.size_label = new Label () { Xalign = 0, Markup = "<b>Size:</b> …" };
this.history_label = new Label () { Xalign = 0, Markup = "<b>History:</b> …" };
Resizable = true; this.size_label.SetSizeRequest (100, 24);
BorderWidth = 0;
Title = "Recent Changes"; HBox layout_sizes = new HBox (false, 0);
IconName = "folder-sparkleshare"; layout_sizes.PackStart (this.size_label, false, false, 12);
layout_sizes.PackStart (this.history_label, false, false, 0);
DeleteEvent += delegate (object o, DeleteEventArgs args) {
Controller.WindowClosed ();
args.RetVal = true;
};
KeyPressEvent += delegate (object o, KeyPressEventArgs args) {
if (args.Event.Key == Gdk.Key.Escape ||
(args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w)) {
Controller.WindowClosed ();
}
};
this.size_label = new Label () {
Markup = "<b>Size:</b> …",
Xalign = 0
};
this.history_label = new Label () {
Markup = "<b>History:</b> …",
Xalign = 0
};
HBox layout_sizes = new HBox (false, 12);
layout_sizes.Add (this.size_label);
layout_sizes.Add (this.history_label);
VBox layout_vertical = new VBox (false, 0); VBox layout_vertical = new VBox (false, 0);
this.spinner = new SparkleSpinner (22); this.spinner = new Spinner ();
this.spinner_wrapper = new VBox ();
this.content_wrapper = new EventBox (); this.content_wrapper = new EventBox ();
this.scrolled_window = new ScrolledWindow (); this.scrolled_window = new ScrolledWindow ();
Gdk.Color white = new Gdk.Color(); this.content_wrapper.OverrideBackgroundColor (StateFlags.Normal,
Gdk.Color.Parse ("white", ref white); new Gdk.RGBA () { Red = 1, Green = 1, Blue=1, Alpha = 1 });
this.content_wrapper.ModifyBg (StateType.Normal, white);
this.web_view = new WebView () {
Editable = false
};
this.web_view = new WebView () { Editable = false };
this.web_view.NavigationRequested += WebViewNavigationRequested; this.web_view.NavigationRequested += WebViewNavigationRequested;
this.scrolled_window.Add (this.web_view); this.scrolled_window.Add (this.web_view);
this.content_wrapper.Add (this.spinner);
this.spinner_wrapper = new VBox (false, 0);
this.spinner_wrapper.PackStart (new Label(""), true, true, 0);
this.spinner_wrapper.PackStart (this.spinner, false, false, 0);
this.spinner_wrapper.PackStart (new Label(""), true, true, 0);
this.spinner.SetSizeRequest (24, 24);
this.spinner.Start (); this.spinner.Start ();
this.layout_horizontal = new HBox (true, 0); this.content_wrapper.Add (this.spinner_wrapper);
this.layout_horizontal = new HBox (false, 0);
this.layout_horizontal.PackStart (layout_sizes, true, true, 12); this.layout_horizontal.PackStart (layout_sizes, true, true, 12);
layout_vertical.PackStart (this.layout_horizontal, false, false, 0); layout_vertical.PackStart (this.layout_horizontal, false, false, 0);
layout_vertical.PackStart (new HSeparator (), false, false, 0);
layout_vertical.PackStart (this.content_wrapper, true, true, 0); layout_vertical.PackStart (this.content_wrapper, true, true, 0);
Add (layout_vertical); Add (layout_vertical);
@ -118,7 +95,7 @@ namespace SparkleShare {
Controller.HideWindowEvent += delegate { Controller.HideWindowEvent += delegate {
Application.Invoke (delegate { Application.Invoke (delegate {
HideAll (); Hide ();
if (this.content_wrapper.Child != null) if (this.content_wrapper.Child != null)
this.content_wrapper.Remove (this.content_wrapper.Child); this.content_wrapper.Remove (this.content_wrapper.Child);
@ -127,6 +104,7 @@ namespace SparkleShare {
Controller.ShowWindowEvent += delegate { Controller.ShowWindowEvent += delegate {
Application.Invoke (delegate { Application.Invoke (delegate {
Move (this.pos_x, this.pos_y);
ShowAll (); ShowAll ();
Present (); Present ();
}); });
@ -134,8 +112,8 @@ namespace SparkleShare {
Controller.ShowSaveDialogEvent += delegate (string file_name, string target_folder_path) { Controller.ShowSaveDialogEvent += delegate (string file_name, string target_folder_path) {
Application.Invoke (delegate { Application.Invoke (delegate {
FileChooserDialog dialog = new FileChooserDialog ("Restore from History", FileChooserDialog dialog = new FileChooserDialog ("Restore from History", this,
this, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Ok); FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Ok);
dialog.CurrentName = file_name; dialog.CurrentName = file_name;
dialog.DoOverwriteConfirmation = true; dialog.DoOverwriteConfirmation = true;
@ -151,21 +129,15 @@ namespace SparkleShare {
}; };
Controller.UpdateChooserEvent += delegate (string [] folders) { Controller.UpdateChooserEvent += delegate (string [] folders) {
Application.Invoke (delegate { Application.Invoke (delegate { UpdateChooser (folders); });
UpdateChooser (folders);
});
}; };
Controller.UpdateChooserEnablementEvent += delegate (bool enabled) { Controller.UpdateChooserEnablementEvent += delegate (bool enabled) {
Application.Invoke (delegate { Application.Invoke (delegate { this.combo_box.Sensitive = enabled; });
this.combo_box.Sensitive = enabled;
});
}; };
Controller.UpdateContentEvent += delegate (string html) { Controller.UpdateContentEvent += delegate (string html) {
Application.Invoke (delegate { Application.Invoke (delegate { UpdateContent (html); });
UpdateContent (html);
});
}; };
Controller.ContentLoadingEvent += delegate { Controller.ContentLoadingEvent += delegate {
@ -173,33 +145,33 @@ namespace SparkleShare {
if (this.content_wrapper.Child != null) if (this.content_wrapper.Child != null)
this.content_wrapper.Remove (this.content_wrapper.Child); this.content_wrapper.Remove (this.content_wrapper.Child);
this.content_wrapper.Add (this.spinner); this.content_wrapper.Add (this.spinner_wrapper);
this.spinner.Start (); this.spinner.Start ();
this.content_wrapper.ShowAll ();
}); });
}; };
Controller.UpdateSizeInfoEvent += delegate (string size, string history_size) { Controller.UpdateSizeInfoEvent += delegate (string size, string history_size) {
Application.Invoke (delegate { Application.Invoke (delegate {
this.size_label.Markup = "<b>Size:</b> " + size; this.size_label.Markup = "<b>Size</b> " + size;
this.history_label.Markup = "<b>History:</b> " + history_size; this.history_label.Markup = "<b>History</b> " + history_size;
this.size_label.ShowAll ();
this.history_label.ShowAll ();
}); });
}; };
DeleteEvent += delegate (object o, DeleteEventArgs args) {
Controller.WindowClosed ();
args.RetVal = true;
};
KeyPressEvent += delegate (object o, KeyPressEventArgs args) {
if (args.Event.Key == Gdk.Key.Escape ||
(args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w)) {
Controller.WindowClosed ();
}
};
} }
private void WebViewNavigationRequested (object o, WebKit.NavigationRequestedArgs args) {
Controller.LinkClicked (args.Request.Uri);
// Don't follow HREFs (as this would cause a page refresh)
if (!args.Request.Uri.Equals ("file:"))
args.RetVal = 1;
}
public void UpdateChooser (string [] folders) public void UpdateChooser (string [] folders)
{ {
if (folders == null) if (folders == null)
@ -226,16 +198,16 @@ namespace SparkleShare {
this.combo_box.Active = 0; this.combo_box.Active = 0;
int row = 2; int row = 2;
foreach (string folder in folders) { foreach (string folder in folders) {
store.AppendValues (folder); store.AppendValues (folder);
if (folder.Equals (Controller.SelectedFolder)) if (folder.Equals (Controller.SelectedFolder))
this.combo_box.Active = row; this.combo_box.Active = row;
row++; row++;
} }
this.combo_box.RowSeparatorFunc = delegate (TreeModel model, TreeIter iter) { this.combo_box.RowSeparatorFunc = delegate (ITreeModel model, TreeIter iter) {
string item = (string) this.combo_box.Model.GetValue (iter, 0); string item = (string) this.combo_box.Model.GetValue (iter, 0);
return (item == "---"); return (item == "---");
}; };
@ -252,43 +224,50 @@ namespace SparkleShare {
Controller.SelectedFolder = selection; Controller.SelectedFolder = selection;
}; };
this.combo_box_wrapper.PackStart (new Label (" "), false, false, 9); this.combo_box_wrapper.Add (this.combo_box);
this.combo_box_wrapper.PackStart (this.combo_box, true, true, 0); this.combo_box.GrabFocus ();
this.layout_horizontal.BorderWidth = 9; this.layout_horizontal.BorderWidth = 6;
this.layout_horizontal.PackStart (this.combo_box_wrapper, true, true, 0); this.layout_horizontal.PackStart (this.combo_box_wrapper, false, false, 0);
this.layout_horizontal.ShowAll (); this.layout_horizontal.ShowAll ();
} }
public void UpdateContent (string html) public void UpdateContent (string html)
{ {
string pixmaps_path = IO.Path.Combine (SparkleUI.AssetsPath, "pixmaps"); string pixmaps_path = new string [] {SparkleUI.AssetsPath, "pixmaps"}.Combine ();
string icons_path = new string [] {SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status"}.Combine (); string icons_path = new string [] {SparkleUI.AssetsPath, "icons", "hicolor", "12x12", "status"}.Combine ();
html = html.Replace ("<!-- $body-font-size -->", (double) (Style.FontDescription.Size / 1024 + 3) + "px");
html = html.Replace ("<!-- $day-entry-header-font-size -->", (Style.FontDescription.Size / 1024 + 3) + "px");
html = html.Replace ("<!-- $a-color -->", "#0085cf");
html = html.Replace ("<!-- $a-hover-color -->", "#009ff8"); html = html.Replace ("<!-- $a-hover-color -->", "#009ff8");
html = html.Replace ("<!-- $body-font-family -->", "\"" + Style.FontDescription.Family + "\""); html = html.Replace ("<!-- $a-color -->", "#0085cf");
html = html.Replace ("<!-- $body-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Normal)));
html = html.Replace ("<!-- $body-background-color -->", SparkleUIHelpers.GdkColorToHex (new TreeView ().Style.Base (StateType.Normal))); html = html.Replace ("<!-- $body-font-family -->", StyleContext.GetFont (StateFlags.Normal).Family);
html = html.Replace ("<!-- $day-entry-header-background-color -->", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal))); html = html.Replace ("<!-- $body-font-size -->", (double) (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px");
html = html.Replace ("<!-- $secondary-font-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); html = html.Replace ("<!-- $body-color -->", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Normal)));
html = html.Replace ("<!-- $small-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive))); html = html.Replace ("<!-- $body-background-color -->",
html = html.Replace ("<!-- $small-font-size -->", "85%"); SparkleUIHelpers.RGBAToHex (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Normal)));
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)));
html = html.Replace ("<!-- $secondary-font-color -->", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Insensitive)));
html = html.Replace ("<!-- $small-color -->", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Insensitive)));
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://" + IO.Path.Combine (icons_path, "document-added.png")); html = html.Replace ("<!-- $document-added-background-image -->", "file://" + new string [] {icons_path, "document-added.png"}.Combine ());
html = html.Replace ("<!-- $document-edited-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-edited.png")); html = html.Replace ("<!-- $document-edited-background-image -->", "file://" + new string [] {icons_path, "document-edited.png"}.Combine ());
html = html.Replace ("<!-- $document-deleted-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-deleted.png")); html = html.Replace ("<!-- $document-deleted-background-image -->", "file://" + new string [] {icons_path, "document-deleted.png"}.Combine ());
html = html.Replace ("<!-- $document-moved-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-moved.png")); html = html.Replace ("<!-- $document-moved-background-image -->", "file://" + new string [] {icons_path, "document-moved.png"}.Combine ());
this.spinner.Stop (); this.spinner.Stop ();
this.scrolled_window.Remove (this.web_view); this.scrolled_window.Remove (this.web_view);
this.web_view.Dispose (); this.web_view.Dispose ();
this.web_view = new WebView () { Editable = false }; this.web_view = new WebView () { Editable = false };
this.web_view.LoadHtmlString (html, "file://"); this.web_view.LoadString (html, "text/html", "UTF-8", "file://");
this.web_view.NavigationRequested += WebViewNavigationRequested; this.web_view.NavigationRequested += WebViewNavigationRequested;
this.scrolled_window.Add (this.web_view); this.scrolled_window.Add (this.web_view);
@ -296,5 +275,15 @@ namespace SparkleShare {
this.content_wrapper.Add (this.scrolled_window); this.content_wrapper.Add (this.scrolled_window);
this.scrolled_window.ShowAll (); this.scrolled_window.ShowAll ();
} }
private void WebViewNavigationRequested (object o, WebKit.NavigationRequestedArgs args) {
Controller.LinkClicked (args.Request.Uri);
// Don't follow HREFs (as this would cause a page refresh)
if (!args.Request.Uri.Equals ("file:"))
args.RetVal = 1;
}
} }
} }

View file

@ -16,7 +16,6 @@
using System; using System;
using System.IO;
using Gtk; using Gtk;
using Mono.Unix; using Mono.Unix;
@ -31,7 +30,7 @@ namespace SparkleShare {
public SparkleSetup () : base () public SparkleSetup () : base ()
{ {
Controller.HideWindowEvent += delegate { Controller.HideWindowEvent += delegate {
Application.Invoke (delegate { HideAll (); }); Application.Invoke (delegate { Hide (); });
}; };
Controller.ShowWindowEvent += delegate { Controller.ShowWindowEvent += delegate {
@ -55,7 +54,7 @@ namespace SparkleShare {
{ {
if (type == PageType.Setup) { if (type == PageType.Setup) {
Header = "Welcome to SparkleShare!"; Header = "Welcome to SparkleShare!";
Description = "First off, whats your name and email?\n(Visible only to team members)"; Description = "First off, whats your name and email?\n(visible only to team members)";
Table table = new Table (2, 3, true) { Table table = new Table (2, 3, true) {
RowSpacing = 6, RowSpacing = 6,
@ -117,48 +116,57 @@ namespace SparkleShare {
Add (wrapper); Add (wrapper);
Controller.CheckSetupPage (name_entry.Text, email_entry.Text); Controller.CheckSetupPage (name_entry.Text, email_entry.Text);
if (name_entry.Text.Equals (""))
name_entry.GrabFocus ();
else
email_entry.GrabFocus ();
} }
if (type == PageType.Add) { if (type == PageType.Add) {
Header = "Wheres your project hosted?"; Header = "Wheres your project hosted?";
VBox layout_vertical = new VBox (false, 12); VBox layout_vertical = new VBox (false, 16);
HBox layout_fields = new HBox (true, 12); HBox layout_fields = new HBox (true, 32);
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 (Gdk.Pixbuf), typeof (string), typeof (SparklePlugin)); ListStore store = new ListStore (typeof (string), typeof (Gdk.Pixbuf), typeof (string), typeof (SparklePlugin));
SparkleTreeView tree = new SparkleTreeView (store) { HeadersVisible = false }; SparkleTreeView tree_view = new SparkleTreeView (store) { HeadersVisible = false };
ScrolledWindow scrolled_window = new ScrolledWindow (); ScrolledWindow scrolled_window = new ScrolledWindow () { ShadowType = ShadowType.In };
scrolled_window.AddWithViewport (tree); scrolled_window.SetPolicy (PolicyType.Never, PolicyType.Automatic);
// Padding column
tree_view.AppendColumn ("Padding", new Gtk.CellRendererText (), "text", 0);
tree_view.Columns [0].Cells [0].Xpad = 4;
// Icon column // Icon column
tree.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0); tree_view.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 1);
tree.Columns [0].Cells [0].Xpad = 6; tree_view.Columns [1].Cells [0].Xpad = 4;
// Service column // Service column
TreeViewColumn service_column = new TreeViewColumn () { Title = "Service" }; TreeViewColumn service_column = new TreeViewColumn () { Title = "Service" };
CellRendererText service_cell = new CellRendererText () { Ypad = 4 }; CellRendererText service_cell = new CellRendererText () { Ypad = 8 };
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 (SparklePlugin plugin in Controller.Plugins) { foreach (SparklePlugin plugin in Controller.Plugins) {
store.AppendValues (new Gdk.Pixbuf (plugin.ImagePath), store.AppendValues ("", new Gdk.Pixbuf (plugin.ImagePath),
"<span size=\"small\"><b>" + plugin.Name + "</b>\n" + "<span size=\"small\"><b>" + plugin.Name + "</b>\n" +
"<span fgcolor=\"" + SecondaryTextColorSelected + "\">" + "<span fgcolor=\"" + SecondaryTextColor + "\">" + plugin.Description + "</span>" +
plugin.Description + "</span>" +
"</span>", plugin); "</span>", plugin);
} }
tree.AppendColumn (service_column); tree_view.AppendColumn (service_column);
scrolled_window.Add (tree_view);
Entry address_entry = new Entry () { Entry address_entry = new Entry () {
Text = Controller.PreviousAddress, Text = Controller.PreviousAddress,
Sensitive = (Controller.SelectedPlugin.Address == null), Sensitive = (Controller.SelectedPlugin.Address == null),
ActivatesDefault = true ActivatesDefault = true
}; };
Entry path_entry = new Entry () { Entry path_entry = new Entry () {
Text = Controller.PreviousPath, Text = Controller.PreviousPath,
Sensitive = (Controller.SelectedPlugin.Path == null), Sensitive = (Controller.SelectedPlugin.Path == null),
@ -180,11 +188,84 @@ namespace SparkleShare {
}; };
// Select the first plugin by default TreeSelection default_selection = tree_view.Selection;
TreeSelection default_selection = tree.Selection; TreePath default_path = new TreePath ("" + Controller.SelectedPluginIndex);
TreePath default_path = new TreePath ("0");
default_selection.SelectPath (default_path); default_selection.SelectPath (default_path);
Controller.SelectedPluginChanged (0);
tree_view.Model.Foreach (new TreeModelForeachFunc (
delegate (ITreeModel model, TreePath path, TreeIter iter) {
string address;
try {
address = (model.GetValue (iter, 2) as SparklePlugin).Address;
} catch (NullReferenceException) {
address = "";
}
if (!string.IsNullOrEmpty (address) &&
address.Equals (Controller.PreviousAddress)) {
tree_view.SetCursor (path, service_column, false);
SparklePlugin plugin = (SparklePlugin) model.GetValue (iter, 2);
if (plugin.Address != null)
address_entry.Sensitive = false;
if (plugin.Path != null)
path_entry.Sensitive = false;
return true;
} else {
return false;
}
}
));
layout_address.PackStart (new Label () {
Markup = "<b>" + "Address" + "</b>",
Xalign = 0
}, true, true, 0);
layout_address.PackStart (address_entry, false, false, 0);
layout_address.PackStart (address_example, false, false, 0);
path_entry.Changed += delegate {
Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree_view.SelectedRow);
};
layout_path.PackStart (new Label () {
Markup = "<b>" + "Remote Path" + "</b>",
Xalign = 0
}, true, true, 0);
layout_path.PackStart (path_entry, false, false, 0);
layout_path.PackStart (path_example, false, false, 0);
layout_fields.PackStart (layout_address, true, true, 0);
layout_fields.PackStart (layout_path, true, true, 0);
layout_vertical.PackStart (new Label (""), false, false, 0);
layout_vertical.PackStart (scrolled_window, true, true, 0);
layout_vertical.PackStart (layout_fields, false, false, 0);
tree_view.ScrollToCell (new TreePath ("" + Controller.SelectedPluginIndex), null, true, 0, 0);
Add (layout_vertical);
if (string.IsNullOrEmpty (path_entry.Text)) {
address_entry.GrabFocus ();
address_entry.Position = -1;
} else {
path_entry.GrabFocus ();
path_entry.Position = -1;
}
Button cancel_button = new Button ("Cancel");
Button add_button = new Button ("Add") { Sensitive = false };
Controller.ChangeAddressFieldEvent += delegate (string text, Controller.ChangeAddressFieldEvent += delegate (string text,
string example_text, FieldState state) { string example_text, FieldState state) {
@ -208,93 +289,22 @@ namespace SparkleShare {
}); });
}; };
Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1); Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
Application.Invoke (delegate { add_button.Sensitive = button_enabled; });
// Update the address field text when the selection changes
tree.CursorChanged += delegate (object sender, EventArgs e) {
Controller.SelectedPluginChanged (tree.SelectedRow);
// TODO: Scroll to selected row when using arrow keys
}; };
tree.Model.Foreach (new TreeModelForeachFunc (delegate (TreeModel model,
TreePath path, TreeIter iter) {
string address; tree_view.CursorChanged += delegate (object sender, EventArgs e) {
Controller.SelectedPluginChanged (tree_view.SelectedRow);
try { };
address = (model.GetValue (iter, 2) as SparklePlugin).Address;
} catch (NullReferenceException) {
address = "";
}
if (!string.IsNullOrEmpty (address) &&
address.Equals (Controller.PreviousAddress)) {
tree.SetCursor (path, service_column, false);
SparklePlugin plugin = (SparklePlugin) model.GetValue (iter, 2);
if (plugin.Address != null) {
address_entry.Sensitive = false;}
if (plugin.Path != null)
path_entry.Sensitive = false;
// TODO: Scroll to the selection
return true;
} else {
return false;
}
}));
address_entry.Changed += delegate { address_entry.Changed += delegate {
Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow); Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree_view.SelectedRow);
}; };
layout_address.PackStart (new Label () {
Markup = "<b>" + "Address:" + "</b>",
Xalign = 0
}, true, true, 0);
layout_address.PackStart (address_entry, false, false, 0);
layout_address.PackStart (address_example, false, false, 0);
path_entry.Changed += delegate {
Controller.CheckAddPage (address_entry.Text, path_entry.Text, tree.SelectedRow);
};
layout_path.PackStart (new Label () {
Markup = "<b>" + "Remote Path:" + "</b>",
Xalign = 0
}, true, true, 0);
layout_path.PackStart (path_entry, false, false, 0);
layout_path.PackStart (path_example, false, false, 0);
layout_fields.PackStart (layout_address);
layout_fields.PackStart (layout_path);
layout_vertical.PackStart (new Label (""), false, false, 0);
layout_vertical.PackStart (scrolled_window, true, true, 0);
layout_vertical.PackStart (layout_fields, false, false, 0);
Add (layout_vertical);
Button cancel_button = new Button ("Cancel");
Button add_button = new Button ("Add") { Sensitive = false };
cancel_button.Clicked += delegate { Controller.PageCancelled (); }; cancel_button.Clicked += delegate { Controller.PageCancelled (); };
add_button.Clicked += delegate { Controller.AddPageCompleted (address_entry.Text, path_entry.Text); };
add_button.Clicked += delegate {
Controller.AddPageCompleted (address_entry.Text, path_entry.Text);
};
Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
Application.Invoke (delegate {
add_button.Sensitive = button_enabled;
});
};
CheckButton check_button = new CheckButton ("Fetch prior history") { Active = false }; CheckButton check_button = new CheckButton ("Fetch prior history") { Active = false };
check_button.Toggled += delegate { Controller.HistoryItemChanged (check_button.Active); }; check_button.Toggled += delegate { Controller.HistoryItemChanged (check_button.Active); };
@ -302,7 +312,7 @@ namespace SparkleShare {
AddOption (check_button); AddOption (check_button);
AddButton (cancel_button); AddButton (cancel_button);
AddButton (add_button); AddButton (add_button);
Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1); Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1);
} }
@ -460,7 +470,7 @@ namespace SparkleShare {
Description = "Please enter the password to see their contents."; Description = "Please enter the password to see their contents.";
} }
Label password_label = new Label ("<b>" + "Password:" + "</b>") { Label password_label = new Label ("<b>" + "Password" + "</b>") {
UseMarkup = true, UseMarkup = true,
Xalign = 1 Xalign = 1
}; };
@ -545,6 +555,8 @@ namespace SparkleShare {
AddButton (cancel_button); AddButton (cancel_button);
AddButton (continue_button); AddButton (continue_button);
password_entry.GrabFocus ();
} }
if (type == PageType.Finished) { if (type == PageType.Finished) {
@ -679,20 +691,15 @@ namespace SparkleShare {
private void RenderServiceColumn (TreeViewColumn column, CellRenderer cell, private void RenderServiceColumn (TreeViewColumn column, CellRenderer cell,
TreeModel model, TreeIter iter) ITreeModel model, TreeIter iter)
{ {
string markup = (string) model.GetValue (iter, 1); string markup = (string) model.GetValue (iter, 2);
TreeSelection selection = (column.TreeView as TreeView).Selection; TreeSelection selection = (column.TreeView as TreeView).Selection;
if (selection.IterIsSelected (iter)) { if (selection.IterIsSelected (iter))
if (column.TreeView.HasFocus) markup = markup.Replace (SecondaryTextColor, SecondaryTextColorSelected);
markup = markup.Replace (SecondaryTextColor, SecondaryTextColorSelected); else
else
markup = markup.Replace (SecondaryTextColorSelected, SecondaryTextColor);
} else {
markup = markup.Replace (SecondaryTextColorSelected, SecondaryTextColor); markup = markup.Replace (SecondaryTextColorSelected, SecondaryTextColor);
}
(cell as CellRendererText).Markup = markup; (cell as CellRendererText).Markup = markup;
} }
@ -704,7 +711,7 @@ namespace SparkleShare {
{ {
get { get {
TreeIter iter; TreeIter iter;
TreeModel model; ITreeModel model;
Selection.GetSelected (out model, out iter); Selection.GetSelected (out model, out iter);
return int.Parse (model.GetPath (iter).ToString ()); return int.Parse (model.GetPath (iter).ToString ());

View file

@ -16,99 +16,72 @@
using System; using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using System.Timers;
using Gtk; using Gtk;
using Mono.Unix;
namespace SparkleShare { namespace SparkleShare {
public class SparkleSetupWindow : Window { public class SparkleSetupWindow : Window {
// TODO: caps private EventBox content_area;
private HBox HBox; private EventBox option_area;
private VBox VBox; private HBox buttons;
private VBox Wrapper;
private VBox OptionArea;
private HBox Buttons;
public string Header; public string Header;
public string Description; public string Description;
public string SecondaryTextColor;
public string SecondaryTextColorSelected;
public Container Content; public readonly string SecondaryTextColor;
public readonly string SecondaryTextColorSelected;
public SparkleSetupWindow () : base ("")
public SparkleSetupWindow () : base ("SparkleShare Setup")
{ {
Title = Catalog.GetString ("SparkleShare Setup"); SetWmclass ("SparkleShare", "SparkleShare");
BorderWidth = 0;
IconName = "folder-sparkleshare"; IconName = "sparkleshare";
Resizable = false; Resizable = false;
WindowPosition = WindowPosition.Center; WindowPosition = WindowPosition.Center;
Deletable = false; Deletable = false;
TypeHint = Gdk.WindowTypeHint.Dialog; TypeHint = Gdk.WindowTypeHint.Dialog;
DeleteEvent += delegate (object sender, DeleteEventArgs args) {
args.RetVal = true;
};
SecondaryTextColor = SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive));
SecondaryTextColorSelected =
SparkleUIHelpers.GdkColorToHex (
MixColors (
new TreeView ().Style.Foreground (StateType.Selected),
new TreeView ().Style.Background (StateType.Selected),
0.15
)
);
SetSizeRequest (680, 400); SetSizeRequest (680, 400);
HBox = new HBox (false, 0); DeleteEvent += delegate (object sender, DeleteEventArgs args) { args.RetVal = true; };
VBox = new VBox (false, 0); Gdk.Color color = SparkleUIHelpers.RGBAToColor (StyleContext.GetColor (StateFlags.Insensitive));
SecondaryTextColor = SparkleUIHelpers.ColorToHex (color);
color = MixColors (
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetColor (StateFlags.Selected)),
SparkleUIHelpers.RGBAToColor (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Selected)),
0.39);
SecondaryTextColorSelected = SparkleUIHelpers.ColorToHex (color);
Wrapper = new VBox (false, 0) { HBox layout_horizontal = new HBox (false, 0);
BorderWidth = 0
};
OptionArea = new VBox (false, 0) { VBox layout_vertical = new VBox (false, 0);
BorderWidth = 0
};
Buttons = CreateButtonBox (); this.content_area = new EventBox ();
this.option_area = new EventBox ();
this.buttons = CreateButtonBox ();
HBox layout_horizontal = new HBox (false , 0) { HBox layout_actions = new HBox (false , 48);
BorderWidth = 0
};
layout_horizontal.PackStart (OptionArea, true, true, 0); layout_actions.PackStart (this.option_area, true, true, 0);
layout_horizontal.PackStart (Buttons, false, false, 0); layout_actions.PackStart (this.buttons, false, false, 0);
VBox.PackStart (Wrapper, true, true, 0); layout_vertical.PackStart (this.content_area, true, true, 0);
VBox.PackStart (layout_horizontal, false, false, 15); layout_vertical.PackStart (layout_actions, false, false, 15);
EventBox box = new EventBox ();
Gdk.Color bg_color = new Gdk.Color ();
Gdk.Color.Parse ("#000", ref bg_color);
box.ModifyBg (StateType.Normal, bg_color);
Image side_splash = SparkleUIHelpers.GetImage ("side-splash.png"); Image side_splash = SparkleUIHelpers.GetImage ("side-splash.png");
side_splash.Yalign = 1; side_splash.Yalign = 1;
box.Add (side_splash); layout_horizontal.PackStart (side_splash, false, false, 0);
layout_horizontal.PackStart (layout_vertical, true, true, 30);
HBox.PackStart (box, false, false, 0); base.Add (layout_horizontal);
HBox.PackStart (VBox, true, true, 30);
base.Add (HBox);
} }
@ -116,7 +89,6 @@ namespace SparkleShare {
{ {
return new HBox () { return new HBox () {
BorderWidth = 0, BorderWidth = 0,
//Layout = ButtonBoxStyle.End,
Homogeneous = false, Homogeneous = false,
Spacing = 6 Spacing = 6
}; };
@ -126,13 +98,13 @@ namespace SparkleShare {
public void AddButton (Button button) public void AddButton (Button button)
{ {
(button.Child as Label).Xpad = 15; (button.Child as Label).Xpad = 15;
Buttons.Add (button); this.buttons.Add (button);
} }
public void AddOption (Widget widget) public void AddOption (Widget widget)
{ {
OptionArea.Add (widget); this.option_area.Add (widget);
} }
@ -160,8 +132,7 @@ namespace SparkleShare {
if (widget != null) if (widget != null)
layout_vertical.PackStart (widget, true, true, 0); layout_vertical.PackStart (widget, true, true, 0);
Wrapper.PackStart (layout_vertical, true, true, 0); this.content_area.Add (layout_vertical);
ShowAll ();
} }
@ -170,23 +141,21 @@ namespace SparkleShare {
Header = ""; Header = "";
Description = ""; Description = "";
if (OptionArea.Children.Length > 0) if (this.option_area.Children.Length > 0)
OptionArea.Remove (OptionArea.Children [0]); this.option_area.Remove (this.option_area.Children [0]);
if (Wrapper.Children.Length > 0) if (this.content_area.Children.Length > 0)
Wrapper.Remove (Wrapper.Children [0]); this.content_area.Remove (this.content_area.Children [0]);
foreach (Button button in Buttons) foreach (Button button in this.buttons)
Buttons.Remove (button); this.buttons.Remove (button);
ShowAll ();
} }
new public void ShowAll () new public void ShowAll ()
{ {
if (Buttons.Children.Length > 0) { if (this.buttons.Children.Length > 0) {
Button default_button = (Button) Buttons.Children [Buttons.Children.Length - 1]; Button default_button = (Button) this.buttons.Children [this.buttons.Children.Length - 1];
default_button.CanDefault = true; default_button.CanDefault = true;
Default = default_button; Default = default_button;
@ -201,11 +170,11 @@ namespace SparkleShare {
{ {
return new Gdk.Color ( return new Gdk.Color (
Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) + Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) +
second_color.Red * ratio))) / 65535), second_color.Red * ratio))) / 65535),
Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) + Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) +
second_color.Green * ratio))) / 65535), second_color.Green * ratio))) / 65535),
Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) + Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) +
second_color.Blue * ratio))) / 65535) second_color.Blue * ratio))) / 65535)
); );
} }
} }

View file

@ -1,76 +0,0 @@
// SparkleShare, a collaboration and sharing tool.
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Timers;
using Gtk;
namespace SparkleShare {
// This is a close implementation of GtkSpinner
public class SparkleSpinner : Image {
private Timer timer;
public SparkleSpinner (int size) : base ()
{
int current_frame = 0;
Gdk.Pixbuf spinner_gallery = SparkleUIHelpers.GetIcon ("process-working", size);
int frames_in_width = spinner_gallery.Width / size;
int frames_in_height = spinner_gallery.Height / size;
int frame_count = (frames_in_width * frames_in_height) - 1;
Gdk.Pixbuf [] frames = new Gdk.Pixbuf [frame_count];
int i = 0;
for (int y = 0; y < frames_in_height; y++) {
for (int x = 0; x < frames_in_width; x++) {
if (!(y == 0 && x == 0)) {
frames [i] = new Gdk.Pixbuf (spinner_gallery, x * size, y * size, size, size);
i++;
}
}
}
timer = new Timer () {
Interval = 600 / frame_count
};
timer.Elapsed += delegate {
if (current_frame < frame_count - 1)
current_frame++;
else
current_frame = 0;
Application.Invoke (delegate {
Pixbuf = frames [current_frame];
});
};
}
public void Start ()
{
timer.Start ();
}
public void Stop ()
{
timer.Stop ();
}
}
}

View file

@ -19,7 +19,7 @@ using System;
using Gtk; using Gtk;
#if HAVE_APP_INDICATOR #if HAVE_APP_INDICATOR
using AppIndicator; using AppIndicator3;
#endif #endif
namespace SparkleShare { namespace SparkleShare {
@ -34,7 +34,7 @@ namespace SparkleShare {
private MenuItem state_item; private MenuItem state_item;
#if HAVE_APP_INDICATOR #if HAVE_APP_INDICATOR
private ApplicationIndicator indicator; private Indicator indicator;
#else #else
private StatusIcon status_icon; private StatusIcon status_icon;
#endif #endif
@ -43,9 +43,9 @@ namespace SparkleShare {
public SparkleStatusIcon () public SparkleStatusIcon ()
{ {
#if HAVE_APP_INDICATOR #if HAVE_APP_INDICATOR
this.indicator = new ApplicationIndicator ("sparkleshare", "sparkleshare", Category.ApplicationStatus); this.indicator = new Indicator ("sparkleshare", "sparkleshare", (int) IndicatorCategory.ApplicationStatus);
this.indicator.IconName = "process-syncing-idle"; this.indicator.IconName = "process-syncing-idle";
this.indicator.Status = Status.Active; this.indicator.Status = (int) IndicatorStatus.Active;
#else #else
this.status_icon = new StatusIcon (); this.status_icon = new StatusIcon ();
this.status_icon.IconName = "sparkleshare"; this.status_icon.IconName = "sparkleshare";
@ -76,8 +76,9 @@ namespace SparkleShare {
#if HAVE_APP_INDICATOR #if HAVE_APP_INDICATOR
this.indicator.IconName = icon_name; this.indicator.IconName = icon_name;
this.indicator.Status = Status.Attention; // Force update of the status icon
this.indicator.Status = Status.Active; this.indicator.Status = (int) IndicatorStatus.Attention;
this.indicator.Status = (int) IndicatorStatus.Active;
#else #else
this.status_icon.IconName = icon_name; this.status_icon.IconName = icon_name;
#endif #endif
@ -151,6 +152,8 @@ namespace SparkleShare {
this.recent_events_item.Sensitive = Controller.RecentEventsItemEnabled; this.recent_events_item.Sensitive = Controller.RecentEventsItemEnabled;
this.quit_item = new MenuItem ("Quit") { Sensitive = Controller.QuitItemEnabled }; this.quit_item = new MenuItem ("Quit") { Sensitive = Controller.QuitItemEnabled };
MenuItem add_item = new MenuItem ("Add Hosted Project…"); MenuItem add_item = new MenuItem ("Add Hosted Project…");
#if HAVE_APP_INDICATOR
MenuItem notify_item; MenuItem notify_item;
if (Program.Controller.NotificationsEnabled) if (Program.Controller.NotificationsEnabled)
@ -168,6 +171,7 @@ namespace SparkleShare {
(notify_item.Child as Label).Text = "Turn Notifications On"; (notify_item.Child as Label).Text = "Turn Notifications On";
}); });
}; };
#endif
MenuItem link_code_item = new MenuItem ("Client ID"); MenuItem link_code_item = new MenuItem ("Client ID");
@ -195,8 +199,10 @@ namespace SparkleShare {
folder_item.Submenu = new Menu (); folder_item.Submenu = new Menu ();
(folder_item.Submenu as Menu).Add (this.recent_events_item); (folder_item.Submenu as Menu).Add (this.recent_events_item);
(folder_item.Submenu as Menu).Add (add_item); (folder_item.Submenu as Menu).Add (add_item);
#if HAVE_APP_INDICATOR
(folder_item.Submenu as Menu).Add (new SeparatorMenuItem ()); (folder_item.Submenu as Menu).Add (new SeparatorMenuItem ());
(folder_item.Submenu as Menu).Add (notify_item); (folder_item.Submenu as Menu).Add (notify_item);
#endif
(folder_item.Submenu as Menu).Add (new SeparatorMenuItem ()); (folder_item.Submenu as Menu).Add (new SeparatorMenuItem ());
(folder_item.Submenu as Menu).Add (link_code_item); (folder_item.Submenu as Menu).Add (link_code_item);
(folder_item.Submenu as Menu).Add (new SeparatorMenuItem ()); (folder_item.Submenu as Menu).Add (new SeparatorMenuItem ());

View file

@ -17,6 +17,7 @@
using System; using System;
using GLib;
using Gtk; using Gtk;
using SparkleLib; using SparkleLib;
@ -24,33 +25,53 @@ namespace SparkleShare {
public class SparkleUI { public class SparkleUI {
public static string AssetsPath = Defines.INSTALL_DIR;
public SparkleStatusIcon StatusIcon; public SparkleStatusIcon StatusIcon;
public SparkleEventLog EventLog; public SparkleEventLog EventLog;
public SparkleBubbles Bubbles; public SparkleBubbles Bubbles;
public SparkleSetup Setup; public SparkleSetup Setup;
public SparkleAbout About; public SparkleAbout About;
public static string AssetsPath = Defines.INSTALL_DIR; private Gtk.Application application;
public SparkleUI () public SparkleUI ()
{ {
Application.Init (); this.application = new Gtk.Application ("org.sparkleshare.sparkleshare", 0);
Setup = new SparkleSetup (); this.application.Register (null);
EventLog = new SparkleEventLog (); this.application.Activated += ApplicationActivatedDelegate;
About = new SparkleAbout ();
Bubbles = new SparkleBubbles ();
StatusIcon = new SparkleStatusIcon ();
Program.Controller.UIHasLoaded ();
} }
// Runs the application
public void Run () public void Run ()
{
(this.application as GLib.Application).Run (0, null);
}
private void ApplicationActivatedDelegate (object sender, EventArgs args)
{ {
Application.Run (); if (this.application.Windows.Length > 0) {
foreach (Window window in this.application.Windows) {
if (window.Visible)
window.Present ();
}
} else {
Setup = new SparkleSetup ();
EventLog = new SparkleEventLog ();
About = new SparkleAbout ();
Bubbles = new SparkleBubbles ();
StatusIcon = new SparkleStatusIcon ();
Setup.Application = this.application;
EventLog.Application = this.application;
About.Application = this.application;
Program.Controller.UIHasLoaded ();
}
} }
} }
} }

View file

@ -12,11 +12,10 @@
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
using System; using System;
using System.IO;
using Gtk; using Gtk;
namespace SparkleShare { namespace SparkleShare {
@ -26,16 +25,10 @@ namespace SparkleShare {
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 ());
// 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);
// FIXME: Temporary workaround for a bug in IconTheme.SearchPath in Gtk# on 64-bit systems
// https://github.com/mono/gtk-sharp/commit/9c54fd5ae77f63d11fdc6873a3cb90691990e37f
icon_theme.AppendSearchPath ("/usr/share/icons");
icon_theme.AppendSearchPath ("/usr/local/share/icons");
icon_theme.AppendSearchPath ("/opt/local/share/icons");
icon_theme.AppendSearchPath (Path.Combine (SparkleUI.AssetsPath, "icons"));
try { try {
return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback); return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback);
@ -60,12 +53,27 @@ namespace SparkleShare {
// Converts a Gdk RGB color to a hex value. // Converts a Gdk RGB color to a hex value.
// Example: from "rgb:0,0,0" to "#000000" // Example: from "rgb:0,0,0" to "#000000"
public static string GdkColorToHex (Gdk.Color color) public static string ColorToHex (Gdk.Color color)
{ {
return String.Format ("#{0:X2}{1:X2}{2:X2}", return String.Format ("#{0:X2}{1:X2}{2:X2}",
(int) Math.Truncate (color.Red / 256.00), (int) Math.Truncate (color.Red / 256.00),
(int) Math.Truncate (color.Green / 256.00), (int) Math.Truncate (color.Green / 256.00),
(int) Math.Truncate (color.Blue / 256.00)); (int) Math.Truncate (color.Blue / 256.00));
} }
public static Gdk.Color RGBAToColor (Gdk.RGBA rgba) {
return new Gdk.Color () {
Red = (ushort) (rgba.Red * 65535),
Green = (ushort) (rgba.Green * 65535),
Blue = (ushort)(rgba.Blue * 65535)
};
}
public static string RGBAToHex (Gdk.RGBA rgba)
{
return ColorToHex (RGBAToColor (rgba));
}
} }
} }

View file

@ -5,62 +5,18 @@ if [[ $UID -eq 0 ]]; then
exit 1 exit 1
fi fi
if [ "$XDG_RUNTIME_DIR" ]; then
pidfile=${XDG_RUNTIME_DIR}/sparkleshare.pid
else
pidfile=~/.sparkleshare-$(hostname)-${USER}.pid
fi
start() { start() {
if [ -e "${pidfile}" ]; then
sparklepid=`cat ${pidfile}`
if [ -n "`ps -p ${sparklepid} | grep ${sparklepid}`" ]; then
echo "SparkleShare is already running."
exit 0
else
echo "Stale SparkleShare PID file found, starting a new instance..."
rm -f $pidfile
fi
fi
echo -n "Starting SparkleShare... "
if [ -n "${SSH_AGENT_PID}" -o -n "${SSH_AUTH_SOCK}" ] ; then if [ -n "${SSH_AGENT_PID}" -o -n "${SSH_AUTH_SOCK}" ] ; then
mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 & mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 &
else else
ssh-agent mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 & ssh-agent mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 &
fi fi
( umask 066; echo $! > ${pidfile} )
echo "Done."
}
stop() {
if [ -e "${pidfile}" ]; then
sparklepid=`cat ${pidfile}`
if [ -n "`ps -p ${sparklepid} | grep ${sparklepid}`" ]; then
echo -n "Stopping SparkleShare... "
kill ${sparklepid}
rm -f ${pidfile}
echo "Done."
else
echo "SparkleShare is not running, removing stale PID file..."
rm -f ${pidfile}
fi
else
echo "SparkleShare is not running."
fi
} }
case $1 in case $1 in
start|--start) start|--start)
start start
;; ;;
stop|--stop)
stop
;;
restart|--restart)
stop
start
;;
open|--open) open|--open)
invite=`date -u +%N` invite=`date -u +%N`
open=`echo $2 | sed 's/sparkleshare:\/\/addProject\///'` open=`echo $2 | sed 's/sparkleshare:\/\/addProject\///'`

View file

@ -9,9 +9,9 @@
<key>CFBundleName</key> <key>CFBundleName</key>
<string>SparkleShare</string> <string>SparkleShare</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.2</string> <string>1.3</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.2</string> <string>1.3</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string> <string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>

View file

@ -36,7 +36,7 @@ namespace SparkleShare {
#endif #endif
public static void Main (string [] args) public static void Main (string [] args)
{ {
if (args.Length != 0 && !args [0].Equals ("start") && if (args.Length != 0 && !args [0].Equals ("help") &&
SparkleBackend.Platform != PlatformID.MacOSX && SparkleBackend.Platform != PlatformID.MacOSX &&
SparkleBackend.Platform != PlatformID.Win32NT) { SparkleBackend.Platform != PlatformID.Win32NT) {
@ -47,13 +47,13 @@ namespace SparkleShare {
"designed to keep things simple and to stay out of your way." + n + "designed to keep things simple and to stay out of your way." + n +
n + n +
"Version: " + SparkleLib.SparkleBackend.Version + n + "Version: " + SparkleLib.SparkleBackend.Version + n +
"Copyright (C) 2010 Hylke Bons" + n + "Copyright (C) 2010 Hylke Bons and others" + n +
"This program comes with ABSOLUTELY NO WARRANTY." + n + "This program comes with ABSOLUTELY NO WARRANTY." + n +
n + n +
"This is free software, and you are welcome to redistribute it" + n + "This is free software, and you are welcome to redistribute it" + n +
"under certain conditions. Please read the GNU GPLv3 for details." + n + "under certain conditions. Please read the GNU GPLv3 for details." + n +
n + n +
"Usage: sparkleshare [start|stop|restart]"); "Usage: sparkleshare [start|open]");
Environment.Exit (-1); Environment.Exit (-1);
} }

View file

@ -141,7 +141,7 @@ namespace SparkleShare {
public abstract void OpenFile (string path); public abstract void OpenFile (string path);
// Opens a file with the appropriate application // Opens a file with the appropriate application
public abstract void OpenWebsite (string url); public virtual void OpenWebsite (string url) { }
// Copies text to the clipboard // Copies text to the clipboard
public abstract void CopyToClipboard (string text); public abstract void CopyToClipboard (string text);

View file

@ -2,7 +2,7 @@
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Name='SparkleShare' Id='184950D5-67F6-4D06-9717-7E2F1607A7B0' UpgradeCode='D3DF1D99-87F5-47A7-A349-863DD6E4B73A' <Product Name='SparkleShare' Id='184950D5-67F6-4D06-9717-7E2F1607A7B0' UpgradeCode='D3DF1D99-87F5-47A7-A349-863DD6E4B73A'
Language='1033' Codepage='1252' Version='1.2' Manufacturer='SparkleShare'> Language='1033' Codepage='1252' Version='1.3' Manufacturer='SparkleShare'>
<Package Id='*' Keywords='Installer' Description="SparkleShare Setup" Manufacturer='SparkleShare' <Package Id='*' Keywords='Installer' Description="SparkleShare Setup" Manufacturer='SparkleShare'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' /> InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

View file

@ -12,8 +12,7 @@ LINK_MONO_POSIX = -r:Mono.Posix
LINK_GLIB = $(GLIBSHARP_LIBS) LINK_GLIB = $(GLIBSHARP_LIBS)
LINK_GTK = $(GTKSHARP_LIBS) LINK_GTK = $(GTKSHARP_LIBS)
LINK_GNOME = $(GNOME_SHARP_LIBS) LINK_GNOME = $(GNOME_SHARP_LIBS)
LINK_DBUS = $(NDESK_DBUS_LIBS) $(NDESK_DBUS_GLIB_LIBS) LINK_WEBKIT = $(WEBKITGTK_SHARP_LIBS)
LINK_DBUS_NO_GLIB = $(NDESK_DBUS_LIBS)
LINK_APP_INDICATOR = $(APP_INDICATOR_LIBS) LINK_APP_INDICATOR = $(APP_INDICATOR_LIBS)
REF_NOTIFY_SHARP = $(LINK_SYSTEM) $(LINK_DBUS) $(GTKSHARP_LIBS) $(GLIBSHARP_LIBS) REF_NOTIFY_SHARP = $(LINK_SYSTEM) $(LINK_DBUS) $(GTKSHARP_LIBS) $(GLIBSHARP_LIBS)
@ -24,7 +23,7 @@ REF_SPARKLELIB = $(LINK_SYSTEM) $(LINK_MONO_POSIX)
LINK_SPARKLELIB = -r:$(DIR_BIN)/SparkleLib.dll LINK_SPARKLELIB = -r:$(DIR_BIN)/SparkleLib.dll
LINK_SPARKLELIB_DEPS = $(REF_SPARKLELIB) $(LINK_SPARKLELIB) LINK_SPARKLELIB_DEPS = $(REF_SPARKLELIB) $(LINK_SPARKLELIB)
REF_SPARKLESHARE = $(LINK_DBUS) $(LINK_GTK) $(LINK_SPARKLELIB_DEPS) $(LINK_APP_INDICATOR) REF_SPARKLESHARE = $(LINK_GTK) $(LINK_SPARKLELIB_DEPS) $(LINK_APP_INDICATOR) $(LINK_WEBKIT)
# Cute hack to replace a space with something # Cute hack to replace a space with something
colon:= : colon:= :

View file

@ -23,10 +23,6 @@ if ENABLE_TESTS
ENABLE_TESTS_FLAG = "-define:ENABLE_TESTS" ENABLE_TESTS_FLAG = "-define:ENABLE_TESTS"
endif endif
if ENABLE_ATK
ENABLE_ATK_FLAG = "-define:ENABLE_ATK"
endif
FILTERED_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE)) FILTERED_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE))
DEP_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE) | sed s,-r:,,g | grep '$(top_builddir)/bin/') DEP_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE) | sed s,-r:,,g | grep '$(top_builddir)/bin/')

View file

@ -1,23 +1,14 @@
AC_DEFUN([SPARKLESHARE_CHECK_GTK_SHARP], AC_DEFUN([SPARKLESHARE_CHECK_GTK_SHARP],
[ [
GTKSHARP_REQUIRED=2.12.2 GTKSHARP_REQUIRED=2.99.1
PKG_CHECK_MODULES(GTKSHARP, PKG_CHECK_MODULES(GTKSHARP,
gtk-sharp-2.0 >= $GTKSHARP_REQUIRED) gtk-sharp-3.0 >= $GTKSHARP_REQUIRED)
AC_SUBST(GTKSHARP_LIBS) AC_SUBST(GTKSHARP_LIBS)
PKG_CHECK_MODULES(GLIBSHARP, PKG_CHECK_MODULES(GLIBSHARP,
glib-sharp-2.0 >= $GTKSHARP_REQUIRED) glib-sharp-3.0 >= $GTKSHARP_REQUIRED)
AC_SUBST(GLIBSHARP_LIBS) AC_SUBST(GLIBSHARP_LIBS)
PKG_CHECK_MODULES(GLIBSHARP_2_12_7,
glib-sharp-2.0 >= 2.12.7,
HAVE_GLIBSHARP_2_12_7=yes,
HAVE_GLIBSHARP_2_12_7=no)
AM_CONDITIONAL(HAVE_GLIBSHARP_2_12_7, [test "$HAVE_GLIBSHARP_2_12_7" = "yes"])
PKG_CHECK_MODULES(GTKSHARP_A11Y, gtk-sharp-2.0 >= 2.12.10, gtksharp_with_a11y=yes, gtksharp_with_a11y=no)
AM_CONDITIONAL(ENABLE_ATK, test "x$gtksharp_with_a11y" = "xyes")
]) ])

View file

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
m4_define([sparkleshare_version], [1.2]) m4_define([sparkleshare_version], [1.3])
AC_PREREQ([2.54]) AC_PREREQ([2.54])
AC_INIT([SparkleShare], sparkleshare_version) AC_INIT([SparkleShare], sparkleshare_version)
@ -31,8 +31,6 @@ PKG_CHECK_EXISTS([mono >= 2.8],
[SHAMROCK_FIND_MONO_4_0_COMPILER [SHAMROCK_FIND_MONO_4_0_COMPILER
SHAMROCK_CHECK_MONO_4_0_GAC_ASSEMBLIES([ SHAMROCK_CHECK_MONO_4_0_GAC_ASSEMBLIES([
System System
System.Security
Mono.Posix
])] ])]
) )
@ -59,14 +57,6 @@ if test -z "$CONFIG_REQUESTED" ; then
enable_debug=yes enable_debug=yes
fi fi
dnl package checks, common for all configs
#PKG_CHECK_MODULES([NDESK_DBUS], [ndesk-dbus-1.0])
#AC_SUBST(NDESK_DBUS_LIBS)
#PKG_CHECK_MODULES([NDESK_DBUS_GLIB], [ndesk-dbus-glib-1.0])
#AC_SUBST(NDESK_DBUS_GLIB_LIBS)
SPARKLESHARE_CHECK_GTK_SHARP SPARKLESHARE_CHECK_GTK_SHARP
AC_ARG_ENABLE(appindicator, AC_ARG_ENABLE(appindicator,
@ -76,12 +66,12 @@ AC_ARG_ENABLE(appindicator,
OSNAME=`uname -s` OSNAME=`uname -s`
if test "$OSNAME" = "Linux" ; then if test "$OSNAME" = "Linux" ; then
dnl check for webkit-sharp dnl check for webkitgtk-sharp
PKG_CHECK_MODULES(WEBKIT_SHARP, webkit-sharp-1.0, have_webkit_sharp=yes, have_webkit_sharp=no) PKG_CHECK_MODULES(WEBKITGTK_SHARP, webkitgtk-sharp-3.0, have_webkitgtk_sharp=yes, have_webkitgtk_sharp=no)
if test "x$have_webkit_sharp" = "xno" ; then if test "x$have_webkitgtk_sharp" = "xno" ; then
AC_ERROR("webkit-sharp is a required dependency: you need to install the appropriate devel package before you can compile") AC_ERROR("webkitgtk-sharp is a required dependency: you need to install the appropriate devel package before you can compile")
fi fi
AC_SUBST(WEBKIT_SHARP_LIBS) AC_SUBST(WEBKITGTK_SHARP_LIBS)
dnl check for notify-sharp dnl check for notify-sharp
PKG_CHECK_MODULES(NOTIFY_SHARP, notify-sharp, have_notify_sharp=yes, have_notify_sharp=no) PKG_CHECK_MODULES(NOTIFY_SHARP, notify-sharp, have_notify_sharp=yes, have_notify_sharp=no)
@ -90,19 +80,19 @@ if test "$OSNAME" = "Linux" ; then
fi fi
AC_SUBST(NOTIFY_SHARP_LIBS) AC_SUBST(NOTIFY_SHARP_LIBS)
APPINDICATOR_REQUIRED=0.0.7 APPINDICATOR_REQUIRED=0.1
if test x$enable_appindicator = xauto ; then if test x$enable_appindicator = xauto ; then
PKG_CHECK_EXISTS([appindicator-sharp-0.1 >= $APPINDICATOR_REQUIRED], PKG_CHECK_EXISTS([appindicator3-sharp-0.1 >= $APPINDICATOR_REQUIRED],
enable_appindicator="yes", enable_appindicator="yes",
enable_appindicator="no") enable_appindicator="no")
fi fi
if test x$enable_appindicator = xyes ; then if test x$enable_appindicator = xyes ; then
PKG_CHECK_EXISTS([appindicator-sharp-0.1 >= $APPINDICATOR_REQUIRED],, PKG_CHECK_EXISTS([appindicator3-sharp-0.1 >= $APPINDICATOR_REQUIRED],,
AC_MSG_ERROR([appindicator-sharp-0.1 is not installed])) AC_MSG_ERROR([appindicator3-sharp-0.1 is not installed]))
PKG_CHECK_MODULES(APP_INDICATOR, PKG_CHECK_MODULES(APP_INDICATOR,
appindicator-sharp-0.1 >= $APPINDICATOR_REQUIRED) appindicator3-sharp-0.1 >= $APPINDICATOR_REQUIRED)
AC_SUBST(APP_INDICATOR_CFLAGS) AC_SUBST(APP_INDICATOR_CFLAGS)
AC_SUBST(APP_INDICATOR_LIBS) AC_SUBST(APP_INDICATOR_LIBS)
AC_DEFINE(HAVE_APP_INDICATOR, 1, [Have AppIndicator]) AC_DEFINE(HAVE_APP_INDICATOR, 1, [Have AppIndicator])