Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

device_store.h

00001 /***************************************************************************
00002  * CVSID: $Id: device_store.h,v 1.11 2004/04/03 07:46:33 david Exp $
00003  *
00004  * device.c : HalDevice methods
00005  *
00006  * Copyright (C) 2003 David Zeuthen, <david@fubar.dk>
00007  * Copyright (C) 2004 Novell, Inc.
00008  *
00009  * Licensed under the Academic Free License version 2.0
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  *
00025  **************************************************************************/
00026 
00027 #ifndef DEVICE_STORE_H
00028 #define DEVICE_STORE_H
00029 
00030 #include <glib-object.h>
00031 
00032 #include "device.h"
00033 
00034 typedef struct _HalDeviceStore      HalDeviceStore;
00035 typedef struct _HalDeviceStoreClass HalDeviceStoreClass;
00036 
00037 struct _HalDeviceStore {
00038     GObject parent;
00039 
00040     GSList *devices;
00041 };
00042 
00043 struct _HalDeviceStoreClass {
00044     GObjectClass parent_class;
00045 
00046     /* signals */
00047     void (*store_changed) (HalDeviceStore *store,
00048                    HalDevice *device,
00049                    gboolean added);
00050 
00051     void (*device_property_changed) (HalDeviceStore *store,
00052                      HalDevice *device,
00053                      const char *key,
00054                      gboolean removed,
00055                      gboolean added);
00056 
00057     void (*device_capability_added) (HalDeviceStore *store,
00058                      HalDevice *device,
00059                      const char *capability);
00060 
00061 };
00062 
00063 #define HAL_TYPE_DEVICE_STORE              (hal_device_store_get_type ())
00064 #define HAL_DEVICE_STORE(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
00065                                             HAL_TYPE_DEVICE_STORE, \
00066                                             HalDeviceStore))
00067 #define HAL_DEVICE_STORE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), \
00068                                             HAL_TYPE_DEVICE_STORE, \
00069                         HalDeviceStoreClass))
00070 #define HAL_IS_DEVICE_STORE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
00071                                             HAL_TYPE_DEVICE_STORE))
00072 #define HAL_IS_DEVICE_STORE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), \
00073                                             HAL_TYPE_DEVICE_STORE))
00074 
00075 typedef void     (*HalDeviceStoreAsyncCallback) (HalDeviceStore *store,
00076                          HalDevice      *device,
00077                          gpointer        user_data);
00078 
00079 /* Return value of FALSE means that the foreach should be short-circuited */
00080 typedef gboolean (*HalDeviceStoreForeachFn) (HalDeviceStore *store,
00081                          HalDevice      *device,
00082                          gpointer        user_data);
00083                          
00084 GType           hal_device_store_get_type   (void);
00085 
00086 HalDeviceStore *hal_device_store_new        (void);
00087 
00088 void            hal_device_store_add        (HalDeviceStore *store,
00089                          HalDevice      *device);
00090 gboolean        hal_device_store_remove     (HalDeviceStore *store,
00091                          HalDevice      *device);
00092 
00093 HalDevice      *hal_device_store_find       (HalDeviceStore *store,
00094                          const char     *udi);
00095 
00096 void            hal_device_store_foreach    (HalDeviceStore *store,
00097                          HalDeviceStoreForeachFn callback,
00098                          gpointer user_data);
00099 
00100 HalDevice      *hal_device_store_match_key_value_string (HalDeviceStore *store,
00101                              const char *key,
00102                              const char *value);
00103 GSList         *hal_device_store_match_multiple_key_value_string (HalDeviceStore *store,
00104                                   const char *key,
00105                                   const char *value);
00106 
00107 void           hal_device_store_match_key_value_string_async (HalDeviceStore *store,
00108                                   const char *key,
00109                                   const char *value,
00110                                   HalDeviceStoreAsyncCallback callback,
00111                                   gpointer user_data,
00112                                   int timeout);
00113 
00114 #endif /* DEVICE_STORE_H */

Generated on Sat Apr 24 19:57:44 2004 for HAL by doxygen 1.3.6-20040222