A document filename is accepted on the command line now.
[raktpdf.git] / src / main.c
1 /*
2  * Copyright (C) 2007 Tilman Sauerbeck (tilman at code-monkey de)
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #ifdef HAVE_CONFIG_H
21 # include <config.h>
22 #endif
23
24 #include <limits.h>
25 #include <stdlib.h>
26 #include <gtk/gtkmain.h>
27
28 #include "rakt-window.h"
29
30 int
31 main (int argc, char **argv)
32 {
33         GtkWidget *window;
34         gchar rp[PATH_MAX], filename[PATH_MAX];
35
36         gtk_init (&argc, &argv);
37
38         g_set_application_name (PACKAGE_NAME);
39
40         window = rakt_window_new ();
41         gtk_widget_show (window);
42
43         if (argc > 1) {
44                 g_snprintf (filename, sizeof (filename),
45                             "file://%s", realpath (argv[1], rp));
46
47                 rakt_window_open_document (RAKT_WINDOW (window), filename);
48         }
49
50         gtk_main ();
51
52         gtk_widget_destroy (window);
53
54         return 0;
55 }