[aravis/timeout-resend] viewer: add a --debug option.



commit fca1beea94213cbe44bdbc00253a02c7452fb13e
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Wed Mar 2 11:26:26 2011 +0100

    viewer: add a --debug option.

 src/arvshowdevices.c |    2 ++
 viewer/arvviewer.c   |   30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/arvshowdevices.c b/src/arvshowdevices.c
index 7a80e93..9a4736e 100644
--- a/src/arvshowdevices.c
+++ b/src/arvshowdevices.c
@@ -39,6 +39,8 @@ main (int argc, char **argv)
 
 	g_option_context_free (context);
 
+	arv_debug_enable (arv_option_debug_domains);
+
 	arv_update_device_list ();
 	n_devices = arv_get_n_devices ();
 	if (n_devices < 1)
diff --git a/viewer/arvviewer.c b/viewer/arvviewer.c
index cdfd729..06750e6 100644
--- a/viewer/arvviewer.c
+++ b/viewer/arvviewer.c
@@ -528,14 +528,44 @@ arv_viewer_new (void)
 	return viewer;
 }
 
+static char *arv_viewer_option_debug_domains = NULL;
+
+static const GOptionEntry arv_viewer_option_entries[] =
+{
+	{
+		"debug", 				'd', 0, G_OPTION_ARG_STRING,
+		&arv_viewer_option_debug_domains, 	"Debug domains", NULL
+	},
+	{ NULL }
+};
+
 int
 main (int argc,char *argv[])
 {
 	ArvViewer *viewer;
+	GOptionContext *context;
+	GError *error = NULL;
+
+	g_thread_init (NULL);
+
+	context = g_option_context_new (NULL);
+	g_option_context_add_main_entries (context, arv_viewer_option_entries, NULL);
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	g_option_context_add_group (context, gst_init_get_option_group ());
+	if (!g_option_context_parse (context, &argc, &argv, &error)) {
+		g_option_context_free (context);
+		g_print ("Option parsing failed: %s\n", error->message);
+		g_error_free (error);
+		return EXIT_FAILURE;
+	}
+
+	g_option_context_free (context);
 
 	gtk_init (&argc, &argv);
 	gst_init (&argc, &argv);
 
+	arv_debug_enable (arv_viewer_option_debug_domains);
+
 	viewer = arv_viewer_new ();
 
 	arv_viewer_update_device_list_cb (viewer);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]