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;
[assembly:AssemblyTitle ("SparkleLib")]
[assembly:AssemblyVersion ("1.2")]
[assembly:AssemblyVersion ("1.3")]
[assembly:AssemblyCopyright ("Copyright (c) 2010 Hylke Bons and others")]
[assembly:AssemblyTrademark ("SparkleShare is a trademark of SparkleShare Ltd.")]

View file

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

View file

@ -14,7 +14,7 @@
height="260"
width="640"
version="1.1"
inkscape:version="0.48.2 r9819"
inkscape:version="0.48.4 r9939"
sodipodi:docname="about-dialog.svg">
<sodipodi:namedview
pagecolor="#ffffff"
@ -34,11 +34,11 @@
fit-margin-right="0"
fit-margin-bottom="0"
showborder="false"
inkscape:zoom="1"
inkscape:cx="172.52608"
inkscape:cy="90.406735"
inkscape:zoom="0.5"
inkscape:cx="454.44819"
inkscape:cy="126.31199"
inkscape:window-x="310"
inkscape:window-y="75"
inkscape:window-y="63"
inkscape:window-maximized="0"
inkscape:current-layer="layer1" />
<defs
@ -60,29 +60,6 @@
stop-color="#3465a4"
offset="1" />
</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
id="linearGradient101494"
x1="437.70999"
@ -2074,11 +2051,52 @@
xlink:href="#linearGradient75956"
id="linearGradient8143"
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)"
x1="437.70999"
y1="553.48291"
x2="437.70999"
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>
<metadata
id="metadata7">
@ -2098,21 +2116,21 @@
<g
id="g101011"
transform="translate(-65.909,-78.641)"
clip-path="url(#clipPath101490)"
inkscape:export-filename="/Users/hbons/Projects/SparkleShare/SparkleShare/Common/Pixmaps/about@2x.png"
clip-path="url(#clipPath4254)"
inkscape:export-filename="/home/hylke/Projects/SparkleShare/SparkleShare/Common/Pixmaps/about@2x.png"
inkscape:export-xdpi="180"
inkscape:export-ydpi="180">
<rect
id="rect3322-0"
height="500"
width="1024"
width="1130"
y="409.51001"
x="-209.11"
style="fill:url(#linearGradient8143)" />
<g
id="g76634"
transform="matrix(0.94303,1.2396,1.2483,-0.93649,-1175.4,1042)"
clip-path="url(#clipPath76786)"
clip-path="none"
style="opacity:0.3">
<path
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"
inkscape:connector-curvature="0" />
</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
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
TARGET = exe
LINK = $(REF_SPARKLESHARE) $(NOTIFY_SHARP_LIBS) $(WEBKIT_SHARP_LIBS)
LINK = $(REF_SPARKLESHARE) $(NOTIFY_SHARP_LIBS) $(WEBKITGTK_SHARP_LIBS)
if HAVE_APP_INDICATOR
BUILD_DEFINES="-define:HAVE_APP_INDICATOR"
@ -12,6 +12,7 @@ endif
SOURCES = \
../Program.cs \
../SparkleAboutController.cs \
../SparkleAvatars.cs \
../SparkleBubblesController.cs \
../SparkleControllerBase.cs \
../SparkleEventLogController.cs \
@ -22,13 +23,11 @@ SOURCES = \
../SparkleSetupController.cs \
../SparkleStatusIconController.cs \
SparkleAbout.cs \
../SparkleAvatars.cs \
SparkleBubbles.cs \
SparkleController.cs \
SparkleEventLog.cs \
SparkleSetup.cs \
SparkleSetupWindow.cs \
SparkleSpinner.cs \
SparkleStatusIcon.cs \
SparkleUI.cs \
SparkleUIHelpers.cs

View file

