diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-09-15 02:52:29 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-09-15 02:52:29 (EDT) |
commit | 5e6822edb1d222ff97d440ea6743890a6e4c2514 (patch) | |
tree | 6dcaa50a27df20732aeda44fb28f59dc554f8ea9 /src | |
parent | 69ebb03efc30cddc9d20051a22b6f09ee2571922 (diff) | |
download | marquee-5e6822edb1d222ff97d440ea6743890a6e4c2514.zip marquee-5e6822edb1d222ff97d440ea6743890a6e4c2514.tar.gz marquee-5e6822edb1d222ff97d440ea6743890a6e4c2514.tar.bz2 |
src/main.c: New file
Diffstat (limited to 'src')
-rw-r--r-- | src/local.mk | 3 | ||||
-rw-r--r-- | src/main.c | 73 |
2 files changed, 75 insertions, 1 deletions
diff --git a/src/local.mk b/src/local.mk index 8bab431..5cbca27 100644 --- a/src/local.mk +++ b/src/local.mk @@ -1 +1,2 @@ -marquee_SOURCES += +marquee_SOURCES += \ + %reldir%/main.c diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..8b6562a --- /dev/null +++ b/src/main.c @@ -0,0 +1,73 @@ +/* + * 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 <http://www.gnu.org/licenses/>. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> + +#include <gtk/gtk.h> + +static gchar *opt_profile; +static gboolean opt_private; +static gboolean opt_version; + +static GOptionEntry entries[] = { + {"profile", 'P', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, + &opt_profile, + "Load configuration and browsing data from PROFILE", + "PROFILE"}, + {"private", 'p', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, + &opt_private, + "Browse privately, without saving browsing data", + NULL}, + {"version", 'V', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, + &opt_version, + "Show application version", + NULL}, + {NULL} +}; + +int +main(int argc, char *argv[]) +{ + GError *error; + + if (G_UNLIKELY(!gtk_init_with_args(&argc, &argv, "[URI]", entries, NULL, + &error))) { + g_print("%s: %s\n", PACKAGE, error->message); + } + + if (G_UNLIKELY(opt_version)) { + g_print("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION); + g_print("Copyright (C) %s %s\n", "2017", "Patrick McDermott"); + g_print("License GPLv3+: GNU GPL version 3 or later " + "<http://gnu.org/licenses/gpl.html>.\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; +} |