~voldyman/granite/abt-dialog-spacefix

« back to all changes in this revision

Viewing changes to lib/Widgets/DecoratedWindow.vala

  • Committer: Cody Garver
  • Author(s): Victor Eduardo
  • Date: 2012-08-24 02:24:36 UTC
  • mfrom: (355.1.10 granite)
  • Revision ID: codygarver@gmail.com-20120824022436-3e3cbwl0lgwi9xeu
Move common code to Granite.Widgets.Utils, fix mode-button scrolling and add support for elementary's fonts. Fix bug #1017231 and #1021578.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
namespace Granite.Widgets {
24
24
 
25
 
    [CCode (cname="get_close_pixbuf")]
26
 
    public extern Gdk.Pixbuf get_close_pixbuf ();
27
 
 
28
25
    public class DecoratedWindow : CompositedWindow {
29
26
 
30
 
        static const string DECORATED_WINDOW_FALLBACK_STYLESHEET = """
 
27
        const string DECORATED_WINDOW_FALLBACK_STYLESHEET = """
31
28
            .decorated-window {
32
29
                border-style:solid;
33
30
                border-color:alpha (#000, 0.35);
38
35
        """;
39
36
 
40
37
        // Currently not overridable
41
 
        static const string DECORATED_WINDOW_STYLESHEET = """
 
38
        const string DECORATED_WINDOW_STYLESHEET = """
42
39
            .decorated-window { border-width:1px; }
43
40
        """;
44
41
 
45
42
        public static void set_default_theming (Gtk.Window ref_window) {
46
 
            var normal_style = new Gtk.CssProvider ();
47
 
            var fallback_style = new Gtk.CssProvider ();
48
 
 
49
 
            try {
50
 
                normal_style.load_from_data (DECORATED_WINDOW_STYLESHEET, -1);
51
 
                fallback_style.load_from_data (DECORATED_WINDOW_FALLBACK_STYLESHEET, -1);
52
 
            } catch (Error e) {
53
 
                warning (e.message);
54
 
            }
55
 
 
56
 
            ref_window.get_style_context ().add_class (STYLE_CLASS_DECORATED_WINDOW);
57
 
 
58
 
            ref_window.get_style_context ().add_provider (normal_style,
59
 
                                            Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
60
 
            ref_window.get_style_context ().add_provider (fallback_style,
61
 
                                            Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
 
43
            Utils.set_theming (ref_window, DECORATED_WINDOW_STYLESHEET,
 
44
                               STYLE_CLASS_DECORATED_WINDOW,
 
45
                               Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
 
46
 
 
47
            Utils.set_theming (ref_window, DECORATED_WINDOW_FALLBACK_STYLESHEET,
 
48
                               STYLE_CLASS_DECORATED_WINDOW,
 
49
                               Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
62
50
        }
63
51
 
64
52
        public bool show_title { get; set; default = true; }
88
76
            this.has_resize_grip = false;
89
77
            this.window_position = Gtk.WindowPosition.CENTER_ON_PARENT;
90
78
 
91
 
            this.close_img = get_close_pixbuf ();
 
79
            this.close_img = Utils.get_close_pixbuf ();
92
80
 
93
81
            this._title = new Gtk.Label (null);
94
82
            this._title.halign = Gtk.Align.CENTER;