elementaryart team mailing list archive
-
elementaryart team
-
Mailing list archive
-
Message #02099
[Merge] lp:~victored/granite/lp-1002050 into lp:granite
Victor Eduardo has proposed merging lp:~victored/granite/lp-1002050 into lp:granite.
Requested reviews:
elementary Pantheon team (elementary-pantheon)
Related bugs:
Bug #1002050 in Granite: "LightWindow theming is broken"
https://bugs.launchpad.net/granite/+bug/1002050
For more details, see:
https://code.launchpad.net/~victored/granite/lp-1002050/+merge/107910
This branch fixes bug #1002050 by passing and setting the style classes at construct time.
I've had no problems using custom theming for DecoratedWindow on Noise, but for some reason it didn't work well for the LightWindow class. Probably a bug in GTK+?
--
https://code.launchpad.net/~victored/granite/lp-1002050/+merge/107910
Your team elementaryart (old) is subscribed to branch lp:granite.
=== modified file 'lib/Widgets/AboutDialog.vala'
--- lib/Widgets/AboutDialog.vala 2012-05-22 08:15:07 +0000
+++ lib/Widgets/AboutDialog.vala 2012-05-30 03:44:19 +0000
@@ -97,7 +97,10 @@
var draw_ref = new Gtk.Window ();
draw_ref.get_style_context ().add_class (STYLE_CLASS_CONTENT_VIEW_WINDOW);
- DecoratedWindow.set_default_theming (draw_ref, action_area);
+
+ // Apply DecoratedWindow's theming
+ DecoratedWindow.set_default_theming (draw_ref);
+
action_area.get_style_context ().add_class (STYLE_CLASS_CONTENT_VIEW);
this.decorated = false;
=== modified file 'lib/Widgets/DecoratedWindow.vala'
--- lib/Widgets/DecoratedWindow.vala 2012-05-20 20:44:51 +0000
+++ lib/Widgets/DecoratedWindow.vala 2012-05-30 03:44:19 +0000
@@ -27,44 +27,38 @@
public class DecoratedWindow : CompositedWindow {
- const string DECORATED_WINDOW_STYLESHEET = """
+ const string DECORATED_WINDOW_FALLBACK_STYLESHEET = """
.decorated-window {
+ border-style:solid;
+ border-color:alpha (#000, 0.35);
background-image:none;
background-color:@bg_color;
border-radius:6px;
- border-width:1px;
- border-style:solid;
- border-color:alpha (#000, 0.35);
- }
- """;
-
- const string DECORATED_WINDOW_WORKAROUNDS_STYLESHEET = """
- .decorated-window * {
- background-image:none;
- background-color:alpha (#fff, 0.0);
- }
- """;
-
- public static void set_default_theming (Gtk.Window ref_window, Gtk.Widget content) {
- var window_css_provider = new Gtk.CssProvider ();
- var content_css_provider = new Gtk.CssProvider ();
+ }
+ """;
+
+ // Currently not overridable
+ const string DECORATED_WINDOW_STYLESHEET = """
+ .decorated-window { border-width:1px; }
+ """;
+
+ public static void set_default_theming (Gtk.Window ref_window) {
+ var normal_style = new Gtk.CssProvider ();
+ var fallback_style = new Gtk.CssProvider ();
try {
- window_css_provider.load_from_data (DECORATED_WINDOW_STYLESHEET, -1);
- content_css_provider.load_from_data (DECORATED_WINDOW_WORKAROUNDS_STYLESHEET, -1);
+ normal_style.load_from_data (DECORATED_WINDOW_STYLESHEET, -1);
+ fallback_style.load_from_data (DECORATED_WINDOW_FALLBACK_STYLESHEET, -1);
} catch (Error e) {
warning (e.message);
}
ref_window.get_style_context ().add_class (STYLE_CLASS_DECORATED_WINDOW);
- ref_window.get_style_context ().add_provider (window_css_provider, Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
- // Add workarounds
- content.get_style_context ().add_class (STYLE_CLASS_DECORATED_WINDOW);
- content.get_style_context ().add_provider (content_css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION );
+ ref_window.get_style_context ().add_provider (normal_style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
+ ref_window.get_style_context ().add_provider (fallback_style, Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
}
-
bool _show_close_button = true;
public bool show_close_button {
get {
@@ -115,7 +109,7 @@
set { _title.label = value; }
}
- public DecoratedWindow (string title = "") {
+ public DecoratedWindow (string title = "", string? window_style = null, string? content_style = null) {
this.resizable = true;
this.has_resize_grip = false;
this.window_position = Gtk.WindowPosition.CENTER_ON_PARENT;
@@ -130,7 +124,14 @@
this.draw_ref = new Gtk.Window ();
// set theming
- set_default_theming (draw_ref, box);
+ set_default_theming (draw_ref);
+
+ // extra theming
+ if (window_style != null && window_style != "")
+ draw_ref.get_style_context ().add_class (window_style);
+
+ if (content_style != null && content_style != "")
+ box.get_style_context ().add_class (content_style);
close_img = get_close_pixbuf ();
@@ -144,11 +145,12 @@
box.pack_start (_title, false);
+ box.margin = SHADOW_BLUR + 1; // SHADOW_BLUR + border_width
+
base.add (this.box);
-
- this.box.margin = SHADOW_BLUR + 1;
}
+
public new void add (Gtk.Widget w) {
this.box.pack_start (w);
}
=== modified file 'lib/Widgets/LightWindow.vala'
--- lib/Widgets/LightWindow.vala 2012-05-18 17:13:53 +0000
+++ lib/Widgets/LightWindow.vala 2012-05-30 03:44:19 +0000
@@ -21,12 +21,14 @@
*/
namespace Granite.Widgets {
+
public class LightWindow : DecoratedWindow {
- public LightWindow (string title="") {
- base (title);
- box.get_style_context ().add_class (STYLE_CLASS_CONTENT_VIEW);
- draw_ref.get_style_context ().add_class (STYLE_CLASS_CONTENT_VIEW_WINDOW);
+ public LightWindow (string title = "") {
+ base (title, STYLE_CLASS_CONTENT_VIEW_WINDOW, STYLE_CLASS_CONTENT_VIEW);
}
+
}
+
}
+
Follow ups