/*
* 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"
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,
"Load configuration and browsing data from PROFILE",
"PROFILE"},
{"version", 'V', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE,
&opt_version,
"Show application version",
NULL},
{G_OPTION_REMAINING, '\0',
G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING_ARRAY,
&opt_uris,
"URIs",
NULL},
{NULL}
};
int
main(int argc, char *argv[])
{
GError *error;
MqApplication *application;
error = NULL;
if (G_UNLIKELY(!gtk_init_with_args(&argc, &argv, "[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);
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);
}