diff options
Diffstat (limited to 'src/main-window.vala')
-rw-r--r-- | src/main-window.vala | 58 |
1 files changed, 33 insertions, 25 deletions
diff --git a/src/main-window.vala b/src/main-window.vala index 88c6e7f..621b115 100644 --- a/src/main-window.vala +++ b/src/main-window.vala @@ -70,9 +70,21 @@ public class MainWindow : Gtk.Window var accel_group = new Gtk.AccelGroup (); add_accel_group (accel_group); - var bg_color = Gdk.RGBA (); - bg_color.parse (AGSettings.get_string (AGSettings.KEY_BACKGROUND_COLOR)); - override_background_color (Gtk.StateFlags.NORMAL, bg_color); + Gtk.StyleContext pContext = get_style_context (); + Gtk.CssProvider pProvider = new Gtk.CssProvider (); + string sColour = AGSettings.get_string (AGSettings.KEY_BACKGROUND_COLOR); + string sCss = "* {background-color: %s;}".printf (sColour); + + try + { + pProvider.load_from_data (sCss, -1); + pContext.add_provider (pProvider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + } + catch (Error pError) + { + warning ("Panic: Error loading style for main window: %s", pError.message); + } + get_accessible ().set_name (_("Login Screen")); ArcticaGreeter.add_style_class (this); @@ -117,40 +129,30 @@ public class MainWindow : Gtk.Window login_box.add (content_box); var content_align = AGSettings.get_string(AGSettings.KEY_CONTENT_ALIGN); - var x_align = 0.5f; + var x_align = Gtk.Align.CENTER; if (content_align == "left") { - x_align = 0.0f; + x_align = Gtk.Align.START; } else if (content_align == "right") { - x_align = 1.0f; + x_align = Gtk.Align.END; } - var align = new Gtk.Alignment (x_align, 0.0f, 0.0f, 1.0f); + hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); + hbox.expand = true; + hbox.show (); + hbox.halign = x_align; + hbox.valign = Gtk.Align.CENTER; if (content_align == "center") { // offset for back button - align.margin_end = greeter.grid_size; + hbox.margin_end = greeter.grid_size; } - align.show (); - content_box.add (align); - - hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); - hbox.expand = true; - hbox.show (); - align.add (hbox); - - align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 0.0f); - align.resize_mode = Gtk.ResizeMode.QUEUE; - align.set_size_request (greeter.grid_size, -1); - align.margin_bottom = greeter.menubar_height; /* offset for menubar at top */ - align.show (); - hbox.add (align); - + content_box.add (hbox); back_button = new FlatButton (); back_button.get_accessible ().set_name (_("Back")); Gtk.button_set_focus_on_click (back_button, false); @@ -179,8 +181,14 @@ public class MainWindow : Gtk.Window back_button.add (image); back_button.clicked.connect (pop_list); - - align.add (back_button); + back_button.halign = Gtk.Align.CENTER; + back_button.valign = Gtk.Align.CENTER; + back_button.hexpand = false; + back_button.vexpand = false; + back_button.resize_mode = Gtk.ResizeMode.QUEUE; + back_button.set_size_request (greeter.grid_size, -1); + back_button.margin_bottom = greeter.menubar_height; + hbox.add (back_button); stack = new ListStack (); stack.show (); |