1 /* ide-device.h
2  *
3  * Copyright 2015-2019 Christian Hergert <christian@hergert.me>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  * SPDX-License-Identifier: GPL-3.0-or-later
19  */
20 
21 #pragma once
22 
23 #if !defined (IDE_FOUNDRY_INSIDE) && !defined (IDE_FOUNDRY_COMPILATION)
24 # error "Only <libide-foundry.h> can be included directly."
25 #endif
26 
27 #include <libide-core.h>
28 
29 #include "ide-foundry-types.h"
30 
31 G_BEGIN_DECLS
32 
33 typedef enum
34 {
35   IDE_DEVICE_ERROR_NO_SUCH_DEVICE = 1,
36 } IdeDeviceError;
37 
38 #define IDE_TYPE_DEVICE  (ide_device_get_type())
39 #define IDE_DEVICE_ERROR (ide_device_error_quark())
40 
41 IDE_AVAILABLE_IN_3_32
42 G_DECLARE_DERIVABLE_TYPE (IdeDevice, ide_device, IDE, DEVICE, IdeObject)
43 
44 struct _IdeDeviceClass
45 {
46   IdeObjectClass parent;
47 
48   void           (*prepare_configuration) (IdeDevice            *self,
49                                            IdeConfig     *configuration);
50   void           (*get_info_async)        (IdeDevice            *self,
51                                            GCancellable         *cancellable,
52                                            GAsyncReadyCallback   callback,
53                                            gpointer              user_data);
54   IdeDeviceInfo *(*get_info_finish)       (IdeDevice            *self,
55                                            GAsyncResult         *result,
56                                            GError              **error);
57 
58   /*< private >*/
59   gpointer _reserved[32];
60 };
61 
62 IDE_AVAILABLE_IN_3_32
63 GQuark         ide_device_error_quark           (void) G_GNUC_CONST;
64 IDE_AVAILABLE_IN_3_32
65 const gchar   *ide_device_get_display_name      (IdeDevice            *self);
66 IDE_AVAILABLE_IN_3_32
67 void           ide_device_set_display_name      (IdeDevice            *self,
68                                                  const gchar          *display_name);
69 IDE_AVAILABLE_IN_3_32
70 const gchar   *ide_device_get_icon_name         (IdeDevice            *self);
71 IDE_AVAILABLE_IN_3_32
72 void           ide_device_set_icon_name         (IdeDevice            *self,
73                                                  const gchar          *icon_name);
74 IDE_AVAILABLE_IN_3_32
75 const gchar   *ide_device_get_id                (IdeDevice            *self);
76 IDE_AVAILABLE_IN_3_32
77 void           ide_device_set_id                (IdeDevice            *self,
78                                                  const gchar          *id);
79 IDE_AVAILABLE_IN_3_32
80 void           ide_device_prepare_configuration (IdeDevice            *self,
81                                                  IdeConfig            *configuration);
82 IDE_AVAILABLE_IN_3_32
83 void           ide_device_get_info_async        (IdeDevice            *self,
84                                                  GCancellable         *cancellable,
85                                                  GAsyncReadyCallback   callback,
86                                                  gpointer              user_data);
87 IDE_AVAILABLE_IN_3_32
88 IdeDeviceInfo *ide_device_get_info_finish       (IdeDevice            *self,
89                                                  GAsyncResult         *result,
90                                                  GError              **error);
91 
92 G_END_DECLS
93