Skip to content

Commit bb6a181

Browse files
authored
Small code enhancements (#117)
* use native handler * prettier option declaration * i forgot the semicolon * Do not linger if toggle is off * Explicit in debug * remove unnecessary newlines * add debug * Withdraw older notification before notifying same thing * Undo withdraw notif. Will do in a separate branch * Move this to separate branch
1 parent cf4b48d commit bb6a181

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

src/Application.vala

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,9 @@ public class Badger.Application : Gtk.Application {
104104
public override int command_line (ApplicationCommandLine command_line) {
105105
stdout.printf ("\n💲️ Command line mode started");
106106

107-
OptionEntry[] options = new OptionEntry[2];
108-
options[0] = {
109-
"headless", 0, 0, OptionArg.NONE,
110-
ref headless, "Run without window", null
111-
};
112-
options[1] = {
113-
"request-autostart", 0, 0, OptionArg.NONE,
114-
ref ask_autostart, "Request autostart permission", null
107+
OptionEntry[] options = {
108+
{"request-autostart", 'r', 0, OptionArg.NONE, ref ask_autostart, "Request autostart permission", null},
109+
{"headless", 'h', 0, OptionArg.NONE, ref headless, "Run without window", null},
115110
};
116111

117112
// We have to make an extra copy of the array, since .parse assumes

src/MainWindow.vala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class Badger.MainWindow : Gtk.Window {
3333

3434
construct {
3535
Intl.setlocale ();
36+
hide_on_close = true;
3637
settings = new GLib.Settings ("com.github.elfenware.badger.timers");
3738

3839
// We cannot resize window if it is allowed to change
@@ -72,19 +73,18 @@ public class Badger.MainWindow : Gtk.Window {
7273
}
7374

7475
private void on_toggle_changed () {
75-
debug ("\nToggle changed!");
76+
debug ("Toggle changed!");
7677
main.revealer.reveal_child = settings.get_boolean ("all");
7778

7879
if (!settings.get_boolean ("all")) {
79-
debug ("\nToggle is off! Resizing window");
80+
debug ("Toggle is off! Resizing window");
8081
set_size_request (12, 12);
8182
queue_resize ();
8283
}
8384
}
8485

8586
// Avoid a bug whence reopened windows cannot be closed
8687
private bool before_destroy () {
87-
hide ();
88-
return true;
88+
return false;
8989
}
9090
}

0 commit comments

Comments
 (0)