Skip to content

Commit

Permalink
Merge pull request #230 from ARAKHN1D/banner-change-mode
Browse files Browse the repository at this point in the history
Change output mode directly from warning banner button
  • Loading branch information
Huluti committed Jun 7, 2024
2 parents 8bf1bcd + 59b2cd5 commit 2882186
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion data/ui/window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<property name="orientation">vertical</property>
<child>
<object class="AdwBanner" id="warning_banner">
<property name="action-name">win.preferences</property>
<property name="action-name">win.banner-change-mode</property>
<property name="button-label" translatable="yes">_Change Mode</property>
<property name="title" translatable="yes">Images will be overwritten, proceed carefully</property>
</object>
Expand Down
5 changes: 5 additions & 0 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def create_simple_action(self, action_name, callback, shortcut=None):
def create_actions(self):
self.create_simple_action('select-file', self.on_select, '<Primary>o')
self.create_simple_action('clear-results', self.clear_results)
self.create_simple_action('banner-change-mode', self.banner_change_mode)
self.create_simple_action('preferences', self.on_preferences, '<Primary>comma')
self.create_simple_action('about', self.on_about)
self.create_simple_action('quit', self.on_quit, '<Primary>q')
Expand Down Expand Up @@ -347,6 +348,10 @@ def compress_images(self, result_items):
def on_lossy_changed(self, switch, state):
self._settings.set_boolean('lossy', switch.get_active())

def banner_change_mode(self, *args):
self._settings.set_boolean('new-file', True)
self.show_warning_banner()

def on_preferences(self, *args):
if self.prefs_dialog is not None:
self.prefs_dialog.force_close()
Expand Down

0 comments on commit 2882186

Please sign in to comment.