about: Fix background image

This commit is contained in:
Hylke Bons 2016-03-06 14:37:21 +00:00
parent 0800654747
commit 45b7c3230c
4 changed files with 29 additions and 37 deletions

View file

@ -33,7 +33,8 @@ namespace SparkleShare {
IconName = "sparkleshare"; IconName = "sparkleshare";
Resizable = false; Resizable = false;
WindowPosition = WindowPosition.Center; WindowPosition = WindowPosition.CenterAlways;
TypeHint = Gdk.WindowTypeHint.Dialog;
SetSizeRequest (600, 260); SetSizeRequest (600, 260);
@ -76,54 +77,45 @@ namespace SparkleShare {
private void CreateAbout () private void CreateAbout ()
{ {
Gdk.RGBA white = new Gdk.RGBA (); CssProvider window_css_provider = new CssProvider ();
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 ();
Image image = SparkleUIHelpers.GetImage("about.png"); Image image = SparkleUIHelpers.GetImage("about.png");
css_provider.LoadFromData ("GtkWindow {" + window_css_provider.LoadFromData ("GtkWindow {" +
"background-image: url('" + image.File + "');" + "background-image: url('" + image.File + "');" +
"background-repeat: no-repeat;" + "background-repeat: no-repeat;" +
"background-position: left bottom;" + "background-position: left bottom;" +
"}"); "}");
StyleContext.AddProvider (css_provider, 800); StyleContext.AddProvider (window_css_provider, 800);
VBox layout_vertical = new VBox (false, 0); VBox layout_vertical = new VBox (false, 0);
HBox links_layout = new HBox (false, 16); HBox links_layout = new HBox (false, 16);
CssProvider label_css_provider = new CssProvider ();
label_css_provider.LoadFromData ("GtkLabel { color: #fff; font-size: 10px; background-color: rgba(0, 0, 0, 0); }");
CssProvider label_highlight_css_provider = new CssProvider ();
label_highlight_css_provider.LoadFromData ("GtkLabel { color: #a8bbcf; font-size: 10px; }");
Label version = new Label () { Label version = new Label () {
Text = "version " + Controller.RunningVersion, Text = "version " + Controller.RunningVersion,
Xalign = 0, Xpad = 0 Xalign = 0, Xpad = 0
}; };
version.OverrideFont (font); version.StyleContext.AddProvider (label_css_provider, 800);
version.OverrideColor (StateFlags.Normal, white);
this.updates = new Label ("Checking for updates…") { this.updates = new Label ("Checking for updates…") {
Xalign = 0, Xpad = 0 Xalign = 0, Xpad = 0
}; };
this.updates.OverrideFont (font); this.updates.StyleContext.AddProvider (label_highlight_css_provider, 800);
this.updates.OverrideColor (StateFlags.Normal, highlight);
Label copyright = new Label () { Label copyright = new Label () {
Markup = string.Format ("Copyright © 2010{0} Hylke Bons and others.", DateTime.Now.Year), Markup = string.Format ("Copyright © 2010{0} Hylke Bons and others.", DateTime.Now.Year),
Xalign = 0, Xpad = 0 Xalign = 0, Xpad = 0
}; };
copyright.OverrideFont (font); copyright.StyleContext.AddProvider (label_css_provider, 800);
copyright.OverrideColor (StateFlags.Normal, white);
TextView license = new TextView (); TextView license = new TextView ();
@ -134,9 +126,7 @@ namespace SparkleShare {
license_buffer.Text = "SparkleShare is Open Source and youre free to use, change, " + license_buffer.Text = "SparkleShare is Open Source and youre free to use, change, " +
"and share it under the GNU GPLv3."; "and share it under the GNU GPLv3.";
license.OverrideBackgroundColor (StateFlags.Normal, new Gdk.RGBA () { Alpha = 0 }); version.StyleContext.AddProvider (label_css_provider, 800);
license.OverrideFont (font);
license.OverrideColor (StateFlags.Normal, white);
SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress); SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
@ -174,12 +164,7 @@ namespace SparkleShare {
CanFocus = false; CanFocus = false;
CssProvider css_provider = new CssProvider (); CssProvider css_provider = new CssProvider ();
css_provider.LoadFromData ("GtkLabel { color: #729fcf; font-size: 10px; }");
css_provider.LoadFromData ("GtkLabel {" +
"color: #729fcf;" +
"cursor: pointer;" +
"}");
StyleContext.AddProvider (css_provider, 800); StyleContext.AddProvider (css_provider, 800);
} }
} }

View file

@ -44,6 +44,8 @@ namespace SparkleShare {
{ {
SetWmclass ("SparkleShare", "SparkleShare"); SetWmclass ("SparkleShare", "SparkleShare");
TypeHint = Gdk.WindowTypeHint.Dialog;
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));
@ -66,8 +68,9 @@ namespace SparkleShare {
this.content_wrapper = new EventBox (); this.content_wrapper = new EventBox ();
this.scrolled_window = new ScrolledWindow (); this.scrolled_window = new ScrolledWindow ();
this.content_wrapper.OverrideBackgroundColor (StateFlags.Normal, CssProvider css_provider = new CssProvider ();
new Gdk.RGBA () { Red = 1, Green = 1, Blue=1, Alpha = 1 }); css_provider.LoadFromData ("GtkEventBox { background-color: #ffffff; }");
this.content_wrapper.StyleContext.AddProvider (css_provider, 800);
// this.web_view = new WebView () { Editable = false }; // this.web_view = new WebView () { Editable = false };
// this.web_view.Settings.EnablePlugins = false; // this.web_view.Settings.EnablePlugins = false;
@ -245,8 +248,11 @@ namespace SparkleShare {
html = html.Replace ("<!-- $body-font-family -->", StyleContext.GetFont (StateFlags.Normal).Family); html = html.Replace ("<!-- $body-font-family -->", StyleContext.GetFont (StateFlags.Normal).Family);
html = html.Replace ("<!-- $body-font-size -->", (double) (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px"); html = html.Replace ("<!-- $body-font-size -->", (double) (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px");
html = html.Replace ("<!-- $body-color -->", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Normal))); html = html.Replace ("<!-- $body-color -->", SparkleUIHelpers.RGBAToHex (StyleContext.GetColor (StateFlags.Normal)));
html = html.Replace ("<!-- $body-background-color -->", // html = html.Replace ("<!-- $body-background-color -->",
SparkleUIHelpers.RGBAToHex (new TreeView ().StyleContext.GetBackgroundColor (StateFlags.Normal))); // SparkleUIHelpers.RGBAToHex (new TreeView ().StyleContext.GetStyleProperty ("background-color")));
Console.WriteLine(new TreeView ().StyleContext.GetStyleProperty ("background-color"));
Console.WriteLine(StyleContext.GetStyleProperty ("color"));
html = html.Replace ("<!-- $day-entry-header-font-size -->", (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px"); html = html.Replace ("<!-- $day-entry-header-font-size -->", (StyleContext.GetFont (StateFlags.Normal).Size / 1024 + 3) + "px");
html = html.Replace ("<!-- $day-entry-header-background-color -->", html = html.Replace ("<!-- $day-entry-header-background-color -->",

View file

@ -31,7 +31,7 @@ namespace SparkleShare {
IconName = "sparkleshare"; IconName = "sparkleshare";
Resizable = false; Resizable = false;
WindowPosition = WindowPosition.Center; WindowPosition = WindowPosition.CenterAlways;
BorderWidth = 16; BorderWidth = 16;
SetSizeRequest (480, 120); SetSizeRequest (480, 120);

View file

@ -36,7 +36,7 @@ namespace SparkleShare {
IconName = "sparkleshare"; IconName = "sparkleshare";
Resizable = false; Resizable = false;
WindowPosition = WindowPosition.Center; WindowPosition = WindowPosition.CenterAlways;
Deletable = false; Deletable = false;
TypeHint = Gdk.WindowTypeHint.Dialog; TypeHint = Gdk.WindowTypeHint.Dialog;
@ -153,3 +153,4 @@ namespace SparkleShare {
} }
} }
} }