diff --git a/lib/SettingsPage.vala b/lib/SettingsPage.vala index e7e19453..663f013f 100644 --- a/lib/SettingsPage.vala +++ b/lib/SettingsPage.vala @@ -40,9 +40,9 @@ public abstract class Switchboard.SettingsPage : Gtk.Widget { public string status { get; construct set; } /** - * An icon name to be displayed in a Granite.SettingsSidebar + * An icon to be displayed in the header and sidebar */ - public string? icon_name { get; construct set; } + public Icon icon { get; construct set; default = new ThemedIcon ("preferences-other"); } /** * A title to be displayed in a Granite.SettingsSidebar @@ -90,7 +90,7 @@ public abstract class Switchboard.SettingsPage : Gtk.Widget { } construct { - var header_icon = new Gtk.Image.from_icon_name (icon_name) { + var header_icon = new Gtk.Image.from_gicon (icon) { icon_size = Gtk.IconSize.LARGE, valign = Gtk.Align.START }; @@ -161,9 +161,9 @@ public abstract class Switchboard.SettingsPage : Gtk.Widget { grid.append (action_bar); grid.set_parent (this); - notify["icon-name"].connect (() => { + notify["icon"].connect (() => { if (header_icon != null) { - header_icon.icon_name = icon_name; + header_icon.gicon = icon; } }); diff --git a/lib/SettingsSidebarRow.vala b/lib/SettingsSidebarRow.vala index 560ea9de..cdef4254 100644 --- a/lib/SettingsSidebarRow.vala +++ b/lib/SettingsSidebarRow.vala @@ -32,15 +32,15 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { public unowned SettingsPage page { get; construct; } - public string icon_name { + private Icon _icon; + public Icon icon { get { - return _icon_name; + return _icon; } set { - _icon_name = value; + _icon = value; if (display_widget is Gtk.Image) { - ((Gtk.Image) display_widget).icon_name = value; - ((Gtk.Image) display_widget).icon_size = Gtk.IconSize.LARGE; + ((Gtk.Image) display_widget).gicon = value; } } } @@ -65,7 +65,6 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { private Gtk.Image status_icon; private Gtk.Label status_label; private Gtk.Label title_label; - private string _icon_name; private string _title; public SettingsSidebarRow (SettingsPage page) { @@ -96,9 +95,11 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { }; status_label.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL); - if (page.icon_name != null) { - display_widget = new Gtk.Image (); - icon_name = page.icon_name; + if (page.icon != null) { + display_widget = new Gtk.Image () { + icon_size = LARGE + }; + icon = page.icon; } else { display_widget = page.display_widget; } @@ -115,7 +116,7 @@ private class Switchboard.SettingsSidebarRow : Gtk.ListBoxRow { child = grid; header = page.header; - page.bind_property ("icon-name", this, "icon-name", BindingFlags.DEFAULT); + page.bind_property ("icon", this, "icon", BindingFlags.DEFAULT); page.bind_property ("status", this, "status", BindingFlags.DEFAULT); page.bind_property ("status-type", this, "status-type", BindingFlags.DEFAULT); page.bind_property ("title", this, "title", BindingFlags.DEFAULT);