Skip to content

Commit

Permalink
Explore tabs + count #6
Browse files Browse the repository at this point in the history
When right-clicking a session a submenu is showed with the titles of the wepages in that session
  • Loading branch information
AlexPerathoner committed Mar 19, 2021
1 parent 8836ef1 commit dbc50a0
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icons8-search-2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icons8-search-1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icons8-search.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@
<action selector="restoreAsPrivate:" target="-2" id="JvQ-ax-An2"/>
</connections>
</menuItem>
<menuItem title="2 tabs" image="icons8-search" tag="1" id="uUw-Wo-BEe">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="2 tabs" id="rRA-3M-oil"/>
</menuItem>
<menuItem title="Remove" image="icons8-delete" id="Tsg-EC-kx9">
<attributedString key="attributedTitle"/>
<modifierMask key="keyEquivalentModifierMask"/>
Expand Down Expand Up @@ -234,6 +238,7 @@
<image name="icons8-edit" width="16" height="16"/>
<image name="icons8-export" width="16" height="16"/>
<image name="icons8-restart" width="16" height="16"/>
<image name="icons8-search" width="16" height="16"/>
<image name="icons8-secure" width="16" height="16"/>
<image name="icons8-synchronize" width="16" height="16"/>
</resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ extension SafariExtensionViewController: NSTableViewDelegate, NSTableViewDataSou
tableView.menu?.autoenablesItems = true
tableView.registerForDraggedTypes([dragDropType])
tableView.singleMenu = singleSelectionMenu
tableView.vc = self
}


Expand Down
15 changes: 12 additions & 3 deletions Sessions Extension/SafariExtensionViewController/TableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,20 @@ import Cocoa

class TableView: NSTableView {
weak var singleMenu: NSMenu!

weak var vc: SafariExtensionViewController?
override func rightMouseDown(with event: NSEvent) {
super.rightMouseDown(with: event)
let correctLocation = convert(event.locationInWindow, from: nil)
singleMenu.popUp(positioning: singleMenu.items.first, at: correctLocation, in: self)

if let singleMenuWTabs = singleMenu {
let sessions = vc?.sessions
let pages = sessions?[self.clickedRow].pages ?? []
singleMenuWTabs.item(withTag: 1)?.submenu?.removeAllItems()
for page in pages {
let menuItem = NSMenuItem(title: page.title, action: nil, keyEquivalent: "")
singleMenuWTabs.item(withTag: 1)?.submenu?.addItem(menuItem)
}
singleMenuWTabs.item(withTag: 1)?.title = "\(pages.count) tabs:"
singleMenuWTabs.popUp(positioning: singleMenuWTabs.items.first, at: correctLocation, in: self)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -452,5 +452,53 @@
landmarkType = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "4076A257-0AD2-447C-8DAE-A87B1CA7EABE"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Sessions Extension/SafariExtensionViewController/SafariExtensionViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "49"
endingLineNumber = "49"
landmarkName = "viewDidLoad()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "47AC050B-270C-4350-AE86-D5EA88E2F648"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Sessions Extension/SafariExtensionViewController/SafariExtensionViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "48"
endingLineNumber = "48"
landmarkName = "viewDidLoad()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "270ADC1D-5A11-420A-8E10-8A6C120A4AB7"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Sessions Extension/SafariExtensionViewController/SafariExtensionViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "46"
endingLineNumber = "46"
landmarkName = "viewDidLoad()"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

0 comments on commit dbc50a0

Please sign in to comment.