# include <config.h>
#endif
+#include <limits.h>
+#include <stdlib.h>
#include <gtk/gtkmain.h>
#include "rakt-window.h"
main (int argc, char **argv)
{
GtkWidget *window;
+ gchar rp[PATH_MAX], filename[PATH_MAX];
gtk_init (&argc, &argv);
window = rakt_window_new ();
gtk_widget_show (window);
+ if (argc > 1) {
+ g_snprintf (filename, sizeof (filename),
+ "file://%s", realpath (argv[1], rp));
+
+ rakt_window_open_document (RAKT_WINDOW (window), filename);
+ }
+
gtk_main ();
gtk_widget_destroy (window);
gtk_widget_queue_draw_area (priv->drawing_area, 0, 0, width, height);
}
-static void
-open_document (RaktWindow *window, gchar *uri)
+void
+rakt_window_open_document (RaktWindow *window, const gchar *uri)
{
RaktWindowPriv *priv;
GError *error = NULL;
gchar *uri;
uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
- open_document (window, uri);
+ rakt_window_open_document (window, uri);
g_free (uri);
}
GType rakt_window_get_type (void);
GtkWidget *rakt_window_new (void);
+void rakt_window_open_document (RaktWindow *window, const gchar *uri);
+
G_END_DECLS
#endif