Skip to content

Commit 12c35ad

Browse files
authored
Merge branch 'main' into autostart
2 parents b820da6 + 9c86a7d commit 12c35ad

File tree

6 files changed

+63
-130
lines changed

6 files changed

+63
-130
lines changed

com.github.elfenware.badger.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,21 @@ finish-args:
1111
- '--device=dri'
1212
- '--socket=fallback-x11'
1313
- '--socket=wayland'
14+
# Allow Badger to send reminders
1415
- '--socket=session-bus'
1516

17+
cleanup:
18+
- '/include'
19+
- '/lib/pkgconfig'
20+
- '/man'
21+
- '/share/doc'
22+
- '/share/gtk-doc'
23+
- '/share/man'
24+
- '/share/pkgconfig'
25+
- '/share/installed-tests'
26+
- '*.la'
27+
- '*.a'
28+
1629
modules:
1730
- name: badger
1831
buildsystem: meson

data/com.github.elfenware.badger.gschema.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,6 @@
7777
path="/com/github/elfenware/badger/state/"
7878
id="com.github.elfenware.badger.state"
7979
gettext-domain="com.github.elfenware.badger">
80-
<key name="window-width" type="i">
81-
<default>180</default>
82-
<summary>The saved width of the window.</summary>
83-
<description>The saved width of the window.</description>
84-
</key>
85-
<key name="window-height" type="i">
86-
<default>200</default>
87-
<summary>The saved height of the window.</summary>
88-
<description>The saved height of the window.</description>
89-
</key>
9080
<key name="first-run" type="b">
9181
<default>true</default>
9282
<summary>Whether this is the first time that Badger has opened</summary>

po/de.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ msgstr "Atmen:"
111111
#: src/MainWindow.vala:43
112112
#: src/MainWindow.vala:44
113113
msgid "Badger"
114-
msgstr "Dachs"
114+
msgstr "Badger"
115115

116116
#: src/MainGrid.vala:48
117117
msgid "Reminders"

po/extra/de.po

Lines changed: 1 addition & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ msgstr ""
1515
#: data/com.github.elfenware.badger.desktop.in:4
1616
#: data/com.github.elfenware.badger.metainfo.xml.in:7
1717
msgid "Badger"
18-
msgstr "Dachs"
18+
msgstr "Badger"
1919

2020
#: data/com.github.elfenware.badger.desktop.in:5
2121
msgid "Ergonomic Reminder"
@@ -225,93 +225,3 @@ msgstr "Erste Veröffentlichung 🎉️"
225225
msgid "Elfenware"
226226
msgstr "Elfenware"
227227

