Skip to content

Commit

Permalink
refactor: improve action name consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
SeaDve committed Jul 24, 2023
1 parent 8975337 commit 7f9a841
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion data/resources/ui/shortcuts.ui
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</child>
<child>
<object class="GtkShortcutsShortcut">
<property name="action-name">app.preferences</property>
<property name="action-name">app.show-preferences</property>
<property name="title" translatable="yes">Show Preferences</property>
</object>
</child>
Expand Down
4 changes: 2 additions & 2 deletions data/resources/ui/window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,15 @@
<section>
<item>
<attribute name="label" translatable="yes">_Preferences</attribute>
<attribute name="action">app.preferences</attribute>
<attribute name="action">app.show-preferences</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
<attribute name="action">win.show-help-overlay</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About Kooha</attribute>
<attribute name="action">app.about</attribute>
<attribute name="action">app.show-about</attribute>
</item>
</section>
</menu>
Expand Down
14 changes: 7 additions & 7 deletions src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,17 @@ impl Application {
}));
self.add_action(&action_show_in_files);

let action_about = gio::SimpleAction::new("about", None);
action_about.connect_activate(clone!(@weak self as obj => move |_, _| {
let action_show_about = gio::SimpleAction::new("show-about", None);
action_show_about.connect_activate(clone!(@weak self as obj => move |_, _| {
about::present_window(Some(&obj.window()));
}));
self.add_action(&action_about);
self.add_action(&action_show_about);

let action_preferences = gio::SimpleAction::new("preferences", None);
action_preferences.connect_activate(clone!(@weak self as obj => move |_, _| {
let action_show_preferences = gio::SimpleAction::new("show-preferences", None);
action_show_preferences.connect_activate(clone!(@weak self as obj => move |_, _| {
obj.present_preferences();
}));
self.add_action(&action_preferences);
self.add_action(&action_show_preferences);

let action_quit = gio::SimpleAction::new("quit", None);
action_quit.connect_activate(clone!(@weak self as obj => move |_, _| {
Expand All @@ -206,7 +206,7 @@ impl Application {
}

fn setup_accels(&self) {
self.set_accels_for_action("app.preferences", &["<Control>comma"]);
self.set_accels_for_action("app.show-preferences", &["<Control>comma"]);
self.set_accels_for_action("app.quit", &["<Control>q"]);
self.set_accels_for_action("window.close", &["<Control>w"]);
self.set_accels_for_action("win.record-speaker", &["<Control>a"]);
Expand Down

0 comments on commit 7f9a841

Please sign in to comment.