[gnome-desktop] Add object to get the vendor name from PNP IDs



commit ec9da39d559b127367224a80c334f89b2faa877a
Author: Bastien Nocera <hadess hadess net>
Date:   Sat Sep 17 23:14:35 2011 +0100

    Add object to get the vendor name from PNP IDs
    
    Ported from gnome-settings-daemon's color plugin.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=659358

 libgnome-desktop/Makefile.am     |    2 +
 libgnome-desktop/display-name.c  |  212 +-----------------------
 libgnome-desktop/gnome-pnp-ids.c |  340 ++++++++++++++++++++++++++++++++++++++
 libgnome-desktop/gnome-pnp-ids.h |   58 +++++++
 4 files changed, 407 insertions(+), 205 deletions(-)
---
diff --git a/libgnome-desktop/Makefile.am b/libgnome-desktop/Makefile.am
index 0c2080e..920637e 100644
--- a/libgnome-desktop/Makefile.am
+++ b/libgnome-desktop/Makefile.am
@@ -24,6 +24,7 @@ introspection_sources = 		\
 	gnome-rr-config.c		\
 	gnome-rr-output-info.c		\
 	gnome-rr-labeler.c		\
+	gnome-pnp-ids.c			\
 	gnome-wall-clock.c		\
 	edid-parse.c
 
@@ -57,6 +58,7 @@ libgnome_desktop_HEADERS = \
         gnome-rr.h                      \
         gnome-rr-config.h               \
         gnome-rr-labeler.h		\
+        gnome-pnp-ids.h			\
         gnome-wall-clock.h
 
 if USE_INTERNAL_PNP_IDS
diff --git a/libgnome-desktop/display-name.c b/libgnome-desktop/display-name.c
index 9c99d86..933b020 100644
--- a/libgnome-desktop/display-name.c
+++ b/libgnome-desktop/display-name.c
@@ -29,223 +29,25 @@
 #include <stdio.h>
 #include <string.h>
 #include <glib.h>