228-
#~ msgid "Blink your eyes"
229-
#~ msgstr "Blinzeln Sie mit den Augen"
230-
231-
#~ msgid "Look away from the screen and slowly blink your eyes for 10 seconds."
232-
#~ msgstr "Schauen Sie vom Bildschirm weg und blinzeln Sie langsam 10 Sekunden lang mit den Augen."
233-
234-
#~ msgid "Eyes:"
235-
#~ msgstr "Die Augen:"
236-
237-
#~ msgid "Stretch your fingers"
238-
#~ msgstr "Strecken Sie Ihre Finger"
239-
240-
#~ msgid "Spread out your palm wide, then close it into a fist. Repeat 5 times."
241-
#~ msgstr "Breiten Sie Ihre Handfläche weit aus und schließen Sie sie dann zu einer Faust. Wiederholen Sie dies 5 Mal."
242-
243-
#~ msgid "Fingers:"
244-
#~ msgstr "Die Finger:"
245-
246-
#~ msgid "Stretch your arms"
247-
#~ msgstr "Strecken Sie Ihre Arme"
248-
249-
#~ msgid "Stretch your arms, and twist your wrists for 10 seconds."
250-
#~ msgstr "Strecken Sie die Arme und verdrehen Sie die Handgelenke für 10 Sekunden."
251-
252-
#~ msgid "Arms:"
253-
#~ msgstr "Die Arme:"
254-
255-
#~ msgid "Stretch your legs"
256-
#~ msgstr "Die Beine vertreten"
257-
258-
#~ msgid "Stand up, twist each ankle, and bend each knee."
259-
#~ msgstr "Stehen Sie auf, drehen Sie jedes Fußgelenk und beugen Sie jedes Knie."
260-
261-
#~ msgid "Legs:"
262-
#~ msgstr "Die Beine:"
263-
264-
#~ msgid "Turn your neck"
265-
#~ msgstr "Den Hals umdrehen"
266-
267-
#~ msgid "Turn your head in all directions. Repeat 3 times."
268-
#~ msgstr "Drehen Sie den Kopf in alle Richtungen. Wiederholen Sie dies 3 Mal."
269-
270-
#~ msgid "Neck:"
271-
#~ msgstr "Hals:"
272-
273-
#~ msgid "Hydrate yourself"
274-
#~ msgstr "Hydratisieren Sie sich"
275-
276-
#~ msgid "Drink a glass of water."
277-
#~ msgstr "Trinken Sie ein Glas Wasser."
278-
279-
#~ msgid "Water:"
280-
#~ msgstr "Wasser:"
281-
282-
#~ msgid "Watch your posture"
283-
#~ msgstr "Achten Sie auf Ihre Körperhaltung"
284-
285-
#~ msgid "Make sure your back is straight."
286-
#~ msgstr "Achten Sie darauf, dass Ihr Rücken gerade ist."
287-
288-
#~ msgid "Posture:"
289-
#~ msgstr "Körperhaltung:"
290-
291-
#~ msgid "Focus on your breath"
292-
#~ msgstr "Konzentrieren Sie sich auf Ihren Atem"
293-
294-
#~ msgid "Inhale and exhale deeply, thrice."
295-
#~ msgstr "Atme dreimal tief ein und aus."
296-
297-
#~ msgid "Breath:"
298-
#~ msgstr "Atmen:"
299-
300-
#~ msgid "Reminders"
301-
#~ msgstr "Mahnungen"
302-
303-
#~ msgid "Decide how often Badger should remind you to relax these:"
304-
#~ msgstr "Entscheiden Sie, wie oft Badger Sie daran erinnern soll, diese zu entspannen:"
305-
306-
#, c-format
307-
#~ msgid "%.0f min"
308-
#~ msgstr "%.0f min"
309-
310-
#~ msgid "1 min"
311-
#~ msgstr "1 Minute"
312-
313-
#~ msgid "30 min"
314-
#~ msgstr "30 min"
315-
316-
#~ msgid "1 hour"
317-
#~ msgstr "1 Stunde"

