diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2015-10-27 22:41:27 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2015-10-28 04:45:02 +0100 |
commit | 69a43a87e821c614fd856fd5ea103b9e7e51f984 (patch) | |
tree | 95198c965a7417d1ca85a70f5429eb98f44c3577 /src | |
parent | d1d9cb38295f9c875844c2d2d657f838b9aba59c (diff) | |
download | arctica-greeter-69a43a87e821c614fd856fd5ea103b9e7e51f984.tar.gz arctica-greeter-69a43a87e821c614fd856fd5ea103b9e7e51f984.tar.bz2 arctica-greeter-69a43a87e821c614fd856fd5ea103b9e7e51f984.zip |
Make session list in toggle box configurable concerning font color and button bg color.
Diffstat (limited to 'src')
-rw-r--r-- | src/settings.vala | 2 | ||||
-rw-r--r-- | src/toggle-box.vala | 33 |
2 files changed, 26 insertions, 9 deletions
diff --git a/src/settings.vala b/src/settings.vala index 9aef819..e7e424d 100644 --- a/src/settings.vala +++ b/src/settings.vala @@ -43,6 +43,8 @@ public class AGSettings public static const string KEY_GROUP_FILTER = "group-filter"; public static const string KEY_IDLE_TIMEOUT = "idle-timeout"; public static const string KEY_REMOTE_SERVICE_FQDN = "remote-service-fqdn"; + public static const string KEY_TOGGLEBOX_FONT_FGCOLOR = "togglebox-font-fgcolor"; + public static const string KEY_TOGGLEBOX_BUTTON_BGCOLOR = "togglebox-button-bgcolor"; public static bool get_boolean (string key) { diff --git a/src/toggle-box.vala b/src/toggle-box.vala index f1ef8b3..fc6c579 100644 --- a/src/toggle-box.vala +++ b/src/toggle-box.vala @@ -42,6 +42,23 @@ public class ToggleBox : Gtk.Box add (item); } + public void set_normal_button_style (Gtk.Button button) + { + /* Tighten padding on buttons to not be so large, default color scheme for buttons */ + var style = new Gtk.CssProvider (); + style.load_from_data ("* {padding: 8px;}\n"+ + "GtkButton {\n"+ + " background-color: %s;\n".printf("rgba(0,0,0,0)")+ + " background-image: none;"+ + "}\n"+ + ".button:hover,\n"+ + ".button:hover:active {\n"+ + " background-color: %s;\n".printf(AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BGCOLOR))+ + "}\n", -1); + button.get_style_context ().add_provider (style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + return; + } + private Gtk.Button selected_button; construct @@ -67,19 +84,20 @@ public class ToggleBox : Gtk.Box { if (selected_button != null) { - selected_button.relief = Gtk.ReliefStyle.NONE; selected_button.get_style_context ().remove_class ("selected"); + set_normal_button_style (selected_button); } selected_button = button; - selected_button.relief = Gtk.ReliefStyle.NORMAL; - selected_button.get_style_context ().add_class ("selected"); selected_key = selected_button.get_data<string> ("toggle-list-key"); + + var bg_color = Gdk.RGBA (); + bg_color.parse (AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_BUTTON_BGCOLOR)); + selected_button.override_background_color(Gtk.StateFlags.NORMAL, bg_color); } private Gtk.Button make_button (string key, string name_in, Gdk.Pixbuf? icon) { var item = new FlatButton (); - item.get_style_context ().add_class ("toggle-button"); item.relief = Gtk.ReliefStyle.NONE; item.clicked.connect (button_clicked_cb); @@ -99,7 +117,7 @@ public class ToggleBox : Gtk.Box } var label = new Gtk.Label (null); - label.set_markup ("<span font=\"Cabin 13\">%s</span>".printf (name)); + label.set_markup ("<span font=\"Cabin 13\" fgcolor=\"%s\">%s</span>".printf (AGSettings.get_string (AGSettings.KEY_TOGGLEBOX_FONT_FGCOLOR), name)); label.halign = Gtk.Align.START; hbox.pack_start (label, true, true, 0); @@ -109,10 +127,7 @@ public class ToggleBox : Gtk.Box try { - /* Tighten padding on buttons to not be so large */ - var style = new Gtk.CssProvider (); - style.load_from_data ("* {padding: 8px;}", -1); - item.get_style_context ().add_provider (style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + set_normal_button_style (item); } catch (Error e) { |