Change the way command line arguments are parsed.

This commit is contained in:
Přemysl Eric Janouch 2011-06-10 14:51:42 +02:00
parent a2b898b610
commit 5d1c8bbf75
6 changed files with 61 additions and 50 deletions

View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: logdiag\n" "Project-Id-Version: logdiag\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-06 16:14+0100\n" "POT-Creation-Date: 2011-06-10 14:24+0200\n"
"PO-Revision-Date: 2011-03-06 16:24+0100\n" "PO-Revision-Date: 2011-06-10 14:25+0100\n"
"Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n" "Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n"
"Language-Team: Czech <cs@li.org>\n" "Language-Team: Czech <cs@li.org>\n"
"Language: \n" "Language: \n"
@ -16,6 +16,10 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../src/logdiag.c:117
msgid "- Schematic editor"
msgstr "- Editor schémat"
#: ../src/ld-window-main.c:769 #: ../src/ld-window-main.c:769
msgid "Close _without Saving" msgid "Close _without Saving"
msgstr "Zavřít _bez uložení" msgstr "Zavřít _bez uložení"
@ -153,9 +157,9 @@ msgstr "Přiblíží diagram"
msgid "Zoom out of the diagram" msgid "Zoom out of the diagram"
msgstr "Oddálí diagram" msgstr "Oddálí diagram"
#: ../src/logdiag.c:42 #: ../src/logdiag.c:86
msgid "[FILE] - Schematic editor" msgid "[FILE]"
msgstr "[SOUBOR] - Editor schémat" msgstr "[SOUBOR]"
#: ../src/ld-window-main.c:173 #: ../src/ld-window-main.c:173
msgid "_About" msgid "_About"

View File

@ -7,15 +7,19 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: logdiag\n" "Project-Id-Version: logdiag\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-06 16:14+0100\n" "POT-Creation-Date: 2011-06-10 14:24+0200\n"
"PO-Revision-Date: 2011-03-07 05:55+0100\n" "PO-Revision-Date: 2011-06-10 14:38+0100\n"
"Last-Translator: Andy J.\n" "Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n"
"Language-Team: German <de@li.org>\n" "Language-Team: German <de@li.org>\n"
"Language: \n" "Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../src/logdiag.c:117
msgid "- Schematic editor"
msgstr "- Schema Editor"
#: ../src/ld-window-main.c:769 #: ../src/ld-window-main.c:769
msgid "Close _without Saving" msgid "Close _without Saving"
msgstr "Schließen _ohne Speichern" msgstr "Schließen _ohne Speichern"
@ -155,9 +159,9 @@ msgstr "In das Diagramm zoomen"
msgid "Zoom out of the diagram" msgid "Zoom out of the diagram"
msgstr "Aus dem Diagramm zoomen" msgstr "Aus dem Diagramm zoomen"
#: ../src/logdiag.c:42 #: ../src/logdiag.c:86
msgid "[FILE] - Schematic editor" msgid "[FILE]"
msgstr "[DATEI] - Schema Editor" msgstr "[DATEI]"
#: ../src/ld-window-main.c:173 #: ../src/ld-window-main.c:173
msgid "_About" msgid "_About"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: logdiag \n" "Project-Id-Version: logdiag \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-06 16:14+0100\n" "POT-Creation-Date: 2011-06-10 14:24+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -222,6 +222,10 @@ msgstr ""
msgid "translator-credits" msgid "translator-credits"
msgstr "" msgstr ""
#: ../src/logdiag.c:42 #: ../src/logdiag.c:86
msgid "[FILE] - Schematic editor" msgid "[FILE]"
msgstr ""
#: ../src/logdiag.c:117
msgid "- Schematic editor"
msgstr "" msgstr ""

View File

