Debian Codegraph @

lib/packagekit-glib2/pk-progress.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_PROGRESS_H
27 #define __PK_PROGRESS_H
28
29 #include <glib-object.h>
30 #include <packagekit-glib2/pk-enum.h>
31 #include <packagekit-glib2/pk-package.h>
32 #include <packagekit-glib2/pk-item-progress.h>
33
34 G_BEGIN_DECLS
35
36 #define PK_TYPE_PROGRESS (pk_progress_get_type ())
37 #define PK_PROGRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_PROGRESS, PkProgress))
38 #define PK_PROGRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_PROGRESS, PkProgressClass))
39 #define PK_IS_PROGRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_PROGRESS))
40 #define PK_IS_PROGRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_PROGRESS))
41 #define PK_PROGRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_PROGRESS, PkProgressClass))
42 #define PK_PROGRESS_TYPE_ERROR (pk_progress_error_get_type ())
43
44 typedef struct _PkProgressPrivate PkProgressPrivate;
45 typedef struct _PkProgress PkProgress;
46 typedef struct _PkProgressClass PkProgressClass;
47
48 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
49 G_DEFINE_AUTOPTR_CLEANUP_FUNC(PkProgress, g_object_unref)
50 #endif
51
52 struct _PkProgress
53 {
54 GObject parent;
55 PkProgressPrivate *priv;
56 };
57
58 struct _PkProgressClass
59 {
60 GObjectClass parent_class;
61 /* padding for future expansion */
62 void (*_pk_reserved1) (void);
63 void (*_pk_reserved2) (void);
64 void (*_pk_reserved3) (void);
65 void (*_pk_reserved4) (void);
66 void (*_pk_reserved5) (void);
67 };
68
69 GType pk_progress_get_type (void);
70 PkProgress *pk_progress_new (void);
71
72 /**
73 * PkProgressType:
74 * @PK_PROGRESS_TYPE_PACKAGE_ID: package id updated
75 * @PK_PROGRESS_TYPE_TRANSACTION_ID: transaction ID updated
76 * @PK_PROGRESS_TYPE_PERCENTAGE: percentage updated
77 * @PK_PROGRESS_TYPE_ALLOW_CANCEL: allow cancel updated
78 * @PK_PROGRESS_TYPE_STATUS: status updated
79 * @PK_PROGRESS_TYPE_ROLE: role updated
80 * @PK_PROGRESS_TYPE_CALLER_ACTIVE: called active updated
81 * @PK_PROGRESS_TYPE_ELAPSED_TIME: elapsed time updated
82 * @PK_PROGRESS_TYPE_REMAINING_TIME: remaining time updated
83 * @PK_PROGRESS_TYPE_SPEED: speed updated
84 * @PK_PROGRESS_TYPE_DOWNLOAD_SIZE_REMAINING: download size remaining updated
85 * @PK_PROGRESS_TYPE_UID: uid updated
86 * @PK_PROGRESS_TYPE_PACKAGE: package updated
87 * @PK_PROGRESS_TYPE_ITEM_PROGRESS: item progress updated
88 * @PK_PROGRESS_TYPE_TRANSACTION_FLAGS: transaction flags updated
89 * @PK_PROGRESS_TYPE_SENDER: D-Bus name of sender updated (Since: 1.2.6)
90 * @PK_PROGRESS_TYPE_INVALID:
91 *
92 * Flag to show which progress field has been updated.
93 **/
94 typedef enum {
95 PK_PROGRESS_TYPE_PACKAGE_ID,
96 PK_PROGRESS_TYPE_TRANSACTION_ID,
97 PK_PROGRESS_TYPE_PERCENTAGE,
98 PK_PROGRESS_TYPE_ALLOW_CANCEL,
99 PK_PROGRESS_TYPE_STATUS,
100 PK_PROGRESS_TYPE_ROLE,
101 PK_PROGRESS_TYPE_CALLER_ACTIVE,
102 PK_PROGRESS_TYPE_ELAPSED_TIME,
103 PK_PROGRESS_TYPE_REMAINING_TIME,
104 PK_PROGRESS_TYPE_SPEED,
105 PK_PROGRESS_TYPE_DOWNLOAD_SIZE_REMAINING,
106 PK_PROGRESS_TYPE_UID,
107 PK_PROGRESS_TYPE_PACKAGE,
108 PK_PROGRESS_TYPE_ITEM_PROGRESS,
109 PK_PROGRESS_TYPE_TRANSACTION_FLAGS,
110 PK_PROGRESS_TYPE_INVALID,
111 PK_PROGRESS_TYPE_SENDER
112 } PkProgressType;
113
114 /**
115 * PkProgressCallback:
116 * @progress: a #PkProgress
117 * @type: the type of progress update this is
118 * @user_data: User data supplied when the callback was registered.
119 *
120 * Function that is called when progress updates are given.
121 */
122 typedef void (*PkProgressCallback) (PkProgress *progress,
123 PkProgressType type,
124 gpointer user_data);
125
126 gboolean pk_progress_set_package_id (PkProgress *progress,
127 const gchar *package_id);
128 const gchar *pk_progress_get_package_id (PkProgress *progress);
129 gboolean pk_progress_set_item_progress (PkProgress *progress,
130 PkItemProgress *item_progress);
131 PkItemProgress *pk_progress_get_item_progress (PkProgress *progress);
132 gboolean pk_progress_set_transaction_id (PkProgress *progress,
133 const gchar *transaction_id);
134 const gchar *pk_progress_get_transaction_id (PkProgress *progress);
135 gboolean pk_progress_set_percentage (PkProgress *progress,
136 gint percentage);
137 gint pk_progress_get_percentage (PkProgress *progress);
138 gboolean pk_progress_set_status (PkProgress *progress,
139 PkStatusEnum status);
140 PkStatusEnum pk_progress_get_status (PkProgress *progress);
141 gboolean pk_progress_set_role (PkProgress *progress,
142 PkRoleEnum role);
143 PkRoleEnum pk_progress_get_role (PkProgress *progress);
144 gboolean pk_progress_set_allow_cancel (PkProgress *progress,
145 gboolean allow_cancel);
146 gboolean pk_progress_get_allow_cancel (PkProgress *progress);
147 gboolean pk_progress_set_caller_active (PkProgress *progress,
148 gboolean caller_active);
149 gboolean pk_progress_get_caller_active (PkProgress *progress);
150 gboolean pk_progress_set_elapsed_time (PkProgress *progress,
151 guint elapsed_time);
152 guint pk_progress_get_elapsed_time (PkProgress *progress);
153 gboolean pk_progress_set_remaining_time (PkProgress *progress,
154 guint remaining_time);
155 guint pk_progress_get_remaining_time (PkProgress *progress);
156 gboolean pk_progress_set_speed (PkProgress *progress,
157 guint speed);
158 guint pk_progress_get_speed (PkProgress *progress);
159 gboolean pk_progress_set_download_size_remaining(PkProgress *progress,
160 guint64 download_size_remaining);
161 guint64 pk_progress_get_download_size_remaining(PkProgress *progress);
162 gboolean pk_progress_set_transaction_flags (PkProgress *progress,
163 guint64 transaction_flags);
164 guint64 pk_progress_get_transaction_flags (PkProgress *progress);
165 gboolean pk_progress_set_uid (PkProgress *progress,
166 guint uid);
167 guint pk_progress_get_uid (PkProgress *progress);
168 gboolean pk_progress_set_sender (PkProgress *progress,
169 const gchar *bus_name);
170 gchar *pk_progress_get_sender (PkProgress *progress);
171 gboolean pk_progress_set_package (PkProgress *progress,
172 PkPackage *package);
173 PkPackage *pk_progress_get_package (PkProgress *progress);
174
175 G_END_DECLS
176
177 #endif /* __PK_PROGRESS_H */