Change the way command line arguments are parsed.
This commit is contained in:
parent
a2b898b610
commit
5d1c8bbf75
14
po/cs.po
14
po/cs.po
@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: logdiag\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-03-06 16:14+0100\n"
|
||||
"PO-Revision-Date: 2011-03-06 16:24+0100\n"
|
||||
"POT-Creation-Date: 2011-06-10 14:24+0200\n"
|
||||
"PO-Revision-Date: 2011-06-10 14:25+0100\n"
|
||||
"Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n"
|
||||
"Language-Team: Czech <cs@li.org>\n"
|
||||
"Language: \n"
|
||||
@ -16,6 +16,10 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ../src/logdiag.c:117
|
||||
msgid "- Schematic editor"
|
||||
msgstr "- Editor schémat"
|
||||
|
||||
#: ../src/ld-window-main.c:769
|
||||
msgid "Close _without Saving"
|
||||
msgstr "Zavřít _bez uložení"
|
||||
@ -153,9 +157,9 @@ msgstr "Přiblíží diagram"
|
||||
msgid "Zoom out of the diagram"
|
||||
msgstr "Oddálí diagram"
|
||||
|
||||
#: ../src/logdiag.c:42
|
||||
msgid "[FILE] - Schematic editor"
|
||||
msgstr "[SOUBOR] - Editor schémat"
|
||||
#: ../src/logdiag.c:86
|
||||
msgid "[FILE]"
|
||||
msgstr "[SOUBOR]"
|
||||
|
||||
#: ../src/ld-window-main.c:173
|
||||
msgid "_About"
|
||||
|
16
po/de.po
16
po/de.po
@ -7,15 +7,19 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: logdiag\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-03-06 16:14+0100\n"
|
||||
"PO-Revision-Date: 2011-03-07 05:55+0100\n"
|
||||
"Last-Translator: Andy J.\n"
|
||||
"POT-Creation-Date: 2011-06-10 14:24+0200\n"
|
||||
"PO-Revision-Date: 2011-06-10 14:38+0100\n"
|
||||
"Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n"
|
||||
"Language-Team: German <de@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ../src/logdiag.c:117
|
||||
msgid "- Schematic editor"
|
||||
msgstr "- Schema Editor"
|
||||
|
||||
#: ../src/ld-window-main.c:769
|
||||
msgid "Close _without Saving"
|
||||
msgstr "Schließen _ohne Speichern"
|
||||
@ -155,9 +159,9 @@ msgstr "In das Diagramm zoomen"
|
||||
msgid "Zoom out of the diagram"
|
||||
msgstr "Aus dem Diagramm zoomen"
|
||||
|
||||
#: ../src/logdiag.c:42
|
||||
msgid "[FILE] - Schematic editor"
|
||||
msgstr "[DATEI] - Schema Editor"
|
||||
#: ../src/logdiag.c:86
|
||||
msgid "[FILE]"
|
||||
msgstr "[DATEI]"
|
||||
|
||||
#: ../src/ld-window-main.c:173
|
||||
msgid "_About"
|
||||
|
@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: logdiag \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"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -222,6 +222,10 @@ msgstr ""
|
||||
msgid "translator-credits"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/logdiag.c:42
|
||||
msgid "[FILE] - Schematic editor"
|
||||
#: ../src/logdiag.c:86
|
||||
msgid "[FILE]"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/logdiag.c:117
|
||||
msgid "- Schematic editor"
|
||||
msgstr ""
|
||||
|
16
po/pl.po
16
po/pl.po
@ -7,15 +7,19 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: logdiag\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-03-06 16:14+0100\n"
|
||||
"PO-Revision-Date: 2011-02-13 20:36+0100\n"
|
||||
"Last-Translator: Robert Svoboda <ravath@gmail.com>\n"
|
||||
"POT-Creation-Date: 2011-06-10 14:24+0200\n"
|
||||
"PO-Revision-Date: 2011-06-10 14:40+0100\n"
|
||||
"Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n"
|
||||
"Language-Team: Polish <pl@li.org>\n"
|
||||
"Language: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ../src/logdiag.c:117
|
||||
msgid "- Schematic editor"
|
||||
msgstr "- Edytor schematów"
|
||||
|
||||
#: ../src/ld-window-main.c:769
|
||||
msgid "Close _without Saving"
|
||||
msgstr "Zamknąć _bez zapisu"
|
||||
@ -155,9 +159,9 @@ msgstr "Przybliżyć widok"
|
||||
msgid "Zoom out of the diagram"
|
||||
msgstr "Oddalić widok"
|
||||
|
||||
#: ../src/logdiag.c:42
|
||||
msgid "[FILE] - Schematic editor"
|
||||
msgstr "[SOUBOR] - Edytor schematów"
|
||||
#: ../src/logdiag.c:86
|
||||
msgid "[FILE]"
|
||||
msgstr "[PLIK]"
|
||||
|
||||
#: ../src/ld-window-main.c:173
|
||||
msgid "_About"
|
||||
|
14
po/sk.po
14
po/sk.po
@ -7,8 +7,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: logdiag\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-03-06 16:14+0100\n"
|
||||
"PO-Revision-Date: 2011-03-06 16:26+0100\n"
|
||||
"POT-Creation-Date: 2011-06-10 14:24+0200\n"
|
||||
"PO-Revision-Date: 2011-06-10 14:40+0100\n"
|
||||
"Last-Translator: Přemysl Janouch <p.janouch@gmail.com>\n"
|
||||
"Language-Team: Slovak <sk@li.org>\n"
|
||||
"Language: \n"
|
||||
@ -16,6 +16,10 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ../src/logdiag.c:117
|
||||
msgid "- Schematic editor"
|
||||
msgstr "- Editor schém"
|
||||
|
||||
#: ../src/ld-window-main.c:769
|
||||
msgid "Close _without Saving"
|
||||
msgstr "Zatvoriť _bez uloženia"
|
||||
@ -154,9 +158,9 @@ msgstr "Priblíži diagram"
|
||||
msgid "Zoom out of the diagram"
|
||||
msgstr "Oddiali diagram"
|
||||
|
||||
#: ../src/logdiag.c:42
|
||||
msgid "[FILE] - Schematic editor"
|
||||
msgstr "[SÚBOR] - Editor schém"
|
||||
#: ../src/logdiag.c:86
|
||||
msgid "[FILE]"
|
||||
msgstr "[SÚBOR]"
|
||||
|
||||
#: ../src/ld-window-main.c:173
|
||||
msgid "_About"
|
||||
|
@ -19,6 +19,14 @@
|
||||
int
|
||||
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;
|
||||
#ifdef _WIN32
|
||||
gchar *install_dir;
|
||||
@ -38,8 +46,8 @@ main (int argc, char *argv[])
|
||||
textdomain (GETTEXT_DOMAIN);
|
||||
|
||||
error = NULL;
|
||||
gtk_init_with_args (&argc, &argv,
|
||||
N_("[FILE] - Schematic editor"), NULL, GETTEXT_DOMAIN, &error);
|
||||
gtk_init_with_args (&argc, &argv, N_("- Schematic editor"),
|
||||
option_entries, GETTEXT_DOMAIN, &error);
|
||||
if (error)
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
@ -49,31 +57,14 @@ main (int argc, char *argv[])
|
||||
|
||||
gtk_window_set_default_icon_name (PROJECT_NAME);
|
||||
|
||||
/* TODO: Accept multiple files. */
|
||||
if (argc < 2)
|
||||
ld_window_main_new (NULL);
|
||||
else
|
||||
/* TODO: Be able to open multiple files. */
|
||||
if (files)
|
||||
{
|
||||
gchar *arg_utf8, *arg_filename;
|
||||
|
||||
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);
|
||||
ld_window_main_new (files[0]);
|
||||
g_strfreev (files);
|
||||
}
|
||||
else
|
||||
ld_window_main_new (NULL);
|
||||
|
||||
gtk_main ();
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user