diff --git a/.gitignore b/.gitignore index a3b782b..c8c041c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ builddir/ .flatpak/ +.flatpak-builder _build/ diff --git a/blanket/main.py b/blanket/main.py index 715ad3c..89d0c06 100644 --- a/blanket/main.py +++ b/blanket/main.py @@ -23,7 +23,7 @@ from blanket.define import AUTHORS, ARTISTS, RES_PATH, SOUND_ARTISTS, SOUND_EDITORS from blanket.main_player import MainPlayer from blanket.mpris import MPRIS -from blanket.preferences import PreferencesWindow +from blanket.preferences import PreferencesDialog from blanket.settings import Settings from blanket.widgets import PresetDialog from blanket.window import BlanketWindow @@ -89,12 +89,12 @@ def setup_actions(self): action.connect('activate', self.on_quit) self.add_action(action) - # Show about window + # Show about dialog action = Gio.SimpleAction.new('about', None) action.connect('activate', self.on_about) self.add_action(action) - # Show preferences window + # Show preferences dialog action = Gio.SimpleAction.new('preferences', None) action.connect('activate', self.on_preferences) self.add_action(action) @@ -223,14 +223,12 @@ def on_background(self, action, value): self.window.props.hide_on_close = value def on_preferences(self, _action, _param): - window = PreferencesWindow(self.window) - window.set_transient_for(self.window) - window.set_modal(True) - window.present() + prefs = PreferencesDialog(self.window) + prefs.present(self.window) def on_about(self, _action, _param): builder = Gtk.Builder.new_from_resource(f'{RES_PATH}/about.ui') - about: Adw.AboutWindow = builder.get_object('about') # type: ignore + about: Adw.AboutDialog = builder.get_object('about') # type: ignore artists = self.__get_credits_list(ARTISTS) sound_artists = self.__get_credits_list(SOUND_ARTISTS) @@ -239,11 +237,11 @@ def on_about(self, _action, _param): about.set_version(self.version) about.set_developers(AUTHORS) about.set_designers(artists) + about.add_link(_('Source Code'), 'https://github.com/rafaelmardojai/blanket') about.add_credit_section(_('Sounds by'), sound_artists) about.add_credit_section(_('Sounds edited by'), sound_editors) - about.set_transient_for(self.window) - about.present() + about.present(self.window) def on_quit(self, _action, _param): self.quit() diff --git a/blanket/preferences.py b/blanket/preferences.py index bd56256..a778b41 100644 --- a/blanket/preferences.py +++ b/blanket/preferences.py @@ -12,8 +12,8 @@ @Gtk.Template(resource_path=f'{RES_PATH}/preferences.ui') -class PreferencesWindow(Adw.PreferencesWindow): - __gtype_name__ = 'PreferencesWindow' +class PreferencesDialog(Adw.PreferencesDialog): + __gtype_name__ = 'PreferencesDialog' dark_group: Adw.PreferencesGroup = Gtk.Template.Child() # type: ignore dark: Adw.SwitchRow = Gtk.Template.Child() # type: ignore @@ -104,16 +104,9 @@ def __request_autostart(self, active: bool): except Exception as e: print(e) - error_dialog = Gtk.MessageDialog( - message_type=Gtk.MessageType.WARNING, - buttons=Gtk.ButtonsType.OK, - text=_('Request error'), - ) - error_dialog.props.transient_for = self - error_dialog.props.modal = True - error_dialog.props.secondary_text = _('The autostart request failed.') - error_dialog.connect('response', self.__on_dialog_response) - error_dialog.present() + error_dialog = Adw.AlertDialog.new(_('Request error'), _('The autostart request failed.')) + error_dialog.add_response('ok', _('Ok')) + error_dialog.present(self.window) self.autostart_failed = True self.autostart.set_active(self.autostart_saved) @@ -128,40 +121,18 @@ def __receive_autostart(self, *args): pass elif state == 1: if active: - error_dialog = Gtk.MessageDialog( - message_type=Gtk.MessageType.WARNING, - buttons=Gtk.ButtonsType.OK, - text=_('Authorization failed'), - ) - error_dialog.props.transient_for = self - error_dialog.props.modal = True - error_dialog.props.secondary_text = _( - 'Make sure Blanket has permission to run in ' - '\nthe background in Settings → Applications → ' - '\nBlanket and try again.' - ) - error_dialog.connect('response', self.__on_dialog_response) - error_dialog.present() + error_dialog = Adw.AlertDialog.new(_('Authorization failed'), _('Make sure Blanket has permission to run in the background in Settings → Applications → Blanket and try again.')) + error_dialog.add_response('ok', _('Ok')) + error_dialog.present(self.window) elif state == 2: - error_dialog = Gtk.MessageDialog( - message_type=Gtk.MessageType.WARNING, - buttons=Gtk.ButtonsType.OK, - text=_('Request error'), - ) - error_dialog.props.transient_for = self - error_dialog.props.modal = True - error_dialog.props.secondary_text = _('The autostart request failed.') - error_dialog.connect('response', self.__on_dialog_response) - error_dialog.present() + error_dialog = Adw.AlertDialog.new(_('Request error'), _('The autostart request failed.')) + error_dialog.add_response('ok', _('Ok')) + error_dialog.present(self.window) self.autostart.set_active(autostart) Settings.get().autostart = autostart return - def __on_dialog_response(self, dialog, response_id): - if response_id == Gtk.ResponseType.OK: - dialog.destroy() - def __get_window_identifier(self): session = os.getenv('XDG_SESSION_TYPE') surface = self.window.get_surface() diff --git a/blanket/window.py b/blanket/window.py index 92be205..7859dc9 100644 --- a/blanket/window.py +++ b/blanket/window.py @@ -129,18 +129,17 @@ def populate_sounds(self): else: Settings.get().remove_custom_audio(name) - message = Adw.MessageDialog.new( - self, + alert = Adw.AlertDialog.new( _('Sound Automatically Removed'), _( 'The {name} sound is no longer accessible, so it has been removed' ).format(name=f'{name}'), ) - message.add_response('accept', _('Accept')) - message.props.body_use_markup = True - message.props.default_response = 'accept' - message.props.close_response = 'accept' - message.present() + alert.add_response('accept', _('Accept')) + alert.props.body_use_markup = True + alert.props.default_response = 'accept' + alert.props.close_response = 'accept' + alert.present(self) def open_audio(self): def on_response(_filechooser, _id): @@ -179,6 +178,7 @@ def on_response(_filechooser, _id): self.filechooser = Gtk.FileChooserNative.new( # type: ignore _('Open audio'), self, Gtk.FileChooserAction.OPEN, None, None ) + self.filechooser.set_modal(True) self.filechooser.connect('response', on_response) for f, mts in filters.items(): diff --git a/com.rafaelmardojai.Blanket.json b/com.rafaelmardojai.Blanket.json index 7853304..e84c317 100644 --- a/com.rafaelmardojai.Blanket.json +++ b/com.rafaelmardojai.Blanket.json @@ -32,8 +32,8 @@ { "type": "git", "url": "https://gitlab.gnome.org/jwestman/blueprint-compiler", - "tag": "v0.8.1", - "commit": "aa7679618e864748f4f4d8f15283906e712752fe" + "tag": "v0.10.0", + "commit": "2a39a16391122af2f3d812e478c1c1398c98b972" } ] }, diff --git a/data/com.rafaelmardojai.Blanket.metainfo.xml.in b/data/com.rafaelmardojai.Blanket.metainfo.xml.in index e1af40c..845cd49 100644 --- a/data/com.rafaelmardojai.Blanket.metainfo.xml.in +++ b/data/com.rafaelmardojai.Blanket.metainfo.xml.in @@ -33,7 +33,7 @@