77 lines
2.4 KiB
Vala
77 lines
2.4 KiB
Vala
/*
|
|
* pdf-presenter - advanced pdf presentation util
|
|
*
|
|
* Copyright (C) 2009 Sebastian Reichel <sre@ring0.de>
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
* THE SOFTWARE.
|
|
*/
|
|
|
|
int main(string[] args) {
|
|
string filename;
|
|
Poppler.Document document = null;
|
|
Gtk.init(ref args);
|
|
|
|
if(args.length != 2) {
|
|
new ErrorDialog("Wrong Usage", "Usage: %s <file>".printf(args[0]));
|
|
Gtk.main();
|
|
return 1;
|
|
}
|
|
|
|
filename = args[1];
|
|
|
|
try {
|
|
filename = Filename.to_uri(filename);
|
|
document = new Poppler.Document.from_file(filename, "");
|
|
} catch(GLib.ConvertError e) {
|
|
new ErrorDialog("This is not a correct filename", "Please specify a valid filename.");
|
|
Gtk.main();
|
|
return 1;
|
|
} catch(GLib.Error e) {
|
|
new ErrorDialog("File not found", e.message);
|
|
Gtk.main();
|
|
return 1;
|
|
}
|
|
|
|
/* Monitor class can be used like this
|
|
Gdk.Display dp = Gdk.Display.get_default();
|
|
Gdk.Screen screen = dp.get_screen(0);
|
|
Monitor m = new Monitor(screen);
|
|
m.connected.connect(add_display);
|
|
m.disconnected.connect(del_display);
|
|
|
|
foreach(string s in m.get_all()) {
|
|
int x,y,w,h;
|
|
m.get_size(s, out x, out y, out w, out h);
|
|
debug("%s: [%d/%d] [%d/%d]",s,x,y,w,h);
|
|
}
|
|
*/
|
|
|
|
var control_window = new ControlWindow(document);
|
|
control_window.show_all();
|
|
|
|
/* uncomment to get presentation window
|
|
var presentation_window = new PresentationWindow(document, 0);
|
|
presentation_window.show_all();
|
|
control_window.page_changed.connect((n) => {presentation_window.set_page(n);});
|
|
*/
|
|
|
|
Gtk.main();
|
|
return 0;
|
|
}
|