Fix the label int he sidebar
[gmpc.git] / src / options.c
blobcfc14641968aaf7bdd89dce5b2d7fca5901ce5d7
1 /* Gnome Music Player Client (GMPC)
2 * Copyright (C) 2011-2012 Qball Cow <qball@gmpclient.org>
3 * Project homepage: http://gmpclient.org/
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <glib.h>
20 #include <gtk/gtk.h>
21 #include <config.h>
22 #include <plugin.h>
23 #include "main.h"
24 #include "log.h"
25 #include "options.h"
27 /* Set default values */
28 Options settings =
30 .show_version = FALSE,
31 .disable_plugins = FALSE,
32 .start_hidden = FALSE,
33 .quit = FALSE,
34 .show_bug_information = FALSE,
35 .fullscreen = FALSE,
36 .config_path = NULL,
37 .debug_level = -1,
38 .profile_name = NULL,
39 .icon_theme = NULL
41 gboolean parse_options(int *argc, char ***argv)
43 GError *error = NULL;
44 GOptionContext *context = NULL;
46 GOptionEntry entries[] =
49 "fullscreen", 0, 0, G_OPTION_ARG_NONE,
50 &(settings.fullscreen), N_("Start the program in full screen"), NULL
53 "version", 'v', 0, G_OPTION_ARG_NONE,
54 &(settings.show_version), N_("Show program version and revision"), NULL
57 "quit", 'q', 0, G_OPTION_ARG_NONE,
58 &(settings.quit), N_("Quits the running gmpc"), NULL
61 "disable-plugins", 0, 0, G_OPTION_ARG_NONE,
62 &(settings.disable_plugins), N_("Don't load the plugins"), NULL
65 "config", 0, 0, G_OPTION_ARG_FILENAME,
66 &(settings.config_path), N_("Load alternative config file"), "Path"
69 "debug-level", 'd', 0, G_OPTION_ARG_INT,
70 &(settings.debug_level), N_("Set the debug level"), "level"
73 "start-hidden", 'h', 0, G_OPTION_ARG_NONE,
74 &(settings.start_hidden), N_("Start gmpc hidden to tray"), NULL
77 "bug-information", 'b', 0, G_OPTION_ARG_NONE,
78 &(settings.show_bug_information), N_("Show bug information"), NULL
81 "log-filter", 'f', 0, G_OPTION_ARG_CALLBACK,
82 log_add_filter, N_("Shows all output from a certain log domain"), "<Log domain>"
85 "profile", 'p', 0, G_OPTION_ARG_STRING,
86 &(settings.profile_name), N_("Select a profile"), "<Profile Name>"
89 "icon-theme", 'i', 0, G_OPTION_ARG_STRING,
90 &(settings.icon_theme), N_("Run GMPC with a different icon theme"), "<icon theme name>"
93 {NULL}
95 INIT_TIC_TAC();
96 context = g_option_context_new(_("Gnome Music Player Client"));
97 TEC("context new")
98 g_option_context_add_main_entries(context, entries, "gmpc");
99 TEC(" add main context")
100 g_option_context_add_group(context, gtk_get_option_group(TRUE));
101 TEC("Add gtk option group")
102 g_option_context_parse(context, argc, argv, &error);
103 TEC("Parse option group")
104 g_option_context_free(context);
105 if (error)
107 g_log(NULL, G_LOG_LEVEL_ERROR, "Failed to parse commandline options: %s", error->message);
108 g_error_free(error);
109 return FALSE;
111 return TRUE;