[gnome-builder] log: handle early verbosity check
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] log: handle early verbosity check
- Date: Mon, 21 Dec 2015 08:08:06 +0000 (UTC)
commit b35d3de7c6c79958b60a3296b58f4f2b26132ef1
Author: Christian Hergert <chergert redhat com>
Date: Thu Dec 17 21:14:51 2015 -0800
log: handle early verbosity check
libide/ide-application-command-line.c | 2 +-
src/main.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/libide/ide-application-command-line.c b/libide/ide-application-command-line.c
index 525ace1..52cd365 100644
--- a/libide/ide-application-command-line.c
+++ b/libide/ide-application-command-line.c
@@ -133,7 +133,7 @@ ide_application_get_command_help (IdeApplication *self,
static gboolean
ide_application_increase_verbosity (void)
{
- ide_log_increase_verbosity ();
+ /* handled during early init */
return TRUE;
}
diff --git a/src/main.c b/src/main.c
index 06df1a8..170c58b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -16,8 +16,38 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#define G_LOG_DOMAIN "builder"
+
#include <ide.h>
+static gboolean
+verbose_cb (const gchar *option_name,
+ const gchar *value,
+ gpointer data,
+ GError **error)
+{
+ ide_log_increase_verbosity ();
+ return TRUE;
+}
+
+static void
+early_verbose_check (gint *argc,
+ gchar ***argv)
+{
+ GOptionContext *context;
+ static const GOptionEntry entries[] = {
+ { "verbose", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, verbose_cb },
+ { NULL }
+ };
+
+ context = g_option_context_new (NULL);
+ g_option_context_set_ignore_unknown_options (context, TRUE);
+ g_option_context_set_help_enabled (context, FALSE);
+ g_option_context_add_main_entries (context, entries, NULL);
+ g_option_context_parse (context, argc, argv, NULL);
+ g_option_context_free (context);
+}
+
int
main (int argc,
char *argv[])
@@ -27,6 +57,8 @@ main (int argc,
ide_log_init (TRUE, NULL);
+ early_verbose_check (&argc, &argv);
+
g_message ("Initializing with Gtk+ version %d.%d.%d.",
gtk_get_major_version (),
gtk_get_minor_version (),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]