[gnome-latex: 81/205] Command line option: new document



commit 5a3996d957fc8fc4a5a9f0b8f940401dc9935553
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Thu Sep 24 16:17:11 2009 +0200

    Command line option: new document

 TODO       | 4 ++--
 src/main.c | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/TODO b/TODO
index ee4c408..b0dbbd4 100644
--- a/TODO
+++ b/TODO
@@ -19,8 +19,8 @@ Fri Sep 18, 2009 to Fri Sep 25, 2009
        x CMake: use FindLATEX module
        x preferences
 
-[-] command line option
-       - new document (--new-document)
+[x] command line option
+       x new document (--new-document)
 
 [-] document tabs
        - possibility to move the tabs
diff --git a/src/main.c b/src/main.c
index d6e560d..745ed88 100644
--- a/src/main.c
+++ b/src/main.c
@@ -79,6 +79,7 @@ main (int argc, char *argv[])
        GtkTreeViewColumn *column;
 
        /* command line options */
+       gboolean option_new_document = FALSE;
 
        gchar *latexila_nls_package = NULL;
 #ifdef LATEXILA_NLS_ENABLED
@@ -89,6 +90,9 @@ main (int argc, char *argv[])
                { "version", 'v', G_OPTION_FLAG_IN_MAIN | G_OPTION_FLAG_NO_ARG,
                        G_OPTION_ARG_CALLBACK, (gpointer) option_version,
                        N_("Display version informations"), NULL },
+               { "new-document", 'n', G_OPTION_FLAG_IN_MAIN | G_OPTION_FLAG_NO_ARG,
+                       G_OPTION_ARG_NONE, &option_new_document,
+                       N_("Create new document"), NULL },
                {NULL}
        };
 
@@ -279,6 +283,10 @@ main (int argc, char *argv[])
        if (! latexila.prefs->show_edit_toolbar)
                gtk_widget_hide (latexila.edit_toolbar);
 
+       /* if --new-document option is used */
+       if (option_new_document)
+               cb_new ();
+
        /* open documents given in arguments */
        for (int i = 1 ; i < argc ; i++)
        {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]