| 1 |
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- |
| 2 |
* |
| 3 |
* Copyright (C) 2011 Richard Hughes <[email protected]> |
| 4 |
* |
| 5 |
* Licensed under the GNU General Public License Version 2 |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software |
| 19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef __CD_PLUGIN_H |
| 23 |
#define __CD_PLUGIN_H |
| 24 |
|
| 25 |
#include <glib-object.h> |
| 26 |
#include <colord-private.h> |
| 27 |
|
| 28 |
#include "cd-device.h" |
| 29 |
|
| 30 |
G_BEGIN_DECLS |
| 31 |
|
| 32 |
typedef struct CdPlugin CdPlugin; |
| 33 |
typedef struct CdPluginPrivate CdPluginPrivate; |
| 34 |
|
| 35 |
typedef const gchar *(*CdPluginGetDescFunc) (void); |
| 36 |
typedef void (*CdPluginFunc) (CdPlugin *plugin); |
| 37 |
typedef void (*CdPluginDeviceFunc) (CdPlugin *plugin, |
| 38 |
CdDevice *device, |
| 39 |
gpointer user_data); |
| 40 |
typedef gboolean (*CdPluginEnabledFunc) (void); |
| 41 |
|
| 42 |
struct CdPlugin { |
| 43 |
GModule *module; |
| 44 |
CdPluginPrivate *priv; |
| 45 |
gpointer user_data; |
| 46 |
CdPluginDeviceFunc device_added; |
| 47 |
CdPluginDeviceFunc device_removed; |
| 48 |
}; |
| 49 |
|
| 50 |
typedef enum { |
| 51 |
CD_PLUGIN_PHASE_INIT, /* plugin started */ |
| 52 |
CD_PLUGIN_PHASE_DESTROY, /* plugin finalized */ |
| 53 |
CD_PLUGIN_PHASE_COLDPLUG, /* system ready for devices */ |
| 54 |
CD_PLUGIN_PHASE_STATE_CHANGED, /* system state has changed */ |
| 55 |
CD_PLUGIN_PHASE_UNKNOWN |
| 56 |
} CdPluginPhase; |
| 57 |
|
| 58 |
#define CD_PLUGIN_GET_PRIVATE(x) g_new0 (x,1) |
| 59 |
|
| 60 |
const gchar *cd_plugin_get_description (void); |
| 61 |
void cd_plugin_initialize (CdPlugin *plugin); |
| 62 |
void cd_plugin_coldplug (CdPlugin *plugin); |
| 63 |
void cd_plugin_destroy (CdPlugin *plugin); |
| 64 |
void cd_plugin_state_changed (CdPlugin *plugin); |
| 65 |
|
| 66 |
void cd_plugin_device_added (CdPlugin *plugin, |
| 67 |
CdDevice *device); |
| 68 |
void cd_plugin_device_removed (CdPlugin *plugin, |
| 69 |
CdDevice *device); |
| 70 |
|
| 71 |
/* optional function which returns false if plugin should not be enabled */ |
| 72 |
gboolean cd_plugin_config_enabled (void); |
| 73 |
|
| 74 |
G_END_DECLS |
| 75 |
|
| 76 |
#endif /* __CD_PLUGIN_H */ |