aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/org.ArcticaProject.arctica-greeter.gschema.xml9
-rw-r--r--src/main-window.vala44
-rw-r--r--src/settings.vala1
3 files changed, 47 insertions, 7 deletions
diff --git a/data/org.ArcticaProject.arctica-greeter.gschema.xml b/data/org.ArcticaProject.arctica-greeter.gschema.xml
index 0af9d09..67f8e83 100644
--- a/data/org.ArcticaProject.arctica-greeter.gschema.xml
+++ b/data/org.ArcticaProject.arctica-greeter.gschema.xml
@@ -255,5 +255,14 @@
<default>true</default>
<summary>Whether to enable the GeoClue-2.0 agent (enhances ayatana-indicator-display).</summary>
</key>
+ <key name="content-align" type="s">
+ <choices>
+ <choice value='left'/>
+ <choice value='center'/>
+ <choice value='right'/>
+ </choices>
+ <default>'left'</default>
+ <summary>Alignment of the main content</summary>
+ </key>
</schema>
</schemalist>
diff --git a/src/main-window.vala b/src/main-window.vala
index 5332186..ad2700a 100644
--- a/src/main-window.vala
+++ b/src/main-window.vala
@@ -34,6 +34,7 @@ public class MainWindow : Gtk.Window
private Background background;
private Gtk.Box login_box;
private Gtk.Box hbox;
+ private Gtk.Box content_box;
private Gtk.Button back_button;
private ShutdownDialog? shutdown_dialog = null;
private bool do_resize;
@@ -90,12 +91,40 @@ public class MainWindow : Gtk.Window
ArcticaGreeter.add_style_class (menubar);
ArcticaGreeter.add_style_class (menubox);
+ content_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
+ content_box.expand = true;
+ content_box.show ();
+ login_box.add (content_box);
+
+ var content_align = AGSettings.get_string(AGSettings.KEY_CONTENT_ALIGN);
+ var x_align = 0.5f;
+
+ if (content_align == "left")
+ {
+ x_align = 0.0f;
+ }
+ else if (content_align == "right")
+ {
+ x_align = 1.0f;
+ }
+
+ var align = new Gtk.Alignment (x_align, 0.0f, 0.0f, 1.0f);
+
+ if (content_align == "center")
+ {
+ // offset for back button
+ align.margin_right = grid_size;
+ }
+
+ align.show ();
+ content_box.add (align);
+
hbox = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
hbox.expand = true;
hbox.show ();
- login_box.add (hbox);
+ align.add (hbox);
- var align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 0.0f);
+ align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 0.0f);
// Hack to avoid gtk 3.20's new allocate logic, which messes us up.
align.resize_mode = Gtk.ResizeMode.QUEUE;
align.set_size_request (grid_size, -1);
@@ -185,12 +214,13 @@ public class MainWindow : Gtk.Window
{
base.size_allocate (allocation);
- if (hbox != null)
+ if (content_box != null)
{
- hbox.margin_start = get_grid_offset (get_allocated_width ()) + grid_size;
- hbox.margin_end = get_grid_offset (get_allocated_width ());
- hbox.margin_top = get_grid_offset (get_allocated_height ());
- hbox.margin_bottom = get_grid_offset (get_allocated_height ());
+ var content_align = AGSettings.get_string(AGSettings.KEY_CONTENT_ALIGN);
+ content_box.margin_left = get_grid_offset (get_allocated_width ()) + (content_align == "left" ? grid_size : 0);
+ content_box.margin_right = get_grid_offset (get_allocated_width ()) + (content_align == "right" ? grid_size : 0);
+ content_box.margin_top = get_grid_offset (get_allocated_height ());
+ content_box.margin_bottom = get_grid_offset (get_allocated_height ());
}
}
diff --git a/src/settings.vala b/src/settings.vala
index 8447c0f..7d1ce8f 100644
--- a/src/settings.vala
+++ b/src/settings.vala
@@ -84,6 +84,7 @@ public class AGSettings : Object
public const string KEY_PREFERRED_SESSIONS = "preferred-sessions";
public const string KEY_GEOCLUE_AGENT = "geoclue-agent";
public const string KEY_MAGNIFIER = "magnifier";
+ public const string KEY_CONTENT_ALIGN = "content-align";
public static bool get_boolean (string key)
{