Skip to content

Commit b2c6b92

Browse files
committed
Lint and clean up old code
1 parent c3e1cf3 commit b2c6b92

File tree

4 files changed

+13
-51
lines changed

4 files changed

+13
-51
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343

4444
steps:
4545
- name: Checkout
46-
uses: actions/checkout@v2
46+
uses: actions/checkout@v4
4747

4848
- name: Lint
4949
run: io.elementary.vala-lint -d .

src/MainGrid.vala

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ public class Badger.MainGrid : Gtk.Box {
3232
orientation = Gtk.Orientation.VERTICAL;
3333

3434

35-
36-
3735
/************************************************/
3836
/* Switch at top */
3937
/************************************************/
@@ -50,16 +48,15 @@ public class Badger.MainGrid : Gtk.Box {
5048
secondary_text = _("If on, Badger will remind you to take care of yourself")
5149
};
5250

53-
global_box.append(heading);
54-
global_box.append(global_switch);
51+
global_box.append (heading);
52+
global_box.append (global_switch);
5553
append (global_box);
5654

5755

5856
/************************************************/
5957
/* Label to explain */
6058
/************************************************/
6159

62-
6360
var subheading = new Gtk.Label (_ ("Decide how often Badger should remind you to relax these:")) {
6461
halign = Gtk.Align.START,
6562
margin_top = 18,
@@ -96,13 +93,10 @@ public class Badger.MainGrid : Gtk.Box {
9693
});
9794

9895

99-
10096
/************************************************/
10197
/* All the scales */
10298
/************************************************/
10399

104-
105-
106100
var scale_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
107101
scale_box.vexpand = true;
108102

@@ -129,32 +123,13 @@ public class Badger.MainGrid : Gtk.Box {
129123

130124
// Get the scale default value
131125
scale.sensitive = settings.get_boolean ("all") ? settings.get_boolean (reminder.name + "-active") : false;
132-
126+
133127
scales.insert (reminder.name + "-active", scale);
134128

135129
uint interval = settings.get_uint (reminder.name);
136130

137-
138-
// Old settings migration: interval == 0 meant "never" till 2.3.1
139-
// if ( interval == 0 ) {
140-
// // Reset to default value
141-
// settings.reset (reminder.name);
142-
143-
// // Read interval again (interval = default_value)
144-
// interval = settings.get_uint (reminder.name);
145-
146-
// // Uncheck the corresponding checkbox
147-
// settings.set_boolean (reminder.name + "-active", false);
148-
// }
149-
150-
151131
scale.set_value (interval);
152-
scale.set_tooltip_text(_ ("%.0f min").printf (interval));
153-
154-
// The marks take a lotta space
155-
//scale.add_mark (0.0, Gtk.PositionType.TOP , null);
156-
//scale.add_mark (30.0, Gtk.PositionType.TOP , null);
157-
//scale.add_mark (60.0, Gtk.PositionType.TOP , null);
132+
scale.set_tooltip_text (_ ("%.0f min").printf (interval));
158133

159134
SetInterval set_interval = reminder.set_reminder_interval;
160135
set_interval (interval);
@@ -164,7 +139,7 @@ public class Badger.MainGrid : Gtk.Box {
164139
settings.set_uint (reminder.name, new_value);
165140
set_interval (new_value);
166141

167-
scale.set_tooltip_text(_ ("%.0f min").printf (duration)) ;
142+
scale.set_tooltip_text (_ ("%.0f min").printf (duration)) ;
168143

169144
return false;
170145
});
@@ -184,28 +159,21 @@ public class Badger.MainGrid : Gtk.Box {
184159
box.append (scale);
185160
scale_box.append (box);
186161

187-
} // Forloop end
188-
189-
append(scale_box);
162+
}
190163

164+
append (scale_box);
191165

192166

193167
/********************************************/
194168
/* DnD Label */
195169
/********************************************/
196170

197-
198-
// User may wonder why they get no notification
199-
// Ok also this looks better
200171
var hey = new Gtk.Label (_ ("Make sure Do Not Disturb is not on!")) {
201172
halign = Gtk.Align.START,
202173
margin_top = 12,
203174
margin_bottom = 6
204175
};
205176
hey.add_css_class ("accent");
206177
append (hey);
207-
208-
209-
210178
}
211179
}

src/MainWindow.vala

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,22 @@ public class Badger.MainWindow : Gtk.Window {
3636
settings = new GLib.Settings ("com.github.elfenware.badger.state");
3737

3838
set_default_size (
39-
settings.get_int ("window-width"),
39+
settings.get_int ("window-width"),
4040
settings.get_int ("window-height")
4141
);
4242

43-
set_title(_("Badger"));
44-
Gtk.Label title_widget = new Gtk.Label(_("Badger"));
43+
set_title (_("Badger"));
44+
Gtk.Label title_widget = new Gtk.Label (_("Badger"));
4545
title_widget.add_css_class (Granite.STYLE_CLASS_TITLE_LABEL);
46-
46+
4747
this.headerbar = new Gtk.HeaderBar ();
4848
headerbar.set_title_widget (title_widget);
4949
headerbar.add_css_class (Granite.STYLE_CLASS_FLAT);
5050
set_titlebar (headerbar);
5151

52-
5352
var content = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
5453
content.append (main);
5554

56-
57-
58-
59-
6055
// Allow grabbing on whole window
6156
var handle = new Gtk.WindowHandle () {
6257
child = content

src/Marks.vala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public class Badger.Marks : Gtk.Box {
2626
margin_top = 12;
2727
margin_bottom = 0;
2828

29-
3029
append (new Gtk.Label (_("1 min")) {
3130
halign = Gtk.Align.START,
3231
hexpand = false
@@ -42,4 +41,4 @@ public class Badger.Marks : Gtk.Box {
4241
hexpand = false
4342
});
4443
}
45-
}
44+
}

0 commit comments

Comments
 (0)