-#include "edid.h"
-
-typedef struct Vendor Vendor;
-struct Vendor
-{
-    const char vendor_id[4];
-    const char vendor_name[28];
-};
-
-/* This list of vendor codes derived from lshw
- * 
- * http://ezix.org/project/wiki/HardwareLiSter
- *
- * Note: we now prefer to use data coming from hwdata (and shipped with
- * gnome-desktop). See
- * http://git.fedorahosted.org/git/?p=hwdata.git;a=blob_plain;f=pnp.ids;hb=HEAD
- * All contributions to the list of vendors should go there.
- */
-static const struct Vendor vendors[] = 
-{
-    { "AIC", "AG Neovo" },
-    { "ACR", "Acer" },
-    { "DEL", "DELL" },
-    { "SAM", "SAMSUNG" },
-    { "SNY", "SONY" },
-    { "SEC", "Epson" },
-    { "WAC", "Wacom" },
-    { "NEC", "NEC" },
-    { "CMO", "CMO" },	/* Chi Mei */
-    { "BNQ", "BenQ" },
-
-    { "ABP", "Advansys" },
-    { "ACC", "Accton" },
-    { "ACE", "Accton" },
-    { "ADP", "Adaptec" },
-    { "ADV", "AMD" },
-    { "AIR", "AIR" },
-    { "AMI", "AMI" },
-    { "ASU", "ASUS" },
-    { "ATI", "ATI" },
-    { "ATK", "Allied Telesyn" },
-    { "AZT", "Aztech" },
-    { "BAN", "Banya" },
-    { "BRI", "Boca Research" },
-    { "BUS", "Buslogic" },
-    { "CCI", "Cache Computers Inc." },
-    { "CHA", "Chase" },
-    { "CMD", "CMD Technology, Inc." },
-    { "COG", "Cogent" },
-    { "CPQ", "Compaq" },
-    { "CRS", "Crescendo" },
-    { "CSC", "Crystal" },
-    { "CSI", "CSI" },
-    { "CTL", "Creative Labs" },
-    { "DBI", "Digi" },
-    { "DEC", "Digital Equipment" },
-    { "DBK", "Databook" },
-    { "EGL", "Eagle Technology" },
-    { "ELS", "ELSA" },
-    { "ESS", "ESS" },
-    { "FAR", "Farallon" },
-    { "FDC", "Future Domain" },
-    { "HWP", "Hewlett-Packard" },
-    { "IBM", "IBM" },
-    { "INT", "Intel" },
-    { "ISA", "Iomega" },
-    { "LEN", "Lenovo" },
-    { "MDG", "Madge" },
-    { "MDY", "Microdyne" },
-    { "MET", "Metheus" },
-    { "MIC", "Micronics" },
-    { "MLX", "Mylex" },
-    { "NVL", "Novell" },
-    { "OLC", "Olicom" },
-    { "PRO", "Proteon" },
-    { "RII", "Racal" },
-    { "RTL", "Realtek" },
-    { "SCM", "SCM" },
-    { "SKD", "SysKonnect" },
-    { "SGI", "SGI" },
-    { "SMC", "SMC" },
-    { "SNI", "Siemens Nixdorf" },
-    { "STL", "Stallion Technologies" },
-    { "SUN", "Sun" },
-    { "SUP", "SupraExpress" },
-    { "SVE", "SVEC" },
-    { "TCC", "Thomas-Conrad" },
-    { "TCI", "Tulip" },
-    { "TCM", "3Com" },
-    { "TCO", "Thomas-Conrad" },
-    { "TEC", "Tecmar" },
-    { "TRU", "Truevision" },
-    { "TOS", "Toshiba" },
-    { "TYN", "Tyan" },
-    { "UBI", "Ungermann-Bass" },
-    { "USC", "UltraStor" },
-    { "VDM", "Vadem" },
-    { "VMI", "Vermont" },
-    { "WDC", "Western Digital" },
-    { "ZDS", "Zeos" },
-
-    /* From http://faydoc.tripod.com/structures/01/0136.htm */
-    { "ACT", "Targa" },
-    { "ADI", "ADI" },
-    { "AOC", "AOC Intl" },
-    { "API", "Acer America" },
-    { "APP", "Apple Computer" },
-    { "ART", "ArtMedia" },
-    { "AST", "AST Research" },
-    { "CPL", "Compal" },
-    { "CTX", "Chuntex Electronic Co." },
-    { "DPC", "Delta Electronics" },
-    { "DWE", "Daewoo" },
-    { "ECS", "ELITEGROUP" },
-    { "EIZ", "EIZO" },
-    { "FCM", "Funai" },
-    { "GSM", "LG Electronics" },
-    { "GWY", "Gateway 2000" },
-    { "HEI", "Hyundai" },
-    { "HIT", "Hitachi" },
-    { "HSL", "Hansol" },
-    { "HTC", "Hitachi" },
-    { "ICL", "Fujitsu ICL" },
-    { "IVM", "Idek Iiyama" },
-    { "KFC", "KFC Computek" },
-    { "LKM", "ADLAS" },
-    { "LNK", "LINK Tech" },
-    { "LTN", "Lite-On" },
-    { "MAG", "MAG InnoVision" },
-    { "MAX", "Maxdata" },
-    { "MEI", "Panasonic" },
-    { "MEL", "Mitsubishi" },
-    { "MIR", "miro" },
-    { "MTC", "MITAC" },
-    { "NAN", "NANAO" },
-    { "NEC", "NEC Tech" },
-    { "NOK", "Nokia" },
-    { "OQI", "OPTIQUEST" },
-    { "PBN", "Packard Bell" },
-    { "PGS", "Princeton" },
-    { "PHL", "Philips" },
-    { "REL", "Relisys" },
-    { "SDI", "Samtron" },
-    { "SMI", "Smile" },
-    { "SPT", "Sceptre" },
-    { "SRC", "Shamrock Technology" },
-    { "STP", "Sceptre" },
-    { "TAT", "Tatung" },
-    { "TRL", "Royal Information Company" },
-    { "TSB", "Toshiba, Inc." },
-    { "UNM", "Unisys" },
-    { "VSC", "ViewSonic" },
-    { "WTC", "Wen Tech" },
-    { "ZCM", "Zenith Data Systems" },
-
-    { "???", "Unknown" },
-};
-
-static GHashTable *pnp_ids = NULL;
-
-static void
-read_pnp_ids (void)
-{
-    gchar *contents;
-    gchar **lines;
-    gchar *line;
-    gchar *code, *name;
-    gint i;
-
-    if (pnp_ids)
-        return;
-
-    pnp_ids = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-
-    if (g_file_get_contents (PNP_IDS, &contents, NULL, NULL))
-    {
-        lines = g_strsplit (contents, "\n", -1);
-        for (i = 0; lines[i]; i++)
-        {
-             line = lines[i];
-             if (line[0] && line[1] && line[2] && line[3] == '\t' && line[4])
-             {
-                 code = line;
-                 line[3] = '\0';
-                 name = line + 4;
-                 g_hash_table_insert (pnp_ids, code, name);
-             }
-        }
-        g_free (lines);
-        g_free (contents);
-    }
-}
 
