Skip to content

Commit

Permalink
Use Switchboard.SettingsPage (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Feb 3, 2024
1 parent 1497f0e commit 1f5763b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 37 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ on:

jobs:
build:

runs-on: ubuntu-22.04
runs-on: ubuntu-latest

strategy:
fail-fast: false
Expand All @@ -24,7 +23,7 @@ jobs:
- name: Install Dependencies
run: |
apt update
apt install -y meson libgranite-7-dev libgtk-4-dev libswitchboard-3-dev valac
apt install -y meson libadwaita-1-dev libgranite-7-dev libgtk-4-dev libswitchboard-3-dev valac
- name: Build
env:
DESTDIR: out
Expand Down
41 changes: 9 additions & 32 deletions src/Widgets/AppSettingsView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,12 @@
* Boston, MA 02110-1301, USA.
*/

public class Widgets.AppSettingsView : Gtk.Grid {
private Gtk.Image app_image;
private Gtk.Label app_label;

public class Widgets.AppSettingsView : Switchboard.SettingsPage {
private SettingsOption bubbles_option;
private SettingsOption sound_option;
private SettingsOption remember_option;

construct {
app_image = new Gtk.Image () {
pixel_size = 48
};

app_label = new Gtk.Label (null) {
use_markup = true,
halign = Gtk.Align.START,
hexpand = true
};
app_label.add_css_class (Granite.STYLE_CLASS_H2_LABEL);

var header = new Gtk.Grid () {
column_spacing = 12
};
header.attach (app_image, 0, 0);
header.attach (app_label, 1, 0);

bubbles_option = new SettingsOption (
"bubbles",
_("Bubbles"),
Expand All @@ -64,15 +44,12 @@ public class Widgets.AppSettingsView : Gtk.Grid {
new Gtk.Switch ()
);

margin_start = 12;
margin_end = 12;
margin_top = 12;
margin_bottom = 12;
row_spacing = 32;
attach (header, 0, 0);
attach (bubbles_option, 0, 1);
attach (sound_option, 0, 2);
attach (remember_option, 0, 3);
var box = new Gtk.Box (VERTICAL, 32);
box.append (bubbles_option);
box.append (sound_option);
box.append (remember_option);

child = box;

update_selected_app ();

Expand All @@ -97,7 +74,7 @@ public class Widgets.AppSettingsView : Gtk.Grid {
selected_app.settings.bind ("sounds", sound_option.widget, "state", GLib.SettingsBindFlags.DEFAULT);
selected_app.settings.bind ("remember", remember_option.widget, "state", GLib.SettingsBindFlags.DEFAULT);

app_label.label = selected_app.app_info.get_display_name ();
app_image.gicon = selected_app.app_info.get_icon ();
title = selected_app.app_info.get_display_name ();
icon = selected_app.app_info.get_icon ();
}
}
2 changes: 0 additions & 2 deletions src/Widgets/SettingsOption.vala
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public class Widgets.SettingsOption : Gtk.Grid {

column_spacing = 12;
row_spacing = 6;
margin_start = 60;
margin_end = 30;
attach (card, 0, 0, 1, 3);
attach (title_label, 1, 0);
attach (widget, 1, 1);
Expand Down

0 comments on commit 1f5763b

Please sign in to comment.