From 8c7e3abbebfe3140bf62433dd93c17f6599ae592 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sun, 2 Jan 2022 12:37:51 +0100 Subject: [PATCH 1/3] :tada: Add a menu button --- prefs.js | 30 ++++++++++++++++++++++++++++++ resources/ui/gtk3.ui | 31 +++++++++++++++++++++++++++++++ resources/ui/gtk4.ui | 31 +++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) diff --git a/prefs.js b/prefs.js index ec05e87..06133d5 100644 --- a/prefs.js +++ b/prefs.js @@ -75,6 +75,36 @@ var PreferencesDialog = class PreferencesDialog { // Initialize the fire-preset dropdown. this._createFirePresets(); + // Add a menu to the title bar of the preferences dialog. + this._widget.connect('realize', (widget) => { + const window = widget.get_root(); + + // Show the version number in the title bar. + window.set_title(`Burn-My-Windows ${Me.metadata.version}`); + + // Add the menu. + const menu = this._builder.get_object('menu-button'); + window.get_titlebar().pack_end(menu); + + // Populate the actions. + const group = Gio.SimpleActionGroup.new(); + + const addAction = (name, uri) => { + const action = Gio.SimpleAction.new(name, null); + action.connect('activate', () => Gtk.show_uri(null, uri, Gdk.CURRENT_TIME)); + group.add_action(action); + }; + + addAction('homepage', 'https://github.com/Schneegans/Burn-My-Windows'); + addAction('bugs', 'https://github.com/Schneegans/Burn-My-Windows/issues'); + addAction( + 'donate-paypal', + 'https://www.paypal.com/donate/?hosted_button_id=3F7UFL8KLVPXE'); + addAction('donate-github', 'https://github.com/sponsors/Schneegans'); + + window.insert_action_group('prefs', group); + }); + // As we do not have something like a destructor, we just listen for the destroy // signal of our main widget. this._widget.connect('destroy', () => { diff --git a/resources/ui/gtk3.ui b/resources/ui/gtk3.ui index 44a8eb1..91669b3 100644 --- a/resources/ui/gtk3.ui +++ b/resources/ui/gtk3.ui @@ -19,6 +19,37 @@ + +
+ + Visit Homepage + prefs.homepage + + + Report a Bug + prefs.bugs + +
+
+ + Donate + + Via PayPal + prefs.donate-paypal + + + Via GitHub + prefs.donate-github + + +
+
+ + + main-menu + open-menu-symbolic + + 10000 500 diff --git a/resources/ui/gtk4.ui b/resources/ui/gtk4.ui index f0fefb9..21e0887 100644 --- a/resources/ui/gtk4.ui +++ b/resources/ui/gtk4.ui @@ -27,6 +27,37 @@ + +
+ + Visit Homepage + prefs.homepage + + + Report a Bug + prefs.bugs + +
+
+ + Donate + + Via PayPal + prefs.donate-paypal + + + Via GitHub + prefs.donate-github + + +
+
+ + + main-menu + open-menu-symbolic + + never 200 From 5682a5cdf85577efbfdef26131d65d4a2e127601 Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sun, 2 Jan 2022 12:48:47 +0100 Subject: [PATCH 2/3] :beetle: Fix GTK3 --- prefs.js | 2 +- resources/ui/gtk3.ui | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/prefs.js b/prefs.js index 06133d5..e8bbe9f 100644 --- a/prefs.js +++ b/prefs.js @@ -77,7 +77,7 @@ var PreferencesDialog = class PreferencesDialog { // Add a menu to the title bar of the preferences dialog. this._widget.connect('realize', (widget) => { - const window = widget.get_root(); + const window = utils.gtk4() ? widget.get_root() : widget.get_toplevel(); // Show the version number in the title bar. window.set_title(`Burn-My-Windows ${Me.metadata.version}`); diff --git a/resources/ui/gtk3.ui b/resources/ui/gtk3.ui index 91669b3..dc27335 100644 --- a/resources/ui/gtk3.ui +++ b/resources/ui/gtk3.ui @@ -47,7 +47,14 @@ main-menu - open-menu-symbolic + 1 + + + open-menu-symbolic + 1 + 1 + + From 681afb47937648bc4b5b057c9a0581d0bcbb77ff Mon Sep 17 00:00:00 2001 From: Simon Schneegans Date: Sun, 2 Jan 2022 12:49:59 +0100 Subject: [PATCH 3/3] :memo: Add changelog entry --- docs/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.md b/docs/changelog.md index 5cb9e78..b259602 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -8,6 +8,7 @@ * Added a new ridiculous close-animation: the T-Rex-Attack! * Added a new simple close-animation: the TV-Effect! +* Added a menu to the preferences dialog with links for bug reporting and donations. #### Other Enhancements