Debian Codegraph @

lib/packagekit-glib2/pk-control.h

raw
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2 *
3 * Copyright (C) 2009 Richard Hughes <[email protected]>
4 *
5 * Licensed under the GNU Lesser General Public License Version 2.1
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library 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 GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #if !defined (__PACKAGEKIT_H_INSIDE__) && !defined (PK_COMPILATION)
23 #error "Only <packagekit.h> can be included directly."
24 #endif
25
26 #ifndef __PK_CONTROL_H
27 #define __PK_CONTROL_H
28
29 #include <glib-object.h>
30 #include <gio/gio.h>
31
32 #include <packagekit-glib2/pk-enum.h>
33
34 G_BEGIN_DECLS
35
36 #define PK_TYPE_CONTROL (pk_control_get_type ())
37 #define PK_CONTROL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_CONTROL, PkControl))
38 #define PK_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_CONTROL, PkControlClass))
39 #define PK_IS_CONTROL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_CONTROL))
40 #define PK_IS_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_CONTROL))
41 #define PK_CONTROL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_CONTROL, PkControlClass))
42 #define PK_CONTROL_ERROR (pk_control_error_quark ())
43 #define PK_CONTROL_TYPE_ERROR (pk_control_error_get_type ())
44
45 typedef struct _PkControlPrivate PkControlPrivate;
46 typedef struct _PkControl PkControl;
47 typedef struct _PkControlClass PkControlClass;
48
49 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
50 G_DEFINE_AUTOPTR_CLEANUP_FUNC(PkControl, g_object_unref)
51 #endif
52
53 /**
54 * PkControlError:
55 * @PK_CONTROL_ERROR_FAILED: the transaction failed for an unknown reason
56 * @PK_CONTROL_ERROR_CANNOT_START_DAEMON: the PackageKit daemon failed to start
57 *
58 * Errors that can be thrown
59 */
60 typedef enum
61 {
62 PK_CONTROL_ERROR_FAILED,
63 PK_CONTROL_ERROR_CANNOT_START_DAEMON
64 } PkControlError;
65
66 struct _PkControl
67 {
68 GObject parent;
69 PkControlPrivate *priv;
70 };
71
72 struct _PkControlClass
73 {
74 GObjectClass parent_class;
75
76 /* signals */
77 void (* transaction_list_changed) (PkControl *control,
78 gchar **transaction_ids);
79 void (* updates_changed) (PkControl *control);
80 void (* repo_list_changed) (PkControl *control);
81 void (* network_state_changed) (PkControl *control);
82 void (* restart_schedule) (PkControl *control);
83 void (* locked) (PkControl *control,
84 gboolean is_locked);
85 void (* connection_changed) (PkControl *control,
86 gboolean connected);
87 void (* installed_changed) (PkControl *control);
88 /* padding for future expansion */
89 void (*_pk_reserved1) (void);
90 void (*_pk_reserved2) (void);
91 void (*_pk_reserved3) (void);
92 void (*_pk_reserved4) (void);
93 };
94
95 GQuark pk_control_error_quark (void);
96 GType pk_control_get_type (void);
97 PkControl *pk_control_new (void);
98
99 void pk_control_get_tid_async (PkControl *control,
100 GCancellable *cancellable,
101 GAsyncReadyCallback callback,
102 gpointer user_data);
103 gchar *pk_control_get_tid_finish (PkControl *control,
104 GAsyncResult *res,
105 GError **error);
106 void pk_control_suggest_daemon_quit_async (PkControl *control,
107 GCancellable *cancellable,
108 GAsyncReadyCallback callback,
109 gpointer user_data);
110 gboolean pk_control_suggest_daemon_quit_finish (PkControl *control,
111 GAsyncResult *res,
112 GError **error);
113 void pk_control_get_daemon_state_async (PkControl *control,
114 GCancellable *cancellable,
115 GAsyncReadyCallback callback,
116 gpointer user_data);
117 gchar *pk_control_get_daemon_state_finish (PkControl *control,
118 GAsyncResult *res,
119 GError **error);
120 void pk_control_set_proxy_async (PkControl *control,
121 const gchar *proxy_http,
122 const gchar *proxy_ftp,
123 GCancellable *cancellable,
124 GAsyncReadyCallback callback,
125 gpointer user_data);
126 void pk_control_set_proxy2_async (PkControl *control,
127 const gchar *proxy_http,
128 const gchar *proxy_https,
129 const gchar *proxy_ftp,
130 const gchar *proxy_socks,
131 const gchar *no_proxy,
132 const gchar *pac,
133 GCancellable *cancellable,
134 GAsyncReadyCallback callback,
135 gpointer user_data);
136 gboolean pk_control_set_proxy_finish (PkControl *control,
137 GAsyncResult *res,
138 GError **error);
139 void pk_control_get_time_since_action_async (PkControl *control,
140 PkRoleEnum role,
141 GCancellable *cancellable,
142 GAsyncReadyCallback callback,
143 gpointer user_data);
144 guint pk_control_get_time_since_action_finish (PkControl *control,
145 GAsyncResult *res,
146 GError **error);
147 void pk_control_get_transaction_list_async (PkControl *control,
148 GCancellable *cancellable,
149 GAsyncReadyCallback callback,
150 gpointer user_data);
151 gchar **pk_control_get_transaction_list_finish (PkControl *control,
152 GAsyncResult *res,
153 GError **error);
154 void pk_control_can_authorize_async (PkControl *control,
155 const gchar *action_id,
156 GCancellable *cancellable,
157 GAsyncReadyCallback callback,
158 gpointer user_data);
159 PkAuthorizeEnum pk_control_can_authorize_finish (PkControl *control,
160 GAsyncResult *res,
161 GError **error);
162 void pk_control_get_properties_async (PkControl *control,
163 GCancellable *cancellable,
164 GAsyncReadyCallback callback,
165 gpointer user_data);
166 gboolean pk_control_get_properties_finish (PkControl *control,
167 GAsyncResult *res,
168 GError **error);
169
170 G_END_DECLS
171
172 #endif /* __PK_CONTROL_H */
173