@ -13,17 +13,16 @@ system_theme_icons = \
apps,sparkleshare-256.png \
apps,sparkleshare-32.png \
apps,sparkleshare-48.png \
status,process-syncing-up-24.png \
status,process-syncing-down-24.png \
status,process-syncing-24.png \
status,process-syncing-error-24.png \
status,process-syncing-up-48.png \
status,process-syncing-down-48.png \
status,process-syncing-48.png \
status,process-syncing-error-48.png
status,process-syncing-up-24.png \
status,process-syncing-down-24.png \
status,process-syncing-24.png \
status,process-syncing-error-24.png \
status,process-syncing-up-48.png \
status,process-syncing-down-48.png \
status,process-syncing-48.png \
status,process-syncing-error-48.png
app_theme_icons = \
animations,process-working-22.png \
status,document-added-12.png \
status,document-edited-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.Diagnostics;
using Gtk;
using Mono.Unix;
namespace SparkleShare {
@ -30,25 +27,15 @@ namespace SparkleShare {
private Label updates;
public SparkleAbout () : base ("")
public SparkleAbout () : base ("About SparkleShare")
{
DefaultSize = new Gdk.Size (600, 260);
SetWmclass ("SparkleShare", "SparkleShare");
IconName = "sparkleshare";
Resizable = false;
BorderWidth = 0;
IconName = "folder-sparkleshare";
WindowPosition = WindowPosition.Center;
Title = "About SparkleShare";
AppPaintable = true;
string image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine ();
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 ();
SetSizeRequest (600, 260);
DeleteEvent += delegate (object o, DeleteEventArgs args) {
@ -65,9 +52,7 @@ namespace SparkleShare {
};
Controller.HideWindowEvent += delegate {
Application.Invoke (delegate {
HideAll ();
});
Application.Invoke (delegate { Hide (); });
};
Controller.ShowWindowEvent += delegate {
@ -79,104 +64,119 @@ namespace SparkleShare {
Controller.UpdateLabelEvent += delegate (string text) {
Application.Invoke (delegate {
this.updates.Markup = String.Format ("<span font_size='small' fgcolor='#8cc4ff'>{0}</span>", text);
this.updates.ShowAll ();
this.updates.Text = text;
this.updates.ShowAll();
});
};
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 () {
Markup = string.Format ("<span font_size='small' fgcolor='white'>version {0}</span>",
Controller.RunningVersion),
Xalign = 0,
Xpad = 300
Text = "version " + Controller.RunningVersion,
Xalign = 0, Xpad = 0
};
this.updates = new Label () {
Markup = "<span font_size='small' fgcolor='#729fcf'>Checking for updates...</span>",
Xalign = 0,
Xpad = 300
version.OverrideFont (font);
version.OverrideColor (StateFlags.Normal, white);
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 () {
Markup = "<span font_size='small' fgcolor='white'>" +
"Copyright © 2010" + DateTime.Now.Year + " " +
"Hylke Bons and others." +
"</span>",
Xalign = 0,
Xpad = 300
Markup = string.Format ("Copyright © 2010{0} Hylke Bons and others.", DateTime.Now.Year),
Xalign = 0, Xpad = 0
};
Label license = new Label () {
LineWrap = true,
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,
};
copyright.OverrideFont (font);
copyright.OverrideColor (StateFlags.Normal, white);
VBox layout_vertical = new VBox (false, 0) {
BorderWidth = 0,
HeightRequest = 260,
WidthRequest = 640
};
HBox links_layout = new HBox (false, 6);
SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
TextView license = new TextView ();
TextBuffer license_buffer = license.Buffer;
license.WrapMode = WrapMode.Word;
license.Sensitive = false;
license_buffer.Text = "SparkleShare is Open Source and youre free to use, change, " +
"and share it under the GNU GPLv3.";
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 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);
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);
SparkleLink debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);
layout_vertical.PackStart (new Label (""), true, true, 0);
layout_vertical.PackStart (version, false, false, 0);
layout_vertical.PackStart (this.updates, false, false, 0);
layout_vertical.PackStart (copyright, false, false, 9);
layout_vertical.PackStart (license, false, false, 0);
layout_vertical.PackStart (links_layout, false, false, 12);
Add (layout_vertical);
layout_vertical.PackStart (copyright, false, false, 6);
layout_vertical.PackStart (license, false, false, 6);
layout_vertical.PackStart (links_layout, false, false, 16);
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.Text = text;
}
public override void OpenWebsite (string url)
{
OpenFile (url);
}
}
}

View file

@ -16,15 +16,10 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Gtk;
using Mono.Unix;
using WebKit;
using IO = System.IO;
namespace SparkleShare {
public class SparkleEventLog : Window {
@ -33,84 +28,66 @@ namespace SparkleShare {
private Label size_label;
private Label history_label;
private HBox layout_horizontal;
private ComboBox combo_box;
private HBox combo_box_wrapper;
private EventBox content_wrapper;
private HBox combo_box_wrapper;
private HBox layout_horizontal;
private ScrolledWindow scrolled_window;
private VBox spinner_wrapper;
private Spinner spinner;
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);
SetSizeRequest (480, (int) (monitor_0_rect.Height * 0.8));
int x = (int) (monitor_0_rect.Width * 0.61);
int y = (int) (monitor_0_rect.Height * 0.5 - (HeightRequest * 0.5));
IconName = "sparkleshare";
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;
BorderWidth = 0;
this.size_label.SetSizeRequest (100, 24);
Title = "Recent Changes";
IconName = "folder-sparkleshare";
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);
HBox layout_sizes = new HBox (false, 0);
layout_sizes.PackStart (this.size_label, false, false, 12);
layout_sizes.PackStart (this.history_label, false, 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.scrolled_window = new ScrolledWindow ();
Gdk.Color white = new Gdk.Color();
Gdk.Color.Parse ("white", ref white);
this.content_wrapper.ModifyBg (StateType.Normal, white);
this.web_view = new WebView () {
Editable = false
};
this.content_wrapper.OverrideBackgroundColor (StateFlags.Normal,
new Gdk.RGBA () { Red = 1, Green = 1, Blue=1, Alpha = 1 });
this.web_view = new WebView () { Editable = false };
this.web_view.NavigationRequested += WebViewNavigationRequested;
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.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);
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);
Add (layout_vertical);
@ -118,7 +95,7 @@ namespace SparkleShare {
Controller.HideWindowEvent += delegate {
Application.Invoke (delegate {
HideAll ();
Hide ();
if (this.content_wrapper.Child != null)
this.content_wrapper.Remove (this.content_wrapper.Child);
@ -127,6 +104,7 @@ namespace SparkleShare {
Controller.ShowWindowEvent += delegate {
Application.Invoke (delegate {
Move (this.pos_x, this.pos_y);
ShowAll ();
Present ();
});
@ -134,8 +112,8 @@ namespace SparkleShare {
Controller.ShowSaveDialogEvent += delegate (string file_name, string target_folder_path) {
Application.Invoke (delegate {
FileChooserDialog dialog = new FileChooserDialog ("Restore from History",
this, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Ok);
FileChooserDialog dialog = new FileChooserDialog ("Restore from History", this,
FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Ok);
dialog.CurrentName = file_name;
dialog.DoOverwriteConfirmation = true;
@ -151,21 +129,15 @@ namespace SparkleShare {
};
Controller.UpdateChooserEvent += delegate (string [] folders) {
Application.Invoke (delegate {
UpdateChooser (folders);
});
Application.Invoke (delegate { UpdateChooser (folders); });
};
Controller.UpdateChooserEnablementEvent += delegate (bool enabled) {
Application.Invoke (delegate {
this.combo_box.Sensitive = enabled;
});
Application.Invoke (delegate { this.combo_box.Sensitive = enabled; });
};
Controller.UpdateContentEvent += delegate (string html) {
Application.Invoke (delegate {
UpdateContent (html);
});
Application.Invoke (delegate { UpdateContent (html); });
};
Controller.ContentLoadingEvent += delegate {
@ -173,33 +145,33 @@ namespace SparkleShare {
if (this.content_wrapper.Child != null)
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.content_wrapper.ShowAll ();
});
};
Controller.UpdateSizeInfoEvent += delegate (string size, string history_size) {
Application.Invoke (delegate {
this.size_label.Markup = "<b>Size:</b> " + size;
this.history_label.Markup = "<b>History:</b> " + history_size;
this.size_label.ShowAll ();
this.history_label.ShowAll ();
this.size_label.Markup = "<b>Size</b> " + size;
this.history_label.Markup = "<b>History</b> " + history_size;
});
};
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)
{
if (folders == null)
@ -226,16 +198,16 @@ namespace SparkleShare {
this.combo_box.Active = 0;
int row = 2;
foreach (string folder in folders) {
foreach (string folder in folders) {
store.AppendValues (folder);
if (folder.Equals (Controller.SelectedFolder))
this.combo_box.Active = 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);
return (item == "---");
};
@ -252,43 +224,50 @@ namespace SparkleShare {
Controller.SelectedFolder = selection;
};
this.combo_box_wrapper.PackStart (new Label (" "), false, false, 9);
this.combo_box_wrapper.PackStart (this.combo_box, true, true, 0);
this.combo_box_wrapper.Add (this.combo_box);
this.combo_box.GrabFocus ();
this.layout_horizontal.BorderWidth = 9;
this.layout_horizontal.PackStart (this.combo_box_wrapper, true, true, 0);
this.layout_horizontal.BorderWidth = 6;
this.layout_horizontal.PackStart (this.combo_box_wrapper, false, false, 0);
this.layout_horizontal.ShowAll ();
}
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 ();
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 ("<!-- $body-font-family -->", "\"" + Style.FontDescription.Family + "\"");
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 ("<!-- $day-entry-header-background-color -->", SparkleUIHelpers.GdkColorToHex (Style.Background (StateType.Normal)));
html = html.Replace ("<!-- $secondary-font-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive)));
html = html.Replace ("<!-- $small-color -->", SparkleUIHelpers.GdkColorToHex (Style.Foreground (StateType.Insensitive)));
html = html.Replace ("<!-- $small-font-size -->", "85%");
html = html.Replace ("<!-- $a-color -->", "#0085cf");
html = html.Replace ("<!-- $body-font-family -->", StyleContext.GetFont (StateFlags.Normal).Family);
html = html.Replace ("<!-- $body-font-size -->", (double) (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px");
html = html.Replace ("<!-- $body-color -->", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Normal)));
html = html.Replace ("<!-- $body-background-color -->",
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 ("<!-- $document-added-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-added.png"));
html = html.Replace ("<!-- $document-edited-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-edited.png"));
html = html.Replace ("<!-- $document-deleted-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-deleted.png"));
html = html.Replace ("<!-- $document-moved-background-image -->", "file://" + IO.Path.Combine (icons_path, "document-moved.png"));
html = html.Replace ("<!-- $document-added-background-image -->", "file://" + new string [] {icons_path, "document-added.png"}.Combine ());
html = html.Replace ("<!-- $document-edited-background-image -->", "file://" + new string [] {icons_path, "document-edited.png"}.Combine ());
html = html.Replace ("<!-- $document-deleted-background-image -->", "file://" + new string [] {icons_path, "document-deleted.png"}.Combine ());
html = html.Replace ("<!-- $document-moved-background-image -->", "file://" + new string [] {icons_path, "document-moved.png"}.Combine ());
this.spinner.Stop ();
this.scrolled_window.Remove (this.web_view);
this.web_view.Dispose ();
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.scrolled_window.Add (this.web_view);
@ -296,5 +275,15 @@ namespace SparkleShare {
this.content_wrapper.Add (this.scrolled_window);
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.IO;
using Gtk;
using Mono.Unix;
@ -31,7 +30,7 @@ namespace SparkleShare {
public SparkleSetup () : base ()
{
Controller.HideWindowEvent += delegate {
Application.Invoke (delegate { HideAll (); });
Application.Invoke (delegate { Hide (); });
};
Controller.ShowWindowEvent += delegate {
@ -55,7 +54,7 @@ namespace SparkleShare {
{
if (type == PageType.Setup) {
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) {
RowSpacing = 6,
@ -117,48 +116,57 @@ namespace SparkleShare {
Add (wrapper);
Controller.CheckSetupPage (name_entry.Text, email_entry.Text);
if (name_entry.Text.Equals (""))
name_entry.GrabFocus ();
else
email_entry.GrabFocus ();
}
if (type == PageType.Add) {
Header = "Wheres your project hosted?";
VBox layout_vertical = new VBox (false, 12);
HBox layout_fields = new HBox (true, 12);
VBox layout_vertical = new VBox (false, 16);
HBox layout_fields = new HBox (true, 32);
VBox layout_address = 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 };
ScrolledWindow scrolled_window = new ScrolledWindow ();
scrolled_window.AddWithViewport (tree);
SparkleTreeView tree_view = new SparkleTreeView (store) { HeadersVisible = false };
ScrolledWindow scrolled_window = new ScrolledWindow () { ShadowType = ShadowType.In };
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
tree.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 0);
tree.Columns [0].Cells [0].Xpad = 6;
tree_view.AppendColumn ("Icon", new Gtk.CellRendererPixbuf (), "pixbuf", 1);
tree_view.Columns [1].Cells [0].Xpad = 4;
// Service column
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.SetCellDataFunc (service_cell, new TreeCellDataFunc (RenderServiceColumn));
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 fgcolor=\"" + SecondaryTextColorSelected + "\">" +
plugin.Description + "</span>" +
"<span fgcolor=\"" + SecondaryTextColor + "\">" + plugin.Description + "</span>" +
"</span>", plugin);
}
tree.AppendColumn (service_column);
tree_view.AppendColumn (service_column);
scrolled_window.Add (tree_view);
Entry address_entry = new Entry () {
Text = Controller.PreviousAddress,
Sensitive = (Controller.SelectedPlugin.Address == null),
ActivatesDefault = true
};
Entry path_entry = new Entry () {
Text = Controller.PreviousPath,
Sensitive = (Controller.SelectedPlugin.Path == null),
@ -180,11 +188,84 @@ namespace SparkleShare {
};
// Select the first plugin by default
TreeSelection default_selection = tree.Selection;
TreePath default_path = new TreePath ("0");
TreeSelection default_selection = tree_view.Selection;
TreePath default_path = new TreePath ("" + Controller.SelectedPluginIndex);
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,
string example_text, FieldState state) {
@ -208,93 +289,22 @@ namespace SparkleShare {
});
};
Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1);
// 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
Controller.UpdateAddProjectButtonEvent += delegate (bool button_enabled) {
Application.Invoke (delegate { add_button.Sensitive = button_enabled; });
};
tree.Model.Foreach (new TreeModelForeachFunc (delegate (TreeModel 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.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;
}
}));
tree_view.CursorChanged += delegate (object sender, EventArgs e) {
Controller.SelectedPluginChanged (tree_view.SelectedRow);
};
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 (); };
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 };
check_button.Toggled += delegate { Controller.HistoryItemChanged (check_button.Active); };
@ -302,7 +312,7 @@ namespace SparkleShare {
AddOption (check_button);
AddButton (cancel_button);
AddButton (add_button);
Controller.CheckAddPage (address_entry.Text, path_entry.Text, 1);
}
@ -460,7 +470,7 @@ namespace SparkleShare {
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,
Xalign = 1
};
@ -545,6 +555,8 @@ namespace SparkleShare {
AddButton (cancel_button);
AddButton (continue_button);
password_entry.GrabFocus ();
}
if (type == PageType.Finished) {
@ -679,20 +691,15 @@ namespace SparkleShare {
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;
if (selection.IterIsSelected (iter)) {
if (column.TreeView.HasFocus)
markup = markup.Replace (SecondaryTextColor, SecondaryTextColorSelected);
else
markup = markup.Replace (SecondaryTextColorSelected, SecondaryTextColor);
} else {
if (selection.IterIsSelected (iter))
markup = markup.Replace (SecondaryTextColor, SecondaryTextColorSelected);
else
markup = markup.Replace (SecondaryTextColorSelected, SecondaryTextColor);
}
(cell as CellRendererText).Markup = markup;
}
@ -704,7 +711,7 @@ namespace SparkleShare {
{
get {
TreeIter iter;
TreeModel model;
ITreeModel model;
Selection.GetSelected (out model, out iter);
return int.Parse (model.GetPath (iter).ToString ());

View file

@ -16,99 +16,72 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text.RegularExpressions;
using System.Timers;
using Gtk;
using Mono.Unix;
namespace SparkleShare {
public class SparkleSetupWindow : Window {
// TODO: caps
private HBox HBox;
private VBox VBox;
private VBox Wrapper;
private VBox OptionArea;
private HBox Buttons;
private EventBox content_area;
private EventBox option_area;
private HBox buttons;
public string Header;
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");
BorderWidth = 0;
IconName = "folder-sparkleshare";
SetWmclass ("SparkleShare", "SparkleShare");
IconName = "sparkleshare";
Resizable = false;
WindowPosition = WindowPosition.Center;
Deletable = false;
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);
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) {
BorderWidth = 0
};
HBox layout_horizontal = new HBox (false, 0);
OptionArea = new VBox (false, 0) {
BorderWidth = 0
};
VBox layout_vertical = new VBox (false, 0);
Buttons = CreateButtonBox ();
this.content_area = new EventBox ();
this.option_area = new EventBox ();
this.buttons = CreateButtonBox ();
HBox layout_horizontal = new HBox (false , 0) {
BorderWidth = 0
};
HBox layout_actions = new HBox (false , 48);
layout_horizontal.PackStart (OptionArea, true, true, 0);
layout_horizontal.PackStart (Buttons, false, false, 0);
layout_actions.PackStart (this.option_area, true, true, 0);
layout_actions.PackStart (this.buttons, false, false, 0);
VBox.PackStart (Wrapper, true, true, 0);
VBox.PackStart (layout_horizontal, 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);
layout_vertical.PackStart (this.content_area, true, true, 0);
layout_vertical.PackStart (layout_actions, false, false, 15);
Image side_splash = SparkleUIHelpers.GetImage ("side-splash.png");
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);
HBox.PackStart (VBox, true, true, 30);
base.Add (HBox);
base.Add (layout_horizontal);
}
@ -116,7 +89,6 @@ namespace SparkleShare {
{
return new HBox () {
BorderWidth = 0,
//Layout = ButtonBoxStyle.End,
Homogeneous = false,
Spacing = 6
};
@ -126,13 +98,13 @@ namespace SparkleShare {
public void AddButton (Button button)
{
(button.Child as Label).Xpad = 15;
Buttons.Add (button);
this.buttons.Add (button);
}
public void AddOption (Widget widget)
{
OptionArea.Add (widget);
this.option_area.Add (widget);
}
@ -160,8 +132,7 @@ namespace SparkleShare {
if (widget != null)
layout_vertical.PackStart (widget, true, true, 0);
Wrapper.PackStart (layout_vertical, true, true, 0);
ShowAll ();
this.content_area.Add (layout_vertical);
}
@ -170,23 +141,21 @@ namespace SparkleShare {
Header = "";
Description = "";
if (OptionArea.Children.Length > 0)
OptionArea.Remove (OptionArea.Children [0]);
if (this.option_area.Children.Length > 0)
this.option_area.Remove (this.option_area.Children [0]);
if (Wrapper.Children.Length > 0)
Wrapper.Remove (Wrapper.Children [0]);
if (this.content_area.Children.Length > 0)
this.content_area.Remove (this.content_area.Children [0]);
foreach (Button button in Buttons)
Buttons.Remove (button);
ShowAll ();
foreach (Button button in this.buttons)
this.buttons.Remove (button);
}
new public void ShowAll ()
{
if (Buttons.Children.Length > 0) {
Button default_button = (Button) Buttons.Children [Buttons.Children.Length - 1];
if (this.buttons.Children.Length > 0) {
Button default_button = (Button) this.buttons.Children [this.buttons.Children.Length - 1];
default_button.CanDefault = true;
Default = default_button;
@ -201,11 +170,11 @@ namespace SparkleShare {
{
return new Gdk.Color (
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) +
second_color.Green * ratio))) / 65535),
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;
#if HAVE_APP_INDICATOR
using AppIndicator;
using AppIndicator3;
#endif
namespace SparkleShare {
@ -34,7 +34,7 @@ namespace SparkleShare {
private MenuItem state_item;
#if HAVE_APP_INDICATOR
private ApplicationIndicator indicator;
private Indicator indicator;
#else
private StatusIcon status_icon;
#endif
@ -43,9 +43,9 @@ namespace SparkleShare {
public SparkleStatusIcon ()
{
#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.Status = Status.Active;
this.indicator.Status = (int) IndicatorStatus.Active;
#else
this.status_icon = new StatusIcon ();
this.status_icon.IconName = "sparkleshare";
@ -76,8 +76,9 @@ namespace SparkleShare {
#if HAVE_APP_INDICATOR
this.indicator.IconName = icon_name;
this.indicator.Status = Status.Attention;
this.indicator.Status = Status.Active;
// Force update of the status icon
this.indicator.Status = (int) IndicatorStatus.Attention;
this.indicator.Status = (int) IndicatorStatus.Active;
#else
this.status_icon.IconName = icon_name;
#endif
@ -151,6 +152,8 @@ namespace SparkleShare {
this.recent_events_item.Sensitive = Controller.RecentEventsItemEnabled;
this.quit_item = new MenuItem ("Quit") { Sensitive = Controller.QuitItemEnabled };
MenuItem add_item = new MenuItem ("Add Hosted Project…");
#if HAVE_APP_INDICATOR
MenuItem notify_item;
if (Program.Controller.NotificationsEnabled)
@ -168,6 +171,7 @@ namespace SparkleShare {
(notify_item.Child as Label).Text = "Turn Notifications On";
});
};
#endif
MenuItem link_code_item = new MenuItem ("Client ID");
@ -195,8 +199,10 @@ namespace SparkleShare {
folder_item.Submenu = new Menu ();
(folder_item.Submenu as Menu).Add (this.recent_events_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 (notify_item);
#endif
(folder_item.Submenu as Menu).Add (new SeparatorMenuItem ());
(folder_item.Submenu as Menu).Add (link_code_item);
(folder_item.Submenu as Menu).Add (new SeparatorMenuItem ());

View file

@ -17,6 +17,7 @@
using System;
using GLib;
using Gtk;
using SparkleLib;
@ -24,33 +25,53 @@ namespace SparkleShare {
public class SparkleUI {
public static string AssetsPath = Defines.INSTALL_DIR;
public SparkleStatusIcon StatusIcon;
public SparkleEventLog EventLog;
public SparkleBubbles Bubbles;
public SparkleSetup Setup;
public SparkleAbout About;
public static string AssetsPath = Defines.INSTALL_DIR;
private Gtk.Application application;
public SparkleUI ()
{
Application.Init ();
this.application = new Gtk.Application ("org.sparkleshare.sparkleshare", 0);
Setup = new SparkleSetup ();
EventLog = new SparkleEventLog ();
About = new SparkleAbout ();
Bubbles = new SparkleBubbles ();
StatusIcon = new SparkleStatusIcon ();
Program.Controller.UIHasLoaded ();
this.application.Register (null);
this.application.Activated += ApplicationActivatedDelegate;
}
// Runs the application
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.
//
// 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.IO;
using Gtk;
namespace SparkleShare {
@ -26,16 +25,10 @@ namespace SparkleShare {
public static Gdk.Pixbuf GetIcon (string name, int size)
{
IconTheme icon_theme = new IconTheme ();
icon_theme.AppendSearchPath (new string [] {SparkleUI.AssetsPath, "icons"}.Combine ());
// foreach (string search_path in IconTheme.Default.SearchPath)
// 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"));
foreach (string search_path in IconTheme.Default.SearchPath)
icon_theme.AppendSearchPath (search_path);
try {
return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback);
@ -60,12 +53,27 @@ namespace SparkleShare {
// Converts a Gdk RGB color to a hex value.
// 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}",
(int) Math.Truncate (color.Red / 256.00),
(int) Math.Truncate (color.Green / 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
fi
if [ "$XDG_RUNTIME_DIR" ]; then
pidfile=${XDG_RUNTIME_DIR}/sparkleshare.pid
else
pidfile=~/.sparkleshare-$(hostname)-${USER}.pid
fi
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
mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 &
else
ssh-agent mono "@expanded_libdir@/@PACKAGE@/SparkleShare.exe" $2 &
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
start|--start)
start
;;
stop|--stop)
stop
;;
restart|--restart)
stop
start
;;
open|--open)
invite=`date -u +%N`
open=`echo $2 | sed 's/sparkleshare:\/\/addProject\///'`

View file

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

View file

@ -36,7 +36,7 @@ namespace SparkleShare {
#endif
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.Win32NT) {
@ -47,13 +47,13 @@ namespace SparkleShare {
"designed to keep things simple and to stay out of your way." + n +
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 +
n +
"This is free software, and you are welcome to redistribute it" + n +
"under certain conditions. Please read the GNU GPLv3 for details." + n +
n +
"Usage: sparkleshare [start|stop|restart]");
"Usage: sparkleshare [start|open]");
Environment.Exit (-1);
}

View file

@ -141,7 +141,7 @@ namespace SparkleShare {
public abstract void OpenFile (string path);
// Opens a file with the appropriate application
public abstract void OpenWebsite (string url);
public virtual void OpenWebsite (string url) { }
// Copies text to the clipboard
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">
<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'
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_GTK = $(GTKSHARP_LIBS)
LINK_GNOME = $(GNOME_SHARP_LIBS)
LINK_DBUS = $(NDESK_DBUS_LIBS) $(NDESK_DBUS_GLIB_LIBS)
LINK_DBUS_NO_GLIB = $(NDESK_DBUS_LIBS)
LINK_WEBKIT = $(WEBKITGTK_SHARP_LIBS)
LINK_APP_INDICATOR = $(APP_INDICATOR_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_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
colon:= :

View file

@ -23,10 +23,6 @@ if ENABLE_TESTS
ENABLE_TESTS_FLAG = "-define:ENABLE_TESTS"
endif
if ENABLE_ATK
ENABLE_ATK_FLAG = "-define:ENABLE_ATK"
endif
FILTERED_LINK = $(shell echo "$(LINK)" | $(UNIQUE_FILTER_PIPE))
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],
[
GTKSHARP_REQUIRED=2.12.2
GTKSHARP_REQUIRED=2.99.1
PKG_CHECK_MODULES(GTKSHARP,
gtk-sharp-2.0 >= $GTKSHARP_REQUIRED)
gtk-sharp-3.0 >= $GTKSHARP_REQUIRED)
AC_SUBST(GTKSHARP_LIBS)
PKG_CHECK_MODULES(GLIBSHARP,
glib-sharp-2.0 >= $GTKSHARP_REQUIRED)
glib-sharp-3.0 >= $GTKSHARP_REQUIRED)
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.
m4_define([sparkleshare_version], [1.2])
m4_define([sparkleshare_version], [1.3])
AC_PREREQ([2.54])
AC_INIT([SparkleShare], sparkleshare_version)
@ -31,8 +31,6 @@ PKG_CHECK_EXISTS([mono >= 2.8],
[SHAMROCK_FIND_MONO_4_0_COMPILER
SHAMROCK_CHECK_MONO_4_0_GAC_ASSEMBLIES([
System
System.Security
Mono.Posix
])]
)
@ -59,14 +57,6 @@ if test -z "$CONFIG_REQUESTED" ; then
enable_debug=yes
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
AC_ARG_ENABLE(appindicator,
@ -76,12 +66,12 @@ AC_ARG_ENABLE(appindicator,
OSNAME=`uname -s`
if test "$OSNAME" = "Linux" ; then
dnl check for webkit-sharp
PKG_CHECK_MODULES(WEBKIT_SHARP, webkit-sharp-1.0, have_webkit_sharp=yes, have_webkit_sharp=no)
if test "x$have_webkit_sharp" = "xno" ; then
AC_ERROR("webkit-sharp is a required dependency: you need to install the appropriate devel package before you can compile")
dnl check for webkitgtk-sharp
PKG_CHECK_MODULES(WEBKITGTK_SHARP, webkitgtk-sharp-3.0, have_webkitgtk_sharp=yes, have_webkitgtk_sharp=no)
if test "x$have_webkitgtk_sharp" = "xno" ; then
AC_ERROR("webkitgtk-sharp is a required dependency: you need to install the appropriate devel package before you can compile")
fi
AC_SUBST(WEBKIT_SHARP_LIBS)
AC_SUBST(WEBKITGTK_SHARP_LIBS)
dnl check for notify-sharp
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
AC_SUBST(NOTIFY_SHARP_LIBS)
APPINDICATOR_REQUIRED=0.0.7
APPINDICATOR_REQUIRED=0.1
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="no")
fi
if test x$enable_appindicator = xyes ; then
PKG_CHECK_EXISTS([appindicator-sharp-0.1 >= $APPINDICATOR_REQUIRED],,
AC_MSG_ERROR([appindicator-sharp-0.1 is not installed]))
PKG_CHECK_EXISTS([appindicator3-sharp-0.1 >= $APPINDICATOR_REQUIRED],,
AC_MSG_ERROR([appindicator3-sharp-0.1 is not installed]))
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_LIBS)
AC_DEFINE(HAVE_APP_INDICATOR, 1, [Have AppIndicator])