[gnome-desktop] pnp-ids: Add test program



commit 8503ae8e1b860c60ea744fdc7064d090fc6690e6
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jun 20 17:28:28 2012 +0100

    pnp-ids: Add test program

 libgnome-desktop/Makefile.am    |    4 ++-
 libgnome-desktop/test-pnp-ids.c |   52 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 1 deletions(-)
---
diff --git a/libgnome-desktop/Makefile.am b/libgnome-desktop/Makefile.am
index 79c8ab0..f8e3078 100644
--- a/libgnome-desktop/Makefile.am
+++ b/libgnome-desktop/Makefile.am
@@ -120,10 +120,12 @@ gnome_rr_debug_LDADD =		\
 	$(lib_LTLIBRARIES)	\
 	$(XLIB_LIBS)
 
-noinst_PROGRAMS = test-xkb-info
+noinst_PROGRAMS = test-xkb-info test-pnp-ids
 test_xkb_info_LDADD =		\
 	$(GNOME_DESKTOP_LIBS)	\
 	$(lib_LTLIBRARIES)	\
 	$(XLIB_LIBS)
 
+test_pnp_ids_LDADD = $(test_xkb_info_LDADD)
+
 -include $(top_srcdir)/git.mk
diff --git a/libgnome-desktop/test-pnp-ids.c b/libgnome-desktop/test-pnp-ids.c
new file mode 100644
index 0000000..f357289
--- /dev/null
+++ b/libgnome-desktop/test-pnp-ids.c
@@ -0,0 +1,52 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2012 Bastien Nocera <hadess hadess net>
+ *
+ * This program 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#define GNOME_DESKTOP_USE_UNSTABLE_API
+
+#include <libgnome-desktop/gnome-pnp-ids.h>
+
+static void
+show_vendor (GnomePnpIds *ids, const char *id)
+{
+	char *vendor;
+	vendor = gnome_pnp_ids_get_pnp_id (ids, id);
+	g_message ("%s => %s", id, vendor);
+	g_free (vendor);
+}
+
+int
+main (int argc, char *argv[])
+{
+	GnomePnpIds *ids;
+	guint i;
+
+	g_type_init ();
+
+	ids = gnome_pnp_ids_new ();
+	for (i = 1; i < argc; i++)
+		show_vendor (ids, argv[i]);
+	if (argc < 2) {
+		show_vendor (ids, "ELO");
+		show_vendor (ids, "IBM");
+	}
+
+	g_object_unref (ids);
+	return 0;
+}



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