src/MainGrid.vala

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
public class Badger.MainGrid : Gtk.Box {
2222
delegate void SetInterval (uint interval);
23+
public Gtk.Revealer revealer;
2324

2425
public MainGrid (Reminder[] reminders) {
2526
var settings = new GLib.Settings ("com.github.elfenware.badger.timers");
@@ -41,6 +42,7 @@ public class Badger.MainGrid : Gtk.Box {
4142
halign = Gtk.Align.END,
4243
hexpand = true,
4344
valign = Gtk.Align.CENTER,
45+
margin_bottom = 18
4446
};
4547
settings.bind ("all", global_switch, "active", SettingsBindFlags.DEFAULT);
4648
var heading = new Granite.HeaderLabel (_ ("Reminders")) {
@@ -52,23 +54,28 @@ public class Badger.MainGrid : Gtk.Box {
5254
global_box.append (global_switch);
5355
append (global_box);
5456

57+
// This is everything below the switch.
58+
var scale_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
59+
scale_box.vexpand = true;
60+
61+
5562

5663
/************************************************/
5764
/* Label to explain */
5865
/************************************************/
5966

6067
var subheading = new Gtk.Label (_ ("Decide how often Badger should remind you to relax these:")) {
6168
halign = Gtk.Align.START,
62-
margin_top = 18,
63-
margin_bottom = 6
69+
margin_top = 12,
70+
margin_bottom = 0
6471
};
6572
subheading.add_css_class (Granite.STYLE_CLASS_H4_LABEL);
6673
subheading.add_css_class ("title-4");
6774

68-
append (subheading);
75+
scale_box.append (subheading);
6976

7077
var marks = new Marks ();
71-
append (marks);
78+
scale_box.append (marks);
7279

7380
HashTable<string, Gtk.Scale> scales = new HashTable<string, Gtk.Scale> (str_hash, str_equal);
7481

@@ -97,9 +104,6 @@ public class Badger.MainGrid : Gtk.Box {
97104
/* All the scales */
98105
/************************************************/
99106

100-
var scale_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
101-
scale_box.vexpand = true;
102-
103107
for (int index = 0; index < reminders.length; index++) {
104108
Reminder reminder = reminders[index];
105109

@@ -161,9 +165,6 @@ public class Badger.MainGrid : Gtk.Box {
161165

162166
}
163167

164-
append (scale_box);
165-
166-
167168
/********************************************/
168169
/* DnD Label */
169170
/********************************************/
@@ -174,6 +175,16 @@ public class Badger.MainGrid : Gtk.Box {
174175
margin_bottom = 6
175176
};
176177
hey.add_css_class ("accent");
177-
append (hey);
178+
scale_box.append (hey);
179+
180+
/**************************************************/
181+
/* Scales revealer */
182+
/**************************************************/
183+
184+
// If the "all" flag is false, the switch is off, hide the scales
185+
this.revealer = new Gtk.Revealer ();
186+
revealer.set_transition_type (Gtk.RevealerTransitionType.SLIDE_DOWN);
187+
revealer.set_child (scale_box);
188+
append (revealer);
178189
}
179190
}

src/MainWindow.vala

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ public class Badger.MainWindow : Gtk.Window {
3232
}
3333

3434
construct {
35-
Intl.setlocale ();
36-
settings = new GLib.Settings ("com.github.elfenware.badger.state");
35+
Intl.setlocale ();
36+
settings = new GLib.Settings ("com.github.elfenware.badger.timers");
37+
38+
// We cannot resize window if it is allowed to change
39+
set_size_request (12, 12);
40+
set_resizable (false);
3741

38-
set_default_size (
39-
settings.get_int ("window-width"),
40-
settings.get_int ("window-height")
41-
);
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 (this.get_title ());
4545
title_widget.add_css_class (Granite.STYLE_CLASS_TITLE_LABEL);
4646

4747
this.headerbar = new Gtk.HeaderBar ();
@@ -59,22 +59,31 @@ public class Badger.MainWindow : Gtk.Window {
5959

6060
set_child (handle);
6161

62-
// save state
62+
// Avoid showing the window without content despite toggle off.
63+
main.revealer.reveal_child = settings.get_boolean ("all");
64+
65+
// Resize window accordingly to state of global switch
66+
settings.changed["all"].connect ( on_toggle_changed);
67+
68+
// Avoid a bug whence reopened windows cannot be closed
6369
close_request.connect (e => {
6470
return before_destroy ();
6571
});
6672
}
6773

74+
private void on_toggle_changed () {
75+
debug ("\nToggle changed!");
76+
main.revealer.reveal_child = settings.get_boolean ("all");
6877

69-
// save state
70-
private bool before_destroy () {
71-
int width, height;
72-
73-
get_default_size (out width, out height);
74-
75-
settings.set_int ("window-width", width);
76-
settings.set_int ("window-height", height);
78+
if (!settings.get_boolean ("all")) {
79+
debug ("\nToggle is off! Resizing window");
80+
set_size_request (12, 12);
81+
queue_resize ();
82+
}
83+
}
7784

85+
// Avoid a bug whence reopened windows cannot be closed
86+
private bool before_destroy () {
7887
hide ();
7988
return true;
8089
}

0 commit comments

Comments
 (0)