@ -7,15 +7,19 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: logdiag\n" "Project-Id-Version: logdiag\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-06 16:14+0100\n" "POT-Creation-Date: 2011-06-10 14:24+0200\n"
"PO-Revision-Date: 2011-02-13 20:36+0100\n" "PO-Revision-Date: 2011-06-10 14:40+0100\n"
"Last-Translator: Robert Svoboda <ravath@gmail.com>\n" "Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n"
"Language-Team: Polish <pl@li.org>\n" "Language-Team: Polish <pl@li.org>\n"
"Language: \n" "Language: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../src/logdiag.c:117
msgid "- Schematic editor"
msgstr "- Edytor schematów"
#: ../src/ld-window-main.c:769 #: ../src/ld-window-main.c:769
msgid "Close _without Saving" msgid "Close _without Saving"
msgstr "Zamknąć _bez zapisu" msgstr "Zamknąć _bez zapisu"
@ -155,9 +159,9 @@ msgstr "Przybliżyć widok"
msgid "Zoom out of the diagram" msgid "Zoom out of the diagram"
msgstr "Oddalić widok" msgstr "Oddalić widok"
#: ../src/logdiag.c:42 #: ../src/logdiag.c:86
msgid "[FILE] - Schematic editor" msgid "[FILE]"
msgstr "[SOUBOR] - Edytor schematów" msgstr "[PLIK]"
#: ../src/ld-window-main.c:173 #: ../src/ld-window-main.c:173
msgid "_About" msgid "_About"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: logdiag\n" "Project-Id-Version: logdiag\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-03-06 16:14+0100\n" "POT-Creation-Date: 2011-06-10 14:24+0200\n"
"PO-Revision-Date: 2011-03-06 16:26+0100\n" "PO-Revision-Date: 2011-06-10 14:40+0100\n"
"Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n" "Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n"
"Language-Team: Slovak <sk@li.org>\n" "Language-Team: Slovak <sk@li.org>\n"
"Language: \n" "Language: \n"
@ -16,6 +16,10 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ../src/logdiag.c:117
msgid "- Schematic editor"
msgstr "- Editor schém"
#: ../src/ld-window-main.c:769 #: ../src/ld-window-main.c:769
msgid "Close _without Saving" msgid "Close _without Saving"
msgstr "Zatvoriť _bez uloženia" msgstr "Zatvoriť _bez uloženia"
@ -154,9 +158,9 @@ msgstr "Priblíži diagram"
msgid "Zoom out of the diagram" msgid "Zoom out of the diagram"
msgstr "Oddiali diagram" msgstr "Oddiali diagram"
#: ../src/logdiag.c:42 #: ../src/logdiag.c:86
msgid "[FILE] - Schematic editor" msgid "[FILE]"
msgstr "[SÚBOR] - Editor schém" msgstr "[SÚBOR]"
#: ../src/ld-window-main.c:173 #: ../src/ld-window-main.c:173
msgid "_About" msgid "_About"

View File

@ -19,6 +19,14 @@
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
gchar **files = NULL;
GOptionEntry option_entries[] =
{
{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &files,
NULL, N_("[FILE]")},
{NULL}
};
GError *error; GError *error;
#ifdef _WIN32 #ifdef _WIN32
gchar *install_dir; gchar *install_dir;
@ -38,8 +46,8 @@ main (int argc, char *argv[])
textdomain (GETTEXT_DOMAIN); textdomain (GETTEXT_DOMAIN);
error = NULL; error = NULL;
gtk_init_with_args (&argc, &argv, gtk_init_with_args (&argc, &argv, N_("- Schematic editor"),
N_("[FILE] - Schematic editor"), NULL, GETTEXT_DOMAIN, &error); option_entries, GETTEXT_DOMAIN, &error);
if (error) if (error)
{ {
g_warning ("%s", error->message); g_warning ("%s", error->message);
@ -49,31 +57,14 @@ main (int argc, char *argv[])
gtk_window_set_default_icon_name (PROJECT_NAME); gtk_window_set_default_icon_name (PROJECT_NAME);
/* TODO: Accept multiple files. */ /* TODO: Be able to open multiple files. */
if (argc < 2) if (files)
ld_window_main_new (NULL);
else
{ {
gchar *arg_utf8, *arg_filename; ld_window_main_new (files[0]);
g_strfreev (files);
arg_utf8 = g_locale_to_utf8 (argv[1], -1, NULL, NULL, &error);
if (error)
{
g_warning ("%s", error->message);
g_error_free (error);
return 1;
}
arg_filename = g_filename_from_utf8 (arg_utf8, -1, NULL, NULL, &error);
if (error)
{
g_warning ("%s", error->message);
g_error_free (error);
return 1;
}
ld_window_main_new (arg_filename);
g_free (arg_filename);
g_free (arg_utf8);
} }
else
ld_window_main_new (NULL);
gtk_main (); gtk_main ();
return 0; return 0;