Merge lp:~tombeckmann/granite/decoratedwindow-dialog into lp:granite

Proposed by Tom Beckmann on 2013-01-14
Status: Work in progress
Proposed branch: lp:~tombeckmann/granite/decoratedwindow-dialog
Merge into: lp:granite
Diff against target: 78 lines (+12/-6) 3 files modified
To merge this branch: bzr merge lp:~tombeckmann/granite/decoratedwindow-dialog
Reviewer Review Type Date Requested Status
Cody Garver 2013-01-14 Needs Fixing on 2013-01-14
Review via email: mp+143147@code.launchpad.net

Description of the Change

Inherit from GtkDialog, so we get the escape closing and the wm knows what kind of window we actually got.

To post a comment you must log in.
Cody Garver (codygarver) wrote :

When I launched Noise and right clicked on a playlist to access a lightwindow everything froze.

review: Needs Fixing
Victor Martinez (victored) wrote :

Good call.

Diff line 63 is not needed, since Utils.set_theming will add the style class as well:
63 + this.get_style_context ().add_class (StyleClass.COMPOSITED);

Since this change implies an API/ABI break, you could post-pone the merge until Luna is released.

Rico Tzschichholz (ricotz) wrote :

If I got this right then just set the type_hint to DIALOG and move the Escape-Key handling from LightWindow up to DecoratedWindow which will accomplish that without breaking things.

Unmerged revisions

518. By Tom Beckmann on 2013-01-14

Remove tabs

517. By Tom Beckmann on 2013-01-14

decoratedwindow: inherited from GtkDialog to gain the close-on-escape and help the wm

Preview Diff

1=== modified file 'demo/main.vala'
2--- demo/main.vala 2012-11-30 18:06:35 +0000
3+++ demo/main.vala 2013-01-14 17:09:26 +0000
4@@ -343,7 +343,7 @@
5 }
6
7 private void show_light_window () {
8- var light_window = new Granite.Widgets.LightWindow ();
9+ var light_window = new Granite.Widgets.LightWindow ("Properties");
10
11 var light_window_notebook = new Granite.Widgets.StaticNotebook ();
12 var entry = new Gtk.Entry ();
13@@ -385,8 +385,6 @@
14 open_drop.append ("audience", "Audience");
15 open_drop.active = 0;
16 grid.margin = 12;
17- grid.margin_top = 24;
18- grid.margin_bottom = 24;
19 entry.text = "Cool Hand Luke";
20 general.column_spacing = 6;
21 general.row_spacing = 6;
22
23=== modified file 'lib/Widgets/CompositedWindow.vala'
24--- lib/Widgets/CompositedWindow.vala 2012-12-21 00:46:56 +0000
25+++ lib/Widgets/CompositedWindow.vala 2013-01-14 17:09:26 +0000
26@@ -25,7 +25,7 @@
27 */
28 public class CompositedWindow : Gtk.Window, Gtk.Buildable {
29
30- private const string STYLESHEET =
31+ internal static const string STYLESHEET =
32 ".composited { background-color: rgba (0,0,0,0); }";
33
34 construct {
35
36=== modified file 'lib/Widgets/DecoratedWindow.vala'
37--- lib/Widgets/DecoratedWindow.vala 2012-12-21 00:46:56 +0000
38+++ lib/Widgets/DecoratedWindow.vala 2013-01-14 17:09:26 +0000
39@@ -25,7 +25,7 @@
40 /**
41 * This class is a standard decorated window.
42 */
43- public class DecoratedWindow : CompositedWindow {
44+ public class DecoratedWindow : Gtk.Dialog {
45
46 const string DECORATED_WINDOW_FALLBACK_STYLESHEET = """
47 .decorated-window {
48@@ -90,6 +90,9 @@
49 * @param content_style style to set content to
50 */
51 public DecoratedWindow (string title = "", string? window_style = null, string? content_style = null) {
52+ this.app_paintable = true;
53+ this.set_visual (Gdk.Screen.get_default ().get_rgba_visual ());
54+ this.decorated = false;
55 this.resizable = false;
56 this.has_resize_grip = false;
57 this.window_position = Gtk.WindowPosition.CENTER_ON_PARENT;
58@@ -124,6 +127,11 @@
59
60 this.draw_ref = new Gtk.Window ();
61
62+ // make our window transparent
63+ this.get_style_context ().add_class (StyleClass.COMPOSITED);
64+ Utils.set_theming (this, CompositedWindow.STYLESHEET, StyleClass.COMPOSITED,
65+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
66+
67 // set theming
68 set_default_theming (this.draw_ref);
69
70@@ -135,7 +143,7 @@
71 this.box.get_style_context ().add_class (content_style);
72
73 this.box.pack_start (this._title, false);
74- base.add (this.box);
75+ get_content_area ().add (this.box);
76
77 this.add_events (Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.POINTER_MOTION_MASK);
78 this.motion_notify_event.connect (on_motion_notify);

Subscribers

People subscribed via source and target branches