diff options
author | Christian Dywan <christian@twotoasts.de> | 2019-06-10 12:05:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-10 12:05:49 +0200 |
commit | fc9e4f92a1821adeb9b8cd04f0d9cddfe42c28d1 (patch) | |
tree | 5fae9a19d08dbf8469b8acab14a0bbcd90d924d0 | |
parent | 8291366d543fe224550debcb43800df96aecc7ab (diff) | |
download | midori-git-fc9e4f92a1821adeb9b8cd04f0d9cddfe42c28d1.tar.gz |
Implement Close Other and Close Tab menu items (#319)
-rw-r--r-- | core/tally.vala | 15 | ||||
-rw-r--r-- | ui/menus.ui | 10 |
2 files changed, 25 insertions, 0 deletions
diff --git a/core/tally.vala b/core/tally.vala index 1fdc65df..a5f70aeb 100644 --- a/core/tally.vala +++ b/core/tally.vala @@ -145,6 +145,21 @@ namespace Midori { browser.add (new Tab (null, tab.web_context, uri)); }); group.add_action (action); + action = new SimpleAction ("close-other", null); + action.activate.connect (() => { + var browser = (Browser)tab.get_ancestor (typeof (Browser)); + foreach (var widget in browser.tabs.get_children ()) { + if (widget != tab) { + ((Tab)widget).try_close (); + } + } + }); + group.add_action (action); + action = new SimpleAction ("close-tab", null); + action.activate.connect (() => { + tab.try_close (); + }); + group.add_action (action); insert_action_group ("tally", group); } diff --git a/ui/menus.ui b/ui/menus.ui index 22d1a750..d89f8349 100644 --- a/ui/menus.ui +++ b/ui/menus.ui @@ -143,5 +143,15 @@ <attribute name="label" translatable="yes">_Duplicate Current Tab</attribute> </item> </section> + <section> + <item> + <attribute name="action">tally.close-other</attribute> + <attribute name="label" translatable="yes">Close Ot_her Tabs</attribute> + </item> + <item> + <attribute name="action">tally.close-tab</attribute> + <attribute name="label" translatable="yes">_Close Tab</attribute> + </item> + </section> </menu> </interface> |