/usr/share/origami/gui/xrefs.rb is in origami-pdf 2.0.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | =begin
This file is part of PDF Walker, a graphical PDF file browser
Copyright (C) 2016 Guillaume Delugré.
PDF Walker is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PDF Walker is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with PDF Walker. If not, see <http://www.gnu.org/licenses/>.
=end
module PDFWalker
class Walker < Window
def show_xrefs(target)
XrefsDialog.new(self, target)
end
end
class XrefsDialog < Dialog
OBJCOL = 0
REFCOL = 1
NAMECOL = 2
def initialize(parent, target)
super("Xrefs to #{target.reference}", parent, Dialog::MODAL, [Stock::CLOSE, Dialog::RESPONSE_NONE])
@parent = parent
@list = ListStore.new(Object, String, String)
@view = TreeView.new(@list)
column = Gtk::TreeViewColumn.new("Origin", Gtk::CellRendererText.new, text: REFCOL)
@view.append_column(column)
column = Gtk::TreeViewColumn.new("Objects", Gtk::CellRendererText.new, text: NAMECOL)
@view.append_column(column)
target.xrefs.each { |obj|
str = obj.type.to_s
iter = @list.append
@list.set_value(iter, OBJCOL, obj)
obj = obj.parent until obj.indirect?
@list.set_value(iter, REFCOL, obj.reference.to_s)
@list.set_value(iter, NAMECOL, str)
}
@view.signal_connect("row_activated") { |tree, path, _column|
if @view.selection.selected
from = @list.get_value(@view.selection.selected, OBJCOL)
@parent.treeview.goto(from)
end
}
scroll = ScrolledWindow.new.set_policy(POLICY_NEVER, POLICY_AUTOMATIC)
scroll.add(@view)
vbox.add(scroll)
set_default_size(200, 200)
signal_connect('response') { destroy }
show_all
end
end
end
|