+#include "gnome-pnp-ids.h"
+#include "edid.h"
 
 static const char *
 find_vendor (const char *code)
 {
     const char *vendor_name;
-    int i;
+    GnomePnpIds *pnp_ids;
 
-    read_pnp_ids ();
-
-    vendor_name = g_hash_table_lookup (pnp_ids, code);
+    pnp_ids = gnome_pnp_ids_new ();
+    vendor_name = gnome_pnp_ids_get_pnp_id (pnp_ids, code);
+    g_object_unref (pnp_ids);
 
     if (vendor_name)
         return vendor_name;
 
-    for (i = 0; i < sizeof (vendors) / sizeof (vendors[0]); ++i)
-    {
-	const Vendor *v = &(vendors[i]);
-
-	if (strcmp (v->vendor_id, code) == 0)
-	    return v->vendor_name;
-    }
-
     return code;
-};
+}
 
 char *
 make_display_name (const MonitorInfo *info)
diff --git a/libgnome-desktop/gnome-pnp-ids.c b/libgnome-desktop/gnome-pnp-ids.c
new file mode 100644
index 0000000..909aa52
--- /dev/null
+++ b/libgnome-desktop/gnome-pnp-ids.c
@@ -0,0 +1,340 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009-2011 Richard Hughes <richard hughsie com>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#include "gnome-pnp-ids.h"
+
+static void     gnome_pnp_ids_finalize     (GObject     *object);
+
+#define GNOME_PNP_IDS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_PNP_IDSS, GnomePnpIdsPrivate))
+
+struct _GnomePnpIdsPrivate
+{
+        gchar                           *data_dir;
+        gchar                           *table_data;
+        GHashTable                      *pnp_table;
+};
+
+static gpointer gnome_pnp_ids_object = NULL;
+
+G_DEFINE_TYPE (GnomePnpIds, gnome_pnp_ids, G_TYPE_OBJECT)
+
+typedef struct Vendor Vendor;
+struct Vendor
+{
+    const char vendor_id[4];
+    const char vendor_name[28];
+};
+
+/* This list of vendor codes derived from lshw
+ *
+ * http://ezix.org/project/wiki/HardwareLiSter
+ *
+ * Note: we now prefer to use data coming from hwdata (and shipped with
+ * gnome-desktop). See
+ * http://git.fedorahosted.org/git/?p=hwdata.git;a=blob_plain;f=pnp.ids;hb=HEAD
+ * All contributions to the list of vendors should go there.
+ */
+static const struct Vendor vendors[] =
+{
+    { "AIC", "AG Neovo" },
+    { "ACR", "Acer" },
+    { "DEL", "DELL" },
+    { "SAM", "SAMSUNG" },
+    { "SNY", "SONY" },
+    { "SEC", "Epson" },
+    { "WAC", "Wacom" },
+    { "NEC", "NEC" },
+    { "CMO", "CMO" },        /* Chi Mei */
+    { "BNQ", "BenQ" },
+
+    { "ABP", "Advansys" },
+    { "ACC", "Accton" },
+    { "ACE", "Accton" },
+    { "ADP", "Adaptec" },
+    { "ADV", "AMD" },
+    { "AIR", "AIR" },
+    { "AMI", "AMI" },
+    { "ASU", "ASUS" },
+    { "ATI", "ATI" },
+    { "ATK", "Allied Telesyn" },
+    { "AZT", "Aztech" },
+    { "BAN", "Banya" },
+    { "BRI", "Boca Research" },
+    { "BUS", "Buslogic" },
+    { "CCI", "Cache Computers Inc." },
+    { "CHA", "Chase" },
+    { "CMD", "CMD Technology, Inc." },
+    { "COG", "Cogent" },
+    { "CPQ", "Compaq" },
+    { "CRS", "Crescendo" },
+    { "CSC", "Crystal" },
+    { "CSI", "CSI" },
+    { "CTL", "Creative Labs" },
+    { "DBI", "Digi" },
+    { "DEC", "Digital Equipment" },
+    { "DBK", "Databook" },
+    { "EGL", "Eagle Technology" },
+    { "ELS", "ELSA" },
+    { "ESS", "ESS" },
+    { "FAR", "Farallon" },
+    { "FDC", "Future Domain" },
+    { "HWP", "Hewlett-Packard" },
+    { "IBM", "IBM" },
+    { "INT", "Intel" },
+    { "ISA", "Iomega" },
+    { "LEN", "Lenovo" },
+    { "MDG", "Madge" },
+    { "MDY", "Microdyne" },
+    { "MET", "Metheus" },
+    { "MIC", "Micronics" },
+    { "MLX", "Mylex" },
+    { "NVL", "Novell" },
+    { "OLC", "Olicom" },
+    { "PRO", "Proteon" },
+    { "RII", "Racal" },
+    { "RTL", "Realtek" },
+    { "SCM", "SCM" },
+    { "SKD", "SysKonnect" },
+    { "SGI", "SGI" },
+    { "SMC", "SMC" },
+    { "SNI", "Siemens Nixdorf" },
+    { "STL", "Stallion Technologies" },
+    { "SUN", "Sun" },
+    { "SUP", "SupraExpress" },
+    { "SVE", "SVEC" },
+    { "TCC", "Thomas-Conrad" },
+    { "TCI", "Tulip" },
+    { "TCM", "3Com" },
+    { "TCO", "Thomas-Conrad" },
+    { "TEC", "Tecmar" },
+    { "TRU", "Truevision" },
+    { "TOS", "Toshiba" },
+    { "TYN", "Tyan" },
+    { "UBI", "Ungermann-Bass" },
+    { "USC", "UltraStor" },
+    { "VDM", "Vadem" },
+    { "VMI", "Vermont" },
+    { "WDC", "Western Digital" },
+    { "ZDS", "Zeos" },
+
+    /* From http://faydoc.tripod.com/structures/01/0136.htm */
+    { "ACT", "Targa" },
+    { "ADI", "ADI" },
+    { "AOC", "AOC Intl" },
+    { "API", "Acer America" },
+    { "APP", "Apple Computer" },
+    { "ART", "ArtMedia" },
+    { "AST", "AST Research" },
+    { "CPL", "Compal" },
+    { "CTX", "Chuntex Electronic Co." },
+    { "DPC", "Delta Electronics" },
+    { "DWE", "Daewoo" },
+    { "ECS", "ELITEGROUP" },
+    { "EIZ", "EIZO" },
+    { "FCM", "Funai" },
+    { "GSM", "LG Electronics" },
+    { "GWY", "Gateway 2000" },
+    { "HEI", "Hyundai" },
+    { "HIT", "Hitachi" },
+    { "HSL", "Hansol" },
+    { "HTC", "Hitachi" },
+    { "ICL", "Fujitsu ICL" },
+    { "IVM", "Idek Iiyama" },
+    { "KFC", "KFC Computek" },
+    { "LKM", "ADLAS" },
+    { "LNK", "LINK Tech" },
+    { "LTN", "Lite-On" },
+    { "MAG", "MAG InnoVision" },
+    { "MAX", "Maxdata" },
+    { "MEI", "Panasonic" },
+    { "MEL", "Mitsubishi" },
+    { "MIR", "miro" },
+    { "MTC", "MITAC" },
+    { "NAN", "NANAO" },
+    { "NEC", "NEC Tech" },
+    { "NOK", "Nokia" },
+    { "OQI", "OPTIQUEST" },
+    { "PBN", "Packard Bell" },
+    { "PGS", "Princeton" },
+    { "PHL", "Philips" },
+    { "REL", "Relisys" },
+    { "SDI", "Samtron" },
+    { "SMI", "Smile" },
+    { "SPT", "Sceptre" },
+    { "SRC", "Shamrock Technology" },
+    { "STP", "Sceptre" },
+    { "TAT", "Tatung" },
+    { "TRL", "Royal Information Company" },
+    { "TSB", "Toshiba, Inc." },
+    { "UNM", "Unisys" },
+    { "VSC", "ViewSonic" },
+    { "WTC", "Wen Tech" },
+    { "ZCM", "Zenith Data Systems" },
+
+    { "???", "Unknown" },
+};
+
+static gboolean
+gnome_pnp_ids_load (GnomePnpIds *pnp_ids, GError **error)
+{
+        gboolean ret;
+        gchar *filename = NULL;
+        gchar *retval = NULL;
+        GnomePnpIdsPrivate *priv = pnp_ids->priv;
+        guint i;
+
+        /* load the contents */
+        g_debug ("loading: %s", PNP_IDS);
+        ret = g_file_get_contents (PNP_IDS, &priv->table_data, NULL, error);
+        if (!ret)
+                goto out;
+
+        /* parse into lines */
+        retval = priv->table_data;
+        for (i = 0; priv->table_data[i] != '\0'; i++) {
+
+                /* ignore */
+                if (priv->table_data[i] != '\n')
+                        continue;
+
+                /* convert newline to NULL */
+                priv->table_data[i] = '\0';
+
+                /* the ID to text is a fixed offset */
+                retval[3] = '\0';
+                g_hash_table_insert (priv->pnp_table,
+                                     retval,
+                                     retval+4);
+                retval = &priv->table_data[i+1];
+        }
+out:
+        g_free (filename);
+        return ret;
+}
+
+static const char *
+find_vendor (const char *pnp_id)
+{
+        guint i;
+
+        for (i = 0; i < G_N_ELEMENTS (vendors); i++) {
+                if (g_strcmp0 (vendors[i].vendor_id, pnp_id) == 0)
+                        return vendors[i].vendor_name;
+        }
+
+        return NULL;
+}
+
+/**
+ * gnome_pnp_ids_get_pnp_id:
+ *
+ * @pnp_ids: a #GnomePnpIds object
+ * @pnp_id: the PNP ID to look for
+ *
+ * Find the full manufacturer name for the given PNP ID.
+ *
+ * Returns: (transfer full): a new string representing the manufacturer name,
+ * or %NULL when not found.
+ */
+gchar *
+gnome_pnp_ids_get_pnp_id (GnomePnpIds *pnp_ids, const gchar *pnp_id)
+{
+        GnomePnpIdsPrivate *priv = pnp_ids->priv;
+        const char *found;
+        guint size;
+
+        g_return_val_if_fail (GNOME_IS_PNP_IDSS (pnp_ids), NULL);
+        g_return_val_if_fail (pnp_id != NULL, NULL);
+
+        /* if table is empty, try to load it */
+        size = g_hash_table_size (priv->pnp_table);
+        if (size == 0) {
+                if (gnome_pnp_ids_load (pnp_ids, NULL) == FALSE)
+                        return NULL;
+        }
+
+        /* look this up in the table */
+        found = g_hash_table_lookup (priv->pnp_table, pnp_id);
+        if (found == NULL) {
+                found = find_vendor (pnp_id);
+                if (found == NULL)
+                        return NULL;
+        }
+
+        return g_strdup (found);
+}
+
+static void
+gnome_pnp_ids_class_init (GnomePnpIdsClass *klass)
+{
+        GObjectClass *object_class = G_OBJECT_CLASS (klass);
+        object_class->finalize = gnome_pnp_ids_finalize;
+        g_type_class_add_private (klass, sizeof (GnomePnpIdsPrivate));
+}
+
+static void
+gnome_pnp_ids_init (GnomePnpIds *pnp_ids)
+{
+        pnp_ids->priv = GNOME_PNP_IDS_GET_PRIVATE (pnp_ids);
+
+        /* we don't keep malloc'd data in the hash; instead we read it
+         * out into priv->table_data and then link to it in the hash */
+        pnp_ids->priv->pnp_table = g_hash_table_new_full (g_str_hash,
+                                                         g_str_equal,
+                                                         NULL,
+                                                         NULL);
+}
+
+static void
+gnome_pnp_ids_finalize (GObject *object)
+{
+        GnomePnpIds *pnp_ids = GNOME_PNP_IDS (object);
+        GnomePnpIdsPrivate *priv = pnp_ids->priv;
+
+        g_free (priv->data_dir);
+        g_free (priv->table_data);
+        g_hash_table_unref (priv->pnp_table);
+
+        G_OBJECT_CLASS (gnome_pnp_ids_parent_class)->finalize (object);
+}
+
+/**
+ * gnome_pnp_ids_new:
+ *
+ * Returns a reference to a #GnomePnpIds object, or creates
+ * a new one if none have been created.
+ *
+ * Returns: (transfer full): a #GnomePnpIds object.
+ */
+GnomePnpIds *
+gnome_pnp_ids_new (void)
+{
+        if (gnome_pnp_ids_object != NULL) {
+                g_object_ref (gnome_pnp_ids_object);
+        } else {
+                gnome_pnp_ids_object = g_object_new (GNOME_TYPE_PNP_IDSS, NULL);
+                g_object_add_weak_pointer (gnome_pnp_ids_object, &gnome_pnp_ids_object);
+        }
+        return GNOME_PNP_IDS (gnome_pnp_ids_object);
+}
+
diff --git a/libgnome-desktop/gnome-pnp-ids.h b/libgnome-desktop/gnome-pnp-ids.h
new file mode 100644
index 0000000..6e249a6
--- /dev/null
+++ b/libgnome-desktop/gnome-pnp-ids.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009-2010 Richard Hughes <richard hughsie com>
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __GNOME_PNP_IDS_H
+#define __GNOME_PNP_IDS_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define GNOME_TYPE_PNP_IDSS                (gnome_pnp_ids_get_type ())
+#define GNOME_PNP_IDS(o)                   (G_TYPE_CHECK_INSTANCE_CAST ((o), GNOME_TYPE_PNP_IDSS, GnomePnpIds))
+#define GNOME_PNP_IDS_CLASS(k)             (G_TYPE_CHECK_CLASS_CAST((k), GNOME_TYPE_PNP_IDSS, GnomePnpIdsClass))
+#define GNOME_IS_PNP_IDSS(o)               (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNOME_TYPE_PNP_IDSS))
+#define GNOME_IS_PNP_IDSS_CLASS(k)         (G_TYPE_CHECK_CLASS_TYPE ((k), GNOME_TYPE_PNP_IDSS))
+#define GNOME_PNP_IDS_GET_CLASS(o)         (G_TYPE_INSTANCE_GET_CLASS ((o), GNOME_TYPE_PNP_IDSS, GnomePnpIdsClass))
+#define GNOME_PNP_IDS_ERROR                (gnome_pnp_ids_error_quark ())
+
+typedef struct _GnomePnpIdsPrivate        GnomePnpIdsPrivate;
+typedef struct _GnomePnpIds               GnomePnpIds;
+typedef struct _GnomePnpIdsClass          GnomePnpIdsClass;
+
+struct _GnomePnpIds
+{
+         GObject                         parent;
+         GnomePnpIdsPrivate             *priv;
+};
+
+struct _GnomePnpIdsClass
+{
+        GObjectClass    parent_class;
+};
+
+GType            gnome_pnp_ids_get_type                    (void);
+GnomePnpIds     *gnome_pnp_ids_new                         (void);
+gchar           *gnome_pnp_ids_get_pnp_id                  (GnomePnpIds            *pnp_ids,
+                                                            const gchar            *pnp_id);
+
+G_END_DECLS
+
+#endif /* __GNOME_PNP_IDS_H */
+



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