Verified Commit d53074e6 authored by M. Sandoval's avatar M. Sandoval 🥑
Browse files

main_window: Simplify selection action

parent ae19916e
......@@ -214,11 +214,13 @@
<section>
<item>
<attribute name="label" translatable="yes">Select _All</attribute>
<attribute name="action">app.selection.all</attribute>
<attribute name="action">app.selection</attribute>
<attribute name="target">all</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Select _None</attribute>
<attribute name="action">app.selection.none</attribute>
<attribute name="action">app.selection</attribute>
<attribute name="target">none</attribute>
</item>
</section>
</menu>
......
......@@ -520,13 +520,9 @@ class MainWindow(Handy.ApplicationWindow):
# Selection Mode Actions
def add_selection_actions(self):
selection_all_action = Gio.SimpleAction.new("selection.all", None)
selection_all_action.connect("activate", self.execute_gio_action, "on_selection_popover_button_clicked", "all")
self.application.add_action(selection_all_action)
selection_none_action = Gio.SimpleAction.new("selection.none", None)
selection_none_action.connect("activate", self.execute_gio_action, "on_selection_popover_button_clicked", "none")
self.application.add_action(selection_none_action)
selection_action = Gio.SimpleAction.new("selection", GLib.VariantType("s"))
self.application.add_action(selection_action)
selection_action.connect("activate", self.execute_gio_action, "on_selection_popover_button_clicked")
# Gio Action Handler
def execute_gio_action(self, action, param, name, arg=None):
......@@ -555,7 +551,7 @@ class MainWindow(Handy.ApplicationWindow):
elif name == "on_database_settings_entry_clicked":
action_db.on_database_settings_entry_clicked(action, param)
elif name == "on_selection_popover_button_clicked":
action_db.selection_ui.on_selection_popover_button_clicked(action, param, arg)
action_db.selection_ui.on_selection_action_activated(param)
# Add Global Accelerator Actions
# The save_dirty action differs to save in that it is set as disabled
......
......@@ -146,9 +146,10 @@ class SelectionUI(Gtk.Box):
self.unlocked_database.window.send_notification(_("Move completed"))
self._clear_all()
def on_selection_popover_button_clicked(self, _action, _param, selection_type):
def on_selection_action_activated(self, param):
self.unlocked_database.start_database_lock_timer()
selection_type = param.get_string()
page = self.unlocked_database.get_current_page()
viewport = page.get_children()[0]
overlay = viewport.get_children()[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment