/*
* Application entry point
*
* Copyright (C) 2017 Patrick McDermott
*
* This file is part of Marquee.
*
* Marquee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Marquee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Marquee. If not, see .
*/
#ifdef HAVE_CONFIG_H
#include
#endif
#include
#include
#include "application.h"
#include "i18n.h"
extern const char *PACKAGE_VERSION_GIT;
static const gchar *opt_profile;
static gboolean opt_version;
static const gchar **opt_uris;
static GOptionEntry entries[] = {
{"profile", 'P', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING,
&opt_profile,
N_("Load configuration and browsing data from PROFILE"),
N_("PROFILE")},
{"version", 'V', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE,
&opt_version,
N_("Show application version"),
NULL},
{G_OPTION_REMAINING, '\0',
G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING_ARRAY,
&opt_uris,
N_("URIs"),
NULL},
{NULL}
};
int
main(int argc, char *argv[])
{
GError *error;
MqApplication *application;
#if defined(ENABLE_NLS) && ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
#if defined(HAVE_BIND_TEXTDOMAIN_CODESET) && HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset(PACKAGE, "UTF-8");
#endif
textdomain(PACKAGE);
setlocale(LC_ALL, "");
#endif
error = NULL;
if (G_UNLIKELY(!gtk_init_with_args(&argc, &argv, N_("[URI]"), entries,
NULL, &error))) {
g_print("%s: %s\n", PACKAGE, error->message);
return EXIT_FAILURE;
}
if (G_UNLIKELY(opt_version)) {
g_print("%s %s%s\n", PACKAGE_NAME, PACKAGE_VERSION,
PACKAGE_VERSION_GIT);
/* TRANSLATORS: The "%s" conversion specifications are the
copyright year(s) and copyright holder(s), respectively. */
g_print(_("Copyright (C) %s %s\n"),
"2017", "Patrick McDermott");
g_print(_("License GPLv3+: GNU GPL version 3 or later "
".\n"
"This is free software: you are free to change and "
"redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by "
"law.\n\n"));
g_print(_("Please report bugs to <%s>.\n"), PACKAGE_BUGREPORT);
return EXIT_SUCCESS;
}
g_set_application_name(PACKAGE_NAME);
application = mq_application_new(opt_profile);
mq_application_add_window(application, opt_uris);
return mq_application_main(application);
}